Re: Segmentation Fault when modifying string variables

From: Jeff <jeffelf_at_nyahnyahspammersnyahnyah>
Date: Sat Jul 31 2010 - 05:43:04 MDT

Hi Mary,

Thank you for the reply. I think the 19 is correct since the script
run well before.
I login to another node on my cluster and it works well now.
So maybe I was justing using some linux environment that is
incompatible with NCL.

Thank you.
Yaosheng

On Fri, Jul 30, 2010 at 11:19 AM, Mary Haley <haley@ucar.edu> wrote:
> Hi Jeff,
>
> Do you know exactly which line the seg fault happens on?
>
> If you comment out the main "begin" and "end" in your code (if you have them),
> and run your script with "ncl -x", this will echo every line as it is executed,
> and you will see where the seg fault occurs.
>
> I think that you might need to make "x" dimensioned 1 x 20, because there's
> a special "end-of-line" character needed when you go from a string to
> a character array.
>
> Your timestamp variables are exactly 19 characters, so see if the following helps:
>
>              x       = new((/1,20/),character)
>
> --Mary
>
> On Jul 30, 2010, at 7:20 AM, Jeff wrote:
>
>>                timestamp0       = "2001-01-01_00:00:00"
>>                timestamp       = "2001-01-01_01:00:00"
>>
>>                fin = "wrfchemi_d01_"+timestamp0
>>                fon = "wrfchemi_d01_"+timestamp
>>
>>                system("ln -sf "+fin+" "+fon)
>>
>>                x       = new((/1,19/),character)
>>                tmp             = stringtocharacter(timestamp)
>>                x(0,:)          = tmp(0:dimsizes(tmp)-2)
>>
>>                f = addfile(fon+".nc","w")
>>                f->Times = (/x/)
>>
>>                delete(timestamp)
>>                delete(timestamp0)
>>                delete(tmp)
>>                delete(x)
>> ======
>
>
Received on Sat Jul 31 05:43:17 2010

This archive was generated by hypermail 2.1.8 : Tue Aug 03 2010 - 15:09:38 MDT