get_site_coords: Pull the latitude and longitude of a site from ScienceBase

View source: R/get_site_coords.R

get_site_coordsR Documentation

Pull the latitude and longitude of a site from ScienceBase

Description

Pull the latitude and longitude of a site from ScienceBase

Usage

get_site_coords(site_names, format = c("normal", "geoknife"),
  on_missing = c("NA", "omit"), out = c("site_name", "lat", "lon"),
  use_basedon = FALSE, attach.units = (format == "normal"))

Arguments

site_names

a list of site names such as those returned from make_site_name()

format

character specifying the desired output format. normal is a human-readable, dplyr-friendly format. geoknife works well for geoknife and excludes sites with incomplete coordinate data.

on_missing

character specifying how to treat missing sites. Use "NA" to include missing sites in the output but with NA for both lon and lat. Use "omit" to omit those sites from the output.

out

vector of column names to include in the output; only honored if format=='normal'

use_basedon

logical. If TRUE, and if there are sites among site_names that have NA in their lat or lon fields but also have a character value in their styx.basedon metadata field, then lat and lon will be pulled from the site named in styx.basedon. use_basedon=TRUE is appropriate primarily for styx sites (those with simulated data, whose initial data are based on some real site) and so use_basedon=FALSE by default.

attach.units

logical. Should units be attached?

Value

a data.frame of site names and coordinates, with units if attach.units=TRUE, or a matrix if format='geoknife'

Examples

get_site_coords(c("nwis_01467200","nwis_351111089512501","nwis_07239450")) 
get_site_coords(c("styx_001001","nwis_07239450"), use_basedon=TRUE) 
get_site_coords(c("nwis_01467200","nwis_09327000","nwis_351111089512501",
    "styx_000001001"), format="geoknife")

USGS-R/mda.streams documentation built on June 3, 2023, 8:43 a.m.