Skip to content

Commit

Permalink
tried to resolve check warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
stineb committed Nov 8, 2023
1 parent f26c72e commit 806c371
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 677 deletions.
17 changes: 14 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,21 @@ Description: Derives time series of the cumulative water deficit (CWD), given ti
Encoding: UTF-8
URL: https://github.com/geco-bern/cwd
BugReports: https://github.com/geco-bern/cwd/issues
License: GPL-3
Depends:
R (>= 3.6)
Imports:
dplyr
ByteCompile: true
dplyr,
here,
lubridate,
readr
Suggests:
rmarkdown,
knitr,
ggplot2,
patchwork,
extRemes
License: AGPL-3
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE)
VignetteBuilder: knitr
ByteCompile: true
661 changes: 0 additions & 661 deletions LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
export(convert_et)
export(cwd)
export(simulate_snow)
import(dplyr)
11 changes: 5 additions & 6 deletions R/cwd.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' during the remainder of the event is set to missing values. This is to avoid interpreting data
#' after rain events but before full compensation of CWD. Defaults to 0.9.
#'
#' @import dplyr
#' @importFrom dplyr
#'
#' @details A list of two data frames (tibbles). \code{inst} contains information about CWD "events".
#' Each row corresonds to one event. An event is defined as a period of consecutive days where the
Expand All @@ -38,17 +38,16 @@ cwd <- function(df, varname_wbal, varname_date, thresh_terminate = 0.0, thresh_d
# corresponds to mct2.R

if (thresh_terminate > thresh_drop){
rlang::warn("Aborting. thresh_terminate must be smaller or equal thresh_drop. Setting it equal.")
warning("Aborting. thresh_terminate must be smaller or equal thresh_drop. Setting it equal.")
thresh_terminate <- thresh_drop
}

inst <- tibble()
idx <- 0
iinst <- 1

df <- df %>%
ungroup() %>%
# dplyr::select(date, !!varname_wbal) %>%
df <- df |>
ungroup() |>
mutate(iinst = NA, dday = NA, deficit = 0)

# search all dates
Expand Down Expand Up @@ -111,7 +110,7 @@ cwd <- function(df, varname_wbal, varname_date, thresh_terminate = 0.0, thresh_d

# record instance
this_inst <- tibble( idx_start = idx, len = iidx_drop-idx, iinst = iinst, date_start=df[[varname_date]][idx], date_end = df[[varname_date]][iidx_drop-1], deficit = max_deficit )
inst <- inst %>% bind_rows(this_inst)
inst <- inst |> bind_rows(this_inst)

# update
iinst <- iinst + 1
Expand Down
2 changes: 2 additions & 0 deletions R/simulate_snow.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#' @param varnam_prec A character string specifying the variable name for rain.
#' @param varnam_snow A character string specifying the variable name for snow.
#'
#' @importFrom dplyr

#' @details Returns a data frame with two added columns: (1) \code{liquid_to_soil}
#' is the rain plus snow melt in mm d-1; (2) \code{snow_pool} is the snow mass
#' in water equivalents (mm) for each day.
Expand Down
12 changes: 12 additions & 0 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions docs/pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pandoc: 3.1.1
pkgdown: 2.0.7
pkgdown_sha: ~
articles: {}
last_built: 2023-10-27T13:12Z
articles:
cwd_example: cwd_example.html
last_built: 2023-11-08T16:33Z

10 changes: 10 additions & 0 deletions docs/reference/cwd.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions docs/reference/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions docs/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,28 @@
<url>
<loc>/LICENSE-text.html</loc>
</url>
<url>
<loc>/articles/cwd_example.html</loc>
</url>
<url>
<loc>/articles/index.html</loc>
</url>
<url>
<loc>/authors.html</loc>
</url>
<url>
<loc>/index.html</loc>
</url>
<url>
<loc>/reference/convert_et.html</loc>
</url>
<url>
<loc>/reference/cwd.html</loc>
</url>
<url>
<loc>/reference/index.html</loc>
</url>
<url>
<loc>/reference/simulate_snow.html</loc>
</url>
</urlset>
10 changes: 6 additions & 4 deletions vignettes/cwd_example.Rmd
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
---
title: "Example"
author: "Beni Stocker"
date: "2023-11-08"
output: html_document
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{map2tidy functionality}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---

```{r setup, include=FALSE}
Expand Down Expand Up @@ -128,8 +132,6 @@ vals <- out_cwd$inst %>%
# Fit general extreme value distribution
evd_gev <- extRemes::fevd(x = vals, type = "GEV", method = "MLE", units = "years")
summary(evd_gev)
plot(evd_gev)
```

Get return levels for given return periods.
Expand Down

0 comments on commit 806c371

Please sign in to comment.