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
Klaus Zimmermann
climix
Commits
ff17c6cf
Commit
ff17c6cf
authored
Jul 22, 2021
by
Klaus Zimmermann
Browse files
Fix (dask) meta handling in spell functions (backport of !167)
parent
fd9f39c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
climix/index_functions/spell_functions.py
View file @
ff17c6cf
...
...
@@ -31,7 +31,8 @@ class SpellLength(ThresholdMixin, ReducerMixin, IndexFunction):
data
=
da
.
moveaxis
(
data
,
axis
,
-
1
)
res
=
da
.
reduction
(
data
,
self
.
chunk
,
self
.
aggregate
,
keepdims
=
True
,
output_size
=
4
,
axis
=-
1
,
dtype
=
int
,
concatenate
=
False
)
axis
=-
1
,
dtype
=
int
,
concatenate
=
False
,
meta
=
np
.
array
((),
dtype
=
int
))
res
=
da
.
ma
.
masked_array
(
da
.
ma
.
getdata
(
res
),
np
.
broadcast_to
(
mask
[...,
np
.
newaxis
],
res
.
shape
))
...
...
@@ -39,7 +40,7 @@ class SpellLength(ThresholdMixin, ReducerMixin, IndexFunction):
def
chunk
(
self
,
raw_data
,
axis
,
keepdims
,
computing_meta
=
False
):
if
computing_meta
:
return
np
.
array
((
0
,),
ndim
=
1
,
dtype
=
int
)
return
np
.
array
((
)
,
dtype
=
int
)
data
=
self
.
condition
(
raw_data
,
self
.
threshold
.
points
)
chunk_res
=
self
.
kernels
.
chunk
(
data
)
...
...
Write
Preview
Supports
Markdown
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