Commit 8c09117a authored by inhuszar's avatar inhuszar
Browse files

Bugfix: mask combination if both masks are specified.

parent bc50fbfb
......@@ -455,15 +455,21 @@ class Cost(TIRLObject):
if not sm and not tm:
return None
# Return target mask if source mask is not defined
elif tm:
elif tm and not sm:
return target_mask
# Return source mask if target mask is not defined
elif sm:
elif sm and not tm:
return source_mask
# Create composite mask if both masks are defined
mm = self.metaparameters.get("maskmode")
# Enforce the "and" match mode if need to mask missing data. With
# the "or" method, the mask values may end up 0.5 instead of 0.
mm = "and"
mm = self.metaparameters.get("maskmode")
if mm == "and":
# Negative values are impossible, hence NaNs are not expected.
return (source_mask * target_mask) ** 0.5
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