get_var: get variable from a GLM simulation

View source: R/get_var.R

get_varR Documentation

get variable from a GLM simulation

Description

Creates a data.frame with DateTime and variable
Variable is sampled out of the GLM output and is taken relative to the surface (reference = 'surface') or the bottom of the lake (reference = 'bottom').

Usage

get_var(
  file = "output.nc",
  var_name,
  reference = "bottom",
  z_out = NULL,
  t_out = NULL,
  ...
)

Arguments

file

a string with the path to the netcdf output from GLM

var_name

a name of a valid variable in the netcdf file specified with file.

reference

a string which specifies the vertical reference ('surface' or 'bottom'). (Only used for variables with multiple depths)

z_out

an optional vector of depths for value output (in meters). (Only used for variables with multiple depths). If NULL, depths will be determined based on the depth of the lake

t_out

a vector of POSIXct dates for temporal resampling (order is important)

...

additional arguments passed to resample_sim()

Value

a data.frame with DateTime and variable at depth

Author(s)

Jordan S. Read, Luke A. Winslow

See Also

get_temp, plot_var

Examples

sim_folder <- run_example_sim(verbose = FALSE)
nc_file <- file.path(sim_folder, 'output/output.nc')
# list variables in the netcdf output from GLM:
print(sim_vars(nc_file))
evaporation <- get_var(nc_file, var_name = "evap")
plot(evaporation)

USGS-R/glmtools documentation built on March 26, 2024, 5:43 p.m.