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