Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
fluiddyn
fluidsim
Commits
aabda5fc1de1
Commit
0695290f
authored
Mar 22, 2021
by
Jason Reneuve
Browse files
speedup load_time_series
parent
71aebd52c49a
Changes
1
Show whitespace changes
Inline
Side-by-side
fluidsim/base/output/spatiotemporal_spectra.py
View file @
aabda5fc
...
...
@@ -329,6 +329,12 @@ class SpatioTemporalSpectra(SpecificOutput):
times
=
[]
for
path
in
paths_1st_rank
:
with
h5py
.
File
(
path
,
"r"
)
as
file
:
tmax_file
=
file
[
"times"
][
-
1
]
if
tmax_file
<
tmin
:
continue
tmin_file
=
file
[
"times"
][
0
]
if
tmin_file
>
tmax
:
break
times_file
=
file
[
"times"
][:]
cond_times
=
(
times_file
>=
tmin
)
&
(
times_file
<=
tmax
)
times
.
append
(
times_file
[
cond_times
])
...
...
@@ -358,14 +364,21 @@ class SpatioTemporalSpectra(SpecificOutput):
f
"spect_
{
k
}
"
:
np
.
empty
(
spect_shape
,
dtype
=
"complex"
)
for
k
in
self
.
keys_fields
}
# loop on all files
for
path_file
in
track
(
paths
,
description
=
"Rearranging..."
):
# loop on all files, rank by rank
for
rank
in
track
(
ranks
,
description
=
"Rearranging..."
):
paths_rank
=
[
p
for
p
in
paths
if
p
.
name
.
startswith
(
f
"rank
{
rank
:
05
}
"
)
]
for
path_file
in
paths_rank
:
# for a given rank, paths are sorted by time
with
h5py
.
File
(
path_file
,
"r"
)
as
file
:
# check if the file contains the time we're looking for
tmin_file
=
file
[
"times"
][
0
]
tmax_file
=
file
[
"times"
][
-
1
]
if
(
tmin_file
>
tmax
)
or
(
tmax_file
<
tmin
)
:
if
tmax_file
<
tmin
:
continue
tmin_file
=
file
[
"times"
][
0
]
if
tmin_file
>
tmax
:
break
# time indices
times_file
=
file
[
"times"
][:]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment