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

Home » Public Forums » archive » Re: Further adventures in POLAR_CONTOUR
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: Further adventures in POLAR_CONTOUR [message #79407] Wed, 29 February 2012 11:35
Brian Wolven is currently offline  Brian Wolven
Messages: 94
Registered: May 2011
Member
In hiking, it is often easy to follow a contour. In IDL, not so much.
Re: Further adventures in POLAR_CONTOUR [message #79408 is a reply to message #79407] Wed, 29 February 2012 10:26 Go to previous message
John Coxon is currently offline  John Coxon
Messages: 15
Registered: February 2012
Junior Member
On 29/02/2012 17:15, David Fanning wrote:
> But, I think you have done a pretty good job of coaxing
> it into working for you. As to *why* it works like that,
> I really don't know. Quite a lot of what the Contour
> command does is a complete and utter mystery to me. :-)

As I put it to my PhD supervisor: "CONTOUR is dark, dark magic indeed."

--
John Coxon
http://www.chickensinenvelopes.net/
Re: Further adventures in POLAR_CONTOUR [message #79409 is a reply to message #79408] Wed, 29 February 2012 09:15 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
John Coxon writes:

> That's *exactly* what my code was doing before, and I don't think it can
> do what I need it to do.
>
> Imagine you plot the co-ordinate lines using PLOT or OPLOT and then use
> the above levels/colours. POLAR_CONTOUR plots white as the
> background/zero level, which obscures the lines completely.
>
> Doing the reverse (plotting the POLAR_CONTOUR and then using OPLOT)
> means that the lines are drawn over the fills, which means there are
> grey lines going through each region of blue/red, which looks very messy
> and inelegant.
>
> As such, your suggested method doesn't allow for the plotting of the
> co-ordinate lines (as far as I can tell), and so I've had to resort to
> the method I posted here - but I am still curious as to why my original
> method didn't work and I had to introduce the mentioned fix.

Oh, I see. Yes, what you "need" it to do, and what it "can"
do, are often two completely different things. :-)

But, I think you have done a pretty good job of coaxing
it into working for you. As to *why* it works like that,
I really don't know. Quite a lot of what the Contour
command does is a complete and utter mystery to me. :-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Further adventures in POLAR_CONTOUR [message #79411 is a reply to message #79409] Wed, 29 February 2012 08:47 Go to previous message
John Coxon is currently offline  John Coxon
Messages: 15
Registered: February 2012
Junior Member
On 29/02/2012 14:13, David Fanning wrote:
> John Coxon writes:
>
>> However, since then, it has become apparent that it would be useful to
>> put the contours above some lines that denote the co-ordinate system,
>> and so I began to experiment with putting two separate contour plots on
>> top of those lines. (I now know, thanks to David, that /cell_fill
>> doesn't ruin my fills in the way I thought it did, so this has become
>> easier and more elegant within the last few minutes!)
>
> I have never had any luck "layering" filled contour plots.
> I think you have to create them all at once with the data
> you have. If your data truly goes from -1 to 1, I would
> have just created the levels and contour colors like this:
>
> levels = Findgen(10) * 0.2 - 1.0
> c_colors = Indgen(10)+1
>
> And called Polar_Contour once, with the FILL keyword set.
> That certainly works with the test data set I created and
> the colors you loaded.
>
> After you get your filled contours, you can overlay contour
> lines in various colors, etc. That should be pretty straightforward.

That's *exactly* what my code was doing before, and I don't think it can
do what I need it to do.

Imagine you plot the co-ordinate lines using PLOT or OPLOT and then use
the above levels/colours. POLAR_CONTOUR plots white as the
background/zero level, which obscures the lines completely.

Doing the reverse (plotting the POLAR_CONTOUR and then using OPLOT)
means that the lines are drawn over the fills, which means there are
grey lines going through each region of blue/red, which looks very messy
and inelegant.

As such, your suggested method doesn't allow for the plotting of the
co-ordinate lines (as far as I can tell), and so I've had to resort to
the method I posted here - but I am still curious as to why my original
method didn't work and I had to introduce the mentioned fix.

--
John Coxon
http://www.chickensinenvelopes.net/
Re: Further adventures in POLAR_CONTOUR [message #79412 is a reply to message #79411] Wed, 29 February 2012 06:35 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> I have almost no experience with POLOR_CONTOUR, although
> I see it is simply a wrapper for the Contour command. It
> takes your polar coordinates, translates them to Cartesian
> coordinates, then grids them with Triangulate and TriGrid,
> before passing the result to the Contour command. If things
> go wrong, it is almost certainly in the gridding part of
> the code.

After giving this some thought this morning in the shower,
I'm almost certain that if I were writing a cgPolarContour
program, I would not do it this way. I think I would
actually put the contour plot on a Polar Stereo map
projection. That way, the polar plot would look, uh,
polar, and you could use your map annotation programs
(e.g., cgMap_Grid) to annotate the plots with circles
and radial lines, which is how a polar plot *should*
be labeled, I think.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Further adventures in POLAR_CONTOUR [message #79413 is a reply to message #79412] Wed, 29 February 2012 06:13 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
John Coxon writes:

> However, since then, it has become apparent that it would be useful to
> put the contours above some lines that denote the co-ordinate system,
> and so I began to experiment with putting two separate contour plots on
> top of those lines. (I now know, thanks to David, that /cell_fill
> doesn't ruin my fills in the way I thought it did, so this has become
> easier and more elegant within the last few minutes!)

Well, a couple of things about this plot. First of all,
my remarks yesterday had to do with contour plots on MAP
PROJECTIONS. I really don't know what happens when you
use CELL_FILL with Contour without putting it on a map
projection. Nothing good, probably. :-)

In any case, there are no map projections here, so if
I were creating this plot, I would be using the FILL keyword.

I have almost no experience with POLOR_CONTOUR, although
I see it is simply a wrapper for the Contour command. It
takes your polar coordinates, translates them to Cartesian
coordinates, then grids them with Triangulate and TriGrid,
before passing the result to the Contour command. If things
go wrong, it is almost certainly in the gridding part of
the code.

I have never had any luck "layering" filled contour plots.
I think you have to create them all at once with the data
you have. If your data truly goes from -1 to 1, I would
have just created the levels and contour colors like this:

levels = Findgen(10) * 0.2 - 1.0
c_colors = Indgen(10)+1

And called Polar_Contour once, with the FILL keyword set.
That certainly works with the test data set I created and
the colors you loaded.

After you get your filled contours, you can overlay contour
lines in various colors, etc. That should be pretty straightforward.

I guess my general feeling, without the data to work with, is
that this whole business has been make overly complex. If I were
having problems with it, I would probably try gridding the data
myself, so I had more control over that part of it, and then
using cgContour to explore the rest of it.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: idl_idlbridge weirdness on unix systems
Next Topic: CrowdFinch Technologies

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

Current Time: Wed Oct 08 12:48:47 PDT 2025

Total time taken to generate the page: 0.00483 seconds