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

Home » Public Forums » archive » Re: problem with TRIANGULATION option in 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: problem with TRIANGULATION option in CONTOUR [message #73048] Sat, 23 October 2010 16:15 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ben Tupper writes:

> You might consider running the points through GRID_INPUT first. I
> really have no idea if that will help in this case, but it often comes
> to the rescue when interpolating.

Yes, that's a good suggestion.

Or, I would try just gridding the data with Triangulate
and Trigrid, and pass the gridded data to Contour.
In other words, don't try to use the TRIANGULATION
keyword. (I have to admit, I had never heard of this
keyword!)

Here are the commands I use to grid irregular data
from a book that will be hot of the press in a month
or so. I get the X and Y vectors that go with the
gridded data from the XGRID and YGRID output
keywords to TriGrid.

Triangulate, lonIrr, latIrr, triangles
gridData = Trigrid(lonIrr, latIrr, dataIrr, $
triangles, NX=41, NY=41, $
XGrid=xgrid, YGrid=ygrid)
Contour, gridData, xgrid, ygrid, /Cell_Fill, $
Levels=levels, Background=FSC_Color('white'),$
Position=[0.125, 0.125, 0.95, 0.80], $
Color=FSC_Color('black'), XStyle=1, YStyle=1, $
C_Colors=Indgen(nlevels)+1

Cheers,

David

P.S. If you want to send the data, I'm always looking
for perverse examples to add to the book! :-)

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: problem with TRIANGULATION option in CONTOUR [message #73049 is a reply to message #73048] Sat, 23 October 2010 15:52 Go to previous messageGo to next message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
On 10/23/10 8:35 AM, Ardhuin wrote:
> Dear all,
> I have been having problems with plotting output of a numerical model
> that uses unstructured grids using IDL: this model computes wave
> heights in the ocean. If I use the set of triangles from the model, I
> get really funny errors:
> Out of range subscript encountered:<LONG Array[66453]>.
> although I only have 9626 points and about 16000 triangles.
>
> The command I use is
> CONTOUR,tablep,x,y,$
> xstyle=5,ystyle=5,/FOLLOW,/CELL_FILL, TRIANGULATION=tri,
> $
> C_COLOR=colorind(0:c_numlev-2+addmini+addmaxi), $
> LEVELS=lev,/
> NOERASE,TITLE=title,CLIP=[rangex(0),rangey(0),rangex(1),rang ey(1)], $
> XRANGE=rangex,YRANGE=rangey,MAX_VALUE=maxval, $
> POSITION=[blx*winx/mwinx,bly*winy/mwiny,trx*winx/
> mwinx,try*winy/mwiny]
>
> Where tablep , x and y
> If I first do TRIANGULATE,X,Y,tri then the contours comes out OK...
> but they cut out through land boundaries and islands.
>
> So I was thinking: my triangles must be wrong ...
> but if I do a TRIGRID with my triangles then I can plot nicely with
> TV ...
> array=trigrid(X,Y,tablep,tri,[dx,dy],
> [rangex(0),rangey(0),rangex(1),rangey(1)], $
> MAX_VALUE=maxval)
>
> So my triangles are OK for TRIGRID but not for CONTOUR... How is that
> possible ??
>

Hi,

You might consider running the points through GRID_INPUT first. I
really have no idea if that will help in this case, but it often comes
to the rescue when interpolating.

Cheers,
Ben
Re: problem with TRIANGULATION option in CONTOUR [message #73050 is a reply to message #73049] Sat, 23 October 2010 15:00 Go to previous messageGo to next message
Ardhuin is currently offline  Ardhuin
Messages: 5
Registered: October 2010
Junior Member
Yes, the CLIP was useless, but even simplifying the command to

CONTOUR,tablep,x,y,$
xstyle=5,ystyle=5,/FOLLOW,/CELL_FILL, TRIANGULATION=tri, $
C_COLOR=colorind(0:c_numlev-2+addmini+addmaxi), $
LEVELS=lev,/
XRANGE=rangex,YRANGE=rangey, $
POSITION=[blx*winx/mwinx,bly*winy/mwiny,trx*winx/
mwinx,try*winy/mwiny]

I do get the same error...

Fabrice Ardhuin
Re: problem with TRIANGULATION option in CONTOUR [message #73052 is a reply to message #73050] Sat, 23 October 2010 05:57 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ardhuin writes:

> So my triangles are OK for TRIGRID but not for CONTOUR... How is that
> possible ??

Have you tried your contour plot without the CLIP keyword?
What is CLIP doing for you?

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: problem with TRIANGULATION option in CONTOUR [message #73150 is a reply to message #73048] Mon, 25 October 2010 12:06 Go to previous message
Ardhuin is currently offline  Ardhuin
Messages: 5
Registered: October 2010
Junior Member
Well, this is exactly what I do not want to do: I want to use my
triangulation because it contains the information on the grid
connectivity (islands are "holes" in the grid where the contouring
should not do any filling).

I have put the basic dataset at this ftp address:
ftp://ftp.ifremer.fr/ifremer/cersat/products/gridded/wavewat ch3/TOOLS/IDL/BUG/
with some illustrative plots. The standard contour fills everything,
including land. If I do a TRIGRID before a TV then I get want I want:
land and Islands are blank... but I'd like to do this with contour to
use the native data resolution...

Fabrice
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Fragile IDL 8 Object Programs
Next Topic: Another Way IDL 8.0 is Fragile

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

Current Time: Wed Oct 08 19:04:59 PDT 2025

Total time taken to generate the page: 0.00801 seconds