WRF I/O STACK

Domain I/O. This layer implements the routines that perform I/O on a domain object to a particular data stream. These are defined in share/module_io_domain.F. Routines include input_initial, output_initial*, input_restart, output_restart, input_history*, output_history, input_boundary, and output_boundary*. There are also a series of routines that are used to input and output the five auxiliary input and five auxiliary history data streams if these are opened. The first set of these are: input_aux_model_inputn, output_aux_model_inputn, input_aux_histn, and output_aux_histn, where n is may be the number of the input or history auxiliary stream, 1 through 5. The high-level routines to open and close datasets for writing and reading, open_w_dataset and open_r_dataset, are also provided at this layer. They are considered high-level because in addition to opening and closing the datasets, they also contain logic to initialize datasets for formats that require it (e.g. netCDF).

Field I/O. This layer contains the routines that take a domain object as an argument and then generate the series of calls to input or output all the individual fields and metadata elements that constitute a dataset. The Registry auto-generates much of this code, which appears in these routines through include statements to registry-generated files in the inc directory (wrf_initialin.inc, wrf_initialout.inc, wrf_restartin.inc, wrf_restartout.inc, wrf_histin.inc, wrf_histout.inc, wrf_bdyin.inc, and wrf_bdyout.inc). The routines of this layer are defined in share/module_io_wrf.F.

Package-independent I/O API. This layer contains definitions of the subroutines specified in the WRF I/O API. Some of these are wrf_open_for_write_begin, wrf_open_for_write_commit, wrf_open_for_read, wrf_write_field, wrf_read_field, wrf_get_dom_ti_real, and so on. There are quite a few of these routines, most of which are for getting or putting metadata in different forms. These routines, defined in frame/module_io.F, are considered part of the WRF framework and have the wrf_ prefix in their names to distinguish them from package-dependent implementations of each routine (next layer down). The principal function of this layer is to select the package-dependent routine from the appropriate linked I/O package to call, based on the definition of the io_form_initial, io_form_restart, io_form_history, and io_form_boundary namelist variables. The association of io_form values with particular packages is specified in the Registry using rconfig and package entries.

Package-specific I/O API. This layer contains definitions of the subroutines specified in the WRF I/O API for a particular package. There may be a number of packages linked into the program. External packages are defined in the external/packagename subdirectory of the WRF distribution. The names are the same as above, except their names have a package specific prefix. External packages have the prefix ext_pkg where pkg specifies the particular package. For example, the netCDF implementation of the I/O API uses the prefix ext_ncd. HDF uses ext_hdf (a placeholder; HDF is not implemented yet). At present there are three placeholder package names, xxx, yyy, and zzz, which are included in the code but inactive (#ifdef’d out using CPP directives). There is also an internal-I/O package, which may be selected to input/output data in a fast, non-self-describing, machine specific intermediate format. The routine names in this package are prefixed with the string ‘int’.