Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set default threshold to 0.1 and merged datam and threahold mask into one #92

Merged
merged 1 commit into from
Apr 9, 2024
Merged
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
9 changes: 2 additions & 7 deletions src/cogserver/algorithms/rca.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RapidChangeAssessment(BaseAlgorithm):
"""Rapid change assessment."""
# parameters
threshold: float = Field(
default=0.5, ge=0.1, le=1.0,
default=0.1, ge=0.1, le=1.0,
title="Threshold(%)",
description="Only pixels with change above this threshold will be returned"
)
Expand Down Expand Up @@ -76,13 +76,8 @@ def __call__(self, img: ImageData) -> ImageData:
valid_mask = (img.array[2].astype('uint8') > self.cloud_mask_value) | (img.array[3].astype('uint8') > self.cloud_mask_value)
diff = b2-b1
data = diff
v = 0.1
#v = data.ptp()*.1
datam = (data > -v) & (data < v)
datam = (data > -self.threshold) & (data < self.threshold)
valid_mask |= datam
if self.threshold:
threshold_mask = np.abs(data)< self.threshold
valid_mask |= threshold_mask

arr = numpy.ma.masked_array(data*100, dtype=self.output_dtype, mask=valid_mask)
return ImageData(
Expand Down