Re: grid plots [message #41989 is a reply to message #41988] |
Thu, 09 December 2004 06:46  |
K. Bowman
Messages: 330 Registered: May 2000
|
Senior Member |
|
|
In article <1102591840.222724.104440@f14g2000cwb.googlegroups.com>,
"Martin" <m.doyle@uea.ac.uk> wrote:
> Hello everyone,
>
> I've been trying to find a way of doing this for ages, but my head is
> sore after banging it against my computer screen!
>
> I have an irregularly gridded dataset (gaussian grid) and I want to be
> able to 1) interpolate it onto a regular grid and 2) plot the data so
> that each grid square is coloured depending on the value within each
> square.
>
> I have a problem with 2) in that I can't find any IDL routines that do
> this. Does anyone happen to know how to go about this at all? I'd be
> grateful for a any suggestions you might have.
There are two ways to do this that come to mind.
One is to use POLYFILL to draw a polygon for each grid cell with the
desired color. This is probably not the best way, as the PS device only
supports 256 colors for line graphics, and it may look ugly on some map
projections (e.g., when grid cells are not rectangles).
The other way is to create an image, but not interpolate the data:
MAP_SET, /HAMMER, LIMIT=limit, /ISOTROPIC, /NOBORDER
data = DIST(15)
bilinear = 0
proj = MAP_IMAGE(data, i0, j0, ni, nj, $
COMPRESS=1, BILINEAR=bilinear, $
LATMIN=-90.0, LONMIN=0.0, LATMAX=90.0, LONMAX=360.0)
image = BYTSCL(proj)
IF (!D.NAME EQ 'PS') THEN $
TV, image, i0, j0, XSIZE=ni, YSIZE=nj $
ELSE $
TV, image, i0, j0
MAP_CONTINENTS
MAP_GRID, GLINESTYLE=0
Change bilinear to 1 to see the effects of interpolating. You can do
something more complicated than a simple BYTSCL to define the colors for
your data.
Ken Bowman
|
|
|