-
Notifications
You must be signed in to change notification settings - Fork 21
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
Refactor types and model initialization #517
Conversation
Nice, some of these improvements (e.g. write out structs for About the naming I think it would be good to replace the terms What are your thoughts on this @SouthEndMusic and @JoostBuitink ? |
I don't have opinions yet about hydrological jargon 😋 |
@vers-w I'm done refactoring for this PR :) The structs I introduced also need some inline documentation, but I'm not the right person to do that. I leave it up to you whether you want to do this within this PR or in a follow up. I see there is a lot of duplicate code in the model initialization code, but I don't understand it well enough at the moment to split it op into sensible sub functions. |
I agree that replacing the terms |
Yes, I think replacing the term |
I also agree that Line 88 in fbc2383
I fully agree that |
Yes, I can do that in this PR, that's fine. When we have decided what terms to use for
Yes, definitely true and also something we would like to improve for v1.0. Did not look into detail at this yet. Probably good to check if we can use structs here that we can set partly (I see that you added |
Yes, in this PR I also make quite heavy use of partly setting structs. With |
'land` refers to `AbstractLandModel`.
- For `Routing` struct use more explicit names (`river_flow`, `overland_flow` and `subsurface_flow`), also easier to distinguish from `land` (vertical) component. - Changed mapping of groundwater flow model (boundaries).
Align with `sbm` and `sbm_gwf` model types. `frac_to_river` is not used by the `sediment` model type and removed from the `network` initialization.
Additionally, replace `nothing` defaults of `Routing` by dummy types and move `Routing` code to separate file `routing/routing.jl`.
The name `Indices` is too general. Improved inline documentation of this struct.
`Model` field `vertical` has been replaced by `land`.
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.
The refactoring LGTM. I did add the inline documentation to the introduced network structs, renamed vertical
to land
and lateral
to routing
of the Model
struct, and made some small improvements.
Some general comments:
- The introduced network structs have some common fields. I think it could be useful to restructure these a bit, this could be part of another PR. For example, for reservoirs and lakes I did introduce a
NetworkWaterBody
struct. - You already mentioned that the model initialization functions have quite some duplicate code. As suggested we could also do this in another PR, including the initialization of the network structs (e.g. move the initialization to network.jl).
- The documentation is not updated (except for the
Model
struct). We could do this in another PR, probably when the work on using standard names is finished.
Hi @JoostBuitink , I did rename |
Explanation
When starting to look into water balance calculations for Wflow, I came across some aspects of the code that I think can be improved:
AbstractModel
Model.Network
instead of using a nestedNamedTuple
network.jl
Model.Lateral
Model.vertical
?initialize_sbm_gwf_model
initialize_sbm_model
initialize_sediment_model