Regrid between curvilinear grids

[1]:
%matplotlib inline
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import numpy as np
import xarray as xr
import xesmf as xe

Prepare data

Input data

Here we regrid the built-in “rasm” demo data. This data is used by another xarray tutorial.

[2]:
ds = xr.tutorial.open_dataset(
    "rasm"
)  # use xr.tutorial.load_dataset() for xarray<v0.11.0
ds
[2]:
Show/Hide data repr Show/Hide attributes
xarray.Dataset
    • time: 36
    • x: 275
    • y: 205
    • time
      (time)
      object
      1980-09-16 12:00:00 ... 1983-08-17 00:00:00
      long_name :
      time
      type_preferred :
      int
      array([cftime.DatetimeNoLeap(1980-09-16 12:00:00),
             cftime.DatetimeNoLeap(1980-10-17 00:00:00),
             cftime.DatetimeNoLeap(1980-11-16 12:00:00),
             cftime.DatetimeNoLeap(1980-12-17 00:00:00),
             cftime.DatetimeNoLeap(1981-01-17 00:00:00),
             cftime.DatetimeNoLeap(1981-02-15 12:00:00),
             cftime.DatetimeNoLeap(1981-03-17 00:00:00),
             cftime.DatetimeNoLeap(1981-04-16 12:00:00),
             cftime.DatetimeNoLeap(1981-05-17 00:00:00),
             cftime.DatetimeNoLeap(1981-06-16 12:00:00),
             cftime.DatetimeNoLeap(1981-07-17 00:00:00),
             cftime.DatetimeNoLeap(1981-08-17 00:00:00),
             cftime.DatetimeNoLeap(1981-09-16 12:00:00),
             cftime.DatetimeNoLeap(1981-10-17 00:00:00),
             cftime.DatetimeNoLeap(1981-11-16 12:00:00),
             cftime.DatetimeNoLeap(1981-12-17 00:00:00),
             cftime.DatetimeNoLeap(1982-01-17 00:00:00),
             cftime.DatetimeNoLeap(1982-02-15 12:00:00),
             cftime.DatetimeNoLeap(1982-03-17 00:00:00),
             cftime.DatetimeNoLeap(1982-04-16 12:00:00),
             cftime.DatetimeNoLeap(1982-05-17 00:00:00),
             cftime.DatetimeNoLeap(1982-06-16 12:00:00),
             cftime.DatetimeNoLeap(1982-07-17 00:00:00),
             cftime.DatetimeNoLeap(1982-08-17 00:00:00),
             cftime.DatetimeNoLeap(1982-09-16 12:00:00),
             cftime.DatetimeNoLeap(1982-10-17 00:00:00),
             cftime.DatetimeNoLeap(1982-11-16 12:00:00),
             cftime.DatetimeNoLeap(1982-12-17 00:00:00),
             cftime.DatetimeNoLeap(1983-01-17 00:00:00),
             cftime.DatetimeNoLeap(1983-02-15 12:00:00),
             cftime.DatetimeNoLeap(1983-03-17 00:00:00),
             cftime.DatetimeNoLeap(1983-04-16 12:00:00),
             cftime.DatetimeNoLeap(1983-05-17 00:00:00),
             cftime.DatetimeNoLeap(1983-06-16 12:00:00),
             cftime.DatetimeNoLeap(1983-07-17 00:00:00),
             cftime.DatetimeNoLeap(1983-08-17 00:00:00)], dtype=object)
    • xc
      (y, x)
      float64
      ...
      long_name :
      longitude of grid cell center
      units :
      degrees_east
      bounds :
      xv
      array([[189.222932, 189.389909, 189.558366, ..., 293.779061, 294.027924,
              294.274399],
             [188.96837 , 189.134706, 189.302537, ..., 294.05584 , 294.304444,
              294.55066 ],
             [188.712343, 188.878007, 189.045152, ..., 294.335053, 294.583375,
              294.829293],
             ...,
             [124.04724 , 123.88362 , 123.71852 , ...,  16.831718,  16.58437 ,
               16.339496],
             [123.786864, 123.622542, 123.456725, ...,  17.118145,  16.870437,
               16.625183],
             [123.527984, 123.36296 , 123.196441, ...,  17.402099,  17.154053,
               16.908451]])
    • yc
      (y, x)
      float64
      ...
      long_name :
      latitude of grid cell center
      units :
      degrees_north
      bounds :
      yv
      array([[16.534986, 16.778456, 17.022224, ..., 27.363016, 27.11811 , 26.87289 ],
             [16.693973, 16.938654, 17.183645, ..., 27.584772, 27.338218, 27.091366],
             [16.852192, 17.098089, 17.344309, ..., 27.805843, 27.557646, 27.309156],
             ...,
             [17.31179 , 17.561247, 17.811046, ..., 28.450248, 28.197183, 27.943847],
             [17.155897, 17.40414 , 17.652723, ..., 28.231296, 27.979893, 27.728216],
             [16.999195, 17.246229, 17.493587, ..., 28.0116  , 27.761856, 27.511827]])
    • Tair
      (time, y, x)
      float64
      ...
      units :
      C
      long_name :
      Surface air temperature
      type_preferred :
      double
      time_rep :
      instantaneous
      [2029500 values with dtype=float64]
  • title :
    /workspace/jhamman/processed/R1002RBRxaaa01a/lnd/temp/R1002RBRxaaa01a.vic.ha.1979-09-01.nc
    institution :
    U.W.
    source :
    RACM R1002RBRxaaa01a
    output_frequency :
    daily
    output_mode :
    averaged
    convention :
    CF-1.4
    references :
    Based on the initial model of Liang et al., 1994, JGR, 99, 14,415- 14,429.
    comment :
    Output from the Variable Infiltration Capacity (VIC) model.
    nco_openmp_thread_number :
    1
    NCO :
    "4.6.0"
    history :
    Tue Dec 27 14:15:22 2016: ncatted -a dimensions,,d,, rasm.nc rasm.nc Tue Dec 27 13:38:40 2016: ncks -3 rasm.nc rasm.nc history deleted for brevity

