1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/lai/01.read.land_class.ascii.ncl Mon Jan 26 22:08:20 2009 -0500
1.3 @@ -0,0 +1,55 @@
1.4 +;************************************************
1.5 +; Read ascii, Write nc
1.6 +; output: lat: N->S lon: -180W->180E
1.7 +;************************************************
1.8 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
1.9 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
1.10 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
1.11 +;************************************************
1.12 +begin
1.13 +;---------------------------------------------------
1.14 +; final data
1.15 + diro = "/fis/cgd/cseg/people/jeff/clamp_data/lai/"
1.16 + filo = "land_class_0.25deg.nc"
1.17 + c = addfile(diro+filo,"c")
1.18 +; filedimdef(c,"time",-1,True)
1.19 +
1.20 + nlat = 180*4
1.21 + nlon = 360*4
1.22 +
1.23 + t = new((/nlat,nlon/),integer)
1.24 + lon = new((/nlon/),float)
1.25 + lat = new((/nlat/),float)
1.26 +;---------------------------------------------------
1.27 +; input data
1.28 + diri = "/fis/cgd/cseg/people/jeff/clamp_data/lai/modis_landcover_qdeg/"
1.29 + fili = "modis_landcover_class_qd.asc"
1.30 + b = diri+fili
1.31 +
1.32 + lat = latGlobeFo(nlat, "lat", "latitude", "degrees_north")
1.33 + lat = (/ lat(::-1) /) ; make N->S
1.34 + lon = lonGlobeFo(nlon, "lon", "longitude", "degrees_east")
1.35 + lon = (/ lon - 180. /) ; subtract 180 from all values
1.36 + lon&lon = lon ; update coordinates
1.37 + lat&lat = lat ; update coordinates
1.38 +
1.39 +;=============================
1.40 +; name dimensions of t and assign coordinate variables
1.41 +;============================
1.42 + t!0 = "lat"
1.43 + t!1 = "lon"
1.44 + t&lat = lat
1.45 + t&lon = lon
1.46 + t@long_name = "landcover class"
1.47 + t@units = ""
1.48 + t@_FillValue= -9999
1.49 + t@missing_value= -9999
1.50 +
1.51 + t = asciiread(b,(/nlat,nlon/),"integer")
1.52 +
1.53 + c->LAND_CLASS = t
1.54 + c->lat = lat
1.55 + c->lon = lon
1.56 +
1.57 + print (min(t) + "/" + max(t))
1.58 +end