forrest@0
|
1 |
;************************************************
|
forrest@0
|
2 |
; Read ascii, Write nc
|
forrest@0
|
3 |
; output: lat: N->S lon: -180W->180E
|
forrest@0
|
4 |
;************************************************
|
forrest@0
|
5 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
|
forrest@0
|
6 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
|
forrest@0
|
7 |
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
|
forrest@0
|
8 |
;************************************************
|
forrest@0
|
9 |
begin
|
forrest@0
|
10 |
;---------------------------------------------------
|
forrest@0
|
11 |
; final data
|
forrest@0
|
12 |
diro = "/fis/cgd/cseg/people/jeff/clamp_data/lai/"
|
forrest@0
|
13 |
filo = "land_class_0.25deg.nc"
|
forrest@0
|
14 |
c = addfile(diro+filo,"c")
|
forrest@0
|
15 |
; filedimdef(c,"time",-1,True)
|
forrest@0
|
16 |
|
forrest@0
|
17 |
nlat = 180*4
|
forrest@0
|
18 |
nlon = 360*4
|
forrest@0
|
19 |
|
forrest@0
|
20 |
t = new((/nlat,nlon/),integer)
|
forrest@0
|
21 |
lon = new((/nlon/),float)
|
forrest@0
|
22 |
lat = new((/nlat/),float)
|
forrest@0
|
23 |
;---------------------------------------------------
|
forrest@0
|
24 |
; input data
|
forrest@0
|
25 |
diri = "/fis/cgd/cseg/people/jeff/clamp_data/lai/modis_landcover_qdeg/"
|
forrest@0
|
26 |
fili = "modis_landcover_class_qd.asc"
|
forrest@0
|
27 |
b = diri+fili
|
forrest@0
|
28 |
|
forrest@0
|
29 |
lat = latGlobeFo(nlat, "lat", "latitude", "degrees_north")
|
forrest@0
|
30 |
lat = (/ lat(::-1) /) ; make N->S
|
forrest@0
|
31 |
lon = lonGlobeFo(nlon, "lon", "longitude", "degrees_east")
|
forrest@0
|
32 |
lon = (/ lon - 180. /) ; subtract 180 from all values
|
forrest@0
|
33 |
lon&lon = lon ; update coordinates
|
forrest@0
|
34 |
lat&lat = lat ; update coordinates
|
forrest@0
|
35 |
|
forrest@0
|
36 |
;=============================
|
forrest@0
|
37 |
; name dimensions of t and assign coordinate variables
|
forrest@0
|
38 |
;============================
|
forrest@0
|
39 |
t!0 = "lat"
|
forrest@0
|
40 |
t!1 = "lon"
|
forrest@0
|
41 |
t&lat = lat
|
forrest@0
|
42 |
t&lon = lon
|
forrest@0
|
43 |
t@long_name = "landcover class"
|
forrest@0
|
44 |
t@units = ""
|
forrest@0
|
45 |
t@_FillValue= -9999
|
forrest@0
|
46 |
t@missing_value= -9999
|
forrest@0
|
47 |
|
forrest@0
|
48 |
t = asciiread(b,(/nlat,nlon/),"integer")
|
forrest@0
|
49 |
|
forrest@0
|
50 |
c->LAND_CLASS = t
|
forrest@0
|
51 |
c->lat = lat
|
forrest@0
|
52 |
c->lon = lon
|
forrest@0
|
53 |
|
forrest@0
|
54 |
print (min(t) + "/" + max(t))
|
forrest@0
|
55 |
end
|