It is the surface air temperature data, with nan over the ocean.

[3]:
dr = ds["Tair"]
dr
[3]:
Show/Hide data repr Show/Hide attributes
xarray.DataArray
'Tair'
  • time: 36
  • y: 205
  • x: 275
  • ...
    [2029500 values with dtype=float64]
    • time
      (time)
      object
      1980-09-16 12:00:00 ... 1983-08-17 00:00:00
      long_name :
      time
      type_preferred :
      int
      array([cftime.DatetimeNoLeap(1980-09-16 12:00:00),
             cftime.DatetimeNoLeap(1980-10-17 00:00:00),
             cftime.DatetimeNoLeap(1980-11-16 12:00:00),
             cftime.DatetimeNoLeap(1980-12-17 00:00:00),
             cftime.DatetimeNoLeap(1981-01-17 00:00:00),
             cftime.DatetimeNoLeap(1981-02-15 12:00:00),
             cftime.DatetimeNoLeap(1981-03-17 00:00:00),
             cftime.DatetimeNoLeap(1981-04-16 12:00:00),
             cftime.DatetimeNoLeap(1981-05-17 00:00:00),
             cftime.DatetimeNoLeap(1981-06-16 12:00:00),
             cftime.DatetimeNoLeap(1981-07-17 00:00:00),
             cftime.DatetimeNoLeap(1981-08-17 00:00:00),
             cftime.DatetimeNoLeap(1981-09-16 12:00:00),
             cftime.DatetimeNoLeap(1981-10-17 00:00:00),
             cftime.DatetimeNoLeap(1981-11-16 12:00:00),
             cftime.DatetimeNoLeap(1981-12-17 00:00:00),
             cftime.DatetimeNoLeap(1982-01-17 00:00:00),
             cftime.DatetimeNoLeap(1982-02-15 12:00:00),
             cftime.DatetimeNoLeap(1982-03-17 00:00:00),
             cftime.DatetimeNoLeap(1982-04-16 12:00:00),
             cftime.DatetimeNoLeap(1982-05-17 00:00:00),
             cftime.DatetimeNoLeap(1982-06-16 12:00:00),
             cftime.DatetimeNoLeap(1982-07-17 00:00:00),
             cftime.DatetimeNoLeap(1982-08-17 00:00:00),
             cftime.DatetimeNoLeap(1982-09-16 12:00:00),
             cftime.DatetimeNoLeap(1982-10-17 00:00:00),
             cftime.DatetimeNoLeap(1982-11-16 12:00:00),
             cftime.DatetimeNoLeap(1982-12-17 00:00:00),
             cftime.DatetimeNoLeap(1983-01-17 00:00:00),
             cftime.DatetimeNoLeap(1983-02-15 12:00:00),
             cftime.DatetimeNoLeap(1983-03-17 00:00:00),
             cftime.DatetimeNoLeap(1983-04-16 12:00:00),
             cftime.DatetimeNoLeap(1983-05-17 00:00:00),
             cftime.DatetimeNoLeap(1983-06-16 12:00:00),
             cftime.DatetimeNoLeap(1983-07-17 00:00:00),
             cftime.DatetimeNoLeap(1983-08-17 00:00:00)], dtype=object)
    • xc
      (y, x)
      float64
      189.2 189.4 189.6 ... 17.15 16.91
      long_name :
      longitude of grid cell center
      units :
      degrees_east
      bounds :
      xv
      array([[189.222932, 189.389909, 189.558366, ..., 293.779061, 294.027924,
              294.274399],
             [188.96837 , 189.134706, 189.302537, ..., 294.05584 , 294.304444,
              294.55066 ],
             [188.712343, 188.878007, 189.045152, ..., 294.335053, 294.583375,
              294.829293],
             ...,
             [124.04724 , 123.88362 , 123.71852 , ...,  16.831718,  16.58437 ,
               16.339496],
             [123.786864, 123.622542, 123.456725, ...,  17.118145,  16.870437,
               16.625183],
             [123.527984, 123.36296 , 123.196441, ...,  17.402099,  17.154053,
               16.908451]])
    • yc
      (y, x)
      float64
      16.53 16.78 17.02 ... 27.76 27.51
      long_name :
      latitude of grid cell center
      units :
      degrees_north
      bounds :
      yv
      array([[16.534986, 16.778456, 17.022224, ..., 27.363016, 27.11811 , 26.87289 ],
             [16.693973, 16.938654, 17.183645, ..., 27.584772, 27.338218, 27.091366],
             [16.852192, 17.098089, 17.344309, ..., 27.805843, 27.557646, 27.309156],
             ...,
             [17.31179 , 17.561247, 17.811046, ..., 28.450248, 28.197183, 27.943847],
             [17.155897, 17.40414 , 17.652723, ..., 28.231296, 27.979893, 27.728216],
             [16.999195, 17.246229, 17.493587, ..., 28.0116  , 27.761856, 27.511827]])
  • units :
    C
    long_name :
    Surface air temperature
    type_preferred :
    double
    time_rep :
    instantaneous
