pycif.plugins.datastreams.fields.netcdf_cams — API reference#
Configuration reference: netcdf_cams plugin
- pycif.plugins.datastreams.fields.netcdf_cams.fetch.fetch(ref_dir, ref_file, input_interval, target_dir, tracer=None, component=None)[source]#
Fetch monthly CAMS NetCDF files and their sub-interval time steps.
Forces the requested period to full months, then for each month (stepped at
tracer.file_freq) reads the number of time steps in the corresponding file to build one sub-interval per time step, and links the file intotarget_dir.- Parameters:
ref_dir – directory where the original files are found.
ref_file – (template) name of the original files.
input_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.component – unused, accepted for interface compatibility.
- Returns:
- for each monthly date, the file path repeated once
per time step found in that file.
- list_dates: for each monthly date, the list of
[start, end] sub-intervals covered by that file’s time steps.
- Return type:
list_files
- pycif.plugins.datastreams.fields.netcdf_cams.get_domain.get_domain(ref_dir, ref_file, input_interval, target_dir, tracer=None)[source]#
Build the CAMS grid Domain from one of the tracer’s input files.
Reads longitude/latitude from the first available input file, computes cell corners assuming a regular grid, and builds the vertical hybrid-sigma coordinates either as interface values (
ap/bp, read from the file, or from a CSV given bytracer.aibi_filewhentracer.aibi_nameis set) or as mid-level values (hyam/hybm).- Parameters:
ref_dir – unused, accepted for interface compatibility.
ref_file – unused, accepted for interface compatibility.
input_interval – unused, accepted for interface compatibility.
target_dir – unused, accepted for interface compatibility.
tracer – the fields Plugin;
tracer.input_filesis used to find a reference file, andtracer.aibi_name/tracer.aibi_filecontrol how the vertical coordinate is resolved.
- Returns:
the CAMS grid domain.
- Return type:
- Raises:
CifError – if no reference file can be found among
tracer.input_files.
- pycif.plugins.datastreams.fields.netcdf_cams.read.read(self, name, varnames, dates, files, interpol_flx=False, comp_type=None, tracer=None, ddi=None, **kwargs)[source]#
Get BCs from raw CAMS files and load them into a pyCIF variable.
For each requested date, computes the time index within the monthly file from the file’s number of time steps, reads the variable, and flips the latitude axis to increasing order (and the vertical axis if
tracer.flip_levelis set) as needed.- Parameters:
self – the BC Plugin
name – the name of the component
varnames – variable name to extract if different from
namedates – list of
[start, end]date pairs to extractfiles – list of file paths matching
datesinterpol_flx – unused, accepted for interface compatibility
comp_type – unused, accepted for interface compatibility
tracer – the fields Plugin;
tracer.flip_levelcontrols whether the vertical axis is flippedddi – must not be
None; only used to validate the call, not otherwise referenced
- Returns:
xarray.DataArray with dims
(time, lev, lat, lon).- Raises:
CifError – if
ddiisNone.