NCL Home > Documentation > Functions > File I/O

isfilevardim

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

Prototype

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

	return_val [dimsizes(dimnames)] :  logical

Arguments

thefile

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.

varname

A single string variable name.

dimnames

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.

Description

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

Examples

Example 1

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


    f        = addfile ("foo.nc" , "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