forrest@0
|
1 |
; ***********************************************
|
forrest@0
|
2 |
; xy_4.ncl
|
forrest@0
|
3 |
; ***********************************************
|
forrest@0
|
4 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
|
forrest@0
|
5 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
|
forrest@0
|
6 |
;************************************************
|
forrest@0
|
7 |
begin
|
forrest@0
|
8 |
;************************************************
|
forrest@0
|
9 |
; read in data: observed
|
forrest@0
|
10 |
;************************************************
|
forrest@0
|
11 |
;g = addfile ("data.81.nc","r")
|
forrest@0
|
12 |
g = addfile ("data.933.nc","r")
|
forrest@0
|
13 |
a = g->TNPP_C
|
forrest@0
|
14 |
;a = g->ANPP_C
|
forrest@0
|
15 |
;a = g->BNPP_C
|
forrest@0
|
16 |
xo = g->LONG_DD
|
forrest@0
|
17 |
yo = g->LAT_DD
|
forrest@0
|
18 |
|
forrest@0
|
19 |
a@long_name = "TNPP_C (gC/m2/year)"
|
forrest@0
|
20 |
;a@long_name = "ANPP_C (gC/m2/year)"
|
forrest@0
|
21 |
;a@long_name = "BNPP_C (gC/m2/year)"
|
forrest@0
|
22 |
|
forrest@0
|
23 |
;print (xo)
|
forrest@0
|
24 |
nx = dimsizes(xo)
|
forrest@0
|
25 |
do i= 0,nx-1
|
forrest@0
|
26 |
if (xo(i) .lt. 0.) then
|
forrest@0
|
27 |
xo(i) = xo(i)+ 360.
|
forrest@0
|
28 |
end if
|
forrest@0
|
29 |
end do
|
forrest@0
|
30 |
;print (xo)
|
forrest@0
|
31 |
|
forrest@0
|
32 |
;************************************************
|
forrest@0
|
33 |
; read in data: model
|
forrest@0
|
34 |
;************************************************
|
forrest@0
|
35 |
f = addfile ("i01.03cn_1545-1569_ANN_climo.nc","r")
|
forrest@0
|
36 |
;f = addfile ("i01.04casa_1605-1629_ANN_climo.nc","r")
|
forrest@0
|
37 |
|
forrest@0
|
38 |
b = f->NPP
|
forrest@0
|
39 |
;b = f->AGNPP
|
forrest@0
|
40 |
;b = f->BGNPP
|
forrest@0
|
41 |
xi = f->lon
|
forrest@0
|
42 |
yi = f->lat
|
forrest@0
|
43 |
|
forrest@0
|
44 |
sec_to_year = 86400.*365.
|
forrest@0
|
45 |
|
forrest@0
|
46 |
bo = linint2_points(xi,yi,b,True,xo,yo,0) * sec_to_year
|
forrest@0
|
47 |
;print (bo)
|
forrest@0
|
48 |
|
forrest@0
|
49 |
bo@long_name = "NPP (gC/m2/year)"
|
forrest@0
|
50 |
;bo@long_name = "AGNPP (gC/m2/year)"
|
forrest@0
|
51 |
;bo@long_name = "BGNPP (gC/m2/year)"
|
forrest@0
|
52 |
|
forrest@0
|
53 |
;************************************************
|
forrest@0
|
54 |
; plotting parameters
|
forrest@0
|
55 |
;************************************************
|
forrest@0
|
56 |
;wks = gsn_open_wks ("ps","xy") ; open workstation
|
forrest@0
|
57 |
wks = gsn_open_wks ("png","xy")
|
forrest@0
|
58 |
|
forrest@0
|
59 |
res = True ; plot mods desired
|
forrest@0
|
60 |
;res@tiMainString = "Model_i01.03cn vs Observed 81" ; add title
|
forrest@0
|
61 |
res@tiMainString = "Model_i01.03cn vs Observed 933" ; add title
|
forrest@0
|
62 |
;res@tiMainString = "Model_i01.04casa vs Observed 81" ; add title
|
forrest@0
|
63 |
;res@tiMainString = "Model_i01.04casa vs Observed 933" ; add title
|
forrest@0
|
64 |
res@xyMarkLineModes = "Markers" ; choose which have markers
|
forrest@0
|
65 |
res@xyMarkers = 16 ; choose type of marker
|
forrest@0
|
66 |
res@xyMarkerColor = "red" ; Marker color
|
forrest@0
|
67 |
res@xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
|
forrest@0
|
68 |
|
forrest@0
|
69 |
res@tmLabelAutoStride = True ; nice tick mark labels
|
forrest@0
|
70 |
|
forrest@0
|
71 |
plot = gsn_csm_xy (wks,a,bo,res) ; create plot
|
forrest@0
|
72 |
|
forrest@0
|
73 |
;************************************************
|
forrest@0
|
74 |
; now create our own markers using NhlNewMarker
|
forrest@0
|
75 |
; available since ncl version 4.2.0.a030
|
forrest@0
|
76 |
;************************************************
|
forrest@0
|
77 |
; this example will create filled squares. You will have to play with
|
forrest@0
|
78 |
; the numbers a but to get the size and shape you desire. On the
|
forrest@0
|
79 |
; documentation page for NhlNewMarker, there is a table of values for
|
forrest@0
|
80 |
; the current marker set, to give you an idea of where to start.
|
forrest@0
|
81 |
|
forrest@0
|
82 |
; res@xyMarkerColor = "blue"
|
forrest@0
|
83 |
; res@tiMainString = "Make your own marker"
|
forrest@0
|
84 |
; res@xyMarkers = NhlNewMarker(wks, "^", 19, 0.0, 0.0, 1.3125, 1.5, 0.0)
|
forrest@0
|
85 |
; plot = gsn_csm_xy (wks,a,bo,res)
|
forrest@0
|
86 |
|
forrest@0
|
87 |
end
|