decr4
Description
decr4 downsamples a 32-bit floating-point (data_type = 3, .r4) OMG1 (JHC_header) bathymetric or backscatter grid by integer decimation factors (-count, or asymmetric -xcount / -ycount). It supports either valid-cell arithmetic averaging (default) or shoal-biased maximum selection (-shoal_bias), plus optional vertical datum offsetting (-add).
CLI Options & Usage
decr4 -in <infile.r4> -out <outfile.r4> \
[-count <n> | -xcount <nx> -ycount <ny>] \
[-ignore <val>] [-shoal_bias] [-add <offset>]
-in <infile.r4>: Input 32-bit floatOMG1.r4grid.-out <outfile.r4>: Output decimated.r4grid.-count <n>: Symmetric integer decimation factor applied to both X and Y (xcount = ycount = n).-xcount <nx> -ycount <ny>: Independent integer decimation factors for X (columns) and Y (rows).-ignore <val>: No-data flag value excluded from calculations (default:99999.0; any cell>= 9999.0is also ignored).-shoal_bias: Selects the maximum (shoalest, in negative-down depth convention) valid value in eachxcount à ycountblock instead of the mean.-add <offset>: Constant floating-point offset added to every valid output cell (default:0.0).
Algorithm
Updates xmax /= xcount, ymax /= ycount, dx *= xcount, and dy *= ycount in the JHC_header, then loops over each xcount à ycount window of source floats, computing either sum / good + added_bit or the shoalest value lowest + added_bit (writing 99999.0 when good == 0).