pycif.plugins.datastreams.fields.gridded_NetCDF_inicond — API reference#
Configuration reference: gridded_NetCDF_inicond plugin
- pycif.plugins.datastreams.fields.gridded_NetCDF_inicond.fetch.fetch(ref_dir, ref_file, input_interval, target_dir, tracer=None, component=None)[source]#
Link the single initial-condition file for the simulation start date.
- Parameters:
ref_dir – Directory where the original files are found.
ref_file – Date-format pattern for the original file name.
input_interval – List of two dates, the beginning and end of the simulation; only the start date is used.
target_dir – Directory where the link to the original file is created.
tracer – Unused.
component – Unused.
- Returns:
A tuple
(list_files, list_dates), each a single-entry dictionary keyed by the simulation start date (empty dicts if the file is not found).
- pycif.plugins.datastreams.fields.gridded_NetCDF_inicond.get_domain.get_domain(ref_dir, ref_file, input_interval, target_dir, tracer=None)[source]#
Read information from the reference file to define the data horizontal and, if relevant, vertical domain.
- Parameters:
ref_dir (str) – the path to the input files
ref_file (str) – format of the input files
input_interval (list) – simulation interval (start and end dates)
target_dir (str) – where to copy
tracer – the tracer Plugin
- Returns:
a domain class object, with the definition of the center grid cells coordinates, as well as corners
- Return type:
domain (Domain)
- pycif.plugins.datastreams.fields.gridded_NetCDF_inicond.read.read(self, name, varnames, dates, files, interpol_flx=False, comp_type=None, **kwargs)[source]#
Read a gridded NetCDF initial-condition field into a pyCIF DataArray.
Opens the inicond NetCDF file, renames its latitude/longitude/level coordinates to
lat/lon/lev(usingself.vertical_dim_namefor the vertical coordinate andfind_coord()for the horizontal ones), optionally sorts latitude/longitude in ascending order, and adds a singletontimedimension set to the simulation start date.- Parameters:
self – The field/tracer Plugin (
vertical_dim_name,sort_lat,sort_lonattributes are used).name – Name of the component; used as the variable name if
varnamesis not given.varnames – Name of the variable to read in the NetCDF file.
dates – List of date entries matching
files; only the first date is used as the initial date.files – List of files matching
dates; only the first file is read (a warning is issued if more than one is given).interpol_flx – Unused.
comp_type – Unused.
**kwargs – Unused.
- Returns:
A 4-dimensional
(time, lev, lat, lon)array.- Return type:
xarray.DataArray