replacecloud

Description

replacecloud (written by A. Y. / JCU, May 1990) is the final step in the cloud-masked Landsat destriping pipeline. After removecloud, lsfilter, add_hilo, and limit_change have been run, replacecloud restores the original unclipped cloud pixels from <cloud_file> back into the destriped ACRES image (-in).

CLI Options & Usage

replacecloud -in <destriped_acres_file> -cloud <cloud_file>
  • -in <destriped_acres_file>: Destriped ACRES-format 8-bit image (updated in-place).
  • -cloud <cloud_file>: .cloud file previously extracted by removecloud.

Algorithm

  1. Reads the 90-byte ACRES header from <destriped_acres_file> to determine row and col, and skips the 90-byte header of <cloud_file>.
  2. Scans all row × col pixels in lockstep: wherever <cloud_file> contains a non-zero byte (c != 0), seeks back 1 byte in <destriped_acres_file> and overwrites the clamped pixel with the original cloud intensity c.