Feature Identification

The NWM reanalysis product is indexed by feature ID. Identifying ID’s is not always easy. nwmHistoric provides tools to identify NHD and NWIS IDs using spatial constraints.

Finding NWIS gages

Analogous functionality for finding USGS NWIS site IDs is provided with discover_nwis. This function only returns NWIS sites that record streamflow (USGS parameter code ‘00060’) and are collocated with an NHD catchment represented in the NWM.

(nwis = discover_nwis(AOI))
#> Error in discover_nwis(AOI): No gages found in this AOI.

Geometric Discovery

The NHDPlusV2 data model loosely conforms to the HY_Features Conceptual Model with a mapping shared here. nwmHistoric extends the ability of discover_nhd to retrieve catchment-divide, flowline, and outlet represnetations of a COMID.

# Return catchments
catch = discover_nhd(AOI, feature = "catchment")

# Return flowlines
fl    = discover_nhd(AOI, feature = "flowline")

# Return outlets
out   = discover_nhd(AOI, feature = "outlet")
#> Error in fortify(data): object 'nwis' not found

Putting it all together

Lets look at one integrative example. The aim is to identify a self-contained (e.g watershed) catchment and extract reanalysis records along the mainstem for 2015. The nhdplusTools package provides an interface to the Network Linked Data Index which allow users to define a starting point (as a USGS siteID or NHDPlus COMID), and traverse the hydrographic network to find the upstream (or downstream) geometries and indexed elements.

Here we use the NLDI to trace the upstream network and the nwmHistoric to extract the relevant streamflow forecasts.

library(nhdplusTools)

# Start with a nwis site ID
nldi_feature <- list("nwissite", "USGS-05428500")

# Find the Upper Mainstem
um <- navigate_nldi(nldi_feature, mode = "UM")

# Find 2015 Flows along the Mainstem
nldi_flows <- readNWMdata(comid = um$nhdplus_comid,
                          startDate = "2015-01-01",
                          endDate   = "2015-12-31")

# For visualization we also retrieve the upper tributary and basin boundary 
ut    <-  navigate_nldi(nldi_feature, mode = "UT")
basin <-  get_nldi_basin(nldi_feature)