class/03.class_1.9_write.ncl
changeset 0 0c6405ab2ff4
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/class/03.class_1.9_write.ncl	Mon Jan 26 22:08:20 2009 -0500
     1.3 @@ -0,0 +1,61 @@
     1.4 +;*************************************************
     1.5 +; ce_1.ncl
     1.6 +;************************************************
     1.7 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"  
     1.8 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
     1.9 +load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"  
    1.10 +;************************************************
    1.11 +begin
    1.12 +
    1.13 +; final output
    1.14 +
    1.15 +  diro  = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
    1.16 +  filo =  "class_pft_1.9.nc"
    1.17 +  c = addfile(diro+filo,"c")
    1.18 + 
    1.19 +; read model data
    1.20 +
    1.21 +  diri  = "/fis/cgd/cseg/people/jeff/surface_data/"
    1.22 +  fili  = "surfdata_1.9x2.5_cn_070119.nc"
    1.23 +  f     = addfile(diri+fili,"r")
    1.24 +
    1.25 +  y     = f->PCT_PFT
    1.26 +; printVarSummary(y)
    1.27 +
    1.28 +; read model grid data
    1.29 +
    1.30 +  diri  = "/fis/cgd/cseg/people/jeff/surface_data/"
    1.31 +  fili  = "lnd_1.9.nc"   
    1.32 +  g = addfile(diri+fili,"r")
    1.33 +
    1.34 +  landmask = g->landmask
    1.35 +  lat      = g->lat
    1.36 +  lon      = g->lon
    1.37 +
    1.38 +  nlat = dimsizes(lat)
    1.39 +  nlon = dimsizes(lon)
    1.40 +
    1.41 +  x = y(0,:,:)
    1.42 +
    1.43 +  x!0   = "lat"
    1.44 +  x&lat = lat            
    1.45 +  x!1   = "lon"
    1.46 +  x&lon = lon
    1.47 +  x@_FillValue = 1.e36
    1.48 +  x@long_name  = "Model PFT Classes"  
    1.49 +  
    1.50 +  do j= 0,nlat-1
    1.51 +  do i= 0,nlon-1
    1.52 +     x(j,i) = maxind(y(:,j,i))      
    1.53 +  end do
    1.54 +  end do 
    1.55 +
    1.56 +; print (x)  
    1.57 +
    1.58 +  x = where(landmask .lt. 1.,x@_FillValue,x)
    1.59 +
    1.60 +  c->CLASS_PFT = x
    1.61 +  c->lat       = lat 
    1.62 +  c->lon       = lon
    1.63 +
    1.64 +end
    1.65 \ No newline at end of file