14) The definition of the OFFLIN output fields to be written is suppressed from files init_outfn_....

When CTIMESERIES_FILETYPE = "OFFLIN", the init_outfn_... files allow to define which fields will be written in the output OUT.nc files.

They force to define two times the variables to write:

  • in the write_... routines, when the write_surf routine is called for each field to write.
  • in the init_outfn_.. routines.

They are hard to maintain and sources of errors.

So, according to what was done for the "NC" I/O format, they are kept only to create the output files and the definition of output fields is replaced by the following mechanics:

  • at the first OFFLINE writing time step, the routines write_surf_atm and write_diag_surf_atm are called two times, one with LDEF = T, one with LDEF = F.
  • the routine mode_write_surf_ol is adapted so that, if LDEF = T, the call to write_surf leads to the call of def_var_netcdf, and not to the writing of the field yet.
  • The init_output_ol and init_oufn_... routines are kept only to create the output OUT.nc files.
  • The routine init_io_surfn takes in optional argument the name of the file where the following fields are to be written.

Remark:

  • In the init_outfn_... files, the attributes long_name and units were more precisely defined that in the write_... routines.
  • If they want to keep this level of precision, the users are invited to take the old init_outfn_.. files and to put the attributes long_name and units in the HCOMMENT argument of the write_surf routine, with the following syntax:
    YCOMMENT = "long_name (units)"
    Thus mode_write_surf_ol will separate long_name from units and put them in the appropriate NETCDF variable attributes.