forked from IRPIhydrology/STREAM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_STREAM_semidistributed.m
224 lines (188 loc) · 8.02 KB
/
run_STREAM_semidistributed.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
%% crea file input
clear, clc, close all
name_bas= 'Mississippi'
TOPOL = load(['topology_',name_bas,'.csv']);
TOPOL(TOPOL(:,4)==0,4)=2;
TOPOL(TOPOL(:,4)==-1,4)=1;
%% load input data
load (['staz_check',name_bas,'.mat'])
load input.mat
%% File preparation for basin configuration
EBRR_BASPAR = [TOPOL(:,1),load(['distance_',name_bas,'.txt']),TOPOL(:,6),TOPOL(:,4)];
BAS_PAR =[size(TOPOL,1); size(ID_bas_app,1); 0];
%% identification closure section according to basin configuration in "Mississippi_basin.png"
sez_outlet = 10; % Vicksburg
bas_check = ID_bas_app(sez_outlet);
%% STREAM model calibration
[X_OPT]=cal_STREAM_semidistributed(input,BAS_PAR,EBRR_BASPAR,sez_outlet,bas_check,ID_bas_app)
save (['X_opt_',name_bas,'.txt'],'X_OPT','-ascii','-tabs')
%% STREAM model run
X_OPT= load(['X_opt_',name_bas,'.txt']);
[NS,KGE_sez,KGE_out,Qsim_out,QB_out,rr_tot]=STREAM_semidistributed(input,BAS_PAR,EBRR_BASPAR,X_OPT,sez_outlet,bas_check,ID_bas_app,1);
%% River discharge comparison for calibrated sections
basin_data = input.basin_data;
temperature= input.temperature;
sez_check= [9,6,4,11];
close all
ID_bas_checkinn=ID_bas_app(sez_check);
set(gcf,'position',[576 49 777 936])
subplot(5,1,1)
Qobs = basin_data{bas_check}{:,4};
QQ=Qsim_out(:,sez_outlet);
QQB = QB_out(:,sez_outlet);
plot(basin_data{1}{1},Qobs,'g-','linew',2)
hold on
plot(basin_data{1}{1},QQ,'r--')
plot(basin_data{1}{1},QQB,'b-')
axis([(basin_data{1}{1}(1)) (basin_data{1}{1}(end)) min(min(QQ,Qobs)) max(max(QQ,Qobs))])
datetick('x','keeplimits')
box on, grid on
ylabel('Discharge (m^3/s)')
legend('Observed data','STREAM total discharge','STREAM slow flow')
[~,RMSE,~,RRQ]=perf(QQ,Qobs);
title(['Outlet section: ',num2str(sez_outlet),' - KGE: ',num2str(klinggupta(QQ,Qobs),'%3.2f'),...
' | R: ',num2str(RRQ,'%3.2f'), ' | RRMSE: ',num2str(RMSE*100,'%3.2f'),'%'])
subplot(5,1,2)
sez_outletinn = find(ID_bas_app==ID_bas_checkinn(1));
Qobs = basin_data{ID_bas_checkinn(1)}{:,4};
QQ=Qsim_out(:,sez_outletinn);
QQB = QB_out(:,sez_outletinn);
plot(basin_data{1}{1},Qobs,'g-','linew',2)
hold on
plot(basin_data{1}{1},QQ,'r--')
plot(basin_data{1}{1},QQB,'b-')
axis([(basin_data{1}{1}(1)) (basin_data{1}{1}(end)) min(min(QQ,Qobs)) max(max(QQ,Qobs))])
datetick('x','keeplimits')
box on, grid on
ylabel('Discharge (m^3/s)')
legend('Observed data','STREAM total discharge','STREAM slow flow')
[~,RMSE,~,RRQ]=perf(QQ,Qobs);
title(['Outlet section: ',num2str(sez_outletinn),' - KGE: ',num2str(klinggupta(QQ,Qobs),'%3.2f'),...
' | R: ',num2str(RRQ,'%3.2f'), ' | RRMSE: ',num2str(RMSE*100,'%3.2f'),'%'])
subplot(5,1,3)
sez_outletinn = find(ID_bas_app==ID_bas_checkinn(2));
Qobs = basin_data{ID_bas_checkinn(2)}{:,4};
QQ=Qsim_out(:,sez_outletinn);
QQB = QB_out(:,sez_outletinn);
plot(basin_data{1}{1},Qobs,'g-','linew',2)
hold on
plot(basin_data{1}{1},QQ,'r--')
plot(basin_data{1}{1},QQB,'b-')
axis([(basin_data{1}{1}(1)) (basin_data{1}{1}(end)) min(min(QQ,Qobs)) max(max(QQ,Qobs))])
datetick('x','keeplimits')
box on, grid on
ylabel('Discharge (m^3/s)')
legend('Observed data','STREAM total discharge','STREAM slow flow')
[~,RMSE,~,RRQ]=perf(QQ,Qobs);
title(['Outlet section: ',num2str(sez_outletinn),' - KGE: ',num2str(klinggupta(QQ,Qobs),'%3.2f'),...
' | R: ',num2str(RRQ,'%3.2f'), ' | RRMSE: ',num2str(RMSE*100,'%3.2f'),'%'])
subplot(5,1,4)
sez_outletinn = find(ID_bas_app==ID_bas_checkinn(3));
Qobs = basin_data{ID_bas_checkinn(3)}{:,4};
QQ=Qsim_out(:,sez_outletinn);
QQB = QB_out(:,sez_outletinn);
plot(basin_data{1}{1},Qobs,'g-','linew',2)
hold on
plot(basin_data{1}{1},QQ,'r--')
plot(basin_data{1}{1},QQB,'b-')
axis([(basin_data{1}{1}(1)) (basin_data{1}{1}(end)) min(min(QQ,Qobs)) max(max(QQ,Qobs))])
datetick('x','keeplimits')
box on, grid on
ylabel('Discharge (m^3/s)')
legend('Observed data','STREAM total discharge','STREAM slow flow')
[~,RMSE,~,RRQ]=perf(QQ,Qobs);
title(['Outlet section: ',num2str(sez_outletinn),' - KGE: ',num2str(klinggupta(QQ,Qobs),'%3.2f'),...
' | R: ',num2str(RRQ,'%3.2f'), ' | RRMSE: ',num2str(RMSE*100,'%3.2f'),'%'])
subplot(5,1,5)
sez_outletinn = find(ID_bas_app==ID_bas_checkinn(4));
Qobs = basin_data{ID_bas_checkinn(4)}{:,4};
QQ=Qsim_out(:,sez_outletinn);
QQB = QB_out(:,sez_outletinn);
plot(basin_data{1}{1},Qobs,'g-','linew',2)
hold on
plot(basin_data{1}{1},QQ,'r--')
plot(basin_data{1}{1},QQB,'b-')
axis([(basin_data{1}{1}(1)) (basin_data{1}{1}(end)) min(min(QQ,Qobs)) max(max(QQ,Qobs))])
datetick('x','keeplimits')
box on, grid on
ylabel('Discharge (m^3/s)')
legend('Observed data','STREAM total discharge','STREAM slow flow')
[~,RMSE,~,RRQ]=perf(QQ,Qobs);
title(['Outlet section: ',num2str(sez_outletinn),' - KGE: ',num2str(klinggupta(QQ,Qobs),'%3.2f'),...
' | R: ',num2str(RRQ,'%3.2f'), ' | RRMSE: ',num2str(RMSE*100,'%3.2f'),'%'])
saveas(gcf,'Results\Calibrated_sections.png')
%% River discharge comparison for non calibrated sections
basin_data = input.basin_data;
temperature= input.temperature;
sez_check= [1,2,8];
close all
ID_bas_checkinn=ID_bas_app(sez_check);
set(gcf,'position',[576 49 777 936])
subplot(4,1,1)
Qobs = basin_data{bas_check}{:,4};
QQ=Qsim_out(:,sez_outlet);
QQB = QB_out(:,sez_outlet);
plot(basin_data{1}{1},Qobs,'g-','linew',2)
hold on
plot(basin_data{1}{1},QQ,'r--')
plot(basin_data{1}{1},QQB,'b-')
axis([(basin_data{1}{1}(1)) (basin_data{1}{1}(end)) min(min(QQ,Qobs)) max(max(QQ,Qobs))])
datetick('x','keeplimits')
box on, grid on
ylabel('Discharge (m^3/s)')
legend('Observed data','STREAM total discharge','STREAM slow flow')
[~,RMSE,~,RRQ]=perf(QQ,Qobs);
title(['Outlet section: ',num2str(sez_outlet),' - KGE: ',num2str(klinggupta(QQ,Qobs),'%3.2f'),...
' | R: ',num2str(RRQ,'%3.2f'), ' | RRMSE: ',num2str(RMSE*100,'%3.2f'),'%'])
subplot(4,1,2)
sez_outletinn = find(ID_bas_app==ID_bas_checkinn(1));
Qobs = basin_data{ID_bas_checkinn(1)}{:,4};
QQ=Qsim_out(:,sez_outletinn);
QQB = QB_out(:,sez_outletinn);
plot(basin_data{1}{1},Qobs,'g-','linew',2)
hold on
plot(basin_data{1}{1},QQ,'r--')
plot(basin_data{1}{1},QQB,'b-')
axis([(basin_data{1}{1}(1)) (basin_data{1}{1}(end)) min(min(QQ,Qobs)) max(max(QQ,Qobs))])
datetick('x','keeplimits')
box on, grid on
ylabel('Discharge (m^3/s)')
legend('Observed data','STREAM total discharge','STREAM slow flow')
[~,RMSE,~,RRQ]=perf(QQ,Qobs);
title(['Outlet section: ',num2str(sez_outletinn),' - KGE: ',num2str(klinggupta(QQ,Qobs),'%3.2f'),...
' | R: ',num2str(RRQ,'%3.2f'), ' | RRMSE: ',num2str(RMSE*100,'%3.2f'),'%'])
subplot(4,1,3)
sez_outletinn = find(ID_bas_app==ID_bas_checkinn(2));
Qobs = basin_data{ID_bas_checkinn(2)}{:,4};
QQ=Qsim_out(:,sez_outletinn);
QQB = QB_out(:,sez_outletinn);
plot(basin_data{1}{1},Qobs,'g-','linew',2)
hold on
plot(basin_data{1}{1},QQ,'r--')
plot(basin_data{1}{1},QQB,'b-')
axis([(basin_data{1}{1}(1)) (basin_data{1}{1}(end)) min(min(QQ,Qobs)) max(max(QQ,Qobs))])
datetick('x','keeplimits')
box on, grid on
ylabel('Discharge (m^3/s)')
% legend('Observed data','STREAM total discharge','STREAM slow flow')
[~,RMSE,~,RRQ]=perf(QQ,Qobs);
title(['Outlet section: ',num2str(sez_outletinn),' - KGE: ',num2str(klinggupta(QQ,Qobs),'%3.2f'),...
' | R: ',num2str(RRQ,'%3.2f'), ' | RRMSE: ',num2str(RMSE*100,'%3.2f'),'%'])
subplot(4,1,4)
sez_outletinn = find(ID_bas_app==ID_bas_checkinn(3));
Qobs = basin_data{ID_bas_checkinn(3)}{:,4};
QQ=Qsim_out(:,sez_outletinn);
QQB = QB_out(:,sez_outletinn);
plot(basin_data{1}{1},Qobs,'g-','linew',2)
hold on
plot(basin_data{1}{1},QQ,'r--')
plot(basin_data{1}{1},QQB,'b-')
axis([(basin_data{1}{1}(1)) (basin_data{1}{1}(end)) min(min(QQ,Qobs)) max(max(QQ,Qobs))])
datetick('x','keeplimits')
box on, grid on
ylabel('Discharge (m^3/s)')
% legend('Observed data','STREAM total discharge','STREAM slow flow')
[~,RMSE,~,RRQ]=perf(QQ,Qobs);
title(['Outlet section: ',num2str(sez_outletinn),' - KGE: ',num2str(klinggupta(QQ,Qobs),'%3.2f'),...
' | R: ',num2str(RRQ,'%3.2f'), ' | RRMSE: ',num2str(RMSE*100,'%3.2f'),'%'])
saveas(gcf,'Results\Notcalibrated_sections.png')