-
Notifications
You must be signed in to change notification settings - Fork 15
/
func_sst_vshear.ncl
185 lines (163 loc) · 5.21 KB
/
func_sst_vshear.ncl
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
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "/walker1/pgchiu/func_read/func_read_ersst.ncl"
;load "func_read_era_all.ncl"
load "func_read_reanalysis.ncl"
undef("read_wind_shear")
function read_wind_shear(years[*],mons[*])
begin
vn = "U"
vn@lev = 850
u850 = read_reanalysis_monly(years,vn)
vn = "V"
v850 = read_reanalysis_monly(years,vn)
vn = "U"
vn@lev = 200
u200 = read_reanalysis_monly(years,vn)
vn = "V"
v200 = read_reanalysis_monly(years,vn)
;; cal vertical wind shear in monthly data
ushear = u200 - u850
vshear = v200 - v850
shearmons = u850
shearmons = sqrt(ushear*ushear + vshear*vshear)
shearclm = clmMonTLL(shearmons)
shearneed = dim_avg_n_Wrap(shearclm({mons-1},:,:),0)
return shearneed
end
undef("plot_sst_vshear")
function plot_sst_vshear(years[*],mons[*],filename,title)
begin
load "res_years.ncl"
nm = dimsizes(mons)
;; read sst
sst = read_ersst(years)
sstclm = clmMonTLL(sst)
sstneed = dim_avg_n_Wrap(sstclm({mons-1},:,:),0) ;; mon = 0-11
delete(sst)
delete(sstclm)
if (isatt(years,"clm").and.years@clm)then
sstspacing = 0.5
sstmax = 30.
sstmin = 26
sstcolorstart= 11
else
sst = read_ersst(allyears)
sstclm = clmMonTLL(sst)
sstneed = sstneed - dim_avg_n_Wrap(sstclm({mons-1},:,:),0) ;; mon = 0-11
sstspacing = 0.2
sstmax = 0.6
sstmin = -0.6
sstcolorstart= 1
end if
;; read wind to vertical wind shear(200hPa-850hPa)
shearneed = read_wind_shear(years,mons)
if (True.or.isatt(years,"clm").and.years@clm)then
vsspacing = 2.
else
shearneed = shearneed - read_wind_shear(allyears,mons)
vsspacing = 1.
end if
;; ploting
wks = gsn_open_wks("ps",filename)
gsn_define_colormap(wks,"temp_19lev")
res = True
res@tiMainString = title
res@tiMainJust = "CenterLeft"
res@tiMainPosition = "Left"
res@gsnLeftString = ""
res@gsnRightString = ""
res@gsnDraw = False
res@gsnFrame = False
res@mpCenterLonF = 180. ; center plot at 180
res@mpMinLonF = 110. ; select a subregion
res@mpMaxLonF = 180.
res@mpMinLatF = 00.
res@mpMaxLatF = 40.
res@cnLevelSelectionMode = "ManualLevels"
res@cnMinLevelValF = sstmin
res@cnMaxLevelValF = sstmax
res@cnLevelSpacingF = sstspacing
;res@lbLabelStride = 5
res@gsnSpreadColorStart = sstcolorstart
res@gsnSpreadColors = True
res2 = True
;res2@cnLevelSelectionMode = "ExplicitLevels"
;res2@cnLevels = (/27,30/)
res2@cnLevelSpacingF = vsspacing
res2@cnLineLabelInterval = 1
res2@cnInfoLabelOn = False
res2@cnMonoLineThickness = False
res2@gsnContourNegLineDashPattern = 1
res2@gsnContourZeroLineThicknessF = 3.
;res2@cnLineThicknesses =(/2.,1.5,1./)
plot = gsn_csm_contour_map_overlay(wks,sstneed,shearneed,res,res2)
draw(plot)
frame(wks)
print("plot: "+filename)
return True
end
undef("plot_sst_vshear_SONdJJA")
function plot_sst_vshear_SONdJJA(years[*],filename,title)
begin
load "res_years.ncl"
;; read sst
sst = read_ersst(years)
sstclm = clmMonTLL(sst)
sstJJA = dim_avg_n_Wrap(sstclm({JJA-1},:,:),0) ;; mon = 0-11
sstSON = dim_avg_n_Wrap(sstclm({SON-1},:,:),0) ;; mon = 0-11
sstneed = sstSON
sstneed = sstSON - sstJJA
delete(sst)
delete(sstclm)
delete(sstJJA)
delete(sstSON)
sstspacing = 0.4
sstmax = 1.2
sstmin = -1.2
sstcolorstart= 1
;; read wind to vertical wind shear(200hPa-850hPa)
shearJJA = read_wind_shear(years,JJA)
shearSON = read_wind_shear(years,SON)
shearneed = shearSON
shearneed = shearSON - shearJJA
vsspacing = 1.
;; ploting
wks = gsn_open_wks("ps",filename)
gsn_define_colormap(wks,"temp_19lev")
res = True
res@tiMainString = title
res@tiMainJust = "CenterLeft"
res@tiMainPosition = "Left"
res@gsnLeftString = ""
res@gsnRightString = ""
res@gsnDraw = False
res@gsnFrame = False
res@mpCenterLonF = 180. ; center plot at 180
res@mpMinLonF = 110. ; select a subregion
res@mpMaxLonF = 180.
res@mpMinLatF = 00.
res@mpMaxLatF = 40.
res@cnLevelSelectionMode = "ManualLevels"
res@cnMinLevelValF = sstmin
res@cnMaxLevelValF = sstmax
res@cnLevelSpacingF = sstspacing
;res@lbLabelStride = 5
res@gsnSpreadColorStart = sstcolorstart
res@gsnSpreadColors = True
res2 = True
;res2@cnLevelSelectionMode = "ExplicitLevels"
;res2@cnLevels = (/27,30/)
res2@cnLevelSpacingF = vsspacing
res2@cnLineLabelInterval = 1
res2@cnInfoLabelOn = False
res2@cnMonoLineThickness = False
res2@gsnContourNegLineDashPattern = 1
res2@gsnContourZeroLineThicknessF = 3.
;res2@cnLineThicknesses =(/2.,1.5,1./)
plot = gsn_csm_contour_map_overlay(wks,sstneed,shearneed,res,res2)
draw(plot)
frame(wks)
print("plot: "+filename)
return True
end