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:

  1. to avoid compatibility issues

  2. 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

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

sparse_in : str, optional

True if the input has the shape of sparse data, i.e., a pandas.DataFrame

sparse_out : str, optional

True if the output has the shape of sparse data, i.e., a pandas.DataFrame

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

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  orig_regular: XXXXX  # bool
20  target_lbc: XXXXX  # bool
21  sparse_in: XXXXX  # str
22  sparse_out: XXXXX  # str
23  rounding_domain: XXXXX  # int