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

Home » Public Forums » archive » data with number of columns variables
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
data with number of columns variables [message #90507] Thu, 05 March 2015 10:11 Go to next message
lucesmm is currently offline  lucesmm
Messages: 26
Registered: October 2014
Junior Member
Hello
I have a set of data like this
The rows can have 3, 7 8,or 9 columns. and they don't repeat in any particular order.

I want to obtain different arrays depending on the first element of the row
any ideas?

header
header
1500.0 1.0 2.0
3000.0 1.0 40.0 3.0 212.0 0.0 0.0
10.3 7.9 -2.4 -0.6 -0.8 0.1 10.0 1.0 0.0
3000.0 2.0 48.0 139.0 3.0 122.0 6.0 0.0
5.7 2.5 -1.6 -0.6 -0.8 0.1 10.0 1.0 0.0
5000.0 6.0 78000.0 1.0 3.0 115.0 5.0 1.0
3.9 0.3 -0.5 -0.5 -0.2 0.8 1.2 1.0 0.0
2011.0 6.0 2.0 21.0 3.0 115.0 5.0 1034.0
3.9 0.3 -0.5 -0.8 -0.2 -0.5 0.0 1.0 0.0
5000.0 17.0 78000.0 3.0 3.0 123.0 5.0 4.0
5.0 0.5 1.3 -1.0 -0.1 0.3 0.3 1.0 0.0
2011.0 17.0 2.0 23.0 3.0 123.0 5.0 1005.0
5.0 0.5 1.3 -1.0 0.2 -0.1 0.0 1.0 0.0
5000.0 19.0 78000.0 3.0 3.0 123.0 5.0 2.0
5.0 0.5 1.3 0.3 0.0 -1.0 0.0 1.0 0.0
2014.0 19.0 2.0 25.0 3.0 123.0 5.0 485.0
5.0 0.5 1.3 0.5 -0.6 0.6 0.0 1.0 0.0
1635.0 1.0 3.0
3000.0 1.0 40.0 3.0 212.0 0.0 0.0
7.3 9.8 2.5 -0.2 -0.9 -0.4 10.0 1.0 0.0
3000.0 2.0 48.0 155.0 3.0 122.0 6.0 0.0
5.6 2.5 -0.4 -0.2 -0.9 -0.4 10.0 1.0 0.0
3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.0 3.0 108.0 5.0 648.0
1.7 0.7 0.5 0.4 -0.7 0.6 0.0 1.0 0.0
Re: data with number of columns variables [message #90509 is a reply to message #90507] Thu, 05 March 2015 10:26 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
lucesmm@gmail.com writes:

> I have a set of data like this
> The rows can have 3, 7 8,or 9 columns. and they don't repeat in any particular order.
>
> I want to obtain different arrays depending on the first element of the row
> any ideas?

Shoot the guy who created the dataset and start over!

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: data with number of columns variables [message #90511 is a reply to message #90507] Thu, 05 March 2015 10:55 Go to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den torsdag 5 mars 2015 kl. 19:12:00 UTC+1 skrev luc...@gmail.com:
> Hello
> I have a set of data like this
> The rows can have 3, 7 8,or 9 columns. and they don't repeat in any particular order.
>
> I want to obtain different arrays depending on the first element of the row
> any ideas?
>
> header
> header
> 1500.0 1.0 2.0
> 3000.0 1.0 40.0 3.0 212.0 0.0 0.0
> 10.3 7.9 -2.4 -0.6 -0.8 0.1 10.0 1.0 0.0
> 3000.0 2.0 48.0 139.0 3.0 122.0 6.0 0.0
> 5.7 2.5 -1.6 -0.6 -0.8 0.1 10.0 1.0 0.0
> 5000.0 6.0 78000.0 1.0 3.0 115.0 5.0 1.0
> 3.9 0.3 -0.5 -0.5 -0.2 0.8 1.2 1.0 0.0
> 2011.0 6.0 2.0 21.0 3.0 115.0 5.0 1034.0
> 3.9 0.3 -0.5 -0.8 -0.2 -0.5 0.0 1.0 0.0
> 5000.0 17.0 78000.0 3.0 3.0 123.0 5.0 4.0
> 5.0 0.5 1.3 -1.0 -0.1 0.3 0.3 1.0 0.0
> 2011.0 17.0 2.0 23.0 3.0 123.0 5.0 1005.0
> 5.0 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-0.1 0.0 1.0 0.0
> 5000.0 5.0 78000.0 3.0 3.0 108.0 5.0 1.0
> 1.7 0.7 0.6 0.3 -0.9 0.2 0.0 1.0 0.0
> 2011.0 5.0 2.0 7.0 3.0 108.0 5.0 144.0
> 1.7 0.7 0.6 0.0 -1.0 0.1 0.0 1.0 0.0
> 5000.0 5.0 78000.0 3.0 3.0 108.0 5.0 1.0
> 1.7 0.7 0.5 -0.1 0.6 0.8 0.2 1.0 0.0
> 2011.0 5.0 2.0 9.0 3.0 108.0 5.0 909.0
> 1.7 0.7 0.5 -0.1 -0.7 0.7 0.0 1.0 0.0
> 5000.0 5.0 78000.0 3.0 3.0 108.0 5.0 1.0
> 1.7 0.7 0.5 0.5 -0.6 0.6 0.0 1.0 0.0
> 2011.0 5.0 2.0 11.0 3.0 108.0 5.0 648.0
> 1.7 0.7 0.5 0.4 -0.7 0.6 0.0 1.0 0.0

Since alĺ the items are of the same kind (floats), I think the following might work:

* Make a template with ascii_template based on the rows with the largest number of columns, specify NaNs for missing data.
* Read the file with read_ascii using this template
* The three-column rows are the ones with NaN in the fourth column.
* The seven-column rows are the ones with NaN in the eighth column but not in the fourth.
* Similar tests for eight-column and nine-column rows.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Objects in ENVI ROI files
Next Topic: ImageMagick option not showing up in Coyote Graphics window

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

Current Time: Wed Oct 08 13:49:30 PDT 2025

Total time taken to generate the page: 0.00597 seconds