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

Home » Public Forums » archive » Re: PRINTF printing to wrong LUN
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: PRINTF printing to wrong LUN [message #71665] Wed, 14 July 2010 08:31
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jul 14, 11:48 am, polystethylene <polystethyl...@hotmail.com>
wrote:
> Has anyone had any experience of IDL seemingly printing to the wrong
> logical unit number?
>
> I have this IF clause in my code:
>
>  IF nwestframes GE 1 THEN BEGIN
>      OPENW,lun2,'rotate.list'
>      PRINTF,lun2,FORMAT='("'+string(calibprefix)+'",A0)',lightlist[b]
>      CLOSE,lun2
>      PRINTF,lun,'rotate @rotate.list @rotate.list 180'
>      PRINT,'Pier flip occurs at frame
> '+string(FORMAT='(I0)',nwestframes+1)+'. 180deg rotation to be applied
> to all eastern sky images'
>      PRINTF,redinfo,'Pier Flip @ frame =
> '+string(FORMAT='(A0)',nwestframes+1)
>  ENDIF
>
> So as you can see I have a new file introduced within the IF clause,
> and two previously open units, lun & redinfo.
>
> Up until this point in the code, IDL was correctly printing to each
> lun, as I instructed it to. In this case however, it has printed 'Pier
> Flip @ frame    100' in the file associated with 'lun' instead of
> 'redinfo'. redinfo has other info successfully printed to it, so I
> have no idea why IDL suddenly messes up here.

This suggests that in some place the variable redinfo is being
changed. You should check the values of the lun variables, to make
sure they are not repeated (using the same value in different files),
and not getting changed. You did not show how you decide on their
values. The most reliable way to avoid conflicts would usually be
something like

OPENW,lun2,'rotate.list',/get_lun

so that IDL finds an unused number and puts it into lun2. Then,
instead of using close:

free_lun,lun2

so that the number is returned to the pool (and the file is closed).
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Selective Convolution
Next Topic: PRINTF printing to wrong LUN

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

Current Time: Wed Oct 08 13:51:23 PDT 2025

Total time taken to generate the page: 0.02723 seconds