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

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Tue Mar 27 11:58:46 MDT 2018

```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)

http://www.ncl.ucar.edu/Document/Graphics/overlays_on_map.shtml

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
> 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.
>
>
>
>
>
>
> Athanasios Karagiannidis
>
> Athanasios F. Karagiannidis
> Physicist, PhD Meteorology and Climatology
> E-mail: thankar at live.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180327/ec1c6987/attachment.html>
```