Dataset

A Dataset class is used to group WRGIS-like data tables together and perform common read/write/modify operations. The calculator and optimiser components of the tool take a Dataset as their main input.

class saco.Dataset(data_folder: str | Path = None, scenarios: List[str] = None, percentiles: List[int] = None, value_types: List[str] = None, constants: Constants = None)

Container to group core data tables for use in calculator/optimiser components.

Parameters:
  • data_folder – Path to folder containing all input files.

  • scenarios – Names of artificial influences scenarios.

  • percentiles – Flow percentiles (natural).

  • value_types – Indicator of aggregation types (‘sub’ or ‘ups’).

  • constants – Global constants (by default instance of config.Constants).

Examples

>>> from saco import Dataset
>>> ds = Dataset(data_folder='/path/to/data/files')
>>> ds.load_data()
__init__(data_folder: str | Path = None, scenarios: List[str] = None, percentiles: List[int] = None, value_types: List[str] = None, constants: Constants = None)

Methods

find_outlet_waterbodies([assessed_outlets_only])

Find IDs of "outlet" waterbodies (i.e. no relevant downstream waterbodies).

identify_upstream_waterbodies(outlet_waterbodies)

Identify all waterbodies upstream of (and including) a waterbody(s).

infer_mean_abstraction([scenario, ...])

Infer mean abstraction from impacts under a given scenario and percentile.

load_data([skip_tables, set_index, ...])

Load data tables, directed graph (waterbody network) and routing matrix.

set_flow_targets([overall_target, ...])

Set flow target columns in Master table (in Dataset.mt.data attribute).

set_optimise_flag([swabs_exclusions, ...])

Set the (at least initial) value of the optimise flag columns in relevant tables.

set_tables(tables)

Set data attributes of tables.

write_tables(output_folder[, overwrite, ...])

Write data tables to parquet or (zipped) csv files.

Attributes

asbs

Instance of abstraction sensitivity bands (ASBs) table.

asb_percs

Instance of ASB percentage definitions table.

dis

Instance of discharges table.

refs

Instance of reference flow (EFI+) table.

gwabs

Instance of groundwater abstractions table.

mt

Instance of waterbody level "master" table.

qnat

Instance of natural flows table.

sfac

Instance of SWABS disaggregation factors table.

sup

Instance of complex impacts table.

swabs

Instance of surface water abstractions table.

wbfx

Instance of (optional) waterbody fix flags table.

wbs

Instance of waterbody metadata table.

asb_percs

Instance of ASB percentage definitions table.

Type:

tables.ASBPercentages

asbs

Instance of abstraction sensitivity bands (ASBs) table.

Type:

tables.AbsSensBands_NBB

dis

Instance of discharges table.

Type:

tables.Discharges_NBB

gwabs

Instance of groundwater abstractions table.

Type:

tables.GWABs_NBB

mt

Instance of waterbody level “master” table.

Type:

tables.Master

qnat

Instance of natural flows table.

Type:

tables.QNaturalFlows_NBB

sfac

Instance of SWABS disaggregation factors table.

Type:

tables.Seasonal_Lookup

sup

Instance of complex impacts table.

Type:

tables.SupResGW_NBB

swabs

Instance of surface water abstractions table.

Type:

tables.SWABS_NBB

wbs

Instance of waterbody metadata table.

Type:

tables.IntegratedWBs_NBB