title: Extract and sum certain layers of NetCDF variable
body: <p>I have a NetCDF file, here is a truncated output of <code>ncdump -h</code>:</p>
  
  <pre><code>dimensions:
      lat = 720 ;
      lon = 1440 ;
      cft = 64 ;
      natpft = 14 ;
  double PCT_CFT(cft, lat, lon) ;
      PCT_CFT:long_name = "percent cft" ;
      PCT_CFT:units = "unitless" ;
      PCT_CFT:_FillValue = -9999. ;
      PCT_CFT:coordinates = "LON LAT" ;
  double PCT_NAT_PFT(natpft, lat, lon) ;
      PCT_NAT_PFT:long_name = "percent pft" ;
      PCT_NAT_PFT:units = "unitless" ;
      PCT_NAT_PFT:_FillValue = -9999. ;
      PCT_NAT_PFT:coordinates = "LON LAT" ;
  </code></pre>
  
  <p>What I need is to extract and sum values from the variable <code>PCT_CFT</code> for the layers 3, 4, 61 and 62 along the dimension <code>cft</code> and then sum up almost all the remaining layers (ie. 5-60, 63, 64) and add these two results to the variable <code>PCT_NAT_PFT</code> as layers 16 and 15 along the dimension <code>natpft</code> respectively. </p>
  
  <p>I would like to achieve this using NCO (or CDO) if possible, I want to avoid using other tools like Python or R... I only know how to sum up the variable across the whole dimension but not across selected layers only - I could therefore probably work around this problem, but I'd like to know if there's a better and cleaner way to do so.</p>