Repository navigation
Issue #1144 rechunk projectfile data - #1925
Conversation
ClaireDons
left a comment
There was a problem hiding this comment.
Looks good, just a small nitpick about docstrings as usual. I think it makes sense to make this public in some way since it might be a significant performance increase in a lot of cases. If we don't want to change the default behaviour then we could add a "chunk_by" flag or so that makes this behaviour optional for users and document when to use it.
| headers: list[dict[str, Any]] | None = None, | ||
| ): | ||
| """ | ||
| Open IDF files chunked by time. |
There was a problem hiding this comment.
Docstrings could be a little more descriptive about why you might want to choose this or its purpose. Especially because there are quite a few "open" methods.
|
Right, I've added an option |



Fixes #1144
Description
This PR builts further upon the ground work and research that went into: #1886 . So you can check that for additional context. I decided not to rechunk, as mentioned in the issue, as in earlier testing for #1886 I found out that rechunking still takes quite some time with very large graphs, as the huge task graph is first optimized by dask before rechunking, which doesn't scale well.
Most relevant changes are in imod/formats/idf.py
This PR adds adds a
imod.formats.idf.open_chunked_by_timefunction, which opens a set of IDFs chunked by layer instead of by time. So the task graph is more optimized. A performance test is added for a set of 32_000 idfs (40 layers 800 timesteps). Opening and loading takes 23 seconds, compared to more than 10 minutes just callingimod.idf.open.The
imod.formats.prj.open_dataroutine calls the new function now .I haven't added
imod.formats.idf.open_chunked_by_timeto the public API yet (so included in the docs and under theimod.idfnamespace), as I'm not sure about theheadersargument in the signature. What do you think? We could do it, and it could even replacereplaceimod.idf.open, as it is a lot more performant in most cases. But that is something to be discussed with users.Boyscouting:
EDIT:
The 2 issues discovered by Sonartype about the cognitive overload of two functions in
imod.formatsare not new. This functions were untouched and not part of this PR.Checklist
Issue #nr, e.g.Issue #737pixi run generate-sbomand committed changes