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

Home » Public Forums » archive » Re: problem with output on PS device / TVREAD
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: problem with output on PS device / TVREAD [message #70224] Fri, 26 March 2010 10:02 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
clément mayet writes:

> In fact the restriction to 50 colors was a test to understand color
> tables. Now I use 250 colors. Of course the rendering on my display is
> much better, but I still have a problem of pixel size on postscript.
> On display or on PNG I don't see any pixel, whereas I have big squares
> on Postscript.

I used your program with 250 colors. I don't see
anything like that. :-)

You might try configuring your PostScript file with
PSConfig. That usually solves *most* PostScript problems. :-)

IF KEYWORD_SET(ps) THEN BEGIN
rightsize = PSWINDOW(/CM)
this_device = !D.name
keywords = PSConfig(filename='toto.ps', _Extra=rightsize)
SET_PLOT,'PS'
device, _EXTRA=keywords
ENDIF

Is this a problem with your viewer? Have you actually
printed the PostScript file?

I don't know. It looks perfectly fine to me.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: problem with output on PS device / TVREAD [message #70225 is a reply to message #70224] Fri, 26 March 2010 09:42 Go to previous messageGo to next message
clément mayet is currently offline  clément mayet
Messages: 8
Registered: March 2010
Junior Member
On 26 mar, 16:21, David Fanning <n...@dfanning.com> wrote:
> clément mayet writes:
>> Any Idea about the Postscript very crude resolution ?
>
> You are restricting your output to only 50 colors.
> If you lift this restriction, you will get MUCH
> better looking output both on PostScript and on
> your display.
>
> You appear to want to do this using indexed color (not
> sure why), so you have 256 colors available. As far as
> I can tell, you are using only a couple of "drawing" colors,
> so you have at least 250 colors available for your
> images.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")


In fact the restriction to 50 colors was a test to understand color
tables. Now I use 250 colors. Of course the rendering on my display is
much better, but I still have a problem of pixel size on postscript.
On display or on PNG I don't see any pixel, whereas I have big squares
on Postscript.


