Co-Linear Contour Points [message #36370] |
Tue, 16 September 2003 13:03  |
doyle
Messages: 6 Registered: April 2002
|
Junior Member |
|
|
I'm trying to plot a contour and am getting an error that tells me my
points are co-linear. I'm not exactly sure what's going on so I
figured I'd appeal to you people. I've tried lots of different things
(including searching through the archives, but to no avail) but here's
the current version of the code. The darkinfo structures contain
latitudes and longitudes and the g_flux is what I'm trying to map
(electron count rates). The order here is that which everything gets
plotted in my code. I left out some stuff in between so as to not bog
things down with too much code.
map_set,/goodes,/continents,title='Dark Area Count Rates For Mapping
The SAA'
plots,darkinfo.sc_lon,darkinfo.sc_lat,psym=3,$
color=fix(alog10(darkinfo.g_flux))+1
z=darkinfo.g_flux
x=darkinfo.sc_lon
y=darkinfo.sc_lat
contour,z,x,y,/irregular,/overplot
Thanks in advance
Nate
|
|
|
Re: Co-Linear Contour Points [message #36463 is a reply to message #36370] |
Wed, 17 September 2003 06:54  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Nate Doyle writes:
> I'm trying to plot a contour and am getting an error that tells me my
> points are co-linear. I'm not exactly sure what's going on so I
> figured I'd appeal to you people.
I see you are not being flooded with answers. :-)
That's probably because the universe of "what's going on"
for this particular question is quite a bit larger than
it is for most typical answers in this newsgroup.
Basically, your data is co-linear, but you already
knew that. :-)
The question is: why? And that is hard to answer.
Maybe your data really is in a straight line. Have
you looked at it in some other way? Maybe you have
two points that are identical. Have you checked for
that?
The CONTOUR command requires gridded data. Your
data is being gridded by TRIANGULATE and TRIGRID.
Sometimes this kind of error message is created
when the /SPHERICAL keyword is used on TRIGRID.
(I don't know why.) I wonder if this keyword gets
set when you are overplotting on a map projection.
(I don't know how to test this.)
In any case, I would try gridding the data myself.
First with the TRIANGULATE/TRIGRID method, and then,
if necessary, with GRIDDATA.
Another way to (sometimes) shake this problem loose
is to add a tiny bit of random location data to your
coordinates.
I don't know if one or any of these suggestions
might help. But maybe you will get a couple of ideas.
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Co-Linear Contour Points [message #36466 is a reply to message #36370] |
Wed, 17 September 2003 01:16  |
Chris Lee
Messages: 101 Registered: August 2003
|
Senior Member |
|
|
In article <ae902fd4.0309161203.125f6b7b@posting.google.com>, "Nate Doyle"
<doyle@lasp.colorado.edu> wrote:
> I'm trying to plot a contour and am getting an error that tells me my
> points are co-linear. I'm not exactly sure what's going on so I figured
> I'd appeal to you people. I've tried lots of different things
> (including searching through the archives, but to no avail) but here's
> the current version of the code. The darkinfo structures contain
> latitudes and longitudes and the g_flux is what I'm trying to map
> (electron count rates). The order here is that which everything gets
> plotted in my code. I left out some stuff in between so as to not bog
> things down with too much code.
> map_set,/goodes,/continents,title='Dark Area Count Rates For Mapping The
> SAA'
> plots,darkinfo.sc_lon,darkinfo.sc_lat,psym=3,$
> color=fix(alog10(darkinfo.g_flux))+1
> z=darkinfo.g_flux
> x=darkinfo.sc_lon
> y=darkinfo.sc_lat
> contour,z,x,y,/irregular,/overplot
> Thanks in advance
> Nate
It usually means that you probably don't have irregularly gridded data.
The error is being generated by the TRIANGULATE procedure, from the IDL
help file...
"
Setting IRREGULAR is the same as performing an explicit triangulation. That is:
CONTOUR, Z, X, Y, /IRREGULAR
is the same as
TRIANGULATE, X, Y, tri ;Get triangulation
CONTOUR, Z, X, Y, TRIANGULATION=tri
"
If you try TRIANGULATE(ing) the data yourself it will complain that the
data is co-linear, this mean that the data points are regularly spaced
(at least, that's the only way I can get the error), if you have
x=[1,2,3,4,5,6,7,8]
y=[1,2,3,4,5,6,7,8]
triangulate, x,y, tri=tri
;...points are co-linear error
x=[1,2,3,4,5,6,7,8]
y=[1,2,3,4,5,6,7,9] ;note the _9_
triangulate, x,y, tri=tri
;no error.
;;;;;;;;;;;;
The IRREGULAR keyword is used if you have (say) 50
measurements at 50 different x and y values. Not when you have 2500
measurements (with 50 measurements at each of 50 different latitudes
etc.)
You should check the dimensionality of z,x and y. My guess is that
z=z(n_x,n_y), x=x(n_x), y=y(n_y)
and not
z=z(n), x=x(n), y=y(n)
Chris.
|
|
|