简体   繁体   中英

Trouble with cdo commands in Python

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.

sinfon 命令

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM