Skip to content

Commit

Permalink
fix: changed threshold value range from 10 to 100, and divide by 100 …
Browse files Browse the repository at this point in the history
…in algorithm (#96)
  • Loading branch information
JinIgarashi authored Apr 26, 2024
1 parent 4b20e28 commit ade941d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/cogserver/algorithms/rca.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ class RapidChangeAssessment(BaseAlgorithm):
"""Rapid change assessment."""
# parameters
threshold: float = Field(
default=0.1, ge=0.1, le=1.0,
title="Threshold(%)",
default=10, ge=10, le=100,
title="Threshold",
unit="%",
description="Only pixels with change above this threshold will be returned"
)

Expand Down Expand Up @@ -76,7 +77,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
datam = (data > -self.threshold) & (data < self.threshold)
threshold = self.threshold / 100
datam = (data > -threshold) & (data < threshold)
valid_mask |= datam

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

0 comments on commit ade941d

Please sign in to comment.