Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8,698 changes: 8,698 additions & 0 deletions demo/dask-scl-poc.ipynb

Large diffs are not rendered by default.

477 changes: 474 additions & 3 deletions semantique/datacube.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions semantique/processor/arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ def delineate(self, track_types = True, **kwargs):

"""
# Get and check array.
obj = xr.apply_ufunc(utils.null_as_zero, self._obj)
obj = utils.apply_ufunc(utils.null_as_zero, self._obj)
if track_types:
vtype = obj.sq.value_type
if vtype is not None and vtype != "binary":
Expand Down Expand Up @@ -816,7 +816,7 @@ def delineate(self, track_types = True, **kwargs):
f"and/or '{SPACE}', not: {list(dims)}"
)
# Delineate.
out = xr.apply_ufunc(lambda x, y: ndimage.label(x, y)[0], obj, nb)
out = utils.apply_ufunc(lambda x, y: ndimage.label(x, y)[0], obj, nb)
# Post-process.
out = out.where(pd.notnull(self._obj)) # Preserve nan.
if track_types:
Expand Down
17 changes: 9 additions & 8 deletions semantique/processor/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1086,14 +1086,15 @@ def call_verb(self, name, params):
verb = getattr(obj.sq, name)
out = verb(**params)
# Warn when output array is empty.
try:
is_empty = out.sq.is_empty
except AttributeError:
is_empty = out.is_empty
if is_empty:
warnings.warn(
f"Verb '{name}' returned an empty array"
)
# Removed for Dask. TODO: Put behind config flag.
# try:
# is_empty = out.sq.is_empty
# except AttributeError:
# is_empty = out.is_empty
# if is_empty:
# warnings.warn(
# f"Verb '{name}' returned an empty array"
# )
logger.debug(f"Applied verb {name}:\n{out}")
return out

Expand Down
Loading