Report

This module is used to report data to the disk. After initialization, the reporter.Report.step() method is called every timestep, which in turn calls the equivalent methods in honeybees’s reporter (to report data from the agents) and the CWatM reporter, to report data from CWatM. The variables to report can be configured in model.yml (see Configuration). All data is saved in a subfolder (see Configuration).

class Reporter(model)[source]

This is the main reporter class for the GEB model. On initialization the ABMReporter and hydrology_reporter classes are initalized.

Parameters:

model – The GEB model.

report()[source]

At the end of the model run, all previously collected data is reported to disk. This function only forwards the report function to the reporter for the ABM model and CWatM.

step()[source]

This function is called at the end of every timestep. This function only forwards the step function to the reporter for the ABM model and CWatM.

Return type:

None

class hydrology_reporter(model, folder)[source]

This class is used to report CWatM data to disk. On initialization the export folder is created if it does not yet exist. Then all variables to report are on read from the configuration folder, and the datastructures to save the data are created.

Parameters:

model – The GEB model.

decompress(attr, array)[source]

This function decompresses an array for given attribute.

Parameters:
  • attr (str) – Attribute which was used to get array.

  • array (ndarray) – The array itself.

Returns:

decompressed_array – The decompressed array.

Return type:

ndarray

export_value(name, value, conf)[source]

Exports an array of values to the export folder.

Parameters:
  • name (str) – Name of the value to be exported.

  • value (ndarray) – The array itself.

  • conf (dict) – Configuration for saving the file. Contains options such a file format, and whether to export the array in this timestep at all.

Return type:

None

get_array(attr, decompress=False)[source]

This function retrieves a NumPy array from the model based the name of the variable. Optionally decompresses the array.

Parameters:
  • attr (str) – Name of the variable to retrieve. Name can contain “.” to specify variables are a “deeper” level.

  • decompress (bool) – Boolean value whether to decompress the array. If True, the class to which the top variable name belongs to must have an equivalent function called decompress.

Returns:

array – The requested array.

Return type:

ndarray

Example

Read discharge from data.grid. Because decompress=True, data.grid must have a decompress method.

>>> get_array(data.grid.discharge, decompress=True)
report()[source]

At the end of the model run, all previously collected data is reported to disk.

Return type:

None

step()[source]

This method is called after every timestep, to collect data for reporting from the model.

Return type:

None