[4]:
plt.figure(figsize=(12, 2))
ax = plt.axes(projection=ccrs.PlateCarree())
dr[0].plot.pcolormesh(ax=ax, x="xc", y="yc")
ax.coastlines()
../_images/notebooks_Curvilinear_grid_8_0.png

Input grid

xc and yc are longitude and latitude values. They are both 2D arrays, describing a curvilinear grid over high-latitudes. Note that it is totally fine for a grid to span over the south or north pole. ESMF performs regridding in the Cartesian space (x, y, z) so there will be no polar singularities.

[5]:
plt.scatter(ds["xc"], ds["yc"], s=0.01)  # plot grid locations
plt.ylim([-90, 90])
plt.xlabel("lon")
plt.ylabel("lat")
[5]:
Text(0, 0.5, 'lat')
../_images/notebooks_Curvilinear_grid_11_1.png

We need to rename the coordinate names to lon and lat because xESMF has no way to guess variable meaning.

[6]:
ds = ds.rename({"xc": "lon", "yc": "lat"})
ds
[6]:
Show/Hide data repr Show/Hide attributes
xarray.Dataset
    • time: 36
    • x: 275
    • y: 205
    • time
      (time)
      object
      1980-09-16 12:00:00 ... 1983-08-17 00:00:00
      long_name :
      time
      type_preferred :
      int
      array([cftime.DatetimeNoLeap(1980-09-16 12:00:00),
             cftime.DatetimeNoLeap(1980-10-17 00:00:00),
             cftime.DatetimeNoLeap(1980-11-16 12:00:00),
             cftime.DatetimeNoLeap(1980-12-17 00:00:00),
             cftime.DatetimeNoLeap(1981-01-17 00:00:00),
             cftime.DatetimeNoLeap(1981-02-15 12:00:00),
             cftime.DatetimeNoLeap(1981-03-17 00:00:00),
             cftime.DatetimeNoLeap(1981-04-16 12:00:00),
             cftime.DatetimeNoLeap(1981-05-17 00:00:00),
             cftime.DatetimeNoLeap(1981-06-16 12:00:00),
             cftime.DatetimeNoLeap(1981-07-17 00:00:00),
             cftime.DatetimeNoLeap(1981-08-17 00:00:00),
             cftime.DatetimeNoLeap(1981-09-16 12:00:00),
             cftime.DatetimeNoLeap(1981-10-17 00:00:00),
             cftime.DatetimeNoLeap(1981-11-16 12:00:00),
             cftime.DatetimeNoLeap(1981-12-17 00:00:00),
             cftime.DatetimeNoLeap(1982-01-17 00:00:00),
             cftime.DatetimeNoLeap(1982-02-15 12:00:00),
             cftime.DatetimeNoLeap(1982-03-17 00:00:00),
             cftime.DatetimeNoLeap(1982-04-16 12:00:00),
             cftime.DatetimeNoLeap(1982-05-17 00:00:00),
             cftime.DatetimeNoLeap(1982-06-16 12:00:00),
             cftime.DatetimeNoLeap(1982-07-17 00:00:00),
             cftime.DatetimeNoLeap(1982-08-17 00:00:00),
             cftime.DatetimeNoLeap(1982-09-16 12:00:00),
             cftime.DatetimeNoLeap(1982-10-17 00:00:00),
             cftime.DatetimeNoLeap(1982-11-16 12:00:00),
             cftime.DatetimeNoLeap(1982-12-17 00:00:00),
             cftime.DatetimeNoLeap(1983-01-17 00:00:00),
             cftime.DatetimeNoLeap(1983-02-15 12:00:00),
             cftime.DatetimeNoLeap(1983-03-17 00:00:00),
             cftime.DatetimeNoLeap(1983-04-16 12:00:00),
             cftime.DatetimeNoLeap(1983-05-17 00:00:00),
             cftime.DatetimeNoLeap(1983-06-16 12:00:00),
             cftime.DatetimeNoLeap(1983-07-17 00:00:00),
             cftime.DatetimeNoLeap(1983-08-17 00:00:00)], dtype=object)
    • lon
      (y, x)
      float64
      189.2 189.4 189.6 ... 17.15 16.91
      long_name :
      longitude of grid cell center
      units :
      degrees_east
      bounds :
      xv
      array([[189.222932, 189.389909, 189.558366, ..., 293.779061, 294.027924,
              294.274399],
             [188.96837 , 189.134706, 189.302537, ..., 294.05584 , 294.304444,
              294.55066 ],
             [188.712343, 188.878007, 189.045152, ..., 294.335053, 294.583375,
              294.829293],
             ...,
             [124.04724 , 123.88362 , 123.71852 , ...,  16.831718,  16.58437 ,
               16.339496],
             [123.786864, 123.622542, 123.456725, ...,  17.118145,  16.870437,
               16.625183],
             [123.527984, 123.36296 , 123.196441, ...,  17.402099,  17.154053,
               16.908451]])
    • lat
      (y, x)
      float64
      16.53 16.78 17.02 ... 27.76 27.51
      long_name :
      latitude of grid cell center
      units :
      degrees_north
      bounds :
      yv
      array([[16.534986, 16.778456, 17.022224, ..., 27.363016, 27.11811 , 26.87289 ],
             [16.693973, 16.938654, 17.183645, ..., 27.584772, 27.338218, 27.091366],
             [16.852192, 17.098089, 17.344309, ..., 27.805843, 27.557646, 27.309156],
             ...,
             [17.31179 , 17.561247, 17.811046, ..., 28.450248, 28.197183, 27.943847],
             [17.155897, 17.40414 , 17.652723, ..., 28.231296, 27.979893, 27.728216],
             [16.999195, 17.246229, 17.493587, ..., 28.0116  , 27.761856, 27.511827]])
    • Tair
      (time, y, x)
      float64
      ...
      units :
      C
      long_name :
      Surface air temperature
      type_preferred :
      double
      time_rep :
      instantaneous
      [2029500 values with dtype=float64]
  • title :
    /workspace/jhamman/processed/R1002RBRxaaa01a/lnd/temp/R1002RBRxaaa01a.vic.ha.1979-09-01.nc
    institution :
    U.W.
    source :
    RACM R1002RBRxaaa01a
    output_frequency :
    daily
    output_mode :
    averaged
    convention :
    CF-1.4
    references :
    Based on the initial model of Liang et al., 1994, JGR, 99, 14,415- 14,429.
    comment :
    Output from the Variable Infiltration Capacity (VIC) model.
    nco_openmp_thread_number :
    1
    NCO :
    "4.6.0"
    history :
    Tue Dec 27 14:15:22 2016: ncatted -a dimensions,,d,, rasm.nc rasm.nc Tue Dec 27 13:38:40 2016: ncks -3 rasm.nc rasm.nc history deleted for brevity

