expandr4
Description
expandr4 is the 32-bit floating-point (data_type = 3, .r4) counterpart to expand. It upsamples (when -factor > 1) or downsamples (when -factor < -1) a georeferenced OMG1 .r4 bathymetric or backscatter grid using either nearest-neighbor block replication or two-pass bilinear interpolation (-interp) with optional no-data masking (-mask, 99999.0).
CLI Options & Usage
expandr4 -in <infile.r4> -out <outfile.r4> -factor <n> [-interp] [-mask]
-in <infile.r4>: Input 32-bit floatOMG1.r4file.-out <outfile.r4>: Output resampled 32-bit float.r4file.-factor <n>: Integer scale factor (> 1expands byn;< -1decimates by|n|).-interp: Performs bilinear interpolation between adjacent grid nodes.-mask: Prevents no-data values (>= 9999.0/99999.0) from being averaged into valid neighboring depth/backscatter cells during interpolation.
Algorithm
- Adjusts
xmax,ymax,dx, anddyin theJHC_headerbyfactor. - In
-interpmode, populates grid nodes(i * factor, j * factor)with source floats, linearly interpolates horizontally between valid row nodes(v1, v2), and then linearly interpolates vertically down allnew_xmaxcolumns, preserving99999.0whenever either endpoint is flagged and-maskis active.