Re: understanding Panel-Plot error when plotting streamlines

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Wed, 24 Oct 2007 16:22:25 -0600

Hi Erik,

You defined plot to be a graphic type of size 3 (plot = new(3,graphic)),
but for your third panel plot you referenced the 4th subscript of the
plot array, which is nonexistent.

So instead of this:
plot(3) = gsn_csm_streamline_map(wks,u_plane,v_plane,mpres)
try this:
plot(2) = gsn_csm_streamline_map(wks,u_plane,v_plane,mpres)
Adam

Erik Noble wrote:
> Hi.
> I am trying follow example 1 from the panel plot page,
> http://www.ncl.ucar.edu/Applications/panel.shtml
>
> except instead of plotting vectors as the third plot, I am plotting streamlines.
>
> I am receiving an error at line 73 in my code:
> fatal:Subscript out of range, error in subscript #0
> fatal:Execute: Error occurred at or near line 73 in file
> Panel-WRF-u-v-Streamlines.ncl
>
> What does this error mean and how can I fix it? It seems that
> everything is correct.
> I basically used the same code that i wrote about earlier when trying
> to only plot streamlines.
> Below is my error and code.
>
> Thank you for the help.
> Sincerely,
> ERik
> *************************************************************
> noble:/Volumes/Data_and_Models/ncl_scripts enoble$ ncl
> Panel-WRF-u-v-Streamlines.ncl
> Copyright (C) 1995-2007 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 4.3.1
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
>
> (0) Working on time: 2006-09-11_00:00:00
>
> Variable: u_plane
> Type: float
> Total Size: 60604 bytes
> 15151 values
> Number of Dimensions: 2
> Dimensions and sizes: [109] x [139]
> Coordinates:
> Number Of Attributes: 6
> lon2d : <ARRAY of 15151 elements>
> lat2d : <ARRAY of 15151 elements>
> description : u Velocity
> units : m/s
> _FillValue : -999999
> PlotLevelID : 700 hPa
> fatal:Subscript out of range, error in subscript #0
> fatal:Execute: Error occurred at or near line 73 in file
> Panel-WRF-u-v-Streamlines.ncl
>
> *********************************************************************************************
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ; This creates a 3x1 Panel plot of Zonal wind, Meridionla wind and Streamlines
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> 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/csm/shea_util.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
>
> begin
>
> a=addfile("/Volumes/Data_and_Models/Model-Output/Athena/WRF-SOP3-Athena_Phys-3-1-1-1.nc","r")
> date = "10 Sep 2006 - 12 UTC"
> lonW = -35
> lonE = 35
> latN = 35
> latS = -20
>
> pressure = 700.
>
> times = wrf_user_list_times(a)
> do it = 328,328 ;;;;;Time step you want!!!!
> print("Working on time: " + times(it) )
>
> u = wrf_user_getvar(a,"ua",it) ; u averaged to mass points
> v = wrf_user_getvar(a,"va",it) ; v averaged to mass points
> p = wrf_user_getvar(a, "pressure",it) ; pressure
>
> u_plane = wrf_user_intrp3d( u,p,"h",pressure,0.,False)
> v_plane = wrf_user_intrp3d( v,p,"h",pressure,0.,False)
>
> u_plane_at_lat2d = a->XLAT(0,:,:) ; do you need XLAT_U, or XLAT?
> u_plane_at_lon2d = a->XLONG(0,:,:) ; do you need XLONG_U, or XLONG?
> v_plane_at_lat2d = a->XLAT(0,:,:) ; do you need XLAT_V, or XLAT?
> v_plane_at_lon2d = a->XLONG(0,:,:) ; do you need XLONG_V, or XLONG?
>
> ;;;;;;;;;;;;;;;;;;;;; Create Map background
> wks = gsn_open_wks("x11","WRF-panel-1")
> plot = new(3,graphic)
>
> mpres = True ; Create map background
>
> ;mpres_at_gsnMaximize = True
>
> mpres_at_gsnDraw = False ; don't draw
> mpres_at_gsnFrame = False ; don't advance frame
> mpres_at_cnInfoLabelOn = False ; turn off cn info label
>
> ;mpres_at_tiMainString = "WRF 700mb Streamlines" ; some title
> mpres_at_gsnCenterString = date
> mpres_at_mpOutlineOn = True
> mpres_at_mpGeophysicalLineColor = "Black"
> mpres_at_mpGeophysicalLineThicknessF = "3.0"
> mpres_at_mpGridLineColor = "Black"
> mpres_at_mpLimbLineColor = "Black"
> mpres_at_mpNationalLineColor = "Black"
> mpres_at_mpPerimLineColor = "Black"
> ;mpres_at_mpFillOn = False ; turn off gray map
> mpres_at_gsnAddCyclic = False ; NEED for
> subregion plotting
> ;;;;;;;;;;;;;;;;;;;;; If you want whole world, comment out regional
> specification below
> mpres_at_mpMinLatF = latS
> mpres_at_mpMaxLatF = latN
> mpres_at_mpMinLonF = lonW
> mpres_at_mpMaxLonF = lonE
>
> ;Creat plots
> plot(0) = gsn_csm_contour_map_ce(wks,u_plane,mpres)
> plot(1) = gsn_csm_contour_map_ce(wks,v_plane,mpres)
>
> mpres_at_gsnLeftString = "700mb U,V, Streamlines"
> delete(mpres_at_cnInfoLabelOn)
> printVarSummary(u_plane)
> plot(3) = gsn_csm_streamline_map(wks,u_plane,v_plane,mpres)
> ;************************************************
> ; create panel
> ;************************************************
> gsn_panel(wks,plot,(/3,1/),False) ; now draw as one plot
> end do
> end
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Oct 24 2007 - 16:22:25 MDT

This archive was generated by hypermail 2.2.0 : Fri Oct 26 2007 - 09:29:31 MDT