I am trying to set a reference time in a netcdf file with the command in python.
i have tried the following.
from cdo import *
cdo = Cdo()
cdo(input = "infile.nc", output = "outfile.nc", options = "2022-12-01,12:00:00")
Once i run this command all the dates in the file changes to 0001-01-01 instead of the one set in options.
i have also tried the following command.
cdo.setreftime("2022-12-01,12:00:00", input="infile.nc", output = "outfile.nc)
which gives the same result.
Grateful for any help.
The correct command should look like
cdo.setreftime("2022-12-01,12:00:00,1hours", input=infile.nc, output=outfile.nc)
and
cdo -setreftime,"2022-12-01,12:00:00,1hours" infile.nc outfile.nc