Open
Conversation
Only opens one file, using metadata to construct Dask chunks for all other files. This greatly reduces the time needed to open a dataset.
Sorting out imports
Collaborator
|
Wow, very cool! I see you made a new function for this. How come we can't just modify the original one? |
Contributor
Author
The next step is to modify the original |
If opening a set of NetCDF files that are all in the same directory, use lazy_open_boutdataset. This is a common use-case and is significantly faster this way. For more complicated cases (e.g. concatenating multiple BOUT++ runs), or if `lazy_load = False`, fall back to the old method.
Merge ds.metadata only if it exists.
Testing uses lists of datasets rather than glob string input.
Collaborator
|
I load with absolute paths most of the time, and the glob you used only works for relative paths. I just pushed a fix. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds a
xbout.lazy_open_boutdatasetfunction that reads collections ofdmporrestartfiles by opening one file, then using metadata to construct Dask chunks for all other files without opening them. No merging of datasets needed.This greatly reduces the time needed to open a dataset.
xbout.open_boutdatasetis modified so that if we are opening a collection of NetCDF files that are all in the same directory (a common use-case) thenlazy_open_datasetwill be used unless disabled withlazy_load=False.Simple test case from
hermes-perftest. 10 files. (t, x, y, z) sizes (1, 16, 50, 1) without X or Y boundaries.Current approach:
New default approach:
Gridfile and geometry loading is handled in the same way as before.