Skip to content
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

Robust save/load methods for class instances (Region, GriddedRegion, etc.) #9

Open
hdrake opened this issue Sep 9, 2023 · 0 comments

Comments

@hdrake
Copy link
Owner

hdrake commented Sep 9, 2023

The package currently does not support saving or loading regions. This would be an extremely useful feature to support because regions in high-resolution models can take a fairly long time to compute but once they are computed are cheap to reuse.

I have had some success using pickle to locally save and load class instances but there are two fatal flaws to this approach:

  1. the files written by pickle are not safe as unknown Python code may be executing while reading in a file
  2. without a stable file structure, it is not guaranteed that files written with one version of regionate will be readable by an earlier or later version.

My proposal is to create custom save and load methods that store class attributes using more robust save methods from established packages (e.g. xarray, pandas, json). I have not yet figures out how best to do this, especially when dealing with class inheritance of these methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant