-
Notifications
You must be signed in to change notification settings - Fork 15
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
Fix downscaling large models #145
Conversation
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.
Generally this looks good to me! I've added to minor suggestions and one suggestion for future performance improvements which can perhaps be added an issue or TODO comment in the code.
hydromt_sfincs/utils.py
Outdated
with rasterio.open(dep) as src: | ||
# Define block size | ||
n1, m1 = src.shape | ||
nrcb = 2000 # nr of cells in a block |
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.
set as argument?
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.
Good one, added an nrmax (similar as in setup_subgrid) argument.
# check for nan-data | ||
if np.all(np.isnan(block_data)): | ||
continue | ||
# Convert row and column indices to pixel coordinates |
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.
I don't think we need to do this now, but since we are working with rasterio (rather than xarray) it would make sense to also directly use the rasterio warp method rather than the raster.reproject method in _downscale_floodmap_da
. I think this could provide quite a significant performance improvement. That would affect the whole block of code below this line.
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 suggestion but let's postpone that for now. I added a TODO to the code
Co-authored-by: DirkEilander <dirk.eilander@gmail.com>
…s/hydromt_sfincs into fix_downscaling_large_models
…tares/hydromt_sfincs into fix_downscaling_large_models
…o fix_downscaling_large_models
Note this PR builds upon #144 and it solves issue #127