Unstructured Spline2D (progress / performance)

113 views
Skip to first unread message

Christoph Russ

unread,
Aug 28, 2016, 8:46:04 PM8/28/16
to julia...@googlegroups.com
Hi everyone,

I am currently using Dierckx.Spline2D to interpolate 2D data. Until now I could rely on the (irregular) grid input with an approximate size of 1000 x 800 datapoints, which didn't give me any trouble. Unfortunately, I now need to use an unstructured setting, where each x,y,z point is defined separately. Each input array is about 800,000 elements long and constructing the spline appears to take a very long time or not work at all. (Input data are large Float64 values for x and y with a comparable small variance in z.)

Is there a way I could occasionally output compute progress or can you recommend another interpolation package / approach / performance optimization that I should be using / doing?

Thank you,
Chris


PS: for n > 4.0 the code below produces:

ERROR: The required storage space exceeds the available storage space:
nxest or nyest too small, or s too small. Try increasing s.
 in Spline2D at /home/chrisruss/.julia/v0.4/Dierckx/src/Dierckx.jl:534

##
using Dierckx

n = 4.0

x = collect(1.0:n)
y = collect(1.0:n)
z2d = rand(size(x,1),size(y,1))
spReg = Spline2D(x,y,z2d)

xi = 1.0:0.42:n
yi = 1.0:0.42:n

z2di = evalgrid(spReg, xi, yi)

x2d = Float64[]
y2d = Float64[]

for i=1:round(Int,n)
  append!(x2d,x)
  for j=1:round(Int,n)
    push!(y2d,y[i])
  end
end

spUnstr = Spline2D(x2d,y2d,z2d[:])

zu2di = evalgrid(spUnstr, xi, yi)

abs(sum(zu2di .- z2di)) < 1.0e-10
##

Tim Holy

unread,
Aug 29, 2016, 10:49:13 AM8/29/16
to julia...@googlegroups.com
For unstructured grids, it depends a lot on what you want. I'm a fan of
piecewise linear polyhedral interpolation, but there are many other choices:
https://en.wikipedia.org/wiki/Multivariate_interpolation#Irregular_grid_.
28scattered_data.29. One of the (many) Voronoi/Delaunay packages should make
this pretty easy to implement.

If you do put something together, please consider contributing it to
Interpolations.jl!

Best,
--Tim

Chris

unread,
Aug 29, 2016, 7:56:36 PM8/29/16
to julia-users
Thanks, I implemented a weighted distance across n neighbouring points to solve my problem for the moment.
Using a triangulation would probably be a better solution, though.
Reply all
Reply to author
Forward
0 new messages