grat.loaders.get_bottlenecks
¶
Loads info from a csv into bottleneck objects.
bottleneck_from_row
¶
Builds a Bottleneck from one csv row or JSON record.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row
|
mapping with |
required | |
irrigation_days
|
zero-indexed days of the water year that use the irrigation capacity |
required |
Returns:
| Type | Description |
|---|---|
|
bottleneck object |
Source code in src/grat/loaders/get_bottlenecks.py
load_bottlenecks
¶
Reads csv rows into a list of bottleneck objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path_to_bottleneck_csv
|
file location of the bottleneck csv |
required | |
irrigation_days
|
zero-indexed days of the water year that use the irrigation
capacity. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
|
list of bottleneck objects |
Source code in src/grat/loaders/get_bottlenecks.py
unpack_bottlenecks
¶
Unpacks the bottleneck data from the list of bottlenecks (JSON INPUT).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
list_of_bottlenecks
|
a list of bottleneck data structured as follows:: [ { "bid": 62, "name": "Planada Canal", "capacity_cfs": 250, "capacity_irr_cfs": 135, "wafrsource": "MercedRiver,UCC,UCC_L,Fahren,Bear" }, { "bid": 63, "name": "Fairfield Canal", "capacity_cfs": 500, "capacity_irr_cfs": 287, "wafrsource": "MercedRiver,UCC,UCC_L,Fahren,Bear" } ] |
required | |
irrigation_days
|
zero-indexed days of the water year that use the irrigation
capacity. Defaults to |
None
|
Returns:
| Type | Description |
|---|---|
|
list of bottleneck objects |