Intempestive warnings in CreateRunOptions since v1.7.8
Resolution of #167 (closed) and especially the commit 6b9a35fb introduced a bug.
There is now a systematic call to CreateIniStates when IniStates in NULL in CreateRunOptions in order to standardize the creation of the vectorized IniStates instead of creating manually in CreateRunOptions.
Unfortunately, this call is global for all possible GR models and provides default values for all possible states:
IniStates <- CreateIniStates(
FUN_MOD = FUN_MOD,
InputsModel = InputsModel,
IsHyst = IsHyst,
IsIntStore = IsIntStore,
ExpStore = 0,
IntStore = 0,
GCemaNeigeLayers = rep(0, NLayers),
eTGCemaNeigeLayers = rep(0, NLayers),
GthrCemaNeigeLayers = rep(0, NLayers),
GlocmaxCemaNeigeLayers = rep(0, NLayers),
verbose = warnings
)
This results in intempestive warnings for all models that don't need such initial states.
For example in https://forge.inrae.fr/airgriwrm/airgriwrm/-/issues/195 with these kind of warnings:
Warning ('test-UpdateQsimUpstream.R:2:1'): (code run outside of `test_that()`)
'RunModel_GR4J' does not require 'GCemaNeigeLayers' 'GCemaNeigeLayers', 'GthrCemaNeigeLayers' and 'GlocmaxCemaNeigeLayers'. Values set to NA
Warning ('test-UpdateQsimUpstream.R:2:1'): (code run outside of `test_that()`)
'RunModel_GR4J' does not require 'IntStore'. Values set to NA
Warning ('test-UpdateQsimUpstream.R:2:1'): (code run outside of `test_that()`)
'RunModel_GR4J' does not require 'ExpStore'. Value set to NA
As this call is always done when IniStates in NULL, a simple solution would be to change the call as follow:
IniStates <- CreateIniStates(
FUN_MOD = FUN_MOD,
InputsModel = InputsModel,
IsHyst = IsHyst,
IsIntStore = IsIntStore,
ExpStore = 0,
IntStore = 0,
GCemaNeigeLayers = rep(0, NLayers),
eTGCemaNeigeLayers = rep(0, NLayers),
GthrCemaNeigeLayers = rep(0, NLayers),
GlocmaxCemaNeigeLayers = rep(0, NLayers),
verbose = FALSE
)
In order to shut down all irrelevant warnings.