-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply overrides in Storage and its superclasses #81
Conversation
and delete parameters that are not used at all in the River node
and update river initialisation in other tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - just some suggestions, nothing big
wsimod/nodes/storage.py
Outdated
@@ -394,7 +449,6 @@ class River(Storage): | |||
# TODO non-day timestep | |||
def __init__( | |||
self, | |||
depth=2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's a great idea to remove arguments. As there will be many config
files that specify depth
for River
nodes, and these will crash. Instead I would suggest to allow depth
as an argument and have something like the following:
print('warning: the depth parameter is unused by River nodes because it is intended for capacity to be unbounded. It may be removed in a future version.')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added - see commit 07e196b
@@ -490,16 +543,6 @@ def __init__( | |||
) | |||
self.muptNpar = 0.001 # [kg/m2/day] nitrogen macrophyte uptake rate | |||
self.muptPpar = 0.0001 # 0.01, # [kg/m2/day] phosphorus macrophyte uptake rate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see that these aren't used - but I guess they were used in CatchWat? Are we likely to need them again? If so, maybe just copy this excerpt into #2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably not as they are for the solids and we haven't decided which sedimentation-resuspension model we are going to integrate ... plus these parameters are not performing very well in previous case studies
Co-authored-by: barneydobson <[email protected]>
with warning for unuse
…eLondon/wsi into storage-overrides
Co-authored-by: barneydobson <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment than in #79 . The overrides look ok, but there's no reason to use pop while you can get the same thing with get. I do not see any reason for modifying the overrides dictionary.
The purpose to
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we already had this pop
vs get
discussion somewhere else and I was happy with the explanation, so feel free to go ahead with it.
Having said that, I would suggest to replace all print
statements with a proper logger. That might be a task for a different PR, though.
wsimod/nodes/storage.py
Outdated
print( | ||
"ERROR: specifying area is depreciated in overrides \ | ||
for river, please specify length and width instead" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use exceptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added runtime errors - is this what is meant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. You could also use ValueError
. There are several built-in exception you can sue. Pick the most appropriate one for each case. https://docs.python.org/3/library/exceptions.html
wsimod/nodes/storage.py
Outdated
print( | ||
"ERROR: specifying capacity is depreciated in overrides \ | ||
for river, it is always set as unbounded capacity" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
wsimod/nodes/storage.py
Outdated
print( | ||
"warning: the depth parameter is unused by River nodes because it is \ | ||
intended for capacity to be unbounded. It may be removed in a future version." | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
Co-authored-by: Diego Alonso Álvarez <[email protected]>
Apply overrides in
Storage
,Groundwater
,QueueGroundwater
,River
,Riverreservoir
and update the tests