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

Home » Public Forums » archive » Re: check for already written and finished files
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
Re: check for already written and finished files [message #56455] Wed, 31 October 2007 01:28
Tal is currently offline  Tal
Messages: 26
Registered: August 2007
Junior Member
Ok.

Try this.

Query the size of your data every few seconds (see: file_info)

And match the size with the expected size of your output.

Only when they match is the process finished.



For example:

If your data is

a=fltarr(512,512,123)

the size of a should be 512*512*123*4=128,974,848 (bytes)

if it was a=uintarr(512,512,123) it was then exactly half the size.

Suppose you save now a under c:\

Now use:

b=file_info('c:\a')

and extract the size in bytes:

Print,b.size

When the sizes will be equal - the process will be finished.



I hope this will help.

Tal
Re: check for already written and finished files [message #56533 is a reply to message #56455] Tue, 30 October 2007 04:27 Go to previous message
mdoubkova is currently offline  mdoubkova
Messages: 4
Registered: September 2007
Junior Member
This would work if I would be able to access the ENVI module itself
and put sem_create in there, and release after program for geocoding
is not active. However, I do not have access to this module. I can
only check the outfile

Thanks, Marcela
Re: check for already written and finished files [message #56537 is a reply to message #56533] Tue, 30 October 2007 02:06 Go to previous message
Tal is currently offline  Tal
Messages: 26
Registered: August 2007
Junior Member
> I want to force IDL to wait until the file is fully written. However I did not find a
> way how to do this.


Try the following:

Since the header file is written only after the data was written to
disk, you could simply run a file_search for a header file (*.hdr)
with the same name as that of the data file (use file_basename for
that) and continue only after you verified its existence.

That should work.
Tal
Re: check for already written and finished files [message #56554 is a reply to message #56537] Mon, 29 October 2007 10:01 Go to previous message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
you are looking for semaphore files. check sem_create etc. Haje


<mdoubkova@gmail.com> wrote in message
news:1193672982.184164.52510@22g2000hsm.googlegroups.com...
> Hello all,
>
> I am dealing with an annoying problem which I hope may find a solution
> somewhere within the IDL audience.
>
> I call ENVI module from IDL which geocodes a binary file and saves it
> under new name also as a binary. Then, I want to proceed with
> processing of this newly created file. First I check for its existence
> and if its readable. Then I start reading this file using READ_BINARY.
>
> The problem is that this file is assigned as readable by file_test(..,/
> read) but is not yet fully geocoded (its obvious when looking at the
> file in windows commander and pressing F5, its size is increasing with
> every click) and thus I cannot be read by READ_BINARY. I want to force
> IDL to wait until the file is fully written. However I did not find a
> way how to do this. Sofar I am just using command wait, however, my
> files have varying size and sometimes its not necessary to wait at
> all, sometimes it takes 1 minut to write the file.
>
>
> Here is the example of the code
>
> ""
> sarscape_geocode, extractedGM, geocodedGM , tmp_control ;calls
> sarscape ENVI modul
> ;?? wait,30??
> test_geocodedFile=file_test(geocodedGM,/read)
> if test_geocodedFile eq 1 then check='OK' else check='ERROR'
> print, logunit, string(' Geocoding ', check, ' ',systime())
> printf, logunit, string(' Geocoding ', check, ' ',systime())
>
> if check eq 'OK' then begin
>
>
> I am gratefully for any answer,
>
> greetings
> Marcela
>
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL and IDL-PVWAVE disambiguation
Next Topic: IDL - ENVI - Mouse move on Image

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

Current Time: Wed Oct 08 19:34:49 PDT 2025

Total time taken to generate the page: 0.00625 seconds