geocat.f2py.checks

Module Contents

Functions

check(user_variable[, var_name, data_type, ...])

Function of data checks for use in wrapper functions.

geocat.f2py.checks.check(user_variable, var_name='variable', data_type=None, max_dimensions=None, min_dimensions=None, dimensions=None, shape=None, is_xarray=None, is_none=None, is_numpy=None, is_chunked=None, comparison=None, unchunked_dims=None, exceptions=True)

Function of data checks for use in wrapper functions.

user_variablexarray.DataArray or numpy.ndarray

Variable of interest

data_typetype or :type:`tuple of types`

Desired data_type of user_variable ex: data_type=np.ndarray

max_dimensionstuple

Maximum number of dimensions needed from user_variable for function ex: max_dimensions=(3) or max_dimensions=3

min_dimensionstuple

Minimum number of dimensions needed from user_variable for function ex: min_dimensions=(3) or min_dimensions=3

dimensionstuple

Number of dimensions needed from user_variable for function ex: dimensions=(3) or dimensions=3

shapetuple

Checks user_variable’s shape ex: shape=(3, 3, 3)

is_xarraybool

Checking whether user_variable is of class xarray.DataArray. Valid inputs are True or False

is_nonebool

Checking whether user_variable is of class NoneType. Valid input is True or False

comparisonn/a

Compares user variable against item passed in as comparison Valid input is anything

unchunked_dimstuple

Checks for unchunked dimensions in user_variable ex: check(user_variable, unchunked_dims=[3]) must include brackets

exceptionsbool

Allows user to turn off exceptions in the check functions Valid input is True or False

is_numpybool

Checks whether variable is of class numpy.ndarray Valid input is True or False

is_chunkedbool

Checks whether variable is chunked Valid input is True or False