Compare two remap-weight map files in NetCDF (SCRIP) format. Loads each file's sparse weight matrix into an Eigen sparse representation, then reports differences in row, col, S entries and matrix norms. Useful for validating that a refactored remap workflow still produces the same matrix, or for diffing two implementations.
The other map-file fields —
xc,yc,area,frac— are best diffed withncdifffrom NCO.compareMapsfocuses on the sparse-matrix entries.
Requires both NetCDF and Eigen3. Build via CMake or autotools; the tool is gated by MOAB_HAVE_EIGEN3 (set by -DENABLE_EIGEN3=ON in CMake).
Binary name on disk is
mbcmpmaps.
| Flag | Default | Description |
|---|---|---|
-i <map1.nc>, --firstMap <map1.nc> | — | First input map file (SCRIP weights). |
-j <map2.nc>, --secondMap <map2.nc> | — | Second input map file. |
-p <n>, --print_differences <n> | 0 | Print up to <n> per-entry differences to stdout. Useful for spot-checking which weights diverged. |
-t <eps>, --tolerance <eps> | — | Pass/fail threshold. The tool exits with code 1 if any matrix-norm difference exceeds <eps>; 0 otherwise. If unset, the tool only reports diagnostics and always exits 0. |
For each map file, the tool extracts the dimensions n_a, n_b, n_s and the row[], col[], S[] variables; it constructs an Eigen::SparseMatrix<double> of size n_b × n_a from them. Then between the two matrices it reports:
-p N, prints up to N entries that differ, ordered by magnitude of the difference.ncdiff (from NCO) — for diffing xc / yc / area / frac outside the sparse matrix