def read_inps2dict(inps): """Read input Namespace object info into inpsDict It grab the following contents into inpsDict 1. inps & all template files 2. configurations: processor, autoPath, updateMode, compression 3. extra metadata: PLATFORM, PROJECT_NAME, 4. translate autoPath """ # Read input info into inpsDict inpsDict = vars(inps) inpsDict['PLATFORM'] = None # Read template file template = {} for fname in inps.template_file: temp = readfile.read_template(fname) temp = ut.check_template_auto_value(temp) template.update(temp) for key, value in template.items(): inpsDict[key] = value if 'processor' in template.keys(): template['mintpy.load.processor'] = template['processor'] prefix = 'mintpy.load.' key_list = [i.split(prefix)[1] for i in template.keys() if i.startswith(prefix)] for key in key_list: value = template[prefix+key] if key in ['processor', 'autoPath', 'updateMode', 'compression']: inpsDict[key] = template[prefix+key] elif value: inpsDict[prefix+key] = template[prefix+key] print('processor : {}'.format(inpsDict['processor'])) if inpsDict['compression'] == False: inpsDict['compression'] = None # PROJECT_NAME --> PLATFORM if not inpsDict['PROJECT_NAME']: cfile = [i for i in list(inps.template_file) if os.path.basename(i) != 'smallbaselineApp.cfg'] inpsDict['PROJECT_NAME'] = sensor.project_name2sensor_name(cfile)[1] msg = 'SAR platform/sensor : ' sensor_name = sensor.project_name2sensor_name(str(inpsDict['PROJECT_NAME']))[0] if sensor_name: msg += str(sensor_name) inpsDict['PLATFORM'] = str(sensor_name) else: msg += 'unknown from project name "{}"'.format(inpsDict['PROJECT_NAME']) print(msg) # update file path with auto if inpsDict.get('autoPath', False): print('use auto path defined in mintpy.defaults.auto_path for options in auto') inpsDict = auto_path.get_auto_path(processor=inpsDict['processor'], work_dir=os.path.dirname(inpsDict['outdir']), template=inpsDict) return inpsDict
def read_inps2dict(inps): """Read input Namespace object info into inpsDict""" # Read input info into inpsDict inpsDict = vars(inps) inpsDict['PLATFORM'] = None # Read template file template = {} for fname in inps.template_file: temp = readfile.read_template(fname) temp = ut.check_template_auto_value(temp) template.update(temp) for key, value in template.items(): inpsDict[key] = value if 'processor' in template.keys(): template['mintpy.load.processor'] = template['processor'] prefix = 'mintpy.load.' key_list = [ i.split(prefix)[1] for i in template.keys() if i.startswith(prefix) ] for key in key_list: value = template[prefix + key] if key in ['processor', 'updateMode', 'compression']: inpsDict[key] = template[prefix + key] elif value: inpsDict[prefix + key] = template[prefix + key] if inpsDict['compression'] == False: inpsDict['compression'] = None # PROJECT_NAME --> PLATFORM if not inpsDict['PROJECT_NAME']: cfile = [ i for i in list(inps.template_file) if os.path.basename(i) != 'smallbaselineApp.cfg' ] inpsDict['PROJECT_NAME'] = sensor.project_name2sensor_name(cfile)[1] inpsDict['PLATFORM'] = str( sensor.project_name2sensor_name(str(inpsDict['PROJECT_NAME']))[0]) if inpsDict['PLATFORM']: print('SAR platform/sensor : {}'.format(inpsDict['PLATFORM'])) print('processor: {}'.format(inpsDict['processor'])) # Here to insert code to check default file path for miami user if (auto_path.autoPath and 'SCRATCHDIR' in os.environ and inpsDict['PROJECT_NAME'] is not None and inpsDict['mintpy.load.unwFile']) == 'auto': print(('check auto path setting for Univ of Miami users' ' for processor: {}'.format(inpsDict['processor']))) inpsDict = auto_path.get_auto_path( processor=inpsDict['processor'], project_name=inpsDict['PROJECT_NAME'], template=inpsDict) return inpsDict
def read_inps2dict(inps): """Read input Namespace object info into inpsDict""" # Read input info into inpsDict inpsDict = vars(inps) inpsDict['PLATFORM'] = None # Read template file template = {} for fname in inps.template_file: temp = readfile.read_template(fname) temp = ut.check_template_auto_value(temp) template.update(temp) for key, value in template.items(): inpsDict[key] = value if 'processor' in template.keys(): template['mintpy.load.processor'] = template['processor'] prefix = 'mintpy.load.' key_list = [ i.split(prefix)[1] for i in template.keys() if i.startswith(prefix) ] for key in key_list: value = template[prefix + key] if key in ['processor', 'autoPath', 'updateMode', 'compression']: inpsDict[key] = template[prefix + key] elif value: inpsDict[prefix + key] = template[prefix + key] if inpsDict['compression'] == False: inpsDict['compression'] = None # PROJECT_NAME --> PLATFORM if not inpsDict['PROJECT_NAME']: cfile = [ i for i in list(inps.template_file) if os.path.basename(i) != 'smallbaselineApp.cfg' ] inpsDict['PROJECT_NAME'] = sensor.project_name2sensor_name(cfile)[1] inpsDict['PLATFORM'] = str( sensor.project_name2sensor_name(str(inpsDict['PROJECT_NAME']))[0]) print('SAR platform/sensor : {}'.format(inpsDict['PLATFORM'])) print('processor: {}'.format(inpsDict['processor'])) # update file path with auto if inpsDict['autoPath']: print( 'use auto path defined in mintpy.defaults.auto_path for options in auto' ) inpsDict = auto_path.get_auto_path(processor=inpsDict['processor'], work_dir=os.path.dirname( inpsDict['outdir']), template=inpsDict) return inpsDict
def read_inps2dict(inps): """Read input Namespace object info into inpsDict""" # Read input info into inpsDict inpsDict = vars(inps) inpsDict['PLATFORM'] = None # Read template file template = {} for fname in inps.template_file: temp = readfile.read_template(fname) temp = ut.check_template_auto_value(temp) template.update(temp) for key, value in template.items(): inpsDict[key] = value if 'processor' in template.keys(): template['mintpy.load.processor'] = template['processor'] prefix = 'mintpy.load.' key_list = [i.split(prefix)[1] for i in template.keys() if i.startswith(prefix)] for key in key_list: value = template[prefix+key] if key in ['processor', 'updateMode', 'compression']: inpsDict[key] = template[prefix+key] elif value: inpsDict[prefix+key] = template[prefix+key] if inpsDict['compression'] == False: inpsDict['compression'] = None # PROJECT_NAME --> PLATFORM if not inpsDict['PROJECT_NAME']: cfile = [i for i in list(inps.template_file) if os.path.basename(i) != 'smallbaselineApp.cfg'] inpsDict['PROJECT_NAME'] = sensor.project_name2sensor_name(cfile)[1] inpsDict['PLATFORM'] = str(sensor.project_name2sensor_name(str(inpsDict['PROJECT_NAME']))[0]) if inpsDict['PLATFORM']: print('platform : {}'.format(inpsDict['PLATFORM'])) print('processor: {}'.format(inpsDict['processor'])) # Here to insert code to check default file path for miami user if (auto_path.autoPath and 'SCRATCHDIR' in os.environ and inpsDict['PROJECT_NAME'] is not None): print(('check auto path setting for Univ of Miami users' ' for processor: {}'.format(inpsDict['processor']))) inpsDict = auto_path.get_auto_path(processor=inpsDict['processor'], project_name=inpsDict['PROJECT_NAME'], template=inpsDict) return inpsDict