pycif.plugins.datastreams.fields.lmdz_inicond_ico — API reference#
Configuration reference: lmdz_inicond_ico plugin
- pycif.plugins.datastreams.fields.lmdz_inicond_ico.fetch.fetch(ref_dir: str, ref_file: str, input_interval: tuple[datetime, datetime], target_dir: str, **kwargs) tuple[dict[datetime, list[str]], dict[datetime, list[tuple[datetime, datetime]]]][source]#
Link the single LMDz DYNAMICO inicond file for the simulation start date.
- Parameters:
ref_dir (str) – Path to the data. If both
ref_dirandref_fileare falsy, nothing is fetched.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.
**kwargs – 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.
- Return type:
(list_files, list_dates)
- Raises:
CifFileNotFoundError – If the original inicond file does not exist.
- pycif.plugins.datastreams.fields.lmdz_inicond_ico.read.read(self, name: str, varnames: str, dates: list[tuple[datetime, datetime]], files: list[str], tracer: object | None = None, **kwargs) DataArray[source]#
Read a mixing-ratio initial condition (icosahedral grid) into a pyCIF DataArray.
- Parameters:
self – The field/tracer Plugin.
name – Name of the component; used as fallback variable name.
varnames – Name of the variable to read; if empty,
nameis used instead.dates – List of date entries; only the first date is used as the output time coordinate.
files – List with a single inicond file path.
tracer – Unused.
**kwargs – Unused.
- Returns:
A 4-dimensional
(time, lev, lat, lon)array with singletontimeandlataxes (the icosahedral cell dimension is carried bylon).- Return type:
xarray.DataArray
- Raises:
CifValueError – If more than one file is given.
- pycif.plugins.datastreams.fields.lmdz_inicond_ico.write.write(self, name: str, path: str | PathLike, data: DataArray, metadata: dict[str, Any] | None = None, **kwargs)[source]#
Append a mixing-ratio initial condition (icosahedral grid) to a NetCDF file.
Squeezes the singleton
timeandlatdimensions, renameslontocell(the DYNAMICO cell index), builds coordinates viaself.domain.get_domain_coords(), and appends the resulting dataset topath.- Parameters:
self (object) – this plugin;
self.domainsupplies the coordinates.name (str) – variable name to write.
path (str) – path to the target file to write.
data (xarray.DataArray) – data to write, with singleton
time/latdimensions.metadata – Unused.
**kwargs – Unused.
- Raises:
CifTypeError – If
datais not anxarray.DataArray.