tmdl_update: Update TMDL tables with new or revised information

View source: R/tmdl_update.R

tmdl_updateR Documentation

Update TMDL tables with new or revised information

Description

Imports TMDL information from DEQ's TMDL database template and GIS shapefiles; and add the new or revised the information to the odeqtmdl package tables. To run this function the xlsx template and/or the parameter/pollutant pair GIS files must be completed.

Usage

tmdl_update(
  action_ids = NULL,
  xlsx_template,
  gis_path,
  package_path,
  update_tables = TRUE,
  update_reaches = TRUE
)

Arguments

action_ids

vector of TMDL action IDs to update. Required.

xlsx_template

The path including file name of the TMDL excel template.

gis_path

Path to the directory that holds the TMDL GIS shapefiles. The GIS shapefiles can be in a subdirctory. The function completes a recursive search using list.files. The GIS files must be ESRI shapefiles and named in the following way:

  • NHD reaches: 'action_[action_id]_[parameter]_[pollutant]_NHD'

  • AU Flowlines: 'action_[action_id]_[parameter]_[pollutant]_AU_Flowline'

  • AU Waterbodies: 'action_[action_id]_[parameter]_[pollutant]_AU_WB'

where, action_id, parameter, and pollutant are user supplied.

package_path

Path to the top level directory of the odeqtmdl R package. The 'data', data_raw', and 'inst/extdata' folders must exist.

update_tables

logical. If TRUE, updates the following package tables:

  • tmdl_actions

  • tmdl_parameters

  • tmdl_geo_id

  • tmdl_targets

  • tmdl_wqstd

update_reaches

logical. if TRUE, imports GIS files and updates the following package tables:

  • tmdl_reaches

  • tmdl_au

  • tmdl_au_gnis

Details

Updates are made to the existing package tables by first removing all rows with the same 'action_id' identified in action_ids. The new information from the xlsx_template and any GIS files are then added to the package tables. There is no filtering for specific parameters or pollutants. All information attributed to the action_id is removed before being replaced, so all information attributed to the action must be included in the xlsx_template.


donco/odeqtmdl documentation built on Feb. 7, 2025, 9:54 p.m.