Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMolinsky committed Feb 9, 2023
2 parents f7617b4 + f77c032 commit 1596c32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion changelog.rst
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ Changes by date
* (enhancement) added directional kriging for ATA and ATP Poisson Kriging,
* (debug) warning for directional kriging functions,
* (enhancement) initialization of `KrigingObject` dataclass,
* (ci/cd) added new workflow tests for MacOS and Ubuntu.
* (ci/cd) added new workflow tests for MacOS and Ubuntu,
* (enhancement) added logging to Simple Kriging process.


2023-01-16
----------
Expand Down
9 changes: 5 additions & 4 deletions pyinterpolate/kriging/models/point/simple_kriging.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
-------
1. Szymon Moliński | @SimonMolinsky
TODO
----
* log k, predicted, dataset
"""
# Python core
from typing import List, Union, Tuple

# Core calculation and data visualization
import logging
import numpy as np

# Pyinterpolate
Expand Down Expand Up @@ -75,13 +73,14 @@ def simple_kriging(
RunetimeError
Singularity matrix in a Kriging system.
"""

logging.info("SIMPLE KRIGING | Operation starts")
k, predicted, dataset = get_predictions(theoretical_model,
known_locations,
unknown_location,
neighbors_range,
no_neighbors,
use_all_neighbors_in_range)
logging.info("SIMPLE KRIGING | Weights are prepared")

try:
output_weights = solve_weights(predicted, k, allow_approximate_solutions)
Expand All @@ -97,6 +96,8 @@ def simple_kriging(
sigma = np.matmul(output_weights.T, k)

if sigma < 0:
logging.info("SIMPLE KRIGING | Variance error lower than zero, NaN is returned")
return [zhat, np.nan, unknown_location[0], unknown_location[1]]

logging.info("SIMPLE KRIGING | Process ends")
return [zhat, sigma, unknown_location[0], unknown_location[1]]

0 comments on commit 1596c32

Please sign in to comment.