Skip to content

LazyChunk#80

Merged
castelao merged 15 commits intomainfrom
subset
Jun 19, 2025
Merged

LazyChunk#80
castelao merged 15 commits intomainfrom
subset

Conversation

@castelao
Copy link
Member

Abstracting the chunk access.

We calculate the cost in full chunks at a time, thus the cost module doesn't need to understand Zarr, but just a collection of variables as ndarrays. We need a collection because the cost definition can be any combination of variables. We don't necessarily use all the variables available in the dataset, so it would be a waste to load all of them (imagine a cost based on a single variable and a features dataset with 50 variables!). Also, one variable can be used in multiple layers, so we want to reduce the I/O and load that chunk-variable only one to be used in all layers.

Instead of passing a Zarr object, we use a LazyChunk, which behaves like a HashMap, so the cost function asks for a variable, and the LazyChunk reads it in the first time, and just access on the subsequent.

The most important change here is to reduce the context in the cost module.

@castelao castelao requested a review from ppinchuk June 18, 2025 03:20
@castelao castelao self-assigned this Jun 18, 2025
@castelao castelao added the enhancement Update to logic or general code improvements label Jun 18, 2025
@ppinchuk
Copy link
Collaborator

ppinchuk commented Jun 18, 2025

To fix the failing Python pixi tests, just merge (rebase) onto main

Copy link
Collaborator

@ppinchuk ppinchuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@castelao
Copy link
Member Author

@ppinchuk , I did some few improvements/adjustments but it is not ideal yet. This could take more documentation and tests. I have to move to something else, so I'll close this one as it is and return when I have a chance.

@ppinchuk
Copy link
Collaborator

No objections, but maybe a quick commit to fix the Rust linter?

@castelao castelao merged commit d87244d into main Jun 19, 2025
22 checks passed
@castelao castelao deleted the subset branch June 19, 2025 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Update to logic or general code improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants