Fix how forcing data is read in#56
Open
mnlevy1981 wants to merge 4 commits into
Open
Conversation
Using open_mfdataset() in data_wrangling.py caused our forcing dataset to be chunked in time. This didn't play nicely with xr.map_blocks(), resulting in the wrong forcing data being available when trying to read multiple netcdf files (such as the 0.1 degree POP time series files). Using xr.open_dataset() and then merging all the datasets does not introduce chunking in the time dimension, so xr.map_blocks() receives the entire forcing dataset. Note that this increases the memory footprint, especially in the Run Multiple Years (highres) notebook. I've had trouble getting enough resources on casper to run two years at a time.
To decrease memory usage, create temporary forcing stream files that only include years that might be used by the current run (based on start_year and nyears). That's start_year-1, start_year, ... start_year + nyears -1 (end_year), and start_year + nyears
Also update Run Multiple Years (highres).ipynb to only use one year of forcing at a time (by creating temporary forcing stream files)
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.
Using
open_mfdataset()indata_wrangling.pycaused our forcing dataset to be chunked intime. This didn't play nicely withxr.map_blocks(), resulting in the wrong forcing data being available when trying to read multiple netcdf files (such as the 0.1 degree POP time series files). Usingxr.open_dataset()and then merging all the datasets does not introduce chunking in thetimedimension, soxr.map_blocks()receives the entire forcing dataset.Note that this increases the memory footprint, especially in the Run Multiple Years (highres) notebook. I've had trouble getting enough resources on casper to run two years at a time.
@rmshkv -- do you want to play with this branch and see if you can get two years per run with the 0.1 degree forcing? Or should we bring it in as-is and then figure out how to update the notebook later?