public class SplinesGridder2 extends java.lang.Object implements Gridder2
In the isotropic and homogeneous case, where D = I is the identity matrix, this gridder is an implementation of Smith and Wessel's (1990) gridding with continuous curvature splines in tension. The finite-difference approximations to derivatives in G are different, however, because of the tensors D between G' and G in G'DG. These tensors D must be symmetric and positive-semidefinite (SPSD) so that the finite-difference operators G'DG and G'DGG'DG are SPSD as well.
Another difference between this implementation and that of Smith and Wessel (1990) is that a multigrid method is not used here to find the gridded values q. Multigrid methods are ineffective for tensors fields D that are anisotropic and inhomogeneous. Instead, this implementation uses conjugate-gradient (CG) iterations.
The gridded values q must be obtained by solving iteratively the large sparse system of equations (G'DGG'DG+tG'DG)q = 0. To facilitate a CG solver, these equations are rewritten as (K+MAM)q = (K-MAK)q, where A = G'DGG'DG+tG'DG, M is a diagonal matrix operator with ones where sample values are missing and zeros where values are known, and K = I-M is a diagonal matrix with ones where sample values are known and zero where they are missing. The matrix K+MAM on the left-hand side is symmetric and positive-definite (SPD), so that CG iterations can be used to solve for the unknown values in q. Only known values in q appear in the right-hand side column vector (K-MAK)q.
See Smith, W.H.F., and P. Wessel, 1990, Gridding with continuous curvature splines in tension: Geophysics, 55, 293--305.
Constructor and Description |
---|
SplinesGridder2()
Constructs a gridder for default tensors.
|
SplinesGridder2(float[] f,
float[] x1,
float[] x2)
Constructs a gridder for default tensors and specified samples.
|
SplinesGridder2(Tensors2 tensors)
Constructs a gridder for the specified tensors.
|
SplinesGridder2(Tensors2 tensors,
float[] f,
float[] x1,
float[] x2)
Constructs a gridder for the specified tensors and samples.
|
Modifier and Type | Method and Description |
---|---|
int |
getIterationCount()
Returns the number of conjugate-gradient iterations required.
|
float[] |
getResiduals()
Gets the initial residual and one residual for each iteration.
|
float[][] |
grid(Sampling s1,
Sampling s2)
Computes gridded sample values from the known sample values.
|
void |
gridMissing(boolean[][] m,
float[][] q)
Computes gridded values that are missing in the specified array.
|
void |
gridMissing(float qnull,
float[][] q)
Computes gridded values that are missing in the specified array.
|
void |
setMaxIterations(int niter)
Sets the maximum number of conjugate-gradient iterations.
|
void |
setScattered(float[] f,
float[] x1,
float[] x2)
Sets the known (scattered) samples.
|
void |
setTension(double tension)
Sets the tension, the weight for the harmonic spline.
|
void |
setTensors(Tensors2 tensors)
Sets the tensor field used by this gridder.
|
public SplinesGridder2()
public SplinesGridder2(float[] f, float[] x1, float[] x2)
f
- array of sample values f(x1,x2).x1
- array of sample x1 coordinates.x2
- array of sample x2 coordinates.public SplinesGridder2(Tensors2 tensors)
tensors
- the tensors.public SplinesGridder2(Tensors2 tensors, float[] f, float[] x1, float[] x2)
tensors
- the tensors.f
- array of sample values f(x1,x2).x1
- array of sample x1 coordinates.x2
- array of sample x2 coordinates.public void setTensors(Tensors2 tensors)
tensors
- the tensors; null for default tensors.public void setTension(double tension)
This tension parameter is not equivalent to the parameter t in the class documentation above. The latter would be infinite if the tension specified here could be set to 1.0.
tension
- the tension; must be in the range [0:1).public void setMaxIterations(int niter)
niter
- the maximum number of iterations.public int getIterationCount()
public float[] getResiduals()
Residuals are normalized root-mean-square differences between the left and right sides of the system of equations that are solved iteratively when computing gridded values. The returned residuals are normalized, so that the zeroth residual (before any conjugate-gradient iterations are performed) is one.
public void gridMissing(float qnull, float[][] q)
qnull
- the null value representing missing samples.q
- array in which missing (null) values are to be replaced.public void gridMissing(boolean[][] m, float[][] q)
m
- array of missing-value flags; true where value is missing.q
- array in which flagged missing values are to be replaced.public void setScattered(float[] f, float[] x1, float[] x2)
Gridder2
setScattered
in interface Gridder2
f
- array of sample values f(x1,x2).x1
- array of sample x1 coordinates.x2
- array of sample x2 coordinates.