DataFusionTools.interpolation package
Contents
DataFusionTools.interpolation package#
Submodules#
DataFusionTools.interpolation.interpolation module#
Module contents#
- class datafusiontools.interpolation.interpolation.BaseClassInterpolation(tree: Union[List, NoneType, <built-in function array>] = None, zn: Union[List, NoneType, <built-in function array>] = None, training_data: Union[List, NoneType, <built-in function array>] = None, training_points: Union[List, NoneType, <built-in function array>] = None)[source]#
Bases:
datafusiontools._core.base_class.BaseClass
- training_data: Union[List, None, numpy.array] = None#
- training_points: Union[List, None, numpy.array] = None#
- tree: Union[List, None, numpy.array] = None#
- zn: Union[List, None, numpy.array] = None#
- class datafusiontools.interpolation.interpolation.CustomKriging(tree: Union[List, NoneType, <built-in function array>] = None, zn: Union[List, NoneType, <built-in function array>] = None, training_data: Union[List, NoneType, <built-in function array>] = None, training_points: Union[List, NoneType, <built-in function array>] = None, two_d: bool = True, variogram_model: datafusiontools.interpolation.interpolation.VariogramModel = <VariogramModel.linear: 'linear'>, variogram_parameters: datafusiontools.interpolation.interpolation.VariogramParameters = VariogramParameters(slope=None, nugget=None, scale=None, exponent=None, sill=None, psill=None, range=None))[source]#
Bases:
datafusiontools.interpolation.interpolation.BaseClassInterpolation
- predict(prediction_points)[source]#
Perform interpolation with Kriging method
- Parameters
prediction_points – prediction points
- Returns
- two_d: bool = True#
- variogram_model: datafusiontools.interpolation.interpolation.VariogramModel = 'linear'#
- variogram_parameters: datafusiontools.interpolation.interpolation.VariogramParameters = VariogramParameters(slope=None, nugget=None, scale=None, exponent=None, sill=None, psill=None, range=None)#
- class datafusiontools.interpolation.interpolation.InverseDistance(tree: Union[List, None, numpy.array] = None, zn: Union[List, None, numpy.array] = None, training_data: Union[List, None, numpy.array] = None, training_points: Union[List, None, numpy.array] = None, nb_near_points: int = 6, power: float = 1.0, tol: float = 1e-09, var: Union[List, None, numpy.array] = None)[source]#
Bases:
datafusiontools.interpolation.interpolation.BaseClassInterpolation
Inverse distance interpolator
- interpolate(training_points, training_data)[source]#
Define the KDtree
- Parameters
training_points – array with the training points
training_data – data at the training points
- Returns
- nb_near_points: int = 6#
- power: float = 1.0#
- predict(prediction_points)[source]#
Perform interpolation with inverse distance method
- Parameters
prediction_points – prediction points
- Returns
- tol: float = 1e-09#
- var: Union[List, None, numpy.array] = None#
- class datafusiontools.interpolation.interpolation.NaturalNeighbor(tree: Union[List, NoneType, <built-in function array>] = None, zn: Union[List, NoneType, <built-in function array>] = None, training_data: Union[List, NoneType, <built-in function array>] = None, training_points: Union[List, NoneType, <built-in function array>] = None, interp: Union[List, NoneType, <built-in function array>] = None)[source]#
Bases:
datafusiontools.interpolation.interpolation.BaseClassInterpolation
- interp: Union[List, None, numpy.array] = None#
- interpolate(training_points, training_data)[source]#
Define the interpolator
This interpolation is done with SciPy interpolate.NearestNDInterpolator.
- Parameters
training_points – array with the training points
training_data – data at the training points
- Returns
- class datafusiontools.interpolation.interpolation.Nearest(tree: Union[List, NoneType, <built-in function array>] = None, zn: Union[List, NoneType, <built-in function array>] = None, training_data: Union[List, NoneType, <built-in function array>] = None, training_points: Union[List, NoneType, <built-in function array>] = None)[source]#
Bases:
datafusiontools.interpolation.interpolation.BaseClassInterpolation
- interpolate(training_points: numpy.array, training_data: numpy.array)[source]#
Define the KDtree
This interpolation is done with SciPy interpolate.NearestNDInterpolator.
- Parameters
training_points – array with the training points
training_data – data at the training points
- Returns
- class datafusiontools.interpolation.interpolation.VariogramModel(value)[source]#
Bases:
enum.Enum
An enumeration.
- exponential = 'exponential'#
- gaussian = 'gaussian'#
- hole_effect = 'hole-effect'#
- linear = 'linear'#
- power = 'power'#
- spherical = 'spherical'#
- class datafusiontools.interpolation.interpolation.VariogramParameters(slope: Optional[float] = None, nugget: Optional[float] = None, scale: Optional[float] = None, exponent: Optional[float] = None, sill: Optional[float] = None, psill: Optional[float] = None, range: Optional[float] = None)[source]#
Bases:
object
- exponent: Optional[float] = None#
- nugget: Optional[float] = None#
- psill: Optional[float] = None#
- range: Optional[float] = None#
- scale: Optional[float] = None#
- sill: Optional[float] = None#
- slope: Optional[float] = None#
- class datafusiontools.interpolation.interpolation_2d_slice.Interpolate2DSlice(interpolation_method_surface: datafusiontools.interpolation.interpolation.BaseClassInterpolation = InverseDistance(tree=None, zn=None, training_data=None, training_points=None, nb_near_points=2, power=1.0, tol=1e-09, var=None), griddata_interpolation_method: str = 'linear')[source]#
Bases:
object
Class that contains methods that facilitate the extraction of a 2d slice from a dataclass.
- Parameters
interpolation_method_surface – Interpolation method selected from interpolating the top and bottom surfaces
griddata_interpolation_method – Interpolation method to determine z coordinates of the top and bottom meshgrid select between the {linear, nearest, cubic} methods. linear is the default.
- calculate_top_and_bottom_points(location_1: datafusiontools._core.data_input.Geometry, location_2: datafusiontools._core.data_input.Geometry, data: List[datafusiontools._core.data_input.Data], number_of_points: int)[source]#
Function that return the top and bottom coordinates of the 2d slice.
- Parameters
location_1 – Starting point of the generated 2d slice
location_2 – Ending point of the generated 2d slice
data – dataset with all available data
number_of_points – Number of point that should be available in the xy axis of the slice
- closest_node_index(node, nodes)[source]#
Function that returns an index that corresponds to the closest point in list.
- Parameters
node – reference point
nodes – list of points that are the search array
- encode_string_data(data: List[datafusiontools._core.data_input.Data], interpolate_variable: str)[source]#
Function that encodes string data for interpolation.
- Parameters
data – dataset with all available data
interpolate_variable – Variable that the 2d slice will be interpolated for
- Returns
Encoded data
- extrapolation(data, extrapolation_spots)[source]#
Function that extrapolates points from 2d to 3d.
- Parameters
data – already existing 3d points
extrapolation_spots – 2d points that the z irectio should be extrapolated
- get_2d_slice_extra(location_1: datafusiontools._core.data_input.Geometry, location_2: datafusiontools._core.data_input.Geometry, data: List[datafusiontools._core.data_input.Data], interpolate_variable: str, number_of_points: int, number_of_independent_variable_points: int, interpolation_method: datafusiontools.interpolation.interpolation.BaseClassInterpolation = InverseDistance(tree=None, zn=None, training_data=None, training_points=None, nb_near_points=10, power=1.0, tol=1e-09, var=None), top_surface: Optional[List] = None, bottom_surface: Optional[List] = None)[source]#
Function that produces an interpolated 2d slice of a 3d domain. In this case the user can choose the interpolation method. The interpolation method should be of type BaseClassInterpolation. This method uses the xyz values of the list of dataclasses to find the n nearest points to the interpolation point.
- Parameters
location_1 – Starting point of the generated 2d slice
location_2 – Ending point of the generated 2d slice
data – dataset with all available data
interpolate_variable – Variable that the 2d slice will be interpolated for
number_of_points – Number of point that should be available in the xy axis of the slice
number_of_independent_variable_points – Number of points available in the z direction of the slice
interpolation_method – Method that should be used for the interpolation of the variable
top_surface – Optional input of the top surface of the slice
bottom_surface – Optional input of the bottom surface of the slice
- Returns
points_2d_slice, results_2d_slice
- get_2d_slice_per_depth_inverse_distance(location_1: datafusiontools._core.data_input.Geometry, location_2: datafusiontools._core.data_input.Geometry, data: List[datafusiontools._core.data_input.Data], interpolate_variable: str, number_of_points: int, number_of_independent_variable_points: int, interpolation_method: Optional[datafusiontools.interpolation.interpolation_inv_distance_per_depth.InverseDistancePerDepth] = None, top_surface: Optional[List] = None, bottom_surface: Optional[List] = None)[source]#
Fuction that produces an interpolated 2d slice of a 3d domain. This function uses the inverse distance per depth method to interpolate the 2d slice. In this case the interpolations method is of type InverseDistancePerDepth
datafusiontools.interpolation.interpolation_inv_distance_per_depth.InverseDistancePerDepth
. This method uses the xy values of the list of dataclasses to find the n nearest points to the interpolation point. Then the n nearest data points are used to interpolate the variable of interest. The interpolation is done for each depth value. Returns the interpolated 2d slice and the variance of the interpolation.- Parameters
location_1 – Starting point of the generated 2d slice
location_2 – Ending point of the generated 2d slice
data – dataset with all available data
interpolate_variable – Variable that the 2d slice will be interpolated for
number_of_points – Number of point that should be available in the xy axis of the slice
number_of_independent_variable_points – Number of points available in the z direction of the slice
interpolation_method – Method that should be used for the interpolation of the variable
top_surface – Optional input of the top surface of the slice
bottom_surface – Optional input of the bottom surface of the slice
- Returns
points_2d_slice, results_2d_slice, variance
- get_plane(xl, xu, yl, yu, i)[source]#
Function that returns a collection of points representing a plane used as a search domain.
- Parameters
xl – x coordinate 1rst point
xu – x coordinate 2nd point
yl – y coordinate 1rst point
yu – y coordinate 2nd point
i – discritization of points produced
- get_top_and_bottom_points(location_1: datafusiontools._core.data_input.Geometry, location_2: datafusiontools._core.data_input.Geometry, data: List[datafusiontools._core.data_input.Data], number_of_points: int, top_surface: Union[List, None, numpy.array] = None, bottom_surface: Union[List, None, numpy.array] = None)[source]#
Function that gets the top and bottoms points of the slice depending on the input of the user
- Parameters
location_1 – Starting point of the generated 2d slice
location_2 – Ending point of the generated 2d slice
data – dataset with all available data
interpolate_variable – Variable that the 2d slice will be interpolated for
number_of_points – Number of point that should be available in the xy axis of the slice
number_of_independent_variable_points – Number of points available in the z direction of the slice
interpolation_method – Method that should be used for the interpolation of the variable
top_surface – Optional input of the top surface of the slice
bottom_surface – Optional input of the bottom surface of the slice
- get_type_of_variable(data: List[datafusiontools._core.data_input.Data], interpolate_variable: str)[source]#
Function that checks if data provided by the user are consistent. Checks that the same type is used for all data.
- Parameters
data – dataset with all available data
interpolate_variable – Variable that the 2d slice will be interpolated for
- Returns
Type of data found
- get_user_defined_surface(location_1: datafusiontools._core.data_input.Geometry, location_2: datafusiontools._core.data_input.Geometry, number_of_points: int, surface: numpy.array)[source]#
Function that interpolates the user defined surface line to the number of points needed for the slice
- Parameters
location_1 – Starting point of the generated 2d slice
location_2 – Ending point of the generated 2d slice
number_of_points – Number of point that should be available in the xy axis of the slice
surface – user defined list of coordinates
- griddata_interpolation_method: str = 'linear'#
- interpolation(data, number_of_points)[source]#
Function that creates a 3d mesh grid.
- Parameters
data – dataset with all available data
number_of_points – Number of point that should be available in the xy axis of the slice
- interpolation_analysis(extrapolation_spots, top, bot, number_of_points)[source]#
Function that performs the interpolation analysis to create a mesh grid of the top and bottom surfaces.
- Parameters
extrapolation_spots – extrapolated 3d plane space points
top – known top points of the 3d space
bottom – known bottom points of the 3d space
number_of_points – Number of point that should be available in the xy axis of the slice
- interpolation_method_surface: datafusiontools.interpolation.interpolation.BaseClassInterpolation = InverseDistance(tree=None, zn=None, training_data=None, training_points=None, nb_near_points=2, power=1.0, tol=1e-09, var=None)#
- datafusiontools.interpolation.interpolation_2d_slice.get_values_for_inverse_dist_per_depth(dataclass_list: List[datafusiontools._core.data_input.Data], value_name: str)[source]#
Function that extracts the values needed for the inverse distance per depth interpolation method
- Parameters
dataclass_list – List of dataclasses that contain the data
value_name – Name of the variable that should be interpolated
- Returns
coordinates, training_data, depth_data
- class datafusiontools.interpolation.interpolation_3d_line.Interpolate3DLine[source]#
Bases:
object
- get_3d_line(line: List, data: List[datafusiontools._core.data_input.Data], interpolate_variable: str, number_of_independent_variable_points: int, bottom_value: float, interpolation_method: datafusiontools.interpolation.interpolation.BaseClassInterpolation = InverseDistance(tree=None, zn=None, training_data=None, training_points=None, nb_near_points=10, power=1.0, tol=1e-09, var=None))[source]#
- class datafusiontools.interpolation.interpolation_utils.InterpolationUtils[source]#
Bases:
object
- static get_data_for_interpolation(data: Union[datafusiontools._core.data_input.Data, List[datafusiontools._core.data_input.Data]], value_name: str, use_independent_variable_as_z: bool)[source]#
Static function that transforms inputted data to be used for the interpolation process
- static get_points_for_interpolation(data: Union[datafusiontools._core.data_input.Data, List[datafusiontools._core.data_input.Data]], use_independent_variable_as_z: bool)[source]#
Static function that transforms inputted data to points that can be used for the interpolation prediction
- static get_points_from_one_dataclass(data_point: datafusiontools._core.data_input.Data, use_independent_variable_as_z: bool)[source]#
- class datafusiontools.interpolation.interpolation_inv_distance_per_depth.InverseDistancePerDepth(nb_near_points: int = 6, power: int = 1, tol: float = 1e-09, default_cov: float = 10.0, tree: Optional[scipy.spatial._ckdtree.cKDTree] = None, zn: Union[List, None, numpy.array] = None, var: Union[List, None, numpy.array] = None, training_data: Union[List, None, numpy.array] = None, training_points: Union[List, None, numpy.array] = None, depth_data: Union[List, None, numpy.array] = None, depth_prediction: Union[List, None, numpy.array] = None)[source]#
Bases:
object
Inverse distance interpolator per depth or some other set independent variable. The interpolation is performed using the inverse distance method. The mean and variance are computed based
- Parameters
nb_near_points – (optional) number of k-nearest neighbours used for interpolation. Default is 6
power – (optional) power of the inverse. Default is 1
tol – (optional) tolerance added to the point distance to overcome division by zero. Default is 1e-9
default_cov – (optional) default covariance for the case of only one datapoint. Default is 10
Extra attributes:
tree: KDtree with nearest neighbors
zn: interpolation results
var: interpolation variance
training_data: training data
training_points: training points
depth_data: training points depth
depth_prediction: interpolation depth
- default_cov: float = 10.0#
- depth_data: Union[List, None, numpy.array] = None#
- depth_prediction: Union[List, None, numpy.array] = None#
- interpolate(training_points: Union[List, numpy.array], training_data: Union[List, numpy.array], depth_points: Union[List, numpy.array])[source]#
Function that defines the training data and the interpolation points for the inverse distance method. The training data are the data at the training points and the interpolation points are the points where the interpolation is performed.
- Parameters
training_points – array with the training points
training_data – data at the training points
depth_points – depth at the training points
- nb_near_points: int = 6#
- power: int = 1#
- predict(prediction_point: Union[List, numpy.array], depth_prediction: Union[List, numpy.array], point: bool = False)[source]#
Perform interpolation with inverse distance method .The mean and variance are computed based on [1], [2], [3].
- Parameters
prediction_point – prediction points
depth_prediction – depth at the prediction points
point – if True, the interpolation is performed at a single point
- predict_no_extrapolation(prediction_point: Union[List, numpy.array], depth_prediction: Union[List, numpy.array], point: bool = False)[source]#
- predict_with_custom_tree(tree: scipy.spatial._ckdtree.cKDTree, prediction_point: Union[List, numpy.array], training_data: Union[List, numpy.array], depth_data: Union[List, numpy.array], depth_prediction: Union[List, numpy.array], point: bool = False)[source]#
Perform interpolation with inverse distance method .The mean and variance are computed based on [1], [2], [3].
- Parameters
prediction_point – prediction points
training_data – data at the training points
depth_data – depth from the training points
depth_prediction – depth at the prediction points
point – (optional) boolean for the case of being a single point
- tol: float = 1e-09#
- training_data: Union[List, None, numpy.array] = None#
- training_points: Union[List, None, numpy.array] = None#
- tree: scipy.spatial._ckdtree.cKDTree = None#
- var: Union[List, None, numpy.array] = None#
- zn: Union[List, None, numpy.array] = None#