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

Home » Public Forums » archive » filtering data data in .txt
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
filtering data data in .txt [message #92985] Tue, 05 April 2016 07:12 Go to next message
omar ali is currently offline  omar ali
Messages: 13
Registered: December 2015
Junior Member
Hi,
I need to filter out the the rows having -9.999 values from the following data. I read the text file with opnr command but unfortunately, date and time are gone.

Example of the file is below:

9/20/2007 10:00:00 1.88
9/20/2007 11:00:00 1.88
9/20/2007 12:00:00 1.88
9/20/2007 13:00:00 1.88
9/20/2007 14:00:00 1.88
9/20/2007 15:00:00 1.88
9/20/2007 16:00:00 1.86
9/20/2007 17:00:00 1.86
9/20/2007 18:00:00 1.83
9/20/2007 19:00:00 -9.999
9/20/2007 20:00:00 -9.999
9/20/2007 21:00:00 -9.999
9/20/2007 22:00:00 -9.999
9/20/2007 23:00:00 -9.999
9/21/2007 0:00:00 -9.999
9/21/2007 1:00:00 -9.999
9/21/2007 2:00:00 -9.999
9/21/2007 3:00:00 -9.999
9/21/2007 4:00:00 -9.999
9/21/2007 5:00:00 -9.999
9/21/2007 6:00:00 -9.999
9/21/2007 7:00:00 -9.999
9/21/2007 8:00:00 -9.999
9/21/2007 9:00:00 -9.999
9/21/2007 10:00:00 1.81
9/21/2007 11:00:00 1.81
9/21/2007 12:00:00 1.81
9/21/2007 13:00:00 1.83
9/21/2007 14:00:00 1.83
Re: filtering data data in .txt [message #92988 is a reply to message #92985] Tue, 05 April 2016 07:21 Go to previous messageGo to next message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Tuesday, April 5, 2016 at 10:12:24 AM UTC-4, omar ali wrote:
> Hi,
> I need to filter out the the rows having -9.999 values from the following data. I read the text file with opnr command but unfortunately, date and time are gone.
>
> Example of the file is below:
>
> 9/20/2007 10:00:00 1.88
> 9/20/2007 11:00:00 1.88
> 9/20/2007 12:00:00 1.88
> 9/20/2007 13:00:00 1.88
> 9/20/2007 14:00:00 1.88
> 9/20/2007 15:00:00 1.88
> 9/20/2007 16:00:00 1.86
> 9/20/2007 17:00:00 1.86
> 9/20/2007 18:00:00 1.83
> 9/20/2007 19:00:00 -9.999
> 9/20/2007 20:00:00 -9.999
> 9/20/2007 21:00:00 -9.999
> 9/20/2007 22:00:00 -9.999
> 9/20/2007 23:00:00 -9.999
> 9/21/2007 0:00:00 -9.999
> 9/21/2007 1:00:00 -9.999
> 9/21/2007 2:00:00 -9.999
> 9/21/2007 3:00:00 -9.999
> 9/21/2007 4:00:00 -9.999
> 9/21/2007 5:00:00 -9.999
> 9/21/2007 6:00:00 -9.999
> 9/21/2007 7:00:00 -9.999
> 9/21/2007 8:00:00 -9.999
> 9/21/2007 9:00:00 -9.999
> 9/21/2007 10:00:00 1.81
> 9/21/2007 11:00:00 1.81
> 9/21/2007 12:00:00 1.81
> 9/21/2007 13:00:00 1.83
> 9/21/2007 14:00:00 1.83

I would recommend using WHERE.

-Jeremy.
Re: filtering data data in .txt [message #92990 is a reply to message #92988] Tue, 05 April 2016 07:51 Go to previous messageGo to next message
omar ali is currently offline  omar ali
Messages: 13
Registered: December 2015
Junior Member
بتاريخ الثلاثاء، 5 أبريل، 2016 4:21:39 م UTC+2، كتب Jeremy Bailin:
> On Tuesday, April 5, 2016 at 10:12:24 AM UTC-4, omar ali wrote:
>> Hi,
>> I need to filter out the the rows having -9.999 values from the following data. I read the text file with opnr command but unfortunately, date and time are gone.
>>
>> Example of the file is below:
>>
>> 9/20/2007 10:00:00 1.88
>> 9/20/2007 11:00:00 1.88
>> 9/20/2007 12:00:00 1.88
>> 9/20/2007 13:00:00 1.88
>> 9/20/2007 14:00:00 1.88
>> 9/20/2007 15:00:00 1.88
>> 9/20/2007 16:00:00 1.86
>> 9/20/2007 17:00:00 1.86
>> 9/20/2007 18:00:00 1.83
>> 9/20/2007 19:00:00 -9.999
>> 9/20/2007 20:00:00 -9.999
>> 9/20/2007 21:00:00 -9.999
>> 9/20/2007 22:00:00 -9.999
>> 9/20/2007 23:00:00 -9.999
>> 9/21/2007 0:00:00 -9.999
>> 9/21/2007 1:00:00 -9.999
>> 9/21/2007 2:00:00 -9.999
>> 9/21/2007 3:00:00 -9.999
>> 9/21/2007 4:00:00 -9.999
>> 9/21/2007 5:00:00 -9.999
>> 9/21/2007 6:00:00 -9.999
>> 9/21/2007 7:00:00 -9.999
>> 9/21/2007 8:00:00 -9.999
>> 9/21/2007 9:00:00 -9.999
>> 9/21/2007 10:00:00 1.81
>> 9/21/2007 11:00:00 1.81
>> 9/21/2007 12:00:00 1.81
>> 9/21/2007 13:00:00 1.83
>> 9/21/2007 14:00:00 1.83
>
> I would recommend using WHERE.
>
> -Jeremy.

the problem is not using where. actually, it is the format of the first and secound columns. I do not know how to read and write such format. I usually a text with the following command which is not appropriate since it save the data into float array.

Thanks

Code for reading txt file
--------------------------
asc_org="D:\data\file.txt"
openr,8,asc_org
r_org=fltarr(1,78840) ; change based on the dimension of the txt file
readf,8,r_org
close,8
Re: filtering data data in .txt [message #92992 is a reply to message #92990] Tue, 05 April 2016 08:16 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Tuesday, April 5, 2016 at 10:51:53 AM UTC-4, omar ali wrote:
> بتاريخ الثلاثاء، 5 أبريل، 2016 4:21:39 م UTC+2، كتب Jeremy Bailin:
>> On Tuesday, April 5, 2016 at 10:12:24 AM UTC-4, omar ali wrote:
>>> Hi,
>>> I need to filter out the the rows having -9.999 values from the following data. I read the text file with opnr command but unfortunately, date and time are gone.
>>>
>>> Example of the file is below:
>>>
>>> 9/20/2007 10:00:00 1.88
>>> 9/20/2007 11:00:00 1.88
>>> 9/20/2007 12:00:00 1.88
>>> 9/20/2007 13:00:00 1.88
>>> 9/20/2007 14:00:00 1.88
>>> 9/20/2007 15:00:00 1.88
>>> 9/20/2007 16:00:00 1.86
>>> 9/20/2007 17:00:00 1.86
>>> 9/20/2007 18:00:00 1.83
>>> 9/20/2007 19:00:00 -9.999
>>> 9/20/2007 20:00:00 -9.999
>>> 9/20/2007 21:00:00 -9.999
>>> 9/20/2007 22:00:00 -9.999
>>> 9/20/2007 23:00:00 -9.999
>>> 9/21/2007 0:00:00 -9.999
>>> 9/21/2007 1:00:00 -9.999
>>> 9/21/2007 2:00:00 -9.999
>>> 9/21/2007 3:00:00 -9.999
>>> 9/21/2007 4:00:00 -9.999
>>> 9/21/2007 5:00:00 -9.999
>>> 9/21/2007 6:00:00 -9.999
>>> 9/21/2007 7:00:00 -9.999
>>> 9/21/2007 8:00:00 -9.999
>>> 9/21/2007 9:00:00 -9.999
>>> 9/21/2007 10:00:00 1.81
>>> 9/21/2007 11:00:00 1.81
>>> 9/21/2007 12:00:00 1.81
>>> 9/21/2007 13:00:00 1.83
>>> 9/21/2007 14:00:00 1.83
>>
>> I would recommend using WHERE.
>>
>> -Jeremy.
>
> the problem is not using where. actually, it is the format of the first and secound columns. I do not know how to read and write such format. I usually a text with the following command which is not appropriate since it save the data into float array.
>
> Thanks
>
> Code for reading txt file
> --------------------------
> asc_org="D:\data\file.txt"
> openr,8,asc_org
> r_org=fltarr(1,78840) ; change based on the dimension of the txt file
> readf,8,r_org
> close,8

You might want to use something like READ_ASCII with ASCII_TEMPLATE. Or alternatively, read them all in as strings and parse it yourself line by line.

-Jeremy.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to create an image with more than one gaussian psfs?
Next Topic: How to create synthetic images of stars with gaussian psf in IDL.

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

Current Time: Wed Oct 08 15:12:07 PDT 2025

Total time taken to generate the page: 0.00546 seconds