[ncl-talk] CSV Data Spacing

Michelle Serino mmserino at tamu.edu
Fri Nov 4 14:38:58 MDT 2016


Hi Rick,

Thanks for getting back to me so quickly.  I see now that I was incorrect
in thinking the line  header = [/str_join(fields," ")/]  specified the
delimiter type, and I did not realize that it is defined when I actually
write the data to the file.  What I currently have is
write_table(n+"Analysis13_"+lat(n)+"_"+lon(n)+"_"+itime+".csv",
"a", data, "%g%g%g%g%g%g%g"), which I now understand is the default
spacing.  So following what you said, if I wanted a space delimiter, for
example, that line of code would look like
write_table(n+"Analysis13_"+lat(n)+"_"+lon(n)+"_"+itime+".csv",
"a", data, "%g %g %g %g %g %g %g").

Thank you for the clarification!

Michelle M. Serino
M.S. Candidate
Texas A&M University
Atmospheric Sciences Dept.
Eller O&M, Suite 1017
College Station, TX 77843
(484) 769-0949

On Fri, Nov 4, 2016 at 3:05 PM, Rick Brownrigg <brownrig at ucar.edu> wrote:

> Hi Michelle,
>
> I'm not sure what the question is.  The output is consistent with the
> documented behavior of write_table -- which states that if no explicit with
> is given in the format codes, then the "default" behavior results (hence,
> the variable-length, per-variable, per-value widths).  If you want nice
> tabular output, use explicit widths.  On the other hand, "CSV" means
> comma-separated:  if you want commas in the output, change you format to
> look something like "%g,%g,%g,%g,%g,%g,%g"
>
> Hope that helps...
> Rick
>
>
> On Fri, Nov 4, 2016 at 1:31 PM, Michelle Serino <mmserino at tamu.edu> wrote:
>
>> Good afternoon everyone,
>>
>>
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A___&d=CwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=axzYETCU2Q6BwUQ0oChDwWUa0fCFFhoM2SO1K3AgTeA&m=rJtiU3x52zJMZM59kkWVY7lLmbe1rG_fgGfOxnlq69I&s=YXaCbla295JlfeVTJsRqepoL7bkPAI80ZaDshCYXfNA&e=>
>> I have code (attached) that creates soundings from RUC data (data
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__drive.google.com_file_d_0B0VUa1xUjt5GaUVkMFd5MlgxWGM_view-3Fusp-3Dsharing&d=CwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=axzYETCU2Q6BwUQ0oChDwWUa0fCFFhoM2SO1K3AgTeA&m=rJtiU3x52zJMZM59kkWVY7lLmbe1rG_fgGfOxnlq69I&s=F0_4G8-QMxqAlJfNUy_6XJDBhIlcbBXnzcNl0Ey90Vg&e=>)
>> and writes that data to csv files.  The delimiter is a single space, but
>> when looking at the csv file (screen shot attached), the spacing is not
>> consistent.  It appears that this is due to simply the size of the numbers
>> in other columns, but it seems to be affecting other code I have that reads
>> this file.  The only place the delimiter is specified is on line 116 of my
>> code, and below that is where I write the data to the file.  I do not
>> currently have direct access to my code, so I hope the format I provided is
>> easily executable.  I appreciate the help.
>>
>> Thank you,
>>
>> Michelle Serino
>>
>> Michelle M. Serino
>> M.S. Candidate
>> Texas A&M University
>> Atmospheric Sciences Dept.
>> Eller O&M, Suite 1017
>> College Station, TX 77843
>> (484) 769-0949
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.ucar.edu_mailman_listinfo_ncl-2Dtalk&d=CwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=axzYETCU2Q6BwUQ0oChDwWUa0fCFFhoM2SO1K3AgTeA&m=rJtiU3x52zJMZM59kkWVY7lLmbe1rG_fgGfOxnlq69I&s=y6HXtjuOWb8_CMCUgwHnhgHQjR0PkwY8Wc7DiKbqvHg&e=>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161104/9761c6be/attachment.html 


More information about the ncl-talk mailing list