Skip to content

Commit f4810af

Browse files
authored
Merge pull request #12 from TOSSHtoolbox/ry-patch
Add Wu et al., (2021) signature
2 parents a71a74e + cda21ad commit f4810af

File tree

7 files changed

+85
-24
lines changed

7 files changed

+85
-24
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ example/example_data/old
1515
old/
1616
example/results/CAMELS_GB_TOSSH_signatures.mat
1717
example/results/CAMELS_TOSSH_signatures.mat
18-
_build/
18+
_build/
19+
main_test.m
20+
log.txt

TOSSH_code/calculation_functions/calc_All.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
BaseflowMagnitude_error_str = strings(size(Q_mat,1),1);
7171
BFI = NaN(size(Q_mat,1),1);
7272
BFI_error_str = strings(size(Q_mat,1),1);
73-
EventGraphThresholds = NaN(size(Q_mat,1),10);
73+
EventGraphThresholds = NaN(size(Q_mat,1),12);
7474
EventGraphThresholds_error_str = strings(size(Q_mat,1),1);
7575
EventRR = NaN(size(Q_mat,1),1);
7676
EventRR_error_str = strings(size(Q_mat,1),1);
@@ -154,6 +154,7 @@
154154
EventGraphThresholds(i,5),EventGraphThresholds(i,6),...
155155
EventGraphThresholds(i,7),EventGraphThresholds(i,8),...
156156
EventGraphThresholds(i,9),EventGraphThresholds(i,10),...
157+
EventGraphThresholds(i,11),EventGraphThresholds(i,12),...
157158
~,EventGraphThresholds_error_str(i)] = ...
158159
sig_EventGraphThresholds(Q_mat{i},t_mat{i},P_mat{i});
159160
[EventRR(i),~,EventRR_error_str(i)] = sig_EventRR(Q_mat{i},t_mat{i},P_mat{i});

TOSSH_code/calculation_functions/calc_McMillan_OverlandFlow.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106

107107
[IE_effect(i),SE_effect(i),IE_thresh_signif(i),IE_thresh(i), ...
108108
SE_thresh_signif(i),SE_thresh(i),SE_slope(i),Storage_thresh(i), ...
109-
Storage_thresh_signif(i),min_Qf_perc(i),~,OF_error_str(i)] ...
109+
Storage_thresh_signif(i),min_Qf_perc(i),~,~,~,OF_error_str(i)] ...
110110
= sig_EventGraphThresholds(Q_mat{i},t_mat{i},P_mat{i},...
111111
'plot_results',plot_results,'max_recessiondays',max_recessiondays);
112112

TOSSH_code/signature_functions/sig_EventGraphThresholds.m

