[ncl-talk] Assign 2d Lat Lon matrices as coordinates to a 2d variable matrix

Athanasios Karagiannidis thankar at live.com
Wed Mar 28 04:02:08 MDT 2018


Dave,


Thank you for your answer.


I'm just making plots at the moment.


Athansios


Athanasios F. Karagiannidis
Physicist, PhD Meteorology and Climatology
E-mail: thankar at live.com


________________________________
From: Dave Allured - NOAA Affiliate <dave.allured at noaa.gov>
Sent: Tuesday, March 27, 2018 7:58 PM
To: Athanasios Karagiannidis
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] Assign 2d Lat Lon matrices as coordinates to a 2d variable matrix

Athanasios,

For plotting fields with 2-D coordinate arrays, use one of these two methods.  Attach the 2-D coordinates directly to the data variable, using these special attribute names:

    FR at lat2d = Lat         ; (2-D)
    FR at lon2d = Lon         ; (2-D)

Alternatively, attach the 2-D coordinates to the plot resource variable.  The special attribute names are different in this method:

    res at sfYArray = Lat     ; (2-D)
    res at sfXArray = Lon     ; (2-D)

Please see section 2 on this page for more details and examples:

    http://www.ncl.ucar.edu/Document/Graphics/overlays_on_map.shtml
NCL Graphics: overlaying data on a map<http://www.ncl.ucar.edu/Document/Graphics/overlays_on_map.shtml>
www.ncl.ucar.edu
NCL Home > Documentation > Graphics Overlaying data on a map For some specific examples of plotting data on a map, see the "Plotting data on a map using gsn_csm_xxx ...


There are many other examples on this page, listed directly under the names of these special attributes:

    http://www.ncl.ucar.edu/Applications/res_list.shtml

There is a different convention for writing self-contained Netcdf files to share with other people.  Are you writing files, or just making plots?

--Dave


On Tue, Mar 27, 2018 at 10:42 AM, Athanasios Karagiannidis <thankar at live.com<mailto:thankar at live.com>> wrote:

Dear all



Could someone help with the following: I have a 2d matrix of a variable (let’s call it FR), extracted from an hdf5 file. I get a 2d Lat matrix and a 2d Lon matrix from 2 other files. How can I assign these Lat and Lon matrices as dimensions for FR? I need to point out here, that the grid in not regular.

I already thought about transforming FR, Lat, and Lon to a 1d matrices, and combining them to a single matrix with Lat, Lon and FR as the first, second and third column respectively. But I think it would be more elegant, and less resource-consuming if I could just assign the Lat Lon matrices as coordinates to FR matrix.



Thank you in advance



Athanasios Karagiannidis

Athanasios F. Karagiannidis
Physicist, PhD Meteorology and Climatology
E-mail: thankar at live.com<mailto:thankar at live.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180328/83716c22/attachment.html>


More information about the ncl-talk mailing list