[ncl-talk] sub: netcdf write 2dlat/2dlon
Dave Allured - NOAA Affiliate
dave.allured at noaa.gov
Fri May 8 10:58:14 MDT 2020
Dale, Rick:
The scheme for storing 2-D coordinates in Netcdf files is described by an
external convention, and is not part of the core Netcdf structure. A full
description is in CF Conventions (1.8) section 5.1. By conforming to the
convention, you enable the 2-D coordinates to be properly understood by a
wide range of generic software, not just NCL.
Here is an example of the bare minimum structure needed to conform. There
is a more complicated example in the CF document.
xxxx
xxx
On Fri, May 8, 2020 at 8:33 AM Rick Brownrigg via ncl-talk <
ncl-talk at ucar.edu> wrote:
> Hi Dale,
>
> You seem to be doing the proper things to attach coordinate variables to a
> variable. But by NetCDF convention (not due to NCL), "coordinate variables"
> are by definition !D arrays with a dimension name the same as the variable
> name.
>
> If you have 2D coordinates, the technique is generally to assign those to
> special lat2d/lon2d *attributes* of the variable. Check out the quote
> below and the web page it was taken from.
>
> Rick
>
> "To plot data on a curvilinear grid, you must read these 2D lat/lon
> variables from the file and attach them to the data variable as special
> attributes called "lat2d" and "lon2d":"
> ,,,
>
> temp at lat2d = a->gridlat_236 ; 113 x 151
> temp at lon2d = a->gridlon_236 ; 113 x 151
>
> http://ncl.ucar.edu/Applications/plot_data_on_map.shtml
>
>
> On Fri, May 8, 2020 at 3:33 AM dale zuri via ncl-talk <ncl-talk at ucar.edu>
> wrote:
>
>> Hi NCL user,
>> I have been trying to write a variable that is function of 2dlat/lon to
>> the netcdf file.
>> I'm getting following error. I would appreciate any help to fix this
>> error.
>>
>> Thanks
>>
>> VRH!0 = "lat2d" ; assign named dimensions
>>
>> VRH!1 = "lon2d"
>>
>>
>> VRH&lat2d = lat2d ; copy lat from T to ORO
>>
>> VRH&lat2d = lon2d
>>
>>
>> ncdf->VRH = VRH
>>
>>
>> Variable: VRH
>>
>> Type: integer
>>
>> Total Size: 491520 bytes
>>
>> 122880 values
>>
>> Number of Dimensions: 2
>>
>> Dimensions and sizes: [nj | 384] x [ni | 320]
>>
>> Coordinates:
>>
>> Number Of Attributes: 3
>>
>> lat2d : <ARRAY of 122880 elements>
>>
>> lon2d : <ARRAY of 122880 elements>
>>
>> _FillValue : -2147483647
>>
>> fatal:Coordinate variables must have one dimension only
>>
>> fatal:No coordinate variable exists for dimension (lat2d) in variable
>> (VRH)
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200508/a796c8c0/attachment.html>
More information about the ncl-talk
mailing list