Lines changed: 61 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function [IE_effect, SE_effect, IE_thresh_signif, IE_thresh, ...
22
SE_thresh_signif, SE_thresh, SE_slope, ...
3-
Storage_thresh, Storage_thresh_signif, min_Qf_perc, ...
3+
Storage_thresh, Storage_thresh_signif, min_Qf_perc, R_Pvol_RC, R_Pint_RC,...
44
error_flag, error_str, fig_handles] = sig_EventGraphThresholds(Q,t,P,varargin)
55
%% sig_EventGraphThresholds calculates a variety of signatures related to saturation and infiltration excess flow.
66
% Calculates a variety of signatures related to saturation excess (SE)
@@ -68,6 +68,18 @@
6868
% Indicates impermeable area contribution (qualitative description in
6969
% Becker and McDonnell, 1998).
7070
%
71+
% Event signatures from Wu et al., (2021); translated to Matlab in
72+
% Bolotin and McMillan (2025).
73+
% R_Pvol_RC: Pearson correlation beween total precipitation vs. normalized quick flow
74+
% (equivalent to event runoff coefficient = (quickflow volume / total P))
75+
% Related to stormflow processes which are sensitive to rainfall volume,
76+
% for example, SSF2, SOF, SSF1, and GWF. Called "SE_correlation" in
77+
% Bolotin and McMillan (2025).
78+
% R_Pint_RC: Pearson correlation beween average precipitation intensity vs. normalized quick flow
79+
% Related to Stormflow processes which are sensitive to rainfall
80+
% intensity, for example, HOF. Called "IE_correlation" in
81+
% Bolotin and McMillan (2025).
82+
%
7183
% error_flag: 0 (no error), 1 (warning), 2 (error in data check), 3
7284
% (error in signature calculation)
7385
% error_str: string contraining error description
@@ -95,6 +107,9 @@
95107
% controls of runoff generation and lateral flows in mountain catchments.
96108
% IAHS Publications-Series of Proceedings and Reports-Intern Assoc
97109
% Hydrological Sciences, 248, pp.199-206.
110+
% Bolotin, L. A., & McMillan, H. (2024). A hydrologic signature approach
111+
% to analysing wildfire impacts on overland flow. Hydrological Processes,
112+
% 38(6). https://doi.org/10.1002/hyp.15215
98113
% Estrany, J., Garcia, C. and Batalla, R.J., 2010. Hydrological response
99114
% of a small mediterranean agricultural catchment. Journal of Hydrology,
100115
% 380(1-2), pp.180-190.
@@ -111,7 +126,11 @@
111126
% Pfister, L., 2015. Towards more systematic perceptual model
112127
% development: a case study using 3 Luxembourgish catchments.
113128
% Hydrological Processes, 29(12), pp.2731-2750.
114-
%
129+
% Wu, S., Zhao, J., Wang, H., & Sivapalan, M. (2021).
130+
% Regional patterns and physical controls of streamflow generation across
131+
% the conterminous United States. Water Resources Research, 57(6),
132+
% e2020WR028086. https://doi.org/10.1029/2020wr028086
133+
115134
% Copyright (C) 2020
116135
% This software is distributed under the GNU Public License Version 3.
117136
% See <https://www.gnu.org/licenses/gpl-3.0.en.html> for details.
@@ -172,6 +191,8 @@
172191
Storage_thresh = NaN;
173192
Storage_thresh_signif = NaN;
174193
min_Qf_perc = NaN;
194+
R_Pvol_RC = NaN;
195+
R_Pint_RC = NaN;
175196
return
176197
end
177198
timestep_factor = 1/days(timestep); % adjust for timestep
@@ -222,31 +243,31 @@
222243
for i = 1:size(stormarray,1)
223244
% total event precipitation [mm] (Estrany names this as X3 coefficient)
224245
event_array(i,1) = sum(P(stormarray(i,1):stormarray(i,3)),'omitnan');
225-
246+
226247
% event average precipitation intensity [mm/timestep] (Estrany X4)
227248
event_array(i,2) = mean(P(stormarray(i,1):stormarray(i,3)),'omitnan');
228-
249+
229250
% event maximum precipitation intensity [mm/timestep] (Estrany X5; but they used 5 min data)
230251
event_array(i,3) = max(P(stormarray(i,1):stormarray(i,3)));
231-
252+
232253
% antecedent precipitation 3 days before [mm] (Estrany X1)
233254
time_antecedent = max(stormarray(i,1) - 3*24/timestep,1);
234255
event_array(i,4) = sum(P(time_antecedent:stormarray(i,1)),'omitnan');
235-
256+
236257
% antecedent precipitation 7 days before [mm] (Estrany X2)
237258
time_antecedent = max(stormarray(i,1) - 7*24/timestep,1);
238259
event_array(i,5) = sum(P(time_antecedent:stormarray(i,1)),'omitnan');
239-
260+
240261
% total event flow volume [mm]
241262
event_array(i,6) = sum(Q(stormarray(i,1):stormarray(i,3)),'omitnan');
242-
263+
243264
% total event quickflow volume [mm]
244265
event_array(i,7) = sum(Q(stormarray(i,1):stormarray(i,3)),'omitnan')-...
245266
sum(B(stormarray(i,1):stormarray(i,3)),'omitnan');
246-
267+
247268
% maximum event runoff [mm/timestep]
248269
event_array(i,8) = max(Q(stormarray(i,1):stormarray(i,3)));
249-
270+
250271
% antecedent precipitation index (API) using Mosley (1979) method
251272
% (sum Pi/i for 30 days)
252273
% get total antecedent time
@@ -367,11 +388,32 @@
367388
Storage_thresh_signif = p_value_st_qf;
368389
Storage_thresh = thresh_st_qf;
369390

