On 10/26/10 2:04 AM, Ardhuin wrote:
> On 26 oct, 02:54, David Fanning<n...@dfanning.com> wrote:
>> Ben Tupper writes:
>>> When I load the data you have posted and generate the triangulation I
>>> get a different number of triangles than you. You can see this in the
>>> output of help - note that tri2 has 19160 vertices. Also, you clip the
>>> maximum Z value when you use TRIGRID but you don't specify it for
>>> CONTOUR. I don't know if these are important issues, but perhaps you
>>> are unwittingly comparing apples to oranges?
>
> Hi, yes, obviously: the TRIANGULATE command will make more triangles
> because it will also fill the land, which I do not want. So, why is my
> set of triangles not working in contour ?? That looks like a bug to
> me.
>
> And if I try
> CONTOUR,Z,X,Y,xstyle=5,ystyle=5, TRIANGULATION=TRI,/CELL_FILL,
> MAX_VALUE=10000.
>
> I still get the same error:
> % Out of range subscript encountered:<LONG Array[66453]>.
> % Execution halted at: $MAIN$
>
Hi,
Actually, in defense of my own (blissful) ignorance, it is not obvious
that the triangulation is anything other than what might be produced by
TRIANGULATE.
OK, your TRI triangles have been screened already - those edges that
cross the land have been pulled out of TRI but they still reside in the
triangulation that TRI2 contains. I can see that if I do this...
PRO OPLOT_TRI, x,y,triangles, _EXTRA = extra
COMPILE_OPT IDL2
FOR i = 0, N_ELEMENTS(triangles)/3 - 1 DO BEGIN
t = [triangles[*,i], triangles[0,i]]
PLOTS, x[t], y[t], _EXTRA = extra
ENDFOR
END
.compile oplot_tri
plot, x,y, xrange = rangex, yrange =rangey, psym = 6
oplot_tri, x,y,tri, psym=-3 ; <---- your triangles
window,/free
plot, x,y, xrange = rangex, yrange =rangey, psym = 6
oplot_tri, x,y,tri2, psym=-3 ; <---- TRIANGULATES triangles
When you contour using the triangulation, the CONTOUR routine is
expecting TRIANGULATE's triangulation, not a modified one. At least
that is what the documents state:
"TRIANGULATION
Set this keyword to a variable that contains an array of triangles
returned from the TRIANGULATE procedure. Providing triangulation data
allows you to contour irregularly gridded data directly, without gridding."
TRIGRID on the other hand, looks like it only needs the triangulation in
the same form as that provided by TRIANGULATION, but it doesn't need to
be from TRIANGULATE. Here's what it's docs state:
"Triangles
A longword array of the form output by TRIANGULATE. That is, Triangles
has the dimensions (3, number of triangles) and, for each i,
Triangles[0,i], Triangles[1,i], and Triangles[2,i] are the indices of
the vertices of the i-th triangle."
So, it looks like TRIGRID is loose enough to work with what you give it,
but CONTOUR is much more rigid in its expectations. At this point, your
probably saying, "What is it with these dopes! I have been saying that
all along!" Well, free help probably isn't worth some much nowadays.
How did you clip the triangulation to begin with? Did you even use
TRIANGULATE to compute the triangles?
Ben
|