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
climix
climix
Commits
d91c83a6
Commit
d91c83a6
authored
Sep 26, 2019
by
Klaus Zimmermann
Browse files
Fix SpellLength (closes
#104
)
Fixes two bugs in SpellLength: * Remove superfluous kwargs * Add proper masking
parent
c7795cc2
Changes
1
Hide whitespace changes
Inline
Side-by-side
climix/index_functions.py
View file @
d91c83a6
...
...
@@ -189,13 +189,17 @@ class SpellLength:
def
call_func
(
self
,
data
,
axis
,
**
kwargs
):
axis
=
normalize_axis
(
axis
,
data
.
ndim
)
return
np
.
apply_along_axis
(
self
,
axis
=
axis
,
arr
=
data
,
**
kwargs
)
mask
=
np
.
ma
.
getmaskarray
(
data
).
any
(
axis
=
axis
)
res
=
np
.
apply_along_axis
(
self
,
axis
=
axis
,
arr
=
data
)
res
=
np
.
ma
.
masked_array
(
np
.
ma
.
getdata
(
res
),
mask
)
return
res
.
astype
(
'float32'
)
def
lazy_func
(
self
,
data
,
axis
,
**
kwargs
):
axis
=
normalize_axis
(
axis
,
data
.
ndim
)
return
da
.
apply_along_axis
(
self
,
axis
=
axis
,
arr
=
data
,
**
kwargs
)
mask
=
da
.
ma
.
getmaskarray
(
data
).
any
(
axis
=
axis
)
res
=
da
.
apply_along_axis
(
self
,
axis
=
axis
,
arr
=
data
)
res
=
da
.
ma
.
masked_array
(
da
.
ma
.
getdata
(
res
),
mask
)
return
res
.
astype
(
'float32'
)
def
__call__
(
self
,
raw_data
):
data
=
self
.
condition
(
raw_data
,
self
.
threshold
.
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