Re: Overlaying XY plots

From: Debasish <debasish_at_nyahnyahspammersnyahnyah>
Date: Tue Jul 20 2010 - 09:39:57 MDT

Dear Justin

Please check the following webpage for overlay

http://www.ncl.ucar.edu/Document/Functions/Built-in/overlay.shtml

http://www.ncl.ucar.edu/Applications/overlay.shtml

http://www.ncl.ucar.edu/Applications/conOncon.shtml

I guess example overlay_7.ncl (http://www.ncl.ucar.edu/Applications/overlay.shtml) will be useful for you

Thanks

Debasish

On 2010-07-20, at 11:31, Justin Traiteur wrote:

> I wrote a code that takes temperature (theta) and plots it against height(meters). I have several different plots (plot1-plot11) that I need to plot on the same xy plot. Right now I can only get them to plot individually.
>
> 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. 11)
> diri = "./"
> ens = i
> fili = "wrfout_ens"
> nc = ".nc"
> f = addfile (diri+fili+ens+nc, "r") ; Load file
>
> pltType = "x11" ; Use x11 for plotting
> wks = gsn_open_wks(pltType,"plt_Surface1") ; Open workstation
> res = False
> 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
> gsnDraw = False
> gsnFrame = False
> colors = (/"red","red","blue","green","green","green"/)
> res@xyLineThicknesses = 3.0 ; line thicknesses
> res@TimeLabel = times(it)
>
> opts = res
> opts@cnLineColor = "Red"
> gsnDraw = False
> gsnFrame = False
> FramePlot = 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)
> plot2 = gsn_csm_xy(wks,theta2,z2,res)
> plot3 = gsn_csm_xy(wks,theta3,z3,res)
> plot4 = gsn_csm_xy(wks,theta4,z4,res)
> plot5 = gsn_csm_xy(wks,theta5,z5,res)
> plot6 = gsn_csm_xy(wks,theta6,z6,res)
> 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)
> 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 Tue Jul 20 09:42:39 2010

This archive was generated by hypermail 2.1.8 : Wed Jul 28 2010 - 10:42:06 MDT