def prep_metadata(ts_file, template=None, print_msg=True): """Prepare metadata for HDF-EOS5 file.""" # read metadata from ts_file ts_obj = timeseries(ts_file) ts_obj.open(print_msg=False) meta = dict(ts_obj.metadata) # read metadata from template_file for key, value in template.items(): if not key.startswith(('mintpy', 'isce')): meta[key] = value # grab unavco metadata unavco_meta = metadata_mintpy2unavco(meta, ts_obj.dateList) if print_msg: print('## UNAVCO Metadata:') print('-----------------------------------------') info.print_attributes(unavco_meta) print('-----------------------------------------') # update metadata from unavco metadata meta.update(unavco_meta) meta['FILE_TYPE'] = 'HDFEOS' return meta
def read_input_attribute(argv, print_msg=True): atr_new = dict() for i in range(1, len(argv)): if os.path.isfile(argv[i]): atr_tmp = readfile.read_template(argv[i]) atr_new.update(atr_tmp) else: atr_tmp = argv[i].split('=') atr_new[atr_tmp[0].strip()] = atr_tmp[1].strip() if print_msg: print("The following attributes will be added/updated, or removed if new value is 'None':") info.print_attributes(atr_new) return atr_new
def prep_metadata(ts_file, print_msg=True): """Prepare metadata for HDF-EOS5 file""" ts_obj = timeseries(ts_file) ts_obj.open(print_msg=False) unavco_meta_dict = metadata_mintpy2unavco(ts_obj.metadata, ts_obj.dateList) if print_msg: print('## UNAVCO Metadata:') print('-----------------------------------------') info.print_attributes(unavco_meta_dict) print('-----------------------------------------') meta_dict = dict(ts_obj.metadata) meta_dict.update(unavco_meta_dict) meta_dict['FILE_TYPE'] = 'HDFEOS' return meta_dict