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