Skip to content

CLI_mask

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

Masking Functionality

Applies a NetCDF mask to another NetCDF file with the same grid. The operation is performed per variable and per cell:

output = file * mask

If --inverse_mask is set, the mask is inverted before applying:

output = file * (1 - mask)

Table of Contents


Syntax

nes mask -f <file.nc> -m <mask.nc> -o <output.nc> -l <var1 var2 ...> -v <mask_variable> [--inverse_mask]

Use -h or --help to view the full list of available options:

nes mask --help

Arguments

Argument Description
-f, --file (required) Path to the base NetCDF file.
-m, --mask (required) Path to the NetCDF file containing the mask.
-o, --output_file Required output NetCDF path
-l, --var_list Space-separated list of NetCDF variables (pollutants) to include. If omitted, all variables are processed.
-v, --var_mask Name of the mask variable in the mask NetCDF file; defaults to mask.
--inverse_mask Invert mask values before applying (1 - mask). A warning is emitted if the mask is outside the [0, 1] range. Default: 'false'

Notes

  • No regridding is performed: selected variables and the mask variable must have the same shape.
  • If a variable does not exist in the base file or shapes do not match, the command fails with an error.
  • --inverse_mask is supported and applies 1 - mask before multiplication.

Example

nes mask -f baseline.nc -m landmask.nc -o masked.nc -l pm2p5oc o3 -v mask --inverse_mask

Clone this wiki locally