domains are implemented in pyCIF so far:
- CHIMERE HCOORD/VCOORD domain (
- Gridded NetCDF domain (
- LMDz grid (
domain loads and stores information about domains.
Domains in pyCIF include all geographical information about models and datastreams grids,
both in the horizontal and vertical direction.
The following attributes, dependencies and functions should be defined
domain, as they are called by other plugins.
They can be parameters to define at the set-up step,
functions to implement in the corresponding module,
or dependencies to be attached to the
Domains in pyCIF are defined with the following data:
The following parameters/data are defined at the initialization of the domain, either
in the function
(optional) this parameter is set to
Truewhen the domain cannot be defined with a regular 2D array; instead, it is stored as a flat list of grid cells;
In the case of unstructured domains, the expected dimensions (
nlat) should ALWAYS be set to:
nlon= number of grid cells
(optional) this parameter goes in tandem with
unstructured_domain; it set to
Truefor unstructured domains, the grid cells of which are regular rectangles in degrees. Setting to
Truespeeds up the computation of grid cell areas
dimensions of the domain in horizontal and vertical directions
arrays of grid cell centers
arrays of grid cell corners; for structured domains, it is arrays of dimensions
nlon + 1/
nlat + 1; for unstructured domains, the expected dimension is
alpha/beta sigma pressure levels
(optional) pressure units: should be one of
Pais assumed if not specied
heights above ground level of the domain levels
heightsare specified, only sigma levels are considered
(optional) set to
Trueif the domain is cyclic in the zonal direction; this is the case for, e.g., global domains
(optional) can be set to
xyif the longitudes and latitudes are not in GPS standard coordinates; in that case, values are assumed to be meters from a reference point
The horizontal definition of the domain is used to determine and compute horizontal regridding (see details in the corresponding transform documentation here)
The vertical definition of the domain is used for vertical interpolations in the corresponding transform (see details here).
The following parameters/data are computed online during the computation of pyCIF depending on the computation needs and the other domain parameters:
longitudes / latitudes of the sides of the domain; they can simply be the outer border of the domain, or a buffer region in some cases
number of grids in the sides; for domain for which sides are the 1D border of the domain,
nlon_side = nb of side gridsand
nlat_side = 1; for domains with a buffer region,
nlat_sidecan be different from 1
grid cell areas
The following functions need to be implemented in any domain to make it interact with other classes.
They must be imported at the root level of the corresponding python package, i.e. in the
from XXXXX import ini_periods from XXXXX import run from XXXXX import native2inputs from XXXXX import native2inputs_adj from XXXXX import outputs2native from XXXXX import outputs2native_adj from XXXXX import compile from XXXXX import ini_mapper
This function is called by default during the initialization of any domain. It is expected to initialize the above-mentioned parameters.
If fails with a
AttributeError, the function
is automatically called.
This function is designed for reading a domain that was already computed from existing coordinate files and auxiliary information.
read_grid is a class method that applies to the
domain plugin itself.
Therefore, the only expected argument is
def read_grid(self, **kwargs): self.zlon = XXXX self.zlat = XXXXX self.zlonc = XXXXX self.zlatc = XXXXX self.nlon = XXXXX self.nlat = XXXXX self.nlev = XXXXX self.sigma_a = XXXXX self.sigma_b = XXXXX self.nlev = XXXXX
Click below to see an example of the
read_grid function for the model CHIMERE.
This function is called when
read_grid fails for some reason.
It is similar to
read_grid, but instead of reading an existing domain,
it will create it from the information given in the Yaml configuration file.
Click below to see an example of the
create_domain function for the model CHIMERE.
This function defines the domain sides variables
has a single argument
It is not necessary to define this function. By default, the border of the domain is taken using the default function below: