Project

General

Profile

CDO chaining in python

Added by Ilias Moysidis about 1 year ago

Is there a way of inserting all the operators as input with the Cdo python package, the same way we would execute the command with terminal-syntax?

For example suppose that we have a netcdf file infile.nc and we want to first apply yearsum and then timmean. We can do this in python with the following line of code:

Cdo().timmean(input="-yearsum infile.nc", output="outfile.nc")

Is there a way to do something like

Cdo(input="-timmean -yearsum infile.nc", output="outfile.nc")?


Replies (1)

RE: CDO chaining in python - Added by Ralf Mueller about 1 year ago

Hi Ilias!

No, there is no such thing. Cdo() is the constructor call, which is part of the python syntax. so no change to overwrite it with any operator call.

BUT: you can use the clone or the copy operator. it has some overhead, but might be negligible

cheers
ralf

    (1-1/1)