Re: write_table

From: virginie hergault <virginie.hergault_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 09 2012 - 10:48:43 MDT

Hi users,

I have some problems with str_write.
To understand what happened, I just modified the example (I put alist
= [/b, a, c, d, f/] instead of alist = [/a, b, c, d, f/]):

a = (/111, 222, 333, 444/)
 b = (/1.1, 2.2, 3.3/)
 c = (/"a", "b", "c"/)
 d = (/11h, 22h/)
 f = (/11l, 22l, 33l, 44l, 55l, 66l/)

 alist = [/b, a, c, d, f/]
 header = (/"--------------------------------", \
            "This is a file header", \
            "--------------------------------"/)
 footer = (/"--------------------------------", \
            "This is a file footer", \
            "--------------------------------"/)

 hlist = [/header/]
 flist = [/footer/]

 str_write("list.txt", "w", hlist, "%s ")
 str_write("list.txt", "a", alist, "%16.2f%d%s%d%ld")
 str_write("list.txt", "a", flist, "%s ")

Which produce:

--------------------------------
This is a file header
--------------------------------
            1.10111a1111
             2.20 222 b 22 22
             3.30 333 c
        33
                                444
           44

             55

             66
--------------------------------
This is a file footer
--------------------------------

What's wrong with the first line??

Thank you,
Virginie

2012/10/8, Wei Huang <huangwei@ucar.edu>:
> Virginie,
>
> Actually, with a little trick, you can make the header left alignment.
> Like this example:
>
> a = (/111, 222, 333, 444/)
> b = (/1.1, 2.2, 3.3/)
> c = (/"a", "b", "c"/)
> d = (/11h, 22h/)
> f = (/11l, 22l, 33l, 44l, 55l, 66l/)
>
> alist = [/a, b, c, d, f/]
>
> header = (/"--------------------------------", \
> "This is a file header", \
> "--------------------------------"/)
> footer = (/"--------------------------------", \
> "This is a file footer", \
> "--------------------------------"/)
>
> hlist = [/header/]
> flist = [/footer/]
>
> str_write("list.txt", "w", hlist, "%s ")
> str_write("list.txt", "a", alist, "%d%16.2f%s%d%ld")
> str_write("list.txt", "a", flist, "%s ")
> Which will produce:
> --------------------------------
> This is a file header
> --------------------------------
> 111, 1.10,a,11,11
> 222, 2.20,b,22,22
> 333, 3.30,c, ,33
> 444, , , ,44
> , , , ,55
> , , , ,66
> --------------------------------
> This is a file footer
> --------------------------------
>
> The trick is to put an extra space in the header format between 's' and
> '"'.
>
> Sorry for the confusion.
>
> Wei
>
> huangwei@ucar.edu
> VETS/CISL
> National Center for Atmospheric Research
> P.O. Box 3000 (1850 Table Mesa Dr.)
> Boulder, CO 80307-3000 USA
> (303) 497-8924
>
>
>
>
>
>
> On Oct 8, 2012, at 8:05 AM, Wei Huang wrote:
>
>> Virginie,
>>
>> Right now, NCL can only make the header right alignment.
>>
>> Wei
>>
>> huangwei@ucar.edu
>> VETS/CISL
>> National Center for Atmospheric Research
>> P.O. Box 3000 (1850 Table Mesa Dr.)
>> Boulder, CO 80307-3000 USA
>> (303) 497-8924
>>
>>
>>
>>
>>
>>
>> On Oct 8, 2012, at 6:50 AM, virginie hergault wrote:
>>
>>> Hi users,
>>>
>>> I use the function str_write and I would like to know how to line up
>>> the header with left alignment.
>>>
>>> Thank you,
>>> Virginie
>>>
>>> 2012/10/5, David Brown <dbrown@ucar.edu>:
>>>> Hi Virginie,
>>>> According to Wei's earlier message, in 6.1.0-beta this routine is
>>>> called
>>>> str_write. It is going to be changed to write_table for the 6.1.0
>>>> release.
>>>> Try str_write.
>>>> -dave
>>>>
>>>>
>>>> On Oct 5, 2012, at 12:00 PM, virginie hergault wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I would like to use the function "write_table", that's why I installed
>>>>> the version 6.1.0-beta of NCL.
>>>>> But when I try to use it, I have the error:
>>>>>
>>>>> fatal:syntax error: possibly an undefined procedure
>>>>>
>>>>> Is it possible to use this function with the version 6.1.0-beta of
>>>>> NCL?
>>>>>
>>>>> Thank you for your answer,
>>>>>
>>>>> Virginie
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>
>> _______________________________________________
>> 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 Tue Oct 9 10:49:11 2012

This archive was generated by hypermail 2.1.8 : Fri Oct 12 2012 - 15:38:19 MDT