comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » write_csv header problems
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
write_csv header problems [message #85743] Fri, 30 August 2013 05:39 Go to next message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
I'm trying to use write_csv and am having problems using the header keyword. It works fine if I only write one variable and have one header, but as soon as I add a second variable and a second string to the header array I get an error message that says 'HEADER must be a string array of length equal to the number of columns'. From what I can tell my string array is the same length as the number of variables I'm trying to write.

header = ['Altitudes','DEM_gnd_alt']
write_csv, 'Seac4rs_DIAL_DC8_20130808_RA_Nav.csv', alt, demgndalt, header=header

Can someone please help? Thanks.

-Morgan
Re: write_csv header problems [message #85744 is a reply to message #85743] Fri, 30 August 2013 05:43 Go to previous messageGo to next message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Hi Morgan,

On 08/30/2013 02:39 PM, Morgan Silverman wrote:
> Can someone please help? Thanks.
>
> -Morgan

The problem most likely comes from your input variables. What happens if
you do:

help, alt, demgndalt

before writing the CSV?
Re: write_csv header problems [message #85745 is a reply to message #85744] Fri, 30 August 2013 05:52 Go to previous messageGo to next message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
On Friday, August 30, 2013 8:43:42 AM UTC-4, Fabien wrote:
> Hi Morgan,
>
>
>
> On 08/30/2013 02:39 PM, Morgan Silverman wrote:
>
>> Can someone please help? Thanks.
>
>>
>
>> -Morgan
>
>
>
> The problem most likely comes from your input variables. What happens if
>
> you do:
>
>
>
> help, alt, demgndalt
>
>
>
> before writing the CSV?

This is what I get from help, alt, demgndalt

ALT FLOAT = Array[1, 678]
DEMGNDALT FLOAT = Array[2710]

I guess the problem is because alt is 2D and my other variable is only 1D. I suppose I need to make them the same size, correct? I also get the same error message though when I use two 2D variables though

O3 DOUBLE = Array[2710, 678]
SA DOUBLE = Array[2710, 678]
HEADER STRING = Array[2]

So now I'm confused again.

Thanks.
Re: write_csv header problems [message #85746 is a reply to message #85745] Fri, 30 August 2013 05:58 Go to previous messageGo to next message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Hi Morgan,

This is not very logical. Why would you write a csv file with two
columns, one with 678 values and the other with 2710?

(This with the 2D arrays as input is clear, if you give a 2d array to
CSV he will make a looooot of columns of it (see the doc))

On 08/30/2013 02:52 PM, Morgan Silverman wrote:
Re: write_csv header problems [message #85747 is a reply to message #85746] Fri, 30 August 2013 06:06 Go to previous message
morganlsilverman is currently offline  morganlsilverman
Messages: 46
Registered: February 2013
Member
On Friday, August 30, 2013 8:58:40 AM UTC-4, Fabien wrote:
> Hi Morgan,
>
>
>
> This is not very logical. Why would you write a csv file with two
>
> columns, one with 678 values and the other with 2710?
>
>
>
> (This with the 2D arrays as input is clear, if you give a 2d array to
>
> CSV he will make a looooot of columns of it (see the doc))
>
>
>
> On 08/30/2013 02:52 PM, Morgan Silverman wrote:

Sorry, my mistake. The 678 goes with the 2D array. That is the number of altitudes for the 2710 data points. I'll have to find the doc and read more. Would you suggest just using printf to output the data to csv file?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Is there a less clunky syntax for retrieving data from an array of hashes?
Next Topic: Keyword UNAME not allowed in call to: CW_FSLIDER

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:47:42 PDT 2025

Total time taken to generate the page: 0.00594 seconds