@@ -436,6 +436,61 @@ def test_core_krige_3d():
436436 assert ss == approx (0.0 , rel = 1e-3 )
437437
438438
439+ def test_non_exact ():
440+ # custom data for this test
441+ data = np .array (
442+ [[0.0 , 0.0 , 0.47 ], [1.5 , 1.5 , 0.56 ], [3 , 3 , 0.74 ], [4.5 , 4.5 , 1.47 ],]
443+ )
444+
445+ # construct grid points so diagonal
446+ # is identical to input points
447+ gridx = np .arange (0.0 , 4.51 , 1.5 )
448+ gridy = np .arange (0.0 , 4.51 , 1.5 )
449+
450+ ok = OrdinaryKriging (
451+ data [:, 0 ],
452+ data [:, 1 ],
453+ data [:, 2 ],
454+ variogram_model = "exponential" ,
455+ variogram_parameters = [500.0 , 3000.0 , 5.0 ],
456+ )
457+ z , ss = ok .execute ("grid" , gridx , gridy , backend = "vectorized" )
458+
459+ ok_non_exact = OrdinaryKriging (
460+ data [:, 0 ],
461+ data [:, 1 ],
462+ data [:, 2 ],
463+ variogram_model = "exponential" ,
464+ variogram_parameters = [500.0 , 3000.0 , 5.0 ],
465+ exact_values = False ,
466+ )
467+ z_non_exact , ss_non_exact = ok_non_exact .execute (
468+ "grid" , gridx , gridy , backend = "vectorized"
469+ )
470+
471+ in_values = np .diag (z )
472+
473+ # test that krig field
474+ # at input location are identical
475+ # to the inputs themselves with
476+ # exact_values == True
477+ assert_allclose (in_values , data [:, 2 ])
478+
479+ # test that krig field
480+ # at input location are different
481+ # than the inputs themselves
482+ # with exact_values == False
483+ assert ~ np .allclose (in_values , data [:, 2 ])
484+
485+ # test that off diagonal values are the same
486+ # by filling with dummy value and comparing
487+ # each entry in array
488+ np .fill_diagonal (z , 0.0 )
489+ np .fill_diagonal (z_non_exact , 0.0 )
490+
491+ assert_allclose (z , z_non_exact )
492+
493+
439494def test_ok (validation_ref ):
440495
441496 # Test to compare OK results to those obtained using KT3D_H2O.
0 commit comments