airGRiwrm issueshttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues2023-02-24T15:40:47+01:00https://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/114Ungauged node: crash on diversion to node outside the sub-network2023-02-24T15:40:47+01:00Dorchies DavidUngauged node: crash on diversion to node outside the sub-networkIn the case of an ungauged node which is also a Diversion to a node located outside the sub-network containing the ungauged nodes and the gauged donor node, the calibration crashes with the following error:
```
Error in InputsModel$Qup...In the case of an ungauged node which is also a Diversion to a node located outside the sub-network containing the ungauged nodes and the gauged donor node, the calibration crashes with the following error:
```
Error in InputsModel$Qupstream[Runoptions$IndPeriod_Run, i] <- OutputsModel[[InputsModel$UpstreamNodes[i]]][[InputsModel$UpstreamVarQ[i]]] :
number of items to replace is not a multiple of replacement length
```
Here below a simple case study that rises this error:
```mermaid
graph LR
id_54032[54032]
id_54001[54001]
id_54095[54095]
id_54095[54095]
id_54001 -->| 45 km| id_54032
id_54095 -->| 42 km| id_54001
id_54095 -->| 100 km| id_54032
class id_54032,id_54001 IntermediateGauged
class id_54095,id_54095 UpstreamUngaugedDiversion
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 2 stroke:#faa, stroke-width:2px,stroke-dasharray: 5 5;
```v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/113Ungauged node: crash with upstream Diversion node2023-02-22T15:28:14+01:00Dorchies DavidUngauged node: crash with upstream Diversion nodeIn case of an existing ungauged node in the model, the calibration process creates a sub-network containing the downstream gauged station, the ungauged stations and the upstream nodes providing the inflows from upstream. As these upstrea...In case of an existing ungauged node in the model, the calibration process creates a sub-network containing the downstream gauged station, the ungauged stations and the upstream nodes providing the inflows from upstream. As these upstream nodes are already calibrated, they just have to provide the flow previously simulated. Therefore, in the sub-network, they act as "Direct Injection" nodes.
The issue arises when one of these upstream nodes has a Diversion, we then get to source of inflows (the flow simulated in the river at the node and the diverted flow) to distribute in the sub-network and the current implementation is not able to distinguish them.v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/110Ungauged node: incorrect definition of donor with Reservoir and bug with Dive...2023-02-08T14:10:33+01:00Dorchies DavidUngauged node: incorrect definition of donor with Reservoir and bug with Diversion nodesBug reported by Florian (https://forgemia.inra.fr/in-wop/seinebasin2/-/issues/40).
In case of a reservoir downstream, this one is selected as donor, which is a wrong selection. The next hydrological node downstream should be selected.
...Bug reported by Florian (https://forgemia.inra.fr/in-wop/seinebasin2/-/issues/40).
In case of a reservoir downstream, this one is selected as donor, which is a wrong selection. The next hydrological node downstream should be selected.
In case of a Diversion node downstream, this is one is correctly selected (A Diversion node contains a hydrological model), but apparently the calibration goes wrong.v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/111Diversion: Remove error "The downstream node of a Diversion node must be diff...2023-02-08T14:10:32+01:00Dorchies DavidDiversion: Remove error "The downstream node of a Diversion node must be different than the downstream node of the node is attached to"I don't know why I've imposed this constraint in the first place.
This kind of network scheme makes sense and can be handled by the model:
```mermaid
graph LR
id_54032[54032]
id_54001[54001]
id_54029[54029]
id_54001[54001]
id_5400...I don't know why I've imposed this constraint in the first place.
This kind of network scheme makes sense and can be handled by the model:
```mermaid
graph LR
id_54032[54032]
id_54001[54001]
id_54029[54029]
id_54001[54001]
id_54001 -->| 45 km| id_54032
id_54029 -->| 32 km| id_54032
id_54001 -->| 60 km| id_54032
class id_54032 IntermediateGauged
class id_54001,id_54001 UpstreamGaugedDiversion
class id_54029 UpstreamUngauged
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 2 stroke:#faa, stroke-width:2px,stroke-dasharray: 5 5;
```v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/109CreateInputsModel: downgrade error on "`Qobs` only for nodes Direct Injection...2023-01-05T10:28:13+01:00Dorchies DavidCreateInputsModel: downgrade error on "`Qobs` only for nodes Direct Injection and Diversion" to warning#99 restricts the use of the `Qobs` in `CreateInputsModel` since the data is not use in other case than "Direct Injection", "Diversion" or "Reservoir" nodes.
This error is blocking for old codes especially first versions of airGRiwrm wh...#99 restricts the use of the `Qobs` in `CreateInputsModel` since the data is not use in other case than "Direct Injection", "Diversion" or "Reservoir" nodes.
This error is blocking for old codes especially first versions of airGRiwrm where the examples populated `Qobs` with observed flows at all nodes.
It's preferable to turn it out into a warning saying that the columns not corresponding to the 3 kind of nodes handling observed flows will be ignored in the process.v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/99CreateInputsmodel [Breaking change]: do not allow to use `Qobs` on nodes othe...2023-01-05T09:33:09+01:00Dorchies DavidCreateInputsmodel [Breaking change]: do not allow to use `Qobs` on nodes other than Direct Injection and DiversionWith the introduction of Diversion nodes (#95) arises the need to clarify the use of the parameter `Qobs` in `CreateInputsModel`.
`Qobs` is only necessary on nodes of type "Direct Injection" and "Diversion" which use a flow time series ...With the introduction of Diversion nodes (#95) arises the need to clarify the use of the parameter `Qobs` in `CreateInputsModel`.
`Qobs` is only necessary on nodes of type "Direct Injection" and "Diversion" which use a flow time series provided by the user. Until now, if the matrix had flows for other type of nodes they were silently ignored.
I propose to raise an error in the case of using Qobs on node other type than the ones which really need it.
A simple warning can eventually be ignored by the user and can lead to errors difficult to debug since this case can come from mismatch column names.v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/90Integration of reservoirs as nodes in the network2022-12-05T09:50:55+01:00Dorchies DavidIntegration of reservoirs as nodes in the networkFollowing #51 which allows to integrate a time series of a released flow in the middle of the network, the idea here is to be able to model the volume of a reservoir in a GRiwrm node with a given release time series. This release time se...Following #51 which allows to integrate a time series of a released flow in the middle of the network, the idea here is to be able to model the volume of a reservoir in a GRiwrm node with a given release time series. This release time series can be provided for the simulation (open-loop / feed-forward control) or calculated by a controller in a supervision (closed-loop / feedback control).
For the moment, the only available way to simulate a reservoir is to handle it manually through a supervisor and at least one controller. With this solution, only the management rules (release) would be handled manually.
## Modelled processes
What about having a dedicated `RunModel` function which would model the following processes:
```mermaid
graph TD
R([fa:fa-water Reservoir])
P(fa:fa-cloud-rain Precip) -- + --> R
U[fa:fa-bacon Qupstream] -- + --> R
R -- - --> E(fa:fa-sun PotEvap)
R -- Release --> D[fa:fa-bacon River downstream]
```
The main process to model is the mass conservation in the reservoir:
```math
V(t) = V(t-\Delta t) + \sum Q_{upstream}(t) - Q_{release}(t) + Q_P(t) - Q_{PE}(t)
```
## Implementation of RunModel_Reservoir
Integration of precipitation and evaporation can be optional if necessary data are not available.
The provided `InputsModel` would contain `Precip` and `PotEvap` and the release would be provided in the argument `Qobs` of `CreateInputsModel.GRiwrm` like for a direct injection node.
`OutputsModel` would contain `Qsim` the release time series and `Vsim` the simulated volume.
V would be a state variable in the model and an initial value must be handled and can be treated like a reservoir state in a GR model (With Vini = 0 by default).
Further variables are necessary to handle this calculation:
1. The relationship between the water area and the volume for the calculation of the volume lost by evaporation
2. The useful capacity of the reservoir (can be the maximum volume in 1. by default)
3. The direct run-off area for the volume gained by precipitation (can be the maximum water area in 1. by default)
The useful capacity could be a parameter of the model which could be calibrated...
In case of overflow of the reservoir, this overflow can be added to the release flow provided by the user. This overflow can also be attenuated in order to simulate the release over a spillway using a [free weir equation](https://cassiopee.g-eau.fr/assets/docs/en/calculators/structures/seuil_denoye.html) and with some assumptions on the water height over the spillway.
## Implementation in the GRiwrm network
An inline reservoir would be integrate as follow in the network:
```mermaid
graph LR
CHAUM_07 --> |0km| PANNEC_R
PANNEC_R --> |153km| GURGY_02
style PANNEC_R fill:#9ed6e3
```
For a reservoir behind a derivation, the situation is more challenging and can be done using a Diversion:
```mermaid
graph LR
BAR-S_06 -->|6km| SEINE_P7
SEINE_P7 -->|32km| SEINE_R8
SEINE_P7 --> SEINE(SEINE)
SEINE--> SEINE_R8
SEINE_R8 -->|41.7km| MERY-_22
style SEINE_P7 fill:#afa, stroke:#faa, stroke-width:3px
style SEINE_R8 fill:#afa
style SEINE fill:#9de
style MERY-_22 fill:#afa
style BAR-S_06 fill:#eef
linkStyle 2 stroke:#faa, stroke-width:2px,stroke-dasharray: 5 5;
```
```mermaid
graph LR
LOUVE_19 -->|0.5km| MARNE_P28
MARNE_P23 -->|3km| STDIZ_04
MARNE_P23 --> M(MARNE)
MARNE_P28 --> M
MARNE_P28 -->|25.6km| MARNE_R25
M --> MARNE_R25
STDIZ_04 -->|28.7km| MARNE_R25
MARNE_R25 -->|56.9km| CHALO_21
style MARNE_P28 fill:#afa, stroke:#faa, stroke-width:3px
style MARNE_P23 fill:#eef, stroke:#faa, stroke-width:3px
style MARNE_R25 fill:#afa
style STDIZ_04 fill:#afa
style CHALO_21 fill:#afa
style M fill:#9de
linkStyle 2 stroke:#faa, stroke-width:2px,stroke-dasharray: 5 5;
linkStyle 3 stroke:#faa, stroke-width:2px,stroke-dasharray: 5 5;
```v0.7.0https://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/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/106RunModel.Supervisor doesn't work with Diversion node2022-11-20T17:18:46+01:00Dorchies DavidRunModel.Supervisor doesn't work with Diversion nodeThe commit db64753b6403fcf04d38fcd3bd2c04b8aee53fe4 which solves an issue with the color of ungauged stations on diverted nodes and refactors the function `getNodeProperties` has caused a regression on vignette V06.
Simulation with RunM...The commit db64753b6403fcf04d38fcd3bd2c04b8aee53fe4 which solves an issue with the color of ungauged stations on diverted nodes and refactors the function `getNodeProperties` has caused a regression on vignette V06.
Simulation with RunModel.Supervisor containing a Diversion node produces `NA` values after few time steps.v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/95Implementation of "Diversion" node2022-11-01T12:57:13+01:00Dorchies DavidImplementation of "Diversion" node# Study cases
There are several cases where flow can be diverted from the river to artificial infrastructure, other catchment, or another part of the catchment. Here's below a minimal example:
```mermaid
graph LR
idUp[Upstream node]
id...# Study cases
There are several cases where flow can be diverted from the river to artificial infrastructure, other catchment, or another part of the catchment. Here's below a minimal example:
```mermaid
graph LR
idUp[Upstream node]
idA(Diversion)
idDn[Downstream node]
idR[Reservoir, canal or river branch]
subgraph Node with GR model + Diversion
idUp -->| 0 km| idA
end
idA -->| x km| idDn
idA -->| y km| idR
idR -->| z km| idDn
classDef UpGau fill:#aaf
classDef IntGau fill:#afa
classDef IntUng fill:#efe
classDef DirInj fill:#faa
class idDn IntGau
class idR IntUng
class idA DirInj
class idUp UpGau
```
The "Diversion" node acts as a direct injection node that withdraws flow from the upstream node and transfers this flow to the "reservoir/canal/river branch" node.
This minimal example can be extended at upstream, downstream or can have several additional branches and intermediate nodes.
The diverted flow should have some limitation, first of all because the flow downstream the diversion (remaining flow in the river) can't be negative and, eventually, can't legally be under an instream flow or minimum ecological flow.
# Proposition of implementation
## The challenge is: how to integrate this flow diversion in the current `GRiwrm` object?
I propose the following trick: the "diversion" node is a post-process of the "Upstream node" and so it has the same `id` but with a `Diversion` model and a `down` id equal to the "reservoir/canal/river branch" node.
| id | down | length | model | area |
|-----------|-----------|--------|------------------------------------------------|------------|
| Up | Down | x | `RunModel_xxxx` | aUp |
| Up | Reservoir | y | `Diversion` | NA |
| Reservoir | Down | z | `Reservoir`, `RunModel_Lag` or `RunModel_GRxx` | aReservoir |
| Down | NA | NA | `RunModel_GRxx` | aDown |
# Modification and add-on to the GRiwrmInputsModel object
The diverted flow needs to be filled in the model inputs. I propose to use the existing `Qobs` parameter as for direct injection nodes. As for direct injection nodes, the sign of this column determines the direction of the flow (if negative, abstraction of the flow; if positive, release of the flow taken from the downstream node of the `Diversion` node).
An additional `Qmin` for the minimal flow to be left in the river at the diversion node. `Qmin` can be a matrix with named columns (with the `id` of the diversion node) and one row by time step to take into account variation of the instream flow during time. By default `Qmin` equals zero for avoiding negative flow downstream the diversion.
## Calculation process
The calculation can follow the following process:
- Calculation of the flow `Qsim` in the upstream node with `RunModel_GRxx`
- Copy of `Qsim` in a `Qnat` variable (the "natural" flow before human influence at this location)
- Limitation of the diverted flow by instream flow `Qabs <- min(-Qdiv, Qnat - Qmin)`
- Subtraction of the diversion from the "natural" flow: `Qsim <- Qnat + Qdiv` (abstracted flow means negative value for `Qdiv`)
In a nutshell, the `OutputsModel` object produces the variables:
- `Qnat`: flow before diversion (output of the GR model)
- `Qdiv`: the modified diverted flow after limitation which is transferred to the downstream node specified by the `Diversion` model
- `Qsim`: the modelled flow which is transferred to the downstream node specified by the `RunModel_xxxx` line in the `GRiwrm` object
# Overview of existing models and specifications
| Node type | Available models | Inputs | Parameters |
|------------------|------------------|-------------------------------------------------|------------------------------|
| Hydrological | airGR GR models | `P`, `T`, `PE` | GR and SD routing parameters |
| Routing | `RunModel_Lag` | None | SD routing parameters |
| Direct injection | `NA` | `Qobs` (<0 for abstraction, >0 for release) | None |
| _Reservoir_ | `Reservoir` | `Qobs` (only >0 for release) | None |
| Diversion | `Diversion` | `Qobs` (diverted flow), `Qmin` (instream flow) | None |
Tasks:
- [x] Modify `CreateGRiwrm` for handling `Diversion` node type
- [x] Modify `plot.GRiwrm` for plotting the network scheme with diversion nodes
- [x] Modify `CreateInputsModel.GRiwrm` to add a tag `Diversion` on `InputsModel` object
- [x] Modify `RunModel.InputsModel` to post-process `airGR::RunModel` with diversion tasks
- [x] Modify `UpdateQsimUpstream` to brings `-Qdiv` upstream of the node collecting the diverted flows
- [x] Write an example in `RunModel.GRiwrmInputsModel`
- [x] Modify `RunModel.Supervision` to integrate diversion tasks in the model
- [x] Write a vignette illustrating `RunModel.Supervision` with a Diversion node
- [x] Modify `Calibration.GRiwrmInputsModel` to integrate diversion tasksv0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/100Improve Supervisor documentation2022-10-31T08:06:58+01:00Dorchies DavidImprove Supervisor documentationAdd a complete original example for the documentation of the Supervisor suite (`CreateSupervisor`, `CreateController`, `RunModelSupervisor`)Add a complete original example for the documentation of the Supervisor suite (`CreateSupervisor`, `CreateController`, `RunModelSupervisor`)v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/104`plot.Qm3s` is not available as a function2022-10-27T11:19:52+02:00Dorchies David`plot.Qm3s` is not available as a functionThe method `plot` for the class "Qm3s" is useful for plotting flow rate time series outside of the result of the simulated flows provided by `attr(GRiwrmOutputsModel, "Qm3s")`.
Currently the call of `plot.Qm3s` raises an error : `Error ...The method `plot` for the class "Qm3s" is useful for plotting flow rate time series outside of the result of the simulated flows provided by `attr(GRiwrmOutputsModel, "Qm3s")`.
Currently the call of `plot.Qm3s` raises an error : `Error in plot.Qm3s(dfQdiv) : could not find function "plot.Qm3s"`
Tasks:
- add checks
- complete the doc
- modify exported object in NAMESPACE (https://stackoverflow.com/questions/18512528/how-to-export-s3-method-so-it-is-available-in-namespace)v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/101CreateSupervisor [Breaking change]: Only allow to apply a command on DirectIn...2022-10-27T11:19:51+02:00Dorchies DavidCreateSupervisor [Breaking change]: Only allow to apply a command on DirectInjection and Diversion nodesThe issue #95 introduces "Diversion" nodes which are declared in the **_GRiwrm_** object by duplicating the line of the node containing the diversion.
Current version of `RunModel.Supervisor` allows to modify the flow (modelled or input...The issue #95 introduces "Diversion" nodes which are declared in the **_GRiwrm_** object by duplicating the line of the node containing the diversion.
Current version of `RunModel.Supervisor` allows to modify the flow (modelled or input) on any node in the network and the nodes are declared by their id. On nodes containing a "Diversion", 3 flows are available: the "natural" flow before the diversion, the diverted flow, and the flow remaining in the river after the diversion. In this situation, which flow is supposed to be modified?
Allowing to apply a modification of the flow on any node including the one with flows simulated by hydrological models doesn't make a real sense since regulation and control is supposed to be applied on human infrastructure which are represented by "DirectInjection" and "Diversion" nodes. Moreover, this way of view is consistant with the content of the `Qobs` variable in `CreateIntputsModel`: the flow directly injected in the model for the "DirectInjection" nodes and the diverted flow for the "Diversion" nodes.
On that basis, I propose to limit the application of Supervision commands "U" only on these 2 types of nodes which give us the advantage that we can continue to use the id of the node to defined where is the flow modified by the command because there can't have any confusion on which flow is modified (injected flow or diverted flow depending on the node type).v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/102Add checks on Supervisor functions2022-10-27T11:19:49+02:00Dorchies DavidAdd checks on Supervisor functionsAdd the following checks:
- [ ] check Supervisor class in `CreateController` and `RunModel.Supervisor`
- [ ] check RunOptions class in `RunModel.Supervisor`
- [ ] raise error if TimeStep parameter of CreateSupervisor is not positive
- [...Add the following checks:
- [ ] check Supervisor class in `CreateController` and `RunModel.Supervisor`
- [ ] check RunOptions class in `RunModel.Supervisor`
- [ ] raise error if TimeStep parameter of CreateSupervisor is not positive
- [ ] raise an error of the location of a U is not related to a DirectInjection or a Diversion node (cf. #101)
- [ ] raise error if a location of a Y is not a node id
- [ ] raise an error if the output of the logic control function does not fit with the number of time steps (rows) and the number of Us (columns)v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/88Regularisation: taking into account X4 transformation2022-10-22T11:39:05+02:00Dorchies DavidRegularisation: taking into account X4 transformationThe parameter X4 depends on the area of the sub-basin, so it should be transformed when it is used as "a priori" parameter for another basin in the regularisation process.The parameter X4 depends on the area of the sub-basin, so it should be transformed when it is used as "a priori" parameter for another basin in the regularisation process.v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/94RunModel.Supervision: handle NA values on injected flows2022-08-31T11:32:58+02:00Dorchies DavidRunModel.Supervision: handle NA values on injected flowsAs noticed by Myriam Soutif-Bellenger, in case of NAs in flows provided on direct flow nodes, these ones are converted to zeros, leading to unexpected results on simulated flow downstream.
The change to zero flow in case of NAs is opera...As noticed by Myriam Soutif-Bellenger, in case of NAs in flows provided on direct flow nodes, these ones are converted to zeros, leading to unexpected results on simulated flow downstream.
The change to zero flow in case of NAs is operated here: https://gitlab.irstea.fr/in-wop/airGRiwrm/-/blob/dev/R/utils.R#L168v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/93Regularisation: check if current node and a priori node use the same model2022-08-29T16:35:57+02:00Dorchies DavidRegularisation: check if current node and a priori node use the same modelActually this check is not applied and can lead to unexpected behaviours.
Throw a fatal error if models are different.
Same model means exactly the same model: e.g. RunModel_GR4J and RunModel_CemaneigeGR4J are different models and rais...Actually this check is not applied and can lead to unexpected behaviours.
Throw a fatal error if models are different.
Same model means exactly the same model: e.g. RunModel_GR4J and RunModel_CemaneigeGR4J are different models and raises an error.v0.7.0Dorchies DavidDorchies Davidhttps://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/42Feature request: use of non gauged stations in the network2022-08-14T12:10:02+02:00Dorchies DavidFeature request: use of non gauged stations in the networkThe idea is to be able to integrate GR models in the network with parameters dependant of neighbour sub-basins.
Ungauged stations
Todo:
- [x] Add SubGraph containing ungauged stations in `plot.GRiwrm`
- [x] Adapt `CreateInputsModel....The idea is to be able to integrate GR models in the network with parameters dependant of neighbour sub-basins.
Ungauged stations
Todo:
- [x] Add SubGraph containing ungauged stations in `plot.GRiwrm`
- [x] Adapt `CreateInputsModel.GRiwrm` for handling ungauged nodes
- [x] Create a function that creates a `RunModel` function including the modelling of ungauged nodes for run in `Calibration`
- [x] Modify Calibration.GRiwrmInputsModel for calibrate the model above and set the calibration parameters for each sub-basinv0.7.0https://gitlab.irstea.fr/in-wop/airGRiwrm/-/issues/51Handle simple in-line reservoir inside the model2022-08-10T17:51:29+02:00Dorchies DavidHandle simple in-line reservoir inside the modelUntil now, reservoirs are handle through direct injections and only upstream nodes can be direct injections.
As a result, catchment with online dams like the Pannecière Lake are currently complicated to integrate in the GRiwrm structure...Until now, reservoirs are handle through direct injections and only upstream nodes can be direct injections.
As a result, catchment with online dams like the Pannecière Lake are currently complicated to integrate in the GRiwrm structure.
Here's below the situation of the Pannecière Lake:
```mermaid
graph LR
P(PANNECIERE)
CHAUM_07 -->|0km| P
P --> |153km| GURGY_02
style P fill:#99f
```
And it's representation in airGRiwrm:
```mermaid
graph LR
CHAUM_07 --> |153km| GURGY_02
PANNEC_P --> |153km| GURGY_02
PANNEC_R --> |153km| GURGY_02
style PANNEC_P fill:#fcc
style PANNEC_R fill:#fcc
```
Because of the unicity of the network, we have to first manually simulate the upstream basin, copy it's value multiplied by -1 into the intake of the lake (`PANNEC_P`) in order to annihilate the upstream influence and only routing the release of the lake (`PANNEC_R`) downstream.
A solution could be to keep the first scheme above and use a "direct injection" node which will simply returning the flow provided in `Qobs` for the node corresponding to the dam.
```mermaid
graph LR
CHAUM_07 --> |0km| PANNEC_R
PANNEC_R --> |153km| GURGY_02
style PANNEC_R fill:#fcc
```
With this simple solution, we can remove simply the preliminary simulation of the upstream part of the dam and the complex step of substracting all of upstream contribution.v0.7.0Dorchies DavidDorchies David