Re: Segmentation fault

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 2 May 2008 08:17:18 -0600 (MDT)

Lin,

The problem appears to be a "running out of memory" situation. There
are lots of arrays being created to hold individual error bars, and
then several new variables created to attach each one of these error
bars to an XY plot.

I'll separately send you a modified version of your script that should
fix this memory problem.

I think there's definitely a problem at the NCL end, and I will
report this to the developers.

As a work-around, I suggest that if you need to attach a bunch of
individual polylines to a plot using "gsn_add_polyline", to do this
using one big X and Y array with missing values inserted to
distinguish between individual lines.

For example, let's say you wanted to add a bunch of horizontal lines
at Y=1,2,3,...,50, with X going from 0 to 100. (I realize this is a
bad example, but bear with me.)

Instead of calling "gsn_add_polyline" 50 times to attach each individual
line:

   X1 = (/0,100/)
   Y1 = (/1, 1/)
   L1 = gsn_add_polyline(wks,plot,X1,Y1,gres)

   X2 = (/0,100/)
   Y2 = (/2, 2/)
   L2 = gsn_add_polyline(wks,plot,X2,Y2,gres)

   .
   .
   .
   L50 = gsn_add_polyline(wks,plot,X50,Y50,gres)

you can create one big X and Y array to hold all the lines, and call
"gsn_add_polyline" once. For example:

    X = (/0,100,-999,0,100,-999,0,100,-999,..., 0,100,-999/)
    Y = (/1, 1,-999,2, 2,-999,3, 3,-999,...,50, 50,-999/)

    L = gsn_add_polyline(wks,plot,X,Y,gres)

These missing values basically cause a "pen-up", so you effectively get
individual lines.

--Mary

On Thu, 1 May 2008, Mary Haley wrote:

> Hi Lin,
>
> That would be great you could personally email me your script and
> data.
>
> By the way, and this is for everybody to know about: if you have a
> complicated NCL script that does a lot of file input and processing,
> sets a bunch of plot resources (maybe dependent on the input data),
> and then calls some gsn_csm_xxxx script at the end, then for debugging
> purposes, you can set the following resource:
>
> res_at_gsnDebugWriteFileName = "some_name"
>
> before you call the gsn_csm_xxxx plotting function.
>
> This will cause only the data that is being plotted to be written to a
> NetCDF file called "some_name.nc", and an NCL script called
> "some_name.ncl" will be generated that reads this data file, and uses
> the same resources that were used in the plotting script.
>
> This comes in handy if you just need to get the barebones script that
> reads the data, sets the resources, and generates a plot.
>
> --Mary
>
> On Thu, 1 May 2008, Lin Su wrote:
>
>> Dear NCL users,
>>
>> I am trying to add the AERONET error bar into the plot, but there is always
>> showing the following errors:
>>
>> ***************************
>> .....
>> **Warning**: PDF - coordinate out of range.
>> **Warning**: PDF - coordinate out of range.
>> **Warning**: PDF - coordinate out of range.
>> Segmentation fault
>> ************************
>>
>> Is there a better way to add the error bar to the graph? BTW, I will send
>> my ncl
>> code and data to you if you'd like to take a look at them:)
>>
>> I appreciate your great help in advance!
>>
>> Best,
>> -Lin
>> ---
>> Lin Su
>> http://atoc.colorado.edu/~sul/
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk_at_ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri May 02 2008 - 08:17:18 MDT

This archive was generated by hypermail 2.2.0 : Fri May 02 2008 - 09:27:23 MDT