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
cbc4812b
Commit
cbc4812b
authored
1 year ago
by
Florian Zill
Browse files
Options
Downloads
Patches
Plain Diff
changed reduce_with to values
parent
0f7d80ec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!115
limit plots, difference plots, clean up
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ogstools/meshlib/mesh_series.py
+7
-11
7 additions, 11 deletions
ogstools/meshlib/mesh_series.py
with
7 additions
and
11 deletions
ogstools/meshlib/mesh_series.py
+
7
−
11
View file @
cbc4812b
"""
A class to handle Meshseries data.
"""
from
pathlib
import
Path
from
typing
import
Callable
,
Union
from
typing
import
Union
import
meshio
import
numpy
as
np
...
...
@@ -263,21 +263,17 @@ class MeshSeries:
)
return
mesh
def
reduce_with
(
self
,
func
:
Callable
,
data_name
:
str
)
->
pv
.
DataSet
:
def
values
(
self
,
data_name
:
str
)
->
np
.
ndarray
:
"""
Reduce
the data in the MeshSeries
with a function
.
Get
the data in the MeshSeries
for all timesteps
.
:param func: The function by which the data is reduced.
Must contain `out` and `axis` as arguments,
e.g. np.max.
:param data_name: Name of the data in the MeshSeries.
:returns: A
pyvista Mesh containing
the re
duc
ed data
.
:returns: A
numpy array of
the re
quest
ed data
for all timesteps
"""
mesh
=
self
.
read
(
0
).
copy
()
if
self
.
_data_type
==
"
xdmf
"
:
vals
=
self
.
hdf5
[
"
meshes
"
][
self
.
hdf5_bulk_name
][
data_name
]
return
self
.
hdf5
[
"
meshes
"
][
self
.
hdf5_bulk_name
][
data_name
]
if
self
.
_data_type
==
"
pvd
"
:
vals
=
[
self
.
read
(
t
)[
data_name
]
for
t
in
tqdm
(
self
.
timesteps
)]
func
(
vals
,
out
=
mesh
[
data_name
],
axis
=
0
)
return
mesh
return
[
self
.
read
(
t
)[
data_name
]
for
t
in
tqdm
(
self
.
timesteps
)]
return
mesh
[
data_name
]
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