prep_conv_table: prep_conv_table: Prepares conversion table to calculate water...

View source: R/prep_conv_table.R

prep_conv_tableR Documentation

prep_conv_table: Prepares conversion table to calculate water level relative to the wetland surface

Description

This function pulls in the spring and fall visit data and the water level data from the NETN RAM database to create a table that is used by the compile_sent_WL() function to calculate water level relative to the wetland surface. Only works for a year at a time and for the growing season only. Because well visits are staggered, the fall BARO reading may not exist for the hour that the field water level measurement was taken. This function accounts for that by taking the last logged BARO measurement and using that for the correction factor. If the field measurement and the logged measurement are more than 2 hours apart, you will receive a warning. This function only works correctly for the most recent growing season of data. Must have a the NETN RAM backend database named "RAM_BE" as a DSN. Function is primarily for internal use.

Usage

prep_conv_table(
  path = NA,
  year = as.numeric(format(Sys.Date(), "%Y")),
  visits = c("both", "spring", "fall"),
  export = TRUE,
  quietly = FALSE
)

Arguments

path

Quoted path of the folder where the output will be saved

year

Numeric. The year you are preparing the data for. Function will only run 1 year at a time.

visits

both, spring, fall

"both"

The default. If selected, the correction factor will be an average of the spring and fall visit.

"spring"

The correction factor will only be derived from the spring visit.

"fall"

The correction factor will only be derived from the fall visit. Use this option if wells were reset during the spring visit and had not acclimated.

export

TRUE or FALSE. Export csv file to specified path. Defaults to TRUE.

quietly

TRUE or FALSE. If FALSE, code will not print progress into console. Defaults to FALSE

Value

Returns a data frame with visit times, site, ground height, and correction factor

Examples

## Not run: 
# Create conversion table for fall-only data
dir = c('C:/Water_level_data/growing_season_2019')
conv_tbl_19 <- prep_conv_table(path = dir, year = 2019, visits = "fall", export = TRUE)

# Create conversion table that averages spring and fall visit without
# printing messages in the console or saving output to file.
dir = c('C:/Water_level_data/growing_season_2019')
conv_tbl_19 <- prep_conv_table(path = dir, year = 2019, visits = "both",
                               export = FALSE, quietly = TRUE)

## End(Not run)


KateMMiller/wetlandACAD documentation built on Oct. 22, 2023, 12:29 a.m.