get_temp: get water temperatures from a GLM simulation

View source: R/get_temp.R

get_tempR Documentation

get water temperatures from a GLM simulation

Description

Creates a data.frame with DateTime and temperatures (in deg C).
Temperatures that are sampled out of the GLM output are taken relative to the surface (reference = 'surface') or the bottom of the lake (reference = 'bottom').

Usage

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

Arguments

file

a string with the path to the netcdf output from GLM

reference

a string which specifies the vertical reference ('surface' or 'bottom')

z_out

an optional vector of depths for temperature output (in meters). 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 temperature at depth

Author(s)

Jordan S. Read, Luke A. Winslow

See Also

resample_sim

Examples

sim_folder <- run_example_sim(verbose = FALSE)
nc_file <- file.path(sim_folder, 'output/output.nc')
temp_surf <- get_temp(nc_file, reference = 'surface', z_out = c(0,1,2))
temp_bot <- get_temp(nc_file, reference = 'bottom', z_out = c(0,1,2))
temp_bot <- get_temp(nc_file)

#-- get temporal subset--
t_out <- seq(as.POSIXct("2015-04-15"), as.POSIXct("2015-06-01"), by = 86400)
temp_surf <- get_temp(nc_file, reference = 'surface', z_out = 0, t_out = t_out)
plot(temp_surf)

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