Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
8d23e30
Add new data encapsulation and refactor
LSchueler Jan 15, 2020
0bff5de
Blackened
LSchueler Jan 20, 2020
89e76b4
Fix bug in setter method
LSchueler Jan 23, 2020
bb67411
[WIP] Add methods for data checking
LSchueler Jan 23, 2020
9e53dc9
Move mean calc. after krige field is added
LSchueler Jan 23, 2020
32a64fa
Add todo note
LSchueler Jan 23, 2020
e18138b
[WIP] Move field base classes and add docstrings
LSchueler Jan 23, 2020
d5053ad
[WIP] 'mean' back to c'tor and refactor add_field
LSchueler Jan 23, 2020
0dcd4bf
SRF __call__ is now using correct default field
LSchueler Jan 24, 2020
60491a3
Remove a getter which is already defined in parent
LSchueler Jan 24, 2020
12357f4
Remove (now) wrong doc line
LSchueler Jan 24, 2020
dfc8a38
Add pos setter and getter
LSchueler Jan 24, 2020
f0f341f
Amend to commit 60491a3
LSchueler Jan 24, 2020
4eee22b
Add more getters, setters
LSchueler Jan 24, 2020
c75a45c
Add reset fct. and checks to FieldData class
LSchueler Jan 24, 2020
b6bbb94
[WIP] updating SRF class
LSchueler Jan 24, 2020
fe257c8
[WIP] Add new Mesh class for discussion
LSchueler Feb 10, 2020
5e54b66
Rename argument name for better distinction
LSchueler Mar 31, 2020
2dab1a0
Add getter setter
LSchueler Mar 31, 2020
ef3945f
Delete comments
LSchueler Mar 31, 2020
b2e848d
[WIP] Move Mesh class from tests to code base
LSchueler Mar 31, 2020
72cbeea
[WIP] Fix docstring
LSchueler Mar 31, 2020
453c9e0
[WIP] Fix bug
LSchueler Mar 31, 2020
0c2867d
[WIP] Merge branch 'develop' into variogram_update
LSchueler Apr 1, 2020
49d8bb3
[WIP] Fix bug
LSchueler Apr 3, 2020
ccfab45
[WIP] Update Krige class
LSchueler Apr 7, 2020
074012d
[WIP] Update SRF class
LSchueler Apr 7, 2020
4570a42
[WIP] Update export functions
LSchueler Apr 7, 2020
fafa5d8
Remove type hints for Py3.5 support
LSchueler Apr 7, 2020
557fe8a
Remove positional only arguments due to Py3.5
LSchueler Apr 7, 2020
3ac633e
Amend
LSchueler Apr 7, 2020
27603ec
Rename helper fcts and add deprecation warnings
LSchueler Apr 17, 2020
d272b0f
Move export methods from Field to Mesh class
LSchueler Apr 17, 2020
870d892
Refactor Mesh export methods
LSchueler Apr 17, 2020
43afd7a
Move export tool fcts to Mesh
LSchueler Apr 18, 2020
89051e1
Speed up export test
LSchueler Apr 18, 2020
a01abbb
Refactor export test
LSchueler Apr 18, 2020
68867af
Add export tests for vector fields
LSchueler Apr 18, 2020
e8328a9
Remove argument from getter
LSchueler Apr 22, 2020
e12abfc
Put Mesh class into separate file
LSchueler Apr 23, 2020
a886419
Add an example for the Mesh class
LSchueler Apr 24, 2020
b9e2195
Amend
LSchueler Apr 24, 2020
0864e0c
Unify set_field_data args with add_field
LSchueler Apr 24, 2020
a76fb81
Meshanise GSTools
LSchueler Apr 24, 2020
5a33d33
Fix a bug when internally changing mesh_type
LSchueler Apr 24, 2020
1bb20e9
Add method for del. field_data
LSchueler Apr 29, 2020
974ec02
1d pos is possible again without tuple
LSchueler Apr 29, 2020
e9e9334
Refactor SRF to be more mesh-centric
LSchueler Apr 29, 2020
5a6a6fe
Add dim to Mesh arg. list
LSchueler Apr 30, 2020
344990f
[WIP] Try to get tests to run
LSchueler Jul 29, 2020
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
2 changes: 2 additions & 0 deletions examples/03_variogram/README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _tutorial_03_variogram:

Tutorial 3: Variogram Estimation
================================

Expand Down
75 changes: 75 additions & 0 deletions examples/08_mesh/00_mesh_intro.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
"""
Example: Using a mesh for GSTools
---------------------------------

This example shows how external data can be analysed with GSTools.


Pretending we have some Data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

We will pretend that we have some external data, by creating some random data
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(2, pos=(x, y), values=field)

# We can add meta data too
mesh.set_field_data("Süderbrarup", "location")
mesh.set_field_data(date(year=2020, month=2, day=28), "date")

# This can be conviniently accessed
print(mesh.location)
print(mesh.date)

# But the meta data is also collected as a dictionary in case you want to export
# it
print(mesh.field_data)


# 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)
12 changes: 12 additions & 0 deletions examples/08_mesh/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. _tutorial_08_mesh:

Tutorial 8: Working With Meshes
===============================

In case you have external data, which does not come from the spatial random
generation or similar methods of GSTools and you want to analyse this data, e.g.
estimate the variogram, you can load the data into a mesh class and conveniently
manipulate, analyse, visualise, and export the data with GSTools.

Gallery
-------
3 changes: 3 additions & 0 deletions gstools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

.. autosummary::
SRF
Field
Mesh

Covariance Base-Class
^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -100,6 +102,7 @@
"""

from gstools import field, variogram, random, covmodel, tools, krige, transform
from gstools.field.mesh import Mesh
from gstools.field import SRF
from gstools.tools import (
vtk_export,
Expand Down
6 changes: 5 additions & 1 deletion gstools/field/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@

.. autosummary::
SRF
Field
Mesh

----
"""

from gstools.field.mesh import Mesh
from gstools.field.base import Field
from gstools.field.srf import SRF

__all__ = ["SRF"]
__all__ = ["SRF", "Field", "Mesh"]
Loading