Gridded NetCDF domain gridded_netcdf/std
#
Description#
Reads domain from a gridded NetCDF file
This plugin read the ‘latitude x longitude’ or ‘level x latitude x longitude’ domain from NetCDF files coordinates.
The latitude and longitude coordinate can be infered by their standard_name
or long_name
attribute (which should be 'latitude'
or
'longitude'
), Otherwise, .
If the latitude or longitude variable has a bounds
attribute, the cell
bounds are read from the variable given by this bounds
attribute (which
should be shaped as (n, 2)). Otherwise the bounds are computed with the
max/min arguments and the lat/lon coordinates (assuming they represents the
cells centers of a regular grid).
Vertical levels information (sigma pressure) is read only if the argument
vertical_coord
is provided. Vertical levels information can reside in a
separate NetCDF file
YAML arguments#
The following arguments are used to configure the plugin. pyCIF will return an exception at the initialization if mandatory arguments are not specified, or if any argument does not fit accepted values or type:
Mandatory arguments#
- file : str, mandatory
NetCDF file containing the grid coordinates
Optional arguments#
- dir : str, optional, default “”
Directory containing
file
- dir_vcoord : str, optional, default “”
Directory containing
file_vcoord
. Use this argument if the vertical coordinates are not infile
- file_vcoord : str, optional
NetCDF file containing the vertical coordinates. Use this argument if the vertical coordinates are not in
file
- vertical_coord : “mids” or “bounds”, optional
Read the domain’s vertical levels if this parameter is used. Should be ‘mids’ if the vertical coordinate represents the levels mid-points or ‘bounds’ if the vertical coordinate represents the levels boundaries. If this parameter is not used a domain single vertical level is created
“mids”: levels mid-points
“bounds”: levels boundaries
- vertical_dim_name : str, optional, default “lev”
Vertical dimension name in
file
orfile_vcoord
- sigma_a_var_name : str, optional, default “ap”
‘sigma a’ variable name in
file
orfile_vcoord
- sigma_b_var_name : str, optional, default “bp”
‘sigma b’ variable name in
file
orfile_vcoord
- pressure_unit : “Pa” or “hPa”, optional
pressure units if different from
units
attributes insigma `a` variable, should be ``'Pa'
or'hPa'
- latitude_varname : str, optional, default “latitude”
Latitude coordinate variable name in
file
. If this argument is not provided, the latitude coordinate is found by itsstandard_name
orlong_name
attribute (which should be'latitude'
).- longitude_varname : str, optional, default “longitude”
Longitude coordinate variable name in
file
. If this argument is not provided, the longitude coordinate is found by itsstandard_name
orlong_name
attribute (which should be'longitude'
).- latitude_dimname : str, optional, default “latitude”
Latitude dimension name in
file
.- longitude_dimname : str, optional, default “longitude”
Longitude dimension name in
file
.- use_corners : bool, optional, default False
True if the longitudes and latitudes are used to defined the corners instead of gridcell centers
- extend_lat : bool, optional, default False
Extend corner latitudes by one cell if nlat_corner != nlat + 1
- extend_lon : bool, optional, default False
Extend corner longitudes by one cell if nlon_corner != nlon + 1
- lat_min : float, optional, default -90.0
Minimum latitude
- lat_max : float, optional, default 90.0
Maximum latitude
- delta_lat : float, optional
Skip the reading/computation of latitude bounds and use regular gridcells with a size of
delta_lat
.delta_lat
should dividelat_max - lat_min
and be coherent with the NetCDF file dimensions.- lon_min : float, optional, default -180.0
Minimum longitude
- lon_max : float, optional, default 180.0
Maximum longitude
- delta_lon : float, optional
Skip the reading/computation of longitude bounds and use regular gridcells with a size of
delta_lon
.delta_lon
should dividelon_max - lon_min
and be coherent with the NetCDF file dimensions.- regular_lon : bool, optional, default True
- Overwrites the default behaviour of regular domain
in zonal direction to compute corners. In this case, use the first and last delta to extent East and West
- regular_lat : bool, optional, default True
Overwrites the default behaviour of regular domain in meridional direction to compute corners. In this case, use the first and last delta to extent South and North
- force_centered_lat : bool, optional, default False
Force grid cells latitude to be centered between thier corners. Grid cells centers and corners will be read normally then the grid cells centers latitudes will be adjusted.
- force_centered_lon : bool, optional, default False
Force grid cells longitude to be centered between thier corners. Grid cells centers and corners will be read normally then the grid cells centers longitudes will be adjusted.
- sort_lat : bool, optional, default True
Sort latitudes in ascending order
- sort_lon : bool, optional, default True
Sort longitudes in ascending order
- drop_variables : list, optional, default []
List of variables to drop when reading the NetCDF files. This allows issues of MissingDimensionErrors as documented in, e.g., https://stackoverflow.com/questions/55109481/how-to-import-netcdf4-file-with-xarray-when-index-names-have-multiple-dimensions
YAML template#
Please find below a template for a YAML configuration:
1domain:
2 plugin:
3 name: gridded_netcdf
4 version: std
5 type: domain
6
7 # Mandatory arguments
8 file: XXXXX # str
9
10 # Optional arguments
11 dir: XXXXX # str
12 dir_vcoord: XXXXX # str
13 file_vcoord: XXXXX # str
14 vertical_coord: XXXXX # mids|bounds
15 vertical_dim_name: XXXXX # str
16 sigma_a_var_name: XXXXX # str
17 sigma_b_var_name: XXXXX # str
18 pressure_unit: XXXXX # Pa|hPa
19 latitude_varname: XXXXX # str
20 longitude_varname: XXXXX # str
21 latitude_dimname: XXXXX # str
22 longitude_dimname: XXXXX # str
23 use_corners: XXXXX # bool
24 extend_lat: XXXXX # bool
25 extend_lon: XXXXX # bool
26 lat_min: XXXXX # float
27 lat_max: XXXXX # float
28 delta_lat: XXXXX # float
29 lon_min: XXXXX # float
30 lon_max: XXXXX # float
31 delta_lon: XXXXX # float
32 regular_lon: XXXXX # bool
33 regular_lat: XXXXX # bool
34 force_centered_lat: XXXXX # bool
35 force_centered_lon: XXXXX # bool
36 sort_lat: XXXXX # bool
37 sort_lon: XXXXX # bool
38 drop_variables: XXXXX # list