<div dir="ltr">Hi:<div><br></div><div>It sounds like you've found a solution, but one should mention that a fortran write statement (using WRAPIT) is easy to format.</div><div><br></div><div>Barry</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 11, 2017 at 5:35 PM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">We could certainly do that, but the format string was set up to allow you to enter text in additional to format strings, for example:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><font face="monospace, monospace"> i = ispan( 95,105, 1)</font></div><div class="gmail_default"><font face="monospace, monospace"> j = ispan(905,1005,10)</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"> write_table("example4.txt","<wbr>w",[/i,j/],"first_%05i second_%05i")</font></div><div class="gmail_default"><span style="font-size:small"><br></span></div><div class="gmail_default"><span style="font-size:small">which gives you:</span></div><div class="gmail_default"><span style="font-size:small"><br></span></div><div class="gmail_default">first_00095 second_00905</div><div class="gmail_default">first_00096 second_00915</div><div class="gmail_default"><span style="font-size:small">. . .</span></div><div class="gmail_default"><span style="font-size:small"><br></span></div><div class="gmail_default"><span style="font-size:small">Like you said, we would have to choose which special character could be used. I suppose in the case of write_table, you </span>could use setfileoption to set or change the special character.</div><span class="HOEnZb"><font color="#888888"><div class="gmail_default"><span style="font-size:small"><br></span></div><div class="gmail_default"><span style="font-size:small">--Mary</span></div><div class="gmail_default"><span style="font-size:small"><br></span></div><div class="gmail_default"><span style="font-size:small"><br></span></div><div class="gmail_default"><span style="font-size:small"><br></span></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 10, 2017 at 2:31 PM, David Brown <span dir="ltr"><<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am wondering if we could provide a special formatting character that<br>
could be part of the format string, maybe at the beginning, and would<br>
signal that no automatic separator character be used. Of course which<br>
character to use might be an issue, but hopefully that could be<br>
solved.<br>
-dave<br>
<div class="m_7163580856492812857HOEnZb"><div class="m_7163580856492812857h5"><br>
On Thu, Aug 10, 2017 at 2:12 PM, Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>> wrote:<br>
> Fortran (some other languages too!) has the capability to provide user<br>
> specified granularity in parsing strings of numbers and characters.<br>
><br>
> fortran: format(i2,5i5)<br>
> <wbr>299999999999999999999999999999<wbr>9<br>
><br>
> The problem is someone must tell you the structure. You could read as<br>
> follows:<br>
> format(i2,i2,i3,i5,i4,i1,....<wbr>...)<br>
><br>
> However, any 'automatic' software must have some separator between the<br>
> numbers.<br>
><br>
> --<br>
> NCDC has text files the include letters, numbers, periods (76.5) all<br>
> together.<br>
><br>
> ====<br>
> fortran: format(i2,5(1x,i5))<br>
> 2 99999 99999 99999 99999 99999 99999<br>
><br>
> Just a comment<br>
> D<br>
><br>
> On Thu, Aug 10, 2017 at 12:02 PM, Rabah Hachelaf <<a href="mailto:hachelaf@sca.uqam.ca" target="_blank">hachelaf@sca.uqam.ca</a>><br>
> wrote:<br>
>><br>
>> Hi Mary and Karin,<br>
>><br>
>> Adding white-spaces by default is a limitation if we need to write some<br>
>> data using a FORTRAN format.<br>
>> We could bypass this "issue" by removing one character starting from the<br>
>> 2nd variable but we would have liked to keep the same format between FORTRAN<br>
>> and NCL<br>
>><br>
>> Regards,<br>
>><br>
>> Rabah<br>
>><br>
>> 2017-08-10 13:15 GMT-04:00 Mary Haley <<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>>:<br>
>>><br>
>>> Hi Rabah,<br>
>>><br>
>>> I see Karin already responded, and had the same response I was just about<br>
>>> to send!<br>
>>><br>
>>> I'll go ahead and include my response here. I've updated the<br>
>>> documentation to indicate this behavior, and also created a ticket just in<br>
>>> case.<br>
>>><br>
>>> Unfortunately, I think this is a "feature" of write_table. Even if<br>
>>> there's a case for declaring this a bug, we probably couldn't change the<br>
>>> behavior because we'd likely break a bunch of existing scripts that depend<br>
>>> on the space being there.<br>
>>><br>
>>> I created a ticket on this (NCL-2646), in case it's an issue for other<br>
>>> users.<br>
>>><br>
>>> Meanwhile, as Karin pointed out, I think the only way around this is to<br>
>>> concatenate the strings yourself:<br>
>>><br>
>>> int1 = 2<br>
>>> int2 = "99999"<br>
>>> int3 = "99999"<br>
>>> int4 = "99999"<br>
>>> int5 = "99999"<br>
>>> int6 = "99999"<br>
>>> int7 = "99999"<br>
>>> int_cat = int2+int3+int4+int5+int6+int7<br>
>>> sounding_check = [/int1,int_cat/]<br>
>>> write_table(outfile,"w",soundi<wbr>ng_check,"%2i%s")<br>
>>><br>
>>> In general, I would caution against writing numbers to a file without any<br>
>>> spaces, because this makes it potentially very difficult for somebody else<br>
>>> looking at the file to know how to read it. However, I do understand that<br>
>>> some of these files have historically been written this way for other<br>
>>> purposes<br>
>>><br>
>>> --Mary<br>
>>><br>
>>><br>
>>><br>
>>> On Wed, Aug 9, 2017 at 3:13 PM, Rabah Hachelaf <<a href="mailto:hachelaf@sca.uqam.ca" target="_blank">hachelaf@sca.uqam.ca</a>><br>
>>> wrote:<br>
>>>><br>
>>>><br>
>>>> Hello,<br>
>>>> I am wounding why there is a systematic white-spaces between values<br>
>>>> although they are removed from the format specifier.<br>
>>>> How can i remove white spaces from in this case.<br>
>>>><br>
>>>> Thank you<br>
>>>><br>
>>>><br>
>>>> begin<br>
>>>> outfile = "test.txt"<br>
>>>> sounding_check = [/2,"99999","99999","99999","9<wbr>9999","99999","99999"/]<br>
>>>> write_table(outfile,"a",soundi<wbr>ng_check,"%2i%s%s%s%s%s%s")<br>
>>>><br>
>>>> end<br>
>>>><br>
>>>><br>
>>>> output :<br>
>>>> 2 99999 99999 99999 99999 99999 99999<br>
>>>> --<br>
>>>> ------------------------------<br>
>>>> Best regards,<br>
>>>> Rabah Hachelaf<br>
>>>><br>
>>>><br>
>>>><br>
>>>> ______________________________<wbr>_________________<br>
>>>> ncl-talk mailing list<br>
>>>> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
>>>> List instructions, subscriber options, unsubscribe:<br>
>>>> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
>>>><br>
>>><br>
>><br>
>><br>
>><br>
>> --<br>
>> ------------------------------<br>
>> Cordialement,<br>
>> Best regards,<br>
>> Rabah Hachelaf<br>
>><br>
>> ______________________________<wbr>_________________<br>
>> ncl-talk mailing list<br>
>> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
>> List instructions, subscriber options, unsubscribe:<br>
>> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
>><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> ncl-talk mailing list<br>
> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
> List instructions, subscriber options, unsubscribe:<br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
><br>
</div></div></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US 914 432 3108<br></div></div></div>
</div>