nextsimhub / nextsimdg

neXtSIM_DG : next generation sea-ice model with DG
https://nextsim-dg.readthedocs.io/en/latest/?badge=latest
Apache License 2.0
10 stars 13 forks source link

Issue533 init maker #542

Closed einola closed 1 month ago

einola commented 2 months ago

Better way to create init files

Fixes #533

Task List


Change Description

This PR implements a Python class for creating an object that holds all the data needed for an initialisation file and a method for writing it to disk. The class is designed to create idealised setups with a fixed resolution. Once we start using realistic grids more, we may want to generalise it.

The user creates an object, giving the constructor the array dimensions and resolution. The initial object contains all the variables that should be included in the initialisation file, all set to zero. The user can modify these variables at will. The file is written once the object goes out of scope (the end of a loop or program). The method for writing to the file does some minimal checking and warning.

Closes #533


Test Description

No direct tests implemented, but this should be used in the integration tests (not done yet).


Documentation Impact

Documentation of this class is to be included in #520. There is some minimal self-documentation in the class itself.


Other Details

N/A


Pre-Request Checklist