how to regrid TLONG/TLAT pop data to regular Lon/Lat grid with python

mneedham

Michael Needham
New Member
Hello,

Is there a "best practice" way to regrid POP output from the TLONG/TLAT grid to a regular (e.g., 1x1 degree) grid?

My naive approach would be:
  • loop over all combinations of lats / lons on my desired 1x1 deg grid
  • collect all Tlong/Tlat gridcells within 0.5 deg of the given lat/lon
  • Perform an average (or some other operation) to give a single value at the new gridcell
However this will likely be slow...
 

mneedham

Michael Needham
New Member
Hi Gustavo, Thank you for the recommendation.

xESMF works great when I use

Code:
xesmf.Regridder(..., method='bilinear')

but fails with

Code:
xesmf.Regridder(..., method='conservative')

AttributeError: 'DataArray.cf' object has no attribute 'get_bounds'

It appears that POP output files do not have bounds for TLONG and TLAT dimensions. Do you have a recommendation of how to perform conservative regridding of POP output?
 

mneedham

Michael Needham
New Member
I don't see a way to explicitly pass the corner points to xesmf.Regridder. Do I need to update my input dataArray to include these corner points somehow?

Note, My input data looks like:

Python:
>>> print(dset.VNT)

<xarray.DataArray 'VNT' (z_t: 60, nlat: 384, nlon: 320)>
dask.array<getitem, shape=(60, 384, 320), dtype=float32, chunksize=(60, 384, 320), chunktype=numpy.ndarray>
Coordinates:
  * z_t      (z_t) float32 500.0 1.5e+03 2.5e+03 ... 5.125e+05 5.375e+05
    ULONG    (nlat, nlon) float64 dask.array<chunksize=(384, 320), meta=np.ndarray>
    ULAT     (nlat, nlon) float64 dask.array<chunksize=(384, 320), meta=np.ndarray>
    TLONG    (nlat, nlon) float64 dask.array<chunksize=(384, 320), meta=np.ndarray>
    TLAT     (nlat, nlon) float64 dask.array<chunksize=(384, 320), meta=np.ndarray>
    year     int64 1851
Dimensions without coordinates: nlat, nlon
Attributes:
    long_name:     Flux of Heat in grid-y direction
    units:         degC/s
    grid_loc:      3121
    cell_methods:  time: mean

But there are no lat/lon bounds for this data:

Python:
>>> print(dset.VNT.cf)

Coordinates:
- CF Axes:   X, Y, Z, T: n/a

- CF Coordinates:   longitude: ['TLONG', 'ULONG']
                    latitude: ['TLAT', 'ULAT']
                  * vertical: ['z_t']
                    time: n/a

- Cell Measures:   area, volume: n/a

- Standard Names:   n/a

- Bounds:   n/a
 
Back
Top