|
1 ;************************************************ |
|
2 ; Read ascii, Write nc |
|
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 ;************************************************ |
|
8 begin |
|
9 ;--------------------------------------------------- |
|
10 ; final data |
|
11 |
|
12 c = addfile("amazon_mask_1x1.nc","c") |
|
13 |
|
14 nlat = 180 |
|
15 nlon = 360 |
|
16 |
|
17 ;************************************************ |
|
18 ; read 1x1 mask data |
|
19 ;************************************************ |
|
20 |
|
21 diri = "/fis/cgd/cseg/people/jeff/clamp_data/observed/biomass/" |
|
22 fili = "mask_1x1.txt" |
|
23 t = asciiread(diri+fili,(/180,360/),"integer") |
|
24 |
|
25 printVarSummary(t) |
|
26 |
|
27 print (min(t)+"/"+max(t)) |
|
28 |
|
29 lon = new((/nlon/),float) |
|
30 lat = new((/nlat/),float) |
|
31 |
|
32 ; data is (89.5N->89.5S) (-179.5->179.5) |
|
33 |
|
34 ; sam result |
|
35 ; lon = fspan(-179.5,179.5,nlon) |
|
36 ; lat = fspan( -89.5, 89.5,nlat) |
|
37 |
|
38 do i = 0,nlon-1 |
|
39 lon(i) = -179.5 + i*(360./nlon) |
|
40 end do |
|
41 |
|
42 do j = 0,nlat-1 |
|
43 ; lat(j) = -89.5 + j*(180./nlat) |
|
44 lat(j) = 89.5 - j*(180./nlat) |
|
45 end do |
|
46 |
|
47 ; print (lon) |
|
48 ; print (lat) |
|
49 ;============================= |
|
50 ; create lat and long coordinate variables |
|
51 ;============================ |
|
52 lon!0 = "lon" |
|
53 lon@long_name = "lon" |
|
54 lon@units = "degrees-east" |
|
55 lon&lon = lon |
|
56 |
|
57 lat!0 = "lat" |
|
58 lat@long_name = "lat" |
|
59 lat@units = "degrees_north" |
|
60 lat&lat = lat |
|
61 ;============================= |
|
62 ; name dimensions of t and assign coordinate variables |
|
63 ;============================ |
|
64 t!0 = "lat" |
|
65 t!1 = "lon" |
|
66 t&lat = lat |
|
67 t&lon = lon |
|
68 t@long_name = "amazon mask" |
|
69 ; t@units = "" |
|
70 t@_FillValue= -999 |
|
71 t@missing_value= -999 |
|
72 |
|
73 c->mask_amazon = t |
|
74 c->lat = lat |
|
75 c->lon = lon |
|
76 |
|
77 ;************************************************ |
|
78 ; create default plot |
|
79 ;************************************************ |
|
80 |
|
81 wks = gsn_open_wks("ps","xy") ; open a ps file |
|
82 gsn_define_colormap(wks,"gui_default") ; choose colormap |
|
83 |
|
84 res = True ; Use plot options |
|
85 res@cnFillOn = True ; Turn on color fill |
|
86 res@gsnSpreadColors = True ; use full colormap |
|
87 ; res@cnFillMode = "RasterFill" ; Turn on raster color |
|
88 ; res@lbLabelAutoStride = True |
|
89 res@cnLinesOn = False ; Turn off contourn lines |
|
90 res@mpFillOn = False ; Turn off map fill |
|
91 res@gsnAddCyclic = False |
|
92 res@tiMainString = "LC15_amazon_biomass" |
|
93 |
|
94 res@mpMinLatF = -21.1 ; range to zoom in on |
|
95 res@mpMaxLatF = 13.8 |
|
96 res@mpMinLonF = 277.28 |
|
97 res@mpMaxLonF = 326.43 |
|
98 |
|
99 res@gsnSpreadColors = True ; use full colormap |
|
100 res@cnLevelSelectionMode = "ManualLevels" ; Manual contour invtervals |
|
101 ; res@cnMinLevelValF = 1. ; Min level |
|
102 ; res@cnMaxLevelValF = 11. ; Max level |
|
103 ; res@cnLevelSpacingF = 1. ; interval |
|
104 res@cnMinLevelValF = 0. ; Min level |
|
105 res@cnMaxLevelValF = 1. ; Max level |
|
106 res@cnLevelSpacingF = 0.1 ; interval |
|
107 ; pres = True ; panel plot mods desired |
|
108 ; pres@gsnMaximize = True ; fill the page |
|
109 |
|
110 plot = gsn_csm_contour_map_ce(wks,t,res) ; for observed |
|
111 |
|
112 end |