-
Notifications
You must be signed in to change notification settings - Fork 5
Issue #1698 Model write optimization #1700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JoerivanEngelen
merged 37 commits into
master
from
issue_#1698_model_write_optimization
Oct 30, 2025
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
9ea9075
Optimize modelsplitter
Manangka 07cad1a
Remove old slice_model method
Manangka 0b631fa
Clean up modelsplitter
Manangka 29b6f8d
Refactor modelsplitter
Manangka 5457c49
Add documentation to the split method. More cleaning up
Manangka 6b71831
Fix incorrect use of item()
Manangka f72c774
Directly call any() on the dask array
Manangka c201314
Fix regrid error due to use of wrong interface
Manangka f19553c
Rvert to earlier more efficient evaluation of has_overlap. Optimize r…
Manangka 9a99506
Revert chunk optimization when opening zarr or nc files. Its not genr…
Manangka 372c1f7
Merge branch 'master' into model_splitter_optimization
Manangka 8567903
Apply review comment
Manangka cbe5624
Fix incorrect order of removing non-spatial dims
Manangka f37972f
Fix lint error
Manangka a32e989
Refactor updating of th buy and ssm package after splitting. Refactor…
Manangka 04f746e
Add comments to the ModelSplitter class
Manangka ba1e808
Add chunking when opening netcdf files. Handle errors for code that d…
Manangka 67ca384
Merge branch 'master' into model_splitter_optimization
Manangka e86f735
Move logic to test whether to skip a package into its own method. Do …
JoerivanEngelen 1967f2d
Rename to update_dependent_packages
JoerivanEngelen c265e41
Reflow paragraphs to 80 characters.
JoerivanEngelen dd47d59
Change hardcoded reference to "index" to call to .is_empty()
JoerivanEngelen 0273210
Add trim_time_dimension logic to ModelSplitter
JoerivanEngelen 5afc773
format
JoerivanEngelen 7f87bf6
Fix mypy errors
JoerivanEngelen 037bd18
revert toml and lock file
JoerivanEngelen d5129f7
Merge branch 'master' into model_splitter_optimization
JoerivanEngelen 86fd4a4
Update changelog
JoerivanEngelen 6df0093
Reduce cognitive load a bit
JoerivanEngelen 59157e0
Merge branch 'master' into model_splitter_optimization
JoerivanEngelen e8ce8f5
Merge branch 'model_splitter_optimization' into issue_#1698_model_wri…
JoerivanEngelen 9b9ac40
Merge branch 'master' into issue_#1698_model_write_optimization
JoerivanEngelen 01deede
Move compute upwards
JoerivanEngelen 2eda736
Move string conversion to base class deserialization; remove redundan…
JoerivanEngelen 8d48854
Remove ruff warning
JoerivanEngelen b1e9bd2
Remove NETCDF4 format specification from HFB to_netcdf call
JoerivanEngelen f68f2b5
Fix broken test with extra compute call
JoerivanEngelen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -316,11 +316,15 @@ def is_spatial_grid(_: Any) -> bool: # noqa: F811 | |
|
|
||
| @dispatch | ||
| def is_equal(array1: xu.UgridDataArray, array2: xu.UgridDataArray) -> bool: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice optimization shortcut! |
||
| if not is_same_domain(array1, array2): | ||
| return False | ||
| return array1.equals(array2) and array1.ugrid.grid.equals(array2.ugrid.grid) | ||
|
|
||
|
|
||
| @dispatch # type: ignore[no-redef] | ||
| def is_equal(array1: xr.DataArray, array2: xr.DataArray) -> bool: # noqa: F811 | ||
| if not is_same_domain(array1, array2): | ||
| return False | ||
| return array1.equals(array2) | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting that this is necessary! I think we can probably load top and bottom in the beginning of the function? Then it is more explicit and performance for consecutive computations will be faster.