1

I want to use climate data operator (CDO) in Windows 10 via Python 3.6. I have installed the CDO using conda install -c conda-forge cdo in Anaconda Prompt. Then I am calling it in Jupyter notebook using from cdo import *. But when I am using cdo = Cdo(), it is throwing me errors. It will be of great help if anyone can guide me to use CDO in python 3.6 installed in Windows 10. Following is the error report

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-2-ab9423485a93> in <module>()
----> 1 cdo=Cdo()

~\Anaconda3\lib\site-packages\cdo.py in __init__(self, returnCdf, returnNoneOnError, forceOutput, cdfMod, env, debug, tempdir, logging, logFile)
    120       self.CDO = 'cdo'
    121 
--> 122     self.operators              = self.getOperators()
    123     self.noOutputOperators      = [op for op in self.operators.keys() if 0 == self.operators[op]]
    124     self.returnCdf              = returnCdf

~\Anaconda3\lib\site-packages\cdo.py in getOperators(self)
    157     operators = {}
    158 
--> 159     version = parse_version(getCdoVersion(self.CDO))
    160     if (version < parse_version('1.7.2')):
    161       proc = subprocess.Popen([self.CDO,'-h'],stderr = subprocess.PIPE,stdout = subprocess.PIPE)

~\Anaconda3\lib\site-packages\cdo.py in getCdoVersion(path2cdo, verbose)
     46 
     47 def getCdoVersion(path2cdo,verbose=False):
---> 48   proc = subprocess.Popen([path2cdo,'-V'],stderr = subprocess.PIPE,stdout = subprocess.PIPE)
     49   ret  = proc.communicate()
     50   cdo_help   = ret[1].decode("utf-8")

~\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors)
    707                                 c2pread, c2pwrite,
    708                                 errread, errwrite,
--> 709                                 restore_signals, start_new_session)
    710         except:
    711             # Cleanup if the child failed starting.

~\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
    995                                          env,
    996                                          os.fspath(cwd) if cwd is not None else None,
--> 997                                          startupinfo)
    998             finally:
    999                 # Child is launched. Close the parent's copy of those pipe

FileNotFoundError: [WinError 2] The system cannot find the file specified
UseR10085
  • 7,120
  • 3
  • 24
  • 54
  • What error message do you get? – BenT Jul 17 '19 at 05:42
  • @BenT I have updated my question with the error message. – UseR10085 May 13 '20 at 10:59
  • 1
    When people have windows10 in my workshops, I usually get them to install the linux subsystem which is now very easy under windows 10, you can then easily install CDO using sudo apt-get install or indeed use cdo from python. – ClimateUnboxed Aug 28 '20 at 14:32

0 Answers0