-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from GeoStat-Framework/normalizer
Mean, Normalizer, Trend and Fitting
- Loading branch information
Showing
47 changed files
with
2,490 additions
and
542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,11 +19,14 @@ | |
|
||
GeoStatTools provides geostatistical tools for various purposes: | ||
- random field generation | ||
- simple, ordinary, universal and external drift kriging | ||
- conditioned field generation | ||
- incompressible random vector field generation | ||
- simple and ordinary kriging | ||
- variogram estimation and fitting | ||
- (automatted) variogram estimation and fitting | ||
- directional variogram estimation and modelling | ||
- data normalization and transformation | ||
- many readily provided and even user-defined covariance models | ||
- metric spatio-temporal modelling | ||
- plotting and exporting routines | ||
|
||
|
||
|
@@ -83,6 +86,7 @@ The documentation also includes some [tutorials][tut_link], showing the most imp | |
- [Field transformations][tut7_link] | ||
- [Geographic Coordinates][tut8_link] | ||
- [Spatio-Temporal Modelling][tut9_link] | ||
- [Normalizing Data][tut10_link] | ||
- [Miscellaneous examples][tut0_link] | ||
|
||
The associated python scripts are provided in the `examples` folder. | ||
|
@@ -219,15 +223,15 @@ cond_val = [0.47, 0.56, 0.74, 1.47, 1.74] | |
|
||
gridx = np.linspace(0.0, 15.0, 151) | ||
|
||
# spatial random field class | ||
# conditioned spatial random field class | ||
model = gs.Gaussian(dim=1, var=0.5, len_scale=2) | ||
srf = gs.SRF(model) | ||
srf.set_condition(cond_pos, cond_val, "ordinary") | ||
krige = gs.krige.Ordinary(model, cond_pos, cond_val) | ||
cond_srf = gs.CondSRF(krige) | ||
|
||
# generate the ensemble of field realizations | ||
fields = [] | ||
for i in range(100): | ||
fields.append(srf(gridx, seed=i)) | ||
fields.append(cond_srf(gridx, seed=i)) | ||
plt.plot(gridx, fields[i], color="k", alpha=0.1) | ||
plt.scatter(cond_pos, cond_val, color="k") | ||
plt.show() | ||
|
@@ -363,6 +367,7 @@ You can contact us via <[email protected]>. | |
[tut7_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/07_transformations/index.html | ||
[tut8_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/08_geo_coordinates/index.html | ||
[tut9_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/09_spatio_temporal/index.html | ||
[tut10_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/10_normalizer/index.html | ||
[tut0_link]: https://geostat-framework.readthedocs.io/projects/gstools/en/stable/examples/00_misc/index.html | ||
[cor_link]: https://en.wikipedia.org/wiki/Autocovariance#Normalization | ||
[vtk_link]: https://www.vtk.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
gstools.normalizer | ||
================== | ||
|
||
.. automodule:: gstools.normalizer | ||
|
||
.. raw:: latex | ||
|
||
\clearpage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ GSTools API | |
random.rst | ||
tools.rst | ||
transform.rst | ||
normalizer.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
r""" | ||
Log-Normal Kriging | ||
------------------ | ||
Log Normal kriging is a term to describe a special workflow for kriging to | ||
deal with log-normal data, like conductivity or transmissivity in hydrogeology. | ||
It simply means to first convert the input data to a normal distribution, i.e. | ||
applying a logarithic function, then interpolating these values with kriging | ||
and transforming the result back with the exponential function. | ||
The resulting kriging variance describes the error variance of the log-values | ||
of the target variable. | ||
In this example we will use ordinary kriging. | ||
""" | ||
import numpy as np | ||
import gstools as gs | ||
|
||
# condtions | ||
cond_pos = [0.3, 1.9, 1.1, 3.3, 4.7] | ||
cond_val = [0.47, 0.56, 0.74, 1.47, 1.74] | ||
# resulting grid | ||
gridx = np.linspace(0.0, 15.0, 151) | ||
# stable covariance model | ||
model = gs.Stable(dim=1, var=0.5, len_scale=2.56, alpha=1.9) | ||
|
||
############################################################################### | ||
# In order to result in log-normal kriging, we will use the :any:`LogNormal` | ||
# Normalizer. This is a parameter-less normalizer, so we don't have to fit it. | ||
normalizer = gs.normalizer.LogNormal | ||
|
||
############################################################################### | ||
# Now we generate the interpolated field as well as the mean field. | ||
# This can be done by setting `only_mean=True` in :any:`Krige.__call__`. | ||
# The result is then stored as `mean_field`. | ||
# | ||
# In terms of log-normal kriging, this mean represents the geometric mean of | ||
# the field. | ||
krige = gs.krige.Ordinary(model, cond_pos, cond_val, normalizer=normalizer) | ||
# interpolate the field | ||
krige(gridx) | ||
# also generate the mean field | ||
krige(gridx, only_mean=True) | ||
|
||
############################################################################### | ||
# And that's it. Let's have a look at the results. | ||
ax = krige.plot() | ||
# plotting the geometric mean | ||
krige.plot("mean_field", ax=ax) | ||
# plotting the conditioning data | ||
ax.scatter(cond_pos, cond_val, color="k", zorder=10, label="Conditions") | ||
ax.legend() |
Oops, something went wrong.