Skip to contents

Imports a table of available parameters, period of record, and count. See https://waterservices.usgs.gov/docs/site-service/ for more information.

Usage

whatNWISdata(..., convertType = TRUE)

Arguments

...

see https://waterservices.usgs.gov/docs/site-service/ for a complete list of options. A list of arguments can also be supplied.

convertType

logical, defaults to TRUE. If TRUE, the function will convert the data to dates, datetimes, numerics based on a standard algorithm. If false, everything is returned as a character

Value

A data frame with the following columns:

NameTypeDescription
agency_cdcharacterThe NWIS code for the agency reporting the data
site_nocharacterThe USGS site number
station_nmcharacterSite name
site_tp_cdcharacterSite type
dec_lat_vanumericDecimal latitude
dec_long_vanumericDecimal longitude
coord_acy_cdcharacterLatitude-longitude accuracy
dec_coord_datum_cdcharacterDecimal Latitude-longitude datum
alt_vacharacterAltitude of Gage or land surface
alt_acy_vacharacterAltitude accuracy
alt_datum_cdcharacterAltitude datum
huc_cdcharacterHydrologic unit code
data_type_cdcharacterData type
parm_cdcharacterParameter code
stat_cdcharacterStatistical code
dd_nucharacterInternal database key
loc_web_dscharacterAdditional measurement description
medium_grp_cdcharacterMedium group code
parm_grp_cdcharacterParameter group code
srs_idcharacterSRS ID
access_cdcharacterAccess code
begin_dateDateBegin date
end_dateDateEnd date
count_nuintegerRecord count
parameter_group_nmcharacterParameter group name
parameter_nmcharacterParameter name
casrncharacterChemical Abstracts Service (CAS) Registry Number
srsnamecharacterSubstance Registry Services
parameter_unitscharacterParameter units

There are also several useful attributes attached to the data frame:

NameTypeDescription
urlcharacterThe url used to generate the data
commentcharacterHeader comments from the RDB file
queryTimePOSIXctThe time the data was returned

Details

This function requires users to create their own arguments based on the NWIS web services. It is a more complicated function to use compared to other NWIS functions such as readNWISdv, readNWISuv, etc. However, this function adds a lot of flexibility to the possible queries. If the "service" argument is included, the results will be filtered to the proper data_type_cd. This is a great function to use before a large data set, by filtering down the number of sites that have useful data.

Examples

# \donttest{

availableData <- whatNWISdata(siteNumber = "05114000")
#> WARNING: NWIS does not deliver
#> discrete water quality data newer than March 11, 2024
#> or updates to existing data. For additional details, see:
#> https://doi-usgs.github.io/dataRetrieval/articles/Status.html

# To find just unit value ('instantaneous') data:
uvData <- whatNWISdata(siteNumber = "05114000",
                       service = "uv")
uvDataMulti <- whatNWISdata(siteNumber = c("05114000", "09423350"),
                            service = c("uv", "dv"))
flowAndTemp <- whatNWISdata(
  stateCd = "WI", service = "uv",
  parameterCd = c("00060", "00010"),
  statCd = "00003"
)
sites <- whatNWISdata(stateCd = "WI",
                      parameterCd = "00060",
                      siteType = "ST", 
                      service = "site")
#> WARNING: NWIS does not deliver
#> discrete water quality data newer than March 11, 2024
#> or updates to existing data. For additional details, see:
#> https://doi-usgs.github.io/dataRetrieval/articles/Status.html
# }