csdms

basic_modeling_interface.vars module

Interface that describes a model’s input and output variables.

class basic_modeling_interface.vars.BmiVars[source]

Bases: object

Methods that get information about input and output variables.

These BMI functions obtain information about a particular input or output variable. They must accommodate any variable that is returned by the BMI functions get_input_var_names() or get_output_var_names().

Methods

get_var_grid(var_name) Get grid identifier for the given variable.
get_var_itemsize(var_name) Get memory use for each array element in bytes.
get_var_nbytes(var_name) Get size, in bytes, of the given variable.
get_var_type(var_name) Get data type of the given variable.
get_var_units(var_name) Get units of the given variable.
get_var_grid(var_name)[source]

Get grid identifier for the given variable.

Parameters:

var_name : str

An input or output variable name, a CSDMS Standard Name.

Returns:

int

The grid identifier.

See also

bmi.info.BmiInfo.get_input_var_names
Get var_name from this method or from get_output_var_names().

Notes

/* C */
int get_var_grid(void * self, const char * var_name, int * id);
get_var_itemsize(var_name)[source]

Get memory use for each array element in bytes.

Parameters:

var_name : str

An input or output variable name, a CSDMS Standard Name.

Returns:

int

Item size in bytes.

Notes

/* C */
int get_var_itemsize(void * self, const char * var_name,
                     int * itemsize);
get_var_nbytes(var_name)[source]

Get size, in bytes, of the given variable.

Parameters:

var_name : str

An input or output variable name, a CSDMS Standard Name.

Returns:

int

The size of the variable, counted in bytes.

Notes

/* C */
int get_var_nbytes(void * self, const char * var_name,
                   int * nbytes);
get_var_type(var_name)[source]

Get data type of the given variable.

Parameters:

var_name : str

An input or output variable name, a CSDMS Standard Name.

Returns:

str

The Python variable type; e.g., str, int, float.

Notes

/* C */
int get_var_type(void * self, const char * var_name, char * type);
get_var_units(var_name)[source]

Get units of the given variable.

Standard unit names, in lower case, should be used, such as meters or seconds. Standard abbreviations, like m for meters, are also supported. For variables with compound units, each unit name is separated by a single space, with exponents other than 1 placed immediately after the name, as in m s-1 for velocity, W m-2 for an energy flux, or km2 for an area.

Parameters:

var_name : str

An input or output variable name, a CSDMS Standard Name.

Returns:

str

The variable units.

Notes

CSDMS uses the UDUNITS standard from Unidata.

/* C */
int get_var_units(void * self, const char * var_name,
                  char * units);