diff --git a/DESCRIPTION b/DESCRIPTION index dc181d42638192dd77dc90767b99eed23fcbd08a..50859b00b83ef31396ae8eeecfdda7315ac4e3b0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: airGR Type: Package Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling -Version: 1.0.9.21 -Date: 2017-08-16 +Version: 1.0.9.22 +Date: 2017-08-18 Authors@R: c( person("Laurent", "Coron", role = c("aut", "trl")), person("Charles", "Perrin", role = c("aut", "ths")), diff --git a/NEWS.rmd b/NEWS.rmd new file mode 100644 index 0000000000000000000000000000000000000000..9886c26da0e0f45a6c00952d93fa8ba9b1b703e5 --- /dev/null +++ b/NEWS.rmd @@ -0,0 +1,460 @@ +--- +title: "Release History of the airGR Package" +output: + html_document: + keep_md: true +--- + + + + +### 1.0.9.22 Release Notes (2017-08-18) + +#### New features + +- An article describing the airGR package has been published. Its reference has been added and will be displayed with <code>citation("airGR")</code>. + +- Added <code>CreateIniStates()</code> function in order to help user to format <code>IniStates</code> argument for <code>CreateRunOptions()</code>. + +- Added (<code>Param_Sets_GR4J</code>) dataset. It contains the generalist parameter sets for the GR4J model. + + +#### Bug fixes + +- Fixed bug in <code>RunModel_GR4H()</code>: in <code>frun_GR4H</code> fortran subroutine, <code>St(2)</code> is now set to 0 (and not <code>St(1)</code>) when <code>St(2) < 0</code>. + +- Fixed bug in <code>plot.OutputsModel()</code> for the regime plot when the period is less than 1 year. + +- Fixed bug in <code>plot.OutputsModel()</code> when there is no common data to plot the cumulative frequency or the correlation QQ. + +- Fixed bug in <code>plot.OutputsModel()</code> for y-axis labelling of flows time series when <code>log_scale = TRUE</code> and <code>BasinArea</code> used. + + +#### Deprectated and defunct + +- The <code>RunSnowModule</code> argument is now deprecated in <code>CreateRunOptions()</code>. + + +#### Major user-visible changes + +- <code>RunModel_GR4J()</code>, <code>RunModel_GR5J()</code> and <code>RunModel_GR6J()</code> (and <code>CemaNeige_GR*J()</code>) now return Ps, Pn and true exchanges. + +- <code>CreateInputsModel()</code> now returns an error when <code>DatesR</code> contains duplicated values. + +- <code>RunModel_GR5J</code> now returns <code>StateEnd</code> in the same order as the other models. + + +#### Minor user-visible changes + +- <code>plot.OutputsModel()</code> now returns a warning message when the length of Qobs is different from the length of Qsim. + +- The X1, X3 (and X6) parameters from GR4H, GR4J, GR2M, GR5J (and GR6J) are now set to 1e-2 when they are fixed to lower values. <code>RunModel*()</code> functions now return a warning message. <code>RunModel*()</code> functions now return a warning when X4 < 0.5 and set it to 0.5. + +- The commands <code>?L0123001</code>, <code>?L0123002</code> and <code>?L0123003</code> now return the documentation page related to <code>BasinObs</code>. + +- Many functions of the package were cleant or slightly modified, with no effect on their outputs. + +- The documentation and help of several functions were improved. + + +#### CRAN-comparibility updates + +- "airGR.c" file registers native routines. + +____________________________________________________________________________________ + + +### 1.0.5.12 Release Notes (2017-01-23) + + +#### New features + +- <code>DataAltiExtrapolation_Valery()</code> and <code>CreateInputsModel()</code> now present a PrecipScale argument which allows rescaling precipitation when it is interpolated on the elevation layers when CemaNeige is used. + + +#### Bug fixes + +- Fixed bug in <code>DataAltiExtrapolation_Valery()</code>. The elevation gradients for air temperature returned by <code>CreateInputsModel()</code> are improved. + + +#### User-visible changes + +- <code>DataAltiExtrapolation_Valery()</code> has been improved. <code>DataAltiExtrapolation_Valery()</code> now runs faster (and by consequence <code>CreateInputsModel()</code> too, when CemaNeige is used). + +____________________________________________________________________________________ + + +### 1.0.4 Release Notes (2017-01-18) + +#### New features + +- <code>RunModel_CemaNeige()</code>, <code>RunModel_CemaNeigeGR4J()</code>, <code>RunModel_CemaNeigeGR5J()</code> and <code>RunModel_CemaNeigeGR6J()</code> now return air temperature for each elevation layer. + + +#### Deprectated and defunct + +- S3 plot method defined for <code>OutputsModel</code> objects. It means that the <code>plot_OutputsModel()</code> function is deprecated and his use has been replaced by the use of <code>plot.OutputsModel()</code> or <code>plot()</code>. + +- In <code>plot.OutputsModel()</code> the <code>PlotChoice</code> argument is deprecated and has been renamed <code>which</code>. + + +#### User-visible changes + +- <code>plot.OutputsModel()</code> displays air temperature time series for each layer when <code>CemaNeige</code> is used (argument <code>which = "Temp"</code> or <code>"all"</code>). + +____________________________________________________________________________________ + + +### 1.0.3 Release Notes (2016-12-09) + +#### New features + +- <code>ErrorCrit*()</code> functions gain a warnings argument to replace the verbose action and the verbose argument now prints the criterion value(s). + + +#### Bug fixes + +- Fixed bug in <code>CreateCalibOptions()</code> when <code>StartParamList</code> or <code>StartParamDistrib</code> arguments are used. + + +#### User-visible changes + +- <code>CreateInputsModel()</code> now returns an error if <code>NLayers <= 0</code> when <code>CemaNeige</code> is used. + +- <code>plot_OutputsModel()</code> now displays raw values on the y-axis when the discharge time series is represented with log scale (formerly, log values of discharges were displayed on the y-axis). + + +____________________________________________________________________________________ + + +### 1.0.2 Release Notes (2016-11-03) + + +#### New features + +- <code>SeriesAggreg()</code> gains a TimeLag argument that corresponds to a numeric value indicating a time lag (in seconds) for the time series aggregation (useful to aggregate hourly time series to the daily time step for instance). + In addition, the function now accepts input dates in both POSIXt formats (POSIXct and POSIXlt). The output is in POSIXct format. + +- <code>plot_OutputsModel()</code> gains a <code>log_scale</code> argument in order to plot the flow with a log scale. + +- A tutorial is available online on the following link: from http://webgr.irstea.fr/airGR. + It can also be displayed with the <code>vignette("airGR")</code> command + + +#### Bug fixes + +- The value <code>sort</code> for the <code>transfo</code> argument of <code>CreateInputsCrit()</code> was not taken into account. It is now fixed. + + +#### Deprectated and defunct + +- <code>CreateCalibOptions()</code> loses the OptimParam argument that was redundant with the <code>FixedParam</code> argument. The <code>Calibration_Michel()</code> was modified to take into account this change by using directly <code>FixedParam</code>, but this is transparent to the user. + +- <code>CreateCalibOptions()</code> loses the StartParam argument that was not used. + + +#### Major user-visible changes + +- The <code>RunModel_GR6J()</code> and <code>RunModel_CemaNeigeGR6J()</code> models were modified back to versions previous to 1.0.1 to prevent from unwanted efficiency criteria deterioration related to the calibration with <code>Calibration_Michel()</code>. + The actual model codes were not modified but the <code>TransfoParam_GR6J()</code> and <code>CreateCalibOptions()</code> functions were modified regarding the X5 parameter. + It is strongly advised to use airGR 1.0.2 for the <code>RunModel_GR6J()</code> and <code>RunModel_CemaNeigeGR6J()</code> functions if you are using <code>Calibration_Michel()</code>, as they are much more efficient. + In case you were using your own calibration algorithm, you will not notice any difference. + + +#### Minor user-visible changes + +- <code>CreateInputsModel()</code> and <code>DataAltiExtrapolation_Valery()</code> functions now allow both POSIXt formats (POSIXct and POSIXlt). + + +____________________________________________________________________________________ + + +### 1.0.1 Release Notes (2016-04-21) + +#### Deprectated and defunct + +- The <code>Calibration_HBAN()</code> and <code>DataAltiExtrapolation_HBAN()</code> functions have respectively been renamed as <code>Calibration_Michel()</code> and <code>DataAltiExtrapolation_Valery()</code> after the names of their creators. + +- The <code>Calibration_optim()</code> function has been removed from the package. + +- The silent mode is now defined by the <code>verbose = TRUE</code> argument (formerly <code>quiet = FALSE</code>) in the following functions : +<code>Calibration()</code>, <code>Calibration_Michel()</code>, <code>CreateInputsModel()</code>, <code>CreateRunOptions()</code>, <code>DataAltiExtrapolation_Valery()</code>, <code>ErrorCrit()</code>, <code>ErrorCrit_KGE()</code>, <code>ErrorCrit_KGE2()</code>, <code>ErrorCrit_NSE()</code>, <code>ErrorCrit_RMSE()</code>, <code>plot_OutputsModel()</code>, <code>SeriesAggreg()</code>. + + +#### Major user-visible changes +- The GR5J model has been modified: previously, two unit hydrographs were used, now only one is remaining. + As a consequence, simulations from the GR5J (<code>RunModel_GR5J()</code> function) and CemaNeige (<code>RunModel_CemaNeigeGR5J()</code> function) models will be different. + +- An important proportion of the transformations of the parameters have been modified (<code>TransfoParam*()</code> functions). Since this modifies the local search, calibration results will be different . + +- The quantiles of the parameters have been recalculated with the new transformations (<code>CreateCalibOptions()</code> function). Since these quantiles constitute the starting point of the calibration algorithm, calibration results will be different. + + +#### Minor user-visible changes + +- The FORTRAN model core codes have been modified: + - optimisation of the codes for fastening of computation; + - simplification of the internal variables for easier reading and understanding. + +- The list of the contributors and authors is now full. + +- The references of the package has been updated; they are returned by the following R-command <code>citation("airGR")</code>. + +____________________________________________________________________________________ + + +### 0.8.1.2 Release Notes (2015-08-21) + +#### Bug fixes + +- Bug fxed in <code>CreateInputsModel()</code> related to the handling of missing values. + +- Bug fxed in <code>CreateRunOptions()</code> preventing the correct use of the <code>IniResLevels</code> argument (to manually set the filling rate of the production and routing stores). + + +#### Minor user-visible changes + +- Removal of an unnecessary warning when <code>IndPeriod_WarmUp = 0</code>. + + +#### CRAN-comparibility updates + +- Modification of namespace file to ensure proper use under linux whithout compilation issues. + + +____________________________________________________________________________________ + + +### 0.8.0.2 Release Notes (2015-04-15) + + +#### New features + +- Three new hydrological models: <code>RunModel_GR4H() function for </code> GR4H (hourly), <code>RunModel_GR2M()</code> function for GR2M (monthly) and <code>RunModel_GR1A()</code> function for GR1A (yearly). + +- New function <code>SeriesAggreg()</code> to easily aggreg timesteps. + + +#### Bug fixes + +- Fixed bug in <code>ErrorCrit_RMSE()</code> which led to incorrect calibration (the criterion was maximised instead of minimised). + + +#### Major user-visible changes + +- Update of the functions <code>CreateRunOptions()</code>, <code>CreateCalibOptions()</code> and <code>plot_OutputsModel()</code> to handle the new models. + +- Modification of CemaNeige FORTRAN code to add an update of Gratio after the SnowPack update (no impact on snow simulation). + + +#### Minor user-visible changes + +- Improvement of the <code>plot_OutputsModel()</code> function to allow a selection among available plots. + +- Minor update in <code>ErrorCrit_KGE()</code> and <code>ErrorCrit_KGE2()</code> to handle case when only one values in not NA. + +- Update of the scripts in airGR-advanced-example to match the structures of the <code>BasinData</code> objects. + +- Correction of formatting issue in airGR-advanced-example regarding the "List_HypsoData.txt" file. + + +____________________________________________________________________________________ + + +### 0.7.4 Release Notes (2014-11-01) + +#### User-visible changes + +- Stable version stemming from version 0.7.3. + +____________________________________________________________________________________ + + +### 0.7.3 Release Notes (2014-XX-XX) + +#### Minor user-visible changes + +- Improvements allowing the arrival of new models. + +- Improvements of the argument verifications in <code>CreateInputsModel()</code>, <code>CreateRunOptions()</code>, <code>CreateInputsCrit()</code>, <code>CreateCalibOptions()</code>. + +- Improvements of all the <code>ErrorCrit()</code> functions to better account for the cases with constant flow values or local zeros. + +____________________________________________________________________________________ + + +### 0.7.2 Release Notes (2014-07-14) + +#### New features + +- New argument in many functions (<code>quiet = TRUE</code> or <code>FALSE</code>) to choose if the warnings should be suppressed or not. + + +#### Bug fixes + +- Fixed bug in <code>CreateCalibOptions()</code> to handle models with only one parameter. + + +#### Major user-visible changes + +- CemaNeige users must now specify one <code>MeanAnSolidPrecip</code> for each elevation layer. The <code>CreateRunOptions()</code> function is impacted. + +- CemaNeige users can now specify the mean elevation of the input series (before it was always considered equal to the catchment median elevation). + The impacted functions are <code>CreateInputsModel()</code> and <code>DataAltiExtrapolation_HBAN()</code>. + + +#### Minor user-visible changes + +- Improvement of the <code>plot_OutputsModel</code> function (to handle 0 in Qobs and Qsim). + +- Improved documentation. + +____________________________________________________________________________________ + + +### 0.7.1 Release Notes (2014-07-14) + +#### Bug fixes + +- Fixed bug in <code>Calibration_HBAN()</code>. The function was not working properly with models having only one parameter. + + +#### Deprectated and defunct + +- The <code>CalibrationAlgo_*()</code> functions were renamed into<code>Calibration_*()</code>. + + +#### Major user-visible changes + +- New architecture with better format verification procedure (using classes) and simpler setting of default configuration. + +- New architecture where the model, calibration and error functions are in the arguments of the functions + (the exotic use of "generic function" created by the users has been removed). + +- Improved documentation and examples. + + + +____________________________________________________________________________________ + + +### 0.7.0 Release Notes (2014-06-06) + +#### Experimental features + +- unfinished version used for development purpose. + +____________________________________________________________________________________ + + +### 0.6.2 Release Notes (2014-02-12) + +#### Bug fixes + +- RC11 bug correction: the automatic selection of the warm-up period was not working properly when no data was available from warm-up (i.e. when the user had set the run to start at the very first index). + +- RC10 bug correction: the <code>CalibrationAlgo_HBAN()</code> function was not working in the very rare case when the diagonal search was activated and lead to a set outside the authorised range. + +- RC9 bug correction: the <code>CalibrationAlgo_HBAN()</code> function was not working properly with models having only one parameter. + +- RC8 bug correction of the <code>ModelDefaultIniOptions()</code> function (this bug was introduced in the RC7 and caused an error when <code>IndPeriod_WarmUp = NULL</code> + +- RC7 bug correction of the <code>ModelDefaultIniOptions()</code> function (the automatic selection of one year for warm-up was not handling properly missing data). + +- RC6 correction of the help files (the description of CemaNeige parameters were inverted). + +- RC5 differs from previous releases in the way the data are read and stored (in a list instead of individual vectors). + The package is similar, only the examples of Main and the files in MyScriptBlocks have changed. + All basin data are now stored inside a list named <code>BasinData</code>. This will greatly ease the future use of Rdata files (instead of txt files) as storage format for the time series of observation. + +____________________________________________________________________________________ + + +### 0.6.1 Release Notes (2014-02-12) + + +#### New features + +- Additional functions for results plotting (the <code>{zoo}</code> package is required for some of them). + +- Add multi-objective calibration using <code>nsga2()</code> (the <code>{mco}</code> package is required). + +#### Major user-visible changes + +- The definition of the generic function is now made in a much simpler way (e.g. see <code>DefineFunctions_Model()</code> or <code>DefineFunctions_ErrorCrit()</code>). + + +#### Minor user-visible changes + +- Code improvements to reduce the computation time. + +- Clearer instructions for the adding and modification of a model. + +- Improvements of the documentation. + +____________________________________________________________________________________ + + +### 0.6.0 Release Notes (2014-02-12) + +#### New features + +- The field Multiplier has been added in the ErrorCrit() outputs, to indicate whether the criterion is an error (to minimise) or and efficiency (to maximise). + This allows to provide real efficiency values in the outputs e.g. NSE[Q] instead of (-1) × NSE[Q]. + + +#### Deprectated and defunct + +- <code>EfficiencyCrit()</code> have been replaced by <code>ErrorCrit()</code> to avoid misunderstanding (by default, the algorithms minimise the error criterion). + +____________________________________________________________________________________ + + +### 0.5.2 Release Notes (2014-02-05) + + +#### Deprectated and defunct + +- The <code>SelectPer</code> arguments are replaced by <code>IndPeriod</code> to ease understanding. + +- The <code>PE</code> arguments are replaced by <code>PotEvap()</code> to ease understanding. + +- The <code>Fsol</code> arguments are replaced by <code>FracSolidPrecip</code> to ease understanding. + + +#### Major user-visible changes + +- R 2.15 in not supported by default. + +- The check that <code>SelectPer_Run()</code> is continuous is now made in the <code>CheckArg()</code> functions. + +- Check of the model functioning time step. + +- Name of the calibration criterion provided in <code>OutputsAlgo()</code>. + + +#### Minor user-visible changes + +- Missing values in FORTRAN are now -999.999 instead of -9.999. + + +____________________________________________________________________________________ + + +### 0.5.1 Release Notes (2014-01-27) + + +#### New features + +- New <code>EfficiencyCrit_NSE_sqrtQ()</code> function to compute NSE criterion on sqrt flows + + +#### Bug fixes + +- Incorrect arguments in the call to <code>RunModelAndCrit</code> from <code>CalibrationAlgo_optim_stats</code> and <code>CalibrationAlgo_nlminb_stats</code>. + +- <code>CalibrationAlgo_nlminb_stats</code> argument was wrongly defined in <code>DefineFunctions_CalibrationAlgo()</code> (<code>optim</code> instead of <code>nlminb</code>). + +- Format checking for <code>RunOptions</code> was incorrectly made in <code>CheckArg()</code> function. + + diff --git a/R/CreateInputsModel.R b/R/CreateInputsModel.R index 640c30e112eceb1c84b05527e969ea80d389ce15..df46eb0184fdd73956215d945e646224987408b2 100644 --- a/R/CreateInputsModel.R +++ b/R/CreateInputsModel.R @@ -79,7 +79,7 @@ CreateInputsModel <- function(FUN_MOD, stop(paste( "the time step of the model inputs must be ", TimeStep, " seconds \n", sep = "")) return(NULL) } - if (anyDuplicated(DatesR) != 0) { + if (any(duplicated(DatesR))) { stop("DatesR must not include duplicated values \n") return(NULL) }