<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","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><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></div><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="HOEnZb"><div class="h5"><br>
On Thu, Aug 10, 2017 at 2:12 PM, Dennis Shea <<a href="mailto:shea@ucar.edu">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>
> 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">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">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",<wbr>sounding_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">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","<wbr>99999","99999","99999"/]<br>
>>>> write_table(outfile,"a",<wbr>sounding_check,"%2i%s%s%s%s%s%<wbr>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">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>
>>><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">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>
><br>
><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>
</div></div></blockquote></div><br></div>