hm_build: Load native data files automatically

hm_buildR Documentation

Load native data files automatically

Description

The method allows you to automatically load your native data inside the hydromet_station slots.

Usage

hm_build(
  obj,
  bureau,
  path,
  file_name,
  slot_name,
  by,
  out_name = NULL,
  sheet = NULL
)

## S4 method for signature 'hydromet_station'
hm_build(
  obj,
  bureau,
  path,
  file_name,
  slot_name,
  by,
  out_name = NULL,
  sheet = NULL
)

Arguments

obj

a valid hydromet_station class object.

bureau

string value containing one of the available options: 'aic', 'cr2', 'dgi', 'ianigla', 'mnemos' or 'snih'.

path

string vector with the path(s) to the file_name argument. If you set a single string it will be recycled for all the files.

file_name

string vector with the native file(s) name(s).

slot_name

string vector with the slot(s) where to set the file(s) or sheet(s).

by

string vector with the time step of the series (e.g.: 'month', 'day', '6 hour', '3 hour', '1 hour', '15 min' ). If you set it as 'none', the function will ignore automatic gap filling. If you set a single string it will be recycled for all the files.

out_name

optional. String vector with user defined variable(s) column(s) name(s).

sheet

optional. Sheet to read. Either a string vector (the name of a sheet), or an integer vector (the position of the sheet). If neither argument specifies the sheet, defaults to the first sheet. This argument just make sense for:

  • 'aic': you must provide a single name or integer indicating the met-station to read.

  • 'dgi': just keep it as NULL.

  • 'mnemos': just keep it as NULL.

Value

A hydromet_station object with the required data loaded inside.

Functions

  • hm_build(hydromet_station): build method for hydromet station object

Examples

## Not run: 
# path to all example files
path <- system.file('extdata', package = 'hydrotoolbox')

# ianigla file
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)' )
          ) %>%
          hm_show()

# cr2 file
hm_create() %>%
  hm_build(bureau = 'cr2', path = path,
           file_name = 'cr2_tmax_yeso_embalse.csv',
           slot_name = c('tmax'),
           by = 'day',
           out_name = c('tair(°C)' )
          )  %>%
          hm_show()

# dgi file
hm_create() %>%
  hm_build(bureau = 'dgi', path = path,
           file_name = 'dgi_toscas.xlsx',
           slot_name = c('swe', 'tmax',
           'tmin', 'tmean', 'rh', 'patm'),
           by = 'day' ) %>%
          hm_show()

# snih file
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') ) %>%
          hm_show()

# aic    => you have to request for this files to AIC.

# mnemos => the data are the same of snih but generated
#           with MNEMOSIII software.

## End(Not run)


hydrotoolbox documentation built on April 14, 2023, 12:34 a.m.