1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/class/02.class.ncl Mon Jan 26 22:08:20 2009 -0500
1.3 @@ -0,0 +1,72 @@
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 +;************************************************
1.14 +; read in model data
1.15 +;************************************************
1.16 + diri = "/fis/cgd/cseg/people/jeff/clamp/class/"
1.17 + fili = "T42.clamp.surface-data.060412.nc"
1.18 + f = addfile(diri+fili,"r")
1.19 +
1.20 + y = f->PCT_PFT
1.21 + printVarSummary(y)
1.22 +
1.23 + diri = "/fis/cgd/cseg/people/jeff/surface_data/"
1.24 + fili = "lnd_T42.nc"
1.25 + g = addfile(diri+fili,"r")
1.26 +
1.27 + landmask = g->landmask
1.28 + lat = g->lat
1.29 + lon = g->lon
1.30 +
1.31 + nlat = dimsizes(lat)
1.32 + nlon = dimsizes(lon)
1.33 +
1.34 + x = y(0,:,:)
1.35 +
1.36 + x!0 = "lat"
1.37 + x&lat = lat
1.38 + x!1 = "lon"
1.39 + x&lon = lon
1.40 + x@_FillValue = 1.e36
1.41 + x@long_name = "Model PFT Classes"
1.42 +
1.43 + do j= 0,nlat-1
1.44 + do i= 0,nlon-1
1.45 + x(j,i) = maxind(y(:,j,i))
1.46 + end do
1.47 + end do
1.48 +
1.49 +; print (x)
1.50 +
1.51 + x = where(landmask .lt. 1.,x@_FillValue,x)
1.52 +
1.53 +;************************************************
1.54 +; create default plot
1.55 +;************************************************
1.56 +
1.57 + wks = gsn_open_wks("ps","class") ; open a ps file
1.58 + gsn_define_colormap(wks,"gui_default") ; choose colormap
1.59 +
1.60 + res = True ; Use plot options
1.61 + res@cnFillOn = True ; Turn on color fill
1.62 + res@gsnSpreadColors = True ; use full colormap
1.63 + res@cnLinesOn = False ; Turn off contourn lines
1.64 + res@mpFillOn = False ; Turn off map fill
1.65 + res@tiMainString = "Class"
1.66 +
1.67 + res@gsnSpreadColors = True ; use full colormap
1.68 + res@cnLevelSelectionMode = "ManualLevels" ; Manual contour invtervals
1.69 + res@cnMinLevelValF = 0. ; Min level
1.70 + res@cnMaxLevelValF = 16. ; Max level
1.71 + res@cnLevelSpacingF = 1. ; interval
1.72 +
1.73 + plot = gsn_csm_contour_map_ce(wks,x,res)
1.74 +
1.75 +end
1.76 \ No newline at end of file