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

pycif.plugins.datastreams.fields.noaa_glob_avg — API reference#

Configuration reference: noaa_glob_avg plugin

pycif.plugins.datastreams.fields.noaa_glob_avg.fetch.fetch(ref_dir, ref_file, date_interval, target_dir, tracer=None, **kwargs)[source]#

Fetch monthly NOAA global-average files.

Forces the start date to the beginning of its month and extends the end date by one month, then for each month (stepped at tracer.file_freq) links the corresponding file into target_dir if it exists, with a one-month list_dates interval.

Parameters:
  • ref_dir – directory where the original files are found.

  • ref_file – (template) name of the original files.

  • date_interval – list of two dates, the beginning and end of the simulation.

  • target_dir – directory where links to the original files are created.

  • tracer – the fields Plugin, giving access to file_freq.

Returns:

for each monthly date, a one-element list with the

file path.

list_dates: for each monthly date, a one-element list with the

[start, end] interval covering that month.

Return type:

list_files

pycif.plugins.datastreams.fields.noaa_glob_avg.get_domain.get_domain(ref_dir, ref_file, input_interval, target_dir, tracer=None)[source]#

Build a global cyclic Domain from a NOAA reference file.

Looks for a reference NetCDF file in ref_dir, either an exact match for ref_file or the first file whose name matches ref_file used as a date-format pattern, then builds a global cyclic lon-lat grid from its longitude/latitude variables and vertical mid-levels from its pressure variable (with sigma_b set to zero, i.e. a purely pressure-based vertical coordinate).

Parameters:
  • ref_dir – directory to search for a reference file.

  • ref_file – exact file name, or a date-format pattern used to match one of the files in ref_dir.

  • input_interval – unused, accepted for interface compatibility.

  • target_dir – unused, accepted for interface compatibility.

  • tracer – unused, accepted for interface compatibility.

Returns:

the NOAA grid domain.

Return type:

Domain

Raises:

CifError – if no reference file can be found in ref_dir.

pycif.plugins.datastreams.fields.noaa_glob_avg.read.read(self, name, varnames, dates, files, interpol_flx=False, comp_type=None, **kwargs)[source]#

Get NOAA global-average values and load them into a pyCIF variable.

Reads self.varname_init from each file in files and converts the values from ppb to ppm.

Parameters:
  • self – the fields Plugin

  • name – the name of the component

  • varnames – unused, accepted for interface compatibility

  • dates – list of [start, end] date pairs to extract; only the start of each pair is used as the output time coordinate

  • files – list of file paths matching dates

  • interpol_flx – unused, accepted for interface compatibility

  • comp_type – unused, accepted for interface compatibility

Returns:

xarray.DataArray with dims (time, lev, lat, lon), in ppm.

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

Not implemented: writing NOAA global-average files is unsupported.

Raises:

CifError – always.