0

I am having trouble trying to combine three files to be averaged. I am not so sure how to even start. I have three files

"nday1.06.nc , nday1.07.nc, nday.08.nc"

each with the variables

"filling on), ('SST', <class 'netCDF4._netCDF4.Variable'>
          float32 SST(time, nlat, nlon)
              long_name: Surface Potential Temperature
              units: degC
              coordinates: TLONG TLAT time
              grid_loc: 2110
              cell_methods: time: mean time: mean time: mean
              _FillValue: 9.96921e+36
          missing_value: 9.96921e+36
          unlimited dimensions: time
          current shape = (1, 2400, 3600)

I just need to average the SST variables and then an output file with the averages

ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
posh8593
  • 21
  • 4

2 Answers2

2

You need ncra not ncwa

http://nco.sourceforge.net/nco.html#ncra

 ncra nday1.06.nc nday1.07.nc nday.08.nc out.nc
Eric Bridger
  • 3,751
  • 1
  • 19
  • 34
  • 1
    Hello! Thank you! I was wondering, my out.nc file actually shows up as out.nc.pid44706.ncra.tmp in my directory. Will it still work as an .nc file when I use it in python? – posh8593 Aug 08 '18 at 19:18
  • 1
    My guess is that's the result of some error in your input files, try first with 2 files. I'm no expert in nco tools. – Eric Bridger Aug 09 '18 at 16:39
  • 1
    Yes, it should work as a .nc file and yes, Eric is right, the fact that it is there means there was an error somewhere. Suggest upgrading to latest NCO. – Charlie Zender Aug 11 '18 at 16:17
1

Similarly, you could you use cdo, but you first need to merge the files:

cdo mergetime nday1.06.nc nday1.07.nc nday.08.nc mergedfile.nc

and then average:

cdo timmean mergedfile.nc out.nc

msi_gerva
  • 2,021
  • 3
  • 22
  • 28