| author | Forrest Hoffman <forrest@climatemodeling.org> | 
| Mon, 26 Jan 2009 22:08:20 -0500 | |
| changeset 0 | 0c6405ab2ff4 | 
| permissions | -rw-r--r-- | 
| forrest@0 | 1 | ;************************************************ | 
| forrest@0 | 2 | ; Read byte, Write nc | 
| forrest@0 | 3 | ; input data is : 13.8533N -> -21.1277S | 
| forrest@0 | 4 | ; -82.7209 -> -33.5739 | 
| forrest@0 | 5 | ; output data is : -21.1277S -> 13.8533N | 
| forrest@0 | 6 | ; 277.2791 -> 326.4261 | 
| forrest@0 | 7 | ;************************************************ | 
| forrest@0 | 8 | load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" | 
| forrest@0 | 9 | load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" | 
| forrest@0 | 10 | load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" | 
| forrest@0 | 11 | ;************************************************ | 
| forrest@0 | 12 | begin | 
| forrest@0 | 13 | ; final output | 
| forrest@0 | 14 | diro = "/fis/cgd/cseg/people/jeff/clamp_data/biomass/ob/" | 
| forrest@0 | 15 | filo = "amazon_biomass.nc" | 
| forrest@0 | 16 | c = addfile(diro+filo,"c") | 
| forrest@0 | 17 | |
| forrest@0 | 18 | ; input byte file | 
| forrest@0 | 19 | diri = "/fis/cgd/cseg/people/jeff/clamp_data/biomass/ob/" | 
| forrest@0 | 20 | fili = "amazon_biomass_byte.nc" | 
| forrest@0 | 21 | b = addfile(diri+fili,"r") | 
| forrest@0 | 22 | |
| forrest@0 | 23 | data = byte2flt(b->biomass) | 
| forrest@0 | 24 | |
| forrest@0 | 25 | dsizes_data = dimsizes(data) | 
| forrest@0 | 26 | nlat = dsizes_data(0) | 
| forrest@0 | 27 | nlon = dsizes_data(1) | 
| forrest@0 | 28 | ; print (nlat) | 
| forrest@0 | 29 | ; print (nlon) | 
| forrest@0 | 30 | |
| forrest@0 | 31 | lat = new((/nlat/),float) | 
| forrest@0 | 32 | lon = new((/nlon/),float) | 
| forrest@0 | 33 | |
| forrest@0 | 34 | latS = -21.1277 | 
| forrest@0 | 35 | latN = 13.8533 | 
| forrest@0 | 36 | lonL = -82.7209 | 
| forrest@0 | 37 | lonR = -33.5739 | 
| forrest@0 | 38 | |
| forrest@0 | 39 | dy = abs((latN-latS)/(nlat-1)) | 
| forrest@0 | 40 | dx = abs((lonR-lonL)/(nlon-1)) | 
| forrest@0 | 41 | |
| forrest@0 | 42 | do n = 0,nlat-1 | 
| forrest@0 | 43 | lat(n) = latS + n*dy | 
| forrest@0 | 44 | end do | 
| forrest@0 | 45 | |
| forrest@0 | 46 | do n = 0,nlon-1 | 
| forrest@0 | 47 | lon(n) = lonL + n*dx + 360. | 
| forrest@0 | 48 | end do | 
| forrest@0 | 49 | |
| forrest@0 | 50 | lat!0 = "lat" | 
| forrest@0 | 51 | lon!0 = "lon" | 
| forrest@0 | 52 | lat@units = "degrees_north" | 
| forrest@0 | 53 | lat@long_name = "Latitude" | 
| forrest@0 | 54 | lon@units = "degrees_east" | 
| forrest@0 | 55 | lon@long_name = "Longitude" | 
| forrest@0 | 56 | print (lat) | 
| forrest@0 | 57 | print (lon) | 
| forrest@0 | 58 | |
| forrest@0 | 59 | data!0 = "lat" | 
| forrest@0 | 60 | data!1 = "lon" | 
| forrest@0 | 61 | |
| forrest@0 | 62 | data@units = "Mg C/ha" | 
| forrest@0 | 63 | data@long_name = "Amoazon Biomass" | 
| forrest@0 | 64 | data@_FillValue = 1.e+36 | 
| forrest@0 | 65 | |
| forrest@0 | 66 | ; print (data) | 
| forrest@0 | 67 | |
| forrest@0 | 68 | c->lat = lat | 
| forrest@0 | 69 | c->lon = lon | 
| forrest@0 | 70 | c->BIOMASS = data(::-1,:) | 
| forrest@0 | 71 | end |