forrest@0
|
1 |
; ***********************************************
|
forrest@0
|
2 |
; add panel plot to 22.lines.ncl
|
forrest@0
|
3 |
; add zone plot to 21.lines.ncl
|
forrest@0
|
4 |
; ***********************************************
|
forrest@0
|
5 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
|
forrest@0
|
6 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
|
forrest@0
|
7 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
|
forrest@0
|
8 |
;************************************************
|
forrest@0
|
9 |
begin
|
forrest@0
|
10 |
;************************************************
|
forrest@0
|
11 |
; read in data: observed
|
forrest@0
|
12 |
;************************************************
|
forrest@0
|
13 |
diri = "/fis/cgd/cseg/people/jeff/clamp_data/co2/"
|
forrest@0
|
14 |
fili = "co2_globalView_98.nc"
|
forrest@0
|
15 |
g = addfile (diri+fili,"r")
|
forrest@0
|
16 |
val = g->CO2_SEAS
|
forrest@0
|
17 |
lon = g->LON
|
forrest@0
|
18 |
lat = g->LAT
|
forrest@0
|
19 |
sta = chartostring(g->STATION)
|
forrest@0
|
20 |
delete (g)
|
forrest@0
|
21 |
|
forrest@0
|
22 |
;print (sta(0))
|
forrest@0
|
23 |
|
forrest@0
|
24 |
ncase = dimsizes(lat)
|
forrest@0
|
25 |
;print (ncase)
|
forrest@0
|
26 |
|
forrest@0
|
27 |
;**************************************************************
|
forrest@0
|
28 |
; get only the lowest level at each station
|
forrest@0
|
29 |
;**************************************************************
|
forrest@0
|
30 |
lat_tmp = lat
|
forrest@0
|
31 |
lat_tmp@_FillValue = 1.e+36
|
forrest@0
|
32 |
|
forrest@0
|
33 |
do n = 0,ncase-1
|
forrest@0
|
34 |
if (.not. ismissing(lat_tmp(n))) then
|
forrest@0
|
35 |
indexes = ind(lat(n) .eq. lat .and. lon(n) .eq. lon)
|
forrest@0
|
36 |
if (dimsizes(indexes) .gt. 1) then
|
forrest@0
|
37 |
lat_tmp(indexes(1:)) = lat_tmp@_FillValue
|
forrest@0
|
38 |
end if
|
forrest@0
|
39 |
delete (indexes)
|
forrest@0
|
40 |
end if
|
forrest@0
|
41 |
end do
|
forrest@0
|
42 |
|
forrest@0
|
43 |
indexes = ind(.not. ismissing(lat_tmp))
|
forrest@0
|
44 |
;print (dimsizes(indexes))
|
forrest@0
|
45 |
;print (indexes)
|
forrest@0
|
46 |
|
forrest@0
|
47 |
lat_ob = lat(indexes)
|
forrest@0
|
48 |
lon_ob = lon(indexes)
|
forrest@0
|
49 |
val_ob = val(indexes,:)
|
forrest@0
|
50 |
;printVarSummary (val_ob)
|
forrest@0
|
51 |
;print (lat_ob +"/"+lon_ob)
|
forrest@0
|
52 |
|
forrest@0
|
53 |
;************************************************
|
forrest@0
|
54 |
; read in model data
|
forrest@0
|
55 |
;************************************************
|
forrest@0
|
56 |
diri2 = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
|
forrest@0
|
57 |
; fili2 = "b30.061m_401_425_MONS_climo.nc"
|
forrest@0
|
58 |
fili2 = "b30.061n_1995-2004_MONS_climo.nc"
|
forrest@0
|
59 |
|
forrest@0
|
60 |
g = addfile(diri2+fili2,"r")
|
forrest@0
|
61 |
x = g->CO2
|
forrest@0
|
62 |
xi = g->lon
|
forrest@0
|
63 |
yi = g->lat
|
forrest@0
|
64 |
xdim = dimsizes(x)
|
forrest@0
|
65 |
nlev = xdim(1)
|
forrest@0
|
66 |
y = x(:,0,:,:)
|
forrest@0
|
67 |
; printVarSummary (y)
|
forrest@0
|
68 |
|
forrest@0
|
69 |
; get the co2 at the lowest level
|
forrest@0
|
70 |
y = x(:,nlev-1,:,:)
|
forrest@0
|
71 |
|
forrest@0
|
72 |
; change to unit of observed (u mol/mol)
|
forrest@0
|
73 |
; Model_units [=] kgCO2 / kgDryAir
|
forrest@0
|
74 |
; 28.966 = molecular weight of dry air
|
forrest@0
|
75 |
; 44. = molecular weight of CO2
|
forrest@0
|
76 |
; u mol = 1e-6 mol
|
forrest@0
|
77 |
|
forrest@0
|
78 |
factor = (28.966/44.) * 1e6
|
forrest@0
|
79 |
y = y * factor
|
forrest@0
|
80 |
|
forrest@0
|
81 |
y@_FillValue = 1.e36
|
forrest@0
|
82 |
y@units = "u mol/mol"
|
forrest@0
|
83 |
; y = where(y0 .lt. 287.,y@_FillValue,y)
|
forrest@0
|
84 |
; printVarSummary (y)
|
forrest@0
|
85 |
; print (min(y)+"/"+max(y))
|
forrest@0
|
86 |
|
forrest@0
|
87 |
; interpolate into observed station
|
forrest@0
|
88 |
; note: model is 0-360E, 90S-90N
|
forrest@0
|
89 |
|
forrest@0
|
90 |
; to be able to handle observation at (-89.98,-24.80)
|
forrest@0
|
91 |
print (yi(0))
|
forrest@0
|
92 |
yi(0) = -90.
|
forrest@0
|
93 |
|
forrest@0
|
94 |
i = ind(lon_ob .lt. 0.)
|
forrest@0
|
95 |
lon_ob(i) = lon_ob(i) + 360.
|
forrest@0
|
96 |
|
forrest@0
|
97 |
yo = linint2_points_Wrap(xi,yi,y,True,lon_ob,lat_ob,0)
|
forrest@0
|
98 |
|
forrest@0
|
99 |
val_model = yo(pts|:,time|:)
|
forrest@0
|
100 |
val_model_0 = val_model
|
forrest@0
|
101 |
; printVarSummary (val_model)
|
forrest@0
|
102 |
; print (min(val_model)+"/"+max(val_model))
|
forrest@0
|
103 |
|
forrest@0
|
104 |
; remove annual mean
|
forrest@0
|
105 |
val_model = val_model - conform(val_model,dim_avg(val_model),0)
|
forrest@0
|
106 |
; print (min(val_model)+"/"+max(val_model))
|
forrest@0
|
107 |
|
forrest@0
|
108 |
mon = ispan(1,12,1)
|
forrest@0
|
109 |
mon@long_name = "month"
|
forrest@0
|
110 |
|
forrest@0
|
111 |
plot_type = "ps"
|
forrest@0
|
112 |
plot_type_new = "png"
|
forrest@0
|
113 |
|
forrest@0
|
114 |
res = True ; plot mods desired
|
forrest@0
|
115 |
res@xyLineThicknesses = (/1.0,2.0/) ; make 2nd lines thicker
|
forrest@0
|
116 |
res@xyLineColors = (/"red","blue"/) ; change line color
|
forrest@0
|
117 |
|
forrest@0
|
118 |
;------------------------------------------------------------------
|
forrest@0
|
119 |
; Add a boxed legend using the more simple method, which won't have
|
forrest@0
|
120 |
; vertical lines going through the markers.
|
forrest@0
|
121 |
|
forrest@0
|
122 |
res@pmLegendDisplayMode = "Always"
|
forrest@0
|
123 |
; res@pmLegendWidthF = 0.1
|
forrest@0
|
124 |
res@pmLegendWidthF = 0.08
|
forrest@0
|
125 |
res@pmLegendHeightF = 0.05
|
forrest@0
|
126 |
; res@pmLegendOrthogonalPosF = -1.17
|
forrest@0
|
127 |
; res@pmLegendOrthogonalPosF = -1.00 ;(downward)
|
forrest@0
|
128 |
res@pmLegendOrthogonalPosF = -0.30 ;(downward)
|
forrest@0
|
129 |
|
forrest@0
|
130 |
; res@pmLegendParallelPosF = 0.18
|
forrest@0
|
131 |
res@pmLegendParallelPosF = 0.23 ;(rightward)
|
forrest@0
|
132 |
|
forrest@0
|
133 |
; res@lgPerimOn = False
|
forrest@0
|
134 |
res@lgLabelFontHeightF = 0.015
|
forrest@0
|
135 |
; res@xyExplicitLegendLabels = (/"model_b30.061m","observed"/)
|
forrest@0
|
136 |
res@xyExplicitLegendLabels = (/"model_b30.061n","observed"/)
|
forrest@0
|
137 |
;-------------------------------------------------------------------
|
forrest@0
|
138 |
|
forrest@0
|
139 |
nzone = 4
|
forrest@0
|
140 |
do z = 0,nzone-1
|
forrest@0
|
141 |
|
forrest@0
|
142 |
if (z .eq. 0) then
|
forrest@0
|
143 |
; maximum score for the zone, 60N-90N
|
forrest@0
|
144 |
score_max = 5.0
|
forrest@0
|
145 |
zone = "60N-90N"
|
forrest@0
|
146 |
; index of stations in this zone
|
forrest@0
|
147 |
ind_z = ind(lat_ob .ge. 60.)
|
forrest@0
|
148 |
; print (ind_z)
|
forrest@0
|
149 |
; print (lat_ob(ind_z)+"/"+lon_ob(ind_z))
|
forrest@0
|
150 |
; print (val_ob(ind_z,:))
|
forrest@0
|
151 |
; print (val_model(ind_z,:))
|
forrest@0
|
152 |
end if
|
forrest@0
|
153 |
|
forrest@0
|
154 |
if (z .eq. 1) then
|
forrest@0
|
155 |
; maximum score for the zone, 30N-60N
|
forrest@0
|
156 |
score_max = 5.0
|
forrest@0
|
157 |
zone = "30N-60N"
|
forrest@0
|
158 |
; index of stations in this zone
|
forrest@0
|
159 |
ind_z = ind(lat_ob .ge. 30. .and. lat_ob .lt. 60.)
|
forrest@0
|
160 |
; print (ind_z)
|
forrest@0
|
161 |
; print (lat_ob(ind_z)+"/"+lon_ob(ind_z))
|
forrest@0
|
162 |
; print (val_ob(ind_z,:))
|
forrest@0
|
163 |
; print (val_model(ind_z,:))
|
forrest@0
|
164 |
end if
|
forrest@0
|
165 |
|
forrest@0
|
166 |
if (z .eq. 2) then
|
forrest@0
|
167 |
; maximum score for the zone, EQ-30N
|
forrest@0
|
168 |
score_max = 5.0
|
forrest@0
|
169 |
zone = "EQ-30N"
|
forrest@0
|
170 |
; index of stations in this zone
|
forrest@0
|
171 |
ind_z = ind(lat_ob .ge. 0. .and. lat_ob .lt. 30.)
|
forrest@0
|
172 |
; print (ind_z)
|
forrest@0
|
173 |
; print (lat_ob(ind_z)+"/"+lon_ob(ind_z))
|
forrest@0
|
174 |
; print (val_ob(ind_z,:))
|
forrest@0
|
175 |
; print (val_model(ind_z,:))
|
forrest@0
|
176 |
end if
|
forrest@0
|
177 |
|
forrest@0
|
178 |
if (z .eq. 3) then
|
forrest@0
|
179 |
; maximum score for the zone, 90S-EQ
|
forrest@0
|
180 |
score_max = 5.0
|
forrest@0
|
181 |
zone = "90S-EQ"
|
forrest@0
|
182 |
; index of stations in this zone
|
forrest@0
|
183 |
ind_z = ind(lat_ob .lt. 0. )
|
forrest@0
|
184 |
; print (ind_z)
|
forrest@0
|
185 |
; print (lat_ob(ind_z)+"/"+lon_ob(ind_z))
|
forrest@0
|
186 |
; print (val_ob(ind_z,:))
|
forrest@0
|
187 |
; print (val_model(ind_z,:))
|
forrest@0
|
188 |
end if
|
forrest@0
|
189 |
|
forrest@0
|
190 |
npts = dimsizes(ind_z)
|
forrest@0
|
191 |
print (npts)
|
forrest@0
|
192 |
|
forrest@0
|
193 |
npts_str = ""
|
forrest@0
|
194 |
npts_str = npts
|
forrest@0
|
195 |
; print (npts_str)
|
forrest@0
|
196 |
|
forrest@0
|
197 |
plot_data = new((/2,12,npts/),float)
|
forrest@0
|
198 |
plot_data_0 = new((/12,npts/),float)
|
forrest@0
|
199 |
|
forrest@0
|
200 |
plot_data!0 = "case"
|
forrest@0
|
201 |
plot_data!1 = "month"
|
forrest@0
|
202 |
plot_data!2 = "pts"
|
forrest@0
|
203 |
plot_data@long_name = "CO2 Seasonal"
|
forrest@0
|
204 |
|
forrest@0
|
205 |
plot_data_0!0 = "month"
|
forrest@0
|
206 |
plot_data_0!1 = "pts"
|
forrest@0
|
207 |
plot_data_0@long_name = "CO2"
|
forrest@0
|
208 |
|
forrest@0
|
209 |
do n=0,npts-1
|
forrest@0
|
210 |
|
forrest@0
|
211 |
plot_data(1,:,n) = (/val_ob(ind_z(n),:)/)
|
forrest@0
|
212 |
plot_data(0,:,n) = (/val_model(ind_z(n),:)/)
|
forrest@0
|
213 |
plot_data_0(:,n) = (/val_model_0(ind_z(n),:)/)
|
forrest@0
|
214 |
|
forrest@0
|
215 |
title1 = sta(ind_z(n))+"("+lat(ind_z(n))+","+lon(ind_z(n))+")"
|
forrest@0
|
216 |
plot_name = sta(ind_z(n))
|
forrest@0
|
217 |
|
forrest@0
|
218 |
; print (title1)
|
forrest@0
|
219 |
; print (plot_name)
|
forrest@0
|
220 |
;***********************************************
|
forrest@0
|
221 |
; create panel plot
|
forrest@0
|
222 |
;***********************************************
|
forrest@0
|
223 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
224 |
plot=new(2,graphic) ; create graphic array
|
forrest@0
|
225 |
res@gsnFrame = False ; Do not draw plot
|
forrest@0
|
226 |
res@gsnDraw = False ; Do not advance frame
|
forrest@0
|
227 |
|
forrest@0
|
228 |
res@tiMainString = title1 ; add title
|
forrest@0
|
229 |
plot(0)=gsn_csm_xy(wks,mon,plot_data(:,:,n),res) ; create plot 1
|
forrest@0
|
230 |
|
forrest@0
|
231 |
; title2 = "Model b30.061m"
|
forrest@0
|
232 |
title2 = "Model b30.061n"
|
forrest@0
|
233 |
res@tiMainString = title2 ; add title
|
forrest@0
|
234 |
plot(1)=gsn_csm_xy(wks,mon,plot_data_0(:,n),res) ; create plot 2
|
forrest@0
|
235 |
|
forrest@0
|
236 |
pres = True ; panel plot mods desired
|
forrest@0
|
237 |
pres@gsnPanelYWhiteSpacePercent = 5 ; increase white space around
|
forrest@0
|
238 |
; indiv. plots in panel
|
forrest@0
|
239 |
pres@gsnMaximize = True ; fill the page
|
forrest@0
|
240 |
|
forrest@0
|
241 |
gsn_panel(wks,plot,(/2,1/),pres) ; create panel plot
|
forrest@0
|
242 |
|
forrest@0
|
243 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
244 |
system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
245 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
246 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
247 |
clear (wks)
|
forrest@0
|
248 |
end do
|
forrest@0
|
249 |
|
forrest@0
|
250 |
; plot zone average
|
forrest@0
|
251 |
|
forrest@0
|
252 |
plot_name = "All_"+npts_str
|
forrest@0
|
253 |
title = plot_name + " in "+ zone
|
forrest@0
|
254 |
|
forrest@0
|
255 |
print (title)
|
forrest@0
|
256 |
print (plot_name)
|
forrest@0
|
257 |
|
forrest@0
|
258 |
wks = gsn_open_wks (plot_type,plot_name) ; open workstation
|
forrest@0
|
259 |
plot=new(2,graphic) ; create graphic array
|
forrest@0
|
260 |
res@gsnFrame = False ; Do not draw plot
|
forrest@0
|
261 |
res@gsnDraw = False ; Do not advance frame
|
forrest@0
|
262 |
|
forrest@0
|
263 |
res@tiMainString = title ; add title
|
forrest@0
|
264 |
plot(0) = gsn_csm_xy (wks,mon,dim_avg_Wrap(plot_data),res) ; create plot 1
|
forrest@0
|
265 |
|
forrest@0
|
266 |
; title2 = "Model b30.061m"
|
forrest@0
|
267 |
title2 = "Model b30.061n"
|
forrest@0
|
268 |
res@tiMainString = title2
|
forrest@0
|
269 |
plot(1) = gsn_csm_xy (wks,mon,dim_avg_Wrap(plot_data_0),res) ; create plot 2
|
forrest@0
|
270 |
|
forrest@0
|
271 |
pres = True ; panel plot mods desired
|
forrest@0
|
272 |
pres@gsnPanelYWhiteSpacePercent = 5 ; increase white space around
|
forrest@0
|
273 |
; indiv. plots in panel
|
forrest@0
|
274 |
pres@gsnMaximize = True ; fill the page
|
forrest@0
|
275 |
|
forrest@0
|
276 |
gsn_panel(wks,plot,(/2,1/),pres) ; create panel plot
|
forrest@0
|
277 |
|
forrest@0
|
278 |
system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
279 |
system("rm "+plot_name+"."+plot_type)
|
forrest@0
|
280 |
; system("rm "+plot_name+"-1."+plot_type_new)
|
forrest@0
|
281 |
; system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
|
forrest@0
|
282 |
|
forrest@0
|
283 |
clear (wks)
|
forrest@0
|
284 |
delete (ind_z)
|
forrest@0
|
285 |
delete (plot_data)
|
forrest@0
|
286 |
delete (plot_data_0)
|
forrest@0
|
287 |
end do
|
forrest@0
|
288 |
end
|