Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion examples/06_conditioned_fields/00_condition_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
###############################################################################

# spatial random field class
model = gs.Gaussian(dim=1, var=0.5, len_scale=2)
model = gs.Gaussian(dim=1, var=0.5, len_scale=1.5)
srf = gs.SRF(model)
srf.set_condition(cond_pos, cond_val, "ordinary")

Expand All @@ -34,6 +34,15 @@
plt.plot(gridx, np.mean(fields, axis=0), linestyle=":", label="Ensemble mean")
plt.plot(gridx, srf.krige_field, linestyle="dashed", label="kriged field")
plt.scatter(cond_pos, cond_val, color="k", zorder=10, label="Conditions")
# 99 percent confidence interval
conf = gs.tools.confidence_scaling(0.99)
plt.fill_between(
gridx,
srf.krige_field - conf * np.sqrt(srf.krige_var),
srf.krige_field + conf * np.sqrt(srf.krige_var),
alpha=0.3,
label="99% confidence interval",
)
plt.legend()
plt.show()

Expand Down
2 changes: 1 addition & 1 deletion gstools/field/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _pre_pos(self, pos, mesh_type="unstructured", make_unstruct=False):
axis_lens : :class:`tuple` or :any:`None`
axis lengths of the structured mesh if mesh type was changed.
"""
x, y, z = pos2xyz(pos, max_dim=self.model.dim)
x, y, z = pos2xyz(pos, dtype=np.double, max_dim=self.model.dim)
pos = xyz2pos(x, y, z)
mesh_type_gen = mesh_type
# format the positional arguments of the mesh
Expand Down
2 changes: 1 addition & 1 deletion gstools/field/condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def ordinary(srf):
)
err_field, __ = err_ok(srf.pos, srf.mesh_type)
cond_field = srf.raw_field + krige_field - err_field
info = {"mean": krige_ok.mean}
info = {"mean": krige_ok.get_mean()}
return cond_field, krige_field, err_field, krige_var, info


Expand Down
4 changes: 3 additions & 1 deletion gstools/krige/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
.. autosummary::
:toctree: generated

Krige
Simple
Ordinary
Universal
Expand All @@ -18,6 +19,7 @@

----
"""
from gstools.krige.base import Krige
from gstools.krige.methods import (
Simple,
Ordinary,
Expand All @@ -26,4 +28,4 @@
Detrended,
)

__all__ = ["Simple", "Ordinary", "Universal", "ExtDrift", "Detrended"]
__all__ = ["Krige", "Simple", "Ordinary", "Universal", "ExtDrift", "Detrended"]
Loading