Output grid

Say we want to regrid it to a global \(4^\circ \times 5^\circ\) grid. xESMF provides a shortcut to make this output grid.

[7]:
ds_out = xe.util.grid_global(5, 4)
ds_out  # contains lat/lon values of cell centers and boundaries.
[7]:
Show/Hide data repr Show/Hide attributes
xarray.Dataset
    • x: 72
    • x_b: 73
    • y: 45
    • y_b: 46
    • lon
      (y, x)
      float64
      -177.5 -172.5 ... 172.5 177.5
      array([[-177.5, -172.5, -167.5, ...,  167.5,  172.5,  177.5],
             [-177.5, -172.5, -167.5, ...,  167.5,  172.5,  177.5],
             [-177.5, -172.5, -167.5, ...,  167.5,  172.5,  177.5],
             ...,
             [-177.5, -172.5, -167.5, ...,  167.5,  172.5,  177.5],
             [-177.5, -172.5, -167.5, ...,  167.5,  172.5,  177.5],
             [-177.5, -172.5, -167.5, ...,  167.5,  172.5,  177.5]])
    • lat
      (y, x)
      float64
      -88.0 -88.0 -88.0 ... 88.0 88.0
      array([[-88., -88., -88., ..., -88., -88., -88.],
             [-84., -84., -84., ..., -84., -84., -84.],
             [-80., -80., -80., ..., -80., -80., -80.],
             ...,
             [ 80.,  80.,  80., ...,  80.,  80.,  80.],
             [ 84.,  84.,  84., ...,  84.,  84.,  84.],
             [ 88.,  88.,  88., ...,  88.,  88.,  88.]])
    • lon_b
      (y_b, x_b)
      int64
      -180 -175 -170 -165 ... 170 175 180
      array([[-180, -175, -170, ...,  170,  175,  180],
             [-180, -175, -170, ...,  170,  175,  180],
             [-180, -175, -170, ...,  170,  175,  180],
             ...,
             [-180, -175, -170, ...,  170,  175,  180],
             [-180, -175, -170, ...,  170,  175,  180],
             [-180, -175, -170, ...,  170,  175,  180]])
    • lat_b
      (y_b, x_b)
      int64
      -90 -90 -90 -90 -90 ... 90 90 90 90
      array([[-90, -90, -90, ..., -90, -90, -90],
             [-86, -86, -86, ..., -86, -86, -86],
             [-82, -82, -82, ..., -82, -82, -82],
             ...,
             [ 82,  82,  82, ...,  82,  82,  82],
             [ 86,  86,  86, ...,  86,  86,  86],
             [ 90,  90,  90, ...,  90,  90,  90]])

    The output coordinates are all 2D arrays. They happen to be a rectilinear grid in this case (lat is constant over x axis, and lon is constant over y axis), but you can use 2D arrays to specify any curvilinear grids.

    Perform regridding

    Regridding is straightforward, just like the previous example.

    [8]:
    
    regridder = xe.Regridder(ds, ds_out, "bilinear")
    dr_out = regridder(dr)
    

    Check results

    Extra dimensions and coordinate values are all correct, like in the previous example.

    [9]:
    
    dr_out
    
    [9]:
    
    Show/Hide data repr Show/Hide attributes
    xarray.DataArray
    'Tair'
    • time: 36
    • y: 45
    • x: 72
    • 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ... nan nan nan nan nan nan nan nan
      array([[[ 0.,  0.,  0., ...,  0.,  0.,  0.],
              [ 0.,  0.,  0., ...,  0.,  0.,  0.],
              [ 0.,  0.,  0., ...,  0.,  0.,  0.],
              ...,
              [nan, nan, nan, ..., nan, nan, nan],
              [nan, nan, nan, ..., nan, nan, nan],
              [nan, nan, nan, ..., nan, nan, nan]],
      
             [[ 0.,  0.,  0., ...,  0.,  0.,  0.],
              [ 0.,  0.,  0., ...,  0.,  0.,  0.],
              [ 0.,  0.,  0., ...,  0.,  0.,  0.],
              ...,
              [nan, nan, nan, ..., nan, nan, nan],
              [nan, nan, nan, ..., nan, nan, nan],
              [nan, nan, nan, ..., nan, nan, nan]],
      
             [[ 0.,  0.,  0., ...,  0.,  0.,  0.],
              [ 0.,  0.,  0., ...,  0.,  0.,  0.],
              [ 0.,  0.,  0., ...,  0.,  0.,  0.],
              ...,
              [nan, nan, nan, ..., nan, nan, nan],
              [nan, nan, nan, ..., nan, nan, nan],
              [nan, nan, nan, ..., nan, nan, nan]],
      
             ...,
      
             [[ 0.,  0.,  0., ...,  0.,  0.,  0.],
              [ 0.,  0.,  0., ...,  0.,  0.,  0.],
              [ 0.,  0.,  0., ...,  0.,  0.,  0.],
              ...,
              [nan, nan, nan, ..., nan, nan, nan],
              [nan, nan, nan, ..., nan, nan, nan],
              [nan, nan, nan, ..., nan, nan, nan]],
      
             [[ 0.,  0.,  0., ...,  0.,  0.,  0.],
              [ 0.,  0.,  0., ...,  0.,  0.,  0.],
              [ 0.,  0.,  0., ...,  0.,  0.,  0.],
              ...,
              [nan, nan, nan, ..., nan, nan, nan],
              [nan, nan, nan, ..., nan, nan, nan],
              [nan, nan, nan, ..., nan, nan, nan]],
      
             [[ 0.,  0.,  0., ...,  0.,  0.,  0.],
              [ 0.,  0.,  0., ...,  0.,  0.,  0.],
              [ 0.,  0.,  0., ...,  0.,  0.,  0.],
              ...,
              [nan, nan, nan, ..., nan, nan, nan],
              [nan, nan, nan, ..., nan, nan, nan],
              [nan, nan, nan, ..., nan, nan, nan]]])
      • time
        (time)
        object
        1980-09-16 12:00:00 ... 1983-08-17 00:00:00
        long_name :
        time
        type_preferred :
        int
        array([cftime.DatetimeNoLeap(1980-09-16 12:00:00),
               cftime.DatetimeNoLeap(1980-10-17 00:00:00),
               cftime.DatetimeNoLeap(1980-11-16 12:00:00),
               cftime.DatetimeNoLeap(1980-12-17 00:00:00),
               cftime.DatetimeNoLeap(1981-01-17 00:00:00),
               cftime.DatetimeNoLeap(1981-02-15 12:00:00),
               cftime.DatetimeNoLeap(1981-03-17 00:00:00),
               cftime.DatetimeNoLeap(1981-04-16 12:00:00),
               cftime.DatetimeNoLeap(1981-05-17 00:00:00),
               cftime.DatetimeNoLeap(1981-06-16 12:00:00),
               cftime.DatetimeNoLeap(1981-07-17 00:00:00),
               cftime.DatetimeNoLeap(1981-08-17 00:00:00),
               cftime.DatetimeNoLeap(1981-09-16 12:00:00),
               cftime.DatetimeNoLeap(1981-10-17 00:00:00),
               cftime.DatetimeNoLeap(1981-11-16 12:00:00),
               cftime.DatetimeNoLeap(1981-12-17 00:00:00),
               cftime.DatetimeNoLeap(1982-01-17 00:00:00),
               cftime.DatetimeNoLeap(1982-02-15 12:00:00),
               cftime.DatetimeNoLeap(1982-03-17 00:00:00),
               cftime.DatetimeNoLeap(1982-04-16 12:00:00),
               cftime.DatetimeNoLeap(1982-05-17 00:00:00),
               cftime.DatetimeNoLeap(1982-06-16 12:00:00),
               cftime.DatetimeNoLeap(1982-07-17 00:00:00),
               cftime.DatetimeNoLeap(1982-08-17 00:00:00),
               cftime.DatetimeNoLeap(1982-09-16 12:00:00),
               cftime.DatetimeNoLeap(1982-10-17 00:00:00),
               cftime.DatetimeNoLeap(1982-11-16 12:00:00),
               cftime.DatetimeNoLeap(1982-12-17 00:00:00),
               cftime.DatetimeNoLeap(1983-01-17 00:00:00),
               cftime.DatetimeNoLeap(1983-02-15 12:00:00),
               cftime.DatetimeNoLeap(1983-03-17 00:00:00),
               cftime.DatetimeNoLeap(1983-04-16 12:00:00),
               cftime.DatetimeNoLeap(1983-05-17 00:00:00),
               cftime.DatetimeNoLeap(1983-06-16 12:00:00),
               cftime.DatetimeNoLeap(1983-07-17 00:00:00),
               cftime.DatetimeNoLeap(1983-08-17 00:00:00)], dtype=object)
      • lon
        (y, x)
        float64
        -177.5 -172.5 ... 172.5 177.5
        array([[-177.5, -172.5, -167.5, ...,  167.5,  172.5,  177.5],
               [-177.5, -172.5, -167.5, ...,  167.5,  172.5,  177.5],
               [-177.5, -172.5, -167.5, ...,  167.5,  172.5,  177.5],
               ...,
               [-177.5, -172.5, -167.5, ...,  167.5,  172.5,  177.5],
               [-177.5, -172.5, -167.5, ...,  167.5,  172.5,  177.5],
               [-177.5, -172.5, -167.5, ...,  167.5,  172.5,  177.5]])
      • lat
        (y, x)
        float64
        -88.0 -88.0 -88.0 ... 88.0 88.0
        array([[-88., -88., -88., ..., -88., -88., -88.],
               [-84., -84., -84., ..., -84., -84., -84.],
               [-80., -80., -80., ..., -80., -80., -80.],
               ...,
               [ 80.,  80.,  80., ...,  80.,  80.,  80.],
               [ 84.,  84.,  84., ...,  84.,  84.,  84.],
               [ 88.,  88.,  88., ...,  88.,  88.,  88.]])
    • regrid_method :
      bilinear

    The regridding result is consistent with the original data, but now on a rectilinear grid with a coarser resolution. nan is mapped to nan.

    [10]:
    
    plt.figure(figsize=(12, 4))
    ax = plt.axes(projection=ccrs.PlateCarree())
    dr_out[0].plot.pcolormesh(ax=ax, x="lon", y="lat")
    ax.coastlines()
    
    ../_images/notebooks_Curvilinear_grid_25_0.png