pycif.plugins.datastreams.fluxes.unstructured_NetCDF — API reference#
Configuration reference: unstructured_NetCDF plugin
- pycif.plugins.datastreams.fluxes.unstructured_NetCDF.get_domain.get_domain(ref_dir, ref_file, input_interval=None, target_dir=None, 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.fluxes.unstructured_NetCDF.read.read(self, name, varnames, dates, files, interpol_flx=False, tracer=None, model=None, ddi=None, debug_read=False, **kwargs)[source]#
Not implemented; always raises.
Reading fluxes on an unstructured NetCDF grid is not yet supported.
- Raises:
CifNotImplementedError – Always.
- pycif.plugins.datastreams.fluxes.unstructured_NetCDF.write.write(self, name, flx_file, flx, mode='a', metadata=None, **kwargs)[source]#
Write a flux DataArray to a CF-style unstructured NetCDF file.
Builds a dataset with a
celldimension (plustime) andlat/lon/lat_bnds/lon_bndsvariables from the domain’s cell coordinates and vertices, and writes it to flx_file (creating it, or appending if it already exists).- Parameters:
self – The flux tracer plugin instance.
name (str) – Name of the flux variable to write.
flx_file (str) – Path of the NetCDF file to write or append to.
flx (xr.DataArray) – Flux data with
time,lev,lat,londimensions;latandlevare squeezed andlonis renamed tocell.mode (str) – Unused directly; existence of flx_file determines whether the dataset is written (
mode='w') or appended (mode='a') to the NetCDF file.metadata (dict, optional) – Must be a dict containing a
'domain'key with the Domain object used to derive cell coordinates and vertices.
- Raises:
CifTypeError – If metadata is not a dict.
CifKeyError – If metadata has no
'domain'key.