391+
%% Wu et al. (2021) correlations for SE and IE
392+
393+
% Event Runoff coefficients = quickflow volume / total P
394+
rcq = event_array(:,7)./event_array(:,1);
395+
396+
% Use Wu et al definition of significant events
397+
% Ratio of start and end Q to peak is less than BFI
398+
bfi = sum(B,'omitnan')/sum(Q,'omitnan');
399+
start_ratio = Q(stormarray(:,1))./event_array(:,8);
400+
end_ratio = Q(stormarray(:,3))./event_array(:,8);
401+
large_events = and(start_ratio < bfi, end_ratio < bfi);
402+
403+
if sum(large_events)>2
404+
%Spearman rank Corr of total P and average intensity with RC
405+
[R_Pvol_RC,~] = corr(event_array(large_events,1), rcq(large_events), 'Type', 'Spearman');
406+
[R_Pint_RC,~] = corr(event_array(large_events,2), rcq(large_events), 'Type', 'Spearman');
407+
else
408+
R_Pvol_RC = NaN;
409+
R_Pint_RC = NaN;
410+
end
411+
370412
%% optional plotting
371413
if plot_results
372-
414+
373415
% plot flow, baseflow and events
374-
fig_events = figure('Position',[300 300 700*2 250*2]);
416+
fig_events = figure('Position',[100 100 700*2 250*2]);
375417
title(['Flow, Baseflow and Event Separation'])
376418
dates_dt = t;%datetime(dates,'ConvertFrom','datenum');
377419
P_max = max(P);
@@ -384,13 +426,12 @@
384426
dates_dt(stormarray(i,3)),dates_dt(stormarray(i,3))],...
385427
[0, P_max, P_max, 0],[198, 219, 239]/255,'LineStyle','none');
386428
end
387-
429+
p5=plot(dates_dt(:),P(:),'color',[250,159,18]/255,'linewidth',1);
388430
p1 = plot(t,Q,'k-','linewidth',1);
389431
p2 = plot(t,B,'k--','linewidth',1);
390-
p5=plot(dates_dt(:),P(:),'color',[250,159,18]/255,'linewidth',1);
391432

392433
xlabel('Time')
393-
ylabel('Flow or Rainfall [mm]')
434+
ylabel('Flow [mm]')
394435
legend([p1, p2, p3, p4, p5],{'Flow','Baseflow','Events','Recessions','Rainfall'},'location','best')
395436

