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

Test RMevents_sko on test data #32

Closed limnoliver closed 6 years ago

limnoliver commented 6 years ago

Can't compare to RMevents because we think it was making wrong calculation. Just manually test RMevents_sko is giving you back what you think it should. @rbcarvin

rbcarvin commented 6 years ago

I tested RMevents_sko and it passes!

#'RM_Events_SKO Testing
#'
#'The RMprep function is also required to run this test.
#'Test:
#'use the RMevents_Test.csv file stored in ./data
#'1. Step through the function using ieHr = 2 AND rainthresh = 0.008 and check if it returns the correct answers as compared to RMevents_Test_answers.csv (this file is also in ./data).
#'2. Run the entire function with defaults. Should return a list with 0 obs of 4 variables.
#'3. Run the entire function with rainthresh = 0.008. Should return a list with 4 obs of 4 variables.
#'4. Run the entire function with ieHr = 2 AND rainthresh = 0.008. Should return a list that matches RMevents_Test_answers.csv

precip_raw <- read.csv(file = "RMevents_Test.csv",sep = ",",col.names = c("Event", "DATE", "TIME", "rain"))
precip_prep <- RMprep(df=precip_raw,prep.type = 1,date.type = 3,tz="America/Chicago")
df<- precip_prep

precip_events <- RMevents_sko(df=precip_prep,ieHr = 2, rainthresh = 0.008)
test_result_list <- precip_events$storms2
limnoliver commented 6 years ago

Ok for now - will test the package more robustly including this function.