Commit c78f8ff0 authored by William Roberts's avatar William Roberts
Browse files

Add more verbosity to dmv

parent 9e94d808
......@@ -6,17 +6,22 @@ import shutil
import logging
from utils import file_finder
logger = logging.getLogger(__name__)
def process(input_file, output_dir, verbose):
logger.info(f'Processing {input_file}')
exe = '/usr/bin/dmv-ncdf'
output_file = os.path.join(os.path.dirname(input_file), f'{os.path.basename(input_file)[:-4]}_{str.lower(os.path.basename(input_file)[-3:])}.nc')
logfile = os.path.join(os.path.dirname(input_file), f'{os.path.basename(input_file)[:-4]}_{str.lower(os.path.basename(input_file)[-3:])}.log')
dmv_input = '%s\n1\n99999\n0\n%s\n\n\n%s\n' % (input_file, output_file, logfile)
if verbose > 1:
p = subprocess.Popen( [exe], stdin=subprocess.PIPE )
if verbose > 2:
logger.debug('/usr/bin/dmv-ncdf output:')
p = subprocess.Popen( [exe], stdin=subprocess.PIPE )
else:
p = subprocess.Popen( [exe], stdout=subprocess.PIPE, stdin=subprocess.PIPE )
p = subprocess.Popen( [exe], stdout=subprocess.PIPE, stdin=subprocess.PIPE )
p.communicate(dmv_input.encode())
if not output_dir:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment