Title: | 'Hydropeaking Events Detection Algorithm' |
---|---|
Description: | This tool identifies hydropeaking events from raw time-series flow record, a rapid flow variation induced by the hourly-adjusted electricity market. The novelty of 'HEDA' is to use vector angle instead of the first-order derivative to detect change points which not only largely improves the computing efficiency but also accounts for the rate of change of the flow variation. More details <doi:10.1016/j.jhydrol.2021.126392>. |
Authors: | Tingyu Li [aut, cre], Xiaotian Zou [aut], Gregory Pasternack [aut] |
Maintainer: | Tingyu Li <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.5 |
Built: | 2025-02-11 03:41:29 UTC |
Source: | https://github.com/cran/HEDA |
Evaluate difference between peaking and off-peaking discharge
Clean_conectD(df, alpha3 = 0.7, alpha4 = 0.5)
Clean_conectD(df, alpha3 = 0.7, alpha4 = 0.5)
df |
Dataframe to be processed |
alpha3 |
Default value: 0.7 |
alpha4 |
Default value: 0.5 |
Evaluate whether the difference in discharge between peaking and off-peaking points is qualified to be identified as hydropeaking events.
The output will be a dataframe in the same form with the input.
## Not run: # before running the function HPK_SampleData$dateTime <- parse_date_time(HPK_SampleData$dateTime,"mdy HM") hpk_flow_cln <- HEDA_Tidy(HPK_SampleData, season = c(6,7,8,9)) hpk_flow_cg <- ReversalCount(hpk_flow_cln) hpk_flow_cg <- Clean_position(hpk_flow_cg) hpk_flow_cg <- Clean_Spt(hpk_flow_cg) # clean the unqualified peaking and off-peaking discharge hpk_flow_cg <- Clean_conectD(hpk_flow_cg) # or change the default values hpk_flow_cg <- Clean_conectD(hpk_flow_cg, alpha3 = 0.7, alpha4 = 0.5) ## End(Not run)
## Not run: # before running the function HPK_SampleData$dateTime <- parse_date_time(HPK_SampleData$dateTime,"mdy HM") hpk_flow_cln <- HEDA_Tidy(HPK_SampleData, season = c(6,7,8,9)) hpk_flow_cg <- ReversalCount(hpk_flow_cln) hpk_flow_cg <- Clean_position(hpk_flow_cg) hpk_flow_cg <- Clean_Spt(hpk_flow_cg) # clean the unqualified peaking and off-peaking discharge hpk_flow_cg <- Clean_conectD(hpk_flow_cg) # or change the default values hpk_flow_cg <- Clean_conectD(hpk_flow_cg, alpha3 = 0.7, alpha4 = 0.5) ## End(Not run)
Change points are excluded if they are in the wrong position. For example, both point 3 and the peak pair represent the peaking discharge whose value (position) should be close to the daily maximum discharge. If the peaking discharge is close to the daily minimum discharge, change points will be removed since they are in the wrong positions
Clean_position(df, alpha2 = 0.3)
Clean_position(df, alpha2 = 0.3)
df |
dataframe to be processed |
alpha2 |
Default value : 0.3 |
output will be a dataframe in the same form as the input
# before running the function HPK_SampleData$dateTime <- parse_date_time(HPK_SampleData$dateTime,"mdy HM") hpk_flow_cln <- HEDA_Tidy(HPK_SampleData, season = c(6,7,8,9)) hpk_flow_cg <- ReversalCount(hpk_flow_cln) # running the function to clean unqualified change points hpk_flow_cg <- Clean_position(hpk_flow_cg) # default value is open to change hpk_flow_cg <- Clean_position(hpk_flow_cg, alpha2 = 0.3)
# before running the function HPK_SampleData$dateTime <- parse_date_time(HPK_SampleData$dateTime,"mdy HM") hpk_flow_cln <- HEDA_Tidy(HPK_SampleData, season = c(6,7,8,9)) hpk_flow_cg <- ReversalCount(hpk_flow_cln) # running the function to clean unqualified change points hpk_flow_cg <- Clean_position(hpk_flow_cg) # default value is open to change hpk_flow_cg <- Clean_position(hpk_flow_cg, alpha2 = 0.3)
Clean repeated points
Clean_Spt(df, alpha3 = 0.7, alpha4 = 0.5)
Clean_Spt(df, alpha3 = 0.7, alpha4 = 0.5)
df |
Dataframe to be processed |
alpha3 |
Default value: 0.7 |
alpha4 |
Default value: 0.5 |
Evaluate whether the difference in discharge between peaking and off-peaking points is qualified to be identified as hydropeaking events
Output file will be a dataframe in the same form as the input
# before running the function HPK_SampleData$dateTime <- parse_date_time(HPK_SampleData$dateTime,"mdy HM") hpk_flow_cln <- HEDA_Tidy(HPK_SampleData, season = c(6,7,8,9)) hpk_flow_cg <- ReversalCount(hpk_flow_cln) hpk_flow_cg <- Clean_position(hpk_flow_cg) # clean continuous points of the same type hpk_flow_cg <- Clean_Spt(hpk_flow_cg) # or change the default values hpk_flow_cg <- Clean_Spt(hpk_flow_cg, alpha3 = 0.7, alpha4 = 0.5)
# before running the function HPK_SampleData$dateTime <- parse_date_time(HPK_SampleData$dateTime,"mdy HM") hpk_flow_cln <- HEDA_Tidy(HPK_SampleData, season = c(6,7,8,9)) hpk_flow_cg <- ReversalCount(hpk_flow_cln) hpk_flow_cg <- Clean_position(hpk_flow_cg) # clean continuous points of the same type hpk_flow_cg <- Clean_Spt(hpk_flow_cg) # or change the default values hpk_flow_cg <- Clean_Spt(hpk_flow_cg, alpha3 = 0.7, alpha4 = 0.5)
Format flow record into hourly record; Split record by designated season; Interpolate and smooth the record.
HEDA_Tidy(df, season)
HEDA_Tidy(df, season)
df |
Dataframe to be processed |
season |
Subset data by season |
Output dataframe has 4 columns containing location id, datatime, parameter value, ann_thre. ann_thre is originally the mean annual discharge. If flow record is subset by season, ann_thre will be the mean discharge during the subset period
## Not run: # format the time column to time column HPK_Sample_data$dateTime <- parse_date_time(HPK_Sample_data$dateTime,"mdy HM") # clean subset data by season hpk_flow_cln <- HEDA_Tidy(HPK_Sample_data, season = c(6,7,8,9)) ## End(Not run)
## Not run: # format the time column to time column HPK_Sample_data$dateTime <- parse_date_time(HPK_Sample_data$dateTime,"mdy HM") # clean subset data by season hpk_flow_cln <- HEDA_Tidy(HPK_Sample_data, season = c(6,7,8,9)) ## End(Not run)
Extract frequency and magnitude metrics
HPK_frq_mgt(df)
HPK_frq_mgt(df)
df |
Dataframe to be processed |
Extract Qpeak, offQpeak, pk_no and pkraio from the identified hydropeaking events
Output dataframe includes time-series values of four metrics. Qpeak is the hydropeaking discharge, offQpeak isbase flow, pk_no is the daily number of rise and fall process, pkratio is the ratio of days with hydropeaking to thetotal number of days analyzed
## Not run: HpkFrqMgt <- HPK_frq_mgt(hpk_flow_cg) ## End(Not run)
## Not run: HpkFrqMgt <- HPK_frq_mgt(hpk_flow_cg) ## End(Not run)
Plot hydrograph
HPK_plot(df)
HPK_plot(df)
df |
Dataframe to be processed |
Plot the hydrograph of the processed data with change points marked by different colors
The plot will be presented under the “Plots” tab in RStudio. Users can determine whether to save out thediagram by themselves. The plot shows flow in m^3/s
## Not run: ## subset the data tt = hpk_flow_cg[13100:13400,] ## plot the hydrograph of the subset data HPK_plot(tt) ## End(Not run)
## Not run: ## subset the data tt = hpk_flow_cg[13100:13400,] ## plot the hydrograph of the subset data HPK_plot(tt) ## End(Not run)
Extract rate of change and duration related metrics
HPK_rt_dur(df)
HPK_rt_dur(df)
df |
Dataframe to be processed |
Extract rate of chane and duration related metrics: pk_rtn is the retention of peaking process. offpk_rtn is theretention of base flow. D_rampup/D_ramp is the duration of rise/fall process. RB_Indx_up/RB_Index_dw is theflashness of rise/fall process. Ramp_up/Ramp_dw is the rate of change of rise/fall process.Strange_up/Strange_dw is the standardized rise/fall amplitude
Output dataframe includes time-series values of four metrics. Qpeak is the hydropeaking discharge, offQpeak isbase flow, pk_no is the daily number of rise and fall process, pkratio is the ratio of days with hydropeaking to thetotal number of days analyzed
## Not run: HpkRtDur <- HPK_rt_dur(hpk_flow_cg) ## to extract the time-series of one metric withouth missing value pk_rtn <- HpkRtDur[na.omit(HpkRtDur$pk_rtn),c("location_id","datetime","pk_rtn")] ## End(Not run)
## Not run: HpkRtDur <- HPK_rt_dur(hpk_flow_cg) ## to extract the time-series of one metric withouth missing value pk_rtn <- HpkRtDur[na.omit(HpkRtDur$pk_rtn),c("location_id","datetime","pk_rtn")] ## End(Not run)
Flow record of Cherry creek below Dion R Holm Powerhouse
data(HPK_SampleData)
data(HPK_SampleData)
site_no
identification number of gauge station
dataTime
Date and time flow when discharge recorded
dateTime
Date and time discharge recorded
A data frame with 3 columns and 30000 flow records
https://waterdata.usgs.gov/nwis/uv?site_no=11278400
data(HPK_SampleData)
data(HPK_SampleData)
Detect hydropeaking events
ReversalCount(df, alpha1 = 0.03, theta = 60, gamma = 1.1)
ReversalCount(df, alpha1 = 0.03, theta = 60, gamma = 1.1)
df |
Dataframe to be processed |
alpha1 |
Default value : 0.03 |
theta |
Default value : 60 degree for m^3/s, 85 degree for cfs. |
gamma |
gamma default value: 1.1 m/s or 40 cfs. |
Output dataframe has six columns containing location id, datatime, parameter value, ann_thre, vt_degree and dgtag. ann_thre is originally the mean annual discharge. If flow record is subset by season, ann_thre will be the mean discharge of that period. vt_degree is the vector angle between two flow vectors. dgtag is the catogrized change points.
Li, T. and Pasternack, G.B., 2021. Revealing the diversity of hydropeaking flow regimes. Journal of Hydrology, 598, p.126392.
## Not run: hpk_flow_cg <- ReversalCount(hpk_flow_cln) hpk_flow_cg <- ReversalCount(hpk_flow_cln, alpha1 = 0.03, theta = 85, gamma = 40) ## End(Not run)
## Not run: hpk_flow_cg <- ReversalCount(hpk_flow_cln) hpk_flow_cg <- ReversalCount(hpk_flow_cln, alpha1 = 0.03, theta = 85, gamma = 40) ## End(Not run)