-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_streamflow.R
More file actions
19 lines (16 loc) · 1.17 KB
/
get_streamflow.R
File metadata and controls
19 lines (16 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#Retrieves streamflow data from NWIS using dataRetrieval package and NWIS web services
ProvoSpringFlow <- mean(readNWISdata(sites="10163000", service="iv",
parameterCd="00060",
startDate=paste(currentyear,"03-01",sep="-"),endDate=paste(currentyear,"06-01",sep="-"))$X_00060_00000,na.rm=T)
SFSpringFlow <- mean(readNWISdata(sites="10150500", service="iv",
parameterCd="00060",
startDate="2018-03-01",endDate="2018-6-1")$X_00060_00000,na.rm=T)
TotalUtahLakeStreamFlow <- round(ProvoSpringFlow+SFSpringFlow,0)
#Categorize values to match the classes set in the model
if(TotalUtahLakeStreamFlow < varthresholds[(varthresholds$Parameter=="SpringQ"),"ThresholdValue"] & TotalUtahLakeStreamFlow>0){
utahlakeSpringQ <- varthresholds[(varthresholds$Parameter=="SpringQ"),"BelowThresholdValue"]
}else if(TotalUtahLakeStreamFlow >= varthresholds[(varthresholds$Parameter=="SpringQ"),"ThresholdValue"] & TotalUtahLakeStreamFlow>0){
utahlakeSpringQ<- varthresholds[(varthresholds$Parameter=="SpringQ"),"AboveThresholdValue"]
}else {
utahlakeSpringQ <- NULL
}