pycif.plugins.datastreams.fields.lmdz_outfields_nc — API reference#
Configuration reference: lmdz_outfields_nc plugin
- pycif.plugins.datastreams.fields.lmdz_outfields_nc.fetch.fetch(ref_dir, ref_file, date_interval, target_dir, tracer=None, component=None)[source]#
Link monthly LMDz
trajqfiles and build 3-hourly sub-intervals.Iterates over dates spaced by
tracer.file_freqacrossdate_interval, links each existing monthly file intotarget_dir, and builds 3-hourly sub-intervals covering the whole month (8 per day).- Parameters:
ref_dir – Directory where the original files are found.
ref_file – Date-format pattern for the original file names.
date_interval – List of two dates, the beginning and end of the period to fetch.
target_dir – Directory where links to the original files are created.
tracer – Tracer/component configuration;
tracer.file_freqgives the frequency at which monthly files are available.component – Unused.
- Returns:
A tuple
(list_files, list_dates)of dictionaries keyed by monthly file date.list_datesmaps each key to one 3-hourly[start, end]interval per 3-hour period of the month;list_filesmaps each key to the (repeated) path of that month’s file.
- pycif.plugins.datastreams.fields.lmdz_outfields_nc.get_domain.get_domain(ref_dir, ref_file, input_interval, target_dir, tracer=None)[source]#
Build the pyCIF domain from an LMDz
trajqreference file.Opens the first fetched
trajqinput file, builds a cyclic regular lon-lat grid (with corner cells extended/wrapped at the poles and at +/-180 degrees) from itslon/latvariables, and reads hybrid vertical coefficientsap/bpfromtracer.dir_vcoord/tracer.file_vcoord.- Parameters:
ref_dir – Unused directly (kept for interface consistency).
ref_file – Used only in the error message if no reference file is available.
input_interval – Unused directly (kept for interface consistency).
target_dir – Unused directly (kept for interface consistency).
tracer – Tracer/component configuration;
tracer.input_files,tracer.dir_vcoordandtracer.file_vcoordare used.
- Returns:
The domain built from the reference file’s horizontal grid and vertical coefficients, with
lon_cyclic=True.- Return type:
- Raises:
CifError – If no reference
trajqfile is available.
- pycif.plugins.datastreams.fields.lmdz_outfields_nc.read.read(self, name, varnames, dates, files, interpol_flx=False, tracer=None, model=None, **kwargs)[source]#
Read a variable from LMDz
trajqfiles into a pyCIF DataArray.Opens each distinct file in
filesonce, matches each requested date against the file’stimecoordinate (since the file may cover a different month/year range than strictly requested), and stacks the selected(lev, lat, lon)slices into a single array.- 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 to extract, matching
files.files – List of files matching
dates; each distinct file is opened only once.interpol_flx – Unused.
tracer – Unused.
model – Unused.
**kwargs – Unused.
- Returns:
A 4-dimensional
(time, lev, lat, lon)array.- Return type:
xarray.DataArray