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
|
forrest@0
|
10 |
;************************************************
|
forrest@0
|
11 |
;f = addfile ("data.81.nc","r")
|
forrest@0
|
12 |
f = addfile ("data.933.nc","r")
|
forrest@0
|
13 |
x = f->SITE_ID ; get t data
|
forrest@0
|
14 |
;y = f->PREC_ANN ; get t data
|
forrest@0
|
15 |
y = f->TNPP_C ; get t data
|
forrest@0
|
16 |
|
forrest@0
|
17 |
x@long_name = "SITE_ID"
|
forrest@0
|
18 |
;y@long_name = "PREC_ANN"
|
forrest@0
|
19 |
y@long_name = "TNPP_C"
|
forrest@0
|
20 |
|
forrest@0
|
21 |
;************************************************
|
forrest@0
|
22 |
; plotting parameters
|
forrest@0
|
23 |
;************************************************
|
forrest@0
|
24 |
wks = gsn_open_wks ("png","xy") ; open workstation
|
forrest@0
|
25 |
|
forrest@0
|
26 |
res = True ; plot mods desired
|
forrest@0
|
27 |
;res@tiMainString = "Observed 81 sites" ; add title
|
forrest@0
|
28 |
res@tiMainString = "Observed 933 sites" ; add title
|
forrest@0
|
29 |
res@xyMarkLineModes = "Markers" ; choose which have markers
|
forrest@0
|
30 |
res@xyMarkers = 16 ; choose type of marker
|
forrest@0
|
31 |
res@xyMarkerColor = "red" ; Marker color
|
forrest@0
|
32 |
res@xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
|
forrest@0
|
33 |
|
forrest@0
|
34 |
res@tmLabelAutoStride = True ; nice tick mark labels
|
forrest@0
|
35 |
|
forrest@0
|
36 |
;plot = gsn_csm_xy (wks,t&nvalues,t(:),res) ; create plot
|
forrest@0
|
37 |
plot = gsn_csm_xy (wks,x,y,res) ; create plot
|
forrest@0
|
38 |
|
forrest@0
|
39 |
;************************************************
|
forrest@0
|
40 |
; now create our own markers using NhlNewMarker
|
forrest@0
|
41 |
; available since ncl version 4.2.0.a030
|
forrest@0
|
42 |
;************************************************
|
forrest@0
|
43 |
; this example will create filled squares. You will have to play with
|
forrest@0
|
44 |
; the numbers a but to get the size and shape you desire. On the
|
forrest@0
|
45 |
; documentation page for NhlNewMarker, there is a table of values for
|
forrest@0
|
46 |
; the current marker set, to give you an idea of where to start.
|
forrest@0
|
47 |
|
forrest@0
|
48 |
; res@xyMarkerColor = "blue"
|
forrest@0
|
49 |
; res@tiMainString = "Make your own marker"
|
forrest@0
|
50 |
; res@xyMarkers = NhlNewMarker(wks, "^", 19, 0.0, 0.0, 1.3125, 1.5, 0.0)
|
forrest@0
|
51 |
; plot = gsn_csm_xy (wks,x,y,res)
|
forrest@0
|
52 |
|
forrest@0
|
53 |
end
|