-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
TOSSH/TOSSH_code/calculation_functions/calc_McMillan_Groundwater.m
Lines 162 to 166 in a7012da
| RecessionParameters(i,1) = median((RecessionParametersTemp(:,1)),'omitnan'); | |
| RecessionParameters(i,2) = median(RecessionParametersTemp(:,2),'omitnan'); | |
| RecessionParametersT0Temp = 1./(RecessionParametersTemp(:,1).*median(Q_mat{i}(Q_mat{i}>0),'omitnan').^(RecessionParametersTemp(:,2)-1)); | |
| ReasonableT0 = and(RecessionParametersTemp(:,2)>0.5,RecessionParametersTemp(:,2)<5); | |
| RecessionParameters(i,3) = median(RecessionParametersT0Temp(ReasonableT0),'omitnan'); |
Issue description:
The current code ./TOSSH_code/calculation_functions/calc_McMillan_Groundwater.m post-processes recession parameters (a and b) from individual fit from sig_RecessionAnalysis to derive the site median a and b, as well as the timescale of recession decay T0, that can be calculated from a and b. However, this post-processing is not included in calc_ALL.m.
This causes some confusions, as:
RecessionParametersis a 1-by-2 matrix if you usecalc_ALL.mand don't postprocess, and 1-by-3 matrix if you usecalc_McMillan_Groundwater.mand post-process the parametersRecessionParametersis a 1-by-2 or 1-by-3 matrix, whose element get converted as "RecessionParmaeters_1", "RecessionParmaeters_2", and "RecessionParmaeters_3" in output CSV file by default in Matlab. Therefore, in the output CSV file, it is not labeled which item represent what parameter, eithera,b, orT0.- Additionally,
T0is a scaled timescale of recession by flow magnitude, but the process is not described in comments.
I'm not looking for an immediate fix right now—left the comment for future improvement.
Some improvements to be done:
- In calculation functions (e.g.,
calc_ALL.m,calc_McMillan_Groundwater.m), instead of storing the output asRecessionParameters(n-by-2 or n-by-3 matrix ), prepare output variables as literal name of each parameters (n-by-1 matrix for each:RecessionParameters_a,RecessionParameters_b, andRecessionParameters_T0) and take the an element ofRecessionParametersoutput like:
[RecessionParametersTemp,~,~,RecessionParameters_error_str(i)] = ...
sig_RecessionAnalysis(Q_mat{i},t_mat{i}, ...
'recession_length', recession_length, ...
'n_start', n_start, ...
'eps', eps, ...
'fit_individual',true);
% Get the estimated parameters for the power function
RecessionParameters_a(i) = median((RecessionParametersTemp(:,1)),'omitnan');
RecessionParameters_b(i) = median(RecessionParametersTemp(:,2),'omitnan'); % This is the b parameter: RecessionParameters_b
% Calculate the timescale of the recession from the parmaeters a and b
RecessionParametersT0Temp = 1./(RecessionParametersTemp(:,1).*median(Q_mat{i}(Q_mat{i}>0),'omitnan').^(RecessionParametersTemp(:,2)-1));
ReasonableT0 = and(RecessionParametersTemp(:,2)>0.5,RecessionParametersTemp(:,2)<5);
RecessionParameters_T0(i) = median(RecessionParametersT0Temp(ReasonableT0),'omitnan'); % This is the T0 parameter: RecessionParameters_T0
- The process of scaling by median Q can be either (1) included in
./TOSSH_code/calculation_functions/calc_All.mas well, or (2) included as an option insig_RecessionAnalysis. - Also additional commenting and citation to this conversion would be helpful. The post-processing converts the estimated
aparameter; it scalesaaccording to flow magnitude (in other words,agets normalized by median flow) as described in McMillan et al., (2014).bis (supposed to be) insensitive to flow magnitude, so no scaling needed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels