Re: Bug report about function gsn_csm_xy

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Jun 21 2012 - 09:25:50 MDT

Hi Erika,

There is a bug in your code. In the second plot, you are plotting 26 sets of curves:

>> plotxy(1) = gsn_csm_xy(wks,aern2,cloudvar(0:25,:),res) ; create plot

But your "markers" array only has 25 elements. The first 25 curves are drawn with markers, and then the last one is drawn in the default, which is lines.

If you change all of your markers, markercolor, etc, arrays to be size 26 (nfiles+1), then the program works.

BTW, you don't need a "do" loop to assign values for your marker arrays. You can simply use:

markers = new((/ nfiles+1 /),string)
markers = "Markers"

--Mary

On Jun 21, 2012, at 9:08 AM, Erika Roesler wrote:

>
>
> Sent from my iPhone
>
> Begin forwarded message:
>
>> From: Erika Roesler <eroesler@gmail.com>
>> Date: June 20, 2012 4:33:14 PM MDT
>> To: ncl-talk@ucar.edu
>> Subject: Bug report about function gsn_csm_xy
>>
>> Hi,
>>
>> I am using NCAR Command Language Version 6.0.0. I am trying to make
>> a scatter plot with the function gsn_csm_xy. For the resource,
>> res@xyMarkLineModes, I would like everything to be "Markers". After a
>> certain number of points to plot, the gsn_csm_xy function begins to
>> set the resource to "Lines". I believe this to be an error. I've
>> attached a pdf illustrating this and the abbreviated code.
>>
>> Thanks for your help,
>> Erika
>>
>>
>> **********************************************************************************************************************
>> ; NCL code created 20June2012 by E.L. Roesler
>> ; Code plots 2 scatter plots. First scatter plot uses markers correctly
>> ; Second scatter plot begins to use lines instead of markers.
>> ; Shows possible bug or threshold in NCL
>> ; Email responses to eroesler@gmail.com
>>
>>
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>
>> begin
>>
>>
>> ;************************************************
>> ; Generate Data for Plot
>> ;************************************************
>>
>> nfiles = 25
>> day = (118.5-117.5)/144
>> t0 = ispan(0,143,1)*day + 117.5
>> cldtopz = generate_2d_array(20,20,10.,100.,0,(/nfiles,dimsizes(t0)/))
>>
>> aern2 = new(25, float)
>> aern2 = (/29.82463507,78.90554375,60.03144278,82.93874791,65.77869368,77.64522267,6.793000507,42.43320029,0.23443441,22.67207765,74.44087366,55.69172796,35.47657784,14.54660133,50.39626142,39.25904904,70.1
>> 5706821,32.7518686,8.31102855,53.75756526,12.86539852,44.21802448,24.55240888,61.578157,20.03611486/)
>>
>>
>>
>> ;************************************************
>> ; Create XY Scatter Plot
>> ;************************************************
>>
>>
>> wks = gsn_open_wks ("ps","ELRoesler_xy_bug") ; open workstation
>> gsn_define_colormap(wks,"gui_default") ; Define a new color map.
>>
>> plotxy = new(2,graphic)
>>
>> res = True ; resources for "left" variable
>> res@gsnDraw = False
>> res@gsnFrame = False
>>
>>
>> markers = new((/ nfiles /),string)
>> markerscolor = new((/ nfiles /),string)
>> markerstype = new((/ nfiles /),string)
>> markerssize = new((/ nfiles /),string)
>> do h=0,nfiles-1
>> markers(h) = "Markers"
>> markerscolor(h) = "black"
>> markerstype(h) = 16
>> markerssize(h) = 0.01
>> end do
>>
>> res@xyMarkLineModes = markers ; choose which have markers
>> res@xyMarkers = markerstype ; choose type of marker
>> res@xyMarkerColor = markerscolor ; Marker color
>>
>> cloudvar = transpose(cldtopz)
>>
>>
>>
>> ;********* BUG HERE NOTICE THE DIFFERENCE IN PLOTXY!!!!!
>> ********************
>> res@tiXAxisString = "Scatter plot uses markers correctly."
>> plotxy(0) = gsn_csm_xy(wks,aern2,cloudvar(0:24,:),res) ; create plot
>>
>> ;********* BUG HERE NOTICE THE DIFFERENCE IN PLOTXY!!!!!
>> ********************
>> res@tiXAxisString = "Scatter plot uses markers then inexplicably
>> begins to draw lines. ~C~ This is incorrect
>> and maybe a bug."
>> plotxy(1) = gsn_csm_xy(wks,aern2,cloudvar(0:25,:),res) ; create plot
>>
>>
>> ;************************************************
>> ; Create panel
>> ;************************************************
>>
>> resp = True
>> resp@txString = "E.L Roesler needs help with this NCL bug. ~C~
>> Please respond to eroesler@gmail.com ~C~ ~C~"
>> resp@gsnMaximize = True ; use full page
>> resp@gsnPaperOrientation = "landscape"
>> resp@gsnPanelYWhiteSpacePercent = 5 ; draw panel with white space added
>> resp@gsnPanelXWhiteSpacePercent = 5
>>
>> gsn_panel(wks,(plotxy),(/2,1/),resp)
>>
>> frame(wks) ; advance the frame
>>
>>
>> end
> <ELRoesler_xy_bug.pdf>
> _______________________________________________
> 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 Thu Jun 21 09:25:58 2012

This archive was generated by hypermail 2.1.8 : Mon Jun 25 2012 - 09:57:23 MDT