Output in netcdf
Branch develop/netcdf
includes now a basic way to write output as netcdf based on the netcdf_writer
module which has been added to the code. The entire operation is carried out by the nc_write
, which is currently called every 6hrs.
The subroutine includes a table which defines which variables should be saved. Similarly, all the output are currently saved in a single file data.nc
at daily frequency for the entire experiment.
The subroutine then create the netcdf files, generating dimensions and variables, and then in a second instance append a new record in the file. If the file exists, data are only appended reading the last record of the time dimension. Variable names is trying to follow cmor-like standard. Both 2d and 3d files can be stored: of course the assignment of each model field to the netcdf file has to be hard-coded in the subroutine (since no pointer including all the diagnostic variables is present in bolam.F90). For 3d data, we exploited the interpolation capabilities of the wrshf_s2s
subroutine which has been structured into a plev_interpolation
subroutine which can potentially be used also on a different set of vertical levels.
A short function to estimate julian date is used to provide the correct calendar in netcdf format. Metadata are provided in a decent way by multiple subroutines in the netcdf_writer
module, and global attributes can be easily expanded.
An important function is provided by nc_info
, which provides the metadata and dimensional information for each variable.
IMPORTANT: the devel/netcdf builds on the devel/mod_model branch which split the mod_model from bolam.f90 and allows for separated compilation of the netcdf_writer
module
As short guide, if you want to add a new variable you should
- add it to the
savelist
table, adjusting its dimension - add it to the select case statement of
nc_info
to provide correct metadata - add it to the select case statement of
nc_write
to assign the correct field - add the required variables in the call of the
mod_model
Things that can be improved
- Read variable names and number of vertical levels from namelist
- Split 2d and 3d field data data in multiple files
- Improve handling of surface fields introducing a proper vertical axis
- Generalize the
nc_write
function so that can be called at different time intervals - Produce cumulated fields as daily fields