-
Notifications
You must be signed in to change notification settings - Fork 20
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
On ppan, use hsmget to copy model files before opening #144
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.
Ran this successfully with hsmget, everything looks good!
|
||
def __call__(self, path_or_paths): | ||
if which('hsmget') is None or not self._dirs_exist(): | ||
# If hsmget or /archive, /ptmp, etc are not available, this will just return the input path(s). |
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.
Since this assumes the user has already module loaded hsmget, maybe we should tell the user somewhere to run that command beforehand if they want to use hsmget?
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 idea! I added a reminder to the log message, a comment, and a note in the README.
return xarray.open_mfdataset(files)[var] | ||
# For now, replicate previous behavior by looking for a single file covering 1993--2019, | ||
# and if not found then looking for multiple files written in either yearly or 5-yearly chunks. | ||
# Later this can be replaced to more intelligently look for the right file(s). |
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 like this comment intelligently look for the right file(s)
: )
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 have a PR ready for once this one is merged 😃
Another PR to build towards working with an updated historical simulation. This one adds a wrapper around the
hsmget
tool and uses it in theopen_var
function so that model data is opened from /vftmp instead of /archive.The general usage is
If the above is run on ppan, it will copy the file from archive to
/ptmp/$USER/archive/acr/fre/NWA/2025_01/NWA12_COBALT_2025_01/gfdl.ncrc6-intel23-prod-hdf5/pp/ocean_monthly/ts/monthly/5yr/ocean_monthly.199301-199712.ssh.nc
And then from there to
/vftmp/$USER/pid####/archive/acr/fre/NWA/2025_01/NWA12_COBALT_2025_01/gfdl.ncrc6-intel23-prod-hdf5/pp/ocean_monthly/ts/monthly/5yr/ocean_monthly.199301-199712.ssh.nc
Finally it will return the above /vftmp path as a
Path
.Future runs of the script from the same ppan session will use the vftmp file immediately. Otherwise, the file will be quickly copied from ptmp as long as that hasn't been swept.
The biggest advantage of this function would be to work with the raw history files, since frepp will also cache those files in the same place on /ptmp. It's still an improvement to not read the post-processed files directly from archive, though.
If the hsmget module isn't loaded or the script isn't running on ppan,
hsmget()
should just do nothing and directly return the input path(s), allowing them to be opened as usual.