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

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.

component: (mandatory)

Component to reproject

accepted type: <class ‘str’>

parameter: (mandatory)

Component to reproject

accepted type: <class ‘str’>

Optional arguments

dir_wgt: (optional):

Directory where pre-computed interpolation weights are available

accepted type: <class ‘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: <class ‘float’>

orig_regular: (optional): True

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

accepted type: <class ‘bool’>

target_lbc: (optional): False

Interpolate to the LBC of a domain

accepted type: <class ‘bool’>

sparse_in: (optional)

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

accepted type: <class ‘str’>

sparse_out: (optional)

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

accepted type: <class ‘str’>

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  method: XXXXX
 9  component: XXXXX
10  parameter: XXXXX
12  # Optional arguments
13  dir_wgt: XXXXX
14  min_weight: XXXXX
15  orig_regular: XXXXX
16  target_lbc: XXXXX
17  sparse_in: XXXXX
18  sparse_out: XXXXX