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

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

Configuration reference: lmdz_prodloss3d plugin

pycif.plugins.datastreams.fields.lmdz_prodloss3d.fetch.fetch(ref_dir, ref_file, input_interval, target_dir, tracer=None, **kwargs)[source]#

Fetch monthly LMDZ production/loss files and their daily sub-intervals.

For each month covered by input_interval (stepped at tracer.file_freq), links the corresponding file from ref_dir into target_dir if it exists, and builds one daily sub-interval per day of the month.

Parameters:
  • ref_dir – directory where the original files are found.

  • ref_file – (template) name of the original files.

  • input_interval – list of two dates, the beginning and end of the simulation.

  • target_dir – directory where links to the original files are created.

  • tracer – the fluxes Plugin, giving access to file_freq.

Returns:

for each monthly date, the file path repeated once

per day of the month.

list_dates: for each monthly date, the list of daily

[start, end] sub-intervals covered by that file.

Return type:

list_files

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

Get pre-computed production/loss fields and load them into a pyCIF variable.

Opens the monthly file matching each requested date, appends a duplicated first-longitude column to close the cyclic LMDZ grid, and picks the time slice matching the requested day of month (falling back to the first day in the file if no exact match is found).

Parameters:
  • self – the fluxes Plugin

  • name – the name of the component

  • tracdir – flux directory and file format

  • tracfile – flux directory and file format

  • dates – list of dates to extract

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

  • comp_type – unused, accepted for interface compatibility

  • model – unused, accepted for interface compatibility

Returns:

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

pycif.plugins.datastreams.fields.lmdz_prodloss3d.write.write(self, prescr_file, prodloss, mode='a', **kwargs)[source]#

Write prescribed species files for LMDZ

Parameters:
  • self (Fluxes) – the Fluxes plugin

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

  • prodloss (xarray.DataArray) – prescribed species data to write

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