yes? let attnames = var.attnamesyes? let gattnames = ..attanmesyes? if `IS_ELEMENT_OF_STR(attnames, "the_att") NE 0` THEN...
yes? show function element_index*
Thank you.1. Is it possible to save the output of show attr/all . to some variable like let foo = ..varnamesI can check from outside using spawn like below
2. How to check whether the attribute is defined in dataset (Global attributes) or not.
For Example :
As you can see below attribute history exists in dataset, so it doesn't throw any exception, but say if I type list ..someother_attr, I get error since it doesn't exist, so is there any way to check whether attribute exists in dataset.
yes? use coads_climatology;
yes? show d
currently SET data sets:
1> /usr/local/ferret/fer_dsets/data/coads_climatology.cdf (default)
name titleI J K L M N
SST SEA SURFACE TEMPERATURE 1:180 1:90 ... 1:12 ... ...
AIRT AIR TEMPERATURE 1:180 1:90 ... 1:12 ... ...
SPEH SPECIFIC HUMIDITY 1:180 1:90 ... 1:12 ... ...
WSPD WIND SPEED 1:180 1:90 ... 1:12 ... ...
UWND ZONAL WIND 1:180 1:90 ... 1:12 ... ...
VWND MERIDIONAL WIND 1:180 1:90 ... 1:12 ... ...
SLP SEA LEVEL PRESSURE 1:180 1:90 ... 1:12 ... ...
yes? show att/all .
attributes for dataset: /usr/local/ferret/fer_dsets/data/coads_climatology.cdf
..history = FERRET V4.45 (GUI) 22-May-97
yes? list ..history
VARIABLE : ..HISTORY
FILENAME : coads_climatology.cdf
FILEPATH : /usr/local/ferret/fer_dsets/data/
X : 1
"FERRET V4.45 (GUI) 22-May-97"
yes? list ..someother_attr
**ERROR: attribute undefined or invalid attribute name: ..SOMEOTHER_ATTR
attribute SOMEOTHER_ATTR not found for dataset
**ERROR: variable unknown or not in data set: ..SOMEOTHER_ATTR
[akshay@localhost tmp]$ ncdump -h /usr/local/ferret/fer_dsets/data/coads_climatology.cdf | grep -q ':something' && echo 'exists' || echo 'does not exist';
does not exist
[akshay@localhost tmp]$ ncdump -h /usr/local/ferret/fer_dsets/data/coads_climatology.cdf | grep -q ':history' && echo 'exists' || echo 'does not exist';
existsRegards,Akshay Hegde,Data and Information,