Open asross opened 2 years ago
Yes this is a good idea. We have done similar stuff when we needed to restart a model.
Ideally we could define a netCDF schema that contains:
To implement this, I would write two functions.
Model.checkpoint('checkpoint.nc')
- the challenge here is discovering all of the necessary attributes to save from each subclass 🤔 from_checkpoint('checkpoint.nc')
(top level function)
Currently, it's pretty difficult to save and load pyqg models. Trying to do it with
pickle.dump
andpickle.load
doesn't work because of Cython issues, and trying to do it with netcdf files is also a bit tricky. This is currently the shortest way I know how to save and load apyqg.Model
:This is a lot of work, and I would love to be able to just do:
Would this feature be useful, and is there a better way we can implement it other than the hacky code I just sketched out?