396437
% plot total precip against quickflow, with threshold
@@ -407,7 +448,7 @@
407448
xlabel('Event precipitation [mm]')
408449
ylabel('Event quickflow volume [mm]')
409450
legend([p1, p2, p3],{'Data','No threshold','With threshold'},'location','best')
410-
451+
411452
% maximum intensity against quickflow, with threshold
412453
subplot(1,3,2)
413454
title(['Quickflow vs intensity, p = ',num2str(round(p_value_mi_qf,6))])
@@ -421,7 +462,7 @@
421462
xlabel('Event maximum intensity [mm/timestep]')
422463
ylabel('Event quickflow volume [mm]')
423464
legend([p1, p2, p3],{'Data','No threshold','With threshold'},'location','best')
424-
465+
425466
% API + total precipitation against quickflow, with threshold
426467
subplot(1,3,3)
427468
title(['Quickflow vs API + P, p = ',num2str(round(p_value_st_qf,6))])
@@ -435,7 +476,7 @@
435476
ylabel('Event quickflow volume [mm]')
436477
legend([p1, p2, p3],{'Data','No threshold','With threshold'},'location','best')
437478
fig_handles.EventGraphThresholds = fig;
438-
479+
439480
% Wrede et al. (2015) say "high intensity storms that don't produce
440481
% flow imply no IE processes". We plot max intensity against quickflow
441482
% on a seasonal basis for the user to evaluate this.
@@ -457,5 +498,5 @@
457498
legend('DJF','MAM','JJA','SON','location','best')
458499
title('Quickflow vs intensity per season') % Wrede 2015
459500
fig_handles.EventGraphThresholdsSeasons = fig2;
460-
461-
end
501+
502+
end

docs/_static/overland_flow_Wu.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Signature;Function (click for code);Unit;Description
2+
R_Pvol_RC;`sig_EventGraphThresholds.m <./_static/matlab/TOSSH_code/TOSSH/TOSSH_code/signature_functions/sig_EventGraphThresholds.html>`_ ;--; Pearson correlation between total precipitation volume and quickflow, related to saturation excess overlandflow process
3+
R_Pint_RC;`sig_EventGraphThresholds.m <./_static/matlab/TOSSH_code/TOSSH/TOSSH_code/signature_functions/sig_EventGraphThresholds.html>`_ ;--; Pearson correlation between precipitation intensity and quickflow, related to infiltration excess overlandflow process

docs/p2_signatures.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ Note that these signatures are all calculated with the same function.
116116
:header-rows: 1
117117
:delim: ;
118118

119+
Wu et al., (2021) overland flow set
120+
"""""""""""""""""""""""""""""""""
121+
A function `sig_EventGraphThresholds.m <./_static/matlab/TOSSH_code/TOSSH/TOSSH_code/signature_functions/sig_EventGraphThresholds.html>`_ contains 2 overland flow
122+
signatures from Wu et al., (2021) [8]_. The implementation in this toolbox is the adapted and coded version by Bolotin and McMillan (2025) [9]_.
123+
124+
.. csv-table:: Wu et al., (2021) overland flow set
125+
:file: ./_static/overland_flow_Wu.csv
126+
:header-rows: 1
127+
:delim: ;
128+
119129

120130
TOSSH: all remaining signatures
121131
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -150,3 +160,7 @@ References
150160
151161
.. [7] McMillan, H.K., 2020. Linking hydrologic signatures to hydrologic processes: A review. Hydrological Processes, 34(6), pp.1393-1409.
152162
163+
.. [8] Wu, S., Zhao, J., Wang, H., & Sivapalan, M. (2021). Regional patterns and physical controls of streamflow generation across the conterminous United States. Water Resources Research, 57(6), e2020WR028086.
164+
165+
.. [9] Bolotin, L. A., & McMillan, H. (2024). A hydrologic signature approach to analysing wildfire impacts on overland flow. Hydrological Processes, 38(6).
166+

example/workflow_2_advanced.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
% Some signatures focus on patterns that are best analysed visually. For
138138
% example, the quickflow response during a rainfall event can indicate
139139
% which runoff generation processes occur in a catchment.
140-
[ie_effect, se_effect, ~, ~, ~, ~, ~, ~, ~, ~, ~, ~, fig_EventGraphThresholds] = ...
140+
[ie_effect, se_effect, ~, ~, ~, ~, ~, ~, ~, ~, ~, ~, ~, ~, fig_EventGraphThresholds] = ...
141141
sig_EventGraphThresholds(Q_3,t_3,P_3,'plot_results',true);
142142
% We can see that most summer storms lead to little runoff, while all
143143
% winter storms produce runoff. This indicates saturation excess quickflow.

0 commit comments

Comments
 (0)