NCO / pynco:ncks命令无法查找/移动文件,文件存在

时间:2018-02-09 19:07:36

标签: python netcdf netcdf4 nco pynco

我使用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包装器的脚本中。

提前感谢任何见解或建议。

1 个答案:

答案 0 :(得分: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命令,因为这可以避免权限问题。