NCL Home > Documentation > Functions > File I/O


Checks if file variable dimensions are defined for a file variable.


	function isfilevardim (
		thefile [1] : file,    
		varname [1] : string,  
		dimnames    : string   

	return_val [dimsizes(dimnames)] :  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 of any dimensionality containing strings.

Return value

The output of isfilevardim is a logical array with the same dimensions as the dimnames parameter.


For each element in the dimnames parameter, isfilevardim returns True if the element is a dimension of the file variable varname in the file thefile and False if not. If the parameter thefile is not a valid file or varname isn't a defined file variable, then a single missing value is returned.

See Also

getfilevardims, getvardims


Example 1

Check to see if the variable "TEMP" has dimension names time, level, lev, latitude, lat, longitude, lon associated with it.

    f        = addfile ("" , "r")     ; create a file reference
                                            ; list of dimension names
    dimNames = (/"time","level","lev","latitude","lat","longitude","lon"/)

    tf       = isfilevardim(f, "TEMP", dimNames)    ; ==> tf(7)

    print(tf)   ; each element will be True or False