0

我正在使用pynco从 Python 脚本中运行ncks命令。尝试在函数内执行移动时报告错误nco_fl_mv()

$ C:/home/Anaconda3/Library/bin/ncks --dmn=lon,0,28,1 --output=C:/home/data/nclimgrid/201801_nclimgrid_dsd/work/lowres_nclimgrid_tavg_slice00.nc C:/home/data/nclimgrid/201801_nclimgrid_dsd/lowres_nclimgrid_tavg.nc
The system cannot find the path specified.
ncks: ERROR nco_fl_mv() unable to execute mv command "move C:/home/data/nclimgrid/201801_nclimgrid_dsd/work/lowres_nclimgrid_tavg_slice00.nc.pid11800.ncks.tmp C:/home/data/nclimgrid/201801_nclimgrid_dsd/work/lowres_nclimgrid_tavg_slice00.nc"

但是,该文件似乎存在:

$ ls -l C:/home/data/nclimgrid/201801_nclimgrid_dsd/work/lowres_nclimgrid_tavg_slice00.nc.pid11800.ncks.tmp 
-rw-r--r-- 1 James.Adams Domain Users 2.9M Feb  9 13:45 C:/home/data/nclimgrid/201801_nclimgrid_dsd/work/lowres_nclimgrid_tavg_slice00.nc.pid11800.ncks.tmp

当我调试到 pynco 模块时,我可以看到 nco.py(第 263 行)中的 cmd 对象如下所示:

<class 'list'>: ['C:\\home\\Anaconda3\\Library\\bin\\ncks', 
                 '--dmn=lon,0,28,1', 
                 '--output=C:/home/data/nclimgrid/201801_nclimgrid_dsd/work/lowres_nclimgrid_tavg_slice00.nc',
              ` 
                 'C:/home/data/nclimgrid/201801_nclimgrid_dsd/lowres_nclimgrid_tavg.nc']`

也许这是一个权限问题?我在 Windows 机器上使用安装在 Anaconda 上的 NCO/pynco。这发生在命令行(vanilla NCO)以及我使用 pynco NCO 包装器的脚本中。

4

1 回答 1

1

我建议您自己尝试从命令行失败的底层命令,并报告是否/如何/是否需要修改它才能成功,即试试这个

move C:/home/data/nclimgrid/201801_nclimgrid_dsd/work/lowres_nclimgrid_tavg_slice00.nc.pid11800.ncks.tmp C:/home/data/nclimgrid/201801_nclimgrid_dsd/work/lowres_nclimgrid_tavg_slice00.nc

您也可以尝试将 --no_tmp_fl 开关添加到 NCO 命令,因为这可以规避权限问题。

于 2018-02-13T21:41:03.383 回答