Problems reading ASCII data [message #42078] |
Thu, 16 December 2004 09:58  |
rats
Messages: 11 Registered: June 2004
|
Junior Member |
|
|
I am trying to read in some large ASCII files. I would like to put
these columns into an array, but I am having a problem with the the 5th
column (e.g. 1/1). IDL changes this to 1.00, when I want it to be a
string "1/1" and the other ones to be formatted as double/integer.
This works well using IDL's read_ascii program, but the headers have a
+/- character that makes it 'not a valid ascii file' according to IDL.
Below is a sample of the data file.
------------------------------------------------------------ --------
X |Y |Z |I |Ret#|D±|Ed|Cla|Ang|Time
------------------------------------------------------------ --------
444997.54, 5384000.40, 278.55, 169, 1/1, 0, 0, 2, 0, 588531.995800
444999.16, 5384001.00, 278.38, 183, 1/1, 0, 0, 2, 0, 588531.995800
444997.81, 5384000.48, 294.75, 000, 1/2, 0, 0, 1, 0, 588531.996000
Is there a quick way to read these data into an array, where it will
ignore the header and each column has its own data format?
|
|
|
Re: Problems reading ASCII data [message #42138 is a reply to message #42078] |
Wed, 22 December 2004 08:51  |
NACH
Messages: 4 Registered: December 2004
|
Junior Member |
|
|
Transread.pro from Markwardt IDL Library should solve your problem.
RC
rats@mail.geog.uvic.ca wrote:
> I am trying to read in some large ASCII files. I would like to put
> these columns into an array, but I am having a problem with the the
5th
> column (e.g. 1/1). IDL changes this to 1.00, when I want it to be a
> string "1/1" and the other ones to be formatted as double/integer.
>
> This works well using IDL's read_ascii program, but the headers have
a
> +/- character that makes it 'not a valid ascii file' according to
IDL.
>
> Below is a sample of the data file.
>
>
> ------------------------------------------------------------ --------
>
> X |Y |Z |I |Ret#|D±|Ed|Cla|Ang|Time
>
> ------------------------------------------------------------ --------
>
> 444997.54, 5384000.40, 278.55, 169, 1/1, 0, 0, 2, 0, 588531.995800
>
> 444999.16, 5384001.00, 278.38, 183, 1/1, 0, 0, 2, 0, 588531.995800
>
> 444997.81, 5384000.48, 294.75, 000, 1/2, 0, 0, 1, 0, 588531.996000
>
>
> Is there a quick way to read these data into an array, where it will
> ignore the header and each column has its own data format?
|
|
|