-
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
Adds the spin-up step #714
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 687_fix_static #714 +/- ##
==================================================
- Coverage 94.73% 94.07% -0.66%
==================================================
Files 73 73
Lines 4941 4983 +42
==================================================
+ Hits 4681 4688 +7
- Misses 260 295 +35 ☔ View full report in Codecov by Sentry. |
Maybe is not an issue in real life, but in its current implementation, if a variable is chosen to be carried over from the previous step, it might trigger errors in either de variable system or the the static configuration check. For example, the following config file runs fine the spin-up but, for the actual simulation it fails with the error below (which was to be expected). I am not sure if this can never happen in a real scenario but I feel this is going to cause trouble. Input file: [core]
[[core.spin_up]]
models = ["hydrology"]
timing = {start_date = "2013-01-01", update_interval = "1 month", run_length = "2 years"}
variables = ["air_temperature", "relative_humidity"]
[hydrology]
[abiotic_simple]
[animal]
[litter]
[soil] Error
|
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.
@dalonsoa this looks like a sensible approach to me. I unfortunately don't have much to add beyond that, but I am sure others will have more to say
What exactly are the 'variables' in this setup? |
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 fear I've lost track of VE development a bit too much to be able to provide too much in the way of useful comments, but it does seem like a sensible approach in general.
Bigger picture, I am wondering if there might be a way to avoid having RUN_VARIABLES_REGISTRY
as a global variable in general. If, for example, it's only ever used in the body of a main loop, you could just declare it as a variable in that loop and pass it into the functions that need it, then you'd get a clean slate on every iteration anyway. But I suspect it's probably not that simple 😉
They are the variables from that step that will be used in the following step. If we look at the issue this is trying to solve, there you said:
So |
Ok, that makes sense. Does the same error come up when you use variables that are more exclusive to the hydrology model, such as soil moisture? |
Same problem. The models that are declared static - all the models except those we are spinning up in the given step - follow the standard rules for static models (first update if no variables to be initialised are in the data object or frozen if all variables are there). For the actual simulation, none of the models are static - unless they were declared as such in the config file. The bottom line is that we cannot provide some variables as input that were supposed to be initialised by a model. The variables system prevents it. But even if we modify the variables system to allow that, the input value will be overwritten when the model is initialised in the real simulation (where presumably, it won't be static) with whatever it calculates. So the only way forward I see is setting up some mechanism within the model - or the data object - that prevents creating a new variable if it is already there. But that might lead to inconsistent results if other variables depend on the calculated one, so I'm not sure of the best way forward. It might require a significant refactoring of the model system. |
And we have another problem there: because we use a simple boolean flag and the data payload to determine the static mode, we cannot at the moment spin the model up in fully-frozen mode and then run the model in update-once mode. |
@vgro and @jacobcook1995 How much of this can we achieve using manual spinup runs using the existing infrastructure? So:
My worry here is that anything we try and develop is going to be brittle until we have a better idea of the actual use cases. If we can develop that understanding more, we'll be able to guide this process. If we can't do this manually now, then I think we think about how to fix those blocks for manual spinup before we go about trying to do it programatically? |
@davidorme check Teams. I've pointed this same thing there and suggested a meeting. |
Too many channels 😄 |
Description
Adds the possibility to run spin-up steps before the actual simulation.
Details of PR TBC
Fixes #581
Type of change
Key checklist
pre-commit
checks:$ pre-commit run -a
$ poetry run pytest
Further checks