[ncl-talk] Handing of file paths own write_table()

Rick Brownrigg brownrig at ucar.edu
Tue Feb 20 10:30:48 MST 2018


Hi Will,

Yes, the behavior you describe is easily duplicated. I've filed a bug
ticket, NCL-2722, and will look into it. Hopeful nothing difficult to take
care of.

Rick

On Mon, Feb 19, 2018 at 9:51 PM, Rick Brownrigg <brownrig at ucar.edu> wrote:

> Hi Will,
>
> That's an "interesting" little bit of behaviour, and I will see if I can't
> duplicate it first thing in the morning and get back to you.
>
> Thanks for reporting...
> Rick
>
> On Mon, Feb 19, 2018 at 3:22 PM, Will Hobbs <will.hobbs at utas.edu.au>
> wrote:
>
>> Hi all
>>
>>
>>
>> Looking for some input on a slightly annoying feature of the
>> write_table() function (well, it was annoying when I couldn’t figure it out)
>>
>>
>>
>> The following bit of code runs just fine as written. However, change diro
>> = “~/” and I get a Segmentation fault. I assume (but don’t know) this is
>> because my HLUres has the tilde set for use with function codes in strings,
>> but I’ve not had the same issue with filepaths in any other NCL I/O
>> function (e.g. asciiwrite(), addfile() ). Indeed,  the asciiwrite()
>> statement in the snippet below works fine with the tilde, it only fails
>> with the write_table() statement.
>>
>>
>>
>> Will
>>
>>
>>
>> begin
>>
>>
>>
>> diro = “/Users/whobbs/” <i.e. your home directory>
>>
>>   filo = "foo.csv"
>>
>>
>>
>>
>>
>>   model = "random_model"
>>
>>   expt  = "random_expt_name"
>>
>>   Dbnd  = (/1025.23,1026.39,1026.99,1027.82/)
>>
>>
>>
>>
>>
>> if (.not.fileexists(diro+filo)) then
>>
>>    asciiwrite(diro+filo, "model,expt,SAMW_upper,SAMW_IW, IW_CDW,CDW_BW")
>>
>> end if
>>
>>
>>
>> oList = [/model, expt, str_join(sprintf("%6.2f",Dbnd),",") /]
>>
>> write_table(diro+filo, "a", oList, "%s,%s,%s")
>>
>>
>>
>>
>>
>> end
>>
>>
>>
>> University of Tasmania Electronic Communications Policy (December, 2014).
>> This email is confidential, and is for the intended recipient only.
>> Access, disclosure, copying, distribution, or reliance on any of it by
>> anyone outside the intended recipient organisation is prohibited and may be
>> a criminal offence. Please delete if obtained in error and email
>> confirmation to the sender. The views expressed in this email are not
>> necessarily the views of the University of Tasmania, unless clearly
>> intended otherwise.
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180220/528472a8/attachment.html>


More information about the ncl-talk mailing list