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

Home » Public Forums » archive » open and save a set of image
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: open and save a set of image [message #51541 is a reply to message #51397] Tue, 21 November 2006 07:36 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
cecilia.devecchi@gmail.com wrote:
> We have a set of hdf files about wind field. We extract these data of
> an area on the Mediterranean Sea.
> We extract these data and we write them in a *.txt file with the
> following lines:
>
> fileout= 'C:\QS' + name + '.txt'
> print,' OUTPUT FILE: ',fileout
> openw,2,/get_lun, fileout
> printf, 2, 'ASCENDING PASS (DAYTIME)'
> printf, 2, ' LON LAT SPD U V SPD2 COUNT
> TIME
> etc....
> ....
> close, 2
>
> With these lines, we succed to pass every file, but we succed to write
> in txt only the first file :

Only the first file? Or the last file?
>
> file_array=file_search('C:\QS\',$
> '*.200*', count=num_file)
> for i=0, num_file-1 do begin
> filename=file_array(i)
> print, filename
> openr, lun, /get_lun, filename
>
> ;read, analisys so the lines that we found above
> fileout= 'C:\QS' + name + '.txt'
> print,' OUTPUT FILE: ',fileout
> openw,2,/get_lun, fileout

From your snippet, the name of the output file is the same for each input file. If this
is actually what you want, then you should either:
a) open the output file before the loop and close it after the loop, or
b) open the output file in the loop with the /append specifier.

And, BTW, if you use /get_lun in OPENW, you don't want the 2 in there. That is,
openw, 2, /get_lun, fileout
should be something like
openw, outfileid, fileout, /get_lun
Same for the printf statements. I'm assuming this is a transcription error in your post
rather than your actual code.

A short working version of the code in question, rather than incomplete snippets, may
shine more light on the actual problem.

cheers,

paulv

--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
Ph: (301)763-8000 x7748
Fax:(301)763-8545
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: POLYFILLV weirdness
Next Topic: vectorized RK4

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

Current Time: Wed Oct 08 19:21:21 PDT 2025

Total time taken to generate the page: 0.00369 seconds