class/02.class.ncl
changeset 0 0c6405ab2ff4
equal deleted inserted replaced
-1:000000000000 0:453176a761bf
       
     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 ;************************************************
       
    11 ; read in model data
       
    12 ;************************************************
       
    13   diri  = "/fis/cgd/cseg/people/jeff/clamp/class/"
       
    14   fili  = "T42.clamp.surface-data.060412.nc"
       
    15   f     = addfile(diri+fili,"r")
       
    16 
       
    17   y     = f->PCT_PFT
       
    18   printVarSummary(y)
       
    19 
       
    20   diri  = "/fis/cgd/cseg/people/jeff/surface_data/"
       
    21   fili  = "lnd_T42.nc"   
       
    22   g = addfile(diri+fili,"r")
       
    23 
       
    24   landmask = g->landmask
       
    25   lat      = g->lat
       
    26   lon      = g->lon
       
    27 
       
    28   nlat = dimsizes(lat)
       
    29   nlon = dimsizes(lon)
       
    30 
       
    31   x = y(0,:,:)
       
    32 
       
    33   x!0   = "lat"
       
    34   x&lat = lat            
       
    35   x!1   = "lon"
       
    36   x&lon = lon
       
    37   x@_FillValue = 1.e36
       
    38   x@long_name  = "Model PFT Classes"  
       
    39   
       
    40   do j= 0,nlat-1
       
    41   do i= 0,nlon-1
       
    42      x(j,i) = maxind(y(:,j,i))      
       
    43   end do
       
    44   end do 
       
    45 
       
    46 ; print (x)  
       
    47 
       
    48   x = where(landmask .lt. 1.,x@_FillValue,x)
       
    49 
       
    50 ;************************************************
       
    51 ; create default plot
       
    52 ;************************************************
       
    53 
       
    54   wks = gsn_open_wks("ps","class")              ; open a ps file
       
    55   gsn_define_colormap(wks,"gui_default")     ; choose colormap
       
    56 
       
    57   res                     = True             ; Use plot options
       
    58   res@cnFillOn            = True             ; Turn on color fill
       
    59   res@gsnSpreadColors     = True             ; use full colormap
       
    60   res@cnLinesOn           = False            ; Turn off contourn lines
       
    61   res@mpFillOn            = False            ; Turn off map fill
       
    62   res@tiMainString        = "Class"
       
    63 
       
    64   res@gsnSpreadColors      = True            ; use full colormap
       
    65   res@cnLevelSelectionMode = "ManualLevels"  ; Manual contour invtervals
       
    66   res@cnMinLevelValF       = 0.              ; Min level
       
    67   res@cnMaxLevelValF       = 16.             ; Max level
       
    68   res@cnLevelSpacingF      = 1.              ; interval
       
    69 
       
    70   plot = gsn_csm_contour_map_ce(wks,x,res)   
       
    71 
       
    72 end