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

Home » Public Forums » archive » CONTOUR and automatic gridding of irregularly spaced data
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
CONTOUR and automatic gridding of irregularly spaced data [message #85023] Mon, 24 June 2013 06:10 Go to next message
Karlo Janos is currently offline  Karlo Janos
Messages: 31
Registered: July 2008
Member
Hi all,

IDL 8.2.3 provides automatic gridding of irregularly spaced data with
the CONTOUR function. Great, I thought in hope to get rid of my CONTOUR
plots in direct graphics.

But when I use a CONTOUR function plot combined with a 'Mollweide' MAP
projection and CENTER_LONGITUDE=nonzero_value the automatic gridding
yields a gap between the -180 and +180 degrees longitudes.
The gap exists even though I have used GRID_UNITS='degrees' which should
cause the use of the SPHERE keyword as it is stated in the documentation
of the CONTOUR function.

The only way to avoid this is manually invoking the gridding routines.

Did I do something wrong?
Or can someone confirm this behaviour?

Thanks and regards

Karlo
Re: CONTOUR and automatic gridding of irregularly spaced data [message #85024 is a reply to message #85023] Mon, 24 June 2013 06:21 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Karlo Janos writes:

> IDL 8.2.3 provides automatic gridding of irregularly spaced data with
> the CONTOUR function. Great, I thought in hope to get rid of my CONTOUR
> plots in direct graphics.
>
> But when I use a CONTOUR function plot combined with a 'Mollweide' MAP
> projection and CENTER_LONGITUDE=nonzero_value the automatic gridding
> yields a gap between the -180 and +180 degrees longitudes.
> The gap exists even though I have used GRID_UNITS='degrees' which should
> cause the use of the SPHERE keyword as it is stated in the documentation
> of the CONTOUR function.
>
> The only way to avoid this is manually invoking the gridding routines.
>
> Did I do something wrong?

Let's just say you are not the first to be thrown upon the shoals of
disappointment. ;-)

Cheers,

David

P.S. What's wrong with gridding the data yourself? God knows, if you do,
it is one less thing to go wrong.

--
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: CONTOUR and automatic gridding of irregularly spaced data [message #85034 is a reply to message #85024] Tue, 25 June 2013 00:12 Go to previous messageGo to next message
Karlo Janos is currently offline  Karlo Janos
Messages: 31
Registered: July 2008
Member
> Let's just say you are not the first to be thrown upon the shoals of
> disappointment. ;-)
>
> Cheers,
>
> David
>
> P.S. What's wrong with gridding the data yourself? God knows, if you do,
> it is one less thing to go wrong.
>

Thanks for your encouraging reply. ;-)
Well, what I _really_ want is a cell filled CONTOUR plot of the coloured
Voronoi cells which result from the (manual or automatic) gridding.
Apparently I have failed to use QHULL properly.

The following code avoids the gap between -180° and +180°:

rresult = SPH_SCAT( lons, lats, data, BOUNDS=[-180., -90., 180., 90.],
GS=[360./N_lons, 180./N_lats] )

cc = CONTOUR( rresult $
, DINDGEN(N_lons+1)/N_lons*360-180 $
, DINDGEN(N_lats+1)/N_lats*180-90 $
, /FILL $
, GRID_UNITS=2 $
)


But the grid is spaced equally in longitudes and latitudes. It is not a
real plot of the Voronoi cells based on the data coordinates.

Can you suggest an approach?

Thanks and regards

Karlo
Re: CONTOUR and automatic gridding of irregularly spaced data [message #85036 is a reply to message #85034] Tue, 25 June 2013 05:03 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Karlo Janos writes:

> But the grid is spaced equally in longitudes and latitudes. It is not a
> real plot of the Voronoi cells based on the data coordinates.
>
> Can you suggest an approach?

I am not at all familiar with how the Contour function works, but how I
typically solve the "gap" problem is to just replicate the first
latitude column as the last column in both the latitude and data arrays.
This gives the direct graphics contour fill algorithm the information it
needs to close the contours over the gap. It also allows you to maintain
the irregular cell spacing of the original data.

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: CONTOUR and automatic gridding of irregularly spaced data [message #85037 is a reply to message #85036] Tue, 25 June 2013 06:24 Go to previous message
Karlo Janos is currently offline  Karlo Janos
Messages: 31
Registered: July 2008
Member
> ... to just replicate the first latitude column as the last column in
> both the latitude and data arrays.
> This gives the direct graphics contour fill algorithm the information it
> needs to close the contours over the gap. It also allows you to maintain
> the irregular cell spacing of the original data.

If I understand you correctly, that might work provided that I already
have columns of longitude data, i.e. equally or non-equally spaced
coordinates (but lying on the same longitude!).

This is not, what I meant by "irregular gridding". My data points are
scattered and have all different latitude and longitude values.

The automatic gridding of the old CONTOUR procedure in combination with
the "/IRREGULAR" keyword does what I need. The question now is what is
different between the CONTOUR procedure and the CONTOUR function?

Thanks and regards

Karlo
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: idl k-d tree implementation
Next Topic: Update stdout instead of writing new line

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

Current Time: Wed Oct 08 15:10:34 PDT 2025

Total time taken to generate the page: 0.00628 seconds