header_tag.html

Skip to contents

USGS's National Water Availability Assessment Data Companion (NWDC) offers web services that provide access to national-scale USGS modeled water availability data underlying the National Water Availability Assessment. More information at https://water.usgs.gov/nwaa-data.

Usage

read_wateruse(
  model = NA_character_,
  variable = NA_character_,
  location = NA_character_,
  timeres = NA_character_,
  startdate = NA_character_,
  enddate = NA_character_,
  intersection = "overlap",
  limit = 500,
  attach_request = getOption("dataRetrieval.attach_request")
)

Arguments

model

See model IDs on the NWDC data catalog page. Options are : "wu-public-supply-wd", "wu-thermoelectric", "wu-irrigation-cu", "wu-irrigation-wd", and "wu-public-supply-cu" https://water.usgs.gov/nwaa-data/data-catalog

variable

See variable IDs on the NWDC data catalog page.

location

Options : huc12, huc10, huc8, huc6, huc4, huc2, countyCd, stateCd Locations can be visualized with the Spatial Extent Viewer. Only one location can be queried at a time. All data are returned on a HUC12 spatial resolution. When a queried location contains more than the maximum number of HUC12s allowed per page or file (defined under limit below), multiple pages or files will be returned. All huc12, huc10, and countyCd location queries return a single page or file. All huc2 location queries return multiple pages or files. All other (huc8, huc6, huc4, stateCd) location queries may or may not return multiple pages or files, depending on their size.

timeres

Options : monthly, annualcy, annualwy.

startdate

Format : YYYY (for annual data) or YYYY-MM (for monthly data)

enddate

Format : YYYY (for annual data) or YYYY-MM (for monthly data)

intersection

Options : overlap, envelop

limit

Defines the number of HUC12s returned per page or file. Queries of locations containing more than the below maximum value of HUC12s will return multiple pages or files (see location above for details).

attach_request

logical, defaults to TRUE. If set to TRUE, the full request sent to the Water Data API is attached as an attribute to the data set.

Examples


# \donttest{
wu1 <- read_wateruse(model = "wu-public-supply-wd",
                     variable = c("pswdtot", "pswdgw", "pswdsw"),
                     location = "stateCd:RI",
                     startdate = "2020-01",
                     timeres = "monthly")
#> Requesting:
#> https://api.water.usgs.gov/nwaa-data/data?format=csv&model=wu-public-supply-wd&variable=pswdtot,pswdgw,pswdsw&location=stateCd%3ARI&timeres=monthly&startdate=2020-01&intersection=overlap&limit=500
                               
wu2 <- read_wateruse(model = "wu-thermoelectric",
                     variable = c('tecufgw', 'tecufsw', 'tecuftot',
                                  'tewdfgw', 'tewdfsw', 'tewdftot',
                                  'tewdssw'),
                     location = "stateCd:RI",
                     startdate = "2020-01",
                     timeres = "monthly")
#> Requesting:
#> https://api.water.usgs.gov/nwaa-data/data?format=csv&model=wu-thermoelectric&variable=tecufgw,tecufsw,tecuftot,tewdfgw,tewdfsw,tewdftot,tewdssw&location=stateCd%3ARI&timeres=monthly&startdate=2020-01&intersection=overlap&limit=500

wu3 <- read_wateruse(model = "wu-irrigation-cu",
                     variable = "irrcutot",
                     location = "stateCd:WI",
                     startdate = "2020-01",
                     timeres = "monthly")
#> Requesting:
#> https://api.water.usgs.gov/nwaa-data/data?format=csv&model=wu-irrigation-cu&variable=irrcutot&location=stateCd%3AWI&timeres=monthly&startdate=2020-01&intersection=overlap&limit=500
#> ⠙ iterating 1 done (0.46/s) | 2.2s
#> ⠹ iterating 2 done (0.39/s) | 5.1s
#> ⠸ iterating 3 done (0.38/s) | 7.9s
#> ⠼ iterating 4 done (0.39/s) | 10.3s

wu4 <- read_wateruse(model = "wu-irrigation-wd",
                     variable = c("irrwdtot", "irrwdgw", "irrwdsw"),
                     location = "huc2:04",
                     startdate = "2015",
                     timeres = "annualcy")
#> Requesting:
#> https://api.water.usgs.gov/nwaa-data/data?format=csv&model=wu-irrigation-wd&variable=irrwdtot,irrwdgw,irrwdsw&location=huc2%3A04&timeres=annualcy&startdate=2015&intersection=overlap&limit=500
#> ⠙ iterating 2 done (0.95/s) | 2.1s
#> ⠹ iterating 4 done (0.94/s) | 4.2s
#> ⠸ iterating 7 done (0.96/s) | 7.3s
#> ⠸ iterating 9 done (1/s) | 8.6s
         
wu5 <- read_wateruse(model = "wu-public-supply-cu",
                     variable = "pscutot",
                     location = "stateCd:WI",
                     startdate = "2020",
                     timeres = "annualwy")
#> Requesting:
#> https://api.water.usgs.gov/nwaa-data/data?format=csv&model=wu-public-supply-cu&variable=pscutot&location=stateCd%3AWI&timeres=annualwy&startdate=2020&intersection=overlap&limit=500
#> ⠙ iterating 4 done (1.6/s) | 2.5s
# }