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 intotarget_dirif it exists, with a one-monthlist_datesinterval.- 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 forref_fileor the first file whose name matchesref_fileused as a date-format pattern, then builds a global cyclic lon-lat grid from itslongitude/latitudevariables and vertical mid-levels from itspressurevariable (withsigma_bset 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:
- 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_initfrom each file infilesand 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 coordinatefiles – list of file paths matching
datesinterpol_flx – unused, accepted for interface compatibility
comp_type – unused, accepted for interface compatibility
- Returns:
xarray.DataArray with dims
(time, lev, lat, lon), in ppm.