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

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_name in "inicond"/"restart_inicond", links the single file matching the start of input_interval. For "lbc"/"background", splits input_interval into sub-periods (tracer.model.periods, default "10D") and, within each sub-period, iterates over hours spaced by tracer.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.periods and tracer.file_freq are used.

  • component – Component being fetched; component.orig_name selects 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/background file is missing.

  • CifError – If component.orig_name is 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 in files and 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, name is 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 singleton lat axis (ICON-ART’s native grid is unstructured; the horizontal dimension is carried by lon).

Return type:

xarray.DataArray

Raises:
  • CifError – If comp_type is None or not recognized.

  • CifKeyError – If the requested date is not found in an lbc/background file.

pycif.plugins.datastreams.fields.iconart_icbc.write.write(self, name, lbc_file, data, mode='a', comp_type=None, **kwargs)[source]#

Not implemented: writing ICON-ART files is not supported.

Raises:

CifError – Always.