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

Home » Public Forums » archive » Re: trying to export pixel data from .dat files, based on coordinate loc
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: trying to export pixel data from .dat files, based on coordinate loc [message #71616] Fri, 09 July 2010 15:40 Go to previous message
Maxwell Peck is currently offline  Maxwell Peck
Messages: 61
Registered: February 2010
Member
On Jul 10, 2:53 am, Snow53 <jennifer_wa...@hotmail.com> wrote:
> Hi, I'm new to IDL so this might sound very easy to some.  Sorry!
> I have 200+ .dat files in one folder, and one associated .hdr file
> that will work for all of them.
> I would like to loop through all the files and extract pixel value
> information based on an input coordinate location (lat, long) for each
> file, and then export all this information into a .txt file or
> similar.
>
> I've been trying to follow other posts that have done similar, but I
> seem to be writing this out wrong as my code isn't compiling correctly
> (I seem to have problems on lines 9 & 14, see below). I don't know
> enough about IDL rules to know the correct way to do this.
>
> If anyone could advise, I'd be so grateful!  Cheers!
>
> Name: extractdata.pro
> ;
> ; Goal: Extract pixel data based on input coordinate location for each
> file (.dat)
> ; within a specified folder location. Export this data to a .txt file.
>
> pro extractdata
> ;define path
>   filepath='X:\MERRA\HDF_Output_Lena\'
> ;open envi files within given folder
>   file_array=file_search[filepath, '*.dat', count['*.dat']= num_file]
>   for i=0, num_file-1 do begin
>
>   file=file_array[i]
>   print, num_file
>
> ;read ENVI binary file
>   read_ENVI_image (file, headerfile= filepath, '*.hdr')
> ;extract pixel information based on lat long coordinates
>   b=ENVI_CONVERT_FILE_COORDINATES [106.002, 83.0]
>   v=b
>   print, v
>
> ;open text file to write data to
> OPENU, U, 'pixel_value.txt', /get_lun, /append
> ;write data
> printf, U, v
> ;close LUN
> close, U
>
> endfor
>
> end

Use ENVI_OPEN_FILE. Use the FID from this command in the
ENVI_CONVERT_FILE_COORDINATES. ENVI_CONVERT_FILE_COORDINATES is a
procedure, you need to specify the output variables in the command.

This is relatively straightforward and can almost be copy and pasted
directly from the ENVI help..

Max
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: SAVE compress and Gzip
Next Topic: trying to export pixel data from .dat files, based on coordinate loc

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

Current Time: Wed Oct 08 15:34:34 PDT 2025

Total time taken to generate the page: 0.00435 seconds