NCL Website header
NCL Home > Documentation > Functions > File I/O


Checks if specified file variable attributes are defined for a file variable.


	function isfilevaratt (
		thefile [1] : file,    
		varname [1] : string,  
		attnames    : string   

	return_val [dimsizes(attnames)] :  logical



A reference to a file created from a call to addfile or addfiles. The file referenced must be one in the supported file format list.


A single string variable name.


An 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.


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



Example 1 Before reading a variable ("TEMP") to memory, check to see if it has specific attributes.

    f = addfile ("", "r")

    attNames = (/"long_name", "description", "units", "scale_factor"/)
    tf       = isfilevaratt(f, "TEMP", attNames)    ; ==> tf(4)
    print(tf)   ; each element will be True or False