Returns True if variable dimensions are defined in the given variable.
function isdim ( var , dimnames : string ) return_val : logical
A variable of any type and dimensionality.dimnames
An array of strings of any dimensionality.
For each element in the dimnames list, isdim returns True if the element is a dimension of var and False if not. The output of isdim is a logical array with the same dimensions as dimnames. If var is not a variable, then a single missing value is returned.
This function is useful for checking if variable dimensions are defined in a variable before accessing them.
Assume x is a 3D array with named dimensions "time", "lat", and "lon".
print(isdim(x,"lev")) ; False print(isdim(x,"time")) ; True print(isdim(x,(/"lat","lon"/))) ; (/True,True/)
Assume x is a 4D array, and that you want to check if its dimensions are named so you can use them for reordering the array: