Skip to content

Commit b5131bd

Browse files
committed
VariogramCloud - new parameters and one test
1 parent b43fa1c commit b5131bd

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Changes - from version >= 1.x
2323
* [tests] Added basic tests for `ExperimentalVariogram()` class
2424
* [enhancement] `build_experimental_variogram()` function has the new parameters `values` and `geometries`, that might be provided instead of `ds` parameter
2525
* [tests] Added basic tests for `build_experimental_variogram()` function
26+
* [enhancement] `VariogramCloud()` class has the new parameters `values` and `geometries`, that might be provided instead of `ds` parameter
2627

2728

2829
2025-10-11

src/pyinterpolate/semivariogram/experimental/classes/variogram_cloud.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import copy
22
from typing import Collection, Dict, Union
3+
from numpy.typing import ArrayLike
34

45
import numpy as np
56
import pandas as pd
67
from prettytable import PrettyTable
78
from scipy.stats import skew, kurtosis
89

10+
from pyinterpolate.core.data_models.points import VariogramPoints
911
from pyinterpolate.semivariogram.experimental.classes.experimental_variogram import (
1012
ExperimentalVariogram)
1113
from pyinterpolate.transform.statistical import remove_outliers
@@ -89,6 +91,15 @@ class VariogramCloud:
8991
ds : numpy array
9092
``[x, y, value]``
9193
94+
values : ArrayLike, optional
95+
Observation in the i-th geometry (from ``geometries``). Optional
96+
parameter, if not given then ``ds`` must be provided.
97+
98+
geometries : ArrayLike, optional
99+
Array or similar structure with geometries. It must have the same
100+
length as ``values``. Optional parameter, if not given then ``ds``
101+
must be provided. Point type geometry.
102+
92103
step_size : float
93104
The fixed distance between lags grouping point neighbors.
94105
@@ -162,7 +173,9 @@ class VariogramCloud:
162173
"""
163174

164175
def __init__(self,
165-
ds: np.ndarray,
176+
ds: Union[ArrayLike, VariogramPoints] = None,
177+
values: ArrayLike = None,
178+
geometries: ArrayLike = None,
166179
step_size: float = None,
167180
max_range: float = None,
168181
direction: float = None,
@@ -172,6 +185,8 @@ def __init__(self,
172185

173186
self._experimental_variogram = ExperimentalVariogram(
174187
ds=ds,
188+
values=values,
189+
geometries=geometries,
175190
step_size=step_size,
176191
max_range=max_range,
177192
direction=direction,

tests/test_semivariogram/test_experimental_variogram_point_cloud.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,19 @@ def test_variogram_cloud_class():
7676
assert isinstance(vc, VariogramCloud)
7777

7878

79+
def test_variogram_cloud_class_sep_geom():
80+
vc = VariogramCloud(
81+
values=REFERENCE_INPUT[:, -1],
82+
geometries=REFERENCE_INPUT[:, :-1],
83+
step_size=STEP_SIZE,
84+
max_range=MAX_RANGE
85+
)
86+
stats = vc.describe()
87+
assert stats[1]['count'] == 24
88+
assert stats[2]['median'] == 9
89+
assert isinstance(vc, VariogramCloud)
90+
91+
7992
def test_outliers_removal():
8093
vc1 = VariogramCloud(
8194
ds=REFERENCE_INPUT,

0 commit comments

Comments
 (0)