Re: Multiple Overlays Problem

From: Rick Brownrigg <brownrig_at_nyahnyahspammersnyahnyah>
Date: Mon Aug 30 2010 - 10:01:47 MDT

Hi Justin,

I think the issue is that you are setting *free standing* variables
"gsnFrame" and "gsnDraw" to false, rather than setting resources;
e.g.:

   res@gsnDraw = False
   res@gsnFrame = False

(or whichever resource you are passing to the plot routines, if not
"res").

PDF is indeed possible. Set your variable "pltType" to "pdf", or if
you have NCL 5.2.0, you can try "newpdf".

Hope that helps...
Rick

On Mon, 30 Aug 2010 10:52:43 -0500
  Justin Traiteur <jtraite2@atmos.illinois.edu> wrote:
> Hello all. I have written a code that overlays several xy plots on
>
> top of each other for different physics options of an ensemble. The
>
> problem that I am having is that before the overlay occurs each map
>
> individual plot is plotted. Is it possible that just the overlay
>plot
> could be shown instead of going through each one individually and
> could that plot be in .pdf format?
>
> Thanks,
> Justin
>
>
> 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/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl" ;
> WRF_Times2Udunits_c
>
> begin
> i = 1
> do while (i .le. 6)
> date = "_06041300"
> diri = "./"
> ens = i
> fili = "wrfout_ens"
> nc = ".nc"
> f = addfile (diri+fili+ens+date+nc,
> "r") ; Load file
>
> pltType = "x11" ;
>
> Use x11 for plotting
> wks = gsn_open_wks(pltType,"overlay") ; Open
>
> workstation
> res = True
> res@MainTitle = "SCM WRF"
> pltres = True
> mpres = True
>
> times = wrf_user_list_times(f)
> it = 1
> res@TimeLabel = times(it)
>
> eta_i = ispan(1,40,1)
> plot = new (1,"graphic") ;
>
> Plot 2 maps
> theta = wrf_user_getvar(f,"theta",it)
> thetan1 = theta(eta_i,0,0)
> thetan2 = theta(eta_i,0,1)
> thetan3 = theta(eta_i,1,0)
> thetan4 = theta(eta_i,1,1)
>
> thetan5 = (thetan1 + thetan2)/2 ;
>
> Calculate average Theta between U points
> thetan6 = (thetan3 + thetan4)/2 ;
>
> Calculate average Theta between V poitns
> thetan7 = (thetan5 + thetan6)/2
>
> z = wrf_user_getvar(f,"z",it) ;
>
> Model height
> zn = z(eta_i,0,0) ;
>
> Only first 40 levs
> u1 = f->U(it,eta_i,0,1)
> u2 = f->U(it,eta_i,1,1)
>
> v1 = f->V(it,eta_i,1,0)
> v2 = f->V(it,eta_i,1,1)
> u3 = (u1 + u2)/2 ;
>
> Calculate average between U grid points
> v3 = (v1 + v2)/2 ;
>
> Calculate average between V grid points
> spd = sqrt(u3*u3+v3*v3) ;
>
> Calculate wind speed
> res = True ;
>
> plot mods desired
> res@tiMainString = "WRF SCM THETA" ;
>
> title
> res@tiYAxisString = "Height (m)" ;
>y
> axis title
> res@tiXAxisString = "Potential Temperature (K)" ;
>x
> axis title
> res@trXMaxF = 302.44
> gsnDraw = False
> gsnFrame = False
>
> colors =
> (/"black","red","blue","green","brown","orange"/)
> res@xyLineThicknesses = 3.0 ;
>
> line thicknesses
> res@TimeLabel = times(it)
>
> opts = res
> opts@cnLineColor = "Red"
> FramePlot = False
> gsnDraw = False
> gsnFrame = False
>
> if(i .eq. 1) then
> theta1 = thetan7
> z1 = zn
> end if
> if(i .eq. 2) then
> theta2 = thetan7
> z2 = zn
> end if
> if(i .eq. 3) then
> theta3 = thetan7
> z3 = zn
> end if
> if(i .eq. 4) then
> theta4 = thetan7
> z4 = zn
> end if
> if(i .eq. 5) then
> theta5 = thetan7
> z5 = zn
> end if
> if(i .eq. 6) then
> theta6 = thetan7
> z6 = zn
> end if
> if(i .eq. 7) then
> theta7 = thetan7
> z7 = zn
> end if
> if(i .eq. 8) then
> theta8 = thetan7
> z8 = zn
> end if
> if(i .eq. 9) then
> theta9 = thetan7
> z9 = zn
> end if
> if(i .eq. 10) then
> theta10 = thetan7
> z10 = zn
> end if
> if(i .eq. 11) then
> theta11 = thetan7
> z11 = zn
> end if
> i = i+1
> end do
>
> plot1 = gsn_csm_xy(wks,theta1,z1,res)
> res@xyLineColor = colors(1)
>
> plot2 = gsn_csm_xy(wks,theta2,z2,res)
> res@xyLineColor = colors(2)
>
> plot3 = gsn_csm_xy(wks,theta3,z3,res)
> res@xyLineColor = colors(3)
>
> plot4 = gsn_csm_xy(wks,theta4,z4,res)
> res@xyLineColor = colors(4)
>
> plot5 = gsn_csm_xy(wks,theta5,z5,res)
> res@xyLineColor = colors(5)
>
> plot6 = gsn_csm_xy(wks,theta6,z6,res)
> ; res@xyLineColor = colors(6)
> ; plot7 = gsn_csm_xy(wks,theta7,z7,res)
> ; plot8 = gsn_csm_xy(wks,theta8,z8,res)
> ; plot9 = gsn_csm_xy(wks,theta9,z9,res)
> ; plot10 = gsn_csm_xy(wks,theta10,z10,res)
> ; plot11 = gsn_csm_xy(wks,theta11,z11,res)
> overlay(plot1,plot2)
>
> overlay(plot1,plot3)
>
> overlay(plot1,plot4)
>
> overlay(plot1,plot5)
>
> overlay(plot1,plot6)
>
> number = (/1., 2., 3., 4., 5., 6./)
> lgres = True
> lgres@lgLineColors = colors
> lgres@lgItemType = "Lines"
> lgres@lgLabelFontHeightF = .08
> lgres@vpWidthF = 0.18
> lgres@vpHeightF = 0.16
> lgres@perimThicknessF = 2.0
> lgres@lgMonoDashIndex= True
> lgres@lgDashIndex = 0
> labels = " Ensemble "+number
> legend = gsn_create_legend (wks,6,labels,lgres)
> amres = True
> amres@amJust = "TopRight"
> amres@amParallelPosF = 0.4
> amres@amOrthogonalPosF = -0.4
> annoid = gsn_add_annotation(plot1,legend,amres)
>
> ; overlay(plot1,plot7)
> ; overlay(plot1,plot8)
> ; overlay(plot1,plot9)
> ; overlay(plot1,plot10)
> ; overlay(plot1,plot11)
>
> draw(plot1)
> frame(wks)
> end
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Aug 30 10:01:53 2010

This archive was generated by hypermail 2.1.8 : Thu Sep 09 2010 - 05:56:39 MDT