Variable Group

class csdl_alpha.src.variable_group.VariableGroup[source]

Represents a group of variables.

This class provides a way to organize and manage a group of variables. It allows for defining checks on the variables, adding tags to the variables, and saving the variables.

Methods

add_check(name[, type, shape, variablize])

Declare parameters to be checked for a variable in the group.

add_tag(tag)

Adds a tag to all Variables in the group or subgroups.

check()

Applies all checks to the variables in the group.

save()

saves any Variables in the group or subgroups.

define_checks

add_check(name, type=None, shape=None, variablize=False)[source]

Declare parameters to be checked for a variable in the group.

This method is used to define checks for a variable in the group. The parameters that can be checked include the name, type, shape, and whether the variable should be variablized.

Parameters
namestr

The name of the variable.

typetype, optional

The type of the variable, by default None.

shapetype, optional

The shape of the variable, by default None.

variablizebool, optional

Whether the variable should be turned into a CSDL variable, by default False.

Raises
ValueError

If the variable with the given name is not found in the group.

ValueError

If parameters for the variable with the given name are already declared.

add_tag(tag)[source]

Adds a tag to all Variables in the group or subgroups.

Parameters
tagstr

Tag to add to the Variables.

check()[source]

Applies all checks to the variables in the group.

save()[source]

saves any Variables in the group or subgroups.