
isfilevaratt
Checks if specified file variable attributes are defined for a file variable.
Prototype
function isfilevaratt ( thefile [1] : file, varname [1] : string, attnames : string ) return_val [dimsizes(attnames)] : logical
Arguments
thefileA reference to a file created from a call to addfile or addfiles. The file referenced must be one in the supported file format list.
varnameA single string variable name.
attnamesAn array type string of any dimensionality.
Return value
The output of isfilevaratt is a logical array with the same dimensions as the attnames parameter. If the parameter thefile is not a valid file or varname isn't a defined file variable, then a single missing value is returned.
Description
For each element in the attnames parameter, isfilevaratt returns True if the element is an attribute of the file variable varname in the file thefile and False if not.
See Also
Examples
Example 1 Before reading a variable ("TEMP") to memory, check to see if it has specific attributes.
f = addfile ("foo.nc", "r") attNames = (/"long_name", "description", "units", "scale_factor"/) tf = isfilevaratt(f, "TEMP", attNames) ; ==> tf(4) print(tf) ; each element will be True or False