overlay

From: Sahana Paul <paulsahana_at_nyahnyahspammersnyahnyah>
Date: Tue, 8 Jan 2008 07:23:46 +0000 (GMT)

Hi,
             I want to overlay two plots. I can do with overlay function and frame the workstation. But I is strange I can not get the pdf /ps version of the plot......I anyone help me in this matter. I give my script below.
   
  Regards
   
  Sahana.
   
  load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl" ; Load the NCL file that
                     ; contains the gsn_* functions used below.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
;=======================================================>;PARAMETERS
     ntime = 120 ;#time steps
; ncols = 8192 ;#columns (stations or grid pts) for S
; ncolz = 3185 ;#columns (stations or grid pts) for Z
; nsvd = 196 ;#svd patterns to calculate
                                                        ;[nsvd<=min(ncols,ncolz)]
                                                        
                                          
      nc_file = addfile("F:/NCEP/slp.mon.mean.nc","r") ; read the grib file
     
      print(nc_file)
         s = nc_file->slp(:,:,:)
       t=nc_file->time
       
        printVarSummary(s)
       
; print(t)
    
          
              arr=new((/ntime,73,144/),float)
                n=0
              i=24+5
          
               do j=1,40
           
                print(s(i:i+2,0,0))
         
                 arr(n:n+2,:,:)=s(i:i+2,:,:)
          
                n=n+3
                i=i+12
          
                end do
              
; printVarSummary(arr)
              
                arr!0="time"
                arr!1="lat"
                arr!2="lon"
             
               y=arr(lat|:,lon|:,time|:)
             
             
; printVarSummary(y)
             
   
             fils = systemfunc("ls F:/ExtracCRU/prec-2d_sum_*.nc")
         
             print(fils)
            
             f = addfiles(fils,"r")
    
;; print(f[:])
    
               z=f[:]->precp
              
               printVarSummary(z)
              
               z1=z(30:149,:)
          
             
                x=dim_avg(z1)
             
; printVarSummary(x)
            
                ccr=escorc(x,y)
            
             
; print(ccr)
                   
                
          
                 copy_VarCoords(y(:,:,0),ccr)
                 
                 ccr1=esacr(y,0)
                 
                 printVarSummary(ccr1)
                 
                copy_VarCoords(y(:,:,0),ccr1(:,:,0))
              
                  wks = gsn_open_wks("x11","cm") ; open a ps plot
                
            
                 gsn_define_colormap(wks,"BlAqGrYeOrRe") ; choose colormap
 
                  res = True ; make plot mods
                  
                  res_at_gsnDraw = False ; don't draw
                  res_at_gsnFrame = False ; don't advance frame
                    res_at_cnFillOn = True ; turn on color
                  res_at_gsnSpreadColors = True ; use full colormap
                  res_at_cnLinesOn = False ; turn off contour lines
                  res_at_lbLabelAutoStride = True ; automatic lb label stride
  
                  res_at_cnLevelSelectionMode = "ManualLevels" ; manually set cn levels
                  res_at_cnMinLevelValF = -1 ; min level
                  res_at_cnMaxLevelValF = 1 ; max level
                  res_at_cnLevelSpacingF = .1 ; contour level spacing
  ;; lag = 0
                  res_at_tiMainString = "Correlations map for SLP(SUMMER)"
               
               
                   base = gsn_csm_contour_map_ce(wks,ccr,res)
                   
                   print(base)
                   
                   
                   
; printVarSummary(ccr1)
                   
                   Nx = num(.not.ismissing(ccr))
                   
; print(Nx)
                             
                    prob = rtest(ccr, 120, 0)
  
                    print(prob)
                    
                    copy_VarCoords(y(:,:,0),prob)
                    
                    siglvl= 0.05
                    
                    siglev=new(dimsizes(prob),float)
                   
                   
                   do i= 0, 72
                   do j= 0, 143
                  
                   if (prob(i,j).lt.siglvl) then
                   
                   siglev(i,j)=prob(i,j)
                   
                   end if
                   
                   end do
                   end do
                   
                   print(siglev)
                   
                    copy_VarCoords(y(:,:,0),siglev)
                   
                    
                    
                   
                    
                   gsn_define_colormap(wks,"BlAqGrYeOrRe") ; choose colormap
 
                   resCN = True ; make plot mods
                   
                    resCN_at_gsnDraw = False ; don't draw
                    resCN_at_gsnFrame = False
                     resCN_at_cnFillOn = False ; turn on color
                   resCN_at_gsnSpreadColors = True ; use full colormap
                   resCN_at_cnLinesOn = True ; turn off contour lines
                   resCN_at_lbLabelAutoStride = True ; automatic lb label stride
 
  
; res_at_tiMainString = "Correlations map for SLP(SUMMER)"
               
               
                   plot = gsn_csm_contour(wks,siglev(:,:),resCN)
                   
                   print(plot)
                  
; overlay(base,plot)
                  
; draw(base)
                  
; frame(wks)
                    
                  wks = gsn_open_wks("x11","cm") ; open a ps plot
                
                  
                  plot1 = gsn_csm_contour_map_overlay(wks,ccr,siglev,res,resCN)
                                     
                   draw(plot1)
                   frame(wks)
                                           
   
   
   

       
---------------------------------
 Forgot the famous last words? Access your message archive online. Click here.

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jan 08 2008 - 00:23:46 MST

This archive was generated by hypermail 2.2.0 : Tue Jan 08 2008 - 18:39:18 MST