NCO/pynco: ncks command unable to find/move file, file is present

696 views Asked by At

I'm using pynco to run a ncks command from within a Python script. It's reporting an error when trying to perform a move within the nco_fl_mv() function:

$ 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"

However, it appears that the file is present:

$ 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

When I debug into the pynco module I can see the cmd object within nco.py (line 263) looks like this:

<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']`

Perhaps this is a permissions issue? I am using NCO/pynco installed on Anaconda on a Windows machine. This happens at the command line (vanilla NCO) as well as within my script using the pynco NCO wrapper.

1

There are 1 answers

0
Charlie Zender On BEST ANSWER

I suggest you attempt the underlying command that failed from the command-line yourself, and report if/how/whether it needs to be modified to succeed, i.e., try this

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

Also you might try adding the --no_tmp_fl switch to the NCO command, as this could circumvent permissions problems.