[ncl-talk] VB: write_table problem

Wei Huang huangwei at ucar.edu
Tue Sep 23 07:33:18 MDT 2014


Elin,

First, it is better to use write_matrix, rather than write_table, as the
later is more for a mixed type of data.
http://www.ncl.ucar.edu/Document/Functions/Built-in/write_matrix.shtml

Secondly, the index in your list create is wrong, you'd better use:
ListPush(dlist45,(/tslice45(j,:)/))

Then your loop index could be wrong as well, but could not see from this
short script snap.

Regards,

Wei

================================================
1850 Table Mesa Dr.
Boulder, CO 80307
Phone: 303-497-8924

On Tue, Sep 23, 2014 at 1:47 AM, Sjökvist Elin <elin.sjokvist at smhi.se>
wrote:

>  Hi,
>
> I’m trying to print data to an ascii file using the write_table function.
>
> My data is a 19x12 matrix (tslice45) that I use to create a list, then
> trying to write:
>
>
>
> dlist45 = NewList("lifo")
>
> do j=0,nr_columns-1
>
>         ListPush(dlist45,(/tslice45(:,j)/))
>
> end do
>
>
>
>
> format_string="%4.2f%4.2f%4.2f%4.2f%4.2f%4.2f%4.2f%4.2f%4.2f%4.2f%4.2f%4.2f"
>
> write_table(filename,"w",dlist45,format_string)
>
>
>
> I get a file with what seems to be correct output data, but when looking
> closer some values are wrong and some values are completely missing! This I
> found out by printing the tslice45 matrix just before creating the list and
> comparing with the output. The errors seem to occur randomly.
>
> I have tried changing the format of the data, my script uses double
> precision as standard so I  added the function doubletofloat for tslice45
> just before creating the list, but it makes no difference.
>
> What is going on?
>
> I’m using NCL v6.1.0.
>
> Thankful for all help,
> Elin
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140923/53697142/attachment.html 


More information about the ncl-talk mailing list