Skip to content

Commit cd083c6

Browse files
committed
updated docstrings in interpolate module (examples)
1 parent d04efc5 commit cd083c6

File tree

3 files changed

+61
-2
lines changed

3 files changed

+61
-2
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Changes - from version >= 1.x
4343
* [docs] corrected broken links to `CONTRIBUTING.md` file in readme and docs
4444
* [setup] links to documentation have been added to `pyproject.toml`
4545
* [docs] docstring examples - all user-facing API endpoints has examples in docstrings, using new input types (values | geometries)
46-
* [docs] updated docstring (example) - `PointSupportDistance`, `core.block_filter` module functions and classes,
46+
* [docs] updated docstrings (examples) in: `PointSupportDistance`, `core.block_filter`, `pipelines.interpolate`,
4747

4848
2025-10-11
4949
----------

src/pyinterpolate/core/pipelines/interpolate.py

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,35 @@ def interpolate_points(
8181
: numpy array
8282
``[predicted value, variance error, longitude (x), latitude (y)]``
8383
84-
84+
Examples
85+
--------
86+
>>> import geopandas as gpd
87+
>>> import numpy as np
88+
>>> import pandas as pd
89+
>>>
90+
>>> from pyinterpolate import (build_experimental_variogram,
91+
... build_theoretical_variogram)
92+
>>> from pyinterpolate.core.pipelines.interpolate import interpolate_points
93+
>>>
94+
>>> dem = gpd.read_file('dem.gpkg')
95+
>>> unknown_locations = gpd.read_file('unknown_locations.gpkg')
96+
>>> step_size = 500
97+
>>> max_range = 10000
98+
>>> exp_variogram = build_experimental_variogram(
99+
... values=dem['dem'],
100+
... geometries=dem['geometry'],
101+
... step_size=step_size,
102+
... max_range=max_range
103+
... )
104+
>>> theo_variogram = build_theoretical_variogram(exp_variogram)
105+
>>> interp = interpolate_points(
106+
... theoretical_model=theo_variogram,
107+
... unknown_locations=unknown_locations['geometry'],
108+
... known_values=dem['dem'],
109+
... known_geometries=dem['geometry']
110+
... )
111+
>>> print(interp[0])
112+
[7.91222896e+01 9.72740449e+01 2.38012302e+05 5.51466805e+05]
85113
"""
86114

87115
if known_locations is None:
@@ -189,6 +217,36 @@ def interpolate_points_dask(
189217
-------
190218
: numpy array
191219
``[predicted value, variance error, longitude (x), latitude (y)]``
220+
221+
Examples
222+
--------
223+
>>> import geopandas as gpd
224+
>>> import numpy as np
225+
>>> import pandas as pd
226+
>>>
227+
>>> from pyinterpolate import (build_experimental_variogram,
228+
... build_theoretical_variogram)
229+
>>> from pyinterpolate.core.pipelines.interpolate import interpolate_points_dask
230+
>>>
231+
>>> dem = gpd.read_file('dem.gpkg')
232+
>>> unknown_locations = gpd.read_file('unknown_locations.gpkg')
233+
>>> step_size = 500
234+
>>> max_range = 10000
235+
>>> exp_variogram = build_experimental_variogram(
236+
... values=dem['dem'],
237+
... geometries=dem['geometry'],
238+
... step_size=step_size,
239+
... max_range=max_range
240+
... )
241+
>>> theo_variogram = build_theoretical_variogram(exp_variogram)
242+
>>> interp = interpolate_points_dask(
243+
... theoretical_model=theo_variogram,
244+
... unknown_locations=unknown_locations['geometry'],
245+
... known_values=dem['dem'],
246+
... known_geometries=dem['geometry']
247+
... )
248+
>>> print(interp[0])
249+
[7.91222896e+01 9.72740449e+01 2.38012302e+05 5.51466805e+05]
192250
"""
193251

194252
if known_locations is None:

tests/test_core/test_interpolate_pipelines.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def test_interpolate_points():
5151
known_values=train[:, -1],
5252
known_geometries=geometries
5353
)
54+
print(interp[0])
5455
assert isinstance(interp, np.ndarray)
5556

5657

0 commit comments

Comments
 (0)