Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OGSTools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ogs
OpenGeoSys Tools
OGSTools
Commits
e4c75707
Commit
e4c75707
authored
1 year ago
by
Florian Zill
Browse files
Options
Downloads
Patches
Plain Diff
updated observation point example
parent
b7ef5dc9
No related branches found
No related tags found
1 merge request
!117
Probe Functionality
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/examples/howto_meshplotlib/plot_observation_points.py
+14
-10
14 additions, 10 deletions
docs/examples/howto_meshplotlib/plot_observation_points.py
with
14 additions
and
10 deletions
docs/examples/howto_meshplotlib/plot_observation_points.py
+
14
−
10
View file @
e4c75707
...
@@ -8,7 +8,7 @@ In this example we plot the data values on observation points over all
...
@@ -8,7 +8,7 @@ In this example we plot the data values on observation points over all
timesteps. Since requested observation points don
'
t necessarily coincide with
timesteps. Since requested observation points don
'
t necessarily coincide with
actual nodes of the mesh different interpolation options are available. See
actual nodes of the mesh different interpolation options are available. See
:py:mod:`ogstools.meshlib.mesh_series.MeshSeries.probe` for more details.
:py:mod:`ogstools.meshlib.mesh_series.MeshSeries.probe` for more details.
Here
again,
we use a component transport example from the ogs benchmark gallery
Here we use a component transport example from the ogs benchmark gallery
(https://www.opengeosys.org/docs/benchmarks/hydro-component/elder/).
(https://www.opengeosys.org/docs/benchmarks/hydro-component/elder/).
"""
"""
...
@@ -17,6 +17,7 @@ Here again, we use a component transport example from the ogs benchmark gallery
...
@@ -17,6 +17,7 @@ Here again, we use a component transport example from the ogs benchmark gallery
# sphinx_gallery_start_ignore
# sphinx_gallery_start_ignore
# sphinx_gallery_thumbnail_number = 2
# sphinx_gallery_thumbnail_number = 2
# fmt:off
# sphinx_gallery_end_ignore
# sphinx_gallery_end_ignore
...
@@ -25,6 +26,7 @@ import numpy as np
...
@@ -25,6 +26,7 @@ import numpy as np
from
ogstools
import
meshplotlib
from
ogstools
import
meshplotlib
from
ogstools.meshplotlib.examples
import
meshseries_CT_2D
as
mesh_series
from
ogstools.meshplotlib.examples
import
meshseries_CT_2D
as
mesh_series
from
ogstools.meshplotlib.utils
import
justified_labels
from
ogstools.propertylib
import
Scalar
from
ogstools.propertylib
import
Scalar
meshplotlib
.
setup
.
reset
()
meshplotlib
.
setup
.
reset
()
...
@@ -39,7 +41,10 @@ si = Scalar(
...
@@ -39,7 +41,10 @@ si = Scalar(
# Let's define 4 observation points and plot them on the mesh.
# Let's define 4 observation points and plot them on the mesh.
# %%
# %%
points
=
np
.
asarray
([[
x
,
0
,
60
]
for
x
in
[
0
,
40
,
80
,
120
]])
points
=
np
.
asarray
(
[[
x
,
0
,
60
]
for
x
in
[
0
,
40
,
80
,
120
]]
+
[[
x
,
0
,
40
]
for
x
in
[
0
,
40
,
80
,
120
]]
)
fig
=
meshplotlib
.
plot
(
mesh_series
.
read
(
0
),
si
)
fig
=
meshplotlib
.
plot
(
mesh_series
.
read
(
0
),
si
)
fig
.
axes
[
0
].
scatter
(
points
[:,
0
],
points
[:,
2
],
s
=
50
,
fc
=
"
none
"
,
ec
=
"
r
"
,
lw
=
3
)
fig
.
axes
[
0
].
scatter
(
points
[:,
0
],
points
[:,
2
],
s
=
50
,
fc
=
"
none
"
,
ec
=
"
r
"
,
lw
=
3
)
for
i
,
point
in
enumerate
(
points
):
for
i
,
point
in
enumerate
(
points
):
...
@@ -50,10 +55,11 @@ plt.rcdefaults()
...
@@ -50,10 +55,11 @@ plt.rcdefaults()
# And now probe the points and the values over time:
# And now probe the points and the values over time:
# %%
# %%
labels
=
[
f
"
{
i
}
:
{
label
}
"
for
i
,
label
in
enumerate
(
justified_labels
(
points
))]
fig
=
meshplotlib
.
plot_probe
(
fig
=
meshplotlib
.
plot_probe
(
mesh_series
=
mesh_series
,
points
=
points
,
mesh_property
=
si
,
time_unit
=
"
a
"
mesh_series
=
mesh_series
,
points
=
points
[:
4
],
mesh_property
=
si
,
time_unit
=
"
a
"
,
labels
=
labels
[:
4
]
)
)
# %% [markdown]
# %% [markdown]
# You can also pass create your own matplotlib figure and pass the axes object.
# You can also pass create your own matplotlib figure and pass the axes object.
# Additionally, you can pass any keyword arguments which are known by
# Additionally, you can pass any keyword arguments which are known by
...
@@ -64,11 +70,9 @@ fig = meshplotlib.plot_probe(
...
@@ -64,11 +70,9 @@ fig = meshplotlib.plot_probe(
# %%
# %%
fig
,
axs
=
plt
.
subplots
(
nrows
=
2
,
figsize
=
[
10
,
5
])
fig
,
axs
=
plt
.
subplots
(
nrows
=
2
,
figsize
=
[
10
,
5
])
meshplotlib
.
plot_probe
(
meshplotlib
.
plot_probe
(
mesh_series
,
points
,
si
,
time_unit
=
"
a
"
,
ax
=
axs
[
0
],
colors
=
[
"
k
"
,
"
b
"
],
mesh_series
,
points
[:
4
],
si
,
time_unit
=
"
a
"
,
ax
=
axs
[
0
],
colors
=
[
"
k
"
],
marker
=
"
.
"
# fmt: skip
labels
=
labels
[:
4
],
marker
=
"
.
"
)
)
points_2
=
np
.
asarray
([[
50
,
0
,
z
]
for
z
in
[
60
,
50
,
40
,
30
]])
meshplotlib
.
plot_probe
(
meshplotlib
.
plot_probe
(
mesh_series
,
points
_2
,
si
,
time_unit
=
"
a
"
,
ax
=
axs
[
1
],
linestyles
=
[
"
-
"
],
mesh_series
,
points
[
4
:]
,
si
,
time_unit
=
"
a
"
,
ax
=
axs
[
1
],
linestyles
=
[
"
-
"
],
l
inewidth
=
1
# fmt: skip
l
abels
=
labels
[
4
:],
linewidth
=
1
,
)
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment