read_dgi: Reads data from Departamento General de Irrigación -...

View source: R/ff_read_dgi.R

read_dgiR Documentation

Reads data from Departamento General de Irrigación - Hydrological Division (DGI - Mendoza - Argentina)


Reads excel files provided by the DGI (Hydrological Division).


read_dgi(path, by = "day", out_name = NULL, sheet = NULL, get_sheet = FALSE)



path to the xlsx file.


string with the time step of the series (e.g.: 'month', 'day', '6 hour', '3 hour', '1 hour', '15 min' ). By default this argument is set to 'day'. If you set it as 'none', the function will ignore automatic gap filling.


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


optional. Sheet to read. Either a string (the name of a sheet), or an integer (the position of the sheet). If neither argument specifies the sheet, defaults to the first sheet.


logical indicating whether you want to print available sheet names (TRUE) in the file or not.


A data frame with the data inside the xlsx file. Gaps between dates are filled with NA_real_ and duplicated rows are eliminated automatically.


# set path to file
path_file <- system.file('extdata', 'dgi_toscas.xlsx',
             package = 'hydrotoolbox')

# because dgi files has multiple sheets we take a look
# on them
read_dgi(path = path_file, get_sheet = TRUE)

# read swe with default column names
head( read_dgi(path = path_file, sheet = 'swe') )

# assign name
head( read_dgi(path = path_file, sheet = 'swe', out_name = 'swe(mm)') )

# now read relative humidity
head( read_dgi(path = path_file, sheet = 'hr', out_name = 'rh(%)') )

hydrotoolbox documentation built on Oct. 25, 2022, 1:05 a.m.