swe_derive: Snow Water Equivalent to melt or snowfall

Description Usage Arguments Value Examples

View source: R/ff_swe_derive.R

Description

Derive melt or snowfall series from snow water equivalent measurements (from snow pillows).

Usage

1
swe_derive(x, col_name, out_name = NULL, case)

Arguments

x

data frame with class Date in the first column and numeric on the others.

col_name

string with column(s) name(s) where to apply the function.

out_name

optional. String with new column(s) name(s). If you set it as NULL, the function will overwrite the original data frame.

case

string vector with 'sf' (meaning snowfall) or 'm' (meaning melt).

Value

The same data frame but with the derived series.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# set path to file
path_file <- system.file('extdata', 'dgi_toscas.xlsx',
             package = 'hydrotoolbox')

# swe table
swe_toscas <- read_dgi(path = path_file,
                       sheet = 'swe',
                       out_name = 'swe(mm)')

# add melt and snowfall
swe_toscas <-
  swe_toscas %>%
  swe_derive(col_name = rep('swe(mm)', 2),
             out_name = c('melt(mm)', 'snowfall(mm)'),
             case = c('m', 'sf') )

hydrotoolbox documentation built on July 9, 2021, 1:06 a.m.