-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plot_variables_maps_CTL-NOI.py
324 lines (281 loc) · 15.7 KB
/
Plot_variables_maps_CTL-NOI.py
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
from Load_data import Data_from_nc
from Calculation_utils import Calculation
import matplotlib.pyplot as plt
import matplotlib as mpl
import cartopy.feature as cfeature
import cartopy.crs as ccrs
import numpy as np
import time
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib import colors as cls
def set_plot_param():
"""Set my own customized plotting parameters"""
mpl.rc('axes', edgecolor='dimgrey')
mpl.rc('axes', labelcolor='dimgrey')
mpl.rc('xtick', color='dimgrey')
mpl.rc('xtick', labelsize=12)
mpl.rc('ytick', color='dimgrey')
mpl.rc('ytick', labelsize=12)
mpl.rc('axes', titlesize=14)
mpl.rc('axes', labelsize=12)
mpl.rc('legend', fontsize='large')
mpl.rc('text', color='dimgrey')
data_E_NOI = Data_from_nc('E:\Research1\\NOIRR\EFLX_LH_TOT_timmean.nc') #load the data
data_variable_E_NOI = data_E_NOI.load_variable('EFLX_LH_TOT')
data_variable_E_NOI[data_variable_E_NOI >= 10000000000] = None
data_variable_E_NOI = data_variable_E_NOI[0, :, :]
data_variable_E_NOI = data_variable_E_NOI[29 :, :]
data_lon = data_E_NOI.load_variable('lon')
data_lat = data_E_NOI.load_variable('lat')
data_lat = data_lat[29 :]
data_E_IRR = Data_from_nc('E:\Research1\\CTL\EFLX_LH_TOT_timmean.nc') #load the data
data_variable_E_IRR = data_E_IRR.load_variable('EFLX_LH_TOT')
data_variable_E_IRR[data_variable_E_IRR >= 10000000000] = None
data_variable_E_IRR = data_variable_E_IRR[0, :, :]
data_variable_E_IRR = data_variable_E_IRR[29 :, :]
f = plt.figure(figsize = (12, 8), dpi=100) # initiate the figure
set_plot_param()
f.subplots_adjust(hspace=0.15, wspace=0.1, left = 0.05, right = 0.95, top = 0.95, bottom = 0.05)
ax1 = plt.subplot(2, 2, 1, projection=ccrs.PlateCarree())
ax1.text(0.01,0.92,'a',color='dimgrey',fontsize=12, transform=ax1.transAxes, weight = 'bold')
ax1.coastlines(linewidth=0.5)
#ax1.add_feature(cfeature.BORDERS, linestyle='-', linewidth=0.5)
ax1.add_feature(cfeature.OCEAN, color='lightgrey')
cmap='BrBG'
bwr = mpl.cm.get_cmap('BrBG')
colors = [bwr(0.1),bwr(0.2),bwr(0.3),bwr(0.4),bwr(0.5),bwr(0.6),bwr(0.7),bwr(0.8),bwr(0.9)]
cmap_bias1 = mpl.colors.ListedColormap(colors)
bounds = [-10, -5, -2, -0.1, 0.1, 2, 5, 10]
norm_bias1 = mpl.colors.BoundaryNorm(bounds,cmap_bias1.N,extend='both')
divider = make_axes_locatable(ax1)
h = ax1.pcolormesh(data_lon,data_lat,data_variable_E_IRR - data_variable_E_NOI, cmap=cmap_bias1, rasterized=True, norm=norm_bias1)
cbar = f.colorbar(h, ax=ax1, cmap=cmap,
spacing='uniform',
orientation='horizontal',
extend='both', shrink = 1, pad = 0, aspect = 50)
cbar.set_label('$\Delta$ LHF (W/$m^2$)',fontsize = 12)
ticklabs = cbar.ax.get_xticklabels()
cbar.ax.set_xticklabels(ticklabs, fontsize=12)
plt.title('Latent heat flux (CTL - NOI)')
data_E_NOI = Data_from_nc('E:\Research1\\NOIRR\FSH_timmean.nc') #load the data
data_variable_E_NOI = data_E_NOI.load_variable('FSH')
data_variable_E_NOI[data_variable_E_NOI >= 10000000000] = None
data_variable_E_NOI = data_variable_E_NOI[0, :, :]
data_variable_E_NOI = data_variable_E_NOI[29 :, :]
data_E_IRR = Data_from_nc('E:\Research1\\CTL\FSH_timmean.nc') #load the data
data_variable_E_IRR = data_E_IRR.load_variable('FSH')
data_variable_E_IRR[data_variable_E_IRR >= 10000000000] = None
data_variable_E_IRR = data_variable_E_IRR[0, :, :]
data_variable_E_IRR = data_variable_E_IRR[29 :, :]
ax1 = plt.subplot(2, 2, 2, projection=ccrs.PlateCarree())
ax1.text(0.01,0.92,'b',color='dimgrey',fontsize=12, transform=ax1.transAxes, weight = 'bold')
ax1.coastlines(linewidth=0.5)
#ax1.add_feature(cfeature.BORDERS, linestyle='-', linewidth=0.5)
ax1.add_feature(cfeature.OCEAN, color='lightgrey')
cmap='BrBG'
bwr = mpl.cm.get_cmap('BrBG')
colors = [bwr(0.1),bwr(0.2),bwr(0.3),bwr(0.4),bwr(0.5),bwr(0.6),bwr(0.7),bwr(0.8),bwr(0.9)]
cmap_bias1 = mpl.colors.ListedColormap(colors)
bounds = [-10, -5, -2, -0.1, 0.1, 2, 5, 10]
norm_bias1 = mpl.colors.BoundaryNorm(bounds,cmap_bias1.N,extend='both')
divider = make_axes_locatable(ax1)
h = ax1.pcolormesh(data_lon,data_lat,data_variable_E_IRR - data_variable_E_NOI, cmap=cmap_bias1, rasterized=True, norm=norm_bias1)
cbar = f.colorbar(h, ax=ax1, cmap=cmap,
spacing='uniform',
orientation='horizontal',
extend='both', shrink = 1, pad = 0, aspect = 50)
cbar.set_label('$\Delta$ SHF (W/$m^2$)',fontsize = 12)
ticklabs = cbar.ax.get_xticklabels()
cbar.ax.set_xticklabels(ticklabs, fontsize=12)
plt.title('Sensible heat flux (CTL - NOI)')
data_E_NOI = Data_from_nc('E:\Research1\\NOIRR\SWup_timmean.nc') #load the data
data_variable_E_NOI = data_E_NOI.load_variable('SWup')
data_variable_E_NOI[data_variable_E_NOI >= 10000000000] = None
data_variable_E_NOI = data_variable_E_NOI[0, :, :]
data_variable_E_NOI = data_variable_E_NOI[29 :, :]
data_E_IRR = Data_from_nc('E:\Research1\\CTL\SWup_timmean.nc') #load the data
data_variable_E_IRR = data_E_IRR.load_variable('SWup')
data_variable_E_IRR[data_variable_E_IRR >= 10000000000] = None
data_variable_E_IRR = data_variable_E_IRR[0, :, :]
data_variable_E_IRR = data_variable_E_IRR[29 :, :]
ax1 = plt.subplot(2, 2, 3, projection=ccrs.PlateCarree())
ax1.text(0.01,0.92,'c',color='dimgrey',fontsize=12, transform=ax1.transAxes, weight = 'bold')
ax1.coastlines(linewidth=0.5)
#ax1.add_feature(cfeature.BORDERS, linestyle='-', linewidth=0.5)
ax1.add_feature(cfeature.OCEAN, color='lightgrey')
cmap='BrBG'
bwr = mpl.cm.get_cmap('BrBG')
colors = [bwr(0.1),bwr(0.2),bwr(0.3),bwr(0.4),bwr(0.5),bwr(0.6),bwr(0.7),bwr(0.8),bwr(0.9)]
cmap_bias1 = mpl.colors.ListedColormap(colors)
bounds = [-5, -2, -1, -0.1, 0.1, 1, 2, 5]
norm_bias1 = mpl.colors.BoundaryNorm(bounds,cmap_bias1.N,extend='both')
divider = make_axes_locatable(ax1)
h = ax1.pcolormesh(data_lon,data_lat,data_variable_E_IRR - data_variable_E_NOI, cmap=cmap_bias1, rasterized=True, norm=norm_bias1)
cbar = f.colorbar(h, ax=ax1, cmap=cmap,
spacing='uniform',
orientation='horizontal',
extend='both', shrink = 1, pad = 0, aspect = 50)
cbar.set_label('$\Delta$ SWup (W/$m^2$)',fontsize = 12)
ticklabs = cbar.ax.get_xticklabels()
cbar.ax.set_xticklabels(ticklabs, fontsize=12)
plt.title('Upwelling shortwave radiation (CTL - NOI)')
data_E_NOI = Data_from_nc('E:\Research1\\NOIRR\LWup_timmean.nc') #load the data
data_variable_E_NOI = data_E_NOI.load_variable('LWup')
data_variable_E_NOI[data_variable_E_NOI >= 10000000000] = None
data_variable_E_NOI = data_variable_E_NOI[0, :, :]
data_variable_E_NOI = data_variable_E_NOI[29 :, :]
data_E_IRR = Data_from_nc('E:\Research1\\CTL\LWup_timmean.nc') #load the data
data_variable_E_IRR = data_E_IRR.load_variable('LWup')
data_variable_E_IRR[data_variable_E_IRR >= 10000000000] = None
data_variable_E_IRR = data_variable_E_IRR[0, :, :]
data_variable_E_IRR = data_variable_E_IRR[29 :, :]
ax1 = plt.subplot(2, 2, 4, projection=ccrs.PlateCarree())
ax1.text(0.01,0.92,'d',color='dimgrey',fontsize=12, transform=ax1.transAxes, weight = 'bold')
ax1.coastlines(linewidth=0.5)
#ax1.add_feature(cfeature.BORDERS, linestyle='-', linewidth=0.5)
ax1.add_feature(cfeature.OCEAN, color='lightgrey')
cmap='BrBG'
bwr = mpl.cm.get_cmap('BrBG')
colors = [bwr(0.1),bwr(0.2),bwr(0.3),bwr(0.4),bwr(0.5),bwr(0.6),bwr(0.7),bwr(0.8),bwr(0.9)]
cmap_bias1 = mpl.colors.ListedColormap(colors)
bounds = [-5, -2, -1, -0.1, 0.1, 1, 2, 5]
norm_bias1 = mpl.colors.BoundaryNorm(bounds,cmap_bias1.N,extend='both')
divider = make_axes_locatable(ax1)
h = ax1.pcolormesh(data_lon,data_lat,data_variable_E_IRR - data_variable_E_NOI, cmap=cmap_bias1, rasterized=True, norm=norm_bias1)
cbar = f.colorbar(h, ax=ax1, cmap=cmap,
spacing='uniform',
orientation='horizontal',
extend='both', shrink = 1, pad = 0, aspect = 50)
cbar.set_label('$\Delta$ LWup (W/$m^2$)',fontsize = 12)
ticklabs = cbar.ax.get_xticklabels()
cbar.ax.set_xticklabels(ticklabs, fontsize=12)
plt.title('Upwelling longwave radiation (CTL - NOI)')
plt.savefig('E:\Data_Evaluation\Data_for_evaluation\Irrigation_amount\Fig\\Energy1.png')
f = plt.figure(figsize = (12, 8), dpi=100) # initiate the figure
set_plot_param()
data_E_NOI = Data_from_nc('E:\Research1\\NOIRR\Qle_timmean.nc') #load the data
data_variable_E_NOI = data_E_NOI.load_variable('Qle')
data_variable_E_NOI[data_variable_E_NOI >= 10000000000] = None
data_variable_E_NOI = data_variable_E_NOI[0, :, :]
data_variable_E_NOI = data_variable_E_NOI[29 :, :] / 28.94 * 365
data_E_IRR = Data_from_nc('E:\Research1\\CTL\Qle_timmean.nc') #load the data
data_variable_E_IRR = data_E_IRR.load_variable('Qle')
data_variable_E_IRR[data_variable_E_IRR >= 10000000000] = None
data_variable_E_IRR = data_variable_E_IRR[0, :, :]
data_variable_E_IRR = data_variable_E_IRR[29 :, :] / 28.94 * 365
ax1 = plt.subplot(2, 2, 1, projection=ccrs.PlateCarree())
ax1.text(0.01,0.92,'a',color='dimgrey',fontsize=12, transform=ax1.transAxes, weight = 'bold')
ax1.coastlines(linewidth=0.5)
#ax1.add_feature(cfeature.BORDERS, linestyle='-', linewidth=0.5)
ax1.add_feature(cfeature.OCEAN, color='lightgrey')
cmap='bwr_r'
bwr = mpl.cm.get_cmap('bwr_r')
colors = [bwr(0.1),bwr(0.2),bwr(0.3),bwr(0.4),bwr(0.5),bwr(0.6),bwr(0.7),bwr(0.8),bwr(0.9)]
cmap_bias1 = mpl.colors.ListedColormap(colors)
bounds = [-100, -50, -20, -1, 1, 20, 50, 100]
norm_bias1 = mpl.colors.BoundaryNorm(bounds,cmap_bias1.N,extend='both')
divider = make_axes_locatable(ax1)
h = ax1.pcolormesh(data_lon,data_lat,data_variable_E_IRR - data_variable_E_NOI, cmap=cmap_bias1, rasterized=True, norm=norm_bias1)
cbar = f.colorbar(h, ax=ax1, cmap=cmap,
spacing='uniform',
orientation='horizontal',
extend='both', shrink = 1, pad = 0, aspect = 50)
cbar.set_label('$\Delta$ E (mm/year)',fontsize = 12)
ticklabs = cbar.ax.get_xticklabels()
cbar.ax.set_xticklabels(ticklabs, fontsize=12)
plt.title('Evaporation (CTL - NOI)')
data_E_NOI = Data_from_nc('E:\Research1\\NOIRR\QVEGT_timmean.nc') #load the data
data_variable_E_NOI = data_E_NOI.load_variable('QVEGT')
data_variable_E_NOI[data_variable_E_NOI >= 10000000000] = None
data_variable_E_NOI = data_variable_E_NOI[0, :, :]
data_variable_E_NOI = data_variable_E_NOI[29 :, :] * 31536000
data_E_IRR = Data_from_nc('E:\Research1\\CTL\QVEGT_timmean.nc') #load the data
data_variable_E_IRR = data_E_IRR.load_variable('QVEGT')
data_variable_E_IRR[data_variable_E_IRR >= 10000000000] = None
data_variable_E_IRR = data_variable_E_IRR[0, :, :]
data_variable_E_IRR = data_variable_E_IRR[29 :, :] * 31536000
ax1 = plt.subplot(2, 2, 2, projection=ccrs.PlateCarree())
ax1.text(0.01,0.92,'b',color='dimgrey',fontsize=12, transform=ax1.transAxes, weight = 'bold')
ax1.coastlines(linewidth=0.5)
#ax1.add_feature(cfeature.BORDERS, linestyle='-', linewidth=0.5)
ax1.add_feature(cfeature.OCEAN, color='lightgrey')
cmap='bwr_r'
bwr = mpl.cm.get_cmap('bwr_r')
colors = [bwr(0.1),bwr(0.2),bwr(0.3),bwr(0.4),bwr(0.5),bwr(0.6),bwr(0.7),bwr(0.8),bwr(0.9)]
cmap_bias1 = mpl.colors.ListedColormap(colors)
bounds = [-50, -20, -10, -1, 1, 10, 20, 50]
norm_bias1 = mpl.colors.BoundaryNorm(bounds,cmap_bias1.N,extend='both')
divider = make_axes_locatable(ax1)
h = ax1.pcolormesh(data_lon,data_lat,data_variable_E_IRR - data_variable_E_NOI, cmap=cmap_bias1, rasterized=True, norm=norm_bias1)
cbar = f.colorbar(h, ax=ax1, cmap=cmap,
spacing='uniform',
orientation='horizontal',
extend='both', shrink = 1, pad = 0, aspect = 50)
cbar.set_label('$\Delta$ TR (mm/year)',fontsize = 12)
ticklabs = cbar.ax.get_xticklabels()
cbar.ax.set_xticklabels(ticklabs, fontsize=12)
plt.title('Transpiration (CTL - NOI)')
data_E_NOI = Data_from_nc('E:\Research1\\NOIRR\QRUNOFF_timmean.nc') #load the data
data_variable_E_NOI = data_E_NOI.load_variable('QRUNOFF')
data_variable_E_NOI[data_variable_E_NOI >= 10000000000] = None
data_variable_E_NOI = data_variable_E_NOI[0, :, :]
data_variable_E_NOI = data_variable_E_NOI[29 :, :] * 31536000
data_E_IRR = Data_from_nc('E:\Research1\\CTL\QRUNOFF_timmean.nc') #load the data
data_variable_E_IRR = data_E_IRR.load_variable('QRUNOFF')
data_variable_E_IRR[data_variable_E_IRR >= 10000000000] = None
data_variable_E_IRR = data_variable_E_IRR[0, :, :]
data_variable_E_IRR = data_variable_E_IRR[29 :, :] * 31536000
f.subplots_adjust(hspace=0.15, wspace=0.1, left = 0.05, right = 0.95, top = 0.95, bottom = 0.05)
ax1 = plt.subplot(2, 2, 3, projection=ccrs.PlateCarree())
ax1.text(0.01,0.92,'c',color='dimgrey',fontsize=12, transform=ax1.transAxes, weight = 'bold')
ax1.coastlines(linewidth=0.5)
#ax1.add_feature(cfeature.BORDERS, linestyle='-', linewidth=0.5)
ax1.add_feature(cfeature.OCEAN, color='lightgrey')
cmap='bwr_r'
bwr = mpl.cm.get_cmap('bwr_r')
colors = [bwr(0.1),bwr(0.2),bwr(0.3),bwr(0.4),bwr(0.5),bwr(0.6),bwr(0.7),bwr(0.8),bwr(0.9)]
cmap_bias1 = mpl.colors.ListedColormap(colors)
bounds = [-100, -50, -20, -1, 1, 20, 50, 100]
norm_bias1 = mpl.colors.BoundaryNorm(bounds,cmap_bias1.N,extend='both')
divider = make_axes_locatable(ax1)
h = ax1.pcolormesh(data_lon,data_lat,data_variable_E_IRR - data_variable_E_NOI, cmap=cmap_bias1, rasterized=True, norm=norm_bias1)
cbar = f.colorbar(h, ax=ax1, cmap=cmap,
spacing='uniform',
orientation='horizontal',
extend='both', shrink = 1, pad = 0, aspect = 50)
cbar.set_label('$\Delta$ Runoff (mm/year)',fontsize = 12)
ticklabs = cbar.ax.get_xticklabels()
cbar.ax.set_xticklabels(ticklabs, fontsize=12)
plt.title('Runoff (CTL - NOI)')
data_E_NOI = Data_from_nc('E:\Research1\\NOIRR\TOTSOILLIQ_timmean.nc') #load the data
data_variable_E_NOI = data_E_NOI.load_variable('TOTSOILLIQ')
data_variable_E_NOI[data_variable_E_NOI >= 10000000000] = None
data_variable_E_NOI = data_variable_E_NOI[0, :, :]
data_variable_E_NOI = data_variable_E_NOI[29 :, :]
data_E_IRR = Data_from_nc('E:\Research1\\CTL\TOTSOILLIQ_timmean.nc') #load the data
data_variable_E_IRR = data_E_IRR.load_variable('TOTSOILLIQ')
data_variable_E_IRR[data_variable_E_IRR >= 10000000000] = None
data_variable_E_IRR = data_variable_E_IRR[0, :, :]
data_variable_E_IRR = data_variable_E_IRR[29 :, :]
ax1 = plt.subplot(2, 2, 4, projection=ccrs.PlateCarree())
ax1.text(0.01,0.92,'d',color='dimgrey',fontsize=12, transform=ax1.transAxes, weight = 'bold')
ax1.coastlines(linewidth=0.5)
#ax1.add_feature(cfeature.BORDERS, linestyle='-', linewidth=0.5)
ax1.add_feature(cfeature.OCEAN, color='lightgrey')
cmap='BrBG'
bwr = mpl.cm.get_cmap('bwr_r')
colors = [bwr(0.1),bwr(0.2),bwr(0.3),bwr(0.4),bwr(0.5),bwr(0.6),bwr(0.7),bwr(0.8),bwr(0.9)]
cmap_bias1 = mpl.colors.ListedColormap(colors)
bounds = [-100, -50, -20, -1, 1, 20, 50, 100]
norm_bias1 = mpl.colors.BoundaryNorm(bounds,cmap_bias1.N,extend='both')
divider = make_axes_locatable(ax1)
h = ax1.pcolormesh(data_lon,data_lat,data_variable_E_IRR - data_variable_E_NOI, cmap=cmap_bias1, rasterized=True, norm=norm_bias1)
cbar = f.colorbar(h, ax=ax1, cmap=cmap,
spacing='uniform',
orientation='horizontal',
extend='both', shrink = 1, pad = 0, aspect = 50)
cbar.set_label('$\Delta$ TSW (kg/$m^2$)',fontsize = 12)
ticklabs = cbar.ax.get_xticklabels()
cbar.ax.set_xticklabels(ticklabs, fontsize=12)
plt.title('Total soil water (CTL - NOI)')
plt.savefig('E:\Data_Evaluation\Data_for_evaluation\Irrigation_amount\Fig\\Water1.png')