Cheers,
Clement
Re: problem with output on PS device / TVREAD [message #70226 is a reply to message #70225] Fri, 26 March 2010 08:21 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
clément mayet writes:

> Any Idea about the Postscript very crude resolution ?

You are restricting your output to only 50 colors.
If you lift this restriction, you will get MUCH
better looking output both on PostScript and on
your display.

You appear to want to do this using indexed color (not
sure why), so you have 256 colors available. As far as
I can tell, you are using only a couple of "drawing" colors,
so you have at least 250 colors available for your
images.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: problem with output on PS device / TVREAD [message #70230 is a reply to message #70226] Fri, 26 March 2010 03:30 Go to previous messageGo to next message
clément mayet is currently offline  clément mayet
Messages: 8
Registered: March 2010
Junior Member
On 25 mar, 19:47, David Fanning <n...@dfanning.com> wrote:
> pp writes:
>> In Clément's case, the gridding wizard would not pop up, which is one
>> of the reasons I said I find imap the easiest way.


I've just tried IMAP, but I'm not really satisfied.
As David said, the first plot is not very good looking, and I'm quite
lost with all the menus. Though, I'm sure it would be interesting to
take some time to get familiar with it.


Cheers,
Clement
Re: problem with output on PS device / TVREAD [message #70231 is a reply to message #70230] Fri, 26 March 2010 03:10 Go to previous messageGo to next message
clément mayet is currently offline  clément mayet
Messages: 8
Registered: March 2010
Junior Member
On 25 mar, 17:58, David Fanning <n...@dfanning.com> wrote:
> clément mayet writes:
>> Now I've got good PNG, thank you David. Any Idea about the Postscript
>> very crude resolution ?
>
> No. Is that netCDF file available somewhere?


Not yet but you will find an example of "geo" structure at
http://dl.free.fr/beTe5saIx.
You can use it directly in the code I've posted (instead of doing the
"geo=tugo2geomat_cl(file,/TIDE)")

Find below the "arrscl.pro" I use.


Thanks for helping !!

Cheers,
Clement


FUNCTION arrscl, array, min_value=min_value, max_value=max_value,
top=top, missing=missing

IF NOT KEYWORD_SET(min_value) THEN BEGIN
min_value=MIN(array, /NAN, max=maxtmp)
ENDIF

IF NOT KEYWORD_SET(max_value) THEN BEGIN
max_value=maxtmp
ENDIF

lower_numbers = WHERE(array LT min_value, cnt)
IF (cnt GT 0) THEN array[lower_numbers]=min_value

greater_numbers = WHERE(array GT max_value, cnt)
IF (cnt GT 0) THEN array[greater_numbers]=max_value

valid_numbers = WHERE( (array GE min_value) OR (array LE max_value),
cnt)
IF ( cnt GT 0 ) THEN BEGIN
array[valid_numbers]=((array[valid_numbers]-min_value)/(max_ value-
min_value))*top
ENDIF

not_numbers = WHERE(array NE array, cnt)
IF (cnt GT 0) THEN array[not_numbers]=missing

return, array

END
Re: problem with output on PS device / TVREAD [message #70237 is a reply to message #70231] Thu, 25 March 2010 12:56 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
pp writes:

> But I do not know if they test for exact regularity, or if there is
> some threshold.

As it turns out, I have been discussing with the author of this
particular data set I used, why the grid does not appear to be
"regular". So perhaps the iMap routine did just the right thing
here.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
Re: problem with output on PS device / TVREAD [message #70239 is a reply to message #70237] Thu, 25 March 2010 12:23 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Mar 25, 3:47 pm, David Fanning <n...@dfanning.com> wrote:
> As it happened, however, my data didn't need to be
> gridded. It was gridded data already, so I don't know
> why the Gridding Wizard appeared.

My guess then is that the wizard appeared because the data was not in
a 2D array. For instance, both of these imap calls do not cause the
wizard to appear:

p=300L
im=dist(np)
lon=dindgen(np)*36d1/(np-1d0)-18d1
lat=dindgen(np)*18d1/(np-1d0)-9d1
imap,im,lon,lat,grid_units=2,map_projection='orthographic'
lon2=rebin(lon,np,np)
lat2=rebin(reform(lat,1,np),np,np)
imap,im,lon2,lat2,grid_units=2,map_projection='orthographic'

The second case actually surprised me. I did not expect it to be smart
enough to test if the 2D lon and lat happened to be a regular grid.
But, for the same data, this will cause the wizard to pop up:

imap,reform(im,np*np),reform(lon2,np*np),reform(lat2,np*np), grid_units=2,map_projection='orthographic'

Which apparently means that the itools do not try to guess the
connectivity of the the points and test for regularity, they treat any
1D array as irregularly sampled.

And, consistent with the second case above, if I put some noise into
the coordinates, they notice that the data is no longer regular, and
then bring the wizard:

lon2_i=lon2+randomu(seed,np*np)
imap,im,lon2_i,lat2,grid_units=2,map_projection='orthographi c'

But I do not know if they test for exact regularity, or if there is
some threshold.
Re: problem with output on PS device / TVREAD [message #70243 is a reply to message #70239] Thu, 25 March 2010 11:47 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
pp writes:

> In Clï¿œment's case, the gridding wizard would not pop up, which is one
> of the reasons I said I find imap the easiest way.

Actually, the gridding wizard was a nice surprise. I have been
after ITTVIS to give us a way to grid data for a long time.
They should make such a thing available, along with decent
documenation so we can learn how to use it.

As it happened, however, my data didn't need to be
gridded. It was gridded data already, so I don't know
why the Gridding Wizard appeared.

> The gridding wizard is only to interpolate the data when it is not in
> a regular grid. I agree the wizard is awkward to use (not just because
> it is interactive), so for irregular data I might have used
> triangulate and trigrid() first, then passed to imap the regularly
> sampled result, so that the wizard would be avoided.

My main point is that iMap, every time I have ever used it,
which I admit is not that often, gives me as a first cut
something that is absolute rubbish. I probably don't know
how to use the damn thing, I admit, but when I do the "logical"
thing, I never have good results. This applies equally well
to all the other iTool programs, so I don't mean to single
out iMap necessarily.

I've no objection to using something that does the job.
But it my hands, iTools have never been that thing. I'm
always hopeful, however, when *someone* has figured it out. ;-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
Re: problem with output on PS device / TVREAD [message #70244 is a reply to message #70243] Thu, 25 March 2010 11:37 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Mar 25, 2:17 pm, David Fanning <n...@dfanning.com> wrote:
> I opened a netCDF file up, saved the image data, latitude,
> and longitude arrays out, and called iMap in the manner
> described above.
>
> I got a pop-up that asked me if I wanted to start the
> "Gridding Wizard". I didn't realize I had started a
> fantasy game, but "Sure, what the hell!". I went through
> several screens, and finally got to something that allowed
> me to set the missing data value in the image. Nice!
>
> OK, so then I waited a couple of minutes while the "wizard",
> or whoever it is, was thinking about things. About the time
> I was thinking about going to get a sandwich, the wizard
> disappeared and something that I can only describe as a
> large, smashed bug of some type appeared in the center of
> a very large window.
>
> I don't know. I presume that is my image on a map projection.
> But it really doesn't resemble anything I've ever seen before.
>
> Meantime, I could have run about 10 of the tools I have around
> here for displaying images on maps, and I would have seen something
> that looked VERY much like what I expected to see.

In Clément's case, the gridding wizard would not pop up, which is one
of the reasons I said I find imap the easiest way.

The gridding wizard is only to interpolate the data when it is not in
a regular grid. I agree the wizard is awkward to use (not just because
it is interactive), so for irregular data I might have used
triangulate and trigrid() first, then passed to imap the regularly
sampled result, so that the wizard would be avoided.
Re: problem with output on PS device / TVREAD [message #70247 is a reply to message #70244] Thu, 25 March 2010 10:17 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
pp writes:

> Is there a particular reason not to use imap? Something like
>
> imap,geo.pha,geo.lon,geo.lat,map_projection='mercator',grid_ units=2
>
>
> Instead of all that device, tv, map_set, map_image stuff?

Well, since I seem to be the head of this Luddite faction,
I thought I would get with the times and try iMap on one
of the netCDF files I have around here.

I opened a netCDF file up, saved the image data, latitude,
and longitude arrays out, and called iMap in the manner
described above.

I got a pop-up that asked me if I wanted to start the
"Gridding Wizard". I didn't realize I had started a
fantasy game, but "Sure, what the hell!". I went through
several screens, and finally got to something that allowed
me to set the missing data value in the image. Nice!

OK, so then I waited a couple of minutes while the "wizard",
or whoever it is, was thinking about things. About the time
I was thinking about going to get a sandwich, the wizard
disappeared and something that I can only describe as a
large, smashed bug of some type appeared in the center of
a very large window.

I don't know. I presume that is my image on a map projection.
But it really doesn't resemble anything I've ever seen before.

Meantime, I could have run about 10 of the tools I have around
here for displaying images on maps, and I would have seen something
that looked VERY much like what I expected to see.

Any other questions? :-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
Re: problem with output on PS device / TVREAD [message #70248 is a reply to message #70247] Thu, 25 March 2010 09:58 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
clï¿œment mayet writes:

> Now I've got good PNG, thank you David. Any Idea about the Postscript
> very crude resolution ?

No. Is that netCDF file available somewhere?

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
Re: problem with output on PS device / TVREAD [message #70249 is a reply to message #70248] Thu, 25 March 2010 09:05 Go to previous messageGo to next message
clément mayet is currently offline  clément mayet
Messages: 8
Registered: March 2010
Junior Member
> Is there a particular reason not to use imap?

I see two reasons:
- I didn't know that tool (newbie on IDL), I'm going to try
- I would like something automatic : one click, files are loaded,
data printed

> Get the hell out of a 16-bit display!! :-)

You're right, I've set it 24-bit, the TVREAD works very well !!

Now I've got good PNG, thank you David. Any Idea about the Postscript
very crude resolution ?
Re: problem with output on PS device / TVREAD [message #70250 is a reply to message #70249] Thu, 25 March 2010 08:47 Go to previous messageGo to next message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Mar 25, 11:57 am, clément mayet <cma...@gmail.com> wrote:
> I want to do something quite simple, but i'm on it since three
> days...need help !
>
> I have a structure like this : geo={lon:FLTARR(Nlon),
> lat:FLTARR(Nlat) , amp:FLTARR(Nlon,Nlat), pha:FLTARR(Nlon,Nlat)}
>
> Where "amp" and "pha" are tidal wave amplitude and phase.
>
> I would like to plot these data on a geographical map and display the
> output in my X window for a preview, and save this image as a PS (or
> PNG).

Is there a particular reason not to use imap? Something like

imap,geo.pha,geo.lon,geo.lat,map_projection='mercator',grid_ units=2


Instead of all that device, tv, map_set, map_image stuff?
Re: problem with output on PS device / TVREAD [message #70251 is a reply to message #70250] Thu, 25 March 2010 08:32 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
clï¿œment mayet writes:

> If it can help, my display is 16bits.
>
> Any (good) idea ?

Get the hell out of a 16-bit display!! :-)

Cheers,

David

P.S. Seriously. You do NOT want to be using a 16-bit
display. Nothing having to do with color will ever make
sense to you.

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thos speakest truth.")
Re: problem with output on PS device / TVREAD [message #70299 is a reply to message #70224] Wed, 31 March 2010 02:27 Go to previous message
clément mayet is currently offline  clément mayet
Messages: 8
Registered: March 2010
Junior Member
I've solved my problem using the keyword SCALE in MAP_IMAGE and
configuring the postscript device with PSCONFIG. My postscript looks
GREAT !

Thanks a lot !

Cheers,
Clement
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL_PATH
Next Topic: gripe about structures

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

Current Time: Sun Nov 29 03:16:08 PST 2020

Total time taken to generate the page: 0.00782 seconds