## Latitudes and longitudes from convert_mpas

Questions, issues, or suggestions related to post-processing of model output.
kgurer777
Posts: 3
Joined: Mon Jul 27, 2020 6:06 pm

### Latitudes and longitudes from convert_mpas

Hello,

I am trying to fully understand how "convert_mpas" routine works and how I should interpret its results. I have been examining the code for this purpose, but I need further interpretation please. The routine is fast and extracted values of 3D variables agree well with the global domain values.

When I convert "latCell" and "lonCell" variables of MPAS output into lat/lon grid using "convert_mpas" routine, the values of the variables are created for the 2D lat/lon coordinates of the target domain that I want to get the data in. While the coordinates are in degrees, the data comes in radian:

--------------------------------------------------------------------

Variable: lat2d
Type: float
Total Size: 42336 bytes
10584 values
Number of Dimensions: 2
Dimensions and sizes: [latitude | 98] x [longitude | 108]
Coordinates:
latitude: [31.6178..42.50189]
longitude: [-129.0292..-113.0208]
Number Of Attributes: 2
long_name : Latitude of cells
(0) Latitude of cells (rad) : min=0.551835 max=0.741798
(0) ---------------

Variable: lon2d
Type: float
Total Size: 42336 bytes
10584 values
Number of Dimensions: 2
Dimensions and sizes: [latitude | 98] x [longitude | 108]
Coordinates:
latitude: [31.6178..42.50189]
longitude: [-129.0292..-113.0208]
Number Of Attributes: 2
long_name : Longitude of cells
(0) Longitude of cells (rad) : min=4.0312 max=4.3106
(0) min=0.0854768 max=17.7317
-----------------------------------------------------------------------------------

When I try to convert the data points from radian to degrees by multiplying the data via clipped ncl script below:

------------------------------------------------------------------------------------
r2d = 180.0/(atan(1)*4.0)

lat2d = a->latCell * r2d
printVarSummary(lat2d)
printMinMax(lat2d,0)

print("---------------")

lon2d = a->lonCell * r2d
printVarSummary(lon2d)
printMinMax(lon2d,0)

then the output is:
----------------------------------------------------------------------

Variable: lat2d
Type: float
Total Size: 42336 bytes
10584 values
Number of Dimensions: 2
Dimensions and sizes: [98] x [108]
Coordinates:
(0) min=31.6178 max=42.5019
(0) ---------------

Variable: lon2d
Type: float
Total Size: 42336 bytes
10584 values
Number of Dimensions: 2
Dimensions and sizes: [98] x [108]
Coordinates:
(0) min=230.971 max=246.979
(0) min=0.0854768 max=17.7317
----------------------------------------------------------------------
In this case, "Coordinates" of both latCell and lonCell are lost, lat2d values are in the correct range but lon2d values are now flipped from "-180/180" to "0/360" range. What am I doing wrong here, or, am I interpreting the results incrorrectly? Is multiplying the latCell and lonCell with r2d wrong and why the multiplication eliminates the coordinates?

How can I fix this problem and convert latCell and lonCell into 2d lat/lon grid with correct degree values?

I appreciate your help very much. Thank you.

Kemal.

mgduda
Posts: 466
Joined: Mon Feb 26, 2018 7:35 pm

### Re: Latitudes and longitudes from convert_mpas

I don't think I'm completely following your workflow, but multiplying the latitudes and longitudes in radians by 180.0/(atan(1.0)*4.0) should be fine.

At what point are the Coordinates added? This isn't something that the convert_mpas program provides. Do you have an NCL script that processes the output of the convert_mpas program?
NCAR/MMM