write_csv header problems [message #85743] |
Fri, 30 August 2013 05:39  |
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 #85745 is a reply to message #85744] |
Fri, 30 August 2013 05:52   |
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 #85747 is a reply to message #85746] |
Fri, 30 August 2013 06:06  |
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?
|
|
|