pycif.plugins.datastreams.fields.lmdz_ic — API reference#
Configuration reference: lmdz_ic plugin
- pycif.plugins.datastreams.fields.lmdz_ic.fetch.fetch(ref_dir, ref_file, input_interval, target_dir, tracer=None, component=None)[source]#
Link the single LMDz restart file for the simulation start date.
- Parameters:
ref_dir (str) – Path to the data.
ref_file (str) – File name format of the data.
input_interval (list[datetime.datetime]) – Date range; only the start date is used.
target_dir (str) – Where to link the data.
tracer – Unused.
component – Unused.
- Returns:
tuple of single-entry dictionaries keyed by the simulation start date, describing the linked file and the (single-point) date interval it covers. Empty dicts if the original file is not found.
- Return type:
(list_files, list_dates)
- pycif.plugins.datastreams.fields.lmdz_ic.read.read(self, name, varnames, dates, files, tracer=None, **kwargs)[source]#
Read a species from an LMDz restart file into a pyCIF DataArray.
Resolves the variable name to read in the file, in order of precedence:
varnamesif given (for a non-perturbed species; raises iftracer.restart_idis also set), otherwisetracer.restart_idif set, otherwise therestart_idof the matching species in the chemical scheme (self.chemistry.acspecies). A numericrestart_idis turned into the conventionalqNNvariable name.- Parameters:
self – The field/tracer Plugin;
self.chemistry.acspeciesis used when no explicitrestart_id/varnamesis given.name – Name of the component/species.
varnames – Explicit variable name to read; incompatible with
tracer.restart_idunlessnameis a perturbed sample (contains"__sample#").dates – List of date entries; only the first date is used as the output time coordinate.
files – List with a single restart file path.
tracer – Tracer/component configuration; may define
restart_id.**kwargs – Unused.
- Returns:
A 4-dimensional
(time, lev, lat, lon)array with a single time step.- Return type:
xarray.DataArray
- Raises:
IllegalArgumentError – If both
varnamesandtracer.restart_idare given for a non-perturbed species.CifTypeError – If
varnamesis given but is not a string.CifValueError – If more than one file is given, or if the species is not found in the chemical scheme.
- pycif.plugins.datastreams.fields.lmdz_ic.write.write(self, name, path, data, lmdz_version='std', metadata=None, **kwargs)[source]#
Write a restart/initial-condition variable to an AEMISSION-style CHIMERE-compatible NetCDF file.
Builds
lat/loncoordinates (with bounds) frommetadata['domain']if given, adds a single-valuedtempstime coordinate (for compatibility with LMDZ std/OpenMPI), renames dimensions to LMDZ’stemps/sigs/rlatu/rlonvconvention, and creates or appends to the target NetCDF file.- Parameters:
self (object) – this plugin.
name (str) – variable name to write.
path (str) – path to the target file to write.
data (xarray.DataArray) – data to write.
lmdz_version (str) – LMDZ plugin version,
'std'or'acc'(currently unused in the body).metadata – Optional dict with a
"domain"entry, used to build thelat/loncoordinates; if absent, no horizontal coordinates are written.**kwargs – Unused.
- Raises:
CifTypeError – If
datais not anxarray.DataArray.