airGR issueshttps://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues2022-02-21T11:13:52+01:00https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/141Vignette about CemaNeige hysteresis to complete2022-02-21T11:13:52+01:00Thirel GuillaumeVignette about CemaNeige hysteresis to completeAs explained in Riboust et al. (2019)'s paper, the CemaNeige hysteresis must be used with a MeanAnSolidPrecip argument of CreateRunOptions set to different values for each elevation zone. As a consequence, we must add/modify a couple of ...As explained in Riboust et al. (2019)'s paper, the CemaNeige hysteresis must be used with a MeanAnSolidPrecip argument of CreateRunOptions set to different values for each elevation zone. As a consequence, we must add/modify a couple of things in the vignette showing how to use it, as well as in the example of RunModel_CemaNeigeGR4J.
In the vignette:
```r
SolidPrecip_Cal <- rep(0, 5)
SolidPrecip_Val <- rep(0, 5)
for(iLayer in 1:5){
SolidPrecip_Cal[iLayer] <- mean(InputsModel$LayerFracSolidPrecip[[iLayer]][Ind_Cal]*InputsModel$LayerPrecip[[iLayer]][Ind_Cal]);
SolidPrecip_Val[iLayer] <- mean(InputsModel$LayerFracSolidPrecip[[iLayer]][Ind_Val]*InputsModel$LayerPrecip[[iLayer]][Ind_Val]);
}
if(inherits(InputsModel,"hourly" )){ Factor <- 365.25*24; }
if(inherits(InputsModel,"daily" )){ Factor <- 365.25; }
if(inherits(InputsModel,"monthly")){ Factor <- 12; }
if(inherits(InputsModel,"yearly" )){ Factor <- 1; }
SolidPrecip_Cal <- SolidPrecip_Cal*Factor
SolidPrecip_Val <- SolidPrecip_Val*Factor
## preparation of RunOptions object
RunOptions_Cal <- CreateRunOptions(FUN_MOD = RunModel_CemaNeigeGR4J,
InputsModel = InputsModel, IndPeriod_Run = Ind_Cal, IsHyst = TRUE,
MeanAnSolidPrecip = SolidPrecip_Cal)
## preparation of RunOptions object
RunOptions_Val <- CreateRunOptions(FUN_MOD = RunModel_CemaNeigeGR4J,
InputsModel = InputsModel, IndPeriod_Run = Ind_Val, IsHyst = TRUE,
MeanAnSolidPrecip = SolidPrecip_Val)
```
In the example:
```r
SolidPrecip <- rep(0, 5)
for(iLayer in 1:5){
SolidPrecip[iLayer] <- mean(InputsModel$LayerFracSolidPrecip[[iLayer]][Ind_Run]*InputsModel$LayerPrecip[[iLayer]][Ind_Run]);
}
if(inherits(InputsModel,"hourly" )){ Factor <- 365.25*24; }
if(inherits(InputsModel,"daily" )){ Factor <- 365.25; }
if(inherits(InputsModel,"monthly")){ Factor <- 12; }
if(inherits(InputsModel,"yearly" )){ Factor <- 1; }
SolidPrecip <- SolidPrecip*Factor
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_CemaNeigeGR4J, InputsModel = InputsModel,
IndPeriod_Run = Ind_Run, IsHyst = TRUE, MeanAnSolidPrecip = SolidPrecip)
```
@olivier.delaigue, please make it R beautiful. :D
I'm doing some tests and confirm tomorrow.
Thanks @francois.bourgin for spotting that.v1.8https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/125Remove warnings about parameter threshold during GR5H calibration2022-07-07T14:10:40+02:00Dorchies DavidRemove warnings about parameter threshold during GR5H calibrationTry this:
```r
library(airGR)
example("RunModel_GR5H")
str(RunOptions) # Line ignored when all lines are copy-paste together. Don't know why
CalibOptions <- CreateCalibOptions(RunModel_GR5H)
OutputsCalib <- Calibration(InputsModel = Inp...Try this:
```r
library(airGR)
example("RunModel_GR5H")
str(RunOptions) # Line ignored when all lines are copy-paste together. Don't know why
CalibOptions <- CreateCalibOptions(RunModel_GR5H)
OutputsCalib <- Calibration(InputsModel = InputsModel, RunOptions = RunOptions,
InputsCrit = InputsCrit, CalibOptions = CalibOptions,
FUN_MOD = RunModel_GR5H)
```
You get:
```
Grid-Screening in progress (0% 20% 40% 60% 80% 100%)
Screening completed (243 runs)
Param = 55.147, -0.400, 228.149, 11.050, 0.126
Crit. NSE[Q] = 0.0650
Steepest-descent local search in progress
Calibration completed (68 iterations, 913 runs)
Param = 451.901, -0.494, 143.170, 3.555, 0.188
Crit. NSE[Q] = 0.9184
There were 24 warnings (use warnings() to see them)
```
And then:
```
> warnings()
Warning messages:
1: In FUN_MOD(InputsModel = InputsModel, RunOptions = RunOptions, ... :
Param[4] (X4: unit hydrograph time constant [h]) < 0.50
X4 set to 0.50
2: In FUN_MOD(InputsModel = InputsModel, RunOptions = RunOptions, ... :
Param[4] (X4: unit hydrograph time constant [h]) < 0.50
X4 set to 0.50
...
```
I suppose that the bounds of the parameter should be correctly handled in the calibration to avoid this kind of warnings.v1.8https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/124RunOptions always warning "model states initialisation not defined" on GR1A m...2022-07-07T14:10:06+02:00Dorchies DavidRunOptions always warning "model states initialisation not defined" on GR1A modelThe following code:
```r
library(airGR)
data(L0123001)
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J,
DatesR = BasinObs$DatesR,
Precip = BasinObs$P,
...The following code:
```r
library(airGR)
data(L0123001)
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR4J,
DatesR = BasinObs$DatesR,
Precip = BasinObs$P,
PotEvap = BasinObs$E)
# conversion of InputsModel to target time step
InputsModel <- SeriesAggreg(InputsModel, Format = "%Y")
Ind_WarmUp <- seq(
which(format(InputsModel$DatesR, format = "%Y")=="1985"),
which(format(InputsModel$DatesR, format = "%Y")=="1985")
)
Ind_Run <- seq(
which(format(InputsModel$DatesR, format = "%Y")=="1986"),
which(format(InputsModel$DatesR, format = "%Y")=="2011")
)
# preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_GR1A,
InputsModel = InputsModel,
IndPeriod_Run = Ind_Run,
IndPeriod_WarmUp = Ind_WarmUp)
```
results with the following warning:
```
Warning message:
In CreateRunOptions(FUN_MOD = RunModel_GR1A, InputsModel = InputsModel, :
model states initialisation not defined: default configuration used
```
If I let the default warm up, the warning appears with the usual default warm-up warning:
```r
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_GR1A,
InputsModel = InputsModel,
IndPeriod_Run = Ind_Run)
```
There is still a warning indicating a wrong initialisation...
```
Warning messages:
1: In CreateRunOptions(FUN_MOD = RunModel_GR1A, InputsModel = InputsModel, :
model warm up period not defined: default configuration used
the year preceding the run period is used
2: In CreateRunOptions(FUN_MOD = RunModel_GR1A, InputsModel = InputsModel, :
model states initialisation not defined: default configuration used
```
Is it a normal behavior? I don't see any clue about this in the documentation.v1.8https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/117Check the compatibility between the RunOptions and the InputsModel obects2021-11-03T14:24:36+01:00Dorchies DavidCheck the compatibility between the RunOptions and the InputsModel obectsHere the necessary data: [GR4J_crash.RData](/uploads/8f44ff6a10af128a396c78110b9a7e6e/GR4J_crash.RData)
And the code tested on the last `dev` version:
```r
> library(airGR)
> load("GR4J_crash.RData")
> ls()
[1] "InputsModel" "Param" ...Here the necessary data: [GR4J_crash.RData](/uploads/8f44ff6a10af128a396c78110b9a7e6e/GR4J_crash.RData)
And the code tested on the last `dev` version:
```r
> library(airGR)
> load("GR4J_crash.RData")
> ls()
[1] "InputsModel" "Param" "RunOptions"
> Param
[1] 169.017118 -2.375568 20.697233 1.417417
> RunModel_GR4J(InputsModel, RunOptions, Param)
Error in RunModel_GR4J(InputsModel, RunOptions, Param) :
NA/NaN/Inf in foreign function call (arg 2)
```
The error occurs in the Fortran call. I don't know how to debug that...v1.8Delaigue OlivierDelaigue Olivierhttps://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/91Remove plot.OutputsModel from NAMESPACE2021-01-15T08:47:47+01:00Delaigue OlivierRemove plot.OutputsModel from NAMESPACEThe `plot.OutputsModel()` function has been export again in order not to break the reverse dependency of the current version of airGRteaching (v0.2.9.25) available on the CRAN (see #89, ab853bd3). This break has already been fixed in the...The `plot.OutputsModel()` function has been export again in order not to break the reverse dependency of the current version of airGRteaching (v0.2.9.25) available on the CRAN (see #89, ab853bd3). This break has already been fixed in the development version of airGRteaching ([v0.2.10](https://gitlab.irstea.fr/HYCAR-Hydro/airgrteaching/-/milestones/1)) that will be submitted to CRAN shortly after airGR [v1.6](https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/milestones/2).
Once the new versions of airGR and airGRteaching will be available on CRAN. This function can be removed from the NAMESPACE again from the development version of airGR.v2.0https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/84Add the use of '['.OutputsModel in plot.OutputsModel2021-07-14T10:14:45+02:00Delaigue OlivierAdd the use of '['.OutputsModel in plot.OutputsModelIt could be nice to simplify the code of the `plot.OutputsModel()` function by the use of '['.OutputsModel in order to manage the `IndPeriod_Plot` argument.It could be nice to simplify the code of the `plot.OutputsModel()` function by the use of '['.OutputsModel in order to manage the `IndPeriod_Plot` argument.v2.0https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/81Remove of the oldest deprecated arguments and functions2022-07-07T14:10:53+02:00Delaigue OlivierRemove of the oldest deprecated arguments and functionsCheck the box when the argument or function is removed.
### 1.0.9.64 Release Notes (2017-11-10)
- [x] `RunSnowModule` argument is now deprecated in `CreateRunOptions()`.
### 1.0.14.1 Release Notes (2018-09-28)
- [x] `LatRad` argum...Check the box when the argument or function is removed.
### 1.0.9.64 Release Notes (2017-11-10)
- [x] `RunSnowModule` argument is now deprecated in `CreateRunOptions()`.
### 1.0.14.1 Release Notes (2018-09-28)
- [x] `LatRad` argument is now deprecated in `PEdaily_Oudin()` and replaced by the `Lat` argument.
- [x] unused `Ind_zeroes` argument of the `CreateInputsCrit()` function is now deprecated.
- [x] `verbose` argument is now deprecated in `CreateInputsCrit()` and replaced by the `warnings` argument.
### 1.2.13.16 Release Notes (2019-04-03)
- [x] `Qobs` argument is now deprecated in `CreateInputsCrit()` and has been renamed `Obs`.
- [x] `FUN_CRIT` argument is now deprecated in `ErrorCrit()`. This function now gets this information from the `InputsCrit` argument.
- [ ] `FUN_CRIT` argument is now deprecated in `Calibration_Michel()`. This function now gets this information from the `InputsCrit` argument.
### 1.3.2.23 Release Notes (2019-06-20)
- [x] `PEdaily_Oudin()` function is deprecated and his use has been replaced by the use of `PE_Oudin()`.
### 1.6.8.44 Release Notes (2021-01-08)
- [ ] `TimeFormat` argument is now deprecated in `SeriesAggreg()`.
- [ ] `NewTimeFormat` argument is now deprecated in `SeriesAggreg()` and replaced by the `Format` argument.v1.8https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/42Add new function to manage time steps2021-04-19T09:09:56+02:00Delaigue OlivierAdd new function to manage time stepsIt is maybe a good idea to create an internal function to manage the time steps in order to avoid command lines in many functions:
```
if ("daily" %in% class(XXXXXXX)) {
TimeStep <- 60 * 60 * 24
}
if ("hourly" %in% class(XXXXXXX)) {
...It is maybe a good idea to create an internal function to manage the time steps in order to avoid command lines in many functions:
```
if ("daily" %in% class(XXXXXXX)) {
TimeStep <- 60 * 60 * 24
}
if ("hourly" %in% class(XXXXXXX)) {
TimeStep <- 60 * 60
}
```