Commit d91c83a6 authored by Klaus Zimmermann's avatar Klaus Zimmermann
Browse files

Fix SpellLength (closes #104)

Fixes two bugs in SpellLength:

* Remove superfluous kwargs
* Add proper masking
parent c7795cc2
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment