if (FALSE) {
# lets say that we want to put together snow water equivalent from Toscas (dgi)
# and daily streamflow discharge from Guido (snih)
# path to all example files
path <- system.file('extdata', package = 'hydrotoolbox')
# on the first place we build the stations
# dgi file
toscas <-
hm_create() %>%
hm_build(bureau = 'dgi', path = path,
file_name = 'dgi_toscas.xlsx',
slot_name = c('swe', 'tmax',
'tmin', 'tmean', 'rh', 'patm'),
by = 'day',
out_name = c('swe', 'tmax',
'tmin', 'tmean', 'rh', 'patm') )
# snih file
guido <-
hm_create() %>%
hm_build(bureau = 'snih', path = path,
file_name = c('snih_hq_guido.xlsx',
'snih_qd_guido.xlsx'),
slot_name = c('hq', 'qd'),
by = c('none', 'day') )
# now we melt the requiered data
hm_create(class_name = 'compact') %>%
hm_melt(melt = c('toscas', 'guido'),
slot_name = list(toscas = 'swe', guido = 'qd'),
col_name = 'all',
out_name = c('swe(mm)', 'qd(m3/s)')
) %>%
hm_plot(slot_name = 'compact',
col_name = list( c('swe(mm)', 'qd(m3/s)') ),
interactive = TRUE,
line_color = c('dodgerblue', 'red'),
y_lab = c('q(m3/s)', 'swe(mm)'),
dual_yaxis = c('right', 'left')
)
}
Run the code above in your browser using DataLab