[Thread Prev][Thread Next][Index]

Re: [ferret_users] SHOW VAR/DATA_SET wrongly counts long name attribute



hi Hella,
You've come upon a bit of an untested corner of Ferret commands. With Ferret V6 we added syntax to access information about file attributes and along with that we put in logic to list file variables with the command

   show var/dset=n  varname

Previous to that the show var command only applied to user-defined variables. This was not well tested (and currently works only inconsistently).

What you are seeing in this output,
yes? sh var/data rh
 rh var # 5 of dataset ./ex_traj2.nc
 rh var # 6 of dataset
is the variable number when coordinate variables are not included, and then the variable number when coordiate variables are included.  So if you did a ncdump -h on the file, I think you'd see a coordinate variable, then lon, lat, level, press, rh.

I will fix this so that it only lists one line of output.  It's useful so that we can do something like this:
yes? use coads_climatology
yes? use levitus_climatology

yes? let/d=2 sst = temp[gxy=sst[d=1],Z=0]

yes? sho var/d=1 sst
 SST var # 1 of dataset /home/users/tmap/ferret/linux/fer_dsets/data/coads_climatology.cdf

yes? sho var/d=2 sst
 SST[D=levitus_climatology] = TEMP[GXY=SST[D=1],Z=0]

I'm not sure the variable number in the file is useful information, so instead perhaps for the file variable we'd list the units and/or title.

Ansley


On 5/30/2013 4:00 PM, Hella Riede wrote:
Dear ferret list,

from the ferret manual: "SHOW VARIABLES/DATA_SET: Lists variables associated with the named dataset by DEFINE VARIABLE/DATA_SET="

This works as expected:
yes? let/d=4 test = 1
yes? sh var/data_set=4
     TEST[D=ex_traj2] = 1

However, when I used it for information about a file variable in the following way, I got strange results:
yes? sh var/data rh
 rh var # 5 of dataset ./ex_traj2.nc
 rh var # 6 of dataset

The first number refers to the position of the queried variable in the file. But the second number additionally sums up "1" for the "long_name" attribute when it first appears.

Here is a dump of the file:
yes? sh da 4
4> ./ex_traj2.nc  (default)
name  title      I    J    K    L    M    N
LAT              ...  ...  ...  1:3  ...  ...
LON              ...  ...  ...  1:3  ...  ...
LEVEL            ...  ...  ...  1:3  ...  ...
PRESS  pressure  ...  ...  ...  1:3  ...  ...
RH     rel hum   ...  ...  ...  1:3  ...  ...
TEMP   temperat  ...  ...  ...  1:3  ...  ...

yes? sh var/data lat
 lat var # 1 of dataset ./ex_traj2.nc
 lat var # 1 of dataset
yes? sh var/data lon
 lon var # 2 of dataset ./ex_traj2.nc
 lon var # 2 of dataset
yes? sh var/data level
 level var # 3 of dataset ./ex_traj2.nc
 level var # 3 of dataset
yes? sh var/data press
 press var # 4 of dataset ./ex_traj2.nc
 press var # 5 of dataset
yes? sh var/data rh
 rh var # 5 of dataset ./ex_traj2.nc
 rh var # 6 of dataset
yes? sh var/data temp
 temp var # 6 of dataset ./ex_traj2.nc
 temp var # 7 of datase

I guess this function IS somehow intended as the output is nicely configured, but it's certainly also confusing.

Best wishes,
Hella


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement