NCO:ncap2 and .total

ncap2 -s 'summed_variable=variable_to_sum.total($lat,$lon)' in.nc out.nc

Make sure to use single quotes.

If your in.nc==out.cnc then adding -A will save you from having to specify “overwrite” (see this).

ncap2 -A -s 'summed_variable=variable_to_sum.total($lat,$lon)' in.nc out.nc