USGS-R / Rainmaker

Repo being permanently moved to: https://code.usgs.gov/water/analysis-tools/Rainmaker
https://code.usgs.gov/water/analysis-tools/Rainmaker
Other
18 stars 14 forks source link

RMevents and DataRetrieval #16

Closed rbcarvin closed 7 years ago

rbcarvin commented 7 years ago

Trying to get RMevents to run on data I just pulled from DataRetieval and I am getting the error:

Error in aggregate.data.frame(as.data.frame(x), ...) : no rows to aggregate

#dataRetrieval call:
siteNumber <- "05408480"
parameterCd <- "00045"  # Precipitation
startDate <- "2015-10-01"
endDate <- "2016-09-30"
precip_05408480 <- readNWISuv(siteNumber, parameterCd, startDate, endDate,tz = "America/Chicago")
precip_05408480 <- renameNWISColumns(precip_05408480)
#RMevents function:
ieHr <- 2 
rainthresh <- 0.008
precip_events <- RMevents_sko(df = precip_05408480,ieHr = ieHr,rainthresh = rainthresh,rain = "Precip_Inst",time = "dateTime")
precip_event_list <- precip_events$storms2

from what I can tell, the dateTime column is coming in as POSIXct, so shouldn't need to be changed, and the Precip_Inst values look right too.

rbcarvin commented 7 years ago

@limnoliver

limnoliver commented 7 years ago

@rbcarvin I think I found the issue (column indexing issue). Submitted a pull request that should solve the issue.