Skip to content

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

@hdrake

Description

@hdrake

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions