diff --git a/DESCRIPTION b/DESCRIPTION index b508b2550c27c3b2bc165e7bbefbab9c16a66e3e..e0860fc81d7ec320a1e6983937aea9762bd9dc74 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: airGRteaching Type: Package Title: Teaching Hydrological Modelling with the GR Rainfall-Runoff Models ('Shiny' Interface Included) -Version: 0.2.10.59 -Date: 2020-10-15 +Version: 0.2.10.60 +Date: 2020-10-20 Authors@R: c( person("Olivier", "Delaigue", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-7668-8468"), email = "airGR@inrae.fr"), person("Laurent", "Coron", role = c("aut"), comment = c(ORCID = "0000-0002-1503-6204")), @@ -11,7 +11,7 @@ Authors@R: c( ) Depends: airGR (>= 1.4.3.87) Imports: dygraphs (>= 1.1.1.6), markdown, plotrix, shiny (>= 1.1.0), shinyjs (>= 1.0), xts -Suggests: knitr +Suggests: knitr, rmarkdown Description: Add-on package to the 'airGR' package that simplifies its use and is aimed at being used for teaching hydrology. The package provides 1) three functions that allow to complete very simply a hydrological modelling exercise 2) plotting functions to help students to explore observed data and to interpret the results of calibration and simulation of the GR ('Génie rural') models 3) a 'Shiny' graphical interface that allows for displaying the impact of model parameters on hydrographs and models internal variables. License: GPL-2 NeedsCompilation: no diff --git a/NEWS.md b/NEWS.md index 023179713ae2c4681752323d90d0773938f5fe7f..2010c2851a14102ee4b1c250ce6bcb4bf8ecc71d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,30 +4,43 @@ -### 0.2.10.98 Release Notes (2020-10-15) +### 0.2.10.60 Release Notes (2020-10-20) -### Version control and issue tracking +#### Version control and issue tracking - Users can now track changes (https://gitlab.irstea.fr/HYCAR-Hydro/airgrteaching) and issues (https://gitlab.irstea.fr/HYCAR-Hydro/airgrteaching/issues) +#### User-visible changes + +- the <code>theme</code> agument of the <code>ShinyGR()<code> function now uses partial matching + +____________________________________________________________________________________ + + +### 0.2.9.26 Release Notes (2020-10-20) + + #### New features -- in the <code>ShinyGR()</code> interface, there is a new tab panel that shows a summary sheets of basin if the name of the dataset contains the code station (8 characters : 1 letter and 7 numbers) of the Banque Hydro French database (so it is available only for the dataset of this database) +- in the <code>ShinyGR()</code> interface, there is a new tab panel that shows a summary sheets of basin if the name of the dataset contains the code station (8 characters : 1 letter and 7 numbers) of the Banque Hydro French database (so it is available only for the dataset of this database) ([#10](https://gitlab.irstea.fr/HYCAR-Hydro/airgrteaching/-/issues/10)) #### User-visible changes -- the <code>theme</code> agument of the <code>ShinyGR()<code> function now user partial matching + +- the <code>theme</code> agument of the <code>ShinyGR()</code> function now works even if a wrong character case #### CRAN-compatibility updates -- when the package is loaded, a message warns the users if they use a version of 'htmlwidgets' < 1.5.2.9002. The latest version of this package, available on GitHub, avoids troubles with the use of dynamic graphics of the 'dygraphs' package (called by the <code>dyplot*()</code> and the <code>ShinyGR()</code> functions) +- when the package is loaded or when the <code>dyplot()</code> and the <code>ShinyGR()</code> function are used, a message warns the users if they use a version of 'htmlwidgets' < 1.5.2.9000. The latest version of this package, available on GitHub, avoids troubles with the use of dynamic graphics of the 'dygraphs' package (called by the <code>dyplot*()</code> and the <code>ShinyGR()</code> functions) ([#5](https://gitlab.irstea.fr/HYCAR-Hydro/airgrteaching/-/issues/5)) + ____________________________________________________________________________________ + ### 0.2.8.69 Release Notes (2020-02-28) @@ -52,7 +65,7 @@ ________________________________________________________________________________ #### User-visible changes -- it is now possible to use the GR4H and GR5H hourly models with or without CemaNeige. For that, in the <code>PrepGR()</code>, the <code>HydroModel</code> argument could be set to <code>"GR4H"</code> or <code>"GR5H"</code>. In the GUI, launched by <code>ShinyGR()</code> function, nothing changed, only the daily models are available. So, now airGRteaching depends on the version of airGR >= 1.4.3.52) +- it is now possible to use the GR4H and GR5H hourly models with or without CemaNeige. For that, in the <code>PrepGR()</code>, the <code>HydroModel</code> argument could be set to <code>"GR4H"</code> or <code>"GR5H"</code>. In the GUI, launched by <code>ShinyGR()</code> function, nothing changed, only the daily models are available. So, now airGRteaching depends on the version of 'airGR' >= 1.4.3.52) - it is now possible to run the <code>PrepGR()</code> function when discharge is not provided in <code>Qobs</code>. If it is the case, the <code>CalGR()</code> function will return an error message because it is not possible to calibrate the model. The <code>SimGR()</code> function will return a warning message because it is not possible to compute any efficiency criterion @@ -116,7 +129,7 @@ ________________________________________________________________________________ - now depends on the latest version (1.2.13.16) of the 'airGR' package: <code>CalGR()</code>, <code>SimGR()</code> and <code>ShinyGR()</code> have been updated -- the 'htmlwidget' package is no longer imported +- the 'htmlwidgets' package is no longer imported #### User-visible changes @@ -311,7 +324,7 @@ ________________________________________________________________________________ #### Bug fixes -- period slider is linked to the dygraphs selected period +- period slider is linked to the 'dygraphs' selected period #### Deprecated and defunct @@ -325,7 +338,7 @@ ________________________________________________________________________________ #### CRAN-compatibility updates -- <code>dyplot()</code> updated to be compatible with dygraphs >= 1.1.1.4 (available only on GitHub) +- <code>dyplot()</code> updated to be compatible with 'dygraphs' >= 1.1.1.4 (available only on GitHub) ____________________________________________________________________________________ @@ -335,7 +348,7 @@ ________________________________________________________________________________ #### New features -- <code>ShinyGR()</code> now use dygraph devices (except for model perf.) +- <code>ShinyGR()</code> now use 'dygraphs' devices (except for model perf.) #### User-visible changes diff --git a/R/ShinyGR.R b/R/ShinyGR.R index 3f8c24991eb58495121175b32f336ae7d92eb405..8ad666cd1bdb948b11d4cabcfb4178e05a73eded 100644 --- a/R/ShinyGR.R +++ b/R/ShinyGR.R @@ -2,9 +2,11 @@ ShinyGR <- function(ObsDF = NULL, DatesR = NULL, Precip = NULL, PotEvap = NULL, ZInputs = NULL, HypsoData = NULL, NLayers = 5, SimPer, NamesObsBV = NULL, theme = "RStudio") { + .onAttach() + theme <- match.arg(arg = theme, choices = c("RStudio", "Cerulean", "Cyborg", "Flatly", "Inrae", "Saclay", "United", "Yeti")) - + if ((is.null(ObsDF) | any(sapply(ObsDF, is.null))) && (is.null(DatesR) | is.null(Precip) | is.null(PotEvap) | is.null(Qobs))) { stop("Missing input data") } diff --git a/R/dyplot.R b/R/dyplot.R index 5bf40a1834cd9903df0eec7e3c2226623f60103d..5ec7a6940fbe0957f5b01115ae32110cb24d5ca1 100644 --- a/R/dyplot.R +++ b/R/dyplot.R @@ -1,3 +1,4 @@ dyplot <- function(x, ...) { + .onAttach() UseMethod("dyplot") } diff --git a/README.md b/README.md index cf4a01d755d16ba03f466d3d7f945a94554ddc17..fbe28142963f8b268de35bae10850686b0c6cbce 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# airGRteaching: Tools to Simplify the Use of the airGR Hydrological Package for Education (Including a Shiny Application +# airGRteaching: Tools to Simplify the Use of the airGR Hydrological Package for Education (Including a Shiny Application) ## Overview @@ -14,7 +14,7 @@ The package is mostly based on three families of functions: - plotting functions to help students to explore observed data and to interpret the results of calibration and simulation of the GR models; - a function which runs a 'Shiny' graphical user interface that allows for displaying in real-time model parameters impacts on hydrographs. -This package brings into R the hydrological modelling tools developed at INRAE-Antony ([Catchment Hydrology research group](https://webgr.inrae.fr/en/) of the HYCAR Research Unit, France). +This package brings into R the hydrological modelling tools developed at INRAE-Antony ([Catchment Hydrology research group](https://webgr.inrae.fr/en/home/) of the HYCAR Research Unit, France). ## Installation @@ -23,6 +23,14 @@ This package brings into R the hydrological modelling tools developed at INRAE-A install.packages("airGRteaching") ``` +This version of airGRteaching is designed to work with the package htmlwidgets >= 1.5.2.9000 (troubles with the package dygraphs using `dyplot()` and `ShinyGR()`) +Install the latest version of 'htmlwidgets' from GitHub with the following command lines: + +```{r eval=FALSE} +install.packages("remotes") +remotes::install_github("ramnathv/htmlwidgets") +``` + ## Modelling Functions @@ -68,7 +76,7 @@ These models can be called within airGRteaching using the following model names - `CemaNeige`: two-parameter degree-day snow melt and accumulation daily model (combined with GR4H, GR5H, GR4J, GR5J or GR6J) (Valéry et al., 2014) -For more information and to get started with the package, you can refer to the vignette (`vignette("get_started")`) and go on the [airGRteaching website](https://hydrogr.github.io/airGRteaching). +For more information and to get started with the package, you can refer to the vignette (`vignette("get_started")`) and go on the [airGRteaching website](https://hydrogr.github.io/airGRteaching/). ## References diff --git a/man/airGRteaching.Rd b/man/airGRteaching.Rd index 7fea45d6b1872f8c5075febe53580e35b93ce3bf..eb93484bab0243755ad75017e6c5e7bf42d480c1 100644 --- a/man/airGRteaching.Rd +++ b/man/airGRteaching.Rd @@ -19,8 +19,8 @@ The package is mostly based on three families of functions: \item a function which runs a 'Shiny' graphical user interface that allows for displaying in real-time the impacts of model parameters on hydrographs. } -This package brings into R the hydrological modelling tools developed at INRAE-Antony (\href{https://webgr.inrae.fr/en/}{Catchment Hydrology research group} of the HYCAR Research Unit, France). -\cr +This package brings into R the hydrological modelling tools developed at INRAE-Antony (\href{https://webgr.inrae.fr/en/home/}{Catchment Hydrology research group} of the HYCAR Research Unit, France). +\cr\cr # --- Modelling Functions @@ -69,7 +69,7 @@ These models can be called within airGRteaching using the following model names \item \code{CemaNeige}: two-parameter degree-day snow melt and accumulation daily model (combined with GR4H, GR5H, GR4J, GR5J or GR6J) (Valéry et al., 2014) } -For more information and to get started with the package, you can refer to the vignette (\code{vignette("get_started")}) and go on the \href{https://hydrogr.github.io/airGRteaching}{airGRteaching website}. +For more information and to get started with the package, you can refer to the vignette (\code{vignette("get_started")}) and go on the \href{https://hydrogr.github.io/airGRteaching/}{airGRteaching website}. \cr