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

Home » Public Forums » archive » strange output with xyouts
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
strange output with xyouts [message #85235] Thu, 18 July 2013 04:15 Go to next message
yfjulien.pub is currently offline  yfjulien.pub
Messages: 4
Registered: July 2013
Junior Member
Hi,

This is my first time here, until now I managed to find answers to my problems through internet and forum searches but this time I couldn't find anything.

I am experiencing a strange IDL behaviour with the xyouts function. I am using it to put a time stamp (such as '2013-01-01 09H59') on an satellite image, with the following code:

device, retain=2, decomposed=0
loadct, 0, /silent
window, 2, xsize=1354, ysize=200
wset, 2
xyouts, 677, 50, '2013-01-01 09H59', $ alignment=.5,charsize=10,charthick=10,color=255, /device
dateLegend = tvrd(true=3)
wdelete, 2

Now comes the problem: sometimes I get the dateLegend right, and sometimes not. More exactly, some times I get what I expect, the '2013-01-01 09H59' time stamp which is then inserted in my satellite image, but sometimes I only get a dot at the (677,50) position, and that's it. Since this code is inserted in a big loop over different images, and that this 'not working' behaviour only affects some of the images, with a frequence that seems random to me, I am quite puzzled.

I have tried the cgText function from the coyote library, I get the same dot result for the cases that are not working with xyouts. When I change the font (!p.font = 0; instead of !p.font=-1) I get the output text OK, but then I am unable to get it as big as I need.

Has anyone experienced this kind of (I suppose) font problem with xyouts?

Thank you in advance for any help provided...
Cheers,

Yves
Re: strange output with xyouts [message #85236 is a reply to message #85235] Thu, 18 July 2013 06:03 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
yfjulien.pub@gmail.com writes:

> This is my first time here, until now I managed to find answers to my problems through internet and forum searches but this time I couldn't find anything.
>
> I am experiencing a strange IDL behaviour with the xyouts function. I am using it to put a time stamp (such as '2013-01-01 09H59') on an satellite image, with the following code:
>
> device, retain=2, decomposed=0
> loadct, 0, /silent
> window, 2, xsize=1354, ysize=200
> wset, 2
> xyouts, 677, 50, '2013-01-01 09H59', $ alignment=.5,charsize=10,charthick=10,color=255, /device
> dateLegend = tvrd(true=3)
> wdelete, 2
>
> Now comes the problem: sometimes I get the dateLegend right, and sometimes not. More exactly, some times I get what I expect, the '2013-01-01 09H59' time stamp which is then inserted in my satellite image, but sometimes I only get a dot at the (677,50) position, and that's it. Since this code is inserted in a big loop over different images, and that this 'not working' behaviour only affects some of the images, with a frequence that seems random to me, I am quite
puzzled.
>
> I have tried the cgText function from the coyote library, I get the same dot result for the cases that are not working with xyouts. When I change the font (!p.font = 0; instead of !p.font=-1) I get the output text OK, but then I am unable to get it as big as I need.
>
> Has anyone experienced this kind of (I suppose) font problem with xyouts?

This doesn't sound to me like it has anything at all to do with XYOutS.
It is more likely that it is a problem with how the string is being
created and its interaction with the true-type font (which you don't
identify).

If I were a betting man, I would bet on there being a byte value
involved in the string creation part of the code (perhaps unexpectedly),
and that when this byte value gets converted to a string it results in
an unprintable ASCII character instead of a number.

I also doubt this happens "randomly". That's just too weird. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: strange output with xyouts [message #85237 is a reply to message #85235] Thu, 18 July 2013 06:06 Go to previous messageGo to next message
yfjulien.pub is currently offline  yfjulien.pub
Messages: 4
Registered: July 2013
Junior Member
Hi again,
It seems that the code:

device, set_font='Helvetica'

before the call to xyouts does the trick...

Since I do not change any font characteristics in any part of the whole program, is it possible that IDL does that behind my back?

Cheers,
Yves
Re: strange output with xyouts [message #85238 is a reply to message #85237] Thu, 18 July 2013 06:15 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
yfjulien.pub@gmail.com writes:

> It seems that the code:
>
> device, set_font='Helvetica'
>
> before the call to xyouts does the trick...
>
> Since I do not change any font characteristics in any part of the whole program, is it possible that IDL does that behind my back?

I think it more likely that in the absence of information IDL chooses
some weird Mac font that causes you all the problems. :-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: strange output with xyouts [message #85239 is a reply to message #85236] Thu, 18 July 2013 06:19 Go to previous messageGo to next message
yfjulien.pub is currently offline  yfjulien.pub
Messages: 4
Registered: July 2013
Junior Member
> If I were a betting man, I would bet on there being a byte value
> involved in the string creation part of the code (perhaps unexpectedly),
> and that when this byte value gets converted to a string it results in
> an unprintable ASCII character instead of a number.
>
> I also doubt this happens "randomly". That's just too weird. :-)

The string I am printing is really a string, I made sure of that through a call to the size founction. Anyhow, when I run the whole program through the whole bunch of satellite images I have, this problem does not always appear with the same image. Moreover, all images time stamps are created the same way, so it makes no sense that some of them work fine and some don't.

As for the true-type font, my settings are the following: !p.font=-1, I was using the default font (Helvetica I think), which now I specify (see message below) before the call to xyouts and this seems to work well (8 different time stamps up to now, no problem, while I had one bad time stamp out of 2 or 3 before)

Cheers,
Yves
Re: strange output with xyouts [message #85240 is a reply to message #85238] Thu, 18 July 2013 06:22 Go to previous messageGo to next message
yfjulien.pub is currently offline  yfjulien.pub
Messages: 4
Registered: July 2013
Junior Member
Ok, thanks a lot, I will now specify everytime which font I want to use, just in case.

Cheers,
Yves
Re: strange output with xyouts [message #85241 is a reply to message #85240] Thu, 18 July 2013 06:47 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
yfjulien.pub@gmail.com writes:

> Ok, thanks a lot, I will now specify everytime which font I want to use, just in case.

The Macs are notorious for having different ideas for how fonts work. I
have no trouble at all believing that the Helvetica font on the Mac is
different from the Helvetica font distributed with IDL. By specifying,
you make sure you are using the IDL one.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: "Can't create pipe" on call to spawn.
Next Topic: Parallel and Perpendicular symbols in IDL 8 New Graphics.

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

Current Time: Wed Oct 08 14:01:01 PDT 2025

Total time taken to generate the page: 0.00595 seconds