Skip to content
Open
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
18 changes: 18 additions & 0 deletions digitalearthau/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ def simple_object_repr(o):
def wofs_fuser(dest, src):
"""
Fuse two WOfS water measurements represented as `ndarray`s.

This fuser is intended for de-duplication of WOfS observations
(where a single observation pass is represented in overlapping scenes).
It is not advised for compositing of multiple independent observations.

The first bit in the WOfS bitfield indicates a lack of data,
i.e. pixels that are outside of the valid area for that layer.
For example, in regions of non-overlap, at least one layer will have nodata set.
All other bits are meaningless, and the layer is expected to be disregarded,
where nodata is set.

The following 6 (for some contexts arguably 7) bits indicate various positive reasons
for imputing an observation. (Most downstream applications will discard imputed data,
but applications can differ in which bits/reasons they consider/ignore when doing so.)
The fuser conservatively flags the output pixel if either layer validly found a
positive issue with it. For example a shadow may be cast on a near-boundary pixel by
something (e.g. cloud) that is outside of the extent of one scene but is able to be
detected in an overlapping scene.
"""
empty = (dest & 1).astype(numpy.bool)
both = ~empty & ~((src & 1).astype(numpy.bool))
Expand Down