Horizontal re-gridding regrid/std#
Description#
Re-projects from one domain to another horizontally.
Note
This transform is based on ad-hoc calculations and not on external libraries
for two reasons:
to avoid compatibility issues
to be able to compute both the forward and adjoint of the operations.
A matrix of weights from the original domain to the target one is saved to enable the forward and adjoint operations. It can be copied in a reference folder and re-used for another pyCIF computation to avoid re-computing weights for equivalent re-gridding.
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#
- parameter : str, mandatory
Component to reproject
- component : str, mandatory
Component to reproject
- method : “mass-conservation” or “fast-conservative” or “bilinear” or “gridcell”, mandatory
Method by which the original data is spatially interpolated onto the output grid
“mass-conservation”: area-weighted interpolation. Can be heavy to compute. Suitable when mass needs to be conserved
“fast-conservative”: faster area-weighted interpolation. Conserves the integral over the domain.
“bilinear”: Linear interpolation from the 4 closest corners. For unstructured domains, a Delaunay triangularisation is used.
“gridcell”: Finds in which grid cell from the original domain are grid cell centers in the target domain.
Optional arguments#
- orig_parameter_plg : Plugin, optional
Plugin object on which the transform works on
- orig_component_plg : Plugin, optional
Corresponding component object on which the transform works on
- successor : str, optional
Name of the successor transform
- precursor : str, optional
Name of the precursor transform
- dir_wgt : str, optional, default “”
Directory where pre-computed interpolation weights are available
- min_weight : float, optional, default 1e-10
Minimum weight to consider when reprojecting. If sensitivity to original dataset is smaller to min_weight, then crops
- min_coverage : float, optional, default 0.5
With the method ‘fast-conservative’ and observation footprints, minimum fraction of a footprint that must be covered by the domain. Less covered observations are considered outside the domain
- orig_regular : bool, optional, default True
Set to FALSE if irregular original grid when reprojecting, True by default
- target_lbc : bool, optional, default False
Interpolate to the LBC of a domain
- rounding_domain : int, optional, default 8
Number of digits to keep when rounding deltas in the domain to check whether the domain is regular or not. Use with the method mass-conservation
- sparse_in : bool, optional, default False
True if the input has the shape of sparse data, i.e., a pandas.DataFrame
- sparse_out : bool, optional, default False
True if the output has the shape of sparse data, i.e., a pandas.DataFrame
- sampled_in : bool, optional, default False
Whether inputs are sampled data
- sampled_out : bool, optional, default False
Whether outputs are sampled data
- chunk_size : int, optional, default 1000
Chunk size for the ‘fast-conservative’ method as well as ‘gridcell’.
- processes : int, optional
Number of processes for the ‘fast-conservative’ method.
- nthreads : int, optional, default 1
Number of chunks to parallelize processing of ensembles.
- threading_mode : “trid” or “levels”, optional, default “levels”
Mode for threading.
“trid”: Threading over tracers (useful for large ensembles)
“levels”: Threading over non-horizontal dimensions (useful for large datasets)
- direction : “forward” or “reverse”, optional, default “forward”
Direction of regridding with find gridcells
“forward”: Finding grid cells indexes of target locations in input domain
“reverse”: Conversely
- grid_to_surface : bool, optional, default False
Scale grid values to area values
YAML template#
Please find below a template for a YAML configuration:
1transform:
2 plugin:
3 name: regrid
4 version: std
5 type: transform
6
7 # Mandatory arguments
8 parameter: XXXXX # str
9 component: XXXXX # str
10 method: XXXXX # mass-conservation|fast-conservative|bilinear|gridcell
11
12 # Optional arguments
13 orig_parameter_plg: XXXXX # Plugin
14 orig_component_plg: XXXXX # Plugin
15 successor: XXXXX # str
16 precursor: XXXXX # str
17 dir_wgt: XXXXX # str
18 min_weight: XXXXX # float
19 min_coverage: XXXXX # float
20 orig_regular: XXXXX # bool
21 target_lbc: XXXXX # bool
22 rounding_domain: XXXXX # int
23 sparse_in: XXXXX # bool
24 sparse_out: XXXXX # bool
25 sampled_in: XXXXX # bool
26 sampled_out: XXXXX # bool
27 chunk_size: XXXXX # int
28 processes: XXXXX # int
29 nthreads: XXXXX # int
30 threading_mode: XXXXX # trid|levels
31 direction: XXXXX # forward|reverse
32 grid_to_surface: XXXXX # bool
See also