overlay plot

From: Chao Luo <chao.luo_at_nyahnyahspammersnyahnyah>
Date: Sun Apr 10 2011 - 13:01:12 MDT

Hi,

I am trying to make wind vector plot over to contour plot, but there is always color bar of vector, which I want to get rid of. I tried something to remove it, but didn't work. I am attching the script and plot here.
Any suggestion is very appreciated!

Thanks much!

Chao

;***************************************************************************
; tstvec_1.ncl
;
;***************************************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

procedure metaUtil (z[*][*][*]:numeric, time[*], lat[*], lon[*])

begin
   z!0 = "time" ; name dimensions
   z!1 = "lat"
   z!2 = "lon"
   z&time = time ; assign coordinate variables
   z&lat = lat
   z&lon = lon
end

begin
  f = addfile ("GRIDCRO2D_4km.20060101.nc", "r")
  lat2d = f->LAT(0,0,:,:)
  lon2d = f->LON(0,0,:,:)

printVarSummary (lat2d)

;;;; read model simulated IC2CG data
lat_nbr = 100
lon_nbr = 142
;;; read ASCII data

uw = asciiread("/data12/cluo/cmaq4.6/data/post/4km/dat/uu_sfc_dot.dat", (/lat_nbr,lon_nbr/),"float")
vw = asciiread("/data12/cluo/cmaq4.6/data/post/4km/dat/vv_sfc_dot.dat", (/lat_nbr,lon_nbr/),"float")
so2 = asciiread("/data12/cluo/cmaq4.6/data/post/4km/dat/so2_sfc_ppm.dat", (/lat_nbr,lon_nbr/),"float")
so2 = so2 * 1000. ;; ppmv => ppbv

printVarSummary (uw)
printVarSummary (vw)

;*************create plots*******************
  wks = gsn_open_wks ("ps", "vector") ; open workstation
  gsn_define_colormap(wks,"BlAqGrYeOrRe") ; choose colormap
  plot = new(2,graphic)

  cnres = True
  cnres@gsnDraw = False ; Don't draw plot or advance the
  cnres@gsnFrame = False ; frame after plot is created.
  cnres@sfXArray = lon2d
  cnres@sfYArray = lat2d
  cnres@mpLimitMode = "Corners"
  cnres@mpLeftCornerLatF = lat2d(0,10)
  cnres@mpLeftCornerLonF = lon2d(0,10)
  cnres@mpRightCornerLatF = lat2d(99,121)
  cnres@mpRightCornerLonF = lon2d(99,121)
  cnres@cnFillOn = True ; color fill
  cnres@cnLinesOn = False ; no contour lines
  cnres@gsnSpreadColors = False ; use total colormap
  cnres@gsnSpreadColorStart = 4
  cnres@gsnSpreadColorEnd = -1
  cnres@mpGridAndLimbOn = False
  cnres@pmTickMarkDisplayMode = "Always" ; turn on tickmarks
  cnres@tmXTOn = False
  cnres@gsnAddCyclic = False ; regional data
  cnres@mpOutlineOn = True ; turn on map outline
  cnres@mpDataBaseVersion = "MediumRes"
  cnres@mpOutlineBoundarySets = "National"
  mpGeophysicalLineThicknessF = 1.5
  cnres@mpDataSetName = "Earth..4"
  cnres@gsnAddCyclic = False
  cnres@lbLabelAutoStride = False

  cnres@cnLevelSelectionMode = "ExplicitLevels" ; set explicit contour levels
  cnres@cnLevels = (/0,1.,5.,10.,15.,20.,30.,50./)
  cnres@cnFillColors = (/10,20,30,40,50,65,75,85,96/)
  cnres@gsnCenterString = "SO2 (ppbv)"

  cnid = gsn_csm_contour_map_ce(wks,so2(:,:),cnres)

  vcres = True ; plot mods desired
  vcres@gsnDraw = False ; Don't draw plot or advance the
  vcres@gsnFrame = False ; frame after plot is created.
  vcres@vcRefAnnoOrthogonalPosF = -1.0 ; move ref vector up
  vcres@vcRefMagnitudeF = 10.0 ; define vector ref mag
  vcres@vcRefLengthF = 0.045 ; define length of vec ref
  vcres@vcGlyphStyle = "CurlyVector" ; turn on curly vectors
  vcres@vcMinDistanceF = 0.017
  vcres@lbLabelAutoStride = False
  vcres@gsnSpreadColors = False

  vcres@gsnAddCyclic = False
  vcres@vfXArray = lon2d
  vcres@vfYArray = lat2d
  vcres@mpLimitMode = "Corners"
  vcres@mpLeftCornerLatF = lat2d(0,10)
  vcres@mpLeftCornerLonF = lon2d(0,10)
  vcres@mpRightCornerLatF = lat2d(99,121)
  vcres@mpRightCornerLonF = lon2d(99,121)

   vcid = gsn_csm_vector_scalar(wks,uw,vw,so2,vcres)

  overlay(cnid,vcid)
; maximize_output(wks,True)

  resP = True
  resP@mpLabelsOn = False
  resP@gsnPanelYWhiteSpacePercent = 5
  resP@gsnPanelXWhiteSpacePercent = 5
  resP@cnFillColors = (/5,10,20,30,40,50,65,75,85,96/)
  resP@gsnMaximize = True
  resP@gsnPanelLabelBar = False
  resP@lbLabelBarOn = False
  resP@gsnPaperOrientation = "portrait"
; resP@lbOrientation = "vertical" ; vertical label bar
; resP@lbOrientation = "horizontal"
  resP@lbLabelAutoStride = False ; nice label bar labels
  resP@lbTitleOn = True
  resP@lbLabelFont = "helvetica"
; resP@lbTitleString = "Sig lvl"
  resP@lbTitlePosition = "Bottom"
  resP@lbTitleFontHeightF = .022
  resP@lbTitleDirection = "Across"
; resP@txString = title
  gsn_panel(wks,cnid,(/2,1/),resP)

  frame (wks)
end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Mon Apr 11 05:01:30 2011

This archive was generated by hypermail 2.1.8 : Tue Apr 19 2011 - 18:32:03 MDT