Learn R Programming

DWBmodelUN (version 1.0.0)

printVar: Print or write variables of interest

Description

This function allows to print or write some of the variables simulated by the DWB model.

Usage

printVar(variable, coor_cells, var_name, coord_sys, dates, as, path_var = "")

Arguments

variable

corresponds to the results of a specific variable of the DWBCalculator.

coor_cells

coordinates of the cells in the same order that were simulated and that will be used to create the results in raster format, this is done from the data frames which contain the simulated results

var_name

name of the variable that will be printed (e.g., q_total, aet, r, qd, qb, s, g)

coord_sys

geographic or projected coordinate system.

dates

dates that were simulated.

as

option to print the results as independent 'raster' (.tif) or in a 'NetCDF' file (.nc).

path_var

path of the directory where one wants to print the files

Value

It saves in a folder previously created a set of raster files with the results of the variable of interest.

Examples

Run this code
# NOT RUN {
data(sogamoso)
dwb_results <- sogamoso$dwb_results
data(cells)
dates <- seq(as.Date("2001-01-01"), as.Date("2010-12-01"), by="month")
coord_sys <- "+init=epsg:4326"
r <- dwb_results[[3]][,1:20]
printVar(r, cells, var_name = "r", coord_sys, dates, as = "NetCDF", path_var = tempdir())

# }

Run the code above in your browser using DataLab