Horizontal re-gridding (regrid / std)


Re-projects from one domain to another horizontally.


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: (mandatory)

Component to reproject

accepted type: str

component: (mandatory)

Component to reproject

accepted type: str

method: (mandatory)

Method by which the original data is spatially interpolated onto the output grid

accepted values:

  • mass-conservation: area-weighted interpolation. Can be heavy to compute. Suitable when mass needs to be conserved

  • 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: (optional)

Plugin object on which the transform works on

accepted type: Plugin

orig_component_plg: (optional)

Corresponding component object on which the transform works on

accepted type: Plugin

successor: (optional)

Name of the successor transform

accepted type: str

precursor: (optional)

Name of the precursor transform

accepted type: str

dir_wgt: (optional):

Directory where pre-computed interpolation weights are available

accepted type: str

min_weight: (optional): 1e-10

Minimum weight to consider when reprojecting. If sensitivity to original dataset is smaller to min_weight, then crops

accepted type: float

orig_regular: (optional): True

Set to FALSE if irregular original grid when reprojecting, True by default

accepted type: bool

target_lbc: (optional): False

Interpolate to the LBC of a domain

accepted type: bool

sparse_in: (optional)

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

accepted type: str

sparse_out: (optional)

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

accepted type: str

rounding_domain: (optional): 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

accepted type: int

Yaml template

Please find below a template for a Yaml configuration:

 2  plugin:
 3    name: regrid
 4    version: std
 5    type: transform
 7  # Mandatory arguments
 8  parameter: XXXXX  # str
 9  component: XXXXX  # str
10  method: XXXXX  # mass-conservation|bilinear|gridcell
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