Visualization#
- interpolate_raster(data, dim=1000, number_of_neighbors=4, semivariogram_model=None, direction=None, tolerance=None, allow_approx_solutions=True)[source]
Function interpolates raster from data points using ordinary kriging.
- Parameters:
- datanumpy array
[coordinate x, coordinate y, value]
.- dimint
Number of pixels (points) of a larger dimension (it could be width or height). Ratio is preserved.
- number_of_neighborsint, default=16
Number of points used to interpolate data.
- semivariogram_modelTheoreticalVariogram, default=None
Variogram model, if not provided then it is estimated from a given dataset.
- directionfloat (in range [0, 360]), optional
Direction of semivariogram, values from 0 to 360 degrees:
0 or 180: is E-W,
90 or 270 is N-S,
45 or 225 is NE-SW,
135 or 315 is NW-SE.
- tolerancefloat (in range [0, 1]), optional
If
tolerance
is 0 then points must be placed at a single line with the beginning in the origin of the coordinate system and the direction given by y-axis and direction parameter. Iftolerance
is> 0
then the bin is selected as an elliptical area with major axis pointed in the same direction as the line for 0 tolerance:the major axis size ==
step_size
,the minor axis size is
tolerance * step_size
,the baseline point is at a center of the ellipse,
the
tolerance == 1
creates an omnidirectional semivariogram.
- allow_approx_solutionsbool, default=True
Allows the approximation of kriging weights based on the OLS algorithm. We don’t recommend set it to
True
if you don’t know what are you doing. This parameter can be useful when you have clusters in your dataset, that can lead to singular or near-singular matrix creation.
- Returns:
- raster_dictDict
A dictionary with keys:
‘result’: numpy array of interpolated values,
‘error’: numpy array of interpolation errors,
- ‘params’:
‘pixel size’,
‘min x’,
‘max x’,
‘min y’,
‘max y’
- to_tiff(data, dir_path, fname='', dim=1000, number_of_neighbors=4, semivariogram_model=None, direction=None, tolerance=None, allow_approx_solutions=True)[source]
Function interpolates raster from data points using ordinary kriging and stores output results in tiff and tfw files.
- Parameters:
- datanumpy array
[coordinate x, coordinate y, value]
.- dir_pathstr
Path to directory where output files will be stored.
- fnamestr, default=’’
Suffix of the output
*results.tiff
and*error.tiff
files.- dimint
Number of pixels (points) of a larger dimension (it could be width or height). Ratio is preserved.
- number_of_neighborsint, default=16
Number of points used to interpolate data.
- semivariogram_modelTheoreticalVariogram, default=None
Variogram model, if not provided then it is estimated from a given dataset.
- directionfloat (in range [0, 360]), optional
Direction of semivariogram, values from 0 to 360 degrees:
0 or 180: is E-W,
90 or 270 is N-S,
45 or 225 is NE-SW,
135 or 315 is NW-SE.
- tolerancefloat (in range [0, 1]), optional
If
tolerance
is 0 then points must be placed at a single line with the beginning in the origin of the coordinate system and the direction given by y-axis and direction parameter. Iftolerance
is> 0
then the bin is selected as an elliptical area with major axis pointed in the same direction as the line for 0 tolerance:the major axis size ==
step_size
,the minor axis size is
tolerance * step_size
,the baseline point is at a center of the ellipse,
the
tolerance == 1
creates an omnidirectional semivariogram.
- allow_approx_solutionsbool, default=True
Allows the approximation of kriging weights based on the OLS algorithm. We don’t recommend set it to
True
if you don’t know what are you doing. This parameter can be useful when you have clusters in your dataset, that can lead to singular or near-singular matrix creation.
- Returns:
- files: Tuple[str, str]
Tuple of two strings: path to tiff file with interpolated data and path to tiff file with interpolation errors.