(03) MNEMOS generated-data

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(hydrotoolbox)

MNEMOS generated data

Esta viñeta ejemplifica el uso del paquete para los datos generados por el software MNEMOS. Dichos registros provienen de la base de datos del SNIH, por lo que la única diferencia radica en el formato de presentación de las series.


This vignette exemplifies the use of the package for the data generated by the software MNEMOS. These records come from the SNIH database, so the only difference lies in the presentation format of the series.

Reading individual files

El formato de salida del software MNEMOS es el de una planilla excel que en sus pestañas contiene las distintas variables que registra una estación hidro-meteorológica.


The output format of the MNEMOS software is that of an excel spreadsheet that in its sheets it contains the different variables recorded by a hydro-meteorological station.

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

# as we can have multiple sheets, we can get an idea of its content
read_mnemos(path = path, get_sheet = TRUE)

# suppose that we want to read the daily minimum temperature
tmax_guido <- read_mnemos(path = path, by = 'day',
                          out_name = 'tmax(ºC)', sheet = '11413-017')

plot(x = tmax_guido[ , 1], y = tmax_guido[ , 2],
     col = 'dodgerblue', type = 'l', 
     xlab = 'date', ylab = 'Tmin(ºC)')

Si bien esta función resulta de gran utilidad, a medida que la cantidad de variables a analizar crece, cargar estas tablas, ordenarlas y modificarlas, se vuelve tarea complicada. La solución que ofrece hydrotoolbox es la de trabajar con los objetos y métodos que el paquete provee. En las siguientes secciones muestro cómo usarlos.


Although this function is very useful, as the number of variables to be analyzed grows, loading these tables, ordering and modifying them becomes a complicated task. The solution that hydrotoolbox offers is to work with the objects and methods that the package provides. In the following sections I will show you how to use them.

Using classes and methods to build a meteorological station

Como menciono en los principios de diseño de este paquete (vignette('package_overview', package = 'hydrotoolbox')), los datos que se registran en las estaciones deben almacenarse en un mismo objeto. Por ello primero habrá que crear dicho objeto (o estación hidro-meteorológica) y luego usar hm_build(), un método que permite cargar automáticamente al objeto todas las variables que la estación real registra.


As I mentioned in the design principles of this package (vignette ('package_overview', package = 'hydrotoolbox')), the data that is recorded in the stations must be stored in the same object. For this reason, you must first create the object (or hydro-meteorological station) and then use hm_build(), a method that allows you to automatically load all variables to the object that the real world station records.

# in this path you will find the raw example data 
path <- system.file('extdata', package = 'hydrotoolbox')

list.files(path)

# we load in a single object (hydromet_station class)
# the streamflow and water height series
guido <- 
  hm_create() %>% # create the met-station
  hm_build(bureau = 'mnemos', path = path,
           file_name = 'mnemos_guido.xlsx',
           slot_name = c('qd', 'evap', 'tair',
                         'tmax', 'tmin', 'wspd'),
           by = c('day', 'day', '6 hour', 
                  'day', 'day', '6 hour'), 
           out_name = c('qd(m3/s)', 'e(mm/d)', 'tdb(ºC)',
                        'tmax(ºC)', 'tmin(ºC)', 'w(km/h)') ) 

# we can explore the data-set inside it by using hm_show
guido %>% hm_show()

Dado que la función constructora es la única que difiere de lo desarrollado para los datos del SNIH, recomiendo (re)visitar esta viñeta (vignette('snih_arg', package = 'hydrotoolbox'))


Since the constructor function is the only one that differs from what was developed for SNIH data, I recommend (re)visiting this vignette (vignette ('snih_arg', package = 'hydrotoolbox'))



Try the hydrotoolbox package in your browser

Any scripts or data that you put into this service are public.

hydrotoolbox documentation built on July 9, 2021, 1:06 a.m.