Conversation
* Always load hazard raster data into chunked dask arrays. * Support both dask and numpy DataArrays being passed as hazard data.
|
This change does enable to use the .from_raster_xarray method instead of my custom method for my hazard file without running into memory issues 👍 |
Actually, I realize that depending on the previous memory allocation I still run into a memory error. I'm not sure if the chunking could be made more efficient, or if it's just too much for my laptop anyways and I either pre-slice the data to a smaller extent (like in my custom function), or run it on euler if I need the full extent. |
Xarray does not check how much memory in your system is already in use. I currently set ds = xr.open_dataset("file.nc", chunks=dict(time=100, chy=-1, chx=-1))
hazard = Hazard.from_raster_xarray(ds, **kwargs) |
|
@emanuel-schmid The |
rather again than still ;) |
|
tests are running and I'm gonna include |
Co-authored-by: Emanuel Schmid <[email protected]>
|
Let me quickly come back to a topic related to a previous PR, not really related to this one but by the method concerned: |
@emanuel-schmid In the Hazard class, we distinguish certain events, that can occur at the same or different times. However, most hazard datasets contain a time variable, but not an event variable. So the choice was made to use the most reasonable default value, but to still call the key |
|
Yes, that makes sense. 👍 I've added a note to this respect in the pydoc string in case somebody else is wondering. Feel free to revert if it isn't appropriate. |
|
Very good! 🤩 |
|
@emanuel-schmid Is this ready to go from your perspective? |
|
🎉 Ready to go, from my perspective. |
|
🙇♂️ many thanks! |
Changes proposed in this PR:
sparseas new dependency for that taskThis PR fixes #544, an issue raised during the review of #507
PR Author Checklist
develop)PR Reviewer Checklist