I have daily data in NETCDF format and every ".nc" file include one year of data while I have data for 1948 to 2017. The name of files are like this: tmax.2m.gauss.1948.nc tmax.2m.gauss.1949.nc .. tmax.2m.gauss.2017.nc
I want to merge all of them into one ".nc" file. I don't know how exactly I can work with "CDO" or "ncrcat". I wrote this:
for year in range(1948,2017):
year_files = glob.glob('D:/Dissertation/Data/NCEP-NCAR/tmax.2m.gauss.}.nc'.format (year))
subprocess.call(['ncrcat'] + year_files + ['-O'])
ncfile = netCDF4.Dataset(year_files, 'r')
But I received error and it does not work. Does anyone know how exactly I can merge all 70 NETCDF files into one file?