co2/31.contour_model.ncl
changeset 0 0c6405ab2ff4
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/co2/31.contour_model.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 +;************************************************
    1.10 +begin
    1.11 +;************************************************
    1.12 +; read in model data
    1.13 +;************************************************
    1.14 +  diri  = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
    1.15 +  fili  = "b30.061m_401_425_ANN_climo.nc"
    1.16 +
    1.17 +  g     = addfile(diri+fili,"r")
    1.18 +  x     = g->CO2
    1.19 +  xdim  = dimsizes(x)
    1.20 +  nlev  = xdim(1)
    1.21 +  y0    = x(0,0,:,:)
    1.22 +  
    1.23 +; get the co2 at the lowest level
    1.24 +  y0    = x(0,nlev-1,:,:)
    1.25 +
    1.26 +; change to unit of observed (u mol/mol)
    1.27 +; Model_units [=] kgCO2 / kgDryAir
    1.28 +; 28.966 = molecular weight of dry air
    1.29 +; 44.       = molecular weight of CO2
    1.30 +; u mol = 1e-6 mol
    1.31 +
    1.32 +  factor = (28.966/44.) * 1e6
    1.33 +  y0     = y0 * factor
    1.34 +
    1.35 +  y0@_FillValue = 1.e36
    1.36 +  y0@units      = "u mol/mol"
    1.37 +; y0 = where(y0 .lt. 287.,y0@_FillValue,y0)
    1.38 +  print (min(y0)+"/"+max(y0))
    1.39 +
    1.40 +;************************************************
    1.41 +; create default plot
    1.42 +;************************************************
    1.43 +
    1.44 +  wks = gsn_open_wks("ps","xy")              ; open a ps file
    1.45 +  gsn_define_colormap(wks,"gui_default")     ; choose colormap
    1.46 +
    1.47 +  res                     = True             ; Use plot options
    1.48 +  res@cnFillOn            = True             ; Turn on color fill
    1.49 +  res@gsnSpreadColors      = True            ; use full colormap
    1.50 +; res@cnFillMode          = "RasterFill"     ; Turn on raster color
    1.51 +; res@lbLabelAutoStride   = True
    1.52 +  res@cnLinesOn           = False            ; Turn off contourn lines
    1.53 +  res@mpFillOn            = False            ; Turn off map fill
    1.54 +  res@tiMainString        = "Model b30.061m 401-425"
    1.55 +
    1.56 +  res@gsnSpreadColors     = True             ; use full colormap
    1.57 +  res@cnLevelSelectionMode = "ManualLevels"  ; Manual contour invtervals
    1.58 +  res@cnMinLevelValF       = 286.            ; Min level
    1.59 +  res@cnMaxLevelValF       = 310.            ; Max level
    1.60 +  res@cnLevelSpacingF      = 2.              ; interval
    1.61 +
    1.62 +  plot = gsn_csm_contour_map_ce(wks,y0,res)         ; for model
    1.63 +  system("convert xy.ps xy.png")
    1.64 +end
    1.65 \ No newline at end of file