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