How to use the gstools.Exponential function in gstools

To help you get started, we’ve selected a few gstools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GeoStat-Framework / GSTools / tests / test_covmodel.py View on Github external
self.cov_models = [
            Gaussian,
            Exponential,
            Rational,
            Stable,
            Matern,
            Linear,
            Circular,
            Spherical,
            TPLGaussian,
            TPLExponential,
            TPLStable,
        ]
        self.std_cov_models = [
            Gaussian,
            Exponential,
            Rational,
            Stable,
            Matern,
            Linear,
            Circular,
            Spherical,
        ]
        self.dims = range(1, 4)
        self.lens = [[10, 5, 2]]
        self.anis = [[0.5, 0.2]]
        self.nuggets = [0, 1]
        self.vars = [1, 2]
        self.angles = [[1, 2, 3]]

        self.gamma_x = [1.0, 3.0, 5.0, 7.0, 9.0, 11.0]
        self.gamma_y = [0.2, 0.5, 0.6, 0.8, 0.8, 0.9]
github GeoStat-Framework / GSTools / tests / test_export.py View on Github external
def setUp(self):
        self.test_dir = tempfile.mkdtemp()
        # structured field with a size 100x100x100 and a grid-size of 1x1x1
        x = y = z = range(50)
        model = Gaussian(dim=3, var=0.6, len_scale=20)
        self.srf_structured = SRF(model)
        self.srf_structured((x, y, z), mesh_type="structured")
        # unstrucutred field
        seed = MasterRNG(19970221)
        rng = np.random.RandomState(seed())
        x = rng.randint(0, 100, size=1000)
        y = rng.randint(0, 100, size=1000)
        model = Exponential(
            dim=2, var=1, len_scale=[12.0, 3.0], angles=np.pi / 8.0
        )
        self.srf_unstructured = SRF(model, seed=20170519)
        self.srf_unstructured([x, y])
github GeoStat-Framework / GSTools / examples / 08_mesh / 00_mesh_intro.py View on Github external
# Estimating the Variogram
# ^^^^^^^^^^^^^^^^^^^^^^^^
# Now, with our mesh, which was loaded from completely external sources, we can
# estimate the variogram of the data.
# To speed things up, we will only use a fraction of the available data

bins = np.linspace(0, 50, 50)
bin_centre, gamma = gs.vario_estimate_unstructured(
    (x, y), field, bins, sampling_size=2000, sampling_seed=19900408)

# As we are experts, we'll do an expert guess and say, that we will most likely
# have data that has an exponential variogram. Non-experts can have a look at
# the "Finding the best fitting variogram model" tutorial in
# :ref:`tutorial_03_variogram`.
fit_model = gs.Exponential(dim=2)
fit_model.fit_variogram(bin_centre, gamma, nugget=False)

ax = fit_model.plot(x_max=max(bin_centre))
ax.plot(bin_centre, gamma)
github GeoStat-Framework / GSTools / examples / 03_variogram / 02_find_best_model.py View on Github external
"""
Finding the best fitting variogram model
----------------------------------------
"""
import numpy as np
import gstools as gs
from matplotlib import pyplot as plt

###############################################################################
# Generate a synthetic field with an exponential model.

x = np.random.RandomState(19970221).rand(1000) * 100.0
y = np.random.RandomState(20011012).rand(1000) * 100.0
model = gs.Exponential(dim=2, var=2, len_scale=8)
srf = gs.SRF(model, mean=0, seed=19970221)
field = srf((x, y))

###############################################################################
# Estimate the variogram of the field with 40 bins and plot the result.

bins = np.arange(40)
bin_center, gamma = gs.vario_estimate_unstructured((x, y), field, bins)
plt.scatter(bin_center, gamma, label="data")
ax = plt.gca()

###############################################################################
# Define a set of models to test.

