Learn R Programming

grwat (version 0.1)

gr_from_pardf: Convert data frame of parameters to list

Description

Convert data frame of parameters to list

Usage

gr_from_pardf(pardf)

Value

list of lists of hydrograph separation parameters as returned in params attribute by gr_separate() with debug = TRUE.

Arguments

pardf

tibble data frame with tabular representation of hydrograph separation parameters as returned by gr_to_pardf().

Examples

Run this code
library(grwat)

data(spas) # example Spas-Zagorye data is included with grwat package
head(spas)

# separate
sep = gr_separate(spas, params = gr_get_params(reg = 'center'))

# Visualize
gr_plot_sep(sep, c(1978, 1989)) 

# Debug mode gives access to additional information
sep_debug = gr_separate(spas, 
                        params = gr_get_params(reg = 'center'), 
                        debug = TRUE)

# a vector of years with jittered params
jit = attributes(sep_debug)$jittered
print(jit)

# actual params used for each year
parlist = attributes(sep_debug)$params

# tweak parameters for selected year
parlist[['1989']]$grad1 = 3
parlist[['1989']]$grad2 = 6

# tabular representation of parameters
partab = gr_to_pardf(parlist)

head(partab)

partab |> 
  dplyr::filter(year == 1989) |> 
  head()

parlist_back = gr_from_pardf(partab)

head(parlist_back[['1989']])

Run the code above in your browser using DataLab