Skip to content

Commit

Permalink
fix: set default threshold to 0.1 and merged datam and threahold mask…
Browse files Browse the repository at this point in the history
… into one
  • Loading branch information
JinIgarashi committed Apr 9, 2024
1 parent 6931206 commit 16b95f6
Showing 1 changed file with 2 additions and 7 deletions.
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

0 comments on commit 16b95f6

Please sign in to comment.