Skip to content

CLI_diffper

Carles Tena edited this page Oct 6, 2026 · 1 revision

diffper

Compute percentage differences per variable and cell: 100 * (file2 - file1) / (file1 + eps). file1 is the baseline and file2 is the comparison. Output units are %. With eps=0, zero baseline values can produce NaN or Inf.

nes diffper -1 baseline.nc -2 comparison.nc -o difference.nc -l NO2 O3
Argument Meaning
-1 Required baseline file
-2 Required comparison file
-o, --output_file Required output file
-l, --var_list Optional variable list; defaults to shared data variables
--eps Constant added to the denominator; default 0.0

For example: nes diffper -1 baseline.nc -2 comparison.nc -o change.nc --eps 1e-12. Choose eps in the units of the input variable; it changes the calculation and does not guarantee a nonzero denominator.

Variables explicitly selected must exist in both files. Shapes must match. The implementation checks shapes, but does not align coordinates or convert units: use inputs with matching grids, timestamps, levels and units.

Clone this wiki locally