deltametrics.plot.VariableSet¶
- class deltametrics.plot.VariableSet(override_dict=None)¶
A default set of properties for variables.
This makes it easy to have consistent plots.
This class defines a dictionary of VariableInfo objects, which store default information about that variable, for easy and consistent plotting.
Additionally, you can create a VariableSet, and assign it to multiple
Cube
instances, so that each shares the same colormaps, etc.Examples
Create a default variable set object.
>>> from deltametrics.plot import VariableSet
>>> VariableSet() <deltametrics.plot.VariableSet object at 0x...>
- __init__(override_dict=None)¶
Initialize the VariableSet.
Initialize the set with default colormaps.
Note
It is expected that any attribute added to the known_list has a valid property defined in this class.
Note
We need an improved way to document each of the defaults. Want to display the colormaps, and the limits, the labels, etc. We want to be able to automatically label the image with low, high, labels, if there is aboundary norm, what happend to above and below values, etc. It’s too verbose to do this in every file though, need a way to automate it. Either a custom Sphinx directive or mpl plot directives with function calls. There seems to be a bug that doesn’t allow function calls to work for docstrings though, only primary documents. Another way could be to just loop all the
known_list
into a single fig at the end?- Parameters:
override_dict (
dict
, optional) – Dictionary defining variable-property sets. Dictionary key should set the must be either a string (and then match defined colormaps in matplotlib or DeltaMetrics), a new matplotlib Colormap object, or an Mx3 numpy array that can be coerced into a linear colormap.
Methods
__init__
([override_dict])Initialize the VariableSet.
Attributes
Flow depth style.
Flow discharge style.
Bed elevation style.
Net-to-gross style.
Sand fraction style.
Flow sedflux style.
Flow stage style.
strata_depth
Sand fraction style.
Temporal history style.
Variables known to the VariableSet.
Flow velocity style.
x
y
- __getitem__(var)¶
Get the attribute.
Variable styling (i.e., the VariableInfo instances can be accessed by slicing the VariableSet with a string matching the VariableInfo name field. This enables accessing variables in evaluation, rather than explicit typing of variable names.
- Parameters:
variable (
str
) – Which variable to get the VariableInfo for.note:: (..) – If variable is not identified in the VariableSet, then a default instance of
VariableInfo
is instantiated with the variable name and returned.
- __setattr__(key, var)¶
Set, with check for types.
This prevents setting non-VariableInfo attributes.
- property depth¶
Flow depth style.
- property discharge¶
Flow discharge style.
- property eta¶
Bed elevation style.
- property net_to_gross¶
Net-to-gross style.
- property sandfrac¶
Sand fraction style.
- property sedflux¶
Flow sedflux style.
- property stage¶
Flow stage style.
- property strata_sand_frac¶
Sand fraction style.
- property time¶
Temporal history style.
- property variables¶
Variables known to the VariableSet.
- property velocity¶
Flow velocity style.