if (FALSE) {
# cuevas station
path <- system.file('extdata', package = 'hydrotoolbox')
# use the build method
hm_cuevas <-
hm_create() %>%
hm_build(bureau = 'ianigla', path = path,
file_name = 'ianigla_cuevas.csv',
slot_name = c('tair', 'rh', 'patm',
'precip', 'wspd', 'wdir',
'kin', 'hsnow', 'tsoil'),
by = 'hour',
out_name = c('tair(°C)', 'rh(%)', 'patm(mbar)',
'p(mm)', 'wspd(km/hr)', 'wdir(°)',
'kin(kW/m2)', 'hsnow(cm)', 'tsoil(°C)' )
)
# aggregate air temperature data to mean value
hm_agg(obj = hm_cuevas, slot_name = 'tair', col_name = 'tair(°C)',
fun = 'mean', period = 'daily', out_name = 't_mean') %>%
hm_show(slot_name = 'tair')
# the previous command overwrites the original slot, so now we are going
# to relocate the agg values
hm_agg(obj = hm_cuevas, slot_name = 'tair',
col_name = 'tair(°C)',
fun = 'mean',
period = 'daily',
relocate = 'tmean',
out_name = 'tmean(°C)',
) %>%
hm_show(slot_name = 'tmean')
}
Run the code above in your browser using DataLab