Open jwallwork23 opened 1 week ago
The ultimate plan is of course to replace my ad-hoc IO with XIOS. So, below is how file reading currently works.
structure/type
. This is used to select with implementation of StructureModule
will be used to read the file. The file is then closed.ParaGrid
from here on). The restart file is opened and the dimension data is read. Up until this point, the model has no defined size or land map. This is all determined from the restart file at this point in the start-up phase.ModelState
object.ModelState
object passed to the cascade of classes that make up the model.Additionally there is reading forcing data from forcing files, which contain many time samples. Currently the forcing files are fixed to the same grid as the model fields, but the hope is that XIOS or OASIS will allow us to use the files provided in the reanalysis datasets.
The summary is that the current method is to read the dimensions and fields as part of the input process, and not to have them predefined in the configuration file, if possible. And definitely not to set them at compile time.
Thanks for the description here @timspainNERSC, it's really useful! I'll implement file writing first and see what comes up there before coming back to this to implement file reading.
Thinking more about what's required for #552, I realised there's a key missing piece for reading files.
Usually, XIOS reads in an XML configuration file along with the NetCDF file that contains the data. The XML file says how to set up the various attributes, e.g., Axes, Domains, Fields. If we want to go ahead with using the XIOS API instead of XML files then we need to be able to read such information from NetCDF files directly. This could be done by borrowing from the existing I/O implementation, for example.
On the other hand, am I right in thinking that the only use case for having XIOS read from file is for restarts? In the case of restarts, you presumably already know how the dimensions and fields are laid out so could reproduce the XIOS attributes without needing to read them.
Any thoughts on this @timspainNERSC @einola?