Commit 908c1791 authored by Marco Kurzynski's avatar Marco Kurzynski
Browse files

changed to input_dir

parent ee01683a
......@@ -504,20 +504,20 @@ def make_IBB_plot(c1_file, lw, sw, records, output_path):
plt.close('all')
def main(directory, output_dir=None, record_range=None, excluded_records=None, separate=None, no_spectral=None):
c1_file = os.path.join(directory, ( os.path.basename(directory)[2:8] + "C1.RNC" ))
c2_file = os.path.join(directory, ( os.path.basename(directory)[2:8] + "C2.RNC" ))
def main(input_dir, output_dir=None, record_range=None, excluded_records=None, separate=None, no_spectral=None):
c1_file = os.path.join(input_dir, ( os.path.basename(input_dir)[2:8] + "C1.RNC" ))
c2_file = os.path.join(input_dir, ( os.path.basename(input_dir)[2:8] + "C2.RNC" ))
if not os.path.isfile(c1_file) or not os.path.isfile(c2_file):
logger.error(f"Invalid input: {directory} -- YYMMDDC1.RNC or YYMMDDC2.RNC not in directory")
logger.error(f"Invalid input_dir: {input_dir} -- YYMMDDC1.RNC or YYMMDDC2.RNC not in input_dir")
exit(1)
if output_dir is not None:
output_path = os.path.realpath(output_dir)
else:
output_path = directory
output_path = input_dir
if not os.path.isdir(output_path):
logger.info('Creating directory: {0}'.format(output_path))
logger.info('Creating output directory: {0}'.format(output_path))
os.mkdir(output_path)
times = AERI_lib.getMetaValues(str(c1_file), 'Time')[0]
......@@ -584,7 +584,7 @@ def main(directory, output_dir=None, record_range=None, excluded_records=None, s
logger.info('Record {0} scene mirror position = {1}'.format(record, sceneMirrorPositions[record - 1]))
# Returns wavenumbers, obs_ice, pred_ice, obs_3body, pred_3body
logger.debug('Running bbcal')
lw,sw = bbcal.process(directory, record, output_path=output_path)
lw,sw = bbcal.process(input_dir, record, output_path=output_path)
if sceneMirrorPositions[record - 1] == 83:
NBB.append((record, times[record - 1], lw[5], sw[5]))
......@@ -652,7 +652,7 @@ if __name__ == '__main__':
formatter_class=argparse.RawTextHelpFormatter
)
parser.add_argument("input", help="Channel 1 input filename in HHMMSSC1.RNC format. Realtive or absolute path")
parser.add_argument("input_dir", help="Directory containing the channel files in HHMMSSCX.RNC format. Realtive or absolute path")
parser.add_argument("-o", '--output-dir',
help="Output file directory. It will be created if it does not exist. Defaults to current directory. Relative or absolute path")
parser.add_argument("-r", '--record-range',
......@@ -676,10 +676,10 @@ if __name__ == '__main__':
np.seterr(all=numpy_levels[min(3, args.verbose)])
# File format: HHMMSSC.RNC
ae_dirs = file_finder.getDirs(args.input)
ae_dirs = file_finder.getDirs(args.input_dir)
if not ae_dirs:
logger.error(f"Invalid input: {args.input} -- No AEYYMMDD "
logger.error(f"Invalid input_dir: {args.input_dir} -- No AEYYMMDD "
f"directories found, must pass a folder contaning AEYYMMDD dirs, "
f"or an AEYYMMDD dir")
exit(1)
......
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