View source: R/loadAndExtract.R
extractHydroVars | R Documentation |
Given an input dataframe with site locations, dates, hours, and depths, this function extracts the corresponding WeStCOMS data. Output can be specific hours and depths, or summarised for the day or water column (surface to depth *d*) as given in 'daySummaryFn' and 'depthSummaryFn'.
extractHydroVars(
sampling.df,
westcoms.dir,
hydroVars,
daySummaryFn = NULL,
depthSummaryFn = NULL,
regional = F,
sep = "/",
cores = 1,
progress = T,
errorhandling = "remove",
returnFullDf = FALSE
)
sampling.df |
Dataframe with a row for each sample. Columns must include 'site.id', 'obs.id', 'date' (YYYYMMDD), 'hour', 'depth', 'grid', 'site.elem', 'trinode_1', 'trinode_2', and 'trinode_3', which can be added through a spatial join with the mesh files (see vignette) |
westcoms.dir |
Character vector with directories for WeStCOMS v1 and WeStCOMS v2 hydrodynamic files |
hydroVars |
Character vector of hydrodynamic variables to extract |
daySummaryFn |
Vector of functions to summarise by day, one per var; if 'NULL' (default), single hour is extracted |
depthSummaryFn |
Vector of functions to summarise across depth, one per var; if 'NULL' (default), single hour is extracted |
regional |
Logical: does sampling.df include rows to calculate regional averages? Requires a row for each element to average for each site. For example, a row for each element within a 1km radius, with the results averaged |
sep |
Directory separation character (Windows: '\', Unix: '/') |
cores |
Number of cores for extracting in parallel; default is 1 |
progress |
Logical: Show progress bar? |
errorhandling |
Passed to 'foreach': one of "stop", "remove", or "pass" |
returnFullDf |
Logical: return full dataframe or only obs.id + hydrovars? |
dataframe with site.id, date, and hydrodynamic variables
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.