# [ncl-talk] Latitude units assignment

Sourav Chatterjee srvsxc at outlook.com
Tue Dec 19 21:28:58 MST 2017

```Thanks Alan,

Just reordering it while plotting worked.

Sourav

________________________________
From: Alan Brammer <abrammer at albany.edu>
Sent: Tuesday, December 19, 2017 2:57:56 PM
To: Sourav Chatterjee
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] Latitude units assignment

Possibly 2 things:

1.
Would help to see the printVarSummary(sst) outputs, but I think you might be missing the actual coordinate values.  You named the dimension and set the units, but that doesn’t set the values.

sst!1 = "longitude"
sst!2 = “latitude”
sst&latitude   = f->Latitude        ;; assuming there is a variable in the file
sst&longitude = f->Longitude
sst&latitude at units = "degrees_north"
sst&longitude at units =“degrees_east"

When you printVarSummary(sst) you want to see values in the “Coordinates:” section of the output (highlighted below).

Variable: example
...
Number of Dimensions: 2
Dimensions and sizes: [lat | 10] x [lon | 10]
Coordinates:
lat: [ 0.. 9]
lon: [ 0.. 9]
Number Of Attributes: 1
_FillValue : 9.96921e+36

If this doesn’t work, include the printVarSummary(sst) outputs you’re getting.

2.
Would also help to see the line that actually gives you the error.
>From gsn_csm_contour_map() "If data is two-dimensional, then the leftmost dimension is represented on the Y (latitude) axis, and the rightmost dimension on the X (longitude) axis."

Currently your data is not ordered in this manner, so a simple way to plot it would be :
time_index = 0
plot = gsn_csm_contour_map(wks, sst( Time | time_index, latitude | :, longitude | : ), res)

See the reference manual here: http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml#NamedSubscripting

Good luck,

Alan

On 19 Dec 2017, at 09:26, Sourav Chatterjee via ncl-talk <ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>> wrote:

Hi,

My original variable is as below:

float SLA(Time, Longitude, Latitude) ;
SLA:_FillValue = 9.96921e+36f ;
SLA:scale_factor = 1.f ;
SLA:coordinates = "Sea Level Anomaly Estimate" ;
SLA:long_name = "Sea Level Anomaly Estimate" ;
SLA:standard_name = "Sea Level Anomaly Estimate" ;
SLA:units = "m" ;

As the lat lon dimensions has no units I was not getting the plot properly.

I tried this:

sst = f->SLA
printVarSummary(sst)

sst!1 = "longitude"
sst!2 = "latitude"

sst&latitude at units = "degrees_north"
sst&longitude at units ="degrees_east"

printVarSummary(sst)

But still getting the error,

(0)    check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.
(0)    A valid latitude coordinate array should have a 'units' attribute equal to one of the following values:

Why is the units attribute is not getting assigned?

Thanks
Sourav
_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171220/54c6c7f0/attachment.html>
```