LibIDW

const LibIDW = require.mx('mxjs/base/algorithms/inverse_distance_weighting.js');

StatusName
calculateIDW ( Object settings )

Perform interpolation from sampling points to interpolation points using classic inverse distance weighting. The settings object should have the following properties:

  • interpolationPointCount {Number} the number of interpolation points.
  • readInterpolationPointLocation {Function} function to read the location of an interpolation point (e.g. a table's read function for the location column).
  • samplePointCount {Number} the number of sample points.
  • readSamplePointLocation {Function} function to read the location of a sampling point (e.g. a table's read function for the location column).
  • variables {Array} an array of objects defining the variables to be interpolated.
  • zeroDistanceRange {Number} (optional) if a sampling point is within this range of an interpolation point, its values are used exactly as the interpolation point values, and no other sampling points are considered. Defaults to 1e-6.
  • powerParameter {Number} (optional) the power parameter P. Defaults to 5.
Each variable definition object should have the following properties:
  • read {Function} a function to read the variable's value from a sampling point (e.g. the read function from the sampling points table's column).
  • write {Function} a function to write the interpolated value to an interpolation point (e.g. the write function from the interpolation points table's output column).
Note that the types of values considered by the read and write functions should match, e.g. if a read function reads a Point column, then the write function should write to a Point column. The three components of point values are interpolated independently.

calculateIDWWithinRSphere ( Object settings )

Perform interpolation from sampling points to interpolation points using the Modified Shepard's method within an R-sphere. The settings object should have the following properties:

  • interpolationPointCount {Number} the number of interpolation points.
  • readInterpolationPointLocation {Function} function to read the location of an interpolation point (e.g. a table's read function for the location column).
  • samplePointCount {Number} the number of sample points.
  • readSamplePointLocation {Function} function to read the location of a sampling point (e.g. a table's read function for the location column).
  • variables {Array} an array of objects defining the variables to be interpolated.
  • R {Number} the radius of the R-sphere to search for sampling points around an interpolation point.
  • Rmax {Number} (optional) maximum radius to search for sampling points around an interpolation point (if an insufficient number of sampling points are found within the regular R-sphere). Defaults to 1000.
  • minNeighboursRequired {Number} (optional) minimum number of sampling points required (search further than the basic R-sphere until this many sampling points are found). Defaults to 5.
  • maxNeighboursConsidered {Number} (optional) maximum number of sampling points used for interpolation (if more sampling points are within the R-sphere, then the most distant sampling points are excluded from the calculations to limit the number of used sampling points to this number). Defaults to 1000.
  • zeroDistanceRange {Number} (optional) if a sampling point is within this range of an interpolation point, its values are used exactly as the interpolation point values, and no other sampling points are considered. Defaults to 1e-6.
  • powerParameter {Number} (optional) the power parameter P. Defaults to 5.
Each variable definition object should have the following properties:
  • read {Function} a function to read the variable's value from a sampling point (e.g. the read function from the sampling points table's column).
  • write {Function} a function to write the interpolated value to an interpolation point (e.g. the write function from the interpolation points table's output column).
Note that the types of values considered by the read and write functions should match, e.g. if a read function reads a Point column, then the write function should write to a Point column. The three components of point values are interpolated independently.


Library Functions

Lib.calculateIDW ( settings )

Perform interpolation from sampling points to interpolation points using classic inverse distance weighting. The settings object should have the following properties:

  • interpolationPointCount {Number} the number of interpolation points.
  • readInterpolationPointLocation {Function} function to read the location of an interpolation point (e.g. a table's read function for the location column).
  • samplePointCount {Number} the number of sample points.
  • readSamplePointLocation {Function} function to read the location of a sampling point (e.g. a table's read function for the location column).
  • variables {Array} an array of objects defining the variables to be interpolated.
  • zeroDistanceRange {Number} (optional) if a sampling point is within this range of an interpolation point, its values are used exactly as the interpolation point values, and no other sampling points are considered. Defaults to 1e-6.
  • powerParameter {Number} (optional) the power parameter P. Defaults to 5.
Each variable definition object should have the following properties:
  • read {Function} a function to read the variable's value from a sampling point (e.g. the read function from the sampling points table's column).
  • write {Function} a function to write the interpolated value to an interpolation point (e.g. the write function from the interpolation points table's output column).
Note that the types of values considered by the read and write functions should match, e.g. if a read function reads a Point column, then the write function should write to a Point column. The three components of point values are interpolated independently.

Parameters:
Lib.calculateIDWWithinRSphere ( settings )

Perform interpolation from sampling points to interpolation points using the Modified Shepard's method within an R-sphere. The settings object should have the following properties:

  • interpolationPointCount {Number} the number of interpolation points.
  • readInterpolationPointLocation {Function} function to read the location of an interpolation point (e.g. a table's read function for the location column).
  • samplePointCount {Number} the number of sample points.
  • readSamplePointLocation {Function} function to read the location of a sampling point (e.g. a table's read function for the location column).
  • variables {Array} an array of objects defining the variables to be interpolated.
  • R {Number} the radius of the R-sphere to search for sampling points around an interpolation point.
  • Rmax {Number} (optional) maximum radius to search for sampling points around an interpolation point (if an insufficient number of sampling points are found within the regular R-sphere). Defaults to 1000.
  • minNeighboursRequired {Number} (optional) minimum number of sampling points required (search further than the basic R-sphere until this many sampling points are found). Defaults to 5.
  • maxNeighboursConsidered {Number} (optional) maximum number of sampling points used for interpolation (if more sampling points are within the R-sphere, then the most distant sampling points are excluded from the calculations to limit the number of used sampling points to this number). Defaults to 1000.
  • zeroDistanceRange {Number} (optional) if a sampling point is within this range of an interpolation point, its values are used exactly as the interpolation point values, and no other sampling points are considered. Defaults to 1e-6.
  • powerParameter {Number} (optional) the power parameter P. Defaults to 5.
Each variable definition object should have the following properties:
  • read {Function} a function to read the variable's value from a sampling point (e.g. the read function from the sampling points table's column).
  • write {Function} a function to write the interpolated value to an interpolation point (e.g. the write function from the interpolation points table's output column).
Note that the types of values considered by the read and write functions should match, e.g. if a read function reads a Point column, then the write function should write to a Point column. The three components of point values are interpolated independently.

Parameters:

Category: Sample Code

const LibIDW = require.mx('mxjs/base/algorithms/inverse_distance_weighting.js');

const settings = { zeroDistanceRange: Controls.read_ZeroDistanceRange(), powerParameter: Controls.read_PowerParameter(), interpolationPointCount: RegularGrid.size(), readInterpolationPointLocation: RegularGrid.read_Location, samplePointCount: Points.size(), readSamplePointLocation: Points.read_Location, variables: [ // point type columns are OK { read: Points.read_StressXXXYXZ, write: RegularGrid.write_StressXXXYXZ }, { read: Points.read_StressYYYZZZ, write: RegularGrid.write_StressYYYZZZ }, // number columns are also OK { read: Points.read_Foo, write: RegularGrid.write_Foo }, ] };

const RSphere = Controls.read_RSphere();

if (typeof(RSphere) === "number") { settings.R = RSphere; LibIDW.calculateIDWWithinRSphere(settings); } else { LibIDW.calculateIDW(settings); }