airGRiwrm issueshttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues2022-02-21T13:34:44+01:00https://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/64`CreateGRiwrm` crashes when keeping all columns and rename some2022-02-21T13:34:44+01:00Dorchies David`CreateGRiwrm` crashes when keeping all columns and rename someSee example below:
```r
text = "id_amont lambert2.x lambert2.y area nom id_aval distance_aval model
H8100021 537912.994 2455749.314 64420.94 La Seine à Vernon NA NA RunModel_CemaNeigeGR4J
H7900010 578113 2437649 61642.28 La Seine à Pois...See example below:
```r
text = "id_amont lambert2.x lambert2.y area nom id_aval distance_aval model
H8100021 537912.994 2455749.314 64420.94 La Seine à Vernon NA NA RunModel_CemaNeigeGR4J
H7900010 578113 2437649 61642.28 La Seine à Poissy H8100021 76.28 RunModel_CemaNeigeGR4J
H5920010 602213 2427449 43824.66 La Seine à Paris [Austerlitz après création lacs] H7900010 82.26 RunModel_CemaNeigeGR4J"
BS_reseau <- read.csv(text = text, sep = "\t")
library(airGRiwrm)
> griwrm <- CreateGRiwrm(BS_reseau,
cols = list(id = "id_amont",
down = "id_aval",
length = "distance_aval"),
keep_all = TRUE)
```
which leads to this error:
```r
Error in if (typeof(df[[x]]) != coltypes[[x]]) { :
argument is of length zero
4.
FUN(X[[i]], ...)
3.
lapply(names(df), function(x) {
if (typeof(df[[x]]) != coltypes[[x]]) {
stop(sprintf("The '%s' column is of type %s, a column of type %s is required",
x, typeof(df[[x]]), coltypes[[x]])) ... at CreateGRiwrm.R#95
2.
CheckColumnTypes(db, list(id = "character", down = "character",
length = "double", model = "character", area = "double")) at CreateGRiwrm.R#69
1.
CreateGRiwrm(BS_reseau, cols = list(id = "id_amont", down = "id_aval",
length = "distance_aval"), keep_all = TRUE)
```v0.6.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/74`plot.GRiwrm` not working in gitlab-ci2022-03-03T16:40:45+01:00Dorchies David`plot.GRiwrm` not working in gitlab-ciHere the errors we have on check:
```
--- re-building ‘V01_Structure_SD_model.Rmd’ using rmarkdown
Quitting from lines 78-80 (V01_Structure_SD_model.Rmd)
Error: processing vignette 'V01_Structure_SD_model.Rmd' failed with diagnostics:
...Here the errors we have on check:
```
--- re-building ‘V01_Structure_SD_model.Rmd’ using rmarkdown
Quitting from lines 78-80 (V01_Structure_SD_model.Rmd)
Error: processing vignette 'V01_Structure_SD_model.Rmd' failed with diagnostics:
invalid value 0 for 'digits' argument
--- failed re-building ‘V01_Structure_SD_model.Rmd’
--- re-building ‘V02_Calibration_SD_model.Rmd’ using rmarkdown
--- finished re-building ‘V02_Calibration_SD_model.Rmd’
--- re-building ‘V03_Open-loop_influenced_flow.Rmd’ using rmarkdown
Quitting from lines 64-65 (V03_Open-loop_influenced_flow.Rmd)
Error: processing vignette 'V03_Open-loop_influenced_flow.Rmd' failed with diagnostics:
invalid value 0 for 'digits' argument
--- failed re-building ‘V03_Open-loop_influenced_flow.Rmd’
--- re-building ‘V04_Closed-loop_regulated_withdrawal.Rmd’ using rmarkdown
Quitting from lines 58-69 (V04_Closed-loop_regulated_withdrawal.Rmd)
Error: processing vignette 'V04_Closed-loop_regulated_withdrawal.Rmd' failed with diagnostics:
invalid value 0 for 'digits' argument
--- failed re-building ‘V04_Closed-loop_regulated_withdrawal.Rmd’
--- re-building ‘airgriwrm.Rmd’ using rmarkdown
--- finished re-building ‘airgriwrm.Rmd’
```v0.6.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/73`plot.GRiwrm`: mermaid code is displayed with the diagram2022-03-03T16:40:42+01:00Dorchies David`plot.GRiwrm`: mermaid code is displayed with the diagramSee on vignette Severn_01:
![image](/uploads/2c095003e57019dcb6801a609a6894cb/image.png)See on vignette Severn_01:
![image](/uploads/2c095003e57019dcb6801a609a6894cb/image.png)v0.6.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/39`RunModel.Supervisor`: Error in ctrlr$U[seq.int(length(sv$ts.index)), i]2021-04-19T18:48:21+02:00Dorchies David`RunModel.Supervisor`: Error in ctrlr$U[seq.int(length(sv$ts.index)), i]Supervisor avec un time step = 1, on a cette erreur dans `setDataToLocation` car le vecteur revoyé par le contrôleur n'est pas une matrice...Supervisor avec un time step = 1, on a cette erreur dans `setDataToLocation` car le vecteur revoyé par le contrôleur n'est pas une matrice...v0.6.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/66addReservoirsGRiwrm error after adding extra columns into griwrm2021-12-15T15:10:42+01:00Dorchies DavidaddReservoirsGRiwrm error after adding extra columns into griwrmSee https://gitlab.irstea.fr/in-wop/seinebasin2/-/jobs/219188
```
Error in rbind(deparse.level, ...) :
numbers of columns of arguments do not match
Calls: local ... eval -> eval -> addReservoirsGRiwrm -> rbind -> rbind
```See https://gitlab.irstea.fr/in-wop/seinebasin2/-/jobs/219188
```
Error in rbind(deparse.level, ...) :
numbers of columns of arguments do not match
Calls: local ... eval -> eval -> addReservoirsGRiwrm -> rbind -> rbind
```Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/32airGR compatibility: change on LengthHydro unit2021-04-15T10:13:55+02:00Dorchies DavidairGR compatibility: change on LengthHydro unitIn HYCAR-Hydro/airgr#112 LengthHydro unit passed from meters to kilometers.
The documentation and vignettes should be modified consequently.In HYCAR-Hydro/airgr#112 LengthHydro unit passed from meters to kilometers.
The documentation and vignettes should be modified consequently.v0.6.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/107Allow to use node with model RunModel_Lag2022-11-27T10:04:52+01:00Dorchies DavidAllow to use node with model RunModel_LagThe easiest way to simulate nodes that represents canal outlets without impluvium should be to use a model RunModel_Lag to only transfer flows from upstream nodes without taking into account potential run-off.
Unfortunately using `RunMo...The easiest way to simulate nodes that represents canal outlets without impluvium should be to use a model RunModel_Lag to only transfer flows from upstream nodes without taking into account potential run-off.
Unfortunately using `RunModel_Lag` as a model, raises lot of issues which seems to be related to malfunctions on both airGRiwrm and airGR...
For example the following code based on the data available in the vignette Severn_01 crashes:
```r
db <- data.frame(id = c("54095", "DownLag"),
length = c(1, NA),
down = c("DownLag", NA),
area = as.double(c(3722.68, NA)),
model = c("RunModel_GR4J", "RunModel_Lag"),
stringsAsFactors = FALSE)
g <- CreateGRiwrm(db)
IM <- CreateInputsModel(g,
DatesR = DatesR,
Precip = Precip[, "54095", drop = FALSE],
PotEvap = PotEvap[, "54095", drop = FALSE])
```
```
CreateInputsModel.GRiwrm: Processing sub-basin 54095...
CreateInputsModel.GRiwrm: Processing sub-basin DownLag...
Error in if (BasinAreas[length(BasinAreas)] < 0) { :
missing value where TRUE/FALSE needed
```v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/8Bug: CI failed because of error in stringi package2020-06-12T16:55:48+02:00Dorchies DavidBug: CI failed because of error in stringi packageWe meet an issue similar to https://github.com/tidyverse/stringr/issues/320
It seems that a dependency issue occurs in stringi package and it needs to be reinstall with compilation.
Since it is installed in the cache, we need to schedul...We meet an issue similar to https://github.com/tidyverse/stringr/issues/320
It seems that a dependency issue occurs in stringi package and it needs to be reinstall with compilation.
Since it is installed in the cache, we need to schedule special CI jobs to reinstall it...Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/108Calibration does not work when upstream catchments are both gauged and ungauged2022-11-28T10:29:39+01:00Thirel GuillaumeCalibration does not work when upstream catchments are both gauged and ungaugedFound by Léonard Santos
I used the ungauged calibration vignette and I set 54001 as gauged. For 54032, upstream 54001 is therefore gauged and 54029 is ungauged. Under this set up, calibration does not work.
Attached is the code for re...Found by Léonard Santos
I used the ungauged calibration vignette and I set 54001 as gauged. For 54032, upstream 54001 is therefore gauged and 54029 is ungauged. Under this set up, calibration does not work.
Attached is the code for reproducing the error.
```
Calibration.GRiwrmInputsModel: Treating sub-basin 54032...
Crit. KGE2[sqrt(Q)] = 0.9520
SubCrit. KGE2[sqrt(Q)] cor(sim, obs, "pearson") = 0.9601
SubCrit. KGE2[sqrt(Q)] cv(sim)/cv(obs) = 0.9997
SubCrit. KGE2[sqrt(Q)] mean(sim)/mean(obs) = 1.0268
Grid-Screening in progress (0%
Error in InputsModel$Qupstream[Runoptions$IndPeriod_Run, i] <- OutputsModel[[InputsModel$UpstreamNodes[i]]]$Qsim_m3 :
number of items to replace is not a multiple of replacement length
```
[bug_ungauged_calib.R](/uploads/ae1e7e87eac0c96a865a663c11cefcdb/bug_ungauged_calib.R)v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/128Calibration: crash with a diverted ungauged node2023-05-12T14:44:09+02:00Dorchies DavidCalibration: crash with a diverted ungauged nodeThe network below results in the following error:
`
Error in InputsModel$Qupstream[Runoptions$IndPeriod_Run, i] <- OutputsModel[[InputsModel$UpstreamNodes[i]]][[InputsModel$UpstreamVarQ[i]]]:
le nombre d'objets à remplacer n'est pas mult...The network below results in the following error:
`
Error in InputsModel$Qupstream[Runoptions$IndPeriod_Run, i] <- OutputsModel[[InputsModel$UpstreamNodes[i]]][[InputsModel$UpstreamVarQ[i]]]:
le nombre d'objets à remplacer n'est pas multiple de la taille du remplacement
`
```mermaid
graph LR
id_54001[54001]
id_54095[54095]
id_Dam[Dam]
id_54095[54095]
id_54095 -->| 0 km| id_Dam
id_Dam -->| 42 km| id_54001
id_54095 -->| 42 km| id_54001
class id_54001 IntermediateGauged
class id_54095,id_54095 UpstreamUngaugedDiversion
class id_Dam Reservoir
classDef default stroke:#333
classDef UpstreamUngauged fill:#eef
classDef UpstreamGauged fill:#aaf
classDef IntermediateUngauged fill:#efe
classDef IntermediateGauged fill:#afa
classDef DirectInjection fill:#faa
classDef Reservoir fill:#9de
classDef UpstreamUngaugedDiversion fill:#eef, stroke:#faa, stroke-width:3px
classDef UpstreamGaugedDiversion fill:#aaf, stroke:#faa, stroke-width:3px
classDef IntermediateUngaugedDiversion fill:#efe, stroke:#faa, stroke-width:3px
classDef IntermediateGaugedDiversion fill:#afa, stroke:#faa, stroke-width:3px
linkStyle 0 stroke:#faa, stroke-width:2px,stroke-dasharray: 5 5;
```v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/123Calibration: crash with ungauged node and multiple Diversions2023-05-11T08:59:50+02:00Dorchies DavidCalibration: crash with ungauged node and multiple Diversionsv0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/122Calibration: Diversion is not handled on upstream nodes2023-04-29T18:02:27+02:00Dorchies DavidCalibration: Diversion is not handled on upstream nodesThe diversion is not taken into account during calibration at least on upstream nodes.
On this small example below, if we define a huge Diversion flow in the node "54095" in order to derive the totality of the flow, the node should not ...The diversion is not taken into account during calibration at least on upstream nodes.
On this small example below, if we define a huge Diversion flow in the node "54095" in order to derive the totality of the flow, the node should not be able to be calibrated because the resulting flow `Qsim` at the node "54095" should be zero.
```mermaid
graph LR
id_54001[54001]
id_54095[54095]
id_54095[54095]
id_54095 -->| 42 km| id_54001
class id_54001 IntermediateGauged
class id_54095,id_54095 UpstreamGaugedDiversion
classDef default stroke:#333
classDef UpstreamUngauged fill:#eef
classDef UpstreamGauged fill:#aaf
classDef IntermediateUngauged fill:#efe
classDef IntermediateGauged fill:#afa
classDef DirectInjection fill:#faa
classDef Reservoir fill:#9de
classDef UpstreamUngaugedDiversion fill:#eef, stroke:#faa, stroke-width:3px
classDef UpstreamGaugedDiversion fill:#aaf, stroke:#faa, stroke-width:3px
classDef IntermediateUngaugedDiversion fill:#efe, stroke:#faa, stroke-width:3px
classDef IntermediateGaugedDiversion fill:#afa, stroke:#faa, stroke-width:3px
linkStyle 0 stroke:#faa, stroke-width:2px,stroke-dasharray: 5 5;
```v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/78Check failed on release version2022-07-18T19:37:24+02:00Dorchies DavidCheck failed on release version:laughing:
```
❯ checking CRAN incoming feasibility ... WARNING
Maintainer: ‘David Dorchies <david.dorchies@inrae.fr>’
Insufficient package version (submitted: 0.6.1, existing: 0.6.1)
Days since last update: 1
0 errors ✔ | ...:laughing:
```
❯ checking CRAN incoming feasibility ... WARNING
Maintainer: ‘David Dorchies <david.dorchies@inrae.fr>’
Insufficient package version (submitted: 0.6.1, existing: 0.6.1)
Days since last update: 1
0 errors ✔ | 1 warning ✖ | 0 notes ✔
```
Solution: skip cran check for tags and schedule on master.
Only run cran check on commits on all branches.v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/89ConvertMeteoSD: crash with upstream nodes with no area2022-08-10T17:51:28+02:00Dorchies DavidConvertMeteoSD: crash with upstream nodes with no areaA downstream node containing an upstream node with an area defined with `NA` crashes the function ConvertMeteoSD.
The example below induces the following error:
![image](/uploads/e2c65d9d2db8c497906d31ea40c9ecb6/image.png)
```
Precip ...A downstream node containing an upstream node with an area defined with `NA` crashes the function ConvertMeteoSD.
The example below induces the following error:
![image](/uploads/e2c65d9d2db8c497906d31ea40c9ecb6/image.png)
```
Precip <- ConvertMeteoSD(griwrmV04, PrecipTot)
Error in meteo[, c(x, upperIDs), drop = FALSE] : subscript out of bounds
```v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/143ConvertSD not allowing T < 0 °C2024-03-03T10:41:10+01:00Thirel GuillaumeConvertSD not allowing T < 0 °CconvertSD gives temperatures that are always >= 0 °C, with several values exactly equal to 0 °C.
See below an example with some personal data, I'll try to reproduce that with data from seineBasin2. It seems the argument temperature = T...convertSD gives temperatures that are always >= 0 °C, with several values exactly equal to 0 °C.
See below an example with some personal data, I'll try to reproduce that with data from seineBasin2. It seems the argument temperature = TRUE is not passed to other functions. See in https://gitlab.irstea.fr/in-wop/airGRiwrm/-/blob/dev/R/ConvertMeteoSD.R, `output <- lapply(id_runoff, ConvertMeteoSD, griwrm = x, meteo = meteo)` or
```r
output <- ConvertMeteoSD(
meteo[, upperIDs, drop = FALSE],
areas = areas
)
```
```
> griwrm
id down length model area
1 I5060001_ONDE I6201020_HYDRO&EDF 5.92 RunModel_CemaNeigeGR4J 98.68
2 I6122020_HYDRO&EDF I5060001_ONDE 2.55 RunModel_CemaNeigeGR4J 91.48
3 I6201020_HYDRO&EDF I6211020_HYDRO&EDF 10.29 RunModel_CemaNeigeGR4J 298.47
4 I6302020_HYDRO&EDF I6322010_HYDRO&EDF 5.88 RunModel_CemaNeigeGR4J 138.71
5 I6322010_HYDRO&EDF I6421030_HYDRO&EDF 17.45 RunModel_CemaNeigeGR4J 183.04
6 I6211020_HYDRO&EDF I5110200_RCS 13.91 RunModel_CemaNeigeGR4J 375.54
7 I5110200_RCS I6421030_HYDRO&EDF 14.40 RunModel_CemaNeigeGR4J 569.54
8 I6421030_HYDRO&EDF <NA> NA RunModel_CemaNeigeGR4J 1009.10
9 I6413010_HYDRO&EDF I6421030_HYDRO&EDF 10.93 RunModel_CemaNeigeGR4J 148.18
TempMean <- as.data.frame(ConvertMeteoSD(griwrm, TempTot, temperature = TRUE))
> summary(TempMean)
I5060001_ONDE I6122020_HYDRO&EDF I6201020_HYDRO&EDF I6302020_HYDRO&EDF I6322010_HYDRO&EDF I6211020_HYDRO&EDF
Min. : 0.000 Min. :-7.107 Min. : 0.000 Min. :-6.211 Min. : 0.000 Min. : 0.000
1st Qu.: 8.272 1st Qu.: 8.438 1st Qu.: 8.217 1st Qu.: 8.532 1st Qu.: 8.632 1st Qu.: 8.486
Median :11.891 Median :11.968 Median :11.821 Median :12.138 Median :12.240 Median :12.109
Mean :11.928 Mean :12.003 Mean :11.885 Mean :12.204 Mean :12.326 Mean :12.149
3rd Qu.:15.793 3rd Qu.:15.816 3rd Qu.:15.738 3rd Qu.:16.076 3rd Qu.:16.183 3rd Qu.:16.024
Max. :32.557 Max. :32.413 Max. :33.003 Max. :33.561 Max. :34.522 Max. :32.432
I5110200_RCS I6421030_HYDRO&EDF I6413010_HYDRO&EDF DatesR
Min. : 0.00 Min. : 0.000 Min. :-6.677 Min. :1951-01-01 00:00:00
1st Qu.: 8.58 1st Qu.: 8.656 1st Qu.: 8.595 1st Qu.:1988-07-01 12:00:00
Median :12.20 Median :12.267 Median :12.197 Median :2025-12-31 00:00:00
Mean :12.25 Mean :12.340 Mean :12.255 Mean :2025-12-31 00:00:00
3rd Qu.:16.15 3rd Qu.:16.210 3rd Qu.:16.149 3rd Qu.:2063-07-01 12:00:00
Max. :32.68 Max. :34.491 Max. :33.973 Max. :2100-12-31 00:00:00
```https://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/134Crash with Hysteresis in Cemaneige2023-06-20T15:26:18+02:00Dorchies DavidCrash with Hysteresis in CemaneigeAs reported by @guillaume.thirel, Calibration crashes when using hysteresis in Cemaneige:
```r
OutputsCalib <- suppressWarnings(
+ Calibration(InputsModel, RunOptions, InputsCrit, CalibOptions))
Calibration.GRiwrmInputsModel: Processi...As reported by @guillaume.thirel, Calibration crashes when using hysteresis in Cemaneige:
```r
OutputsCalib <- suppressWarnings(
+ Calibration(InputsModel, RunOptions, InputsCrit, CalibOptions))
Calibration.GRiwrmInputsModel: Processing sub-basin 54057...
Grid-Screening in progress (0%Error in .ArgumentsCheckGR(InputsModel, RunOptions, Param) :
'Param' must be a vector of length 8 and contain no NA
In addition: There were 12 warnings (use warnings() to see them)
```
Reproductible example: [Severn_GR4JCemaNeigeHyst_semiglobal.R](/uploads/b3c3d704e673fee34d0131415404b414/Severn_GR4JCemaNeigeHyst_semiglobal.R)v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/85CreateInputsCrit: wrong id in error message2022-07-18T19:05:13+02:00Dorchies DavidCreateInputsCrit: wrong id in error messageThe id of the downstream station appears in the error message instead of the unknown upstream node id.
Example in vignette "Severn_03", if you swap the nodes `54095` and `54001` as direct injection nodes, the node `54001` is no longer ...The id of the downstream station appears in the error message instead of the unknown upstream node id.
Example in vignette "Severn_03", if you swap the nodes `54095` and `54001` as direct injection nodes, the node `54001` is no longer a node simulated with a GR model and can't be used as a priori id for the node `54032`:
`'Each item of AprioriIds must be an id of a simulated node: the id "54032" is unknown`v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/37CreateInputsModel: Error when using data.frame for Qobs2021-04-28T12:35:37+02:00Dorchies DavidCreateInputsModel: Error when using data.frame for QobsError with Qupstream which should be a matrix...Error with Qupstream which should be a matrix...v0.6.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/124CreateInputsModel: wrong area of sub-basin with upstream Reservoir, Lag or Di...2023-05-11T11:22:10+02:00Dorchies DavidCreateInputsModel: wrong area of sub-basin with upstream Reservoir, Lag or Direct Injection nodesIf a sub-basin has an upstream node with a model running with `area=NA`, then the area of the sub-basin is miscalculated because it doesn't take into account the area of the basins upstream the node with `area=NA`.
Solution: we need to...If a sub-basin has an upstream node with a model running with `area=NA`, then the area of the sub-basin is miscalculated because it doesn't take into account the area of the basins upstream the node with `area=NA`.
Solution: we need to look upstream the node in order to take into account the area of more upstream nodes.v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/117CreateSupervisor: wrong definition of allowed nodes for command2023-03-29T08:29:10+02:00Dorchies DavidCreateSupervisor: wrong definition of allowed nodes for commandThe list of nodes allowed for use as controller actuators or commands (the parameter `U` of `CreateController`), can be wrong if the network contains Diversion nodes.The list of nodes allowed for use as controller actuators or commands (the parameter `U` of `CreateController`), can be wrong if the network contains Diversion nodes.v0.7.0Dorchies DavidDorchies David