models = {
    "gaussian": gs.Gaussian,
github GeoStat-Framework / GSTools / examples / 01_random_field / 02_fancier.py View on Github external
The code is very similar to the previous examples, but with a different
covariance model class :any:`Exponential`. As model parameters we a using
following

- variance :math:`\sigma^2=1`
- correlation length :math:`\lambda=(12, 3)^T`
- rotation angle :math:`\theta=\pi/8`

"""

import numpy as np
import gstools as gs

x = y = np.arange(100)
model = gs.Exponential(dim=2, var=1, len_scale=[12.0, 3.0], angles=np.pi / 8)
srf = gs.SRF(model, seed=20170519)
srf.structured([x, y])
srf.plot()

###############################################################################
# The anisotropy ratio could also have been set with

model = gs.Exponential(dim=2, var=1, len_scale=12, anis=0.25, angles=np.pi / 8)
github GeoStat-Framework / GSTools / examples / 08_mesh / 00_mesh_intro.py View on Github external
with GSTools, but we will delete the objects and only use the data, without the
backend GSTools provides.
"""
from datetime import date
import numpy as np
import gstools as gs

# create a circular mesh
point_no = 10000
rng = np.random.RandomState(20170521)
r = 50.0 * np.sqrt(rng.uniform(size=point_no))
theta = 2.0 * np.pi * rng.uniform(size=point_no)
x = r * np.cos(theta)
y = r * np.sin(theta)

tmp_model = gs.Exponential(dim=2, var=1.5, len_scale=10.0)
tmp_srf = gs.SRF(tmp_model)
field = tmp_srf((x, y))
tmp_srf.plot()

# Now that we have our data, let's delete everything GSTools related and pretend
# that this has never happend
del(tmp_model)
del(tmp_srf)


# Creating the Mesh
# ^^^^^^^^^^^^^^^^^
#
# Starting out fresh, we want to feed the mesh with our data
mesh = gs.Mesh(pos=(x, y), values=field)
github GeoStat-Framework / GSTools / examples / 02_cov_model / 01_basic_methods.py View on Github external
\rho\left(r\right)

- ``CovModel.cor`` : The normalized correlation taking a
  normalized range given by:

  .. math::
      \mathrm{cor}\left(\frac{r}{\ell}\right) = \rho\left(r\right)


As you can see, it is the easiest way to define a covariance model by giving a
correlation function as demonstrated in the introductory example.
If one of the above functions is given, the others will be determined:
"""
import gstools as gs

model = gs.Exponential(dim=3, var=2.0, len_scale=10, nugget=0.5)
ax = model.plot("variogram")
model.plot("covariance", ax=ax)
model.plot("correlation", ax=ax)
github GeoStat-Framework / GSTools / examples / 03_variogram / 00_fit_variogram.py View on Github external
"""
Fit Variogram
-------------
"""
import numpy as np
import gstools as gs

###############################################################################
# Generate a synthetic field with an exponential model.

x = np.random.RandomState(19970221).rand(1000) * 100.0
y = np.random.RandomState(20011012).rand(1000) * 100.0
model = gs.Exponential(dim=2, var=2, len_scale=8)
srf = gs.SRF(model, mean=0, seed=19970221)
field = srf((x, y))

###############################################################################
# Estimate the variogram of the field with 40 bins.

bins = np.arange(40)
bin_center, gamma = gs.vario_estimate_unstructured((x, y), field, bins)

###############################################################################
# Fit the variogram with a stable model (no nugget fitted).

fit_model = gs.Stable(dim=2)
fit_model.fit_variogram(bin_center, gamma, nugget=False)

###############################################################################
github GeoStat-Framework / GSTools / examples / 01_random_field / 02_fancier.py View on Github external
"""

import numpy as np
import gstools as gs

x = y = np.arange(100)
model = gs.Exponential(dim=2, var=1, len_scale=[12.0, 3.0], angles=np.pi / 8)
srf = gs.SRF(model, seed=20170519)
srf.structured([x, y])
srf.plot()

###############################################################################
# The anisotropy ratio could also have been set with

model = gs.Exponential(dim=2, var=1, len_scale=12, anis=0.25, angles=np.pi / 8)