print .txt files with all my data in columns [message #88632] |
Thu, 22 May 2014 01:22  |
carolinaperpina
Messages: 5 Registered: May 2014
|
Junior Member |
|
|
Hi all,
I am quite new using IDL and I would like to merge different arrays just in one .txt file.
I wrote at the begging of my code:
CLC_CAPRIfile1990 = odir + country + '_1990_CLC_CAPRI.txt'
openw, 4, CLC_CAPRIfile1990
**first array [21,3]
capri_clc1990 = [[long(arableCLC90s)], [long(arableCAPRI1990s)],[long(PC_CLC90s)]
***second array [21,3]
capri_clc2000 = [[long(arableCLC00s)], [long(arableCAPRI2000s)],[long(PC_CLC00s)]
I would like to print an array of [42,3], that's mean that the merging should be in columns (I can accepted also in rows).
printf, 4, ******I don not how to do this print.
Thank you very much in advance.
Regards,
Carolina
|
|
|
Re: print .txt files with all my data in columns [message #88633 is a reply to message #88632] |
Thu, 22 May 2014 01:40   |
Fabzi
Messages: 305 Registered: July 2010
|
Senior Member |
|
|
Hi Carolina,
maybe is write_csv something for you?
http://www.exelisvis.com/docs/WRITE_CSV.html
On 22.05.2014 10:22, carolinaperpina@gmail.com wrote:
> Hi all,
>
> I am quite new using IDL and I would like to merge different arrays just in one .txt file.
>
> I wrote at the begging of my code:
>
> CLC_CAPRIfile1990 = odir + country + '_1990_CLC_CAPRI.txt'
> openw, 4, CLC_CAPRIfile1990
>
>
> **first array [21,3]
> capri_clc1990 = [[long(arableCLC90s)], [long(arableCAPRI1990s)],[long(PC_CLC90s)]
>
> ***second array [21,3]
> capri_clc2000 = [[long(arableCLC00s)], [long(arableCAPRI2000s)],[long(PC_CLC00s)]
>
> I would like to print an array of [42,3], that's mean that the merging should be in columns (I can accepted also in rows).
>
>
> printf, 4, ******I don not how to do this print.
>
>
> Thank you very much in advance.
> Regards,
> Carolina
>
|
|
|
Re: print .txt files with all my data in columns [message #88634 is a reply to message #88632] |
Thu, 22 May 2014 01:51   |
carolinaperpina
Messages: 5 Registered: May 2014
|
Junior Member |
|
|
On Thursday, May 22, 2014 10:22:22 AM UTC+2, carolin...@gmail.com wrote:
> Hi all,
>
>
>
> I am quite new using IDL and I would like to merge different arrays just in one .txt file.
>
>
>
> I wrote at the begging of my code:
>
>
>
> CLC_CAPRIfile1990 = odir + country + '_1990_CLC_CAPRI.txt'
>
> openw, 4, CLC_CAPRIfile1990
>
>
>
>
>
> **first array [21,3]
>
> capri_clc1990 = [[long(arableCLC90s)], [long(arableCAPRI1990s)],[long(PC_CLC90s)]
>
>
>
> ***second array [21,3]
>
> capri_clc2000 = [[long(arableCLC00s)], [long(arableCAPRI2000s)],[long(PC_CLC00s)]
>
>
>
> I would like to print an array of [42,3], that's mean that the merging should be in columns (I can accepted also in rows).
>
>
>
>
>
> printf, 4, ******I don not how to do this print.
>
>
>
>
>
> Thank you very much in advance.
>
> Regards,
>
> Carolina
Hi Fabien,
First of all, thank you very much for replying me.
Yes, I thought at the beginning to use write_csv but I do not how to write the code, could you help me please?. It should be something like....
capri_clc1990 = [[long(arableCLC90s)], [long(arableCAPRI1990s)],[long(PC_CLC90s)]
capri_clc2000 = [[long(arableCLC00s)], [long(arableCAPRI2000s)],[long(PC_CLC00s)]
csv_CLC_CAPRI= odir + country + '_CLC_CAPRI90.csv' ***file name
write_csv, csv_CLC_CAPRI, ***** I do not what to write he...
Thank you very much.
Carolina
|
|
|
Re: print .txt files with all my data in columns [message #88635 is a reply to message #88632] |
Thu, 22 May 2014 02:00   |
carolinaperpina
Messages: 5 Registered: May 2014
|
Junior Member |
|
|
On Thursday, May 22, 2014 10:22:22 AM UTC+2, carolin...@gmail.com wrote:
> Hi all,
>
>
>
> I am quite new using IDL and I would like to merge different arrays just in one .txt file.
>
>
>
> I wrote at the begging of my code:
>
>
>
> CLC_CAPRIfile1990 = odir + country + '_1990_CLC_CAPRI.txt'
>
> openw, 4, CLC_CAPRIfile1990
>
>
>
>
>
> **first array [21,3]
>
> capri_clc1990 = [[long(arableCLC90s)], [long(arableCAPRI1990s)],[long(PC_CLC90s)]
>
>
>
> ***second array [21,3]
>
> capri_clc2000 = [[long(arableCLC00s)], [long(arableCAPRI2000s)],[long(PC_CLC00s)]
>
>
>
> I would like to print an array of [42,3], that's mean that the merging should be in columns (I can accepted also in rows).
>
>
>
>
>
> printf, 4, ******I don not how to do this print.
>
>
>
>
>
> Thank you very much in advance.
>
> Regards,
>
> Carolina
The problem is that write_csv just accept 8 columns. My data are bigger than 8, I have put just an example of it.
Thank you!
|
|
|
Re: print .txt files with all my data in columns [message #88636 is a reply to message #88635] |
Thu, 22 May 2014 02:16   |
Fabzi
Messages: 305 Registered: July 2010
|
Senior Member |
|
|
If you read the documentation you see that:
Data1 can be an IDL structure in which each field contains a vector of
data that corresponds to a separate column in the output file. The
vectors must all have the same number of elements, but can have
different data types. If Data1 is an IDL structure, all other Data
arguments are ignored.
Data1 can be a two-dimensional array in which each column in the array
corresponds to a separate column in the output file. If Data1 is a
two-dimensional array, all other Data arguments are ignored.
This allows you to have any number of columns you want
On 22.05.2014 11:00, carolinaperpina@gmail.com wrote:
> On Thursday, May 22, 2014 10:22:22 AM UTC+2, carolin...@gmail.com wrote:
>> Hi all,
>>
>>
>>
>> I am quite new using IDL and I would like to merge different arrays just in one .txt file.
>>
>>
>>
>> I wrote at the begging of my code:
>>
>>
>>
>> CLC_CAPRIfile1990 = odir + country + '_1990_CLC_CAPRI.txt'
>>
>> openw, 4, CLC_CAPRIfile1990
>>
>>
>>
>>
>>
>> **first array [21,3]
>>
>> capri_clc1990 = [[long(arableCLC90s)], [long(arableCAPRI1990s)],[long(PC_CLC90s)]
>>
>>
>>
>> ***second array [21,3]
>>
>> capri_clc2000 = [[long(arableCLC00s)], [long(arableCAPRI2000s)],[long(PC_CLC00s)]
>>
>>
>>
>> I would like to print an array of [42,3], that's mean that the merging should be in columns (I can accepted also in rows).
>>
>>
>>
>>
>>
>> printf, 4, ******I don not how to do this print.
>>
>>
>>
>>
>>
>> Thank you very much in advance.
>>
>> Regards,
>>
>> Carolina
>
> The problem is that write_csv just accept 8 columns. My data are bigger than 8, I have put just an example of it.
> Thank you!
>
|
|
|
Re: print .txt files with all my data in columns [message #88637 is a reply to message #88632] |
Thu, 22 May 2014 03:56   |
carolinaperpina
Messages: 5 Registered: May 2014
|
Junior Member |
|
|
On Thursday, May 22, 2014 10:22:22 AM UTC+2, carolin...@gmail.com wrote:
> Hi all,
>
>
>
> I am quite new using IDL and I would like to merge different arrays just in one .txt file.
>
>
>
> I wrote at the begging of my code:
>
>
>
> CLC_CAPRIfile1990 = odir + country + '_1990_CLC_CAPRI.txt'
>
> openw, 4, CLC_CAPRIfile1990
>
>
>
>
>
> **first array [21,3]
>
> capri_clc1990 = [[long(arableCLC90s)], [long(arableCAPRI1990s)],[long(PC_CLC90s)]
>
>
>
> ***second array [21,3]
>
> capri_clc2000 = [[long(arableCLC00s)], [long(arableCAPRI2000s)],[long(PC_CLC00s)]
>
>
>
> I would like to print an array of [42,3], that's mean that the merging should be in columns (I can accepted also in rows).
>
>
>
>
>
> printf, 4, ******I don not how to do this print.
>
>
>
>
>
> Thank you very much in advance.
>
> Regards,
>
> Carolina
Hi Fabien,
Thank you very much for your explanation, because I thought that was the number of columns, I got it!
So, taking into account my example, it should be...
capri_clc1990 = [[long(arableCLC90s)], [long(arableCAPRI1990s)],[long(PC_CLC90s)]
capri_clc2000 = [[long(arableCLC00s)], [long(arableCAPRI2000s)],[long(PC_CLC00s)]
csv_CLC_CAPRI= odir + country + '_CLC_CAPRI90.csv' ***file name
write_csv, csv_CLC_CAPRI, capri_clc1990,capri_clc2000
It is this correct?
Because also I was thinking to do it like this:
capri_clc1990 = [[long(arableCLC90s)], [long(arableCAPRI1990s)],[long(PC_CLC90s)]
capri_clc2000 = [[long(arableCLC00s)], [long(arableCAPRI2000s)],[long(PC_CLC00s)]
capri_1991_2000 = [[capri_clc1990],capri_clc2000]]
csv_CLC_CAPRI= odir + country + '_CLC_CAPRI90.csv' ***file name
write_csv, csv_CLC_CAPRI, capri_1991_2000
I do not know how to write it in a proper way...
Regards,
Carolina
|
|
|
|
Re: print .txt files with all my data in columns [message #88640 is a reply to message #88632] |
Thu, 22 May 2014 07:37  |
carolinaperpina
Messages: 5 Registered: May 2014
|
Junior Member |
|
|
On Thursday, May 22, 2014 10:22:22 AM UTC+2, carolin...@gmail.com wrote:
> Hi all,
>
>
>
> I am quite new using IDL and I would like to merge different arrays just in one .txt file.
>
>
>
> I wrote at the begging of my code:
>
>
>
> CLC_CAPRIfile1990 = odir + country + '_1990_CLC_CAPRI.txt'
>
> openw, 4, CLC_CAPRIfile1990
>
>
>
>
>
> **first array [21,3]
>
> capri_clc1990 = [[long(arableCLC90s)], [long(arableCAPRI1990s)],[long(PC_CLC90s)]
>
>
>
> ***second array [21,3]
>
> capri_clc2000 = [[long(arableCLC00s)], [long(arableCAPRI2000s)],[long(PC_CLC00s)]
>
>
>
> I would like to print an array of [42,3], that's mean that the merging should be in columns (I can accepted also in rows).
>
>
>
>
>
> printf, 4, ******I don not how to do this print.
>
>
>
>
>
> Thank you very much in advance.
>
> Regards,
>
> Carolina
HI fabien,
Yes,I will try it!
Again, thank you very much for your help!
Kind Regards,
Carolina
|
|
|