class/03.class_T31_write.ncl
changeset 0 0c6405ab2ff4
equal deleted inserted replaced
-1:000000000000 0:a0595373bfe5
       
     1 ;*************************************************
       
     2 ; ce_1.ncl
       
     3 ;************************************************
       
     4 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"  
       
     5 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
       
     6 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"  
       
     7 ;************************************************
       
     8 begin
       
     9 
       
    10 ; final output
       
    11 
       
    12   diro  = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
       
    13   filo =  "class_pft_T31.nc"
       
    14   c = addfile(diro+filo,"c")
       
    15  
       
    16 ; read model data
       
    17 
       
    18   diri  = "/fis/cgd/cseg/people/jeff/surface_data/"
       
    19   fili  = "surfdata_48x96_c070501.nc"
       
    20   f     = addfile(diri+fili,"r")
       
    21 
       
    22   y     = f->PCT_PFT
       
    23 ; printVarSummary(y)
       
    24 
       
    25 ; read model grid data
       
    26 
       
    27   diri  = "/fis/cgd/cseg/people/jeff/surface_data/"
       
    28   fili  = "lnd_T31.nc"   
       
    29   g = addfile(diri+fili,"r")
       
    30 
       
    31   landmask = g->landmask
       
    32   lat      = g->lat
       
    33   lon      = g->lon
       
    34 
       
    35   nlat = dimsizes(lat)
       
    36   nlon = dimsizes(lon)
       
    37 
       
    38   x = y(0,:,:)
       
    39 
       
    40   x!0   = "lat"
       
    41   x&lat = lat            
       
    42   x!1   = "lon"
       
    43   x&lon = lon
       
    44   x@_FillValue = 1.e36
       
    45   x@long_name  = "Model PFT Classes"  
       
    46   
       
    47   do j= 0,nlat-1
       
    48   do i= 0,nlon-1
       
    49      x(j,i) = maxind(y(:,j,i))      
       
    50   end do
       
    51   end do 
       
    52 
       
    53 ; print (x)  
       
    54 
       
    55   x = where(landmask .lt. 1.,x@_FillValue,x)
       
    56 
       
    57   c->CLASS_PFT = x
       
    58   c->lat       = lat 
       
    59   c->lon       = lon
       
    60 
       
    61 end