microbenthos.dataview package¶
Submodules¶
microbenthos.dataview.base module¶
-
class
microbenthos.dataview.base.
ModelData
(store=None)[source]¶ Bases:
object
Abstract Base Class that encapsulates the model data from a simulation, and provides a uniform interface to access elements in the nested hierarchy.
-
PATH_DEPTHS
= '/domain/depths'¶
-
PATH_TIMES
= '/time'¶
-
ENTRY_ENV
= 'env'¶
-
ENTRY_EQUATIONS
= 'equations'¶
-
ENTRY_MICROBES
= 'microbes'¶
-
ENTRY_MICROBE_FEATURES
= 'features'¶
-
ENTRY_IRRADIANCE
= 'irradiance'¶
-
PATH_IRRADIANCE_CHANNELS
= 'env/irradiance/channels'¶
-
times
¶ numerical array of the model clock times
-
depths
¶ numerical array of the domain depths
-
eqn_vars
¶ Set of data paths for equation variables
-
eqn_processes
¶ Set of data paths for equation process expressions
-
eqn_source_totals
¶ Set of data paths for equation source totals
-
eqn_var_actual
¶ Set of data paths for equation var actual density
-
eqn_var_expected
¶ Set of data paths for equation var expected density
-
eqn_var_difference
¶ Set of data paths var (expected - actual)
-
microbe_features
¶ set of data paths for microbial features
-
irradiance_intensities
¶ set of data paths for irradiance intensity channels
-
aliased_paths
¶ mapping of aliased to real path
-
derived_paths
¶ mapping of derived paths to its inputs and processor
-
property
store
¶ The backing data store
-
get_data
(path, tidx=None)[source]¶ Get the data at the given path and time index
The path is first checked if it is in the
aliased_paths
orderived_paths
, and if not the data is looked for in the store.
-
abstract
check_store
(obj)[source]¶ Check if the given store is of the right type
- Returns
bool – True if a valid store obj
-
abstract
get_node
(path)[source]¶ Return the node at the given path
- Parameters
path (str) – A “/” separated path
- Returns
The node in the nested data store
- Raises
KeyError – if no such node exists
-
abstract
read_data_from
(path, tidx)[source]¶ Data read out method to be implemented by subclasses
- Returns
a
PhysicalField
of the data
-
abstract
read_metadata_from
(path)[source]¶ Reads out the metadata for a given node in the model data
- Returns
a
dict
of the metadata
-
update_equations
()[source]¶ Update the information about the equation variables and sources in
eqn_vars
,eqn_source_totals
andeqn_processes
.
-
add_derived_data
(path, inputs, processor)[source]¶ Add a path entry for derived data
This method is used to add a data path which will provide data based on the inputs and a callable processor, as processor(*inputs).
- Parameters
path (str) – The new derived path
inputs (tuple) – Set of input paths for the calculation
processor (callable) – The callable that performs the calculation
- Returns
PhysicalField – The output from the calculation
- Raises
ValueError – if path exists in store
TypeError – if processor is not a callable
-
update_tracked
()[source]¶ Update the information about the tracked history of the equation variables & sources
-
update_irradiance
()[source]¶ Update the set of data paths for irradiance intensities in
irradiance_intensities
.
-
microbenthos.dataview.hdfstore module¶
-
class
microbenthos.dataview.hdfstore.
HDFModelData
(store=None)[source]¶ Bases:
microbenthos.dataview.base.ModelData
Class that encapsulates the model data stored in a HDF
Group
.-
check_store
(obj)[source]¶ Check if the given store is of the right type
- Returns
bool – True if a valid store obj
-
get_node
(path)[source]¶ Return the node at the given path
- Parameters
path (str) – A “/” separated path
- Returns
Group
orDataset
stored at path- Raises
KeyError – if no such node exists
-
microbenthos.dataview.plotter module¶
-
class
microbenthos.dataview.plotter.
ModelPlotter
(model=None, style=None, figsize=None, dpi=None, unit_env='mol/l', unit_microbes='mg/cm**3', unit_sources='mol/l/min', unit_process='mol/l/min', track_budget=False)[source]¶ Bases:
object
-
property
model
¶
-
_create_figure
(**kwargs)[source]¶ Create the figure based on the model data structure.
- The following vs-depth axes are created by default:
Microbes (for microbial features & irradiance distribution)
Environment (for eqn variable distribution)
Sources (eqn source totals distribution)
Processes (eqn process expression distribution)
If
track_budget
is True and corresponding data is available in model, then the time_vars axes is created.Returns:
-
property
axes_all
¶
-
property
axes_depth_all
¶
-
property
axes_time_all
¶
-
_get_label
(path)[source]¶ Create the artist label from the path :param path: A “/” nested path :type path: str
- Returns
A string that can be used as the label
-
_init_artist_styles
()[source]¶ Create the styles for the artists
Prepare color cycle and line styles so that entities from the same group get the same color
-
update_artists
(tidx)[source]¶ Update the data of the line artists for time point
- Parameters
tidx (int) – The time index
-
draw
()[source]¶ Draw the changes on to the canvas. This is meant to be called after each
update_artists()
-
property
microbenthos.dataview.snapshot module¶
-
class
microbenthos.dataview.snapshot.
SnapshotModelData
(store=None)[source]¶ Bases:
microbenthos.dataview.base.ModelData
Class that encapsulates the model data stored in snapshot
dict
-
check_store
(obj)[source]¶ Check if the given store is of the right type
- Returns
bool – True if a valid store obj
-
get_node
(path)[source]¶ Return the node at the given path
- Parameters
path (str) – A “/” separated path
- Returns
The node in the nested data store
- Raises
KeyError – if no such node exists
-
read_metadata_from
(path)[source]¶ Reads out the metadata for a given node in the model data
- Returns
a
dict
of the metadata
-
read_data_from
(path, tidx=None)[source]¶ Get the data from the path in the snapshot
- Parameters
path (str) – Input used for
get_node()
tidx (None) – This is ignored, since a model snapshot only contains one timepoint
- Returns
a
PhysicalField
of the data with units at the node
-