stationMeta: Utility for ingesting and filtering station/timeseries...

View source: R/stationMeta.R

stationMetaR Documentation

Utility for ingesting and filtering station/timeseries metadata

Description

This script takes a .xlsx document containing metadata and grading information for all WRB time-series, brings it into R as a list of tibbles, and extracts grading information to facilitate the reporting of trend analyses. It can prepare a data.frame containing information to fetch data from Aquarius, the Snow Survey and EQWin Access databases, ECCC, and a user-specified workbook or prepare a list of tibbles containing metadata for the time-series meeting the minGrade specification.

Usage

stationMeta(
  path,
  colList = c("Site name", "Location identifier", "TS name", "Start date", "End date",
    "Data location", "Latitude", "Longitude", "GRADE length", "GRADE gaps",
    "GRADE disturbance", "GRADE data quality", "GRADE final score"),
  gradeColumn = "GRADE final score",
  gradeRange = NULL,
  Active_or_Inactive = "Y",
  product = "data.table",
  ignore.tabs = c("README", "Parameter codes for WQN", "Filter and Grade all sites")
)

Arguments

path

The path to the Excel workbook containing station/time-series metadata, as a character vector.

colList

The list of columns you wish to include in the final output, as a character vector. Defaults to all columns yielding useful station metadata.

gradeColumn

The column containing grade information to use as a filter with gradeRange.

gradeRange

NULL or a numeric vector of length 2, as in c(4,6). Default NULL returns all regardless of grade, specifying a range returns only the time-series with a GRADE final score value within the (inclusive) range.

Active_or_Inactive

input "Y" if you wish to retain only rows with Y in the Active (Y/N) column, "N" for the alternative case

product

Specify "data.table" or "list", depending on if you want a single data.frame or a list of tibbles. The single data.frame will be formatted for input to the tsFetch and other package functions for trend analysis, while the list of tibbles will contain a list element for each tab in the Excel workbook. In either case the tabs specified in ignore.tabs will not be included.

ignore.tabs

The name(s) of tabs to ignore in the Excel workbook, as a character vector.

Value

A data.table ready for input to the tsFetch function (can be used for other purposes), or a list of tibbles. Both outputs contain the same information but in a different form.


YukonWRB/WRBTrends documentation built on Oct. 26, 2022, 6:36 a.m.