Modifications to scoring and graphics production for the final version of code for the C-LAMP paper in GCB.
1 ; ***********************************************
3 ; ***********************************************
4 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
5 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
6 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
7 ;************************************************
9 ;************************************************
10 ; read in data: observed
11 ;************************************************
12 diri = "/fis/cgd/cseg/people/jeff/clamp_data/co2/"
13 fili = "co2_globalView_98.nc"
14 g = addfile (diri+fili,"r")
18 sta = chartostring(g->STATION)
26 ;**************************************************************
27 ; get only the lowest level at each station
28 ;**************************************************************
30 lat_tmp@_FillValue = 1.e+36
33 if (.not. ismissing(lat_tmp(n))) then
34 indexes = ind(lat(n) .eq. lat .and. lon(n) .eq. lon)
35 if (dimsizes(indexes) .gt. 1) then
36 lat_tmp(indexes(1:)) = lat_tmp@_FillValue
42 indexes = ind(.not. ismissing(lat_tmp))
43 ;print (dimsizes(indexes))
48 val_ob = val(indexes,:)
49 ;printVarSummary (val_ob)
50 ;print (lat_ob +"/"+lon_ob)
52 ;************************************************
54 ;************************************************
55 diri2 = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
56 fili2 = "b30.061m_401_425_MONS_climo.nc"
58 g = addfile(diri2+fili2,"r")
67 ; get the co2 at the lowest level
70 ; change to unit of observed (u mol/mol)
71 ; Model_units [=] kgCO2 / kgDryAir
72 ; 28.966 = molecular weight of dry air
73 ; 44. = molecular weight of CO2
76 factor = (28.966/44.) * 1e6
81 ; y = where(y0 .lt. 287.,y@_FillValue,y)
83 ; print (min(y)+"/"+max(y))
85 ; interpolate into observed station
86 ; note: model is 0-360E, 90S-90N
88 ; to be able to handle observation at (-89.98,-24.80)
92 i = ind(lon_ob .lt. 0.)
93 lon_ob(i) = lon_ob(i) + 360.
95 yo = linint2_points_Wrap(xi,yi,y,True,lon_ob,lat_ob,0)
97 val_model = yo(pts|:,time|:)
98 ; printVarSummary (val_model)
99 ; print (min(val_model)+"/"+max(val_model))
102 val_model = val_model - conform(val_model,dim_avg(val_model),0)
103 ; print (min(val_model)+"/"+max(val_model))
105 plot_sta = new((/2,12/),float)
106 plot_sta@long_name = "Seasonal CO2"
109 mon@long_name = "month"
112 plot_type_new = "png"
114 res = True ; plot mods desired
115 res@xyLineThicknesses = (/1.0,2.0/) ; make 2nd lines thicker
116 res@xyLineColors = (/"blue","red"/) ; change line color
118 ;------------------------------------------------------------------
119 ; Add a boxed legend using the more simple method, which won't have
120 ; vertical lines going through the markers.
122 res@pmLegendDisplayMode = "Always"
123 ; res@pmLegendWidthF = 0.1
124 res@pmLegendWidthF = 0.08
125 res@pmLegendHeightF = 0.05
126 ; res@pmLegendOrthogonalPosF = -1.17
127 ; res@pmLegendOrthogonalPosF = -1.00 ;(downward)
128 res@pmLegendOrthogonalPosF = -0.30 ;(downward)
130 ; res@pmLegendParallelPosF = 0.18
131 res@pmLegendParallelPosF = 0.23 ;(rightward)
133 ; res@lgPerimOn = False
134 res@lgLabelFontHeightF = 0.015
135 res@xyExplicitLegendLabels = (/"observed","model_b30.061m"/)
136 ;-------------------------------------------------------------------
142 ; maximum score for the zone, 60N-90N
144 ; index of stations in this zone
145 ind_z = ind(lat_ob .ge. 60.)
147 ; print (lat_ob(ind_z)+"/"+lon_ob(ind_z))
148 ; print (val_ob(ind_z,:))
149 ; print (val_model(ind_z,:))
153 ; maximum score for the zone, 30N-60N
155 ; index of stations in this zone
156 ind_z = ind(lat_ob .ge. 30. .and. lat_ob .lt. 60.)
158 ; print (lat_ob(ind_z)+"/"+lon_ob(ind_z))
159 ; print (val_ob(ind_z,:))
160 ; print (val_model(ind_z,:))
164 ; maximum score for the zone, EQ-30N
166 ; index of stations in this zone
167 ind_z = ind(lat_ob .ge. 0. .and. lat_ob .lt. 30.)
169 ; print (lat_ob(ind_z)+"/"+lon_ob(ind_z))
170 ; print (val_ob(ind_z,:))
171 ; print (val_model(ind_z,:))
175 ; maximum score for the zone, 90S-EQ
177 ; index of stations in this zone
178 ind_z = ind(lat_ob .lt. 0. )
180 ; print (lat_ob(ind_z)+"/"+lon_ob(ind_z))
181 ; print (val_ob(ind_z,:))
182 ; print (val_model(ind_z,:))
185 npts = dimsizes(ind_z)
190 plot_sta(0,:) = (/val_ob(ind_z(n),:)/)
191 plot_sta(1,:) = (/val_model(ind_z(n),:)/)
193 title = sta(ind_z(n))+"("+lat(ind_z(n))+","+lon(ind_z(n))+")"
194 plot_name = sta(ind_z(n))
199 wks = gsn_open_wks (plot_type,plot_name) ; open workstation
200 res@tiMainString = title ; add title
202 plot = gsn_csm_xy (wks,mon,plot_sta,res) ; create plot
205 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
206 system("rm "+plot_name+"."+plot_type)
207 system("rm "+plot_name+"-1."+plot_type_new)
208 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)