Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coyote
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nils
coyote
Commits
231535a8
Commit
231535a8
authored
1 month ago
by
Nils-Arne Dreier
Committed by
Siddhant Tibrewal
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: first timestep is not startdate but startdate + dt
parent
582fe58e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#100842
waiting for manual action
Stage: lint
Stage: build
Stage: test
Stage: verify
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/hiopy/configure/configure.py
+3
-3
3 additions, 3 deletions
apps/hiopy/configure/configure.py
apps/hiopy/worker.py
+5
-6
5 additions, 6 deletions
apps/hiopy/worker.py
with
8 additions
and
9 deletions
apps/hiopy/configure/configure.py
+
3
−
3
View file @
231535a8
...
...
@@ -9,10 +9,10 @@ def add_time(dataset, startdate, enddate, dt, name="time"):
startdate
=
np
.
datetime64
(
startdate
)
if
type
(
enddate
)
is
str
:
enddate
=
np
.
datetime64
(
enddate
)
if
type
(
dt
)
is
int
:
dt
=
np
.
timedelta64
(
dt
,
"
s
"
)
time_data
=
(
np
.
arange
(
startdate
,
enddate
,
np
.
timedelta64
(
dt
,
"
s
"
))
-
startdate
)
//
np
.
timedelta64
(
1
,
"
s
"
)
time_data
=
(
np
.
arange
(
startdate
+
dt
,
enddate
+
dt
,
dt
)
-
startdate
)
//
np
.
timedelta64
(
1
,
"
s
"
)
for
g
in
_collect_groups
(
dataset
):
time
=
g
.
create_dataset
(
name
,
data
=
time_data
,
fill_value
=
None
,
shape
=
time_data
.
shape
)
...
...
This diff is collapsed.
Click to expand it.
apps/hiopy/worker.py
+
5
−
6
View file @
231535a8
...
...
@@ -131,15 +131,14 @@ def main():
"
seconds since
"
in
time_coordinate
.
attrs
[
"
units
"
]
),
"
Currently the time must be given in seconds
"
dt
=
time_coordinate
[
1
]
-
time_coordinate
[
0
]
# compute time start index
t0
=
(
np
.
datetime64
(
start_datetime
())
-
np
.
datetime64
(
var_group
[
"
time
"
].
attrs
[
"
units
"
][
len
(
"
seconds since
"
)
:])
)
/
np
.
timedelta64
(
1
,
"
s
"
)
t0_idx
=
np
.
searchsorted
(
var_group
[
"
time
"
],
t0
)
assert
var_group
[
"
time
"
][
t0_idx
]
==
t0
,
"
start_datetime not found in time axis
"
dt
=
time_coordinate
[
t0_idx
+
1
]
-
time_coordinate
[
t0_idx
]
-
np
.
datetime64
(
var_group
[
time_dim_name
].
attrs
[
"
units
"
][
len
(
"
seconds since
"
)
:])
)
/
np
.
timedelta64
(
1
,
"
s
"
)
+
dt
t0_idx
=
np
.
searchsorted
(
var_group
[
time_dim_name
],
t0
)
assert
var_group
[
time_dim_name
][
t0_idx
]
==
t0
,
"
start_datetime not found in time axis
"
# see YAC_REDUCTION_TIME_NONE etc. (TODO: pass constants through coyote)
time_methods2yac
=
{
"
point
"
:
0
,
"
sum
"
:
1
,
"
mean
"
:
2
,
"
min
"
:
3
,
"
max
"
:
4
}
...
...
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