Activity
changed milestone to %v1.6.10
added R SUGGESTION To Do labels
added 1 commit
- 3f08d613 - v1.6.9.0 feat(S3): '[' S3 method for InputsModel and OutputsModel classes
added 1 commit
- 05cf434b - v1.6.9.3 refactor: '['.InputsModel and '['.OutputsModel run like a "classical"...
added 1 commit
- eeba0367 - v1.6.9.4 docs(man): add usage of '['.InputsModel and '['.OutputsModel in...
- Resolved by Dorchies David
@david.dorchies, I added
'['.InputsModel()
and'['.OutputsModel()
functions.If the index is a numeric, it returns a subset of the time series. If it is a character (or a factor) it returns the chosen element.
I needed to manage the class inputs of the
SeriesAggreg.list()
, otherwise when the inputs areInputsModel()
orOutputsModel()
objects the specifics[
S3 methods are used instead of a "classical use of[
(see commit 4863f7a6):- set to a "list" at the start
- reset at the end
In addition, I added both usages of
'['.InputsModel()
and'['.OutputsModel()
inCreateInputsModel()
andRunModel()
help pages.Tell me what you think about it!
Examples:
example("RunModel_CemaNeigeGR4J")
On InputsModel object
str(InputsModel[1:9]) # List of 7 # $ DatesR : POSIXlt[1:9], format: "1984-01-01" "1984-01-02" "1984-01-03" "1984-01-04" ... # $ Precip : num [1:9] 7.09 10.47 0 9.48 4.85 ... # $ PotEvap : num [1:9] 0 0 0 0 0 0 0 0 0 # $ LayerPrecip :List of 5 # ..$ L1: num [1:9] 5.66 8.35 0 7.56 3.87 ... # ..$ L2: num [1:9] 6.49 9.59 0 8.68 4.44 ... # ..$ L3: num [1:9] 7.16 10.57 0 9.57 4.9 ... # ..$ L4: num [1:9] 7.76 11.45 0 10.37 5.31 ... # ..$ L5: num [1:9] 8.39 12.39 0 11.21 5.74 ... # $ LayerTempMean :List of 5 # ..$ L1: num [1:9] 0.9262 0.0929 -7.879 -8.3482 -4.6479 ... # ..$ L2: num [1:9] -0.536 -1.37 -9.345 -9.818 -6.121 ... # ..$ L3: num [1:9] -1.56 -2.4 -10.38 -10.85 -7.16 ... # ..$ L4: num [1:9] -2.42 -3.25 -11.23 -11.71 -8.01 ... # ..$ L5: num [1:9] -3.24 -4.08 -12.06 -12.54 -8.85 ... # $ LayerFracSolidPrecip:List of 5 # ..$ L1: num [1:9] 0.518 0.727 1 1 1 ... # ..$ L2: num [1:9] 0.884 1 1 1 1 ... # ..$ L3: num [1:9] 1 1 1 1 1 ... # ..$ L4: num [1:9] 1 1 1 1 1 1 1 1 1 # ..$ L5: num [1:9] 1 1 1 1 1 1 1 1 1 # $ ZLayers : num [1:5] 1052 1389 1626 1822 2013 # - attr(*, "class")= chr [1:4] "InputsModel" "daily" "GR" "CemaNeige"
str(InputsModel[c("Precip", "LayerPrecip")]) # List of 2 # $ Precip : num [1:10593] 7.09 10.47 0 9.48 4.85 ... # $ LayerPrecip:List of 5 # ..$ L1: num [1:10593] 5.66 8.35 0 7.56 3.87 ... # ..$ L2: num [1:10593] 6.49 9.59 0 8.68 4.44 ... # ..$ L3: num [1:10593] 7.16 10.57 0 9.57 4.9 ... # ..$ L4: num [1:10593] 7.76 11.45 0 10.37 5.31 ... # ..$ L5: num [1:10593] 8.39 12.39 0 11.21 5.74 ...
On OutputsModel object
str(OutputsModel[1:9]) # List of 21 # $ DatesR : POSIXlt[1:9], format: "1990-01-01" "1990-01-02" "1990-01-03" "1990-01-04" ... # $ PotEvap : num [1:9] 0 0 0 0 0 0 0 0 0 # $ Precip : num [1:9] 0 1.2 22.85 4.2 5.17 ... # $ Prod : num [1:9] 243 243 243 242 243 ... # $ Pn : num [1:9] 0 0 0 0.045 0.987 ... # $ Ps : num [1:9] 0 0 0 0.0291 0.639 ... # $ AE : num [1:9] 0 0 0 0 0 0 0 0 0 # $ Perc : num [1:9] 0.298 0.297 0.295 0.293 0.295 ... # $ PR : num [1:9] 0.298 0.297 0.295 0.309 0.643 ... # $ Q9 : num [1:9] 0.269 0.267 0.266 0.274 0.479 ... # $ Q1 : num [1:9] 0.03 0.0298 0.0296 0.03 0.0421 ... # $ Rout : num [1:9] 61.3 61.1 60.8 60.5 60.5 ... # $ Exch : num [1:9] 0.188 0.185 0.182 0.179 0.176 ... # $ AExch1 : num [1:9] 0.188 0.185 0.182 0.179 0.176 ... # $ AExch2 : num [1:9] 0.188 0.185 0.182 0.179 0.176 ... # $ AExch : num [1:9] 0.375 0.369 0.363 0.358 0.352 ... # $ QR : num [1:9] 0.754 0.736 0.719 0.704 0.702 ... # $ QD : num [1:9] 0.218 0.214 0.211 0.209 0.218 ... # $ Qsim : num [1:9] 0.971 0.95 0.931 0.913 0.92 ... # $ CemaNeigeLayers:List of 5 # ..$ Layer01:List of 11 # .. ..$ Pliq : num [1:9] 0 0 0 0.225 2.915 ... # .. ..$ Psol : num [1:9] 0 0.957 18.229 3.126 1.209 ... # .. ..$ SnowPack : num [1:9] 232 233 251 254 255 ... # .. ..$ ThermalState: num [1:9] -2.45 -2.66 -2.82 -2.74 -2.57 ... # .. ..$ Gratio : num [1:9] 1 1 1 1 1 1 1 1 1 # .. ..$ PotMelt : num [1:9] 0 0 0 0 0 0 0 0 0 # .. ..$ Melt : num [1:9] 0 0 0 0 0 0 0 0 0 # .. ..$ PliqAndMelt : num [1:9] 0 0 0 0.225 2.915 ... # .. ..$ Temp : num [1:9] -8.546 -8.015 -6.879 -0.732 1.827 ... # .. ..$ Gthreshold : num [1:9] 264 264 264 264 264 ... # .. ..$ Glocalmax : num [1:9] 264 264 264 264 264 ... # ..$ Layer02:List of 11 # .. ..$ Pliq : num [1:9] 0 0 0 0 1.6 ... # .. ..$ Psol : num [1:9] 0 1.1 20.93 3.85 3.13 ... # .. ..$ SnowPack : num [1:9] 379 380 401 405 408 ... # .. ..$ ThermalState: num [1:9] -3.7 -3.92 -4.08 -4.01 -3.85 ... # .. ..$ Gratio : num [1:9] 1 1 1 1 1 1 1 1 1 # .. ..$ PotMelt : num [1:9] 0 0 0 0 0 0 0 0 0 # .. ..$ Melt : num [1:9] 0 0 0 0 0 0 0 0 0 # .. ..$ PliqAndMelt : num [1:9] 0 0 0 0 1.6 ... # .. ..$ Temp : num [1:9] -10.009 -9.478 -8.345 -2.201 0.354 ... # .. ..$ Gthreshold : num [1:9] 264 264 264 264 264 ... # .. ..$ Glocalmax : num [1:9] 264 264 264 264 264 ... # ..$ Layer03:List of 11 # .. ..$ Pliq : num [1:9] 0 0 0 0 0.416 ... # .. ..$ Psol : num [1:9] 0 1.21 23.07 4.24 4.8 ... # .. ..$ SnowPack : num [1:9] 502 503 526 530 535 ... # .. ..$ ThermalState: num [1:9] -4.62 -4.84 -5.02 -4.95 -4.79 ... # .. ..$ Gratio : num [1:9] 1 1 1 1 1 1 1 1 1 # .. ..$ PotMelt : num [1:9] 0 0 0 0 0 0 0 0 0 # .. ..$ Melt : num [1:9] 0 0 0 0 0 0 0 0 0 # .. ..$ PliqAndMelt : num [1:9] 0 0 0 0 0.416 ... # .. ..$ Temp : num [1:9] -11.037 -10.507 -9.376 -3.234 -0.681 ... # .. ..$ Gthreshold : num [1:9] 264 264 264 264 264 ... # .. ..$ Glocalmax : num [1:9] 264 264 264 264 264 ... # ..$ Layer04:List of 11 # .. ..$ Pliq : num [1:9] 0 0 0 0 0 ... # .. ..$ Psol : num [1:9] 0 1.31 25 4.59 5.66 ... # .. ..$ SnowPack : num [1:9] 602 603 628 633 638 ... # .. ..$ ThermalState: num [1:9] -5.39 -5.62 -5.79 -5.73 -5.57 ... # .. ..$ Gratio : num [1:9] 1 1 1 1 1 1 1 1 1 # .. ..$ PotMelt : num [1:9] 0 0 0 0 0 0 0 0 0 # .. ..$ Melt : num [1:9] 0 0 0 0 0 0 0 0 0 # .. ..$ PliqAndMelt : num [1:9] 0 0 0 0 0 ... # .. ..$ Temp : num [1:9] -11.89 -11.36 -10.23 -4.09 -1.54 ... # .. ..$ Gthreshold : num [1:9] 264 264 264 264 264 ... # .. ..$ Glocalmax : num [1:9] 264 264 264 264 264 ... # ..$ Layer05:List of 11 # .. ..$ Pliq : num [1:9] 0 0 0 0 0 ... # .. ..$ Psol : num [1:9] 0 1.42 27.03 4.97 6.12 ... # .. ..$ SnowPack : num [1:9] 698 699 726 731 737 ... # .. ..$ ThermalState: num [1:9] -6.15 -6.38 -6.56 -6.5 -6.34 ... # .. ..$ Gratio : num [1:9] 1 1 1 1 1 1 1 1 1 # .. ..$ PotMelt : num [1:9] 0 0 0 0 0 0 0 0 0 # .. ..$ Melt : num [1:9] 0 0 0 0 0 0 0 0 0 # .. ..$ PliqAndMelt : num [1:9] 0 0 0 0 0 ... # .. ..$ Temp : num [1:9] -12.72 -12.19 -11.06 -4.92 -2.37 ... # .. ..$ Gthreshold : num [1:9] 264 264 264 264 264 ... # .. ..$ Glocalmax : num [1:9] 264 264 264 264 264 ... # $ StateEnd :List of 3 # ..$ Store :List of 4 # .. ..$ Prod: num 113 # .. ..$ Rout: num 42.3 # .. ..$ Exp : num NA # .. ..$ Int : num NA # ..$ UH :List of 2 # .. ..$ UH1: num [1:20] 0.00574 0.0019 0 0 0 ... # .. ..$ UH2: num [1:40] 6.38e-04 4.25e-04 1.53e-05 0.00 0.00 ... # ..$ CemaNeigeLayers:List of 4 # .. ..$ G : num [1:5] 88.7 137.7 175.8 208.7 237.9 # .. ..$ eTG : num [1:5] -3.3 -4.44 -5.3 -6.02 -6.72 # .. ..$ Gthr : num [1:5] 264 264 264 264 264 # .. ..$ Glocmax: num [1:5] 180 264 264 264 264 # ..- attr(*, "class")= chr [1:5] "IniStates" "GR" "CemaNeige" "daily" ... # - attr(*, "class")= chr [1:5] "OutputsModel" "daily" "GR" "CemaNeige" ...
str(OutputsModel[c("Precip", "StateEnd")]) # List of 2 # $ Precip : num [1:3652] 0 1.2 22.85 4.2 5.17 ... # $ StateEnd:List of 3 # ..$ Store :List of 4 # .. ..$ Prod: num 113 # .. ..$ Rout: num 42.3 # .. ..$ Exp : num NA # .. ..$ Int : num NA # ..$ UH :List of 2 # .. ..$ UH1: num [1:20] 0.00574 0.0019 0 0 0 ... # .. ..$ UH2: num [1:40] 6.38e-04 4.25e-04 1.53e-05 0.00 0.00 ... # ..$ CemaNeigeLayers:List of 4 # .. ..$ G : num [1:5] 88.7 137.7 175.8 208.7 237.9 # .. ..$ eTG : num [1:5] -3.3 -4.44 -5.3 -6.02 -6.72 # .. ..$ Gthr : num [1:5] 264 264 264 264 264 # .. ..$ Glocmax: num [1:5] 180 264 264 264 264 # ..- attr(*, "class")= chr [1:5] "IniStates" "GR" "CemaNeige" "daily" ...
Edited by Delaigue Olivier
added 1 commit
- 6f438158 - v1.6.9.5 docs(man): improve explanation about the usage of '['.InputsModel and...
I found issues with SD model:
> example("RunModel_Lag") > str(InputsModel[1:10]) List of 7 $ DatesR : POSIXlt[1:10], format: "1984-01-01" "1984-01-02" "1984-01-03" ... $ Precip : num [1:10] 4.1 15.9 0.8 0 0 0 0 0 2.9 0 $ PotEvap : num [1:10] 0.2 0.2 0.3 0.3 0.1 0.3 0.4 0.4 0.5 0.5 $ Qupstream : num [1:10] -86400 -86400 -86400 -86400 -86400 -86400 -86400 -86400 -86400 -86400 $ LengthHydro : num [1:10] 150 NA NA NA NA NA NA NA NA NA $ BasinAreas : num [1:10] NA 360 NA NA NA NA NA NA NA NA $ OutputsModel:List of 20 ..$ DatesR : POSIXlt[1:10], format: "1990-01-01" "1990-01-02" ... ..$ PotEvap : num [1:10] 0.3 0.4 0.4 0.3 0.1 0.1 0.1 0.2 0.2 0.3 ..$ Precip : num [1:10] 0 9.3 3.2 7.3 0 0 0 0 0.1 0.2 ..$ Prod : num [1:10] 196 199 199 201 200 ... ..$ Pn : num [1:10] 0 8.9 2.8 7 0 0 0 0 0 0 ..$ Ps : num [1:10] 0 3.65 1.12 2.75 0 ... ..$ AE : num [1:10] 0.2833 0.4 0.4 0.3 0.0952 ... ..$ Perc : num [1:10] 0.645 0.696 0.703 0.74 0.725 ... ..$ PR : num [1:10] 0.645 5.946 2.383 4.992 0.725 ... ..$ Q9 : num [1:10] 1.78 1.52 3.86 3.17 3.45 ... ..$ Q1 : num [1:10] 0.2 0.195 0.271 0.387 0.365 ... ..$ Rout : num [1:10] 53.9 53.6 55.3 56.1 56.9 ... ..$ Exch : num [1:10] 0.181 0.18 0.176 0.197 0.207 ... ..$ AExch1 : num [1:10] 0.181 0.18 0.176 0.197 0.207 ... ..$ AExch2 : num [1:10] 0.181 0.18 0.176 0.197 0.207 ... ..$ AExch : num [1:10] 0.362 0.36 0.353 0.393 0.414 ... ..$ QR : num [1:10] 2.05 1.99 2.36 2.55 2.78 ... ..$ QD : num [1:10] 0.381 0.375 0.447 0.584 0.572 ... ..$ Qsim : num [1:10] 2.43 2.37 2.8 3.14 3.35 ... ..$ StateEnd:List of 3 .. ..$ Store :List of 4 .. .. ..$ Prod: num [1:10] 189 NA NA NA NA ... .. .. ..$ Rout: num [1:10] 48.9 NA NA NA NA ... .. .. ..$ Exp : num [1:10] NA NA NA NA NA NA NA NA NA NA .. .. ..$ Int : num [1:10] NA NA NA NA NA NA NA NA NA NA .. ..$ UH :List of 2 .. .. ..$ UH1: num [1:10] 0.514 0.54 0.148 0 0 ... .. .. ..$ UH2: num [1:10] 0.056306 0.057176 0.042254 0.012188 0.000578 ... .. ..$ CemaNeigeLayers:List of 4 .. .. ..$ G : num [1:10] NA NA NA NA NA NA NA NA NA NA .. .. ..$ eTG : num [1:10] NA NA NA NA NA NA NA NA NA NA .. .. ..$ Gthr : num [1:10] NA NA NA NA NA NA NA NA NA NA .. .. ..$ Glocmax: num [1:10] NA NA NA NA NA NA NA NA NA NA .. ..- attr(*, "class")= chr [1:3] "IniStates" "GR" "daily" ..- attr(*, "class")= chr [1:3] "OutputsModel" "daily" "GR" - attr(*, "class")= chr [1:4] "InputsModel" "daily" "GR" "SD"
Than can be solved as follow:
- Add exceptions in
.ExtractInputsModel
for ignoring fields:LengthHydro
andBasinAreas
- Add an exception in
.ExtractInputsModel
for calling.ExtractOutputsModel
on the fieldOutputsModel
Edited by Dorchies David- Add exceptions in
I think that it is ok now.
Fixed bug for
$Qupstream
, which is not more coerced into a vector for a 1-column matrix.I manage the
$StateEnd
element in.ExtractOutputsModel()
as it is done for$ZLayers
in.ExtractOutputsModel()
.@david.dorchies, ok?
> str(InputsModel[1:10]) List of 7 $ DatesR : POSIXlt[1:10], format: "1984-01-01" "1984-01-02" "1984-01-03" "1984-01-04" ... $ Precip : num [1:10] 4.1 15.9 0.8 0 0 0 0 0 2.9 0 $ PotEvap : num [1:10] 0.2 0.2 0.3 0.3 0.1 0.3 0.4 0.4 0.5 0.5 $ Qupstream : num [1:10, 1] -86400 -86400 -86400 -86400 -86400 -86400 -86400 -86400 -86400 -86400 $ LengthHydro : num 150 $ BasinAreas : num [1:2] NA 360 $ OutputsModel:List of 20 ..$ DatesR : POSIXlt[1:10], format: "1990-01-01" "1990-01-02" "1990-01-03" "1990-01-04" ... ..$ PotEvap : num [1:10] 0.3 0.4 0.4 0.3 0.1 0.1 0.1 0.2 0.2 0.3 ..$ Precip : num [1:10] 0 9.3 3.2 7.3 0 0 0 0 0.1 0.2 ..$ Prod : num [1:10] 196 199 199 201 200 ... ..$ Pn : num [1:10] 0 8.9 2.8 7 0 0 0 0 0 0 ..$ Ps : num [1:10] 0 3.65 1.12 2.75 0 ... ..$ AE : num [1:10] 0.2833 0.4 0.4 0.3 0.0952 ... ..$ Perc : num [1:10] 0.645 0.696 0.703 0.74 0.725 ... ..$ PR : num [1:10] 0.645 5.946 2.383 4.992 0.725 ... ..$ Q9 : num [1:10] 1.78 1.52 3.86 3.17 3.45 ... ..$ Q1 : num [1:10] 0.2 0.195 0.271 0.387 0.365 ... ..$ Rout : num [1:10] 53.9 53.6 55.3 56.1 56.9 ... ..$ Exch : num [1:10] 0.181 0.18 0.176 0.197 0.207 ... ..$ AExch1 : num [1:10] 0.181 0.18 0.176 0.197 0.207 ... ..$ AExch2 : num [1:10] 0.181 0.18 0.176 0.197 0.207 ... ..$ AExch : num [1:10] 0.362 0.36 0.353 0.393 0.414 ... ..$ QR : num [1:10] 2.05 1.99 2.36 2.55 2.78 ... ..$ QD : num [1:10] 0.381 0.375 0.447 0.584 0.572 ... ..$ Qsim : num [1:10] 2.43 2.37 2.8 3.14 3.35 ... ..$ StateEnd:List of 3 .. ..$ Store :List of 4 .. .. ..$ Prod: num 189 .. .. ..$ Rout: num 48.9 .. .. ..$ Exp : num NA .. .. ..$ Int : num NA .. ..$ UH :List of 2 .. .. ..$ UH1: num [1:20] 0.514 0.54 0.148 0 0 ... .. .. ..$ UH2: num [1:40] 0.056306 0.057176 0.042254 0.012188 0.000578 ... .. ..$ CemaNeigeLayers:List of 4 .. .. ..$ G : num NA .. .. ..$ eTG : num NA .. .. ..$ Gthr : num NA .. .. ..$ Glocmax: num NA .. ..- attr(*, "class")= chr [1:3] "IniStates" "GR" "daily" ..- attr(*, "class")= chr [1:3] "OutputsModel" "daily" "GR" - attr(*, "class")= chr [1:4] "InputsModel" "daily" "GR" "SD"
added 1 commit
- cb746f9e - v1.6.9.6 refactor: replace lapply by NextMethod to classicaly extract elements...
added 1 commit
- a644ed82 - v1.6.9.7 fix: add an exception in .ExtractInputsModel for calling...
added 1 commit
- d374b49f - v1.6.9.8 fix: add exceptions when .ExtractInputsModel run on SD objects in...
added 1 commit
- b1fcddef - v1.6.9.9 refactor: simplify .ExtractOutputsModel code to manage StateEnd exception
mentioned in commit 4c8bf21b