pycif.plugins.datastreams.fields.oldlmdz_ic — API reference

pycif.plugins.datastreams.fields.oldlmdz_ic — API reference#

Configuration reference: oldlmdz_ic plugin

pycif.plugins.datastreams.fields.oldlmdz_ic.get_domain.get_domain(ref_dir, ref_file, input_interval, target_dir, tracer=None)[source]#

Build the legacy LMDZ4 72x96x19 Domain from a reference restart file.

Looks for a reference NetCDF file in ref_dir, either an exact match for ref_file or the first file whose name matches ref_file used as a date-format pattern, reads the rlatu/ rlonv grid coordinates (in radians, converted to degrees) and the ap/bp hybrid vertical coefficients, computes grid-cell corners manually (with an ad hoc pole adjustment), and builds the corresponding domain.

Parameters:
  • ref_dir – directory to search for a reference file.

  • ref_file – exact file name, or a date-format pattern used to match one of the files in ref_dir.

  • input_interval – unused, accepted for interface compatibility.

  • target_dir – unused, accepted for interface compatibility.

  • tracer – unused, accepted for interface compatibility.

Returns:

the legacy LMDZ4 grid domain.

Return type:

Domain

Raises:

CifError – if no reference file can be found in ref_dir.

pycif.plugins.datastreams.fields.oldlmdz_ic.read.read(self, name, tracdir, tracfile, varnames, dates, interpol_flx=False, comp_type=None, model=None, tracer=None, **kwargs)[source]#

Get the initial concentration field from the legacy LMDZ4 restart file and load it into a pyCIF variable.

All entries of tracfile must resolve to the same file (a single restart file is expected); the variable is looked up by varnames first, falling back to q{restart_id:02d} from the chemical scheme if varnames is not found in the file.

Parameters:
  • self – the IC Plugin

  • name – the name of the component

  • tracdir – restart file directory and file format

  • tracfile – restart file directory and file format

  • varnames – name of the variable to read, or a name absent from the file to trigger the restart_id-based fallback

  • dates – list of dates to extract; only the earliest date is used

  • interpol_flx (bool) – unused, accepted for interface compatibility

  • comp_type – unused, accepted for interface compatibility

  • model – the model Plugin, used to resolve the fallback variable name via model.chemistry.acspecies

  • tracer – unused, accepted for interface compatibility

Returns:

xarray.DataArray with dims (time, lev, lat, lon).

Raises:

CifError – if more than one distinct file is given in tracfile.

pycif.plugins.datastreams.fields.oldlmdz_ic.write.write(self, name, ic_file, ic_data, mode='a', **kwargs)[source]#

Write flux to AEMISSION CHIMERE compatible files.

Parameters:
  • self (Fluxes) – the Fluxes plugin

  • ic_file (str) – the file where to write fluxes

  • ic_data (xarray.DataArray) – fluxes data to write

  • mode (str) – ‘w’ to overwrite, ‘a’ to append