-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Try to convert RiverSplitWithGauge factors correctly.
Add a conversion function for the factors on RiverSplitWithGauge. The factors have changed in this implementation and require conversion from ratios to proportions. This is only possible if they existing factors are all constants. Fixes #241.
- Loading branch information
Showing
5 changed files
with
229 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
pywr-schema/tests/v1/river_split_with_gauge1-converted.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{ | ||
"metadata": { | ||
"title": "RiverSplitWithGauge", | ||
"description": "Example of an abstraction with an MRF of form y=mx+c", | ||
"minimum_version": "0.1" | ||
}, | ||
"timestepper": { | ||
"start": "2015-01-01", | ||
"end": "2015-12-31", | ||
"timestep": 1 | ||
}, | ||
"scenarios": null, | ||
"network": { | ||
"nodes": [ | ||
{ | ||
"meta": { | ||
"name": "Catchment" | ||
}, | ||
"type": "Catchment", | ||
"cost": null, | ||
"flow": { | ||
"type": "Constant", | ||
"value": 100.0 | ||
}, | ||
"parameters": null | ||
}, | ||
{ | ||
"meta": { | ||
"name": "Gauge" | ||
}, | ||
"type": "RiverSplitWithGauge", | ||
"mrf": { | ||
"type": "Parameter", | ||
"name": "Gauge-p0", | ||
"key": null | ||
}, | ||
"mrf_cost": { | ||
"type": "Constant", | ||
"value": -1000.0 | ||
}, | ||
"parameters": null, | ||
"splits": [ | ||
{ | ||
"factor": { | ||
"type": "Constant", | ||
"value": 0.25 | ||
}, | ||
"slot_name": "abstraction" | ||
} | ||
] | ||
}, | ||
{ | ||
"meta": { | ||
"name": "Estuary" | ||
}, | ||
"type": "Output", | ||
"cost": null, | ||
"max_flow": null, | ||
"min_flow": null, | ||
"parameters": null | ||
}, | ||
{ | ||
"meta": { | ||
"name": "Demand" | ||
}, | ||
"type": "Output", | ||
"max_flow": { | ||
"type": "Constant", | ||
"value": 50.0 | ||
}, | ||
"cost": { | ||
"type": "Constant", | ||
"value": -10.0 | ||
}, | ||
"min_flow": null, | ||
"parameters": null | ||
} | ||
], | ||
"edges": [ | ||
{ | ||
"from_node": "Catchment", | ||
"to_node": "Gauge" | ||
}, | ||
{ | ||
"from_node": "Gauge", | ||
"from_slot": "river", | ||
"to_node": "Estuary" | ||
}, | ||
{ | ||
"from_node": "Gauge", | ||
"from_slot": "abstraction", | ||
"to_node": "Demand" | ||
} | ||
], | ||
"metric_sets": null, | ||
"parameters": [ | ||
{ | ||
"meta": { | ||
"name": "Gauge-p0" | ||
}, | ||
"type": "MonthlyProfile", | ||
"interp_day": null, | ||
"values": [ | ||
40.0, | ||
40.0, | ||
40.0, | ||
40.0, | ||
40.0, | ||
40.0, | ||
40.0, | ||
40.0, | ||
40.0, | ||
40.0, | ||
40.0, | ||
40.0 | ||
] | ||
} | ||
], | ||
"outputs": null, | ||
"tables": null, | ||
"timeseries": null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"metadata": { | ||
"title": "RiverSplitWithGauge", | ||
"description": "Example of an abstraction with an MRF of form y=mx+c", | ||
"minimum_version": "0.1" | ||
}, | ||
"timestepper": { | ||
"start": "2015-01-01", | ||
"end": "2015-12-31", | ||
"timestep": 1 | ||
}, | ||
"nodes": [ | ||
{ | ||
"name": "Catchment", | ||
"type": "catchment", | ||
"flow": 100 | ||
}, | ||
{ | ||
"name": "Gauge", | ||
"type": "RiverSplitWithGauge", | ||
"mrf": { | ||
"type": "monthlyprofile", | ||
"values": [40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0, 40.0] | ||
}, | ||
"mrf_cost": -1000, | ||
"factors": [3, 1], | ||
"slot_names": ["river", "abstraction"] | ||
}, | ||
{ | ||
"name": "Estuary", | ||
"type": "output" | ||
}, | ||
{ | ||
"name": "Demand", | ||
"type": "Output", | ||
"max_flow": 50, | ||
"cost": -10 | ||
} | ||
], | ||
"edges": [ | ||
["Catchment", "Gauge"], | ||
["Gauge", "Estuary", "river", null], | ||
["Gauge", "Demand", "abstraction", null] | ||
] | ||
} |