# Finding corners of grid cells

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

#### gabriel_bromley

##### New member
Hello,

I would like to implement 1st order conservative remapping using the CDO utilities. They require the 4 corner lats and lons of each grid cell as referenced below. Is there any utility that exists that could get these corners? Any ideas?

Code:
Here is an example for the CDO description of a curvilinear grid. xvals/yvals describe the positions of the 6x5 quadrilateral grid cells. The first 4 values of xbounds/ybounds are the corners of the first grid cell.

gridtype  = curvilinear
gridsize  = 30
xsize     = 6
ysize     = 5
xvals     =  -21  -11    0   11   21   30  -25  -13    0   13
25   36  -31  -16    0   16   31   43  -38  -21
0   21   38   52  -51  -30    0   30   51   64
xbounds   =  -23  -14  -17  -28       -14   -5   -6  -17        -5    5    6   -6
5   14   17    6        14   23   28   17        23   32   38   28
-28  -17  -21  -34       -17   -6   -7  -21        -6    6    7   -7
6   17   21    7        17   28   34   21        28   38   44   34
-34  -21  -27  -41       -21   -7   -9  -27        -7    7    9   -9
7   21   27    9        21   34   41   27        34   44   52   41
-41  -27  -35  -51       -27   -9  -13  -35        -9    9   13  -13
9   27   35   13        27   41   51   35        41   52   63   51
-51  -35  -51  -67       -35  -13  -21  -51       -13   13   21  -21
13   35   51   21        35   51   67   51        51   63   77   67
yvals     =   29   32   32   32   29   26   39   42   42   42
39   35   48   51   52   51   48   43   57   61
62   61   57   51   65   70   72   70   65   58
ybounds   =   23   26   36   32        26   27   37   36        27   27   37   37
27   26   36   37        26   23   32   36        23   19   28   32
32   36   45   41        36   37   47   45        37   37   47   47
37   36   45   47        36   32   41   45        32   28   36   41
41   45   55   50        45   47   57   55        47   47   57   57
47   45   55   57        45   41   50   55        41   36   44   50
50   55   64   58        55   57   67   64        57   57   67   67
57   55   64   67        55   50   58   64        50   44   51   58
58   64   72   64        64   67   77   72        67   67   77   77
67   64   72   77        64   58   64   72        58   51   56   64

The XLAT_C and XLONG_C fields in the geogrid output files should provide you with the corner latitudes and longitudes:
Code:
float XLAT_C(Time, south_north_stag, west_east_stag) ;
XLAT_C:FieldType = 104 ;
XLAT_C:MemoryOrder = "XY " ;
XLAT_C:units = "degrees latitude" ;
XLAT_C:description = "Latitude at grid cell corners" ;
XLAT_C:stagger = "CORNER" ;
XLAT_C:sr_x = 1 ;
XLAT_C:sr_y = 1 ;
float XLONG_C(Time, south_north_stag, west_east_stag) ;
XLONG_C:FieldType = 104 ;
XLONG_C:MemoryOrder = "XY " ;
XLONG_C:units = "degrees longitude" ;
XLONG_C:description = "Longitude at grid cell corners" ;
XLONG_C:stagger = "CORNER" ;
XLONG_C:sr_x = 1 ;
XLONG_C:sr_y = 1 ;

So the 4 corner longitudes of the first grid cell would be:

Code:
xlong_c[0][0]
xlong_c[0][1]
xlong_c[1][1]
xlong_c[1][0]

Am I interpreting this correctly?

Thanks,

Gabe

Yes, that should work.