[ncl-talk] sub: netcdf write 2dlat/2dlon
Rick Brownrigg
brownrig at ucar.edu
Fri May 8 08:33:00 MDT 2020
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)
> _______________________________________________
> 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/20200508/3c5618e8/attachment.html>
More information about the ncl-talk
mailing list