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

Home » Public Forums » archive » 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
trying to export pixel data from .dat files, based on coordinate loc [message #71623] Fri, 09 July 2010 09:53 Go to previous message
Snow53 is currently offline  Snow53
Messages: 32
Registered: July 2010
Member
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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: trying to export pixel data from .dat files, based on coordinate loc
Next Topic: % POLY_FIT: Warning: Invert detected a small pivot element - help needed

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

Current Time: Wed Oct 08 15:33:59 PDT 2025

Total time taken to generate the page: 0.00417 seconds