Building ESMF Remapping Coefficient Files#

The Earth System Modeling Framework (ESMF) applications provide a means to compute various types (e.g., bilinear, nearest-neighbor, etc.,) remapping coefficient values. The esmf_remap application provides a script-level interface around the xESMF package.

Application Configuration#

The esmf_remap application configuration for a remapping of \(0.25^{\circ}\) grid-cell centers \(5.0^{\circ}\) grid cell centers is as follows.

output_netcdf: /work/tripolar.0p25_1p0.bilinear.t2t_remap.oras5.nc
interp_type: bilinear
ignore_degenerate: true
grids:
  destination:
  ncfile: /work/gridspec.reglatlon.1p0.nc
  ncxdim_name: nx
  ncydim_name: ny
  nclat: tlat
  nclon: tlon
source:
  ncfile: /work/gridspec.tripolar.0p25.nc
  ncxdim_name: nx
  ncydim_name: ny
  nclat: tlat
  nclon: tlon

Configuration Variable

Description

interp_type

The interpolation type for which to compute the ESMF attributes; both bilinear and nearest_s2d are supported.

grids

The respective source and destination grid informations; see the following table for further information.

ignore_degenerate

Ignore geographical locations that collapse to a singularity when computing the ESMF remapping coefficients.

output_netcdf

The netCDF-formatted file path to contain the computed ESMF attributes.

The allowable attributes for the respective source and destination grid-types are as follows.

Grid Variable

Description

ncfile

Defines the netCDF-formatted file path containing the respective grid attributes; used only if is_netcdf is True.

nclat

Defines the netCDF-formatted file path variable name for the latitude coordinate values.

nclon

Defines the netCDF-formatted file path variable name for the longitude coordinate values.

ncxdim_name

Defines the netCDF-formatted file path x-dimension variable name.

ncydim_name

Defines the netCDF-formatted file path y-dimension variable name.

Launching the Application#

The esmf_remap application may be launched from within the UFS Tools package for the example described in the previous section as follows.

user@host:$ cd scripts
user@host:$ ./compute_coeffs --esmf /path/to/ufs_tools/parm/esmf_remap/esmf_remap.yaml

If successful, a netCDF-formatted file containing the ESMF remapping attributes will be created containing the following metadata attributes.

user@host:$ /path/to/ncdump -h /run/tripolar.0p25_5p0.bilinear.t2t_remap.nc

netcdf tripolar.0p25_5p0.bilinear.t2t_remap {
dimensions:
        n_s = 113472 ;
variables:
       double S(n_s) ;
               S:_FillValue = NaN ;
       int col(n_s) ;
       int row(n_s) ;
}

A description of the respective ESMF remapping variables/attributes can be found here.

Wrapper Application#

In addition to the stand-alone script example, a wrapper application around the stand-alone script is included with the UFS Tools package and allows the computation of various remapping attributes to run in succession.

Usage: wrapper_esmf_remap.py [-h] script template yaml

ESMF remapping coefficient computation wrapper application.

Positional Arguments:
script      Path to the ESMF remapping application script.
template    YAML-formatted file containing the ESMF remapping application YAML-formatted template file.
yaml        YAML-formatted file containing the ESMF remapping application wrapper configuration.

Optional Arguments:
-h, --help  show this help message and exit
user@host:$ cd wrappers
user@host:$ ./wrapper_esmf_remap.py /path/to/ufs_tools/scripts/compute_coeffs.py /path/to/ufs_tools/parm/esmf_remap/esmf_remap_tmpl.yaml /path/to/ufs_tools/parm/esmf_remap/wrapper_esmf_remap.yaml