[Thread Prev][Thread Next][Index]

Re: [ferret_users] Defining long_name and standard_name for an axis



Hi Mike,
You can do this (though it's not working completely as I'll show below). The syntax for specifying an coordinate variable is to put it in parentheses. Since coordinate variables, or axes, are different from regular variables, we used this different syntax. For coordinate variables that come from netCDF files, you can do the following

yes? use etopo60
yes? show grid rose
   GRID GQW1
name       axis              # pts   start                end
ETOPO60X  LONGITUDE          360mr   20.5E                19.5E(379.5)
ETOPO60Y  LATITUDE           180 r   89.5S                89.5N
normal    Z
normal    T

yes? define attribute/output (ETOPO60Y).long_name = "this is the Y axis of ROSE"
yes? save/clobber/file=aa.nc rose
LISTing to file aa.nc

yes? sp ncdump -h aa.nc
netcdf aa {
dimensions:
       ETOPO60X = 360 ;
       ETOPO60Y = 180 ;
variables:
       double ETOPO60X(ETOPO60X) ;
               ETOPO60X:units = "degrees_east" ;
               ETOPO60X:modulo = " " ;
               ETOPO60X:point_spacing = "even" ;
               ETOPO60X:axis = "X" ;
       double ETOPO60Y(ETOPO60Y) ;
               ETOPO60Y:units = "degrees_north" ;
               ETOPO60Y:point_spacing = "even" ;
               ETOPO60Y:long_name = "this is the Y axis of ROSE" ;
               ETOPO60Y:axis = "Y" ;
       float ROSE(ETOPO60Y, ETOPO60X) ;
               ROSE:missing_value = -1.e+34f ;
...

If you've defined the axis in Ferret, I'm finding that this doesn't always work:

yes? ! define an axis, add an attribute, and synthesize a variable
yes? ! on the axis. The attribute is saved to a file:

yes? define axis/y=-89:89:1/units=deg longitude
yes? let v = y[gy=longitude]

yes? define attribute/output (longitude).long_name = "here is a new longitude axis"
yes? sh att/all (longitude)
    attributes for coordinate axis
(LONGITUDE).units = DEG
(LONGITUDE).point_spacing = even
(LONGITUDE).axis = Y
(LONGITUDE).long_name = here is a new longitude axis

yes? save/clobber/file=aa.nc  v
LISTing to file aa.nc

yes? sp ncdump -h aa.nc
netcdf aa {
dimensions:
       LONGITUDE = 179 ;
variables:
       double LONGITUDE(LONGITUDE) ;
               LONGITUDE:units = "DEG" ;
               LONGITUDE:point_spacing = "even" ;
               LONGITUDE:axis = "Y" ;
               LONGITUDE:long_name = "here is a new longitude axis" ;
       float V(LONGITUDE) ;
               V:missing_value = -1.e+34f ;
               V:_FillValue = -1.e+34f ;
               V:long_name = "Y[GY=LONGITUDE]" ;


! But, if we define an axis and regrid an existing variable to it:



yes? use etopo120
yes? define axis/y=-89:89:1/units=deg longitude
yes? define attribute/output (longitude).long_name = "here is a 1-degree longitude axis"
yes? sh att/all (longitude)
    attributes for coordinate axis
(LONGITUDE).units = DEG
(LONGITUDE).point_spacing = even
(LONGITUDE).axis = Y
(LONGITUDE).long_name = here is a 1-degree longitude axis

yes? let rosey = rose[gy=longitude]
yes? save/clobber/file=aa.nc rosey
LISTing to file aa.nc

yes? sp ncdump -h aa.nc
netcdf aa {
dimensions:
       ETOPO120X = 180 ;
       LONGITUDE = 179 ;
variables:
       double ETOPO120X(ETOPO120X) ;
               ETOPO120X:units = "degrees_east" ;
               ETOPO120X:modulo = " " ;
               ETOPO120X:point_spacing = "even" ;
               ETOPO120X:axis = "X" ;
       double LONGITUDE(LONGITUDE) ;
               LONGITUDE:units = "degrees_north" ;
               LONGITUDE:point_spacing = "even" ;
               LONGITUDE:axis = "Y" ;
       float ROSEY(LONGITUDE, ETOPO120X) ;


This'll give you a start, and we'll work on getting the new attribute saved to files in all cases.

Ansley

McCann, Mike wrote:
Hi,
How does one set the attributes 'long_name' and 'standard_name' for output to netCDF on an axis? I can do this for a variable: DEFINE ATTRIBUTE/output PSAL.standard_name = "sea_water_salinity"

but for an axis defined like this:

  DEFINE AXIS/X/UNITS=deg LONGITUDE=-122.39965

I don't see how to set the long_name or standard_name.
I'm trying to get my data set to pass the CF compliance checker which is complaining like this: ------------------
Checking variable: LONGITUDE
------------------
WARNING (3): No standard_name or long_name attribute specified

-Mike

--
Mike McCann
Software Engineer
Monterey Bay Aquarium Research Institute
7700 Sandholdt Road
Moss Landing, CA 95039-9644
Voice: 831.775.1769 Fax: 831.775.1736 http://www.mbari.org <http://www.mbari.org/>





[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement