1 ;*****************************************************
2 ; combine scatter, histogram, global and zonal plots
3 ; compute all correlation coef and M score
4 ; add 1-to-1 line in scatter plots
5 ;*****************************************************
6 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl.test"
7 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl.test"
8 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
9 ;*****************************************************
10 procedure get_bin(RAIN1_1D[*]:numeric, NPP1_1D[*]:numeric \
11 ,RAIN2_1D[*]:numeric, NPP2_1D[*]:numeric \
12 ,xvalues[*][*]:numeric, yvalues[*][*]:numeric \
13 ,mn_yvalues[*][*]:numeric, mx_yvalues[*][*]:numeric \
17 ; Calculaee "nice" bins for binning the data in equally spaced ranges.
18 ; input : RAIN1_1D, RAIN2_1D, NPP1_1D, NPP2_1D
19 ; output: xvalues, yvalues, mn_yvalues, mx_yvalues,dx4
21 nbins = 15 ; Number of bins to use.
23 nicevals = nice_mnmxintvl(min(RAIN1_1D),max(RAIN1_1D),nbins,True)
24 nvals = floattoint((nicevals(1) - nicevals(0))/nicevals(2) + 1)
25 range = fspan(nicevals(0),nicevals(1),nvals)
27 ; Use this range information to grab all the values in a
28 ; particular range, and then take an average.
34 ; xvalues = new((/2,nx/),typeof(RAIN1_1D))
35 xvalues(0,:) = range(0:nr-2) + (range(1:)-range(0:nr-2))/2.
36 dx = xvalues(0,1) - xvalues(0,0) ; range width
37 dx4 = dx/4 ; 1/4 of the range
38 xvalues(1,:) = xvalues(0,:) - dx/5.
39 ; yvalues = new((/2,nx/),typeof(RAIN1_1D))
40 ; mn_yvalues = new((/2,nx/),typeof(RAIN1_1D))
41 ; mx_yvalues = new((/2,nx/),typeof(RAIN1_1D))
45 ; See if we are doing model or observational data.
55 ; Loop through each range and check for values.
60 ; print("In range ["+range(i)+","+range(i+1)+")")
61 idx = ind((range(i).le.data).and.(data.lt.range(i+1)))
64 ; print("In range ["+range(i)+",)")
65 idx = ind(range(i).le.data)
68 ; Calculate average, and get min and max.
70 if(.not.any(ismissing(idx))) then
71 yvalues(nd,i) = avg(npp_data(idx))
72 mn_yvalues(nd,i) = min(npp_data(idx))
73 mx_yvalues(nd,i) = max(npp_data(idx))
77 yvalues(nd,i) = yvalues@_FillValue
78 mn_yvalues(nd,i) = yvalues@_FillValue
79 mx_yvalues(nd,i) = yvalues@_FillValue
82 ; Print out information.
84 ; print(data_types(nd) + ": " + count + " points, avg = " + yvalues(nd,i))
85 ; print("Min/Max: " + mn_yvalues(nd,i) + "/" + mx_yvalues(nd,i))
88 ; Clean up for next time in loop.
96 ;****************************************************************************
98 ;****************************************************************************
102 plot_type_new = "png"
104 ;************************************************
106 ;************************************************
108 ;film = "i01.06cn_1798-2004_ANN_climo.nc"
112 ;film = "i01.06casa_1798-2004_ANN_climo.nc"
113 ;model_name = "06casa"
116 film = "i01.10casa_1948-2004_ANN_climo.nc"
117 model_name = "10casa"
120 ;film = "i01.10cn_1948-2004_ANN_climo.nc"
123 ;--------------------------------------------------
124 dirm = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
125 fm = addfile (dirm+film,"r")
132 ;************************************************
134 ;************************************************
136 ;(1) data at 81 sites
137 dir81 = "/fis/cgd/cseg/people/jeff/clamp_data/npp/ob/"
139 f81 = addfile (dir81+fil81,"r")
143 rain81 = tofloat(f81->PREC_ANN)
147 id81@long_name = "SITE_ID"
149 ;change longitude from (-180,180) to (0,360)
150 ;for model data interpolation
152 do i= 0,dimsizes(x81)-1
153 if (x81(i) .lt. 0.) then
154 x81(i) = x81(i)+ 360.
158 ;-------------------------------------
159 ;(2) data at 933 sites
160 dir933 = "/fis/cgd/cseg/people/jeff/clamp_data/npp/ob/"
161 fil933 = "data.933.nc"
162 f933 = addfile (dir933+fil933,"r")
164 id933 = f933->SITE_ID
165 npp933 = f933->TNPP_C
170 id933@long_name = "SITE_ID"
172 ;change longitude from (-180,180) to (0,360)
173 ;for model data interpolation
175 do i= 0,dimsizes(x933)-1
176 if (x933(i) .lt. 0.) then
177 x933(i) = x933(i)+ 360.
181 ;----------------------------------------
182 ;(3) global data, interpolated into model grid
183 dirglobe = "/fis/cgd/cseg/people/jeff/clamp_data/npp/ob/"
184 filglobe = "Npp_"+model_grid+"_mean.nc"
185 fglobe = addfile (dirglobe+filglobe,"r")
187 nppglobe0 = fglobe->NPP
190 ;***********************************************************************
191 ; interpolate model data into ob sites
192 ;***********************************************************************
194 nppmod = nppmod0(0,:,:)
195 rainmod = rainmod0(0,:,:)
199 nppmod81 =linint2_points(xm,ym,nppmod,True,x81,y81,0)
201 nppmod933 =linint2_points(xm,ym,nppmod,True,x933,y933,0)
203 rainmod81 =linint2_points(xm,ym,rainmod,True,x81,y81,0)
205 rainmod933=linint2_points(xm,ym,rainmod,True,x933,y933,0)
207 ;**********************************************************
209 ;**********************************************************
210 ; Units for these variables are:
214 ; npp81 : g C/m^2/year
215 ; nppmod81: g C/m^2/s
216 ; nppglobe: g C/m^2/year
218 ; We want to convert these to "m/year" and "g C/m^2/year".
220 nsec_per_year = 60*60*24*365
222 rain81 = rain81 / 1000.
223 rainmod81 = (rainmod81/ 1000.) * nsec_per_year
224 nppmod81 = nppmod81 * nsec_per_year
226 rain933 = rain933 / 1000.
227 rainmod933 = (rainmod933/ 1000.) * nsec_per_year
228 nppmod933 = nppmod933 * nsec_per_year
230 nppmod = nppmod * nsec_per_year
232 npp81@units = "gC/m^2/yr"
233 nppmod81@units = "gC/m^2/yr"
234 npp933@units = "gC/m^2/yr"
235 nppmod933@units = "gC/m^2/yr"
236 nppmod@units = "gC/m^2/yr"
237 nppglobe@units = "gC/m^2/yr"
238 rain81@units = "m/yr"
239 rainmod81@units = "m/yr"
240 rain933@units = "m/yr"
241 rainmod933@units = "m/yr"
243 npp81@long_name = "NPP (gC/m2/year)"
244 npp933@long_name = "NPP (gC/m2/year)"
245 nppmod81@long_name = "NPP (gC/m2/year)"
246 nppmod933@long_name = "NPP (gC/m2/year)"
247 nppmod@long_name = "NPP (gC/m2/year)"
248 nppglobe@long_name = "NPP (gC/m2/year)"
249 rain81@long_name = "PREC (m/year)"
250 rain933@long_name = "PREC (m/year)"
251 rainmod81@long_name = "PREC (m/year)"
252 rainmod933@long_name = "PREC (m/year)"
254 ;*******************************************************************
255 ;(A)-1 table of site81 (1) (the first 41 sites)
256 ;*******************************************************************
261 table_header_name = "Site ID"
263 ; column (not including header column)
264 col_header = (/"Latitude","Longitude","NPP (gC/m2/year)","RAIN (m/year)"/)
265 ncol = dimsizes(col_header)
267 ; row (not including header row)
269 row_header = new ((/nrow/),string )
270 row_header(0:nrow-1) = id81(0:nrow-1)
273 ncr1 = (/1,1/) ; 1 row, 1 column
274 x1 = (/0.005,0.15/) ; Start and end X
275 y1 = (/0.900,0.95/) ; Start and end Y
276 text1 = table_header_name
278 res1@txFontHeightF = 0.015
279 res1@gsFillColor = "CornFlowerBlue"
281 ; Column header (equally space in x2)
282 ncr2 = (/1,ncol/) ; 1 rows, ncol columns
283 x2 = (/x1(1),0.995/) ; start from end of x1
287 res2@txFontHeightF = 0.015
288 res2@gsFillColor = "Gray"
290 ; Row header (equally space in y2)
291 ncr3 = (/nrow,1/) ; nrow rows, 1 columns
293 y3 = (/1.0-table_length,y1(0)/) ; end at start of y1
296 res3@txFontHeightF = 0.010
297 res3@gsFillColor = "Gray"
300 ncr4 = (/nrow,ncol/) ; nrow rows, ncol columns
301 x4 = x2 ; Start and end x
302 y4 = y3 ; Start and end Y
303 text4 = new((/nrow,ncol/),string)
305 color_fill4 = new((/nrow,ncol/),string)
306 color_fill4 = "white"
307 ; color_fill4(:,ncol-1) = "grey"
308 ; color_fill4(nrow-1,:) = "green"
310 res4 = True ; Set up resource list
311 ; res4@gsnDebug = True ; Useful to print NDC row,col values used.
312 res4@txFontHeightF = 0.015
313 res4@gsFillColor = color_fill4
316 ;-------------------------------------------------------------------
320 text4(n,0) = sprintf("%5.2f", y81(n))
321 text4(n,1) = sprintf("%5.2f", x81(n))
322 text4(n,2) = sprintf("%5.2f", npp81(n))
323 text4(n,3) = sprintf("%5.2f", rain81(n))
325 ;-------------------------------------------------------------------
327 plot_name = "table_site81_ob1"
329 wks = gsn_open_wks (plot_type,plot_name)
330 ;------------------------------------------
334 gRes@txFontHeightF = 0.02
337 title_text = "Observation at 81 Sites (1)"
339 gsn_text_ndc(wks,title_text,0.50,0.975,gRes)
340 ;------------------------------------------
342 gsn_table(wks,ncr1,x1,y1,text1,res1)
343 gsn_table(wks,ncr2,x2,y2,text2,res2)
344 gsn_table(wks,ncr3,x3,y3,text3,res3)
345 gsn_table(wks,ncr4,x4,y4,text4,res4)
358 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
359 system("rm "+plot_name+"."+plot_type)
360 system("rm "+plot_name+"-1."+plot_type_new)
361 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
363 ;*******************************************************************
364 ;(A)-2 table of site81 (2) (the last 40 sites)
365 ;*******************************************************************
370 table_header_name = "Site ID"
372 ; column (not including header column)
373 col_header = (/"Latitude","Longitude","NPP (gC/m2/year)","RAIN (m/year)"/)
374 ncol = dimsizes(col_header)
376 ; row (not including header row)
378 row_header = new ((/nrow/),string )
379 row_header(0:nrow-1) = id81(41:41+nrow-1)
382 ncr1 = (/1,1/) ; 1 row, 1 column
383 x1 = (/0.005,0.15/) ; Start and end X
384 y1 = (/0.900,0.95/) ; Start and end Y
385 text1 = table_header_name
387 res1@txFontHeightF = 0.015
388 res1@gsFillColor = "CornFlowerBlue"
390 ; Column header (equally space in x2)
391 ncr2 = (/1,ncol/) ; 1 rows, ncol columns
392 x2 = (/x1(1),0.995/) ; start from end of x1
396 res2@txFontHeightF = 0.015
397 res2@gsFillColor = "Gray"
399 ; Row header (equally space in y2)
400 ncr3 = (/nrow,1/) ; nrow rows, 1 columns
402 y3 = (/1.0-table_length,y1(0)/) ; end at start of y1
405 res3@txFontHeightF = 0.010
406 res3@gsFillColor = "Gray"
409 ncr4 = (/nrow,ncol/) ; nrow rows, ncol columns
410 x4 = x2 ; Start and end x
411 y4 = y3 ; Start and end Y
412 text4 = new((/nrow,ncol/),string)
414 color_fill4 = new((/nrow,ncol/),string)
415 color_fill4 = "white"
416 ; color_fill4(:,ncol-1) = "grey"
417 ; color_fill4(nrow-1,:) = "green"
419 res4 = True ; Set up resource list
420 ; res4@gsnDebug = True ; Useful to print NDC row,col values used.
421 res4@txFontHeightF = 0.015
422 res4@gsFillColor = color_fill4
425 ;-------------------------------------------------------------------
429 text4(n,0) = sprintf("%5.2f", y81(n+41))
430 text4(n,1) = sprintf("%5.2f", x81(n+41))
431 text4(n,2) = sprintf("%5.2f", npp81(n+41))
432 text4(n,3) = sprintf("%5.2f", rain81(n+41))
434 ;-------------------------------------------------------------------
436 plot_name = "table_site81_ob2"
438 wks = gsn_open_wks (plot_type,plot_name)
439 ;------------------------------------------
443 gRes@txFontHeightF = 0.02
446 title_text = "Observation at 81 Sites (2)"
448 gsn_text_ndc(wks,title_text,0.50,0.975,gRes)
449 ;------------------------------------------
451 gsn_table(wks,ncr1,x1,y1,text1,res1)
452 gsn_table(wks,ncr2,x2,y2,text2,res2)
453 gsn_table(wks,ncr3,x3,y3,text3,res3)
454 gsn_table(wks,ncr4,x4,y4,text4,res4)
467 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
468 system("rm "+plot_name+"."+plot_type)
469 system("rm "+plot_name+"-1."+plot_type_new)
470 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
472 ;**************************************************************************
473 ;(A)-3 scatter plot, ob 933
474 ;**************************************************************************
476 plot_name = "scatter_ob_933"
477 title = "Observed 933 sites"
479 wks = gsn_open_wks (plot_type,plot_name) ; open workstation
480 res = True ; plot mods desired
481 res@tiMainString = title ; add title
482 res@xyMarkLineModes = "Markers" ; choose which have markers
483 res@xyMarkers = 16 ; choose type of marker
484 res@xyMarkerColor = "red" ; Marker color
485 res@xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
486 res@tmLabelAutoStride = True ; nice tick mark labels
488 plot = gsn_csm_xy (wks,id933,npp933,res) ; create plot
492 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
493 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
494 system("rm "+plot_name+"-*."+plot_type_new)
495 system("rm "+plot_name+"."+plot_type)
497 ;**************************************************************************
498 ;(A)-4 scatter plot, model 933
499 ;**************************************************************************
501 plot_name = "scatter_model_933"
502 title = "Model "+ model_name +" 933 sites"
504 wks = gsn_open_wks (plot_type,plot_name) ; open workstation
505 res = True ; plot mods desired
506 res@tiMainString = title ; add title
507 res@xyMarkLineModes = "Markers" ; choose which have markers
508 res@xyMarkers = 16 ; choose type of marker
509 res@xyMarkerColor = "red" ; Marker color
510 res@xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
511 res@tmLabelAutoStride = True ; nice tick mark labels
513 plot = gsn_csm_xy (wks,id933,nppmod933,res) ; create plot
517 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
518 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
519 system("rm "+plot_name+"-*."+plot_type_new)
520 system("rm "+plot_name+"."+plot_type)
522 ;***************************************************************************
523 ;(A)-5 scatter plot, model vs ob 81
524 ;***************************************************************************
526 plot_name = "scatter_model_vs_ob_81"
527 title = model_name +" vs ob 81 sites"
529 wks = gsn_open_wks (plot_type,plot_name) ; open workstation
530 res = True ; plot mods desired
531 res@tiMainString = title ; add title
532 res@xyMarkLineModes = "Markers" ; choose which have markers
533 res@xyMarkers = 16 ; choose type of marker
534 res@xyMarkerColor = "red" ; Marker color
535 res@xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
536 res@tmLabelAutoStride = True ; nice tick mark labels
539 res@gsnFrame = False ; don't advance frame yet
540 ;-------------------------------
541 ;compute correlation coef. and M
542 ccr81 = esccr(nppmod81,npp81,0)
546 bias = sum(abs(nppmod81-npp81)/(abs(nppmod81)+abs(npp81)))
547 M81 = (1. - (bias/dimsizes(y81)))*5.
551 tRes@txFontHeightF = 0.025
553 correlation_text = "(correlation coef = "+sprintf("%5.2f", ccr81)+")"
555 gsn_text_ndc(wks,correlation_text,0.5,0.95,tRes)
556 ;--------------------------------
557 plot = gsn_csm_xy (wks,npp81,nppmod81,res) ; create plot
558 ;-------------------------------
561 dum=gsn_add_polyline(wks,plot,(/0,1200/),(/0,1200/),False)
562 ;-------------------------------
568 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
569 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
570 system("rm "+plot_name+"-*."+plot_type_new)
571 system("rm "+plot_name+"."+plot_type)
573 ;***************************************************************************
574 ;(A)-6 scatter plot, model vs ob 933
575 ;***************************************************************************
577 plot_name = "scatter_model_vs_ob_933"
578 title = model_name +" vs ob 933 sites"
580 wks = gsn_open_wks (plot_type,plot_name) ; open workstation
581 res = True ; plot mods desired
582 res@tiMainString = title ; add title
583 res@xyMarkLineModes = "Markers" ; choose which have markers
584 res@xyMarkers = 16 ; choose type of marker
585 res@xyMarkerColor = "red" ; Marker color
586 res@xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
587 res@tmLabelAutoStride = True ; nice tick mark labels
590 res@gsnFrame = False ; don't advance frame yet
591 ;-------------------------------
592 ;compute correlation coef. and M
593 ccr933 = esccr(nppmod933,npp933,0)
597 bias = sum(abs(nppmod933-npp933)/(abs(nppmod933)+abs(npp933)))
598 M933 = (1. - (bias/dimsizes(y933)))*5.
602 tRes@txFontHeightF = 0.025
604 correlation_text = "(correlation coef = "+sprintf("%5.2f", ccr933)+")"
606 gsn_text_ndc(wks,correlation_text,0.5,0.95,tRes)
607 ;--------------------------------
608 plot = gsn_csm_xy (wks,npp933,nppmod933,res) ; create plot
609 ;-------------------------------
612 dum=gsn_add_polyline(wks,plot,(/0,1500/),(/0,1500/),False)
613 ;-------------------------------
619 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
620 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
621 system("rm "+plot_name+"-*."+plot_type_new)
622 system("rm "+plot_name+"."+plot_type)
624 ;*******************************************************************
625 ;(A)-7 table of site81 (1) (the first 41 sites), model vs ob
626 ;*******************************************************************
631 table_header_name = "Site ID"
633 ; row (not including header row)
635 row_header = new ((/nrow/),string )
636 row_header(0:nrow-1) = id81(0:nrow-1)
639 ncr1 = (/1,1/) ; 1 row, 1 column
640 x1 = (/0.005,0.15/) ; Start and end X
641 y1 = (/0.85 ,0.95/) ; Start and end Y
642 text1 = table_header_name
644 res1@txFontHeightF = 0.015
645 res1@gsFillColor = "CornFlowerBlue"
647 ; Column header1 (equally space in x2)
653 col_header = (/"Latitude","Longitude"/)
654 ncol = dimsizes(col_header)
656 ncr2 = (/1,ncol/) ; 1 rows, ncol columns
657 x2 = (/x1(1),0.35/) ; start from end of x1
661 res2@txFontHeightF = 0.015
662 res2@gsFillColor = "Gray"
664 ; Column header2 (equally space in x2)
666 col_header1 = (/"NPP (gC/m2/year)","RAIN (m/year)"/)
667 col_header2 = (/"ob",model_name \
671 ncol1 = dimsizes(col_header1)
672 ncol2 = dimsizes(col_header2)
674 ncr21 = (/1,ncol1/) ; 1 rows, 4 columns
675 x21 = (/x2(1),0.995/) ; start from end of x2
676 yhalf = (y1(0)+y1(1))*0.5
677 y21 = (/yhalf,y1(1)/) ; top half of y1
680 res21@txFontHeightF = 0.015
681 res21@gsFillColor = "Gray"
683 ncr22 = (/1,ncol2/) ; 1 rows, 12 columns
684 x22 = x21 ; start from end of x1
685 y22 = (/y1(0),yhalf/) ; bottom half of y1
688 res22@txFontHeightF = 0.015
689 res22@gsFillColor = "Gray"
691 ; Row header (equally space in y2)
692 ncr3 = (/nrow,1/) ; nrow rows, 1 columns
694 y3 = (/1.0-table_length,y1(0)/) ; end at start of y1
697 res3@txFontHeightF = 0.010
698 res3@gsFillColor = "Gray"
701 ncr4 = (/nrow,ncol/) ; nrow rows, ncol columns
702 x4 = x2 ; Start and end x
703 y4 = y3 ; Start and end Y
704 text4 = new((/nrow,ncol/),string)
706 color_fill4 = new((/nrow,ncol/),string)
707 color_fill4 = "white"
708 ; color_fill4(:,ncol-1) = "grey"
709 ; color_fill4(nrow-1,:) = "green"
711 res4 = True ; Set up resource list
712 ; res4@gsnDebug = True ; Useful to print NDC row,col values used.
713 res4@txFontHeightF = 0.015
714 res4@gsFillColor = color_fill4
719 ncr42 = (/nrow,ncol2/) ; nrow rows, ncol columns
720 x42 = x21 ; Start and end x
721 y42 = y3 ; Start and end Y
722 text42 = new((/nrow,ncol2/),string)
724 color_fill42 = new((/nrow,ncol2/),string)
725 color_fill42 = "white"
726 ; color_fill42(:,ncol-1) = "grey"
727 ; color_fill42(nrow-1,:) = "green"
729 res42 = True ; Set up resource list
730 ; res42@gsnDebug = True ; Useful to print NDC row,col values used.
731 res42@txFontHeightF = 0.015
732 res42@gsFillColor = color_fill42
734 delete (color_fill42)
735 ;-------------------------------------------------------------------
739 text4(n,0) = sprintf("%5.2f", y81(n))
740 text4(n,1) = sprintf("%5.2f", x81(n))
744 text42(n,0) = sprintf("%5.2f", npp81(n))
745 text42(n,1) = sprintf("%5.2f", nppmod81(n))
746 text42(n,2) = sprintf("%5.2f", rain81(n))
747 text42(n,3) = sprintf("%5.2f", rainmod81(n))
749 ;---------------------------------------------------------------------------
751 plot_name = "table_site81_model_vs_ob1"
753 wks = gsn_open_wks (plot_type,plot_name)
754 ;------------------------------------------
758 gRes@txFontHeightF = 0.02
761 title_text = "Model vs Observation at 81 Sites (1)"
763 gsn_text_ndc(wks,title_text,0.50,0.975,gRes)
764 ;------------------------------------------
766 gsn_table(wks,ncr1,x1,y1,text1,res1)
767 gsn_table(wks,ncr2,x2,y2,text2,res2)
768 gsn_table(wks,ncr21,x21,y21,text21,res21)
769 gsn_table(wks,ncr22,x22,y22,text22,res22)
770 gsn_table(wks,ncr3,x3,y3,text3,res3)
771 gsn_table(wks,ncr4,x4,y4,text4,res4)
772 gsn_table(wks,ncr42,x42,y42,text42,res42)
801 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
802 system("rm "+plot_name+"."+plot_type)
803 system("rm "+plot_name+"-1."+plot_type_new)
804 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
806 ;*******************************************************************
807 ;(A)-8 table of site81 (2) (the last 40 sites), model vs ob
808 ;*******************************************************************
813 table_header_name = "Site ID"
815 ; row (not including header row)
817 row_header = new ((/nrow/),string )
818 row_header(0:nrow-1) = id81(41:41+nrow-1)
821 ncr1 = (/1,1/) ; 1 row, 1 column
822 x1 = (/0.005,0.15/) ; Start and end X
823 y1 = (/0.85 ,0.95/) ; Start and end Y
824 text1 = table_header_name
826 res1@txFontHeightF = 0.015
827 res1@gsFillColor = "CornFlowerBlue"
829 ; Column header1 (equally space in x2)
831 col_header = (/"Latitude","Longitude"/)
832 ncol = dimsizes(col_header)
834 ncr2 = (/1,ncol/) ; 1 rows, ncol columns
835 x2 = (/x1(1),0.35/) ; start from end of x1
839 res2@txFontHeightF = 0.015
840 res2@gsFillColor = "Gray"
842 ; Column header2 (equally space in x2)
844 ; col_header1 = (/"NPP (gC/m2/year)","RAIN (m/year)"/)
845 col_header2 = (/"ob",model_name \
849 ncol1 = dimsizes(col_header1)
850 ncol2 = dimsizes(col_header2)
852 ncr21 = (/1,ncol1/) ; 1 rows, 4 columns
853 x21 = (/x2(1),0.995/) ; start from end of x2
854 yhalf = (y1(0)+y1(1))*0.5
855 y21 = (/yhalf,y1(1)/) ; top half of y1
858 res21@txFontHeightF = 0.015
859 res21@gsFillColor = "Gray"
861 ncr22 = (/1,ncol2/) ; 1 rows, 12 columns
862 x22 = x21 ; start from end of x1
863 y22 = (/y1(0),yhalf/) ; bottom half of y1
866 res22@txFontHeightF = 0.015
867 res22@gsFillColor = "Gray"
869 ; Row header (equally space in y2)
870 ncr3 = (/nrow,1/) ; nrow rows, 1 columns
872 y3 = (/1.0-table_length,y1(0)/) ; end at start of y1
875 res3@txFontHeightF = 0.010
876 res3@gsFillColor = "Gray"
879 ncr4 = (/nrow,ncol/) ; nrow rows, ncol columns
880 x4 = x2 ; Start and end x
881 y4 = y3 ; Start and end Y
882 text4 = new((/nrow,ncol/),string)
884 color_fill4 = new((/nrow,ncol/),string)
885 color_fill4 = "white"
886 ; color_fill4(:,ncol-1) = "grey"
887 ; color_fill4(nrow-1,:) = "green"
889 res4 = True ; Set up resource list
890 ; res4@gsnDebug = True ; Useful to print NDC row,col values used.
891 res4@txFontHeightF = 0.015
892 res4@gsFillColor = color_fill4
897 ncr42 = (/nrow,ncol2/) ; nrow rows, ncol columns
898 x42 = x21 ; Start and end x
899 y42 = y3 ; Start and end Y
900 text42 = new((/nrow,ncol2/),string)
902 color_fill42 = new((/nrow,ncol2/),string)
903 color_fill42 = "white"
904 ; color_fill42(:,ncol-1) = "grey"
905 ; color_fill42(nrow-1,:) = "green"
907 res42 = True ; Set up resource list
908 ; res42@gsnDebug = True ; Useful to print NDC row,col values used.
909 res42@txFontHeightF = 0.015
910 res42@gsFillColor = color_fill42
912 delete (color_fill42)
913 ;-------------------------------------------------------------------
917 text4(n,0) = sprintf("%5.2f", y81(n+41))
918 text4(n,1) = sprintf("%5.2f", x81(n+41))
922 text42(n,0) = sprintf("%5.2f", npp81(n+41))
923 text42(n,1) = sprintf("%5.2f", nppmod81(n+41))
924 text42(n,2) = sprintf("%5.2f", rain81(n+41))
925 text42(n,3) = sprintf("%5.2f", rainmod81(n+41))
927 ;-------------------------------------------------------------------
929 plot_name = "table_site81_model_vs_ob2"
931 wks = gsn_open_wks (plot_type,plot_name)
932 ;------------------------------------------
936 gRes@txFontHeightF = 0.02
939 title_text = "Model vs Observation at 81 Sites (2)"
941 gsn_text_ndc(wks,title_text,0.50,0.975,gRes)
942 ;------------------------------------------
944 gsn_table(wks,ncr1,x1,y1,text1,res1)
945 gsn_table(wks,ncr2,x2,y2,text2,res2)
946 gsn_table(wks,ncr21,x21,y21,text21,res21)
947 gsn_table(wks,ncr22,x22,y22,text22,res22)
948 gsn_table(wks,ncr3,x3,y3,text3,res3)
949 gsn_table(wks,ncr4,x4,y4,text4,res4)
950 gsn_table(wks,ncr42,x42,y42,text42,res42)
979 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
980 system("rm "+plot_name+"."+plot_type)
981 system("rm "+plot_name+"-1."+plot_type_new)
982 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
984 ;**************************************************************************
986 ;**************************************************************************
988 RAIN1_1D = ndtooned(rain81)
989 RAIN2_1D = ndtooned(rainmod81)
990 NPP1_1D = ndtooned(npp81)
991 NPP2_1D = ndtooned(nppmod81)
996 xvalues = new((/2,nx/),float)
997 yvalues = new((/2,nx/),float)
998 mn_yvalues = new((/2,nx/),float)
999 mx_yvalues = new((/2,nx/),float)
1000 dx4 = new((/1/),float)
1002 get_bin(RAIN1_1D, NPP1_1D, RAIN2_1D, NPP2_1D \
1003 ,xvalues,yvalues,mn_yvalues,mx_yvalues,dx4)
1005 ;----------------------------------------
1006 ;compute correlation coeff and M score
1011 good = ind(.not.ismissing(u) .and. .not.ismissing(v))
1015 ccr81h = esccr(uu,vv,0)
1019 bias = sum(abs(vv-uu)/(abs(vv)+abs(uu)))
1020 M81h = (1.- (bias/dimsizes(uu)))*5.
1027 ;----------------------------------------------------------------------
1030 resh@gsnMaximize = True
1031 resh@gsnDraw = False
1032 resh@gsnFrame = False
1033 resh@xyMarkLineMode = "Markers"
1034 resh@xyMarkerSizeF = 0.014
1036 resh@xyMarkerColors = (/"Brown","Blue"/)
1037 resh@trYMinF = min(mn_yvalues) - 10.
1038 resh@trYMaxF = max(mx_yvalues) + 10.
1040 resh@tiYAxisString = "NPP (g C/m2/year)"
1041 resh@tiXAxisString = "Precipitation (m/year)"
1043 max_bar = new((/2,nx/),graphic)
1044 min_bar = new((/2,nx/),graphic)
1045 max_cap = new((/2,nx/),graphic)
1046 min_cap = new((/2,nx/),graphic)
1049 line_colors = (/"brown","blue"/)
1051 ;**************************************************************************
1052 ;(B)-1 histogram plot, ob 81 site
1053 ;**************************************************************************
1055 plot_name = "histogram_ob_81"
1056 title = "Observed 81 site"
1057 resh@tiMainString = title
1059 wks = gsn_open_wks (plot_type,plot_name)
1061 xy = gsn_csm_xy(wks,xvalues(0,:),yvalues(0,:),resh)
1063 ;-------------------------------
1064 ;Attach the vertical bar and the horizontal cap line
1072 lnres@gsLineColor = line_colors(nd)
1075 if(.not.ismissing(mn_yvalues(nd,i)).and. \
1076 .not.ismissing(mx_yvalues(nd,i))) then
1078 ; Attach the vertical bar, both above and below the marker.
1082 y2 = mn_yvalues(nd,i)
1085 min_bar(nd,i) = gsn_add_polyline(wks,xy,plx,ply,lnres)
1087 y2 = mx_yvalues(nd,i)
1090 max_bar(nd,i) = gsn_add_polyline(wks,xy,plx,ply,lnres)
1092 ; Attach the horizontal cap line, both above and below the marker.
1094 x1 = xvalues(nd,i) - dx4
1095 x2 = xvalues(nd,i) + dx4
1096 y1 = mn_yvalues(nd,i)
1099 min_cap(nd,i) = gsn_add_polyline(wks,xy,plx,ply,lnres)
1101 y1 = mx_yvalues(nd,i)
1104 max_cap(nd,i) = gsn_add_polyline(wks,xy,plx,ply,lnres)
1113 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
1114 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
1115 system("rm "+plot_name+"-*."+plot_type_new)
1116 system("rm "+plot_name+"."+plot_type)
1118 ;****************************************************************************
1119 ;(B)-2 histogram plot, model vs ob 81 site
1120 ;****************************************************************************
1122 plot_name = "histogram_model_vs_ob_81"
1123 title = model_name+ " vs Observed 81 site"
1124 resh@tiMainString = title
1126 wks = gsn_open_wks (plot_type,plot_name) ; open workstation
1128 ;-----------------------------
1129 ; Add a boxed legend using the more simple method, which won't have
1130 ; vertical lines going through the markers.
1132 resh@pmLegendDisplayMode = "Always"
1133 ; resh@pmLegendWidthF = 0.1
1134 resh@pmLegendWidthF = 0.08
1135 resh@pmLegendHeightF = 0.05
1136 resh@pmLegendOrthogonalPosF = -1.17
1137 ; resh@pmLegendOrthogonalPosF = -1.00 ;(downward)
1138 ; resh@pmLegendParallelPosF = 0.18
1139 resh@pmLegendParallelPosF = 0.88 ;(rightward)
1141 ; resh@lgPerimOn = False
1142 resh@lgLabelFontHeightF = 0.015
1143 resh@xyExplicitLegendLabels = (/"observed",model_name/)
1144 ;-----------------------------
1146 tRes@txFontHeightF = 0.025
1148 correlation_text = "(correlation coef = "+sprintf("%5.2f", ccr81h)+")"
1150 gsn_text_ndc(wks,correlation_text,0.56,0.85,tRes)
1152 xy = gsn_csm_xy(wks,xvalues,yvalues,resh)
1153 ;-------------------------------
1154 ;Attach the vertical bar and the horizontal cap line
1157 lnres@gsLineColor = line_colors(nd)
1160 if(.not.ismissing(mn_yvalues(nd,i)).and. \
1161 .not.ismissing(mx_yvalues(nd,i))) then
1163 ; Attach the vertical bar, both above and below the marker.
1167 y2 = mn_yvalues(nd,i)
1168 min_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
1170 y2 = mx_yvalues(nd,i)
1171 max_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
1173 ; Attach the horizontal cap line, both above and below the marker.
1175 x1 = xvalues(nd,i) - dx4
1176 x2 = xvalues(nd,i) + dx4
1177 y1 = mn_yvalues(nd,i)
1178 min_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
1180 y1 = mx_yvalues(nd,i)
1181 max_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
1190 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
1191 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
1192 system("rm "+plot_name+"-*."+plot_type_new)
1193 system("rm "+plot_name+"."+plot_type)
1210 ;**************************************************************************
1212 ;**************************************************************************
1215 RAIN1_1D = ndtooned(rain933)
1216 RAIN2_1D = ndtooned(rainmod933)
1217 NPP1_1D = ndtooned(npp933)
1218 NPP2_1D = ndtooned(nppmod933)
1223 xvalues = new((/2,nx/),float)
1224 yvalues = new((/2,nx/),float)
1225 mn_yvalues = new((/2,nx/),float)
1226 mx_yvalues = new((/2,nx/),float)
1227 dx4 = new((/1/),float)
1229 get_bin(RAIN1_1D, NPP1_1D, RAIN2_1D, NPP2_1D \
1230 ,xvalues,yvalues,mn_yvalues,mx_yvalues,dx4)
1232 ;----------------------------------------
1233 ;compute correlation coeff and M score
1238 good = ind(.not.ismissing(u) .and. .not.ismissing(v))
1242 ccr933h = esccr(uu,vv,0)
1246 bias = sum(abs(vv-uu)/(abs(vv)+abs(uu)))
1247 M933h = (1.- (bias/dimsizes(uu)))*5.
1254 ;----------------------------------------------------------------------
1258 resh@gsnMaximize = True
1259 resh@gsnDraw = False
1260 resh@gsnFrame = False
1261 resh@xyMarkLineMode = "Markers"
1262 resh@xyMarkerSizeF = 0.014
1264 resh@xyMarkerColors = (/"Brown","Blue"/)
1265 resh@trYMinF = min(mn_yvalues) - 10.
1266 resh@trYMaxF = max(mx_yvalues) + 10.
1268 resh@tiYAxisString = "NPP (g C/m2/year)"
1269 resh@tiXAxisString = "Precipitation (m/year)"
1271 max_bar = new((/2,nx/),graphic)
1272 min_bar = new((/2,nx/),graphic)
1273 max_cap = new((/2,nx/),graphic)
1274 min_cap = new((/2,nx/),graphic)
1277 line_colors = (/"brown","blue"/)
1279 ;**************************************************************************
1280 ;(B)-3 histogram plot, ob 933 site
1281 ;**************************************************************************
1283 plot_name = "histogram_ob_933"
1284 title = "Observed 933 site"
1285 resh@tiMainString = title
1287 wks = gsn_open_wks (plot_type,plot_name)
1289 xy = gsn_csm_xy(wks,xvalues(0,:),yvalues(0,:),resh)
1291 ;-------------------------------
1292 ;Attach the vertical bar and the horizontal cap line
1295 lnres@gsLineColor = line_colors(nd)
1298 if(.not.ismissing(mn_yvalues(nd,i)).and. \
1299 .not.ismissing(mx_yvalues(nd,i))) then
1301 ; Attach the vertical bar, both above and below the marker.
1305 y2 = mn_yvalues(nd,i)
1306 min_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
1308 y2 = mx_yvalues(nd,i)
1309 max_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
1311 ; Attach the horizontal cap line, both above and below the marker.
1313 x1 = xvalues(nd,i) - dx4
1314 x2 = xvalues(nd,i) + dx4
1315 y1 = mn_yvalues(nd,i)
1316 min_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
1318 y1 = mx_yvalues(nd,i)
1319 max_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
1329 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
1330 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
1331 system("rm "+plot_name+"-*."+plot_type_new)
1332 system("rm "+plot_name+"."+plot_type)
1334 ;****************************************************************************
1335 ;(B)-4 histogram plot, model vs ob 933 site
1336 ;****************************************************************************
1338 plot_name = "histogram_model_vs_ob_933"
1339 title = model_name+ " vs Observed 933 site"
1340 resh@tiMainString = title
1342 wks = gsn_open_wks (plot_type,plot_name) ; open workstation
1344 ;-----------------------------
1345 ; Add a boxed legend using the more simple method, which won't have
1346 ; vertical lines going through the markers.
1348 resh@pmLegendDisplayMode = "Always"
1349 ; resh@pmLegendWidthF = 0.1
1350 resh@pmLegendWidthF = 0.08
1351 resh@pmLegendHeightF = 0.05
1352 resh@pmLegendOrthogonalPosF = -1.17
1353 ; resh@pmLegendOrthogonalPosF = -1.00 ;(downward)
1354 ; resh@pmLegendParallelPosF = 0.18
1355 resh@pmLegendParallelPosF = 0.88 ;(rightward)
1357 ; resh@lgPerimOn = False
1358 resh@lgLabelFontHeightF = 0.015
1359 resh@xyExplicitLegendLabels = (/"observed",model_name/)
1360 ;-----------------------------
1362 tRes@txFontHeightF = 0.025
1364 correlation_text = "(correlation coef = "+sprintf("%5.2f", ccr933h)+")"
1366 gsn_text_ndc(wks,correlation_text,0.56,0.85,tRes)
1368 xy = gsn_csm_xy(wks,xvalues,yvalues,resh)
1369 ;-------------------------------
1370 ;Attach the vertical bar and the horizontal cap line
1373 lnres@gsLineColor = line_colors(nd)
1376 if(.not.ismissing(mn_yvalues(nd,i)).and. \
1377 .not.ismissing(mx_yvalues(nd,i))) then
1379 ; Attach the vertical bar, both above and below the marker.
1383 y2 = mn_yvalues(nd,i)
1384 min_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
1386 y2 = mx_yvalues(nd,i)
1387 max_bar(nd,i) = gsn_add_polyline(wks,xy,(/x1,x1/),(/y1,y2/),lnres)
1389 ; Attach the horizontal cap line, both above and below the marker.
1391 x1 = xvalues(nd,i) - dx4
1392 x2 = xvalues(nd,i) + dx4
1393 y1 = mn_yvalues(nd,i)
1394 min_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
1396 y1 = mx_yvalues(nd,i)
1397 max_cap(nd,i) = gsn_add_polyline(wks,xy,(/x1,x2/),(/y1,y1/),lnres)
1407 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
1408 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
1409 system("rm "+plot_name+"-*."+plot_type_new)
1410 system("rm "+plot_name+"."+plot_type)
1412 ;***************************************************************************
1414 ;***************************************************************************
1417 resg = True ; Use plot options
1418 resg@cnFillOn = True ; Turn on color fill
1419 resg@gsnSpreadColors = True ; use full colormap
1420 ; resg@cnFillMode = "RasterFill" ; Turn on raster color
1421 ; resg@lbLabelAutoStride = True
1422 resg@cnLinesOn = False ; Turn off contourn lines
1423 resg@mpFillOn = False ; Turn off map fill
1425 resg@gsnSpreadColors = True ; use full colormap
1426 resg@cnLevelSelectionMode = "ManualLevels" ; Manual contour invtervals
1427 resg@cnMinLevelValF = 0. ; Min level
1428 resg@cnMaxLevelValF = 2200. ; Max level
1429 resg@cnLevelSpacingF = 200. ; interval
1431 ;****************************************************************************
1432 ;(C)-1 global contour plot, ob
1433 ;****************************************************************************
1435 delta = 0.00000000001
1436 nppglobe = where(ismissing(nppglobe).and.(ismissing(nppmod).or.(nppmod.lt.delta)),0.,nppglobe)
1438 plot_name = "global_ob"
1439 title = "Observed MODIS MOD 17"
1440 resg@tiMainString = title
1442 wks = gsn_open_wks (plot_type,plot_name) ; open workstation
1443 gsn_define_colormap(wks,"gui_default") ; choose colormap
1445 plot = gsn_csm_contour_map_ce(wks,nppglobe,resg)
1450 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
1451 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
1452 system("rm "+plot_name+"-*."+plot_type_new)
1453 system("rm "+plot_name+"."+plot_type)
1455 ;****************************************************************************
1456 ;(C)-2 global contour plot, model
1457 ;****************************************************************************
1459 plot_name = "global_model"
1460 title = "Model "+ model_name
1461 resg@tiMainString = title
1463 wks = gsn_open_wks (plot_type,plot_name) ; open workstation
1464 gsn_define_colormap(wks,"gui_default") ; choose colormap
1466 plot = gsn_csm_contour_map_ce(wks,nppmod,resg)
1471 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
1472 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
1473 system("rm "+plot_name+"-*."+plot_type_new)
1474 system("rm "+plot_name+"."+plot_type)
1476 ;****************************************************************************
1477 ;(C)-3 global contour plot, model vs ob
1478 ;****************************************************************************
1480 plot_name = "global_model_vs_ob"
1482 wks = gsn_open_wks (plot_type,plot_name) ; open workstation
1483 gsn_define_colormap(wks,"gui_default") ; choose colormap
1486 plot=new(3,graphic) ; create graphic array
1488 resg@gsnFrame = False ; Do not draw plot
1489 resg@gsnDraw = False ; Do not advance frame
1491 ; compute correlation coef and M score
1493 uu1 = ndtooned(nppmod)
1494 vv1 = ndtooned(nppglobe)
1497 good = ind(.not.ismissing(uu1) .and. .not.ismissing(vv1))
1502 ccrG = esccr(ug,vg,0)
1505 MG = (ccrG*ccrG)* 5.0
1508 ; plot correlation coef
1511 gRes@txFontHeightF = 0.02
1514 correlation_text = "(correlation coef = "+sprintf("%5.2f", ccrG)+")"
1516 gsn_text_ndc(wks,correlation_text,0.20,0.50,gRes)
1517 ;--------------------------------------------------------------------
1520 title = "Observed MODIS MOD 17"
1521 resg@tiMainString = title
1523 plot(0) = gsn_csm_contour_map_ce(wks,nppglobe,resg)
1527 title = "Model "+ model_name
1528 resg@tiMainString = title
1530 plot(1) = gsn_csm_contour_map_ce(wks,nppmod,resg)
1535 zz = nppmod - nppglobe
1536 title = "Model_"+model_name+" - Observed"
1538 resg@cnMinLevelValF = -500 ; Min level
1539 resg@cnMaxLevelValF = 500. ; Max level
1540 resg@cnLevelSpacingF = 50. ; interval
1541 resg@tiMainString = title
1543 plot(2) = gsn_csm_contour_map_ce(wks,zz,resg)
1545 pres = True ; panel plot mods desired
1546 ; pres@gsnPanelYWhiteSpacePercent = 5 ; increase white space around
1547 ; indiv. plots in panel
1548 pres@gsnMaximize = True ; fill the page
1550 gsn_panel(wks,plot,(/3,1/),pres) ; create panel plot
1556 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
1557 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
1558 system("rm "+plot_name+"-*."+plot_type_new)
1559 system("rm "+plot_name+"."+plot_type)
1561 ;***************************************************************************
1562 ;(D)-1 zonal line plot, ob
1563 ;***************************************************************************
1565 vv = zonalAve(nppglobe)
1566 vv@long_name = nppglobe@long_name
1568 plot_name = "zonal_ob"
1569 title = "Observed MODIS MOD 17"
1572 resz@tiMainString = title
1574 wks = gsn_open_wks (plot_type,plot_name) ; open workstation
1576 plot = gsn_csm_xy (wks,ym,vv,resz)
1581 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
1582 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
1583 system("rm "+plot_name+"-*."+plot_type_new)
1584 system("rm "+plot_name+"."+plot_type)
1586 ;****************************************************************************
1587 ;(D)-2 zonal line plot, model vs ob
1588 ;****************************************************************************
1590 s = new ((/2,dimsizes(ym)/), float)
1592 s(0,:) = zonalAve(nppglobe)
1593 s(1,:) = zonalAve(nppmod)
1595 s@long_name = nppglobe@long_name
1596 ;-------------------------------------------
1597 ; compute correlation coef and M score
1599 ccrZ = esccr(s(1,:), s(0,:),0)
1602 MZ = (ccrZ*ccrZ)* 5.0
1604 ;-------------------------------------------
1605 plot_name = "zonal_model_vs_ob"
1606 title = "Zonal Average"
1607 resz@tiMainString = title
1609 wks = gsn_open_wks (plot_type,plot_name)
1611 ; resz@vpHeightF = 0.4 ; change aspect ratio of plot
1612 ; resz@vpWidthF = 0.7
1614 resz@xyMonoLineColor = "False" ; want colored lines
1615 resz@xyLineColors = (/"black","red"/) ; colors chosen
1616 ; resz@xyLineThicknesses = (/3.,3./) ; line thicknesses
1617 resz@xyLineThicknesses = (/2.,2./) ; line thicknesses
1618 resz@xyDashPatterns = (/0.,0./) ; make all lines solid
1620 resz@tiYAxisString = s@long_name ; add a axis title
1621 resz@txFontHeightF = 0.0195 ; change title font heights
1624 resz@pmLegendDisplayMode = "Always" ; turn on legend
1625 resz@pmLegendSide = "Top" ; Change location of
1626 ; resz@pmLegendParallelPosF = .45 ; move units right
1627 resz@pmLegendParallelPosF = .82 ; move units right
1628 resz@pmLegendOrthogonalPosF = -0.4 ; move units down
1630 resz@pmLegendWidthF = 0.10 ; Change width and
1631 resz@pmLegendHeightF = 0.10 ; height of legend.
1632 resz@lgLabelFontHeightF = .02 ; change font height
1633 ; resz@lgTitleOn = True ; turn on legend title
1634 ; resz@lgTitleString = "Example" ; create legend title
1635 ; resz@lgTitleFontHeightF = .025 ; font of legend title
1636 resz@xyExplicitLegendLabels = (/"Observed",model_name/) ; explicit labels
1637 ;--------------------------------------------------------------------
1639 zRes@txFontHeightF = 0.025
1641 correlation_text = "(correlation coef = "+sprintf("%5.2f", ccrZ)+")"
1643 gsn_text_ndc(wks,correlation_text,0.50,0.77,zRes)
1644 ;--------------------------------------------------------------------
1646 plot = gsn_csm_xy (wks,ym,s,resz)
1651 system("convert "+plot_name+"."+plot_type+" "+plot_name+"."+plot_type_new)
1652 system("mv "+plot_name+"-0."+plot_type_new+" "+plot_name+"."+plot_type_new)
1653 system("rm "+plot_name+"-*."+plot_type_new)
1654 system("rm "+plot_name+"."+plot_type)
1656 ;***************************************************************************
1657 ; tar up output plots
1658 ;***************************************************************************
1660 temp_name = "temp." + model_name
1661 system("mkdir -p " + temp_name)
1662 system("mv *.png " + temp_name)
1663 system("tar cf "+ temp_name +".tar " + temp_name)
1665 ;***************************************************************************