lai/31.contour_ob_lai_max.ncl.1
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
; read in observed data
forrest@0
    11
;************************************************
forrest@0
    12
  diri  = "/fis/cgd/cseg/people/jeff/clamp_data/"
forrest@0
    13
; fili  = "LAI_2000-2005_ensemble_T42.nc"
forrest@0
    14
  fili  = "2000-2005_ensemble_T42.nc"
forrest@0
    15
  f     = addfile(diri+fili,"r")
forrest@0
    16
forrest@0
    17
  z     = f->LAI
forrest@0
    18
  y     = z(0,:,:)
forrest@0
    19
  y@long_name = "Leaf Area Index Max"
forrest@0
    20
  p     = z(0,:,:)
forrest@0
    21
  p@long_name = "Leaf Area Index Max Month"
forrest@0
    22
  s     = z(:,0,0)
forrest@0
    23
; printVarSummary(s)
forrest@0
    24
 
forrest@0
    25
  dsizes_z = dimsizes(z)
forrest@0
    26
  ntime    = dsizes_z(0)
forrest@0
    27
  nlat     = dsizes_z(1)
forrest@0
    28
  nlon     = dsizes_z(2)
forrest@0
    29
  
forrest@0
    30
  do j = 0,nlat-1
forrest@0
    31
  do i = 0,nlon-1
forrest@0
    32
     s      = z(:,j,i) 
forrest@0
    33
     y(j,i) = max(s)
forrest@0
    34
     p(j,i) = maxind(s)+ 1
forrest@0
    35
forrest@0
    36
;    iMax   = ind(s.eq.y(j,i)) + 1      ; may be multiple max
forrest@0
    37
;    if (.not.ismissing(iMax(0))) then 
forrest@0
    38
;        p(j,i) =  iMax(0)          ; no meta data
forrest@0
    39
;    end if
forrest@0
    40
;    delete(iMax)
forrest@0
    41
forrest@0
    42
  end do
forrest@0
    43
  end do
forrest@0
    44
forrest@0
    45
; printVarSummary(p)
forrest@0
    46
  print (min(y)+"/"+max(y))
forrest@0
    47
  print (min(p)+"/"+max(p))
forrest@0
    48
exit
forrest@0
    49
;************************************************
forrest@0
    50
; read in model data
forrest@0
    51
;************************************************
forrest@0
    52
  fili2 = "i01.03cn_1545-1569_ANN_climo.nc"
forrest@0
    53
  g     = addfile(diri+fili2,"r")
forrest@0
    54
  x     = g->TLAI
forrest@0
    55
forrest@0
    56
  delta = 0.00000000001
forrest@0
    57
  x0    = x(0,:,:)
forrest@0
    58
  y = where(ismissing(y).and.(ismissing(x0).or.(x0.lt.delta)),0.,y)
forrest@0
    59
;************************************************
forrest@0
    60
; create default plot
forrest@0
    61
;************************************************
forrest@0
    62
  
forrest@0
    63
; setvalues NhlGetWorkspaceObjectId()
forrest@0
    64
;   "wsMaximumSize" : 199999999
forrest@0
    65
; end setvalues
forrest@0
    66
forrest@0
    67
  wks = gsn_open_wks("ps","xy")         ; open a ps file
forrest@0
    68
; gsn_define_colormap(wks,"wgne15")          ; choose colormap
forrest@0
    69
  gsn_define_colormap(wks,"gui_default")     ; choose colormap
forrest@0
    70
forrest@0
    71
  res                     = True             ; Use plot options
forrest@0
    72
  res@cnFillOn            = True             ; Turn on color fill
forrest@0
    73
  res@gsnSpreadColors      = True            ; use full colormap
forrest@0
    74
; res@cnFillMode          = "RasterFill"     ; Turn on raster color
forrest@0
    75
; res@lbLabelAutoStride   = True
forrest@0
    76
  res@cnLinesOn           = False            ; Turn off contourn lines
forrest@0
    77
  res@mpFillOn            = False            ; Turn off map fill
forrest@0
    78
  res@tiMainString        = "MODIS MOD 15A2 2000-2005"
forrest@0
    79
forrest@0
    80
  res@gsnSpreadColors     = True             ; use full colormap
forrest@0
    81
  res@cnLevelSelectionMode = "ManualLevels"  ; Manual contour invtervals
forrest@0
    82
  res@cnMinLevelValF       = 0.              ; Min level
forrest@0
    83
  res@cnMaxLevelValF       = 12.             ; Max level
forrest@0
    84
  res@cnLevelSpacingF      = 1.              ; interval
forrest@0
    85
forrest@0
    86
; pres                            = True     ; panel plot mods desired
forrest@0
    87
; pres@gsnMaximize                = True     ; fill the page
forrest@0
    88
forrest@0
    89
  plot = gsn_csm_contour_map_ce(wks,y,res)   ; for observed
forrest@0
    90
forrest@0
    91
  plot = gsn_csm_contour_map_ce(wks,p,res)   ; for observed
forrest@0
    92
forrest@0
    93
; gsn_panel(wks,plot,(/1,1/),pres)           ; create panel plot
forrest@0
    94
  system("convert xy.ps xy.png")
forrest@0
    95
end