POV-Ray : Newsgroups : povray.off-topic : Povray reading CSV's? Server Time
28 Jul 2024 16:19:58 EDT (-0400)
  Povray reading CSV's? (Message 1 to 7 of 7)  
From: gregjohn
Subject: Povray reading CSV's?
Date: 18 Jan 2014 12:00:01
Message: <web.52dab29e8a27a4503452adce0@news.povray.org>
I work with a lot of generated CSV files.  I'm getting tired of all the mouse
clicks required to import it into Excel, and into an intelligible graph.  I'd
like to write my own povray file for graphing, perhaps one that is always
perfect in "readability" no matter what render pixel size you pick.

What's the quickest way of getting a CSV-formatted data file into povray?  (If I
have to do even a small amount of editing of the CSV by hand, it ruins the
benefit of the project.)


Post a reply to this message

From: clipka
Subject: Re: Povray reading CSV's?
Date: 18 Jan 2014 12:25:37
Message: <52dab911@news.povray.org>
Am 18.01.2014 17:58, schrieb gregjohn:
> I work with a lot of generated CSV files.  I'm getting tired of all the mouse
> clicks required to import it into Excel, and into an intelligible graph.  I'd
> like to write my own povray file for graphing, perhaps one that is always
> perfect in "readability" no matter what render pixel size you pick.
>
> What's the quickest way of getting a CSV-formatted data file into povray?  (If I
> have to do even a small amount of editing of the CSV by hand, it ruins the
> benefit of the project.)

If the CSV data doesn't happen to contain trailing commas, you're out of 
luck with official POV-Ray.

If you do have trailing commas (or can arrange to add them 
automatically, using e.g. a unix call to sed), and also know how many 
items you'll have, the fastest way is probably to populate an array with 
the data using #include, then go on from there:

   #declare MyArray = array[Rows * Columns] {
     #include "MyData.csv"
   }

If you do have trailing commas but don't know how many items to read, 
you'll probably need to resort to #read.


If you don't have trailing commas, you might want to have a look 
UberPOV's plaintext reading feature, which allows you to #read arbitrary 
ASCII files line by line.

Maybe the quickest way to proceed from there is to write the lines right 
back into a temporary file with added trailing commas, and then either 
#include that file into an array (you can determine the number of items 
by counting the lines in the previous steps) or #read it as a CSV as 
outlined above.


(P.S.: Note that on-topic posts are off-topic in p.off-topic :-P)


Post a reply to this message

From: Warp
Subject: Re: Povray reading CSV's?
Date: 18 Jan 2014 14:13:11
Message: <52dad246@news.povray.org>
gregjohn <pte### [at] yahoocom> wrote:
> I work with a lot of generated CSV files.  I'm getting tired of all the mouse
> clicks required to import it into Excel, and into an intelligible graph.

I thought Excel supports an expressive scripting language...

-- 
                                                          - Warp


Post a reply to this message

From: gregjohn
Subject: Re: Povray reading CSV's?
Date: 18 Jan 2014 15:15:01
Message: <web.52dae01a7be82f13452adce0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
>
>    #declare MyArray = array[Rows * Columns] {
>      #include "MyData.csv"
>    }
>

Okay perhaps that Rows*Columns detail is the best part of the advice, as I'm not
sure I'd've thought of it myself.


Post a reply to this message

From: Orchid Win7 v1
Subject: Re: Povray reading CSV's?
Date: 19 Jan 2014 05:21:24
Message: <52dba724$1@news.povray.org>
On 18/01/2014 07:13 PM, Warp wrote:
> gregjohn<pte### [at] yahoocom>  wrote:
>> I work with a lot of generated CSV files.  I'm getting tired of all the mouse
>> clicks required to import it into Excel, and into an intelligible graph.
>
> I thought Excel supports an expressive scripting language...

Well, it supports VisualBasic for Applications. Not sure I'd call that 
"expressive"...


Post a reply to this message

From: gregjohn
Subject: Re: Povray reading CSV's?
Date: 4 Feb 2014 14:00:01
Message: <web.52f137b57be82f140d56c170@news.povray.org>
"gregjohn" <pte### [at] yahoocom> wrote:
> I work with a lot of generated CSV files.  I'm getting tired of all the mouse
> clicks required to import it into Excel, and into an intelligible graph.  I'd
> like to write my own povray file for graphing, perhaps one that is always
> perfect in "readability" no matter what render pixel size you pick.
>
> What's the quickest way of getting a CSV-formatted data file into povray?  (If I
> have to do even a small amount of editing of the CSV by hand, it ruins the
> benefit of the project.)

Oh my, upon seeing a corporate directive to use Apache OpenOffice, I tried to
use Calc to import my CSV.

It interpreted
-3.5308E-07

as
'-3.5308E-07


Post a reply to this message

From: Francois Labreque
Subject: Re: Povray reading CSV's?
Date: 5 Feb 2014 09:46:14
Message: <52f24eb6$1@news.povray.org>

> "gregjohn" <pte### [at] yahoocom> wrote:
>> I work with a lot of generated CSV files.  I'm getting tired of all the mouse
>> clicks required to import it into Excel, and into an intelligible graph.  I'd
>> like to write my own povray file for graphing, perhaps one that is always
>> perfect in "readability" no matter what render pixel size you pick.
>>
>> What's the quickest way of getting a CSV-formatted data file into povray?  (If I
>> have to do even a small amount of editing of the CSV by hand, it ruins the
>> benefit of the project.)
>
> Oh my, upon seeing a corporate directive to use Apache OpenOffice, I tried to
> use Calc to import my CSV.
>
> It interpreted
> -3.5308E-07
>
> as
> '-3.5308E-07

IIRC, when you open the CSV in AOO, there's an option to "detect special 
numbers" (or something similar) that will make it treat scitentific 
notations as numbers and not text.


-- 
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/*    flabreque    */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/*        @        */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/*   gmail.com     */}camera{orthographic location<6,1.25,-6>look_at a }


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.