---
name: "ncwa"
section: "1"
platform: "linux"
package: "nco"
version: "5.3.3-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/ncwa"
---

# ncwa(1)

netCDF Weighted Averager

## NAME

ncwa - netCDF Weighted Averager

## SYNTAX

ncwa \[-3\] \[-4\] \[-5\] \[-6\] \[-7\] \[-A\] \[-a  *dim*\[,...\]\] \[-B  *mask\_cond\]* \[-b\] \[--bfr *sz\_byt*\]*\[-C\]*\[-c\] \[--cmp *cmp\_sng*\] \[--cnk\_byt *sz\_byt*\]*\[--cnk\_csh* *sz\_byt*\]*\[--cnk\_dmn* *nm,sz\_lmn*\] \[--cnk\_map  *map*\] \[--cnk\_min *sz\_byt*\] \[--cnk\_plc  *plc*\] \[--cnk\_scl  *sz\_lmn*\]*\[-D* *dbg\_lvl*\] \[-d  *dim*,\[ *min*\]\[,\[ *max*\]\]\] \[--dbl\|flt\] \[-F\] \[--fl\_fmt=fmt\] \[-G *gpe\_dsc*\] \[-g   *grp*\[,...\]\] \[--glb *att\_name=* *att\_val*\]\] \[-H\] \[-h\] \[--hdf\] \[--hdr\_pad *sz\_byt*\]*\[--hpss\_try\]* \[-I\] \[-L  *dfl\_lvl*\]*\[-l* *path*\] \[-M  *val*\] \[-m  *mask*\] \[-N\] \[--no\_cll\_msr\] \[--no\_cll\_mth\] \[--no\_frm\_trm\] \[--no\_tmp\_fl\] \[-O\] \[-o  *output-file*\] \[-p  *path*\] \[--qnt *var1*\[, *var2*\[,...\]\]= *prc*\]\] \[--qnt\_alg *alg\_nm\]* \[-R\] \[-r\] \[--ram\_all\] \[-T *mask\_comp*\] \[-t *thr\_nbr*\] \[--uio\] \[--unn\] \[-v  *var*\[,...\]\] \[-w  *weight*\] \[-x\] \[-y  *op\_typ*\] *input-file* *output-file*

## DESCRIPTION

**ncwa** averages variables in a single file over arbitrary dimensions, with options to specify weights, masks, and normalization.    The default behavior of  **ncwa** is to arithmetically average every numerical variable over all dimensions and produce a scalar result. To average variables over only a subset of their dimensions, specify these dimensions in a comma-separated list following  **-a**, e.g., **-a time,lat,lon**. As with all arithmetic operators, the operation may be restricted to an arbitrary hypserslab by employing the  **-d** option **ncwa** also handles values matching the variable's **\_FillValue** attribute correctly.  Moreover,  **ncwa** understands how to manipulate user-specified weights, masks, and normalization options. With these options,  **ncwa** can compute sophisticated averages (and integrals) from the command line.

*mask* and  *weight*, if specified, are broadcast to conform to the variables being averaged.  The rank of variables is reduced by the number of dimensions which they are averaged over.   Thus arrays which are one dimensional in the  *input-file* and are averaged by  **ncwa** appear in the  *output-file* as scalars. This allows the user to infer which dimensions may have been averaged. Note that that it is impossible for  **ncwa** to make make a *weight* or  *mask* of rank  *W* conform to a  *var* of rank  *V* if  *W \> V*. This situation often arises when coordinate variables (which, by definition, are one dimensional) are weighted and averaged. **ncwa** assumes you know this is impossible and so  **ncwa** does not attempt to broadcast  *weight* or  *mask* to conform to *var* in this case, nor does  **ncwa** print a warning message telling you this, because it is so common.   Specifying  *dbg \> 2* does cause  **ncwa** to emit warnings in these situations, however.

Non-coordinate variables are always masked and weighted if specified. Coordinate variables, however, may be treated specially. By default, an averaged coordinate variable, e.g.,  **latitude**, appears in  *output-file* averaged the same way as any other variable containing an averaged dimension. In other words, by default  **ncwa** weights and masks coordinate variables like all other variables.   This design decision was intended to be helpful but for some applications it may be preferable not to weight or mask coordinate variables just like all other variables.    Consider the following arguments to  **ncwa**: “-a latitude -w lat\_wgt -d latitude,0.,90.” where  **lat\_wgt** is a weight in the **latitude** dimension. Since, by default  **ncwa** weights coordinate variables, the value of  **latitude** in the  *output-file* depends on the weights  in  *lat\_wgt* and is not likely to be 45.---the midpoint latitude of the hyperslab. Option  **-I** overrides this default behavior and causes  **ncwa** not to weight or mask coordinate variables. In the above case, this causes the value of  **latitude** in the *output-file* to be 45.---which is a somewhat appealing result. Thus,  **-I** specifies simple arithmetic averages for the coordinate variables.  In the case of latitude,  **-I** specifies that you prefer to archive the central latitude of the hyperslab over which variables were averaged  rather than the area weighted centroid of the hyperslab. Note that the default behavior of ( **-I**) changed on 1998/12/01---before this date the default was not to weight or mask coordinate variables. The mathematical definition of operations involving rank reduction  is given above.

## AUTHOR

**NCO** manual pages written by Charlie Zender and originally formatted by Brian Mays.

## REPORTING BUGS

Report bugs to \<http://sf.net/bugs/?group\_id=3331\>.

## COPYRIGHT

Copyright © 1995-present Charlie Zender\
 This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

## SEE ALSO

The full documentation for **NCO** is maintained as a Texinfo manual called the  **NCO Users Guide.** Because  **NCO** is mathematical in nature, the documentation includes TeX-intensive portions not viewable on character-based displays.  Hence the only complete and authoritative versions of the  **NCO Users Guide** are the PDF (recommended), DVI, and Postscript versions at \<http://nco.sf.net/nco.pdf\>, \<http://nco.sf.net/nco.dvi\>, and \<http://nco.sf.net/nco.ps\>, respectively. HTML and XML versions are available at \<http://nco.sf.net/nco.html\> and \<http://nco.sf.net/nco.xml\>, respectively.

If the **info** and **NCO** programs are properly installed at your site, the command

-

  **info nco**

should give you access to the complete manual, except for the TeX-intensive portions.

[**ncap2**(1)](/ncap2/1.md), [**ncatted**(1)](/ncatted/1.md), [**ncbo**(1)](/ncbo/1.md), [**ncclimo**(1)](/ncclimo/1.md), [**nces**(1)](/nces/1.md), [**ncecat**(1)](/ncecat/1.md), [**ncflint**(1)](/ncflint/1.md), [**ncz2psx**(1)](/ncz2psx/1.md), [**ncks**(1)](/ncks/1.md), [**nco**(1)](/nco/1.md), [**ncpdq**(1)](/ncpdq/1.md), [**ncra**(1)](/ncra/1.md), [**ncrcat**(1)](/ncrcat/1.md), [**ncremap**(1)](/ncremap/1.md), [**ncrename**(1)](/ncrename/1.md), [**ncwa**(1)](/ncwa/1.md)

## HOMEPAGE

The  **NCO** homepage at \<http://nco.sf.net\> contains more information.
