diff -r 000000000000 -r 0c6405ab2ff4 lai/01.read.land_class.ascii.ncl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lai/01.read.land_class.ascii.ncl Mon Jan 26 22:08:20 2009 -0500 @@ -0,0 +1,55 @@ +;************************************************ +; Read ascii, Write nc +; output: lat: N->S lon: -180W->180E +;************************************************ +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" +;************************************************ +begin +;--------------------------------------------------- +; final data + diro = "/fis/cgd/cseg/people/jeff/clamp_data/lai/" + filo = "land_class_0.25deg.nc" + c = addfile(diro+filo,"c") +; filedimdef(c,"time",-1,True) + + nlat = 180*4 + nlon = 360*4 + + t = new((/nlat,nlon/),integer) + lon = new((/nlon/),float) + lat = new((/nlat/),float) +;--------------------------------------------------- +; input data + diri = "/fis/cgd/cseg/people/jeff/clamp_data/lai/modis_landcover_qdeg/" + fili = "modis_landcover_class_qd.asc" + b = diri+fili + + lat = latGlobeFo(nlat, "lat", "latitude", "degrees_north") + lat = (/ lat(::-1) /) ; make N->S + lon = lonGlobeFo(nlon, "lon", "longitude", "degrees_east") + lon = (/ lon - 180. /) ; subtract 180 from all values + lon&lon = lon ; update coordinates + lat&lat = lat ; update coordinates + +;============================= +; name dimensions of t and assign coordinate variables +;============================ + t!0 = "lat" + t!1 = "lon" + t&lat = lat + t&lon = lon + t@long_name = "landcover class" + t@units = "" + t@_FillValue= -9999 + t@missing_value= -9999 + + t = asciiread(b,(/nlat,nlon/),"integer") + + c->LAND_CLASS = t + c->lat = lat + c->lon = lon + + print (min(t) + "/" + max(t)) +end