Coder Social home page Coder Social logo

cshshydrology's People

Contributors

boshek avatar kevinshook avatar paulwhitfield avatar rchlumsk avatar vmunozs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cshshydrology's Issues

CRAN issue #8 - AGPL licence

License components with restrictions and base license permitting such:
AGPL-3 | file LICENSE

The license file is only needed in case of attribution requirements or
other possible restrictions.
Hence please omit it.

Session Info

CRAN issue #5 writing information to console that cannot be suppressed

You write information messages to the console that cannot be easily
suppressed.
It is more R like to generate objects that can be used to extract the
information a user is interested in, and then print() that object.
Instead of print()/cat() rather use message()/warning() or
if(verbose)cat(..) (or maybe stop()) if you really have to write text to
the console.
(except for print, summary, interactive functions

Session Info

CRAN issue #4 use of \dontrun instead of \donttest

\dontrun{} should only be used if the example really cannot be executed
(e.g. because of missing additional software, missing API keys, ...) by
the user. That's why wrapping examples in \dontrun{} adds the comment
("# Not run:") as a warning for the user.
Does not seem necessary in all cases.

Please unwrap the examples if they are executable in < 5 sec, or replace
\dontrun{} with \donttest{}.

Please put functions which download data in \donttest{}.

Session Info

Example run times

Several examples are being flagged in the check --as-cran as taking excessively long to execute

Examples with CPU (user + system) or elapsed time > 5s
                      user system elapsed
ch_flow_raster_trend 9.152  0.428   9.584
ch_regime_plot       8.354  0.375   8.730
ch_polar_plot        8.150  0.371   8.528

We should probably try using them with smaller data sets.

Session Info

CRAN issue #7 deleting user's objects

Please do not modify the user's global environment or the user's home
filespace in your examples or vignettes by deleting objects
rm(list = ls())

Session Info

Issues in hydrograph.plot

Session Info
 setting  value                       
 version  R version 3.4.4 (2018-03-15)
 system   x86_64, linux-gnu           
 ui       RStudio (1.1.453)           
 language (EN)                        
 collate  en_CA.UTF-8                 
 tz       America/Regina              
 date     2018-06-12                  

Packages -------------------------------------------------------------------------------------------------------------------------------
 package   * version date       source        
 base      * 3.4.4   2018-03-16 local         
 compiler    3.4.4   2018-03-16 local         
 datasets  * 3.4.4   2018-03-16 local         
 devtools    1.13.5  2018-02-18 CRAN (R 3.4.3)
 digest      0.6.15  2018-01-28 CRAN (R 3.4.3)
 graphics  * 3.4.4   2018-03-16 local         
 grDevices * 3.4.4   2018-03-16 local         
 memoise     1.1.0   2017-04-21 CRAN (R 3.4.1)
 methods   * 3.4.4   2018-03-16 local         
 stats     * 3.4.4   2018-03-16 local         
 tools       3.4.4   2018-03-16 local         
 utils     * 3.4.4   2018-03-16 local         
 withr       2.1.2   2018-03-15 CRAN (R 3.4.4)
 yaml        2.1.18  2018-03-08 CRAN (R 3.4.3)

There are a couple of issues:

  1. The function name i(hydrograph.plot) is delimited by a period. This is not what the Google style guide recommends https://google.github.io/styleguide/Rguide.xml#identifiers:
    function names have initial capital letters and no dots
    Currently all of our function names begin with lower-case letters, but using the dot as a delimiter can cause problems on Windows systems as the second word can be confused with the file extension.
  2. I get these warnings when I run check()
hydrograph.plot: no visible global function definition for ‘par’
hydrograph.plot: no visible global function definition for ‘plot’
hydrograph.plot: no visible global function definition for ‘grid’
hydrograph.plot: no visible global function definition for ‘polygon’
hydrograph.plot: no visible global function definition for ‘lines’
hydrograph.plot: no visible global function definition for ‘axis’
hydrograph.plot: no visible global function definition for ‘mtext’
hydrograph.plot: no visible global function definition for ‘legend’
Undefined global functions or variables:
  axis grid legend lines mtext par plot polygon
Consider adding
  importFrom("graphics", "axis", "grid", "legend", "lines", "mtext",
             "par", "plot", "polygon")
to your NAMESPACE file.

You can add the functions to NAMESPACE, by adding statements to hydrology-package.R, i.e.

#' @import (timeDate)
#' @import (raster)
#' @import (Kendall)
#' @import (fields)

The functions called from other packages all need to be specified using the :: notation, specifying the name of the package, as in graphics::axis() etc.

CRAN issue #2 missing return value for function

Please add \value to .Rd files regarding exported methods and explain
the functions results in the documentation. Please write about the
structure of the output (class) and also what the output means. (If a
function does not return a value, please document that too, e.g.
\value{No return value, called for side effects} or similar)
Missing Rd-tags:
ch_axis_doy.Rd: \value

Session Info

Issues with Dan Moore's vignette

  1. There is a local path in the camp_creek_test vignette:
wd <- "C:/cshshydrology/spatial_functions/working"

Also there is a commented out one in ShannonFalls_spatialhydrology vignette
# dem <- raster::raster("c:/Research/Shannon Falls/Map/cdem_dem_151108_134502_tif/cdem_dem_151108_134502.tif")

  1. We get a lot of warnings when using the library() function in the Vignettes, because of all of the raster functions, e.g.
There were 15 warnings (use warnings() to see them)
> warnings()
Warning messages:
1: replacing previous import ‘lubridate::intersect’ by ‘raster::intersect’ when loading ‘CSHShydRology’
2: replacing previous import ‘lubridate::origin’ by ‘raster::origin’ when loading ‘CSHShydRology’
3: replacing previous import ‘lubridate::union’ by ‘raster::union’ when loading ‘CSHShydRology’
4: replacing previous import ‘raster::density’ by ‘stats::density’ when loading ‘CSHShydRology’
5: replacing previous import ‘raster::weighted.mean’ by ‘stats::weighted.mean’ when loading ‘CSHShydRology’
6: replacing previous import ‘raster::predict’ by ‘stats::predict’ when loading ‘CSHShydRology’
7: replacing previous import ‘raster::aggregate’ by ‘stats::aggregate’ when loading ‘CSHShydRology’
8: replacing previous import ‘raster::quantile’ by ‘stats::quantile’ when loading ‘CSHShydRology’
9: replacing previous import ‘raster::update’ by ‘stats::update’ when loading ‘CSHShydRology’
10: replacing previous import ‘raster::tail’ by ‘utils::tail’ when loading ‘CSHShydRology’
11: replacing previous import ‘raster::stack’ by ‘utils::stack’ when loading ‘CSHShydRology’
12: replacing previous import ‘raster::unstack’ by ‘utils::unstack’ when loading ‘CSHShydRology’
13: replacing previous import ‘raster::head’ by ‘utils::head’ when loading ‘CSHShydRology’
14: replacing previous import ‘raster::image’ by ‘graphics::image’ when loading ‘CSHShydRology’
15: replacing previous import ‘raster::plot’ by ‘graphics::plot’ when loading ‘CSHShydRology’

There are a couple of ways of getting around this.
The best way is to avoid the conflicts
The library() function has some options, including:

exclude,include.only	character vector of names of objects to exclude or include in the attached frame. Only one of these arguments may be used in a call to library or require

We can use this to only include the functions that we need.

Alternatively (and this is definitely poorer style), the library() function also has the option

warn.conflicts	logical. If TRUE, warnings are printed about conflicts from attaching the new package. A conflict is a function masking a function, or a non-function masking a non-function. The default is TRUE unless specified as FALSE in the conflicts.policy option.

If we have to, we could set this to FALSE, but that's not my preference

Can't set the y-axis label in hydrograph_plot

Session Info
Session info --------------------------------------------------------------------------------------------------------------------------
 setting  value                   

    
 version  R version 3.4.4 (2018-03-15)
 system   x86_64, linux-gnu           
 ui       RStudio (1.1.423)           
 language (EN)                        
 collate  en_CA.UTF-8                 
 tz       America/Regina              
 date     2018-05-23                  

Packages ------------------------------------------------------------------------------------------------------------------------------
 package       * version date       source        
 backports       1.1.2   2017-12-13 cran (@1.1.2) 
 base          * 3.4.4   2018-03-16 local         
 compiler        3.4.4   2018-03-16 local         
 CSHShydRology * 0.0.1   2018-05-23 local         
 datasets      * 3.4.4   2018-03-16 local         
 devtools        1.13.5  2018-02-18 CRAN (R 3.4.3)
 digest          0.6.15  2018-01-28 CRAN (R 3.4.3)
 evaluate        0.10.1  2017-06-24 CRAN (R 3.4.1)
 graphics      * 3.4.4   2018-03-16 local         
 grDevices     * 3.4.4   2018-03-16 local         
 htmltools       0.3.6   2017-04-28 CRAN (R 3.4.1)
 knitr           1.20    2018-02-20 CRAN (R 3.4.3)
 lubridate       1.7.3   2018-02-27 CRAN (R 3.4.3)
 magrittr        1.5     2014-11-22 CRAN (R 3.4.1)
 memoise         1.1.0   2017-04-21 CRAN (R 3.4.1)
 methods       * 3.4.4   2018-03-16 local         
 Rcpp            0.12.16 2018-03-13 CRAN (R 3.4.4)
 rmarkdown       1.9     2018-03-01 CRAN (R 3.4.3)
 rprojroot       1.3-2   2018-01-03 cran (@1.3-2) 
 rsconnect       0.8.8   2018-03-09 CRAN (R 3.4.3)
 stats         * 3.4.4   2018-03-16 local         
 stringi         1.1.7   2018-03-12 CRAN (R 3.4.4)
 stringr         1.3.0   2018-02-19 CRAN (R 3.4.3)
 tools           3.4.4   2018-03-16 local         
 utils         * 3.4.4   2018-03-16 local         
 withr           2.1.2   2018-03-15 CRAN (R 3.4.4)
 yaml            2.1.18  2018-03-08 CRAN (R 3.4.3)
When I try to change the y-axis title, it fails. The last chunk in the attached pdf shows the issue

hydrograph_plot.pdf

Feature request - deriving precipitation events from precipitation time series

A function to basically isolate rainfall events from precipitation data would be helpful, and has been requested for usage in groundwater event modelling in particular.

First cut of this could use some first order derivative criteria to detect a rate of change in precip to capture rise and fall in precip intensity (?). Would likely require hourly or higher resolution data

Whitfield branch

The function names in the Whitfield branch all begin with a lower-case letter, which is contradicted by the Google code standards at https://google.github.io/styleguide/Rguide.xml#identifiers:

I got the following errors when running check()

checking dependencies in R code ... WARNING
'::' or ':::' imports not declared from:
  ‘Graphics’ ‘Kendall’ ‘fields’ ‘raster’ ‘timeDate’
...
ocumented arguments not in \usage in documentation object 'HYDAT_list':
  ‘stnID’ ‘stn’

Undocumented arguments in documentation object 'doys'
  ‘Date’
Documented arguments not in \usage in documentation object 'doys':
  ‘{Date}’

Functions with \usage entries need to have the appropriate \alias
entries, and all their arguments documented.
The \usage entries must correspond to syntactically valid R code.
See chapter ‘Writing R documentation files’ in the ‘Writing R
Extensions’ manual.

CRAN issue #6 changing user's options

Please make sure that you do not change the user's options, par or
working directory. If you really have to do so within functions, please
ensure with an immediate call of on.exit() that the settings are reset
when the function is exited. e.g.:
...
oldpar <- par(no.readonly = TRUE) # code line i
on.exit(par(oldpar)) # code line i + 1
...
par(mfrow=c(2,2)) # somewhere after
...

...
old <- options() # code line i
on.exit(options(old)) # code line i+1
...
options(scipen = 999)
...
e.g.:
If you're not familiar with the function, please check ?on.exit. This
function makes it possible to restore options before exiting a function
even if the function breaks. Therefore it needs to be called immediately
after the option change within a function.

Please always make sure to reset to user's options(), working directory
or par() after you changed it in examples and vignettes and demos.
e.g.: inst/doc/hydrograph_plot.R
oldpar <- par(mgp = c(2.5, 1, 0))
...
par(oldpar)

Session Info

Additional functions in the package

I will appreciate if the following routine tasks performed by most hydrologists are added to the package:
-Time series gap infilling
-Flow naturalization
-Streamflow data extension
-Flow transfer to an ungauged site
-Annual and seasonal autocorrelations and cross-correlations
-ARIMA models for stochastic time series recreation, or at least AR models, both univariate and multivariate. It must have a -module for data analysis, a module for fitting a model and a module for generate series using the fitted model. ( I am sure this tools already exist in R, but the idea would be to included them in the CWRA package and linked with the Canada dataset.)
-Spatial and temporal disaggregation methods….including flow disaggregation methods
-Statistics related to storage, drought and surplus
-Scaling and standardization

Dead URL in README

Found this dead link while taking a look through the package to find areas I can clean up/contribute.

The link to the CSHS page at the end of the "What is CSHS Hydrology?" section of the README 404s.

Link is currently http://www.cwra.org/en/branches/affiliates/cshs-a

Would submit a PR but not sure where this link should actually point.

Link location in README:

image

Resulting 404:

image

Dan_Moore_spatial branch

Session Info
Lots of errors found by check().
  • there are many undocumented function arguments
  • many of the functions don't have examples
  • functions don't have import statements
    I have fixed ch_saga_catchment() as an example of how it can be done,
    but many the other functions need to be fixed.

ch_wbt_catchment_onestep - catchment.shp export is actually the channel.shp

Love this function, but the catchment.shp export at the end is actually the channel data. Thankfully the catchment.tif is correct so I've been converting that to .shp.

My reproducible example is the help example (one day I"ll learn to make reprex).

Cheers

library(raster)
test_raster <- ch_volcano_raster()
dem_raster_file <- tempfile(fileext = c(".tif"))
writeRaster(test_raster, dem_raster_file, format = "GTiff")
wd <- tempdir()
pourpoint_file <- tempfile("volcano_pourpoints", fileext = ".shp")
pourpoints <- ch_volcano_pourpoints(pourpoint_file)
catchment <- ch_wbt_catchment_onestep(wd = wd, in_dem = dem_raster_file,
pp_sf = pourpoints, sink_method = "fill", threshold = 1, snap_dist = 10)

> devtools::session_info()
─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.2.0 (2022-04-22 ucrt)
 os       Windows 10 x64 (build 19045)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  English_Canada.utf8
 ctype    English_Canada.utf8
 tz       America/Los_Angeles
 date     2023-03-02
 rstudio  2022.12.0+353 Elsbeth Geranium (desktop)
 pandoc   2.12 @ C:\\Users\\jmorris\\ANACON~1\\Scripts\\pandoc.exePackages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package       * version  date (UTC) lib source
 assertthat      0.2.1    2019-03-21 [1] CRAN (R 4.2.0)
 boot            1.3-28   2021-05-03 [2] CRAN (R 4.2.0)
 cachem          1.0.6    2021-08-19 [1] CRAN (R 4.2.0)
 callr           3.7.3    2022-11-02 [1] CRAN (R 4.2.2)
 circular        0.4-95   2022-04-26 [1] CRAN (R 4.2.2)
 class           7.3-20   2022-01-16 [2] CRAN (R 4.2.0)
 classInt        0.4-8    2022-09-29 [1] CRAN (R 4.2.2)
 cli             3.4.1    2022-09-23 [1] CRAN (R 4.2.1)
 codetools       0.2-18   2020-11-04 [2] CRAN (R 4.2.0)
 colorspace      2.0-3    2022-02-21 [1] CRAN (R 4.2.0)
 crayon          1.5.2    2022-09-29 [1] CRAN (R 4.2.2)
 CSHShydRology * 1.3.0    2022-11-16 [1] CRAN (R 4.2.0)
 DBI             1.1.3    2022-06-18 [1] CRAN (R 4.2.2)
 devtools        2.4.5    2022-10-11 [1] CRAN (R 4.2.2)
 digest          0.6.30   2022-10-18 [1] CRAN (R 4.2.2)
 dotCall64       1.0-2    2022-10-03 [1] CRAN (R 4.2.2)
 dplyr           1.0.10   2022-09-01 [1] CRAN (R 4.2.2)
 e1071           1.7-12   2022-10-24 [1] CRAN (R 4.2.2)
 ellipsis        0.3.2    2021-04-29 [1] CRAN (R 4.2.0)
 fansi           1.0.3    2022-03-24 [1] CRAN (R 4.2.0)
 farver          2.1.1    2022-07-06 [1] CRAN (R 4.2.2)
 fastmap         1.1.0    2021-01-25 [1] CRAN (R 4.2.0)
 fields          14.1     2022-08-12 [1] CRAN (R 4.2.2)
 fs              1.5.2    2021-12-08 [1] CRAN (R 4.2.0)
 generics        0.1.3    2022-07-05 [1] CRAN (R 4.2.2)
 ggplot2         3.4.0    2022-11-04 [1] CRAN (R 4.2.2)
 ggspatial       1.1.6    2022-07-08 [1] CRAN (R 4.2.2)
 glue            1.6.2    2022-02-24 [1] CRAN (R 4.2.0)
 gridExtra       2.3      2017-09-09 [1] CRAN (R 4.2.0)
 gtable          0.3.1    2022-09-01 [1] CRAN (R 4.2.2)
 here          * 1.0.1    2020-12-13 [1] CRAN (R 4.2.0)
 htmltools       0.5.3    2022-07-18 [1] CRAN (R 4.2.2)
 htmlwidgets     1.5.4    2021-09-08 [1] CRAN (R 4.2.0)
 httpuv          1.6.6    2022-09-08 [1] CRAN (R 4.2.2)
 httr            1.4.4    2022-08-17 [1] CRAN (R 4.2.2)
 Kendall         2.2.1    2022-03-20 [1] CRAN (R 4.2.0)
 KernSmooth      2.23-20  2021-05-03 [2] CRAN (R 4.2.0)
 later           1.3.0    2021-08-18 [1] CRAN (R 4.2.0)
 lattice         0.20-45  2021-09-22 [2] CRAN (R 4.2.0)
 lifecycle       1.0.3    2022-10-07 [1] CRAN (R 4.2.1)
 lubridate       1.9.0    2022-11-06 [1] CRAN (R 4.2.2)
 magrittr        2.0.3    2022-03-30 [1] CRAN (R 4.2.0)
 maps            3.4.1    2022-10-30 [1] CRAN (R 4.2.2)
 memoise         2.0.1    2021-11-26 [1] CRAN (R 4.2.0)
 mime            0.12     2021-09-28 [1] CRAN (R 4.2.0)
 miniUI          0.1.1.1  2018-05-18 [1] CRAN (R 4.2.0)
 munsell         0.5.0    2018-06-12 [1] CRAN (R 4.2.0)
 mvtnorm         1.1-3    2021-10-08 [1] CRAN (R 4.2.0)
 pillar          1.8.1    2022-08-19 [1] CRAN (R 4.2.2)
 pkgbuild        1.3.1    2021-12-20 [1] CRAN (R 4.2.0)
 pkgconfig       2.0.3    2019-09-22 [1] CRAN (R 4.2.0)
 pkgload         1.3.2    2022-11-16 [1] CRAN (R 4.2.0)
 plotrix         3.8-2    2021-09-08 [1] CRAN (R 4.2.0)
 prettyunits     1.1.1    2020-01-24 [1] CRAN (R 4.2.0)
 processx        3.8.0    2022-10-26 [1] CRAN (R 4.2.2)
 profvis         0.3.7    2020-11-02 [1] CRAN (R 4.2.2)
 promises        1.2.0.1  2021-02-11 [1] CRAN (R 4.2.0)
 proxy           0.4-27   2022-06-09 [1] CRAN (R 4.2.2)
 ps              1.7.2    2022-10-26 [1] CRAN (R 4.2.2)
 purrr           0.3.5    2022-10-06 [1] CRAN (R 4.2.2)
 R6              2.5.1    2021-08-19 [1] CRAN (R 4.2.0)
 raster          3.6-3    2022-09-18 [1] CRAN (R 4.2.2)
 Rcpp            1.0.9    2022-07-08 [1] CRAN (R 4.2.2)
 remotes         2.4.2    2021-11-30 [1] CRAN (R 4.2.1)
 rgdal           1.6-2    2022-11-09 [1] CRAN (R 4.2.2)
 rlang           1.0.6    2022-09-24 [1] CRAN (R 4.2.1)
 rprojroot       2.0.3    2022-04-02 [1] CRAN (R 4.2.0)
 rstudioapi      0.14     2022-08-22 [1] CRAN (R 4.2.2)
 scales          1.2.1    2022-08-20 [1] CRAN (R 4.2.2)
 sessioninfo     1.2.2    2021-12-06 [1] CRAN (R 4.2.0)
 sf              1.0-9    2022-11-08 [1] CRAN (R 4.2.2)
 shiny           1.7.3    2022-10-25 [1] CRAN (R 4.2.2)
 sp              1.5-1    2022-11-07 [1] CRAN (R 4.2.2)
 spam            2.9-1    2022-08-07 [1] CRAN (R 4.2.2)
 stringi         1.7.8    2022-07-11 [1] CRAN (R 4.2.1)
 stringr         1.4.1    2022-08-20 [1] CRAN (R 4.2.2)
 terra           1.6-17   2022-09-10 [1] CRAN (R 4.2.1)
 tibble          3.1.8    2022-07-22 [1] CRAN (R 4.2.2)
 tidyhydat       0.5.7    2022-10-16 [1] CRAN (R 4.2.2)
 tidyselect      1.2.0    2022-10-10 [1] CRAN (R 4.2.1)
 timechange      0.1.1    2022-11-04 [1] CRAN (R 4.2.2)
 timeDate        4021.106 2022-09-30 [1] CRAN (R 4.2.1)
 units           0.8-0    2022-02-05 [1] CRAN (R 4.2.0)
 urlchecker      1.0.1    2021-11-30 [1] CRAN (R 4.2.2)
 usethis         2.1.6    2022-05-25 [1] CRAN (R 4.2.2)
 utf8            1.2.2    2021-07-24 [1] CRAN (R 4.2.0)
 vctrs           0.5.1    2022-11-16 [1] CRAN (R 4.2.2)
 viridis         0.6.2    2021-10-13 [1] CRAN (R 4.2.0)
 viridisLite     0.4.1    2022-08-22 [1] CRAN (R 4.2.2)
 whitebox        2.2.0    2022-10-27 [1] CRAN (R 4.2.2)
 withr           2.5.0    2022-03-03 [1] CRAN (R 4.2.0)
 xtable          1.8-4    2019-04-21 [1] CRAN (R 4.2.0)

 [1] C:/Users/jmorris/AppData/Local/R/win-library/4.2
 [2] C:/Program Files/R/R-4.2.0/library

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.