forked from ksemmendinger/loslr_regulation_optimization
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.py
71 lines (49 loc) · 1.84 KB
/
template.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""
-------------------------------------------------------------------------------
this script contains a template for the `getPlanLimitsInputs` and `planLimits`
functions
-------------------------------------------------------------------------------
"""
"""
-------------------------------------------------------------------------------
# import custom function for engineering rounding
import sys
sys.path.append(".")
from functions.utils import round_d
# extracts timestep inputs for `planLimits`
def getPlanLimitsInputs(data, t):
# INPUTS
# data: dictionary of input time series from main simulation function
# keys are variable names and values are np.arrays of the time series of
# the variable values
# t: timestep from simulation for loop
# OUTPUTS
# x: dictionary with named key value pairs of hydrologic inputs at the
# timestep of interest
x = dict()
x["variable"] = data["variable"][t]
# code to extract, calculate, or format needed inputs for `planLimits`....
return x
def planLimits(
qm,
prelimLevel,
prelimFlow,
prelimRegime,
x,
septemberRule,
):
# INPUTS
# qm: quarter-month from simulation for loop
# prelimLevel: release function calculated preliminary water level
# prelimFlow: release function calculated preliminary flow
# prelimRegime: release function calculated preliminary regime
# x: dictionary output from `getPlanLimitsInputs`
# septemberRule: "off" or the septemberRule function
# OUTPUTS
# dictionary with named key value pairs "ontFlow" and "ontRegime"
# extract outputs from x
variable = x["variable"]
# code to check against flow limits here....
return {"ontFlow": ontFlow, "ontRegime": ontRegime}
-------------------------------------------------------------------------------
"""