Why splitting a netCDF with ncks changes its dates?

46 Views Asked by At

I'm working with heavy netCDF files and would like to split them by dates to make them easier to manage.

My netCDF dates are from 01/01/2023 00:00:00 to 04/01/2023 00:00:00. I used the following commands to divide my netCDF:

ncks -d time,0,23 mynetCDF.nc out1.nc
ncks -d time,24,47 mynetCDF.nc out2.nc
ncks -d time,48,71 mynetCDF.nc out3.nc

If I understand correctly, each out*.nc should therefore correspond to different time steps. I thought I'd get the following dates:

  • out1.nc from 01/01/2023 00:00:00 to 01/01/2023 23:00:00
  • out2.nc from 02/01/2023 00:00:00 to 02/01/2023 23:00:00
  • out3.nc from 03/01/2023 00:00:00 to 03/01/2023 23:00:00

But all the dates go from 01/01/2023 00:00:00 to 01/01/2023 23:00:00 and I don't understand why. Why is the date blocked on the first 24 hours of mynetCDF.nc for all releases?

Thank you.

1

There are 1 best solutions below

0
On

My guess, purely from the timestep indices you use to hyperslab, is that your input file is 72 timesteps per day, or something like that. In any case, NCO treats integer hyperslab indexes as timesteps. You must place a decimal after the index for NCO to interpret it as a coordinate value. Please read more about hyperslabing time value using the built-in date recognition from UDUnits here. An example command you can try is

ncks -d time_udunits,"2023-01-01 00:00:00","2023-01-01 23:59:59" mynetCDF.nc out1.nc