1+ from numpy .typing import ArrayLike
12import os
23
34import dask
78
89from pyinterpolate .kriging .point .ordinary import ok_calc
910from pyinterpolate .semivariogram .theoretical .classes .theoretical_variogram import TheoreticalVariogram
11+ from transform .geo import geometry_and_values_array
1012
1113
1214def interpolate_points (
1315 theoretical_model : TheoreticalVariogram ,
14- known_locations : np .ndarray ,
15- unknown_locations : np .ndarray ,
16+ unknown_locations : ArrayLike ,
17+ known_locations : ArrayLike = None ,
18+ known_values : ArrayLike = None ,
19+ known_geometries : ArrayLike = None ,
1620 neighbors_range = None ,
1721 no_neighbors = 4 ,
1822 max_tick = 5. ,
@@ -29,13 +33,22 @@ def interpolate_points(
2933 theoretical_model : TheoreticalVariogram
3034 Fitted theoretical variogram model.
3135
32- known_locations : numpy array
33- The known locations: x, y, value.
34-
3536 unknown_locations : numpy array
3637 Points where you want to estimate value
3738 ``[(x, y), ...] <-> [(lon, lat), ...]``.
3839
40+ known_locations : numpy array, optional
41+ The known locations: ``[x, y, value]``.
42+
43+ known_values : ArrayLike, optional
44+ Observation in the i-th geometry (from ``known_geometries``). Optional
45+ parameter, if not given then ``known_locations`` must be provided.
46+
47+ known_geometries : ArrayLike, optional
48+ Array or similar structure with geometries. It must have the same
49+ length as ``known_values``. Optional parameter, if not given then
50+ ``known_locations`` must be provided. Point type geometry.
51+
3952 neighbors_range : float, default=None
4053 The maximum distance where we search for the neighbors.
4154 If ``None`` is given then range is selected from
@@ -69,6 +82,12 @@ def interpolate_points(
6982 ``[predicted value, variance error, longitude (x), latitude (y)]``
7083 """
7184
85+ if known_locations is None :
86+ known_locations = geometry_and_values_array (
87+ geometry = known_geometries ,
88+ values = known_values
89+ )
90+
7291 interpolated_results = []
7392
7493 _disable_progress_bar = not progress_bar
@@ -94,8 +113,10 @@ def interpolate_points(
94113
95114def interpolate_points_dask (
96115 theoretical_model : TheoreticalVariogram ,
97- known_locations : np .ndarray ,
98- unknown_locations : np .ndarray ,
116+ unknown_locations : ArrayLike ,
117+ known_locations : ArrayLike = None ,
118+ known_values : ArrayLike = None ,
119+ known_geometries : ArrayLike = None ,
99120 neighbors_range = None ,
100121 no_neighbors = 4 ,
101122 max_tick = 5. ,
@@ -114,13 +135,22 @@ def interpolate_points_dask(
114135 theoretical_model : TheoreticalVariogram
115136 Fitted theoretical variogram model.
116137
117- known_locations : numpy array
118- The known locations: x, y, value.
119-
120138 unknown_locations : numpy array
121139 Points where you want to estimate value
122140 ``[(x, y), ...] <-> [(lon, lat), ...]``.
123141
142+ known_locations : numpy array, optional
143+ The known locations: ``[x, y, value]``.
144+
145+ known_values : ArrayLike, optional
146+ Observation in the i-th geometry (from ``known_geometries``). Optional
147+ parameter, if not given then ``known_locations`` must be provided.
148+
149+ known_geometries : ArrayLike, optional
150+ Array or similar structure with geometries. It must have the same
151+ length as ``known_values``. Optional parameter, if not given then
152+ ``known_locations`` must be provided. Point type geometry.
153+
124154 neighbors_range : float, default=None
125155 The maximum distance where we search for the neighbors.
126156 If ``None`` is given then range is selected from
@@ -159,6 +189,12 @@ def interpolate_points_dask(
159189 ``[predicted value, variance error, longitude (x), latitude (y)]``
160190 """
161191
192+ if known_locations is None :
193+ known_locations = geometry_and_values_array (
194+ geometry = known_geometries ,
195+ values = known_values
196+ )
197+
162198 if number_of_workers == - 1 :
163199 core_num = os .cpu_count ()
164200 if core_num > 1 :
0 commit comments