-
Notifications
You must be signed in to change notification settings - Fork 15
/
func_plot_rhvo.ncl
104 lines (95 loc) · 2.83 KB
/
func_plot_rhvo.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
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;load "func_read_era_all.ncl"
load "func_read_reanalysis.ncl"
function plot_rhvo(years[*],mons[*],title,filename)
begin
if(isatt(years,"RHlev"))then
RHlev = years@RHlev
else
RHlev = 700
end if
if(isatt(years,"VORlev"))then
VORlev = years@VORlev
else
VORlev = 850
end if
;; read rh
vn = "RH"
vn@lev = RHlev
rh = read_reanalysis_monclm(years,vn)
prh = dim_avg_n_Wrap(rh({mons},:,:),0)
;; read vo and turn to absolute vorticity
vn = "VOR"
vn@lev = VORlev
vor = read_reanalysis_monclm(years,vn)
pvor = dim_avg_n_Wrap(vor({mons},:,:),0)
if (isatt(years,"absvor"))then ;; to abs. vor.
f = pvor
dims = dimsizes(f)
if(isatt(years,"clm").and.(.not.years@clm))then
f = 0
else
do j = 0, dims(0)-1
f(j,:) = (2.*2*3.14/86400.) * sin(f&lat(j)/180*3.14)
end do
end if
pvor = pvor+f
end if
scale = 1.e05
pvor = pvor*scale
;; set plot res
res = True
res@tiMainString = title
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@cnMaxLevelValF = 2.
res@cnMinLevelValF = -2.
res@cnLevelSpacingF = .5
res@gsnSpreadColors = True
res@cnSmoothingOn = True
res@cnSmoothingDistanceF = 0.005
res2 = True
res2@cnLevelSelectionMode = "ManualLevels"
res2@cnMaxLevelValF = 100.
res2@cnMinLevelValF = 0.
res2@cnLevelSpacingF = 5.
res2@cnInfoLabelOn = False
;; anomaly
if(isatt(years,"clm").and.(.not.years@clm))then
res2@cnLevelSpacingF = 1.
res@cnMaxLevelValF = 0.5
res@cnMinLevelValF = -0.5
res@cnLevelSpacingF = 0.1
end if
;; plot
wks = gsn_open_wks("ps",filename)
gsn_define_colormap(wks,"BlWhRe")
pvor@long_name= ""
pvor@units = ""
prh@long_name = ""
prh@units = ""
plot = gsn_csm_contour_map_overlay(wks,pvor,prh,res,res2)
res2@cnLineThicknessF = 3.5
res2@cnLevelSelectionMode = "ExplicitLevels"
res2@cnLevels = 60.
res2@gsnFrame = False
res2@gsnDraw = False
res2@lbLabelBarOn = False
res2@cnInfoLabelOn =False
res2@cnLineLabelsOn = False
plot2 = gsn_csm_contour(wks,prh,res2)
overlay(plot,plot2)
draw(plot)
frame(wks)
print("plot: "+filename)
return True
end