[ncl-talk] Fwd: Another dimensions problem

Dennis Shea shea at ucar.edu
Wed Feb 1 11:27:28 MST 2017


'For convenience', primarily graphical convenience, NCL allows
multidimensional attributes to be associated with variables. However, the
underlying netCDF software precludes writing multi-dimensional attributes.
Multidimensional attributes are written as 1D.

As a side point: netCDF and NCL do not allow cascading attributes:
attributes can not have  attributes.

See:
http://www.unidata.ucar.edu/software/netcdf/netcdf/Differences-between-Attributes-and-Variables.html

---
Again, 'for convenience', NCL high level graphical interfaces are aware of
specific multi-dimensional attributes (eg: 'lat2d', 'lon2d' ). However, if
variables X, Y, Z each has associated with it the lat2d, lon2d attributes
for graphical reasons  and, subsequently, each variable is written to a
netCDF file, the file will have these attributes written for each variable.
If the lat2d & lon2d arrays are large, this could have a significant impact
on file size.

IMHO: when writing netCDF

[1]
Write the lat2d, lon2d as separate variables. Any name: LAT, LON, LAT2D,
LON2D, XLAT, XLONG,.....).

[2]
Not required, but recommended, associate with each variable being written a
'coordinates' attribute specifying the variables containing coordinates
(separated by spaces), say

     X at coordinates = "XLONG XLAT"
     Y at coordinates = "XLONG XLAT"

[3]
Delete the 'lat2d' and 'lon2d'  attributes *PRIOR* to writing the variables
to the file
      delete([/ X at lat2d, X at lon2d, ....., Z at lat2d, Z at lon2d /])

D






On Wed, Feb 1, 2017 at 10:03 AM, Alan Brammer <abrammer at albany.edu> wrote:

> There’s something weird going on with how ncl interprets the lat2d and
> lon2d attributes.
>
> If you redefine the attributes in the script as you had commented out.
> e.g.
> l_obs at lat2d :=  xlat(0,:,:)       ; this is for plotting
> l_obs at lon2d := xlon(0,:,:)     ; using gsn_csm routines
>
> When they get written to netcdf they are converted to actual 1d arrays.
> While they’re in the script they are in a weird world of being a fake 2d
> array.
>
> I’m surprised that NCL doesn’t handle a 1d array and unwrap it accordingly
> though.
>
>
> Good luck.
>
>
>
>
> On 1 Feb 2017, at 11:17, Barry Lynn <barry.h.lynn at gmail.com> wrote:
>
> I hope someone might have a suggestion.  Thank you.
> ---------- Forwarded message ----------
> From: Barry Lynn <barry.h.lynn at gmail.com>
> Date: Sun, Jan 29, 2017 at 2:36 PM
> Subject: Another dimensions problem
> To: ncl-talk <ncl-talk at ucar.edu>
>
>
> Hi:
>
> I cannot succeed to map a variable from the wrfinput_d02.nc file.
>
> I get a dimension problem (different dimensions, different sizes).
>
> This problem seems to happen often and using (/var/) didn't solve it.
>
> Thank you,
>
> Barry​
>  wrfinput_d02.nc
> <https://drive.google.com/file/d/0B3E3GjUeKpBdUXBVdk5VeW95WUk/view?usp=drive_web>
>>
> --
> Barry H. Lynn, Ph.D
> Senior Lecturer,
> The Institute of the Earth Science,
> The Hebrew University of Jerusalem,
> Givat Ram, Jerusalem 91904, Israel
> Tel: 972 547 231 170
> Fax: (972)-25662581
>
> C.E.O, Weather It Is, LTD
> Weather and Climate Focus
> http://weather-it-is.com
> Jerusalem, Israel
> Local: 02 930 9525
> Cell: 054 7 231 170
> Int-IS: x972 2 930 9525
> US 914 432 3108 <(914)%20432-3108>
>
>
>
> --
> Barry H. Lynn, Ph.D
> Senior Lecturer,
> The Institute of the Earth Science,
> The Hebrew University of Jerusalem,
> Givat Ram, Jerusalem 91904, Israel
> Tel: 972 547 231 170
> Fax: (972)-25662581
>
> C.E.O, Weather It Is, LTD
> Weather and Climate Focus
> http://weather-it-is.com
> Jerusalem, Israel
> Local: 02 930 9525
> Cell: 054 7 231 170
> Int-IS: x972 2 930 9525
> US 914 432 3108 <(914)%20432-3108>
> <l_obs_map.ncl><map_output.file>_________________________
> ______________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
> _______________________________________________
> ncl-talk mailing list
> 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/20170201/089e65be/attachment.html 


More information about the ncl-talk mailing list