[ncl-talk] Remove white-spaces from write_table output [SEC=UNCLASSIFIED]
Karin Meier-Fleischer
meier-fleischer at dkrz.de
Thu Aug 10 01:19:48 MDT 2017
Hi Rabah,
it’s because you are writting a table and the delimiter is per default a blank.
Do you really want to write the values without a blank or colon as delimiter?
Then try to write the values as strings like
begin
outfile = "test_write_table.txt"
sounding_check = [/"2"+"99999"+"99999"+"99999"+"99999"+"99999"+"99999"/]
write_table(outfile,"a",sounding_check,"%s")
end
The output is
2999999999999999999999999999999
Bye,
Karin
> Am 10.08.2017 um 01:29 schrieb Griffith Young <griffith.young at bom.gov.au>:
>
> This is not an NCL solution but it may suit your needs or be applicable elsewhere.
>
> sed 's/ //g' infile.txt > outfile.txt
>
> It is a global find and replace of all spaces in a file.
>
> I mention this in the case where write_table() does not meet your needs.
>
> Griff.
>
> From: ncl-talk-bounces at ucar.edu <mailto:ncl-talk-bounces at ucar.edu> [mailto:ncl-talk-bounces at ucar.edu <mailto:ncl-talk-bounces at ucar.edu>] On Behalf Of Rabah Hachelaf
> Sent: Thursday, 10 August 2017 7:14 AM
> To: ncl-talk
> Subject: [ncl-talk] Remove white-spaces from write_table output
>
>
> Hello,
> I am wounding why there is a systematic white-spaces between values although they are removed from the format specifier.
> How can i remove white spaces from in this case.
>
> Thank you
>
>
> begin
> outfile = "test.txt"
> sounding_check = [/2,"99999","99999","99999","99999","99999","99999"/]
> write_table(outfile,"a",sounding_check,"%2i%s%s%s%s%s%s")
>
> end
>
>
> output :
> 2 99999 99999 99999 99999 99999 99999
> --
> ------------------------------
> Best regards,
> Rabah Hachelaf
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
____________________________________
Dipl. Geophys. Karin Meier-Fleischer
Visualisierung
Abteilung Anwendungen
Deutsches Klimarechenzentrum GmbH (DKRZ)
Bundesstrasse 45a * D-20146 Hamburg
Germany
Phone: +49 (0)40 460094 126
Fax: +49 (0)40 460094 270
E-Mail: meier-fleischer at dkrz.de
URL: http://www.dkrz.de/
Geschäftsführer: Prof. Dr. Thomas Ludwig
Sitz der Gesellschaft: Hamburg
Amtsgericht Hamburg HRB 39784
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170810/e854659c/attachment.html
More information about the ncl-talk
mailing list