Skip to contents

Identifies the nearest CDEC gage to a lat/lon of interest. This function requires metadata of all CDEC stations of interest. By default, all CDEC stations are used.

Usage

calcNearestCDEC(
  df,
  cdecGPS = deltadata:::cdecStations,
  cdecMetadata = deltadata:::cdecMetadata,
  variable = c("temp", "turbidity", "ec"),
  waterColumn = c("top", "bottom")
)

Arguments

df

A data frame that contains at least the lat/lon of station(s) of interest, named as lat and lon.

cdecGPS

A data frame containing the GPS coordinates of the CDEC gages of interest, as lat and lon.

cdecMetadata

A data frame containing the metadata table of the CDEC gages of interest. This table must match the format provided by the DWR website. It is recommended to use pullMetadataCDEC() to get this data.

variable

The water quality variable of interest. Currently only supports water temperature as temp, turbidity as turbidity, and electro-conductivity as ec. This defaults to water temperature.

waterColumn

Where in the water column should the variable of interest be prioritized? Supports only top and bottom, defaulting to top. For now, top data will be used in the calculation even if you ask for bottom data.

Value

A data frame of the metadata of the closest CDEC station to your point of interest that has data for the variable of interest.

Examples

if (FALSE) { # \dontrun{
df <- data.frame(station = "306", lat = 38.00064, lon = -122.4136)

calcNearestCDEC(df)
} # }