Comments (2)
Hi Joe,
I have used pynco
successfully on Windows 10 a couple of times however when I try to initiate some operations, I get the same error. I am still relatively new to Python so I am not sure if this is an issue with my code or with pynco
.
My code:
from nco import Nco
import os
nco = Nco()
#Folder containing .nc files I want to loop through
folder = os.listdir("C:\\Users\\jcrouch\\Desktop\\HFRadar")
#Loop through each ncfile to set the record dmn
#and append "_time" to the end of the file name
print("Making record dimensions...")
for ncfiles in folder:
files = ncfiles.strip()
inputs = str(files)
outputs = str(os.path.splitext(files)[0] + "_time.nc")
print("Input file = " + inputs)
print("Output file = " + outputs)
print("\n")
nco.ncks(input = inputs, output = outputs, mk_rec_dmn = 'time_run')
print("Record dimensions complete.")
The output:
Making record dimensions...
Input file = 08_12.nc
Output file = 08_12_time.nc
Error in calling operator ncks with:
C:\Downloads\nco\ncks --mk_rec_dmn=time_run --output=08_12_time.nc 08_12.nc <<<
Inputs: 08_12.nc
b'nco_err_exit(): ERROR Short NCO-generated message (usually name of function that triggered error): nco__open()\r\nnco_err_exit(): ERROR Error code is 2. Translation into English with nc_strerror(2) is "No such file or directory"\r\n'
Traceback (most recent call last):
File "C:\Users\jcrouch\Desktop\python\projects\nco\mk_rec_dmn.py", line 20, in <module>
nco.ncks(input = inputs, output = outputs, mk_rec_dmn = 'time_run')
File "C:\Program Files\Python35\lib\site-packages\nco-0.0.2-py3.5.egg\nco\nco.py", line 245, in get
nco.nco.NCOException: (returncode:1) b'nco_err_exit(): ERROR Short NCO-generated message (usually name of function that triggered error): nco__open()\r\nnco_err_exit(): ERROR Error code is 2. Translation into English with nc_strerror(2) is "No such file or directory"\r\n'
[Finished in 0.3s with exit code 1]
If it is indeed my code (more than likely), how do you suggest looping through .nc files using pynco
?
from pynco.
Good to hear that you have gotten pynco
on windows. I suppose we can close this issue now.
As for your error, it seems like 08_12.nc
isn't a file. Try using glob.glob
instead of os.listdir
Running this should raise the same error:
C:\Downloads\nco\ncks --mk_rec_dmn=time_run --output=08_12_time.nc 08_12.nc
from pynco.
Related Issues (20)
- Use of subprocess with shell=True, security vulnerability? HOT 19
- libnetcdf.so.7: cannot open shared object file: No such file or directory HOT 2
- ImportError: No module named custom HOT 2
- Error : pynco in Windows10 HOT 1
- Error calling NCO command with tempfile helper HOT 5
- 1.0 release HOT 4
- Drop python 2?
- Use a more permissive license? HOT 3
- Windows support HOT 9
- 'Rename' object not iterable HOT 12
- m HOT 8
- Permission denied error using pynco ncks on windows HOT 2
- options HOT 4
- Remove mention of ncdump in README/docs HOT 1
- initialization issue HOT 5
- Initializing `Nco` with `overwrite=True` causes indefinite hang HOT 5
- Atted object passes quotation marks as part of var_name and att_name to subprocess HOT 6
- Read The Docs integration is broken
- Sort out `pynco` vs. `nco` on PyPI HOT 1
- Unknown operator: ncdump HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pynco.