airGR issueshttps://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues2023-10-31T10:20:55+01:00https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/186Add the features diagram in the 'get_started' vignette2023-10-31T10:20:55+01:00Delaigue OlivierAdd the features diagram in the 'get_started' vignetteIn order to summerize the main functions: https://hydrogr.github.io/airGR/fig/airGR_features_diagram.svg
A section has already been added to the airGR website.In order to summerize the main functions: https://hydrogr.github.io/airGR/fig/airGR_features_diagram.svg
A section has already been added to the airGR website.v1.8https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/185Add 'hydroPSO' package in the 'Suggests' list2023-10-26T10:58:38+02:00Delaigue OlivierAdd 'hydroPSO' package in the 'Suggests' listWhen the 'hydroPSO' package will be available again on CRAN, we will have to:
- complete the Suggests' list in the `DESCRIPTION` file
- update the `V02.1_param_optim` vignette
- update the `.vignettechunkignore` fileWhen the 'hydroPSO' package will be available again on CRAN, we will have to:
- complete the Suggests' list in the `DESCRIPTION` file
- update the `V02.1_param_optim` vignette
- update the `.vignettechunkignore` filev1.8https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/184CI: crash on dev branch2023-10-23T17:14:51+02:00Dorchies DavidCI: crash on dev branchSee pipeline https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/pipelines/50934 as example...
Todo:
- update DESCRIPTION file
- update .gitlab-ci.ymlSee pipeline https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/pipelines/50934 as example...
Todo:
- update DESCRIPTION file
- update .gitlab-ci.ymlv1.7.6Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/183Change webGR URLs of english pages2023-10-31T13:54:43+01:00Delaigue OlivierChange webGR URLs of english pagesSince the language plugin no longer works on webGR.inrae.fr, all links must be modified in the package documentation and vignettes.Since the language plugin no longer works on webGR.inrae.fr, all links must be modified in the package documentation and vignettes.v1.7.6https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/182Correct vignette due to 'hydroPSO' was removed from the CRAN repository2023-10-19T18:06:50+02:00Delaigue OlivierCorrect vignette due to 'hydroPSO' was removed from the CRAN repositoryProf Brian Ripley
16 October 2023 13:03
```
Dear maintainer,
Please see the problems shown on
<https://cran.r-project.org/web/checks/check_results_airGR.html>.
Please correct before 2023-10-30 to safely retain your package on CRAN.
...Prof Brian Ripley
16 October 2023 13:03
```
Dear maintainer,
Please see the problems shown on
<https://cran.r-project.org/web/checks/check_results_airGR.html>.
Please correct before 2023-10-30 to safely retain your package on CRAN.
Packages in Suggests should be used conditionally: see 'Writing R Extensions'.
This needs to be corrected even if the missing package(s) become available.
It can be tested by checking with _R_CHECK_DEPENDS_ONLY_=true.
The CRAN Team
```v1.7.6https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/181CreateRunOptions and RunModel_GR5H* do not crash when Imax set to NULL2023-10-26T11:23:17+02:00Thirel GuillaumeCreateRunOptions and RunModel_GR5H* do not crash when Imax set to NULLSee
```
library(airGR)
## load of catchment data
data(L0123003)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR5H, DatesR = BasinObs$DatesR,
Precip = Ba...See
```
library(airGR)
## load of catchment data
data(L0123003)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD = RunModel_GR5H, DatesR = BasinObs$DatesR,
Precip = BasinObs$P, PotEvap = BasinObs$E)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR, format = "%Y-%m-%d %H:%M")=="2006-01-01 00:00"),
which(format(BasinObs$DatesR, format = "%Y-%m-%d %H:%M")=="2006-12-31 23:00"))
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_GR5H, Imax = NULL,
InputsModel = InputsModel, IndPeriod_Run = Ind_Run)
```
It gives a warning for something else, but no error:
```
Warning message:
In CreateRunOptions(FUN_MOD = RunModel_GR5H, Imax = NULL, InputsModel = InputsModel, :
model warm up period not defined: default configuration used
the year preceding the run period is used
```
That is not desirable in my opinion (someone I know just made wrong simulations for this reason due to a bad reading of Imax values).v1.8https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/180Remove use of DLLEXPORT command in Fortran codes2023-10-19T18:06:55+02:00Delaigue OlivierRemove use of DLLEXPORT command in Fortran codesOn 09.08.2023 11:37, Prof Brian Ripley wrote:
> The manual now says
```
Warning to package maintainers: the Intel Fortran compilers interpret comments intended for Visual Fortran like
!DEC$ ATTRIBUTES DLLEXPORT,C,REFERENCE,ALIAS:'kd...On 09.08.2023 11:37, Prof Brian Ripley wrote:
> The manual now says
```
Warning to package maintainers: the Intel Fortran compilers interpret comments intended for Visual Fortran like
!DEC$ ATTRIBUTES DLLEXPORT,C,REFERENCE,ALIAS:'kdenestmlcvb' :: kdenestmlcvb
The DLLEXPORT gives a warning but the remainder silently generates incorrectly named entry points. Such comment lines need to be removed from code for use with R (even if using Intel Fortran on Windows).
```
> Such comments are seen in
>
> MixtureRegLTIC PBRF WWR airGR conTree concreg coxphf coxphw groupsubsetselection rBDAT stima
>
> with warnings showing (in an hour or two) as an 'Intel' additional issue on the CRAN resuls page.
>
> Please remove them in your next update.v1.7.6https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/179RunModel_CemaNeige fails in CreateIniStates at the hourly time step2023-10-26T11:23:22+02:00Thebault CyrilRunModel_CemaNeige fails in CreateIniStates at the hourly time stepWhen I try to use RunModel_CemaNeige alone (without GR models) at the hourly time step, the following error appear:
`UH1' must be numeric of length 480 (20 * 24)`
The error appear because in CreateIniStates, the following condition `if...When I try to use RunModel_CemaNeige alone (without GR models) at the hourly time step, the following error appear:
`UH1' must be numeric of length 480 (20 * 24)`
The error appear because in CreateIniStates, the following condition `if ("CemaNeige" %in% ObjectClass & ! "GR" %in% ObjectClass)` leads to a `UH1` set to `rep(Inf, UH1n)` instead of `rep(Inf, UH1n*k)`. This error appear also with `UH2`. Note that the `k` value is defined later in the script as:
```r
if ("hourly" %in% ObjectClass) {
k <- 24
} else {
k <- 1
}
```
I suggest therefore to move this part at the beginning of the function CreateIniStates and after that to define everywhere UH1 and UH2 as
rep(Inf, UH1n*k).
PS: The examples with CemaNeige at the hourly time step can't be run, the U2345030 catchment is not included in the package (and we can't use another catchment included in the package because they either have temperature data or hourly data, but never both).v1.8https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/178frun_CemaNeige.f90: case dG = 0 not considered2023-10-23T17:34:05+02:00Thirel Guillaumefrun_CemaNeige.f90: case dG = 0 not consideredIn frun_CemaNeige.f90, the case when dG = 0 is not taken into account. It can result in a Gratio that is set and stays equal to 1 when small solid precipitation occurs and melts on the same day. I propose to correct that by modifying lin...In frun_CemaNeige.f90, the case when dG = 0 is not taken into account. It can result in a Gratio that is set and stays equal to 1 when small solid precipitation occurs and melts on the same day. I propose to correct that by modifying line 187
` IF (dG.LT.0.) THEN`
becomes
` IF (dG.LE.0.) THEN`
Attached is the modified file, as well as the output of a simulation where this bug is activated.
Bug identified by @francois.bourgin and Thibault Hallouin.
[frun_CEMANEIGE.f90](/uploads/c8331d51d796ee6d0495b454903f8444/frun_CEMANEIGE.f90)
[bug_sca.csv](/uploads/f48eb420cd3ca73f00724f3813999659/bug_sca.csv)v1.7.6https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/177RunModel_Lag: negative Qsim during Calibration produces NaNs2024-03-27T14:24:06+01:00Dorchies DavidRunModel_Lag: negative Qsim during Calibration produces NaNsIn case of a simulation with Direct Injection abstracting to much water, the downstream flow simulated by `RunModel_Lag` can be negative. But there is a piece of code to cap it to zero:
```r
if (length(RunOptions$Outputs_Sim) > 2) {
...In case of a simulation with Direct Injection abstracting to much water, the downstream flow simulated by `RunModel_Lag` can be negative. But there is a piece of code to cap it to zero:
```r
if (length(RunOptions$Outputs_Sim) > 2) {
if (any(OutputsModel$Qsim[!is.na(OutputsModel$Qsim)] < 0)) {
warning(length(which(OutputsModel$Qsim < 0)), " time steps with negative flow, set to zero.")
OutputsModel$Qsim[OutputsModel$Qsim < 0] <- 0
}
# Warning for NAs
if (any(is.na(OutputsModel$Qsim))) {
warning(length(which(is.na(OutputsModel$Qsim))), " time steps with NA values")
}
}
```
Unfortunately the assignation to zero is in a condition that is not met during calibration. In case of using a square root transformation for the error criterion, the criterion produces NaNs with a lot of warnings.
Planned solution: move the cap to zero outside the condition linked to the warning (see code above) in order to make it systematic.v1.8https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/176CreateIniStates: Huge computation time spent on GetFeatModel2023-10-26T11:23:40+02:00Dorchies DavidCreateIniStates: Huge computation time spent on GetFeatModelThe Rstudio profiler on airGRiwrm calibration with ungauged nodes returns this result:
![image](/uploads/2a1ef7ba9e8378e269332851c470569c/image.png)
We see that on 3.46 sec of calculation, 1.62 sec are spent in `CreateIniStates` and es...The Rstudio profiler on airGRiwrm calibration with ungauged nodes returns this result:
![image](/uploads/2a1ef7ba9e8378e269332851c470569c/image.png)
We see that on 3.46 sec of calculation, 1.62 sec are spent in `CreateIniStates` and especially in the call to `.GetFeatModel` which take a lot of time to run `system.file` and `read.table`.
One first quick solution would be to add in `Calibration`, a copy of model features from `RunOptions` to `InputsModel` in order to provide them to `CreateIniStates` through `InputsModel`.
If we think of more structured solution, model features could be attached from the beginning to the `InputsModel` object and propagated to all subsequent objects used in simulation/calibration without the need to call again the expensive `.GetFeatModel` function. This point of view change substantially the call to airGR functions because we would need to precise `IsSD` and `IsHyst` parameters in the `CreateInputsModel` call. This also would simplify the calls to other `Create...` functions which would not need these parameters anymore.
@guillaume.thirel, @olivier.delaigue, if you agree with this point of view, this proposed solution needs further investigation in order to avoid breaking changes and take into account any legacy and new call to airGR functions. Maybe in a separated ticket issue ?v1.8https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/175Correct vignette due to the return of 'Rmalschains' on the CRAN repository2023-10-31T10:39:38+01:00Delaigue OlivierCorrect vignette due to the return of 'Rmalschains' on the CRAN repositoryThe package is available again on the CRAN.
- Remove the explanations from the vignette '2.1_param_optim' about the installation of the package from the CRAN archives
- Add the package in the 'Suggests' list of the DESCRIPTION fileThe package is available again on the CRAN.
- Remove the explanations from the vignette '2.1_param_optim' about the installation of the package from the CRAN archives
- Add the package in the 'Suggests' list of the DESCRIPTION filev1.7.6https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/173Replace the use of 'personList' in the CITATION file2023-04-11T16:56:30+02:00Delaigue OlivierReplace the use of 'personList' in the CITATION file```
CRAN checks:
Package CITATION file contains call(s) to old-style personList() or
as.personList(). Please use c() on person objects instead.
``````
CRAN checks:
Package CITATION file contains call(s) to old-style personList() or
as.personList(). Please use c() on person objects instead.
```v1.7.4https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/172Correct vignette due to 'Rmalschains' was removed from the CRAN repository2023-10-20T10:20:53+02:00Delaigue OlivierCorrect vignette due to 'Rmalschains' was removed from the CRAN repositoryProf Brian Ripley
3 April 2023 10:05
```
Dear maintainer,
Please see the problems shown on
<https://cran.r-project.org/web/checks/check_results_airGR.html>.
Please correct before 2023-04-17 to safely retain your package on CRAN.
...Prof Brian Ripley
3 April 2023 10:05
```
Dear maintainer,
Please see the problems shown on
<https://cran.r-project.org/web/checks/check_results_airGR.html>.
Please correct before 2023-04-17 to safely retain your package on CRAN.
Packages in Suggests should be used conditionally: see 'Writing R Extensions'.
This needs to be corrected even if the missing package(s) become available.
It can be tested by checking with _R_CHECK_DEPENDS_ONLY_=true.
The CRAN Team
```v1.7.4https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/171Check error: Direct call of 'as.data.frame.POSIXct()' is deprecated. Use 'as...2023-10-24T11:05:59+02:00Dorchies DavidCheck error: Direct call of 'as.data.frame.POSIXct()' is deprecated. Use 'as.data.frame.vector()' or 'as.data.frame()' insteadThis error has raised on the check for devel version of R since 16th of December.
It needs to be fixed for the next release.This error has raised on the check for devel version of R since 16th of December.
It needs to be fixed for the next release.v1.7.6https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/170Move the project in the airGRgalaxy repository2023-02-14T13:02:13+01:00Delaigue OlivierMove the project in the airGRgalaxy repository- [ ] Move the project into the [airGRgalaxy group](https://gitlab.irstea.fr/HYCAR-Hydro/airgrgalaxy)
- [ ] Update the **URL** and **BugReports** items in the DESCRIPTION file- [ ] Move the project into the [airGRgalaxy group](https://gitlab.irstea.fr/HYCAR-Hydro/airgrgalaxy)
- [ ] Update the **URL** and **BugReports** items in the DESCRIPTION filev1.8https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/169Fix GR pathology2023-10-26T11:24:06+02:00Thirel GuillaumeFix GR pathologyIssue initially reported to Vazken and Charles by Wouter Knoben on the Excel GR4J in 2017, also reported recently by @laurent.strohmenger on GR5J recently.
Note: this issue concerns airGR but is not specific to the package, it comes fr...Issue initially reported to Vazken and Charles by Wouter Knoben on the Excel GR4J in 2017, also reported recently by @laurent.strohmenger on GR5J recently.
Note: this issue concerns airGR but is not specific to the package, it comes from the GR implementation.
Under some conditions (i.e. some parameters sets, some climatic conditions), the lower part of the GR models, namely the routing store and the exchange component, enter in a mode where it cannot escape anymore. Due to a positive X2 and a positive exchange larger than the routing store outflow, the routing store comes to an equilibrium and a non null discharge is produced, even though no more rainfall is injected.
This is very annoying, as the simulation quality becomes very poor. This issue may not be found under calibration, because a low objective function would lead to avoid these parameter sets, but some parameter sets can look ok under calibration and then give erroneous simulations, under a different climate for instance (e.g. high rainfall).
Included is the email exchange with Wouter Knoben colleagues.
[GR4J_pathology_Knoben.docx](/uploads/715ff50a3c0232a3125178db848fdc15/GR4J_pathology_Knoben.docx)
Attached also an R code reproducing the bug proposed by @laurent.strohmenger and augmented by the translation in R of the GR5J routing part producing the bug. It shows that X2 does not need to be larger than X3, oppositely to what was discussed in 2017.
[GR5J_bug.R](/uploads/4fc1d93321a41a052546d69d9b435427/GR5J_bug.R)
There is no solution to date, but this must be cured.v2.0https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/168Error message slightly wrong for TransfoParamGR5J2023-10-19T18:07:29+02:00Thirel GuillaumeError message slightly wrong for TransfoParamGR5JSee below (it only occurs for TransfoParam_GR5J):
```
> airGR::TransfoParam_GR5J(rep(-9.99, 4), Direction = "TR")
Error in airGR::TransfoParam_GR5J(rep(-9.99, 4), Direction = "TR") :
the GR4J model requires 5 parameters
```
Monkey ...See below (it only occurs for TransfoParam_GR5J):
```
> airGR::TransfoParam_GR5J(rep(-9.99, 4), Direction = "TR")
Error in airGR::TransfoParam_GR5J(rep(-9.99, 4), Direction = "TR") :
the GR4J model requires 5 parameters
```
Monkey tester, à votre service !v1.7.6https://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/167CreateRunOptions: crash with RunModel_Lag2022-11-27T10:04:52+01:00Dorchies DavidCreateRunOptions: crash with RunModel_LagThe example provided for `RunModel_Lag` is incoherent. Both `CreateInputsModel` and `CreateRunOptions` uses `FUN_MOD = RunModelGR4J` to work. If, in example, we try to change the argument to `FUN_MOD = RunModel_Lag`, CreateRunOptions cra...The example provided for `RunModel_Lag` is incoherent. Both `CreateInputsModel` and `CreateRunOptions` uses `FUN_MOD = RunModelGR4J` to work. If, in example, we try to change the argument to `FUN_MOD = RunModel_Lag`, CreateRunOptions crashes:
```r
> InputsModelInf <- CreateInputsModel(FUN_MOD = RunModel_Lag, DatesR = BasinObs$DatesR,
+ Precip = BasinObs$P, PotEvap = BasinObs$E,
+ Qupstream = Qupstream, LengthHydro = LengthHydro,
+ BasinAreas = BasinAreas)
> RunOptions <- CreateRunOptions(FUN_MOD = RunModel_Lag,
+ InputsModel = InputsModelInf, IndPeriod_Run = Ind_Run)
Error in rep(0, NState) : invalid 'times' argument
```
This is due to the fact that:
```
> class(InputsModelInf)
[1] "InputsModel" "daily" "SD" "SD"
```
And in `CreateRunOptions` there is a test for defining the size of the initial state vector restricted to `if ("GR" %in% ObjectClass | "CemaNeige" %in% ObjectClass)` and therefore `Nstate` is `NULL` when proceeding to the creation of the initial state vector.
I see 2 solutions:
- Define the default value of `NState <- 0` instead of `NULL` which could be generic to any future model outside GR family assuming the lack of initial state
- Systematically call `CreateIniStates` with proper parameters for the cases where the parameter `IniStates` is NULL (I have tested it with `IniStates = CreateIniStates(RunModel_Lag, InputsModel)`, it works).v1.8Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/HYCAR-Hydro/airgr/-/issues/166Update GR5H interception grid-screening parameter quantiles2022-09-13T14:58:36+02:00Delaigue OlivierUpdate GR5H interception grid-screening parameter quantilesAccording to the tests made by @cyril.thebault on the ~579 catchments, it seems to be needed to update the GR5H interception parameter quantiles used during the grid-screening calibration step.
Current values:
```r
GR5Hinterception = ...According to the tests made by @cyril.thebault on the ~579 catchments, it seems to be needed to update the GR5H interception parameter quantiles used during the grid-screening calibration step.
Current values:
```r
GR5Hinterception = matrix(c(+3.46, -1.25, +4.04, -9.53, -9.34,
+3.74, -0.41, +4.78, -8.94, -3.33,
+4.29, +0.16, +5.39, -7.39, +3.33), ncol = 5, byrow = TRUE)
```
New values (found after 4 convergence loops):
```r
GR5Hinterception = matrix(c(+4.92, -0.17, +4.27, -9.81, -9.29,
+5.42, -0.07, +4.94, -9.66, -7.36,
+6.05, -0.01, +5.63, -9.26, -5.55), ncol = 5, byrow = TRUE)
```v1.8