swe_derive {hydrotoolbox}R Documentation

Snow Water Equivalent to melt or snowfall

Description

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

Usage

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

Arguments

x

data frame or tibble with class Date or POSIX* in the first column.

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 table.

case

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

Value

The same data frame but with the derived series.

Examples


# 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') )



[Package hydrotoolbox version 1.1.2 Index]