netcdfnco

Using nco to convert NetCDF file with monthly data into daily files


I have a year of data as monthly NetCDF files, and I'd like to turn them into daily files. I know I can use ncks to extract 24 hours, like this

ncks -d time,0,23 -o output.nc input.nc

but I'd like to automatically chunk the whole month into days, without having to worry about the number of days in each month and whatnot. Is there an easy way to do this? (I could of course write a python script or similar that calls ncks, but it would be more elegant to avoid that.)


Solution

  • From the question it is not clear to me if your monthly files contain daily data. i.e. you have 12 files and each file contains daily (or finer) time resolution information. If this is the case then I think what you want to do is very easy with cdo using

    cdo splitday input.nc output 
    

    you will end up with a number of files, each with a day of data, and the number of days in each month is handled automatically for you.