#! /usr/bin/python

""" process_pans

Check to see if new PAN (Public Access Notice) files should be created,
and if needed create them.

This is a python rewrite of an earlier perl script, process_pans.pl.

There should be two arguments for this script

Created on 2017-02-09

@author: Bill Barrett

"""

import sys
import time
import re


AIM_PAN_DIRECTORY = '/aim/pdc/processed_pans'
AIM_PAN_FNAME_PATTERN = 'cips_sci_3a_20\d{2}-\d{3}_v05.\d{2}_r01.png.pan'
VETTED_INFO_FILENAME = '/aim/pdc/cips_vetted_files_info_l3.txt'

def main(minimum_date):
    """The main driver.

    Parameters
    ----------

    """


def get_minimum_date(argv):
    minimum_date = None
    if  len(sys.argv) >= 2:
        if re.match(r'\d{7}', argv[1]):
            minimum_date = argv[1]
    if minimum_date is None:
        minimum_date = time.strftime("%Y%j")
    return minimum_date


if __name__ == '__main__':
    minimum_date = get_minimum_date(sys.argv)
    print('minimum date: {0}'.format(minimum_date))
    main(minimum_date)

