co2/31.contour_model.ncl
changeset 0 0c6405ab2ff4
equal deleted inserted replaced
-1:000000000000 0:f1e60e286848
       
     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 ;************************************************
       
     7 begin
       
     8 ;************************************************
       
     9 ; read in model data
       
    10 ;************************************************
       
    11   diri  = "/fis/cgd/cseg/people/jeff/clamp_data/model/"
       
    12   fili  = "b30.061m_401_425_ANN_climo.nc"
       
    13 
       
    14   g     = addfile(diri+fili,"r")
       
    15   x     = g->CO2
       
    16   xdim  = dimsizes(x)
       
    17   nlev  = xdim(1)
       
    18   y0    = x(0,0,:,:)
       
    19   
       
    20 ; get the co2 at the lowest level
       
    21   y0    = x(0,nlev-1,:,:)
       
    22 
       
    23 ; change to unit of observed (u mol/mol)
       
    24 ; Model_units [=] kgCO2 / kgDryAir
       
    25 ; 28.966 = molecular weight of dry air
       
    26 ; 44.       = molecular weight of CO2
       
    27 ; u mol = 1e-6 mol
       
    28 
       
    29   factor = (28.966/44.) * 1e6
       
    30   y0     = y0 * factor
       
    31 
       
    32   y0@_FillValue = 1.e36
       
    33   y0@units      = "u mol/mol"
       
    34 ; y0 = where(y0 .lt. 287.,y0@_FillValue,y0)
       
    35   print (min(y0)+"/"+max(y0))
       
    36 
       
    37 ;************************************************
       
    38 ; create default plot
       
    39 ;************************************************
       
    40 
       
    41   wks = gsn_open_wks("ps","xy")              ; open a ps file
       
    42   gsn_define_colormap(wks,"gui_default")     ; choose colormap
       
    43 
       
    44   res                     = True             ; Use plot options
       
    45   res@cnFillOn            = True             ; Turn on color fill
       
    46   res@gsnSpreadColors      = True            ; use full colormap
       
    47 ; res@cnFillMode          = "RasterFill"     ; Turn on raster color
       
    48 ; res@lbLabelAutoStride   = True
       
    49   res@cnLinesOn           = False            ; Turn off contourn lines
       
    50   res@mpFillOn            = False            ; Turn off map fill
       
    51   res@tiMainString        = "Model b30.061m 401-425"
       
    52 
       
    53   res@gsnSpreadColors     = True             ; use full colormap
       
    54   res@cnLevelSelectionMode = "ManualLevels"  ; Manual contour invtervals
       
    55   res@cnMinLevelValF       = 286.            ; Min level
       
    56   res@cnMaxLevelValF       = 310.            ; Max level
       
    57   res@cnLevelSpacingF      = 2.              ; interval
       
    58 
       
    59   plot = gsn_csm_contour_map_ce(wks,y0,res)         ; for model
       
    60   system("convert xy.ps xy.png")
       
    61 end