Project

General

Profile

c = Cdo() Error

Added by Zhan Shi over 2 years ago

Hello,

I have a probably silly question, but I appreciate if anyone could help me solve it.

I first downloaded it via pip and got error when running Cdo():
TypeError: expected str, bytes or os.PathLike object, not NoneType

It's a really old version (1.5.6) and the error seemed to come from :

-->self.operators = self.__getOperators()
-->version = parse_version(getCdoVersion(self.CDO))
-->proc = subprocess.Popen([path2cdo, '-V'], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
-->self._execute_child(args, executable, preexec_fn, close_fds,....

But after I downloaded the latest version (2.0.5) I got this error:

from cdo import Cdo
c = Cdo()

-->> Could not load xarray!! <<--
-->> Could not load netCDF4! <<--

I got clues that I need to make some changes on function __getOperators() but failed. (here's the link: http://www.bamboodream.sakura.ne.jp/hiroblog/?page_id=552)
Does anybody know hot to fix it? T T

Regards,
Eden


Replies (4)

RE: c = Cdo() Error - Added by Luke Davis over 2 years ago

The cdo python binding seems to be maintained on github (https://github.com/Try2Code/cdo-bindings), you might get more help posting an issue there too.

If you haven't already you should run pip install netCDF4 xarray or conda install -c conda-forge netCDF4 array, outside of that not sure what the problem is.

RE: c = Cdo() Error - Added by Ralf Mueller over 2 years ago

hi!

xarray and netCDF4 are optional dependencies of the python bindings. so these messages are just warnings, not errors.

cheers
ralf

RE: c = Cdo() Error - Added by Lixu Jin over 2 years ago

How do you get the latest version?

RE: c = Cdo() Error - Added by Ralf Mueller over 2 years ago

conda install -c conda-forge cdo python-cdo

    (1-4/4)