[ncl-talk] metadata for netCDF file
Mary Haley
haley at ucar.edu
Tue Dec 16 10:12:08 MST 2014
Mark,
1) You can do it directly on the variable on the file, as long as you open
the file in "w" mode when you call addfile:
a = addfile("......","w")
a->tas at coordinates = "lon lat height"
2) and 3) can be answered together. Whenever NCL writes variables to a
NetCDF file, it *always* forces variables to have a dimension name, even
scalars. If you don't provide a name when you write the variable to a
NetCDF file using NCL, then NCL will assign names "ncl1", "ncl2", "ncl3",
etc.
When writing scalar variables to a file, we recommend using "ncl_scalar" as
a dimension name:
p0 =1000.
p0!0 = "ncl_scalar"
a->p0 = p0
For variables containing characters, like your rotated pole variable, it's
up to you to decide on a dimension name. ou might want to use something
that indicates a string length, like "nchar":
a->rotated_pole!0 = "nchar"
--Mary
On Thu, Dec 4, 2014 at 12:42 PM, Mark Chan <cym263 at yahoo.com> wrote:
>
> Dear NCL users,
>
> In the below is about the metadata of a netCDF file, generated by using
> NCL script. I would like to do some modification about the metadata. Can
> one give any suggestion how to do it?
>
> (1) modifying the coordinates from (tas:coordinates = "lon lat") to
> (tas:coordinates = "lon lat height")
> (2) the rotated_pole is a variable without a dimension, because it is a
> variable without any data. How can I improve it here?
> (3) what is the meaning of ncl3 and ncl5? how to remove them from the
> metadata?
>
> Thanks so much in advance.
>
> Cheers,
> Mark
>
>
> ===metadata below=========
> ncdump -h
> tas_AFR-44_NCC-NorESM1-M_historical_r1i1p1_BCCR-WRF331C_v1_mon_195001-195012.nc
>
>
> netcdf
> tas_AFR-44_NCC-NorESM1-M_historical_r1i1p1_BCCR-WRF331C_v1_mon_195001-195012
> {
> dimensions:
> time = UNLIMITED ; // (12 currently)
> rlon = 213 ;
> rlat = 220 ;
> ncl3 = 9 ;
> bnds = 2 ;
> ncl5 = 1 ;
> variables:
> double time(time) ;
> time:long_name = "time" ;
> time:standard_name = "time" ;
> time:units = "days since 1949-12-01 00:00:00" ;
> time:calendar = "standard" ;
> time:axis = "T" ;
> time:bounds = "time_bnds" ;
> double rlon(rlon) ;
> rlon:long_name = "longitude in rotated pole grid" ;
> rlon:standard_name = "grid_longitude" ;
> rlon:units = "degrees" ;
> rlon:axis = "X" ;
> double rlat(rlat) ;
> rlat:long_name = "latitude in rotated pole grid" ;
> rlat:standard_name = "grid_latitude" ;
> rlat:units = "degrees" ;
> rlat:axis = "Y" ;
> char rotated_pole(ncl3) ;
> rotated_pole:grid_mapping_name = "rotated_latitude_longitude" ;
> rotated_pole:grid_north_pole_latitude = 90.f ;
> rotated_pole:grid_north_pole_longitude = -180.f ;
> float tas(time, rlat, rlon) ;
> tas:long_name = "Near-Surface Air Temperature" ;
> tas:standard_name = "air_temperature" ;
> tas:units = "K" ;
> tas:cell_methods = "time: mean" ;
> tas:_FillValue = 1.e+20f ;
> tas:missing_value = 1.e+20f ;
> tas:coordinates = "lon lat" ;
> double time_bnds(time, bnds) ;
> time_bnds:long_name = "Time Bounds" ;
> time_bnds:standard_name = "time bounds" ;
> time_bnds:coordinates = "time bnds" ;
> double height(ncl5) ;
> height:long_name = "height" ;
> height:standard_name = "height" ;
> height:units = "m" ;
> height:positive = "up" ;
> height:axis = "Z" ;
> double lon(rlat, rlon) ;
> lon:long_name = "longitude" ;
> lon:standard_name = "longitude" ;
> lon:units = "degrees_east" ;
> lon:bounds = "lon_bnds" ;
> lon:coordinates = "lon lat" ;
> double lat(rlat, rlon) ;
> lat:long_name = "latitude" ;
> lat:standard_name = "latitude" ;
> lat:units = "degrees_north" ;
> lat:bounds = "lat_bnds" ;
> lat:coordinates = "lon lat" ;
> double lon_bnds(rlat, rlon, bnds) ;
> lon_bnds:long_name = "Longitude Bounds" ;
> lon_bnds:standard_name = "longitude bounds" ;
> lon_bnds:coordinates = "lon lat bnds" ;
> double lat_bnds(rlat, rlon, bnds) ;
> lat_bnds:long_name = "Latitude Bounds" ;
> lat_bnds:standard_name = "latitude bounds" ;
> lat_bnds:coordinates = "lon lat bnds" ;
>
>
>
> _______________________________________________
> ncl-talk mailing list
> 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/20141216/cdfbac5b/attachment.html
More information about the ncl-talk
mailing list