Re: problem with output on PS device / TVREAD [message #70224] |
Fri, 26 March 2010 10:02  |
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   |
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 #70230 is a reply to message #70226] |
Fri, 26 March 2010 03:30   |
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   |
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 #70239 is a reply to message #70237] |
Thu, 25 March 2010 12:23   |
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   |
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   |
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   |
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 #70250 is a reply to message #70249] |
Thu, 25 March 2010 08:47   |
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?
|
|
|
|
|