1

I have a dataset at hourly timesteps and I am interpolating it to 30-min with 'inttime' in cdo. However, the timestamp outputted is not correct, it is just duplicated from the original data. How can I correct that using cdo (or nco)?

I am interpolating the data with 'cdo inttime,date,time,inc ifile.nc ofile.nc'.

This is what I have after the interpolation... 2000-01-01 01:00:00, 2000-01-01 01:00:00, 2000-01-01 02:00:00, 2000-01-01 02:00:00, etc.

But this is what I want to have after the interpolation... 2000-01-01 01:00:00, 2000-01-01 01:30:00, 2000-01-01 02:00:00, 2000-01-01 02:30:00, etc.

Thanks in advance for all the help!

Cheers, M.

ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
  • tricky, cdo shifttime shifts *all* steps in the file, so that won't help. I've not used that function in cdo myself. Weird it doesn't handle the time step in a sensible way, I wonder if it is even a bug? I corrected your question tag by the way – ClimateUnboxed Feb 21 '21 at 11:45
  • Can you clarify the question? `cdo inttime,date,time,inc ifile.nc ofile.nc` is not a valid CDO call. What was your actual call? The issue described should not occur, as far as I know. It looks like ofile.nc is just the original data copied – Robert Wilson Feb 21 '21 at 17:07

1 Answers1

2

You can correct the time variable after its mis-interpolation by assigning it to an arithmetically increasing array with ncap2, e.g., if units are hours since start day, then something like the following...

ncap2 -s 'time=array(1.0,0.5,$time)' in.nc out.nc

ncap2 can also interpolate using GSL, but the CDO formulation appears much simpler so I wouldn't bother trying to change that.

Charlie Zender
  • 5,929
  • 14
  • 19