-
Notifications
You must be signed in to change notification settings - Fork 0
/
crt_mnth_wb.m
186 lines (143 loc) · 7.28 KB
/
crt_mnth_wb.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
function wb = crt_mnth_wb(set, cswitch)
% A = area_wghts(0.25:0.5:179.75, 0.5);
% A = A';
% A = A*ones(1,720);
if cswitch == 1
if strcmp(set, 'cfsr')
load /media/storage/Data/Precipitation/CFSR/CFSR_PREC.mat
P_l = comp_glob_quant(cfsr_prec, [1989 2006], 1, 'monthly', [4 5 9], -9999, 1);
% P_o = comp_glob_quant(cfsr_prec, [1989 2006], 2, 'monthly', [4 5 9], -9999, 1);
clear cfsr_prec
load /media/storage/Data/Evaporation/CFSR/CFSR_ET.mat
ET_l = comp_glob_quant(cfsr_et, [1989 2006], 1, 'monthly', [4 5 9], -9999, 1);
% ET_o = comp_glob_quant(cfsr_et, [1989 2006], 2, 'monthly', [4 5 9], -9999, 1);
clear cfsr_et
load /media/storage/Data/Runoff/CFSR/CFSR_R.mat
R = comp_glob_quant(cfsr_r, [1989 2006], 1, 'monthly', [4 5 9], 'NaN', 1);
clear cfsr_r
load /media/storage/Data/Mflux/CFSR/CFSR_VIMFD.mat
DQ_l = comp_glob_quant(cfsr_vimfd, [1989 2006], 1, 'monthly', [4 5 9], -9999, 1);
% DQ_o = comp_glob_quant(cfsr_vimfd, [1989 2006], 2, 'monthly', [4 5 9], -9999, 1);
clear cfsr_vimfd
load /media/storage/Data/Total_water_atm/CFSR/CFSR_TQV.mat
dwdt = central_diff(cfsr_tqv, [1989, 2006], [4 5 9]);
DW_l = comp_glob_quant(dwdt, [1989 2006], 1, 'monthly', [1 2 3], -9999, 1);
% DW_o = comp_glob_quant(dwdt, [1989 2006], 2, 'monthlyl', [1 2 3], -9999, 1);
clear cfsr_tqv dwdt
elseif strcmp(set, 'merra')
load /media/storage/Data/Precipitation/MERRA/MERRA_PREC.mat
P_l = comp_glob_quant(merra_prec, [1989 2006], 1, 'monthly', [4 5 9], -9999, 1);
% P_o = comp_glob_quant(merra_prec, [1989 2006], 2, 'annual', [4 5 9], -9999, 1);
clear merra_prec
load /media/storage/Data/Evaporation/MERRA/MERRA_ET.mat
ET_l = comp_glob_quant(merra_et, [1989 2006], 1, 'monthly', [4 5 9], -9999, 1);
% ET_o = comp_glob_quant(merra_et, [1989 2006], 2, 'annual', [4 5 9], -9999, 1);
clear merra_et
load /media/storage/Data/Runoff/MERRA/MERRA_R.mat
R = comp_glob_quant(merra_r, [1989 2006], 1, 'monthly', [4 5 9], 'NaN', 1);
clear merra_r
load /media/storage/Data/Mflux/MERRA/MERRA_VIMFD.mat
DQ_l = comp_glob_quant(merra_vimfd, [1989 2006], 1, 'monthly', [4 5 9], -9999, 1);
% DQ_o = comp_glob_quant(merra_vimfd, [1989 2006], 2, 'annual', [4 5 9], -9999, 1);
clear merra_vimfd
load /media/storage/Data/Total_water_atm/MERRA/CFSR_TQV.mat
dwdt = centra_diff(merra_tqv, [1989, 2006], [4 5 9]);
DW_l = comp_glob_quant(dwdt, [1989 2006], 1, 'monthly', [1 2 3], -9999, 1);
% DW_o = comp_glob_quant(dwdt, [1989 2006], 2, 'annual', [1 2 3], -9999, 1);
clear merra_tqv dwdt
elseif strcmp(set, 'ecmwf')
load /media/storage/Data/Precipitation/ECMWF/ECMWF_PREC.mat
P_l = comp_glob_quant(ecmwf_prec, [1989 2006], 1, 'monthly', [4 5 9], -9999, 1);
% P_o = comp_glob_quant(ecmwf_prec, [1989 2006], 2, 'annual', [4 5 9], -9999, 1);
clear ecmwf_prec
load /media/storage/Data/Evaporation/ECMWF/ECMWF_ET.mat
ET_l = comp_glob_quant(ecmwf_et, [1989 2006], 1, 'monthly', [4 5 9], -9999, 1);
% ET_o = comp_glob_quant(ecmwf_et, [1989 2006], 2, 'annual', [4 5 9], -9999, 1);
clear ecmwf_et
load /media/storage/Data/Runoff/ECMWF/ECMWF_R.mat
R = comp_glob_quant(ecmwf_r, [1989 2006], 1, 'monthly', [4 5 9], 'NaN', 1);
clear ecmwf_r
load /media/storage/Data/Mflux/ECMWF/ECMWF_VIMFD.mat
DQ_l = comp_glob_quant(ecmwf_vimfd, [1989 2006], 1, 'monthly', [4 5 9], -9999, 1);
% DQ_o = comp_glob_quant(ecmwf_vimfd, [1989 2006], 2, 'annual', [4 5 9], -9999, 1);
clear ecmwf_vimfd
load /media/storage/Data/Total_water_atm/ECMWF/ECMWF_TQV.mat
dwdt = central_diff(ecmwf_tqv, [1989, 2006], [4 5 9]);
DW_l = comp_glob_quant(dwdt, [1989 2006], 1, 'monthly', [1 2 3], -9999, 1);
% DW_o = comp_glob_quant(dwdt, [1989 2006], 2, 'annual', [1 2 3], -9999, 1);
clear ecmwf_tqv dwdt
wb = [P_l' ET_l' R' DQ_l' DW_l'];
end
elseif cswitch == 2
if strcmp(set, 'cfsr')
load /media/storage/Data/Precipitation/CFSR/CFSR_PREC.mat
load /media/storage/Data/Evaporation/CFSR/CFSR_ET.mat
for i = 1:length(cfsr_et)
emnp{i,1} = cfsr_et{i,4};
emnp{i,2} = cfsr_et{i,5};
emnp{i,3} = cfsr_et{i,9} - cfsr_prec{i,9};
end
E_P = comp_cont_quant(emnp, [1989 2006], 'monthly', [1 2 3], -9999, 1);
clear cfsr_* emnp
load /media/storage/Data/Runoff/CFSR/CFSR_R.mat
R = comp_cont_quant(cfsr_r, [1989 2006], 'monthly', [4 5 9], 'NaN', 1);
clear cfsr_r
load /media/storage/Data/Mflux/CFSR/CFSR_VIMFD.mat
DQ_l = comp_cont_quant(cfsr_vimfd, [1989 2006],'monthly', [4 5 9], -9999, 1);
% DQ_o = comp_glob_quant(cfsr_vimfd, [1989 2006], 2, 'monthly', [4 5 9], -9999, 1);
clear cfsr_vimfd
load /media/storage/Data/Total_water_atm/CFSR/CFSR_TQV.mat
dwdt = central_diff(cfsr_tqv, [1989, 2006], [4 5 9]);
DW_l = comp_cont_quant(dwdt, [1989 2006], 'monthly', [1 2 3], -9999, 1);
% DW_o = comp_glob_quant(dwdt, [1989 2006], 2, 'monthlyl', [1 2 3], -9999, 1);
clear cfsr_tqv dwdt
elseif strcmp(set, 'merra')
load /media/storage/Data/Precipitation/MERRA/MERRA_PREC.mat
load /media/storage/Data/Evaporation/MERRA/MERRA_ET.mat
for i = 1:length(merra_et)
emnp{i,1} = merra_et{i,4};
emnp{i,2} = merra_et{i,5};
emnp{i,3} = merra_et{i,9} - merra_prec{i,9};
end
E_P = comp_cont_quant(emnp, [1989 2006], 'monthly', [1 2 3], -9999, 1);
clear merra_* emnp
load /media/storage/Data/Runoff/MERRA/MERRA_R.mat
R = comp_cont_quant(merra_r, [1989 2006], 'monthly', [4 5 9], 'NaN', 1);
clear merra_r
load /media/storage/Data/Mflux/MERRA/MERRA_VIMFD.mat
DQ_l = comp_cont_quant(merra_vimfd, [1989 2006], 'monthly', [4 5 9], -9999, 1);
% DQ_o = comp_glob_quant(merra_vimfd, [1989 2006], 2, 'annual', [4 5 9], -9999, 1);
clear merra_vimfd
load /media/storage/Data/Total_water_atm/MERRA/CFSR_TQV.mat
dwdt = centra_diff(merra_tqv, [1989, 2006], [4 5 9]);
DW_l = comp_cont_quant(dwdt, [1989 2006], 'monthly', [1 2 3], -9999, 1);
% DW_o = comp_glob_quant(dwdt, [1989 2006], 2, 'annual', [1 2 3], -9999, 1);
clear merra_tqv dwdt
elseif strcmp(set, 'ecmwf')
load /media/storage/Data/Precipitation/ECMWF/ECMWF_PREC.mat
load /media/storage/Data/Evaporation/ECMWF/ECMWF_ET.mat
for i = 1:length(ecmwf_et)
emnp{i,1} = ecmwf_et{i,4};
emnp{i,2} = ecmwf_et{i,5};
emnp{i,3} = ecmwf_et{i,9} - ecmwf_prec{i,9};
end
E_P = comp_cont_quant(emnp, [1989 2006], 'monthly', [1 2 3], -9999, 1);
clear ecmwf_* emnp
load /media/storage/Data/Runoff/ECMWF/ECMWF_R.mat
R = comp_cont_quant(ecmwf_r, [1989 2006], 'monthly', [4 5 9], 'NaN', 1);
clear ecmwf_r
load /media/storage/Data/Mflux/ECMWF/ECMWF_VIMFD.mat
DQ_l = comp_cont_quant(ecmwf_vimfd, [1989 2006], 'monthly', [4 5 9], -9999, 1);
% DQ_o = comp_glob_quant(ecmwf_vimfd, [1989 2006], 2, 'annual', [4 5 9], -9999, 1);
clear ecmwf_vimfd
load /media/storage/Data/Total_water_atm/ECMWF/ECMWF_TQV.mat
dwdt = central_diff(ecmwf_tqv, [1989, 2006], [4 5 9]);
DW_l = comp_cont_quant(dwdt, [1989 2006], 'monthly', [1 2 3], -9999, 1);
% DW_o = comp_glob_quant(dwdt, [1989 2006], 2, 'annual', [1 2 3], -9999, 1);
clear ecmwf_tqv dwdt
end
wb{1} = E_P;
wb{2} = R;
wb{3} = DQ_l;
wb{4} = DW_l;
end