forrest@0: ;************************************************ forrest@0: ; Read byte, Write nc forrest@0: ; input data is : 13.8533N -> -21.1277S forrest@0: ; -82.7209 -> -33.5739 forrest@0: ; output data is : -21.1277S -> 13.8533N forrest@0: ; 277.2791 -> 326.4261 forrest@0: ;************************************************ forrest@0: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" forrest@0: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" forrest@0: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" forrest@0: ;************************************************ forrest@0: begin forrest@0: ; final output forrest@0: diro = "/fis/cgd/cseg/people/jeff/clamp_data/biomass/ob/" forrest@0: filo = "amazon_biomass.nc" forrest@0: c = addfile(diro+filo,"c") forrest@0: forrest@0: ; input byte file forrest@0: diri = "/fis/cgd/cseg/people/jeff/clamp_data/biomass/ob/" forrest@0: fili = "amazon_biomass_byte.nc" forrest@0: b = addfile(diri+fili,"r") forrest@0: forrest@0: data = byte2flt(b->biomass) forrest@0: forrest@0: dsizes_data = dimsizes(data) forrest@0: nlat = dsizes_data(0) forrest@0: nlon = dsizes_data(1) forrest@0: ; print (nlat) forrest@0: ; print (nlon) forrest@0: forrest@0: lat = new((/nlat/),float) forrest@0: lon = new((/nlon/),float) forrest@0: forrest@0: latS = -21.1277 forrest@0: latN = 13.8533 forrest@0: lonL = -82.7209 forrest@0: lonR = -33.5739 forrest@0: forrest@0: dy = abs((latN-latS)/(nlat-1)) forrest@0: dx = abs((lonR-lonL)/(nlon-1)) forrest@0: forrest@0: do n = 0,nlat-1 forrest@0: lat(n) = latS + n*dy forrest@0: end do forrest@0: forrest@0: do n = 0,nlon-1 forrest@0: lon(n) = lonL + n*dx + 360. forrest@0: end do forrest@0: forrest@0: lat!0 = "lat" forrest@0: lon!0 = "lon" forrest@0: lat@units = "degrees_north" forrest@0: lat@long_name = "Latitude" forrest@0: lon@units = "degrees_east" forrest@0: lon@long_name = "Longitude" forrest@0: print (lat) forrest@0: print (lon) forrest@0: forrest@0: data!0 = "lat" forrest@0: data!1 = "lon" forrest@0: forrest@0: data@units = "Mg C/ha" forrest@0: data@long_name = "Amoazon Biomass" forrest@0: data@_FillValue = 1.e+36 forrest@0: forrest@0: ; print (data) forrest@0: forrest@0: c->lat = lat forrest@0: c->lon = lon forrest@0: c->BIOMASS = data(::-1,:) forrest@0: end