def update_inps_with_file_metadata(inps, metadata): # Subset # Convert subset input into bounding box in radar / geo coordinate # geo_box = None if atr is not geocoded. coord = ut.coordinate(metadata) inps.pix_box, inps.geo_box = subset.subset_input_dict2box( vars(inps), metadata) inps.pix_box = coord.check_box_within_data_coverage(inps.pix_box) inps.geo_box = coord.box_pixel2geo(inps.pix_box) # Out message data_box = (0, 0, inps.width, inps.length) vprint('data coverage in y/x: ' + str(data_box)) vprint('subset coverage in y/x: ' + str(inps.pix_box)) vprint('data coverage in lat/lon: ' + str(coord.box_pixel2geo(data_box))) vprint('subset coverage in lat/lon: ' + str(inps.geo_box)) vprint( '------------------------------------------------------------------------' ) # DEM contour display if max(inps.pix_box[3] - inps.pix_box[1], inps.pix_box[2] - inps.pix_box[0]) > 2e3: inps.disp_dem_contour = False if inps.dem_file: vprint( 'area exceed 2000 pixels, turn off default DEM contour display' ) # Multilook, if too many subplots in one figure for less memory and faster speed if inps.multilook_num > 1: inps.multilook = True # Colormap inps.colormap = pp.check_colormap_input(metadata, inps.colormap, datasetName=inps.dset[0], cmap_lut=inps.cmap_lut, print_msg=inps.print_msg) # Reference Point # Convert ref_lalo if existed, to ref_yx, and use ref_yx for the following # ref_yx is referenced to input data coverage, not subseted area for display if inps.ref_lalo and inps.geo_box: inps.ref_yx = [ coord.lalo2yx(inps.ref_lalo[0], coord_type='lat'), coord.lalo2yx(inps.ref_lalo[1], coord_type='lon') ] vprint('input reference point in lat/lon: {}'.format(inps.ref_lalo)) vprint('input reference point in y /x : {}'.format(inps.ref_yx)) # ref_lalo if inps.ref_yx and inps.geo_box: inps.ref_lalo = [ coord.yx2lalo(inps.ref_yx[0], coord_type='y'), coord.yx2lalo(inps.ref_yx[1], coord_type='x') ] elif 'REF_LAT' in metadata.keys(): inps.ref_lalo = [ float(metadata['REF_LAT']), float(metadata['REF_LON']) ] else: inps.ref_lalo = None # Points of interest inps = pp.read_point2inps(inps, coord) # Unit and Wrap inps.disp_unit, inps.wrap = pp.check_disp_unit_and_wrap( metadata, disp_unit=inps.disp_unit, wrap=inps.wrap, wrap_range=inps.wrap_range, print_msg=inps.print_msg) # Min / Max - Display if not inps.vlim: if (any(i in inps.key.lower() for i in ['coherence', '.cor']) or (inps.key == 'ifgramStack' and inps.dset[0].split('-')[0] in ['coherence']) or inps.dset[0] == 'cmask'): inps.vlim = [0.0, 1.0] elif inps.key in ['.int'] or inps.wrap: inps.vlim = inps.wrap_range # Transparency - Alpha if not inps.transparency: # Auto adjust transparency value when showing shaded relief DEM if inps.dem_file and inps.disp_dem_shade: inps.transparency = 0.8 else: inps.transparency = 1.0 # Flip Left-Right / Up-Down if inps.auto_flip: inps.flip_lr, inps.flip_ud = pp.auto_flip_direction( metadata, print_msg=inps.print_msg) # Figure Title if not inps.fig_title: inps.fig_title = pp.auto_figure_title(metadata['FILE_PATH'], datasetNames=inps.dset, inps_dict=vars(inps)) vprint('figure title: ' + inps.fig_title) # Figure output file name if not inps.outfile: inps.outfile = ['{}{}'.format(inps.fig_title, inps.fig_ext)] inps = update_figure_setting(inps) return inps
def read_init_info(inps): # Time Series Info atr = readfile.read_attribute(inps.file[0]) inps.key = atr['FILE_TYPE'] if inps.key == 'timeseries': obj = timeseries(inps.file[0]) elif inps.key == 'giantTimeseries': obj = giantTimeseries(inps.file[0]) elif inps.key == 'HDFEOS': obj = HDFEOS(inps.file[0]) else: raise ValueError('input file is {}, not timeseries.'.format(inps.key)) obj.open(print_msg=inps.print_msg) inps.seconds = atr.get('CENTER_LINE_UTC', 0) if not inps.file_label: inps.file_label = [] for fname in inps.file: fbase = os.path.splitext(os.path.basename(fname))[0] fbase = fbase.replace('timeseries', '') inps.file_label.append(fbase) # default mask file if not inps.mask_file and 'msk' not in inps.file[0]: dir_name = os.path.dirname(inps.file[0]) if 'Y_FIRST' in atr.keys(): inps.mask_file = os.path.join(dir_name, 'geo_maskTempCoh.h5') else: inps.mask_file = os.path.join(dir_name, 'maskTempCoh.h5') if not os.path.isfile(inps.mask_file): inps.mask_file = None ## date info inps.date_list = obj.dateList inps.num_date = len(inps.date_list) if inps.start_date: inps.date_list = [i for i in inps.date_list if int(i) >= int(inps.start_date)] if inps.end_date: inps.date_list = [i for i in inps.date_list if int(i) <= int(inps.end_date)] inps.num_date = len(inps.date_list) inps.dates, inps.yearList = ptime.date_list2vector(inps.date_list) (inps.ex_date_list, inps.ex_dates, inps.ex_flag) = read_exclude_date(inps.ex_date_list, inps.date_list) # reference date/index if not inps.ref_date: inps.ref_date = atr.get('REF_DATE', None) if inps.ref_date: inps.ref_idx = inps.date_list.index(inps.ref_date) else: inps.ref_idx = None # date/index of interest for initial display if not inps.idx: if (not inps.ref_idx) or (inps.ref_idx < inps.num_date / 2.): inps.idx = inps.num_date - 2 else: inps.idx = 2 # Display Unit (inps.disp_unit, inps.unit_fac) = pp.scale_data2disp_unit(metadata=atr, disp_unit=inps.disp_unit)[1:3] # Map info - coordinate unit inps.coord_unit = atr.get('Y_UNIT', 'degrees').lower() # Read Error List inps.ts_plot_func = plot_ts_scatter inps.error_ts = None inps.ex_error_ts = None if inps.error_file: # assign plot function inps.ts_plot_func = plot_ts_errorbar # read error file error_fc = np.loadtxt(inps.error_file, dtype=bytes).astype(str) inps.error_ts = error_fc[:, 1].astype(np.float)*inps.unit_fac # update error file with exlcude date if inps.ex_date_list: e_ts = inps.error_ts[:] inps.ex_error_ts = e_ts[inps.ex_flag == 0] inps.error_ts = e_ts[inps.ex_flag == 1] # Zero displacement for 1st acquisition if inps.zero_first: inps.zero_idx = min(0, np.min(np.where(inps.ex_flag)[0])) # default lookup table file and coordinate object if not inps.lookup_file: inps.lookup_file = ut.get_lookup_file('./inputs/geometryRadar.h5') inps.coord = ut.coordinate(atr, inps.lookup_file) ## size and lalo info inps.pix_box, inps.geo_box = subset.subset_input_dict2box(vars(inps), atr) inps.pix_box = inps.coord.check_box_within_data_coverage(inps.pix_box) inps.geo_box = inps.coord.box_pixel2geo(inps.pix_box) data_box = (0, 0, int(atr['WIDTH']), int(atr['LENGTH'])) vprint('data coverage in y/x: '+str(data_box)) vprint('subset coverage in y/x: '+str(inps.pix_box)) vprint('data coverage in lat/lon: '+str(inps.coord.box_pixel2geo(data_box))) vprint('subset coverage in lat/lon: '+str(inps.geo_box)) vprint('------------------------------------------------------------------------') # calculate multilook_num # ONLY IF: # inps.multilook is True (no --nomultilook input) AND # inps.multilook_num ==1 (no --multilook-num input) # Note: inps.multilook is used for this check ONLY # Note: multilooking is only applied to the 3D data cubes and their related operations: # e.g. spatial indexing, referencing, etc. All the other variables are in the original grid # so that users get the same result as the non-multilooked version. if inps.multilook and inps.multilook_num == 1: inps.multilook_num = pp.auto_multilook_num(inps.pix_box, inps.num_date, max_memory=inps.maxMemory, print_msg=inps.print_msg) ## reference pixel if not inps.ref_lalo and 'REF_LAT' in atr.keys(): inps.ref_lalo = (float(atr['REF_LAT']), float(atr['REF_LON'])) if inps.ref_lalo: # set longitude to [-180, 180) if inps.coord_unit.lower().startswith('deg') and inps.ref_lalo[1] >= 180.: inps.ref_lalo[1] -= 360. # ref_lalo --> ref_yx if not set in cmd if not inps.ref_yx: inps.ref_yx = inps.coord.geo2radar(inps.ref_lalo[0], inps.ref_lalo[1], print_msg=False)[0:2] # use REF_Y/X if ref_yx not set in cmd if not inps.ref_yx and 'REF_Y' in atr.keys(): inps.ref_yx = (int(atr['REF_Y']), int(atr['REF_X'])) # ref_yx --> ref_lalo if in geo-coord # for plotting purpose only if inps.ref_yx and 'Y_FIRST' in atr.keys(): inps.ref_lalo = inps.coord.radar2geo(inps.ref_yx[0], inps.ref_yx[1], print_msg=False)[0:2] # do not plot native reference point if it's out of the coverage due to subset if (inps.ref_yx and 'Y_FIRST' in atr.keys() and inps.ref_yx == (int(atr.get('REF_Y',-999)), int(atr.get('REF_X',-999))) and not ( inps.pix_box[0] <= inps.ref_yx[1] < inps.pix_box[2] and inps.pix_box[1] <= inps.ref_yx[0] < inps.pix_box[3])): inps.disp_ref_pixel = False print('the native REF_Y/X is out of subset box, thus do not display') ## initial pixel coord if inps.lalo: inps.yx = inps.coord.geo2radar(inps.lalo[0], inps.lalo[1], print_msg=False)[0:2] try: inps.lalo = inps.coord.radar2geo(inps.yx[0], inps.yx[1], print_msg=False)[0:2] except: inps.lalo = None ## figure settings # Flip up-down / left-right if inps.auto_flip: inps.flip_lr, inps.flip_ud = pp.auto_flip_direction(atr, print_msg=inps.print_msg) # Transparency - Alpha if not inps.transparency: # Auto adjust transparency value when showing shaded relief DEM if inps.dem_file and inps.disp_dem_shade: inps.transparency = 0.7 else: inps.transparency = 1.0 ## display unit ans wrap # if wrap_step == 2*np.pi (default value), set disp_unit_img = radian; # otherwise set disp_unit_img = disp_unit inps.disp_unit_img = inps.disp_unit if inps.wrap: inps.range2phase = -4. * np.pi / float(atr['WAVELENGTH']) if 'cm' == inps.disp_unit.split('/')[0]: inps.range2phase /= 100. elif 'mm' == inps.disp_unit.split('/')[0]: inps.range2phase /= 1000. elif 'm' == inps.disp_unit.split('/')[0]: inps.range2phase /= 1. else: raise ValueError('un-recognized display unit: {}'.format(inps.disp_unit)) if (inps.wrap_range[1] - inps.wrap_range[0]) == 2*np.pi: inps.disp_unit_img = 'radian' inps.vlim = inps.wrap_range inps.cbar_label = 'Displacement [{}]'.format(inps.disp_unit_img) ## fit a suite of time func to the time series inps.model, inps.num_param = ts2vel.read_inps2model(inps, date_list=inps.date_list) # dense TS for plotting inps.date_list_fit = ptime.get_date_range(inps.date_list[0], inps.date_list[-1]) inps.dates_fit = ptime.date_list2vector(inps.date_list_fit)[0] inps.G_fit = time_func.get_design_matrix4time_func( date_list=inps.date_list_fit, model=inps.model, seconds=inps.seconds) return inps, atr
def read_init_info(inps): # Time Series Info ts_file0 = inps.file[0] atr = readfile.read_attribute(ts_file0) inps.key = atr['FILE_TYPE'] if inps.key == 'timeseries': obj = timeseries(ts_file0) elif inps.key == 'giantTimeseries': obj = giantTimeseries(ts_file0) elif inps.key == 'HDFEOS': obj = HDFEOS(ts_file0) else: raise ValueError('input file is {}, not timeseries.'.format(inps.key)) obj.open(print_msg=inps.print_msg) if not inps.file_label: inps.file_label = [str(i) for i in list(range(len(inps.file)))] # default mask file if not inps.mask_file and 'masked' not in ts_file0: dir_name = os.path.dirname(ts_file0) if 'Y_FIRST' in atr.keys(): inps.mask_file = os.path.join(dir_name, 'geo_maskTempCoh.h5') else: inps.mask_file = os.path.join(dir_name, 'maskTempCoh.h5') if not os.path.isfile(inps.mask_file): inps.mask_file = None # date info inps.date_list = obj.dateList inps.num_date = len(inps.date_list) if inps.start_date: inps.date_list = [ i for i in inps.date_list if int(i) >= int(inps.start_date) ] if inps.end_date: inps.date_list = [ i for i in inps.date_list if int(i) <= int(inps.end_date) ] inps.num_date = len(inps.date_list) inps.dates, inps.yearList = ptime.date_list2vector(inps.date_list) (inps.ex_date_list, inps.ex_dates, inps.ex_flag) = read_exclude_date(inps.ex_date_list, inps.date_list) # initial display index #if atr['REF_DATE'] in inps.date_list: # inps.ref_idx = inps.date_list.index(atr['REF_DATE']) #else: # inps.ref_idx = 0 if inps.ref_date: inps.ref_idx = inps.date_list.index(inps.ref_date) else: inps.ref_idx = 3 if not inps.idx: if inps.ref_idx < inps.num_date / 2.: inps.idx = inps.num_date - 3 else: inps.idx = 3 # Display Unit (inps.disp_unit, inps.unit_fac) = pp.scale_data2disp_unit(metadata=atr, disp_unit=inps.disp_unit)[1:3] # Map info - coordinate unit inps.coord_unit = atr.get('Y_UNIT', 'degrees').lower() # Read Error List inps.ts_plot_func = plot_ts_scatter inps.error_ts = None inps.ex_error_ts = None if inps.error_file: # assign plot function inps.ts_plot_func = plot_ts_errorbar # read error file error_fc = np.loadtxt(inps.error_file, dtype=bytes).astype(str) inps.error_ts = error_fc[:, 1].astype(np.float) * inps.unit_fac # update error file with exlcude date if inps.ex_date_list: e_ts = inps.error_ts[:] inps.ex_error_ts = e_ts[inps.ex_flag == 0] inps.error_ts = e_ts[inps.ex_flag == 1] # Zero displacement for 1st acquisition if inps.zero_first: inps.zero_idx = min(0, np.min(np.where(inps.ex_flag)[0])) # default lookup table file if not inps.lookup_file: inps.lookup_file = ut.get_lookup_file('./inputs/geometryRadar.h5') inps.coord = ut.coordinate(atr, inps.lookup_file) # size and lalo info inps.pix_box, inps.geo_box = subset.subset_input_dict2box(vars(inps), atr) inps.pix_box = inps.coord.check_box_within_data_coverage(inps.pix_box) inps.geo_box = inps.coord.box_pixel2geo(inps.pix_box) data_box = (0, 0, int(atr['WIDTH']), int(atr['LENGTH'])) vprint('data coverage in y/x: ' + str(data_box)) vprint('subset coverage in y/x: ' + str(inps.pix_box)) vprint('data coverage in lat/lon: ' + str(inps.coord.box_pixel2geo(data_box))) vprint('subset coverage in lat/lon: ' + str(inps.geo_box)) vprint( '------------------------------------------------------------------------' ) # reference pixel if not inps.ref_lalo and 'REF_LAT' in atr.keys(): inps.ref_lalo = (float(atr['REF_LAT']), float(atr['REF_LON'])) if inps.ref_lalo: if inps.ref_lalo[1] > 180.: inps.ref_lalo[1] -= 360. inps.ref_yx = inps.coord.geo2radar(inps.ref_lalo[0], inps.ref_lalo[1], print_msg=False)[0:2] if not inps.ref_yx and 'REF_Y' in atr.keys(): inps.ref_yx = [int(atr['REF_Y']), int(atr['REF_X'])] # Initial Pixel Coord if inps.lalo: inps.yx = inps.coord.geo2radar(inps.lalo[0], inps.lalo[1], print_msg=False)[0:2] try: inps.lalo = inps.coord.radar2geo(inps.yx[0], inps.yx[1], print_msg=False)[0:2] except: inps.lalo = None # Flip up-down / left-right if inps.auto_flip: inps.flip_lr, inps.flip_ud = pp.auto_flip_direction( atr, print_msg=inps.print_msg) # Transparency - Alpha if not inps.transparency: # Auto adjust transparency value when showing shaded relief DEM if inps.dem_file and inps.disp_dem_shade: inps.transparency = 0.7 else: inps.transparency = 1.0 # display unit ans wrap # if wrap_step == 2*np.pi (default value), set disp_unit_img = radian; # otherwise set disp_unit_img = disp_unit inps.disp_unit_img = inps.disp_unit if inps.wrap: inps.range2phase = -4. * np.pi / float(atr['WAVELENGTH']) if 'cm' == inps.disp_unit.split('/')[0]: inps.range2phase /= 100. elif 'mm' == inps.disp_unit.split('/')[0]: inps.range2phase /= 1000. elif 'm' == inps.disp_unit.split('/')[0]: inps.range2phase /= 1. else: raise ValueError('un-recognized display unit: {}'.format( inps.disp_unit)) if (inps.wrap_range[1] - inps.wrap_range[0]) == 2 * np.pi: inps.disp_unit_img = 'radian' inps.vlim = inps.wrap_range inps.cbar_label = 'Displacement [{}]'.format(inps.disp_unit_img) return inps, atr
def main(iargs=None): inps = cmd_line_parse(iargs) # translate input options processor = isce_utils.get_processor(inps.metaFile) src_box, geom_src_dir = read_vrt_info(os.path.join(inps.geomDir, 'lat.vrt')) # metadata meta = prepare_metadata(inps.metaFile, geom_src_dir, box=src_box) # subset - read pix_box for fringe file pix_box = subset.subset_input_dict2box(vars(inps), meta)[0] pix_box = ut.coordinate(meta).check_box_within_data_coverage(pix_box) print('input subset in y/x: {}'.format(pix_box)) # subset - update src_box for isce file and meta src_box = (pix_box[0] + src_box[0], pix_box[1] + src_box[1], pix_box[2] + src_box[0], pix_box[3] + src_box[1]) meta = attr.update_attribute4subset(meta, pix_box) print( 'input subset in y/x with respect to the VRT file: {}'.format(src_box)) ## output directory for dname in [inps.outDir, os.path.join(inps.outDir, 'inputs')]: os.makedirs(dname, exist_ok=True) ## output filename ts_file = os.path.join(inps.outDir, 'timeseries.h5') tcoh_file = os.path.join(inps.outDir, 'temporalCoherence.h5') ps_mask_file = os.path.join(inps.outDir, 'maskPS.h5') if 'Y_FIRST' in meta.keys(): geom_file = os.path.join(inps.outDir, 'inputs/geometryGeo.h5') else: geom_file = os.path.join(inps.outDir, 'inputs/geometryRadar.h5') ## 1 - time-series (from fringe) prepare_timeseries(outfile=ts_file, unw_file=inps.unwFile, metadata=meta, processor=processor, baseline_dir=inps.baselineDir, box=pix_box) ## 2 - temporal coherence and mask for PS (from fringe) prepare_temporal_coherence(outfile=tcoh_file, infile=inps.cohFile, metadata=meta, box=pix_box) prepare_ps_mask(outfile=ps_mask_file, infile=inps.psMaskFile, metadata=meta, box=pix_box) ## 3 - geometry (from SLC stacks before fringe, e.g. ISCE2) prepare_geometry(outfile=geom_file, geom_dir=geom_src_dir, box=src_box, metadata=meta) return ts_file, tcoh_file, ps_mask_file, geom_file
def main(iargs=None): inps = cmd_line_parse(iargs) print('\n-------------------READ INPUTS -------------------') print('Read metadata from file: {}'.format(inps.file)) attr = readfile.read_attribute(inps.file) #Extract subset if defined inps.pix_box, inps.geo_box = subset.subset_input_dict2box(vars(inps), attr) # output filename if not inps.outfile: inps.outfile = attr['PROJECT_NAME'] # date1/2 if attr['FILE_TYPE'] in ['timeseries', 'HDFEOS']: date1, date2 = inps.dset.split('_') inps.dset = date2 elif attr['FILE_TYPE'] == 'ifgramStack': date1, date2 = inps.dset.split('-')[1].split('_') else: # velocity and *.unw files date1, date2 = ptime.yyyymmdd(attr['DATE12'].replace('_', '-').split('-')) if inps.dset.startswith('step'): date1 = inps.dset.split('step')[-1] date2 = date1 print('First InSAR date: {}'.format(date1)) print('Second InSAR date: {}'.format(date2)) # read data print('Read {} from file: {}'.format(inps.dset, inps.file)) dis, attr = readfile.read(inps.file, datasetName=inps.dset, box=inps.pix_box) if attr['FILE_TYPE'] == 'timeseries': print('Read {} from file: {}'.format(date1, inps.file)) dis -= readfile.read(inps.file, datasetName=date1, box=inps.pix_box)[0] # mask data if inps.mask_file is not None: mask = readfile.read(inps.mask_file, box=inps.pix_box)[0] print('Set data to NaN for pixels with zero value in file: {}'.format( inps.mask_file)) dis[mask == 0] = np.nan # read geometry incidence / azimuth angle print('\nread incidence / azimuth angle from file: {}'.format( inps.geom_file)) inc_angle = readfile.read(inps.geom_file, datasetName='incidenceAngle', box=inps.pix_box)[0] az_angle = readfile.read(inps.geom_file, datasetName='azimuthAngle', box=inps.pix_box)[0] print('Mean satellite incidence angle: {0:.2f}°'.format( np.nanmean(inc_angle))) print('Mean satellite heading angle: {0:.2f}°\n'.format( 90 - np.nanmean(az_angle))) # Update attributes if inps.subset_lat != None or inps.subset_x != None: attr = attribute.update_attribute4subset(attr, inps.pix_box) # create kite container scene = mintpy2kite(dis, attr, date1, date2, inc_angle, az_angle, out_file=inps.outfile) return scene
def main(iargs=None): inps = cmd_line_parse(iargs) # 1. Read metadata and data k = readfile.read_attribute(inps.file)['FILE_TYPE'] if k == 'timeseries' and inps.dset and '_' in inps.dset: inps.ref_date, inps.dset = inps.dset.split('_') else: inps.ref_date = None atr = readfile.read_attribute(inps.file, datasetName=inps.dset) # pix_box inps.pix_box = subset.subset_input_dict2box(vars(inps), atr)[0] inps.pix_box = ut.coordinate(atr).check_box_within_data_coverage( inps.pix_box) data_box = (0, 0, int(atr['WIDTH']), int(atr['LENGTH'])) print('data coverage in y/x: {}'.format(data_box)) print('subset coverage in y/x: {}'.format(inps.pix_box)) atr = attr.update_attribute4subset(atr, inps.pix_box) # read data data = readfile.read(inps.file, datasetName=inps.dset, box=inps.pix_box)[0] if k == 'timeseries' and inps.ref_date: data -= readfile.read(inps.file, datasetName=inps.ref_date, box=inps.pix_box)[0] # mask mask = pp.read_mask(inps.file, mask_file=inps.mask_file, datasetName=inps.dset, box=inps.pix_box)[0] if mask is not None: print('masking out pixels with zero value in file: {}'.format( inps.mask_file)) data[mask == 0] = np.nan if inps.zero_mask: print('masking out pixels with zero value') data[data == 0] = np.nan del mask # Data Operation - Display Unit & Rewrapping (data, inps.disp_unit, inps.disp_scale, inps.wrap) = pp.scale_data4disp_unit_and_rewrap( data, metadata=atr, disp_unit=inps.disp_unit, wrap=inps.wrap, wrap_range=inps.wrap_range) if inps.wrap: inps.vlim = inps.wrap_range # 2. Generate Google Earth KMZ # 2.1 Common settings # disp min/max and colormap cmap_lut = 256 if not inps.vlim: cmap_lut, inps.vlim = pp.auto_adjust_colormap_lut_and_disp_limit(data) inps.colormap = pp.auto_colormap_name(atr, inps.colormap) inps.colormap = pp.ColormapExt(inps.colormap, cmap_lut).colormap inps.norm = colors.Normalize(vmin=inps.vlim[0], vmax=inps.vlim[1]) # Output filename inps.fig_title = pp.auto_figure_title(inps.file, datasetNames=inps.dset, inps_dict=vars(inps)) if not inps.outfile: inps.outfile = '{}.kmz'.format(inps.fig_title) inps.outfile = os.path.abspath(inps.outfile) # 2.2 Write KMZ file if 'Y_FIRST' in atr.keys(): # create ground overlay KML for file in geo-coord write_kmz_overlay( data, meta=atr, out_file=inps.outfile, inps=inps, ) else: # create placemark KML for file in radar-coord write_kmz_placemark( data, meta=atr, out_file=inps.outfile, geom_file=inps.geom_file, inps=inps, ) return inps.outfile