Hello all,

This may be a difficult post to respond to in the whole, but any

pointers would be appreciated.

My overall goal is to generate contour plots for a wide range of input

data. The data points are not regularly spaced and do not align to

any grid. The data points represent measurements taken from a model

that can take on a variety of shapes. To make matters more difficult,

I'd prefer not to interpolate around corners of the model.

For example ( please forgive the ascii art ):

-----------------------|

. . . . . . . .|

. . . . . . . .|

----------------| . . .|

>. .|

>. . .|

>------|

In the model above the edges denoted by "|" and "-", data points

denoted by ".". This is a simple L shape with random data points

sampled.

For the most part, the approaches I've taken have worked, but I am

hitting some difficult conditions to debug. Most unnerving are some

artifacts in the plot even though the data values are fairly uniform

(see attached image "fail.png" ).

The general approach I'm taking goes as follows:

1 ) Make a linear space for the x and y components of the data and the

model ( def_points_x is unique and sorted sorted in the code example

):

# model boundary points x

x_def = linspace( def_points_x[0], def_points_x[-1],

self.num_points_x ) # do something similar for x and y of data and

model points

2) Triangulate on the points

try:

ltri = delaunay.Triangulation( array( xPoints ), array(

yPoints ) ) # xPoints and yPoints are data points

except:

ltri = ( None, None, None )

3) use the natural neighbor extrapolator

if extrapolate:

# extrapolate

try:

interp_extrap = ltri.nn_extrapolator( region_values )

# values for the data points in same order ( i.e., ( xPoints[1],

yPoints[1] ) -> region_values[1] )

except:

return ( None, None, None)

4) extrapolate to the model boundary

x2,y2 = meshgrid( x_def, y_def ) # model boundary region

z = interp_extrap( x2, y2 )

5) plot the result

contourf( x_def, y_def, z, linspace( minValue, maxValue,

self.numberOfContourLevels ), zorder = 50, extend = 'both' )

I've attached two images, one showing a nice result and one showing artifacts.

Am I completely off base in this approach, hence I cannot seem to

"perfect" the results? Suggestions?

Thanks for reading!

-Erik