npp/32.contour_diff.ncl
changeset 0 0c6405ab2ff4
equal deleted inserted replaced
-1:000000000000 0:50a6b35b806d
       
     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 observed data
       
    10 ;************************************************
       
    11  f     = addfile ("Npp_T42_mean.nc","r")
       
    12  y     = f->NPP
       
    13 ;************************************************
       
    14 ; read in model data
       
    15 ;************************************************
       
    16  g     = addfile ("i01.03cn_1545-1569_ANN_climo.nc","r")
       
    17 ;g     = addfile ("i01.04casa_1605-1629_ANN_climo.nc","r")
       
    18  x     = g->NPP
       
    19 
       
    20  nsec_per_year = 86400.*365.
       
    21  x = x * nsec_per_year
       
    22  
       
    23  x@units = "gC/m^2/year" 
       
    24 ;************************************************
       
    25 ;fill ob missing grid the same as model
       
    26 ;************************************************
       
    27  delta = 0.00001
       
    28  x0    = x(0,:,:)
       
    29  y = where(ismissing(y).and.(ismissing(x0).or.(x0.lt.delta)),0.,y)
       
    30 
       
    31  y@units = "gC/m^2/year"
       
    32 ;************************************************
       
    33 ;model - observed
       
    34 ;************************************************ 
       
    35  z = x
       
    36  z = x(0,:,:) - y(:,:)
       
    37 ;************************************************
       
    38 ; create 3 plots
       
    39 ;************************************************
       
    40   wks = gsn_open_wks("ps","xy")             ; open a ps file
       
    41   gsn_define_colormap(wks,"gui_default")     ; choose colormap
       
    42 
       
    43   res                     = True             ; Use plot options
       
    44   res@cnFillOn            = True             ; Turn on color fill
       
    45   res@gsnSpreadColors      = True            ; use full colormap
       
    46 ; res@cnFillMode          = "RasterFill"     ; Turn on raster color
       
    47 ; res@lbLabelAutoStride   = True
       
    48   res@cnLinesOn           = False            ; Turn off contourn lines
       
    49   res@mpFillOn            = False            ; Turn off map fill
       
    50   res@tiMainString        = "Observed MODIS MOD 17"
       
    51 
       
    52   res@gsnSpreadColors     = True             ; use full colormap
       
    53   res@cnLevelSelectionMode = "ManualLevels"  ; Manual contour invtervals
       
    54   res@cnMinLevelValF       = 0.              ; Min level
       
    55   res@cnMaxLevelValF       = 2200.           ; Max level
       
    56   res@cnLevelSpacingF      = 200.            ; interval
       
    57 
       
    58   res@gsnFrame             = False           ; Do not draw plot 
       
    59   res@gsnDraw              = False           ; Do not advance frame
       
    60 
       
    61   plot=new(3,graphic)                        ; create graphic array
       
    62 
       
    63   plot(0) = gsn_csm_contour_map_ce(wks,y,res)        ; for observed
       
    64 
       
    65   res@tiMainString        = "Model i01.03cn"
       
    66 ; res@tiMainString        = "Model i01.04casa"
       
    67   plot(1) = gsn_csm_contour_map_ce(wks,x(0,:,:),res) ; for model
       
    68 
       
    69   res@cnMinLevelValF       = -500           ; Min level
       
    70   res@cnMaxLevelValF       =  500.          ; Max level
       
    71   res@cnLevelSpacingF      = 50.            ; interval
       
    72   res@tiMainString        = "(Model i01.03cn) - (observed)"
       
    73 ; res@tiMainString        = "(Model i01.04casa) - (observed)"
       
    74   plot(2) = gsn_csm_contour_map_ce(wks,z(0,:,:),res) ; for model - ob
       
    75 
       
    76 ;***********************************************
       
    77 ; create panel plot
       
    78 ;***********************************************
       
    79   pres                            = True        ; panel plot mods desired
       
    80   pres@gsnPanelYWhiteSpacePercent = 5           ; increase white space around
       
    81                                                 ; indiv. plots in panel
       
    82   pres@gsnMaximize                = True        ; fill the page
       
    83 
       
    84   gsn_panel(wks,plot,(/3,1/),pres)              ; create panel plot
       
    85 
       
    86   system("convert xy.ps xy.png")
       
    87 end