Skip to content
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

test warm start #136

Closed
visr opened this issue Jun 3, 2021 · 1 comment
Closed

test warm start #136

visr opened this issue Jun 3, 2021 · 1 comment
Assignees
Labels
test This change adds or pertains to unit tests

Comments

@visr
Copy link
Member

visr commented Jun 3, 2021

We've tested in the past that two runs that follow each other, are exactly equal to a single run of that period without restart. This was to verify that the state handling was working as intended. This test was done offline, and is not yet part of the automatic tests. We should convert the snippet below to an automatic test to verify the state handling code stays correct.

Wflow.jl/test/run.jl

Lines 7 to 38 in 7e97168

# test whether restarted runs get the same results as continuus ones, i.e. state is captured
tomlpath = joinpath(@__DIR__, "sbm_config.toml")
config = Wflow.Config(tomlpath)
# January at once, cold start
config.starttime = DateTime("2000-01-01T00:00:00")
config.endtime = DateTime("2000-02-01T00:00:00")
config.model.reinit = true # cold start
# note that this needs to be relative to the tomlpath
config.state.path_output = joinpath(dirname(tomlpath), "data/state-test/outstates-moselle-january.nc")
config.output.path = joinpath(dirname(tomlpath), "data/state-test/output-moselle-january.nc")
model = Wflow.initialize_sbm_model(config)
Wflow.run(model)
# first half of January, cold start
config.starttime = DateTime("2000-01-01T00:00:00")
config.endtime = DateTime("2000-01-15T00:00:00")
config.model.reinit = true # cold start
config.state.path_output = joinpath(dirname(tomlpath), "data/state-test/outstates-moselle-january-1of2.nc")
config.output.path = joinpath(dirname(tomlpath), "data/state-test/output-moselle-january-1of2.nc")
model = Wflow.initialize_sbm_model(config)
Wflow.run(model)
# second half of January, warm start
config.starttime = DateTime("2000-01-15T00:00:00")
config.endtime = DateTime("2000-02-01T00:00:00")
config.model.reinit = false # cold start
config.state.path_input = joinpath(dirname(tomlpath), "data/state-test/outstates-moselle-january-1of2.nc")
config.state.path_output = joinpath(dirname(tomlpath), "data/state-test/outstates-moselle-january-2of2.nc")
config.output.path = joinpath(dirname(tomlpath), "data/state-test/output-moselle-january-2of2.nc")
model = Wflow.initialize_sbm_model(config)
Wflow.run(model)

@visr visr self-assigned this Jun 3, 2021
@visr visr added the test This change adds or pertains to unit tests label Jun 8, 2021
@visr
Copy link
Member Author

visr commented Jul 8, 2021

Fixed in #140

@visr visr closed this as completed Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test This change adds or pertains to unit tests
Projects
None yet
Development

No branches or pull requests

1 participant