pycif.plugins.datastreams.fields.iconart_icbc — API reference#
Configuration reference: iconart_icbc plugin
- pycif.plugins.datastreams.fields.iconart_icbc.fetch.fetch(ref_dir, ref_file, input_interval, target_dir, tracer=None, component=None)[source]#
Link ICON-ART initial/boundary condition files and build the date/file maps.
For
component.orig_namein"inicond"/"restart_inicond", links the single file matching the start ofinput_interval. For"lbc"/"background", splitsinput_intervalinto sub-periods (tracer.model.periods, default"10D") and, within each sub-period, iterates over hours spaced bytracer.file_freq, linking every required file.- Parameters:
ref_dir – Directory where the original files are found.
ref_file – Date-format pattern for the original file names.
input_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.model.periodsandtracer.file_freqare used.component – Component being fetched;
component.orig_nameselects the fetch strategy.
- Returns:
A tuple
(list_files, list_dates)of dictionaries. For initial conditions, both have a single key (the start date). For boundary conditions, each key is a sub-period start date mapping to the list of hourly files/sub-intervals within that sub-period.- Raises:
CifFileNotFoundError – If a required
lbc/backgroundfile is missing.CifError – If
component.orig_nameis not recognized.
- pycif.plugins.datastreams.fields.iconart_icbc.read.read(self, name, varnames, dates, files, interpol_flx=False, comp_type=None, ddi=None, **kwargs)[source]#
Read ICON-ART initial/boundary condition data into a pyCIF DataArray.
For
comp_type == "inicond", reads the variable from the single file infilesand adds a singleton (fake) latitude axis. For"lbc"/"background", reads the variable from each file in turn, selects the time slice matching the requested date, and stacks the results (also adding a singleton latitude axis).- 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.interpol_flx – Unused.
comp_type – Type of file to read:
"inicond","lbc"or"background".ddi – Unused.
**kwargs – Unused.
- Returns:
A 4-dimensional
(time, lev, lat, lon)array with a singletonlataxis (ICON-ART’s native grid is unstructured; the horizontal dimension is carried bylon).- Return type:
xarray.DataArray
- Raises:
CifError – If
comp_typeisNoneor not recognized.CifKeyError – If the requested date is not found in an
lbc/backgroundfile.