linopy.variables.Variables#
- class linopy.variables.Variables(data=<factory>, model=None)#
A variables container used for storing multiple variable arrays.
- __init__(data=<factory>, model=None)#
Methods
__init__
([data, model])add
(variable)Add a variable to the variables container.
get_blockmap
([dtype])Get a one-dimensional array mapping the variables to blocks.
get_label_position
(values)Get tuple of name and coordinate for variable labels.
get_label_range
(name)Get starting and ending label for a variable.
get_name_by_label
(label)Get the variable name of the variable containing the passed label.
items
()iter_ravel
(key[, filter_missings])Create an generator which iterates over all arrays in key and flattens them.
print_labels
(values)Print a selection of labels of the variables.
ravel
(key[, filter_missings, compute])Ravel and concate all arrays in key while aligning to broadcast_like.
remove
(name)Remove variable name from the variables.
reset_solution
()Reset the stored solution of variables.
set_blocks
(blocks)Get a dataset of same shape as variables.labels indicating the blocks.
Attributes
attrs
Get all binary variables.
Get all continuous variables.
coords
dataset_attrs
dataset_names
dims
Convert all variables to a single pandas Dataframe.
indexes
Get all integers variables.
labels
Get the labels of all variables.
lower
Get the lower bounds of all variables.
model
nvars
Get the number all variables effectively used by the model.
solution
Get the solution of variables.
upper
Get the upper bounds of all variables.
data