Reads peak flow from NWISweb.
Usage
readNWISpeak(
siteNumbers,
startDate = "",
endDate = "",
asDateTime = TRUE,
convertType = TRUE,
override_error = FALSE
)Arguments
- siteNumbers
character USGS site number(or multiple sites). This is usually an 8 digit number.
- startDate
character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates retrieval for the earliest possible record.
- endDate
character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates retrieval for the latest possible record.
- asDateTime
logical default to
TRUE. WhenTRUE, the peak_dt column is converted to a Date object, and incomplete dates are removed. WhenFALSE, no columns are removed, but no dates are converted.- convertType
logical, defaults to
TRUE. IfTRUE, the function will convert the data to dates, datetimes, numerics based on a standard algorithm. If false, everything is returned as a character- override_error
Logical parameter that allows users to run this function during the final stages of NWIS decommission. NWIS servers will be taken offline February 22nd, 2027. Setting this parameter to
TRUEshould only be used as a tool to convert readNWIS to read_waterdata functions.
Value
A data frame with the following columns:
| Name | Type | Description |
| agency_cd | character | The NWIS code for the agency reporting the data |
| site_no | character | The USGS site number |
| peak_dt | Date | Date of peak streamflow |
| peak_tm | character | Time of peak streamflow as character |
| peak_va | numeric | Annual peak streamflow value in cfs |
| peak_cd | character | Peak Discharge-Qualification codes (see comment
for more information) |
| gage_ht | numeric | Gage height for the associated peak streamflow in feet |
| gage_ht_cd | character | Gage height qualification codes |
| year_last_pk | numeric | Peak streamflow reported is the highest since this year |
| ag_dt | Date | Date of maximum gage-height for water year (if not concurrent with peak) |
| ag_tm | character | Time of maximum gage-height for water year (if not concurrent with peak) |
| ag_gage_ht | numeric | maximum Gage height for water year in feet (if not concurrent with peak) |
| ag_gage_ht_cd | character | maximum Gage height code |
There are also several useful attributes attached to the data frame:
| Name | Type | Description |
| url | character | The url used to generate the data |
| queryTime | POSIXct | The time the data was returned |
| comment | character | Header comments from the RDB file |
| siteInfo | data.frame | A data frame containing information on the requested sites |
Details
In some cases, the specific date of the peak data is not know. This function
will default to
converting complete dates to a "Date" object, and converting incomplete dates to
"NA". If those incomplete dates are
needed, set the asDateTime argument to FALSE. No dates will be converted to
R Date objects.
