diff --git a/bin/csk_dump_data.py b/bin/csk_dump_data.py index ba54ada..20030db 100755 --- a/bin/csk_dump_data.py +++ b/bin/csk_dump_data.py @@ -19,8 +19,8 @@ def usage(): print print 'Usage : csk_dump_data.py [l0 lN p0 pN] [-res RESFILE]' print - print ' inputfile is the input Cosmo-skymed HDF5 filename : master.hd5' - print ' outputfile is the output filename : master.slc' + print ' inputfile is the input Cosmo-skymed HDF5 filename : main.hd5' + print ' outputfile is the output filename : main.slc' print ' l0 is the first azimuth line (starting at 1)' print ' lN is the last azimuth line' print ' p0 is the first range pixel (starting at 1)' diff --git a/bin/rs2_dump_data.py b/bin/rs2_dump_data.py index e8203b2..db609cc 100755 --- a/bin/rs2_dump_data.py +++ b/bin/rs2_dump_data.py @@ -22,8 +22,8 @@ def usage(): print print 'Usage : rs2_dump_data.py [l0 lN p0 pN] [-res RESFILE]' print - print ' inputfile is the input Radarsat-2 geotiff filename : master.tif' - print ' outputfile is the output filename : master.slc' + print ' inputfile is the input Radarsat-2 geotiff filename : main.tif' + print ' outputfile is the output filename : main.slc' print ' l0 is the first azimuth line (starting at 1)' print ' lN is the last azimuth line' print ' p0 is the first range pixel (starting at 1)' diff --git a/bin/tsx_dump_header2doris.py b/bin/tsx_dump_header2doris.py index bb06314..8c86e44 100755 --- a/bin/tsx_dump_header2doris.py +++ b/bin/tsx_dump_header2doris.py @@ -135,7 +135,7 @@ def hms2sec(hmsString,convertFlag='int'): # outStream.write('precise_orbits: 0\n') # outStream.write('crop: 0\n') # outStream.write('sim_amplitude: 0\n') -# outStream.write('master_timing: 0\n') +# outStream.write('main_timing: 0\n') # outStream.write('oversample: 0\n') # outStream.write('resample: 0\n') # outStream.write('filt_azi: 0\n') diff --git a/bin/tsx_dump_header2doris_noxpath.py b/bin/tsx_dump_header2doris_noxpath.py index 4c5e641..4f17a56 100755 --- a/bin/tsx_dump_header2doris_noxpath.py +++ b/bin/tsx_dump_header2doris_noxpath.py @@ -167,7 +167,7 @@ def hms2sec(hmsString,convertFlag='int'): # print('precise_orbits: 0') # print('crop: 0') # print('sim_amplitude: 0') -# print('master_timing: 0') +# print('main_timing: 0') # print('oversample: 0') # print('resample: 0') # print('filt_azi: 0') diff --git a/doris_stack/functions/ESD_functions.py b/doris_stack/functions/ESD_functions.py index e3daaa8..014cc49 100755 --- a/doris_stack/functions/ESD_functions.py +++ b/doris_stack/functions/ESD_functions.py @@ -96,8 +96,8 @@ def get_f_DC_difference(nBurst): burst1 = 'burst_' + str(nBurst) + '/' burst2 = 'burst_' + str(nBurst + 1) + '/' - this_m_resData = burst1 + 'master.res' - next_m_resData = burst2 + 'master.res' + this_m_resData = burst1 + 'main.res' + next_m_resData = burst2 + 'main.res' os.chdir(os.getcwd() + '/' + burst1) f_DC_1 = get_ramp(os.path.basename(this_m_resData), resampled=0, type='DC') @@ -118,8 +118,8 @@ def get_coordinates(nBurst): burst1 = 'burst_' + str(nBurst) + '/' burst2 = 'burst_' + str(nBurst+1) + '/' - this_m_resData = burst1 + 'master.res' - next_m_resData = burst2 + 'master.res' + this_m_resData = burst1 + 'main.res' + next_m_resData = burst2 + 'main.res' # Get variables from first burst this_line_first = int(get_parameter('First_line (w.r.t. output_image)',this_m_resData,1)) diff --git a/doris_stack/functions/ESD_ps_ds.py b/doris_stack/functions/ESD_ps_ds.py index 62682f8..1855a45 100755 --- a/doris_stack/functions/ESD_ps_ds.py +++ b/doris_stack/functions/ESD_ps_ds.py @@ -5,7 +5,7 @@ from doris.doris_stack.functions.ESD_functions import get_f_DC_difference, get_coordinates, freadbk -def save_overlapping(stack_folder, master_date, dates, overlap): +def save_overlapping(stack_folder, main_date, dates, overlap): nBurst, burst, next_burst = get_burst(overlap) @@ -27,33 +27,33 @@ def save_overlapping(stack_folder, master_date, dates, overlap): burst1 = 'burst_' + str(nBurst) + '/' burst2 = 'burst_' + str(nBurst + 1) + '/' - # First get the data for the master and df_dc - master_path = os.path.join(overlap_path, master_date) + # First get the data for the main and df_dc + main_path = os.path.join(overlap_path, main_date) df_dc_path = os.path.join(overlap_path, 'df_dc') - master_1 = master_file(burst) - master_2 = master_file(next_burst) + main_1 = main_file(burst) + main_2 = main_file(next_burst) - if not os.path.exists(master_path + '_1') or not os.path.exists(master_path + '_2'): - master_1 = freadbk(burst1 + master_1, line_start, first_pixel_this, line_length, + if not os.path.exists(main_path + '_1') or not os.path.exists(main_path + '_2'): + main_1 = freadbk(burst1 + main_1, line_start, first_pixel_this, line_length, pixel_length, 'cpxint16', this_nr_oflines, this_nr_ofpixels) - master_2 = freadbk(burst2 + master_2, 1, first_pixel_next, line_length, pixel_length, + main_2 = freadbk(burst2 + main_2, 1, first_pixel_next, line_length, pixel_length, 'cpxint16', next_nr_oflines, next_nr_ofpixels) - master_1_file = np.memmap(master_path + '_1', 'complex64', shape=master_1.shape, mode='w+') - master_2_file = np.memmap(master_path + '_2', 'complex64', shape=master_2.shape, mode='w+') - master_1_file[:] = master_1 - master_2_file[:] = master_2 - master_1_file.flush() - master_2_file.flush() + main_1_file = np.memmap(main_path + '_1', 'complex64', shape=main_1.shape, mode='w+') + main_2_file = np.memmap(main_path + '_2', 'complex64', shape=main_2.shape, mode='w+') + main_1_file[:] = main_1 + main_2_file[:] = main_2 + main_1_file.flush() + main_2_file.flush() if not os.path.exists(df_dc_path): df_dc = get_f_DC_difference(nBurst) df_dc_file = np.memmap(df_dc_path, 'float32', shape=df_dc.shape, mode='w+') df_dc_file[:,:] = df_dc[:,:] - # Then loop over the slaves + # Then loop over the subordinates for date in dates: - if date == master_date: + if date == main_date: continue path = swath_path(stack_folder, date, burst) @@ -66,14 +66,14 @@ def save_overlapping(stack_folder, master_date, dates, overlap): burst2 = 'burst_' + str(nBurst + 1) + '/' if not os.path.exists(data_path + '_1') or not os.path.exists(data_path + '_2'): - slave_1 = freadbk(burst1 + 'slave_rsmp_reramped.raw', line_start, first_pixel_this, line_length, pixel_length , 'complex64', this_nr_oflines, this_nr_ofpixels) - slave_2 = freadbk(burst2 + 'slave_rsmp_reramped.raw', 1, first_pixel_next, line_length, pixel_length, 'complex64', next_nr_oflines, next_nr_ofpixels) - slave_1_file = np.memmap(data_path + '_1', 'complex64', shape=slave_1.shape, mode='w+') - slave_2_file = np.memmap(data_path + '_2', 'complex64', shape=slave_2.shape, mode='w+') - slave_1_file[:] = slave_1 - slave_2_file[:] = slave_2 - slave_1_file.flush() - slave_2_file.flush() + subordinate_1 = freadbk(burst1 + 'subordinate_rsmp_reramped.raw', line_start, first_pixel_this, line_length, pixel_length , 'complex64', this_nr_oflines, this_nr_ofpixels) + subordinate_2 = freadbk(burst2 + 'subordinate_rsmp_reramped.raw', 1, first_pixel_next, line_length, pixel_length, 'complex64', next_nr_oflines, next_nr_ofpixels) + subordinate_1_file = np.memmap(data_path + '_1', 'complex64', shape=subordinate_1.shape, mode='w+') + subordinate_2_file = np.memmap(data_path + '_2', 'complex64', shape=subordinate_2.shape, mode='w+') + subordinate_1_file[:] = subordinate_1 + subordinate_2_file[:] = subordinate_2 + subordinate_1_file.flush() + subordinate_2_file.flush() def find_ps_overlapping(stack_folder, overlap): @@ -149,19 +149,19 @@ def select_ps_data(stack_folder, overlap): # Save only the ps points to file. for date in dates: - slave_ps_name = os.path.join(overlap_path, date + '_1_ps') - master_ps_name = os.path.join(overlap_path, date + '_2_ps') + subordinate_ps_name = os.path.join(overlap_path, date + '_1_ps') + main_ps_name = os.path.join(overlap_path, date + '_2_ps') - if not os.path.exists(slave_ps_name) or not os.path.exists(master_ps_name): - slave_ps = np.memmap(slave_ps_name, 'complex64', mode='w+', shape=(ps_num)) - master_ps = np.memmap(master_ps_name, 'complex64', mode='w+', shape=(ps_num)) - slave = np.memmap(os.path.join(overlap_path, date + '_1'), 'complex64', mode='r', + if not os.path.exists(subordinate_ps_name) or not os.path.exists(main_ps_name): + subordinate_ps = np.memmap(subordinate_ps_name, 'complex64', mode='w+', shape=(ps_num)) + main_ps = np.memmap(main_ps_name, 'complex64', mode='w+', shape=(ps_num)) + subordinate = np.memmap(os.path.join(overlap_path, date + '_1'), 'complex64', mode='r', shape=(line_length, pixel_length)) - master = np.memmap(os.path.join(overlap_path, date + '_2'), 'complex64', mode='r', + main = np.memmap(os.path.join(overlap_path, date + '_2'), 'complex64', mode='r', shape=(line_length, pixel_length)) if ps_num > 0: - slave_ps[:] = slave[ps_dat] - master_ps[:] = master[ps_dat] + subordinate_ps[:] = subordinate[ps_dat] + main_ps[:] = main[ps_dat] # Do the same for the df_dc file if not os.path.exists(os.path.join(overlap_path, 'df_dc_ps')): df_dc_ps = np.memmap(os.path.join(overlap_path, 'df_dc_ps'), 'float32', mode='w+', shape=(ps_num)) @@ -171,7 +171,7 @@ def select_ps_data(stack_folder, overlap): df_dc_ps[:] = df_dc[ps_dat] -def network_esd_ps(stack_folder, overlap, master_date, max_baseline, max_offset=0.02): +def network_esd_ps(stack_folder, overlap, main_date, max_baseline, max_offset=0.02): # Based on ps point esd is calculated using a network approach dates, overlap_path, diff_matrix, var_matrix, to_angle_matrix, weight_matrix, processing = prepare_esd(stack_folder, overlap) @@ -202,16 +202,16 @@ def network_esd_ps(stack_folder, overlap, master_date, max_baseline, max_offset= timediff = datetime.strptime(date_2, '%Y-%m-%d') - datetime.strptime(date, '%Y-%m-%d') if timediff > timedelta(minutes=1) and timediff < timedelta(days=max_baseline): - first_master = np.memmap(os.path.join(overlap_path, date + '_1_ps'), 'complex64', mode='r', + first_main = np.memmap(os.path.join(overlap_path, date + '_1_ps'), 'complex64', mode='r', shape=ps_num) - first_slave = np.memmap(os.path.join(overlap_path, date_2 + '_1_ps'), 'complex64', mode='r', + first_subordinate = np.memmap(os.path.join(overlap_path, date_2 + '_1_ps'), 'complex64', mode='r', shape=ps_num) - second_master = np.memmap(os.path.join(overlap_path, date + '_2_ps'), 'complex64', mode='r', + second_main = np.memmap(os.path.join(overlap_path, date + '_2_ps'), 'complex64', mode='r', shape=ps_num) - second_slave = np.memmap(os.path.join(overlap_path, date_2 + '_2_ps'), 'complex64', mode='r', + second_subordinate = np.memmap(os.path.join(overlap_path, date_2 + '_2_ps'), 'complex64', mode='r', shape=ps_num) - double_diff = (first_master * first_slave.conj()) * (second_master * second_slave.conj()).conj() + double_diff = (first_main * first_subordinate.conj()) * (second_main * second_subordinate.conj()).conj() # Now select all pixels with an offset of less than x milipixel double_diff[np.isnan(double_diff)] = 0.050 @@ -231,10 +231,10 @@ def network_esd_ps(stack_folder, overlap, master_date, max_baseline, max_offset= return diff_matrix, var_matrix, to_angle_matrix, weight_matrix, dates -def network_esd_coh(stack_folder, overlap, master_date, max_baseline, ra=10, az=2): +def network_esd_coh(stack_folder, overlap, main_date, max_baseline, ra=10, az=2): dates, overlap_path, diff_matrix, var_matrix, to_angle_matrix, weight_matrix, processed = prepare_esd(stack_folder, overlap) - folder = master_date[0:4] + master_date[5:7] + master_date[8:10] + "_" + dates[0][0:4] + dates[0][5:7] + dates[0][8:10] + folder = main_date[0:4] + main_date[5:7] + main_date[8:10] + "_" + dates[0][0:4] + dates[0][5:7] + dates[0][8:10] os.chdir(os.path.join(stack_folder, folder, overlap[0:7])) nBurst = int(overlap.split('_')[3]) @@ -426,10 +426,10 @@ def swath_path(stack_folder, date, key): return file_path -def master_file(key): +def main_file(key): # This function converts combinations of dates and keys to a datafile name string = '_iw_' + key[6] + '_burst_' + key[14:] - string = 'master' + string + '.raw' + string = 'main' + string + '.raw' return string @@ -442,14 +442,14 @@ def master_file(key): overlap = sys.argv[2] esd_type = sys.argv[3] max_baseline = sys.argv[4] - master_date = sys.argv[5] + main_date = sys.argv[5] ps_select = sys.argv[6] # Use 1 if needed, use 0 if not elif len(sys.argv) == 6: stack_folder = sys.argv[1] overlap = sys.argv[2] esd_type = sys.argv[3] max_baseline = sys.argv[4] - master_date = sys.argv[5] + main_date = sys.argv[5] else: sys.exit('usage: stack_folder type burst') @@ -457,17 +457,17 @@ def master_file(key): print('burst is ' + overlap) print('ps select is ' + ps_select) print('max baseline is ' + max_baseline) - print('master date is ' + master_date) + print('main date is ' + main_date) print('type ESD is ' + esd_type) # first get all the dates from the stack: - master_key = master_date[:4] + master_date[5:7] + master_date[8:] + main_key = main_date[:4] + main_date[5:7] + main_date[8:] ifgs = [f for f in os.listdir(stack_folder) if len(f) == 8] - dates = [f[:4] + '-' + f[4:6] + '-' + f[6:8] for f in ifgs if f != master_key] + dates = [f[:4] + '-' + f[4:6] + '-' + f[6:8] for f in ifgs if f != main_key] # Then run the overlap cutout / ps selection and - save_overlapping(stack_folder, master_date, dates, overlap) + save_overlapping(stack_folder, main_date, dates, overlap) # If we want to select ps points if ps_select == '1': @@ -477,9 +477,9 @@ def master_file(key): max_baseline = int(max_baseline) if esd_type == 'ps': select_ps_data(stack_folder, overlap) - diff_matrix, var_matrix, to_angle_matrix, weight, dates = network_esd_ps(stack_folder, overlap, master_date, max_baseline) + diff_matrix, var_matrix, to_angle_matrix, weight, dates = network_esd_ps(stack_folder, overlap, main_date, max_baseline) elif esd_type == 'coh': - diff_matrix, var_matrix, to_angle_matrix, weight, dates = network_esd_coh(stack_folder, overlap, master_date, max_baseline) + diff_matrix, var_matrix, to_angle_matrix, weight, dates = network_esd_coh(stack_folder, overlap, main_date, max_baseline) else: sys.exit('Type should either be coh or ps') diff --git a/doris_stack/functions/baselines.py b/doris_stack/functions/baselines.py index 2e841a5..5f14c3b 100755 --- a/doris_stack/functions/baselines.py +++ b/doris_stack/functions/baselines.py @@ -63,11 +63,11 @@ def baselines(dir_in,inputfile,start_date='2014-01-01',end_date='2018-01-01',dor resfiles = dict() # First create the ifgs.res files and store the data in a res data class. - master = res[0] - copyfile(master,os.path.join(process_folder,'master.res')) + main = res[0] + copyfile(main,os.path.join(process_folder,'main.res')) for resultfile, dat in zip(res, date): - copyfile(resultfile,os.path.join(process_folder,'slave.res')) + copyfile(resultfile,os.path.join(process_folder,'subordinate.res')) subprocess.call([doris + ' ' + inputfile], shell=True) dat = dat.astype(datetime.datetime).strftime('%Y-%m-%d') diff --git a/doris_stack/functions/burst_metadata.py b/doris_stack/functions/burst_metadata.py index e90dfd6..f02f26d 100755 --- a/doris_stack/functions/burst_metadata.py +++ b/doris_stack/functions/burst_metadata.py @@ -115,7 +115,7 @@ def burst_crop(meta,burst_num,swath_data,new_burst_num): first_sample = [int(x) for x in meta['aux']['firstValidSample'][burst_num-1].split()] swath_data = os.path.basename(swath_data) - crop['Data_output_file'] = 'slave_iw_' + swath_data[6] + '_burst_' + str(new_burst_num) + '.raw' + crop['Data_output_file'] = 'subordinate_iw_' + swath_data[6] + '_burst_' + str(new_burst_num) + '.raw' crop['Data_output_format'] = 'complex_short' # Start line of this burst in total swath product diff --git a/doris_stack/functions/cleanup_stack.py b/doris_stack/functions/cleanup_stack.py index 132449c..a3ae1d4 100644 --- a/doris_stack/functions/cleanup_stack.py +++ b/doris_stack/functions/cleanup_stack.py @@ -1,9 +1,9 @@ # This script can be used to cleanup a datastack # In this script we use the following rational -# 1. Data from the master date and ESD are always kept (can change when these scripts evolve) +# 1. Data from the main date and ESD are always kept (can change when these scripts evolve) # 2. The last processing step is saved (or if different processing steps are connected and the last one is not finished yet # 3. All .res and .ras files are kept. -# 4. Following steps are never deleted > resampled slave / subt_refdem / filtphase (multilooked) / coherence (multilooked) / unwrap +# 4. Following steps are never deleted > resampled subordinate / subt_refdem / filtphase (multilooked) / coherence (multilooked) / unwrap import os import sys @@ -15,38 +15,38 @@ def res_file_selection(path, dat_type='burst'): del_files = [] res_dat = dict() - # First check if slave / master / ifgs res files are there - for res_type in ['master', 'slave', 'ifgs']: + # First check if subordinate / main / ifgs res files are there + for res_type in ['main', 'subordinate', 'ifgs']: if os.path.exists(os.path.join(path, res_type + '.res')): res_dat[res_type] = ResData(os.path.join(path, res_type + '.res'), type=res_type) else: print('No data found in ' + path) return [] - if res_dat['slave'].process_control['readfiles'] == '1' and res_dat['slave'].process_control['crop'] == '1': - if res_dat['slave'].processes['readfiles']['deramp'] == '1': + if res_dat['subordinate'].process_control['readfiles'] == '1' and res_dat['subordinate'].process_control['crop'] == '1': + if res_dat['subordinate'].processes['readfiles']['deramp'] == '1': # Remove the ramped image data. - del_files.append(res_dat['slave'].processes['crop']['Data_output_file'][:-12] + '.raw') + del_files.append(res_dat['subordinate'].processes['crop']['Data_output_file'][:-12] + '.raw') if res_dat['ifgs'].process_control['dem_assist'] == '1': # Remove the temporary files for dem_assist del_files.extend(['dac_delta_demline.temp', 'dac_delta_dempixel.temp', 'dac_m_demline.temp', 'dac_m_dempixel.temp']) - if res_dat['slave'].process_control['resample'] == '1' and res_dat['ifgs'].process_control['dem_assist'] == '1': + if res_dat['subordinate'].process_control['resample'] == '1' and res_dat['ifgs'].process_control['dem_assist'] == '1': del_files.extend(['dac_delta_line.raw', 'dac_delta_pixel.raw']) - if res_dat['slave'].process_control['resample'] == '1': + if res_dat['subordinate'].process_control['resample'] == '1': # After resampling the deramped file is not needed anymore. Also processing data from resampling is not needed. - del_files.append(res_dat['slave'].processes['crop']['Data_output_file']) - del_files.extend(['rsmp_orig_slave_line.raw', 'rsmp_orig_slave_pixel.raw']) + del_files.append(res_dat['subordinate'].processes['crop']['Data_output_file']) + del_files.extend(['rsmp_orig_subordinate_line.raw', 'rsmp_orig_subordinate_pixel.raw']) - # Now the resampled slave stays. + # Now the resampled subordinate stays. if res_dat['ifgs'].process_control['subtr_refphase'] == '1': - # If the reference phase is subtracted both the reramped slave and interferogram can be removed - del_files.extend(['cint.raw', 'slave_rsmp_reramped.raw']) + # If the reference phase is subtracted both the reramped subordinate and interferogram can be removed + del_files.extend(['cint.raw', 'subordinate_rsmp_reramped.raw']) if res_dat['ifgs'].process_control['subtr_refdem'] == '1': # When the dem phase is removed, the interferogram with subtracted reference phase can be removed. - del_files.extend(['cint.raw', 'cint_srp.raw', 'demcrop.raw', 'dem_radar.raw', 'master_slave.crd']) + del_files.extend(['cint.raw', 'cint_srp.raw', 'demcrop.raw', 'dem_radar.raw', 'main_subordinate.crd']) if res_dat['ifgs'].process_control['filtphase'] == '1': # When after the the removal of the reference dem the filtphase step is done, the subtrefdem ifgs is removed. - del_files.extend(['cint.raw', 'cint_srp.raw', 'cint_srd.raw', 'demcrop.raw', 'dem_radar.raw', 'master_slave.crd']) + del_files.extend(['cint.raw', 'cint_srp.raw', 'cint_srd.raw', 'demcrop.raw', 'dem_radar.raw', 'main_subordinate.crd']) # Finally if it is about a burst image, we can check whether the filtered and coherence files are already # concatenated, which means they can be removed. @@ -77,15 +77,15 @@ def res_file_selection(path, dat_type='burst'): return del_files -def cleanup_stack(path, master_key): +def cleanup_stack(path, main_key): # This is the main cleanup function. folders = next(os.walk(path))[1] - if not master_key in folders: - print('master folder not found in path') + if not main_key in folders: + print('main folder not found in path') return else: - folders.remove(master_key) + folders.remove(main_key) del_files = [] @@ -117,9 +117,9 @@ def find_burst_folders(folder): # Actually execute the code... if __name__ == "__main__": path = sys.argv[1] - master_key = sys.argv[2] + main_key = sys.argv[2] print('path to be cleaned ' + path) - print('master key is ' + master_key) + print('main key is ' + main_key) - cleanup_stack(path, master_key) + cleanup_stack(path, main_key) diff --git a/doris_stack/functions/concatenate_decatenate.py b/doris_stack/functions/concatenate_decatenate.py index 13efee4..23d8367 100755 --- a/doris_stack/functions/concatenate_decatenate.py +++ b/doris_stack/functions/concatenate_decatenate.py @@ -3,15 +3,15 @@ import os, sys -def decatenate(date_folder, image_file, burst_file, datatype, multilooked='none', res_type='master'): +def decatenate(date_folder, image_file, burst_file, datatype, multilooked='none', res_type='main'): # Decatenate data. # Multilooks can be none > not concatenated, only > only multilooked images are concatenated or > # all > both original and multilooked images are concatenated. if len(multilooked) == 7: - master = os.path.join(date_folder, image_file[:-4] + '_' + multilooked + '.raw') + main = os.path.join(date_folder, image_file[:-4] + '_' + multilooked + '.raw') else: - master = os.path.join(date_folder, image_file) + main = os.path.join(date_folder, image_file) # Load .res files image_res, burst_res = read_res(date_folder, type=res_type) @@ -30,10 +30,10 @@ def decatenate(date_folder, image_file, burst_file, datatype, multilooked='none' no_pixels = int(burst_res[bursts[0]].processes['readfiles']['Number_of_pixels_output_image']) # First use memmap to get a memory map of the full file. - full_image = np.memmap(master, dtype=datatype, mode='r', shape=(no_lines, no_pixels)) + full_image = np.memmap(main, dtype=datatype, mode='r', shape=(no_lines, no_pixels)) for burst in bursts: - # Finally write all data from individual bursts to master file. We assume a simple 20 pixel offset from + # Finally write all data from individual bursts to main file. We assume a simple 20 pixel offset from # the side to prevent copying data without information. burst_dat, line_0, line_1, pix_0, pix_1, burst_pix, burst_line, az_offset, ra_offset = \ @@ -45,13 +45,13 @@ def decatenate(date_folder, image_file, burst_file, datatype, multilooked='none' burst_image.flush() -def concatenate(date_folder, image_file, burst_file, datatype, multilooked='none', res_type='master'): +def concatenate(date_folder, image_file, burst_file, datatype, multilooked='none', res_type='main'): # Concatenate data. if len(multilooked) == 7: - master = os.path.join(date_folder, image_file[:-4] + '_' + multilooked + '.raw') + main = os.path.join(date_folder, image_file[:-4] + '_' + multilooked + '.raw') else: - master = os.path.join(date_folder, image_file) + main = os.path.join(date_folder, image_file) # Load .res files image_res, burst_res = read_res(date_folder, type=res_type) @@ -70,10 +70,10 @@ def concatenate(date_folder, image_file, burst_file, datatype, multilooked='none no_pixels = int(burst_res[bursts[0]].processes['readfiles']['Number_of_pixels_output_image']) # First use memmap to get a memory map of the full file. - full_image = np.memmap(master, dtype=datatype, mode='w+', shape=(no_lines, no_pixels)) + full_image = np.memmap(main, dtype=datatype, mode='w+', shape=(no_lines, no_pixels)) for burst in bursts: - # Finally write all data from individual bursts to master file. We assume a simple 20 pixel offset from + # Finally write all data from individual bursts to main file. We assume a simple 20 pixel offset from # the side to prevent copying data without information. (corrected with multilooking factor) burst_dat, line_0, line_1, pix_0, pix_1, burst_pix, burst_line, daz, dra = \ @@ -87,12 +87,12 @@ def concatenate(date_folder, image_file, burst_file, datatype, multilooked='none def burst_info(burst, burst_file, burst_res, multilooked='none'): # Information about this specific burst - if burst_file == 'master.raw': + if burst_file == 'main.raw': if multilooked: string = '_iw_' + burst[6] + '_burst_' + burst[17:] + '_' + multilooked + '.raw' else: string = '_iw_' + burst[6] + '_burst_' + burst[17:] + '.raw' - elif burst_file == 'master_deramped.raw': + elif burst_file == 'main_deramped.raw': if multilooked: string = '_iw_' + burst[6] + '_burst_' + burst[17:] + '_deramped' + '_' + multilooked + '.raw' else: @@ -126,7 +126,7 @@ def burst_info(burst, burst_file, burst_res, multilooked='none'): return burst_dat, line_0, line_1, pix_0, pix_1, burst_pix, burst_line, az_offset, ra_offset -def read_res(date_folder, type='master'): +def read_res(date_folder, type='main'): # Read .res data to the burst objects. Generally done after a processing step. swaths = next(os.walk(date_folder))[1] @@ -140,36 +140,36 @@ def read_res(date_folder, type='master'): bursts = [burst for burst in bursts if burst.startswith('burst')] for burst in bursts: - slave_res = os.path.join(date_folder, swath, burst, 'slave.res') - master_res = os.path.join(date_folder, swath, burst, 'master.res') + subordinate_res = os.path.join(date_folder, swath, burst, 'subordinate.res') + main_res = os.path.join(date_folder, swath, burst, 'main.res') burst_name = swath + '_' + burst - if type == 'master' and os.path.exists(master_res): - res_burst[burst_name] = ResData(filename=master_res) - elif type == 'slave' and os.path.exists(slave_res): - res_burst[burst_name]= ResData(filename=slave_res) - elif os.path.exists(master_res): - res_burst[burst_name] = ResData(filename=master_res) - elif os.path.exists(slave_res): - res_burst[burst_name]= ResData(filename=slave_res) + if type == 'main' and os.path.exists(main_res): + res_burst[burst_name] = ResData(filename=main_res) + elif type == 'subordinate' and os.path.exists(subordinate_res): + res_burst[burst_name]= ResData(filename=subordinate_res) + elif os.path.exists(main_res): + res_burst[burst_name] = ResData(filename=main_res) + elif os.path.exists(subordinate_res): + res_burst[burst_name]= ResData(filename=subordinate_res) else: - print('No burst master or slave image available') + print('No burst main or subordinate image available') return - slave_res = os.path.join(date_folder, 'slave.res') - master_res = os.path.join(date_folder, 'master.res') - - if type == 'master' and os.path.exists(master_res): - res_image = ResData(filename=master_res) - elif type == 'slave' and os.path.exists(slave_res): - res_image = ResData(filename=slave_res) - elif os.path.exists(master_res): - res_image = ResData(filename=master_res) - elif os.path.exists(slave_res): - res_image = ResData(filename=slave_res) + subordinate_res = os.path.join(date_folder, 'subordinate.res') + main_res = os.path.join(date_folder, 'main.res') + + if type == 'main' and os.path.exists(main_res): + res_image = ResData(filename=main_res) + elif type == 'subordinate' and os.path.exists(subordinate_res): + res_image = ResData(filename=subordinate_res) + elif os.path.exists(main_res): + res_image = ResData(filename=main_res) + elif os.path.exists(subordinate_res): + res_image = ResData(filename=subordinate_res) else: - print('No image master or slave image available') + print('No image main or subordinate image available') return return res_image, res_burst @@ -188,7 +188,7 @@ def read_res(date_folder, type='master'): if len(sys.argv) > 6: res_type = sys.argv[6] else: - res_type = 'master' + res_type = 'main' print('concatenate folder is ' + date_folder) print('burst_file is ' + burst_file) diff --git a/doris_stack/functions/correct_ESD.py b/doris_stack/functions/correct_ESD.py index dbf8fae..d301c24 100755 --- a/doris_stack/functions/correct_ESD.py +++ b/doris_stack/functions/correct_ESD.py @@ -15,8 +15,8 @@ def remove_ramp(file, angle_pixel): # Remove ramp from burst - res_file = 'master.res' - res_dat = ResData(res_file, 'master') + res_file = 'main.res' + res_dat = ResData(res_file, 'main') crop = res_dat.processes['crop'] lines = int(crop['Last_line (w.r.t. original_image)']) - int(crop['First_line (w.r.t. original_image)']) + 1 pixels = int(crop['Last_pixel (w.r.t. original_image)']) - int(crop['First_pixel (w.r.t. original_image)']) + 1 diff --git a/doris_stack/functions/do_deramp_SLC.py b/doris_stack/functions/do_deramp_SLC.py index c63a2e5..4c380fe 100755 --- a/doris_stack/functions/do_deramp_SLC.py +++ b/doris_stack/functions/do_deramp_SLC.py @@ -19,7 +19,7 @@ def usage(): print ' will be characterized by baseband spectrum. The function also requires ' print ' the .res file RESFILENAME. ' print ' for example ' - print ' python do_deramp_SLC.py 20140821_iw_2_burst_1.raw slave.res False ' + print ' python do_deramp_SLC.py 20140821_iw_2_burst_1.raw subordinate.res False ' print ' created by Gert Mulder' print ' Part of code adapted from Lorenzo Iannini and Wu Wenhao' try: diff --git a/doris_stack/functions/do_reramp_SLC.py b/doris_stack/functions/do_reramp_SLC.py index a7e266e..62e9cdc 100755 --- a/doris_stack/functions/do_reramp_SLC.py +++ b/doris_stack/functions/do_reramp_SLC.py @@ -14,9 +14,9 @@ def usage(): print ' and RESFILENAME (res) that was deramped by deramp_SLC.m. The phase screen' print ' must account for the new resampled grids PIXRGGRID and PIXAZGRID ' print ' [Nlines_mst x Nsamples_mst] that contain the time coordinates of the' - print ' resampled image into the master grid: ' + print ' resampled image into the main grid: ' print ' for example ' - print ' python do_reramp_SLC.py slave_rsmp.raw slave.res False ' + print ' python do_reramp_SLC.py subordinate_rsmp.raw subordinate.res False ' print ' created by Gert Mulder' print ' Part of code adapted from Lorenzo Iannini and Wu Wenhao' try: @@ -43,10 +43,10 @@ def usage(): # Image size properties if res.process_control['resample'] == '1': #oversampled data - l0 = int(res.processes['resample']['First_line (w.r.t. original_master)']) - lN = int(res.processes['resample']['Last_line (w.r.t. original_master)']) - p0 = int(res.processes['resample']['First_pixel (w.r.t. original_master)']) - pN = int(res.processes['resample']['Last_pixel (w.r.t. original_master)']) + l0 = int(res.processes['resample']['First_line (w.r.t. original_main)']) + lN = int(res.processes['resample']['Last_line (w.r.t. original_main)']) + p0 = int(res.processes['resample']['First_pixel (w.r.t. original_main)']) + pN = int(res.processes['resample']['Last_pixel (w.r.t. original_main)']) dataFormat = 'complex64' resampled = True else: # original data diff --git a/doris_stack/functions/get_ramp.py b/doris_stack/functions/get_ramp.py index 923a512..9dfe186 100755 --- a/doris_stack/functions/get_ramp.py +++ b/doris_stack/functions/get_ramp.py @@ -39,10 +39,10 @@ def get_ramp(res_file, resampled=0, type='chirp'): lNum = int(get_parameter('Number_of_lines_original', res_file,1)) if resampled == 1: - l0 = int(get_parameter('First_line (w.r.t. original_master)', res_file,2,'*_Start_resample','* End_resample:_NORMAL')) - lN = int(get_parameter('Last_line (w.r.t. original_master)', res_file,2,'*_Start_resample','* End_resample:_NORMAL')) - p0 = int(get_parameter('First_pixel (w.r.t. original_master)', res_file,2,'*_Start_resample','* End_resample:_NORMAL')) - pN = int(get_parameter('Last_pixel (w.r.t. original_master)', res_file,2,'*_Start_resample','* End_resample:_NORMAL')) + l0 = int(get_parameter('First_line (w.r.t. original_main)', res_file,2,'*_Start_resample','* End_resample:_NORMAL')) + lN = int(get_parameter('Last_line (w.r.t. original_main)', res_file,2,'*_Start_resample','* End_resample:_NORMAL')) + p0 = int(get_parameter('First_pixel (w.r.t. original_main)', res_file,2,'*_Start_resample','* End_resample:_NORMAL')) + pN = int(get_parameter('Last_pixel (w.r.t. original_main)', res_file,2,'*_Start_resample','* End_resample:_NORMAL')) else: l0 = int(get_parameter('First_line (w.r.t. original_image)', res_file, 1)) lN = int(get_parameter('Last_line (w.r.t. original_image)', res_file, 1)) @@ -54,19 +54,19 @@ def get_ramp(res_file, resampled=0, type='chirp'): Nrg_res = pN-p0+1 if resampled == 1: - # Read the resampled image and slave coordinates in master geometry + # Read the resampled image and subordinate coordinates in main geometry ################################################################################# - Path_MFF_HDR ='rsmp_orig_slave_pixel'+'.hdr' - Link_DATA ='rsmp_orig_slave_pixel'+'.r00' # the default format should be r00 - Link_rsmp_orig_slave_pixel ='rsmp_orig_slave_pixel.raw' + Path_MFF_HDR ='rsmp_orig_subordinate_pixel'+'.hdr' + Link_DATA ='rsmp_orig_subordinate_pixel'+'.r00' # the default format should be r00 + Link_rsmp_orig_subordinate_pixel ='rsmp_orig_subordinate_pixel.raw' if (os.path.isfile(Path_MFF_HDR)): os.remove(Path_MFF_HDR) if (os.path.isfile(Link_DATA)): os.remove(Link_DATA) - RAW_DATA_ABSOLUTE_PATH=os.path.abspath(Link_rsmp_orig_slave_pixel) + RAW_DATA_ABSOLUTE_PATH=os.path.abspath(Link_rsmp_orig_subordinate_pixel) print "RAW_DATA_ABSOLUTE_PATH=", RAW_DATA_ABSOLUTE_PATH os.symlink(RAW_DATA_ABSOLUTE_PATH,Link_DATA) @@ -88,9 +88,9 @@ def get_ramp(res_file, resampled=0, type='chirp'): os.remove(Link_DATA) ################################################################################# - Path_MFF_HDR ='rsmp_orig_slave_line'+'.hdr' - Link_DATA ='rsmp_orig_slave_line'+'.r00' - Link_rsmp_orig_slave_line ='rsmp_orig_slave_line.raw' + Path_MFF_HDR ='rsmp_orig_subordinate_line'+'.hdr' + Link_DATA ='rsmp_orig_subordinate_line'+'.r00' + Link_rsmp_orig_subordinate_line ='rsmp_orig_subordinate_line.raw' if (os.path.isfile(Path_MFF_HDR)): os.remove(Path_MFF_HDR) @@ -98,7 +98,7 @@ def get_ramp(res_file, resampled=0, type='chirp'): os.remove(Link_DATA) - RAW_DATA_ABSOLUTE_PATH=os.path.abspath(Link_rsmp_orig_slave_line) + RAW_DATA_ABSOLUTE_PATH=os.path.abspath(Link_rsmp_orig_subordinate_line) print "RAW_DATA_ABSOLUTE_PATH=", RAW_DATA_ABSOLUTE_PATH os.symlink(RAW_DATA_ABSOLUTE_PATH,Link_DATA) diff --git a/doris_stack/functions/resdata.py b/doris_stack/functions/resdata.py index 507a746..0a14910 100755 --- a/doris_stack/functions/resdata.py +++ b/doris_stack/functions/resdata.py @@ -25,7 +25,7 @@ def __init__(self,filename='',type=''): # Create a ResData object (single/interferogram) if type not in ['single','interferogram'] and not filename: - warnings.warn('Define if results data is slave, master or interferogram') + warnings.warn('Define if results data is subordinate, main or interferogram') return else: self.res_type = type @@ -37,7 +37,7 @@ def __init__(self,filename='',type=''): self.res_read() else: if type == 'single': - self.process_control = collections.OrderedDict([('readfiles', '0'),('leader_datapoints', '0'), ('precise_orbits', '0'), ('crop', '0'), ('sim_amplitude', '0'), ('master_timing' , '0'), + self.process_control = collections.OrderedDict([('readfiles', '0'),('leader_datapoints', '0'), ('precise_orbits', '0'), ('crop', '0'), ('sim_amplitude', '0'), ('main_timing' , '0'), ('oversample', '0'), ('resample', '0') , ('filt_azi', '0'), ('filt_range', '0'), ('NOT_USED' , '0')]) elif type == 'interferogram': self.process_control = collections.OrderedDict([('coarse_orbits','0'),('coarse_correl','0'),('fine_coreg','0'),('timing_error','0'),('dem_assist','0'), diff --git a/doris_stack/functions/stack_cleanup.py b/doris_stack/functions/stack_cleanup.py index 3e1b4d9..0d1e92b 100755 --- a/doris_stack/functions/stack_cleanup.py +++ b/doris_stack/functions/stack_cleanup.py @@ -37,10 +37,10 @@ def cleanup(stack_folder, cleanup_ps=True, cleanup_ds=False, full_swath_rm=[], f ifg unwrapped ifg_unw NA (yes) no dem pixel shift (pixel) dac_delta_p yes yes dem pixel shift (line) dac_delta_l yes yes - slave image s_ramp yes yes - slave image deramped s_deramp no yes - master image m_ramp yes yes - master image deramped m_deramp no (*) yes + subordinate image s_ramp yes yes + subordinate image deramped s_deramp no yes + main image m_ramp yes yes + main image deramped m_deramp no (*) yes dem phase dem no no latitude phi no (*) no longitude lam no (*) no @@ -50,7 +50,7 @@ def cleanup(stack_folder, cleanup_ps=True, cleanup_ds=False, full_swath_rm=[], f burst ras files b_ras yes yes burst res files b_res yes yes - * Only one needed in a single master stack. Is not implemented yet. + * Only one needed in a single main stack. Is not implemented yet. """ # First check what should be removed. @@ -114,7 +114,7 @@ def cleanup(stack_folder, cleanup_ps=True, cleanup_ds=False, full_swath_rm=[], f def scan_stack(stack_folder): - # This function enters the children directories and checks whether a master.res, ifgs.res, swath folder and ifg + # This function enters the children directories and checks whether a main.res, ifgs.res, swath folder and ifg # exist. swath_folders = [] @@ -123,7 +123,7 @@ def scan_stack(stack_folder): for folder in dirs: r, folders, files = os.walk(os.path.join(root, folder)).next() - if 'swath_1' in folders and 'master.res' in files and 'ifgs.res' in files and 'cint.raw' in files: + if 'swath_1' in folders and 'main.res' in files and 'ifgs.res' in files and 'cint.raw' in files: swath_folders.append(os.path.join(root, folder)) return swath_folders diff --git a/doris_stack/main_code/burst.py b/doris_stack/main_code/burst.py index 9118f9c..f87ffed 100644 --- a/doris_stack/main_code/burst.py +++ b/doris_stack/main_code/burst.py @@ -86,7 +86,7 @@ def meta_burst(self, swath_meta=[], corners=True): # Read metadata from xml and inserts in resdata of burst # Insert the different steps (readfiles, orbits and crop) - self.header = burst_header('master.res') + self.header = burst_header('main.res') self.insert(readfiles, process='readfiles') self.insert(self.datapoints, process=self.orbit_type) self.insert(crop, process='crop') diff --git a/doris_stack/main_code/doris_main.py b/doris_stack/main_code/doris_main.py index 60e3c10..47001a5 100644 --- a/doris_stack/main_code/doris_main.py +++ b/doris_stack/main_code/doris_main.py @@ -21,8 +21,8 @@ start_date = settings.find('.start_date').text end_date = settings.find('.end_date').text -master_date = settings.find('.master_date').text +main_date = settings.find('.main_date').text #start doris sentinel1 run doris_sentinel_1 = DorisSentinel1() -doris_sentinel_1.run(args.parameterfilepath, start_date, end_date, master_date) +doris_sentinel_1.run(args.parameterfilepath, start_date, end_date, main_date) diff --git a/doris_stack/main_code/doris_parameters.py b/doris_stack/main_code/doris_parameters.py index 266d7aa..3a120b2 100644 --- a/doris_stack/main_code/doris_parameters.py +++ b/doris_stack/main_code/doris_parameters.py @@ -31,7 +31,7 @@ def __init__(self, stack_path): data_path = self._settings_get('.sar_data_folder') self.data_path = data_path # - # used in single_master.py + # used in single_main.py # # # used in test_dat_ESD diff --git a/doris_stack/main_code/doris_sentinel_1.py b/doris_stack/main_code/doris_sentinel_1.py index a94a438..6737718 100644 --- a/doris_stack/main_code/doris_sentinel_1.py +++ b/doris_stack/main_code/doris_sentinel_1.py @@ -8,11 +8,11 @@ from doris.doris_stack.main_code.stack import StackData from doris.doris_stack.main_code.dorisparameters import DorisParameters from doris.doris_stack.main_code.grs_profile import GRS_Profile -from doris.doris_stack.main_code.single_master_stack import SingleMaster +from doris.doris_stack.main_code.single_main_stack import SingleMain class DorisSentinel1(object): - def run(self, doris_parameters_path, start_date, end_date, master_date): + def run(self, doris_parameters_path, start_date, end_date, main_date): print 'start sentinel 1 processing' @@ -51,19 +51,19 @@ def run(self, doris_parameters_path, start_date, end_date, master_date): # Select the images which are new in this datastack. stack.select_image() # Then these images are unzipped - stack.check_new_images(master=master_date) + stack.check_new_images(main=main_date) # All images which correspond with the start and end date are selected stack.unpack_image() # Based on the shape file bursts are selected for one date - print('master date is ' + master_date) - stack.select_burst(date=master_date) + print('main date is ' + main_date) + stack.select_burst(date=main_date) # And also for the other dates the needed bursts are selected stack.extend_burst() # Remove the images which are not fully present stack.remove_incomplete_images() # Now the exact coordinates of the different burst in the concatenated image is calculated - stack.define_burst_coordinates(slaves=True) + stack.define_burst_coordinates(subordinates=True) # Write the datastack to the stack_path folder stack.write_stack(write_path=stack_path,no_data=False) # A few auxiliary functions which are not strictly necessary. @@ -75,10 +75,10 @@ def run(self, doris_parameters_path, start_date, end_date, master_date): # Finally delete unzipped images stack.del_unpacked_image() - import single_master_stack + import single_main_stack - # Now we import the script to create a single master interferogram - processing = SingleMaster(master_date=master_date, start_date=start_date, + # Now we import the script to create a single main interferogram + processing = SingleMain(main_date=main_date, start_date=start_date, end_date=end_date, stack_folder=stack_path, input_files=input_files, processing_folder=stack_path) @@ -91,10 +91,10 @@ def run(self, doris_parameters_path, start_date, end_date, master_date): if(dorisParameters.do_coarse_orbits): profile.log_time_stamp('coarse_orbits') processing.coarse_orbits() - # Deramp the data of both slave and master + # Deramp the data of both subordinate and main if(dorisParameters.do_deramp): profile.log_time_stamp('deramp') - processing.deramp(master=True) # Still needed for coherence... + processing.deramp(main=True) # Still needed for coherence... # Fake the use of fine window coregistration, which is officially not needed if(dorisParameters.do_fake_fine_coreg_bursts): profile.log_time_stamp('fake_fine_coreg_bursts') diff --git a/doris_stack/main_code/dorisparameters.py b/doris_stack/main_code/dorisparameters.py index ba8cadc..52919ee 100644 --- a/doris_stack/main_code/dorisparameters.py +++ b/doris_stack/main_code/dorisparameters.py @@ -39,7 +39,7 @@ def __init__(self, stack_path): direction = self._settings_get('.direction') self.direction = direction # - # used in single_master.py + # used in single_main.py # # # used in test_dat_ESD diff --git a/doris_stack/main_code/resdata.py b/doris_stack/main_code/resdata.py index cd28c96..d502127 100644 --- a/doris_stack/main_code/resdata.py +++ b/doris_stack/main_code/resdata.py @@ -25,7 +25,7 @@ def __init__(self,filename='',type=''): # Create a ResData object (single/interferogram) if type not in ['single','interferogram'] and not filename: - warnings.warn('Define if results data is slave, master or interferogram') + warnings.warn('Define if results data is subordinate, main or interferogram') return else: self.res_type = type @@ -37,7 +37,7 @@ def __init__(self,filename='',type=''): self.res_read() else: if type == 'single': - self.process_control = collections.OrderedDict([('readfiles', '0'),('leader_datapoints', '0'), ('precise_orbits', '0'), ('crop', '0'), ('sim_amplitude', '0'), ('master_timing' , '0'), + self.process_control = collections.OrderedDict([('readfiles', '0'),('leader_datapoints', '0'), ('precise_orbits', '0'), ('crop', '0'), ('sim_amplitude', '0'), ('main_timing' , '0'), ('oversample', '0'), ('resample', '0') , ('filt_azi', '0'), ('filt_range', '0'), ('NOT_USED' , '0')]) elif type == 'interferogram': self.process_control = collections.OrderedDict([('coarse_orbits','0'),('coarse_correl','0'),('fine_coreg','0'),('timing_error','0'),('dem_assist','0'), diff --git a/doris_stack/main_code/single_master_stack.py b/doris_stack/main_code/single_master_stack.py index 11f49bc..652c052 100644 --- a/doris_stack/main_code/single_master_stack.py +++ b/doris_stack/main_code/single_master_stack.py @@ -11,13 +11,13 @@ from doris.doris_stack.functions.baselines import baselines -class SingleMaster(object): +class SingleMain(object): - def __init__(self, start_date='', end_date='', master_date='', stack_folder='', processing_folder='', + def __init__(self, start_date='', end_date='', main_date='', stack_folder='', processing_folder='', input_files=''): - # This function loads in a datastack to create a single master stack. Optional are the start date, end date and - # master date. If they are not defined all dates will be loaded. The master date can be loaded later using the - # master function. If you want a random master value, choose master_date='random' + # This function loads in a datastack to create a single main stack. Optional are the start date, end date and + # main date. If they are not defined all dates will be loaded. The main date can be loaded later using the + # main function. If you want a random main value, choose main_date='random' # Dates should be given as 'yyyy-mm-dd'. If stack_read is True information is read from the stack_folder. Otherwise # the datastack from an StackData object should be given as input. @@ -43,8 +43,8 @@ def __init__(self, start_date='', end_date='', master_date='', stack_folder='', self.stack = dict() self.full_swath = dict() - self.master_date = '' - self.master_key = '' + self.main_date = '' + self.main_key = '' self.folder = processing_folder self.stack_folder = stack_folder @@ -63,14 +63,14 @@ def __init__(self, start_date='', end_date='', master_date='', stack_folder='', self.to_angle_matrix = dict() self.weight_matrix = dict() - if master_date: - master_date = datetime.strptime(master_date, '%Y-%m-%d') - self.master(master_date) + if main_date: + main_date = datetime.strptime(main_date, '%Y-%m-%d') + self.main(main_date) if self.folder: self.processing_read() - self.coreg_dates = [d for d in self.stack.keys() if d != self.master_date] + self.coreg_dates = [d for d in self.stack.keys() if d != self.main_date] def processing_read(self): # This function reads a processing datastack based on the processing folder @@ -116,16 +116,16 @@ def remove_finished(self, step='unwrap'): print(date) print('End list') - def master(self,master_date): - # Load master date - self.master_date = master_date.strftime('%Y-%m-%d') - self.master_key = self.master_date[:4] + self.master_date[5:7] + self.master_date[8:10] + def main(self,main_date): + # Load main date + self.main_date = main_date.strftime('%Y-%m-%d') + self.main_key = self.main_date[:4] + self.main_date[5:7] + self.main_date[8:10] - if not master_date in self.stack.keys(): - print 'Master date is not part of the datastack. If you do not need to initialize anymore this is not a problem.' + if not main_date in self.stack.keys(): + print 'Main date is not part of the datastack. If you do not need to initialize anymore this is not a problem.' def baseline(self): - # Create baseline plot of datastack. Usefull to select the right master + # Create baseline plot of datastack. Usefull to select the right main baselines(self.stack_folder,self.start_date,self.end_date) def initialize(self, path='',cascade=False): @@ -150,26 +150,26 @@ def initialize(self, path='',cascade=False): os.chdir(burst_folder) # Copy data files - m_source = self.burst_path(key=burst, date=self.master_date, dat_type='slave', full_path=True) - m_dest = self.burst_path(key=burst, date=date, dat_type='master', full_path=True) + m_source = self.burst_path(key=burst, date=self.main_date, dat_type='subordinate', full_path=True) + m_dest = self.burst_path(key=burst, date=date, dat_type='main', full_path=True) if not os.path.exists(m_dest): os.symlink(m_source, m_dest) # Write res files - new_filename = os.path.join(burst_folder, 'master.res') + new_filename = os.path.join(burst_folder, 'main.res') if not os.path.exists(new_filename): - res = deepcopy(self.stack[self.master_date][burst]['slave']) - res.processes['crop']['Data_output_file'] = 'master' + res.processes['crop']['Data_output_file'][5:] + res = deepcopy(self.stack[self.main_date][burst]['subordinate']) + res.processes['crop']['Data_output_file'] = 'main' + res.processes['crop']['Data_output_file'][5:] res.write(new_filename=new_filename) self.read_res() self.create_full_swath() - self.coarse_orbits(dates=[self.master_date]) # Create ifgs.res files for master. + self.coarse_orbits(dates=[self.main_date]) # Create ifgs.res files for main. - del self.stack[self.master_date] - del self.full_swath[self.master_date] + del self.stack[self.main_date] + del self.full_swath[self.main_date] def create_full_swath(self): # Create folders with full swath for individual interferogram. @@ -181,13 +181,13 @@ def create_full_swath(self): print(date) bursts = self.stack[date].keys() - if 'slave' in self.full_swath[date].keys() and 'master' in self.full_swath[date].keys(): + if 'subordinate' in self.full_swath[date].keys() and 'main' in self.full_swath[date].keys(): continue - for dat_type in ['master', 'slave']: + for dat_type in ['main', 'subordinate']: self.full_swath[date][dat_type] = copy.deepcopy(self.stack[date][bursts[0]][dat_type]) - # Information slave images + # Information subordinate images az_time = self.full_swath[date][dat_type].processes['readfiles']['First_pixel_azimuth_time (UTC)'] az_time = datetime.strptime(az_time,'%Y-%b-%d %H:%M:%S.%f') range_time = float(self.full_swath[date][dat_type].processes['readfiles']['Range_time_to_first_pixel (2way) (ms)']) @@ -226,8 +226,8 @@ def create_full_swath(self): self.full_swath[date][dat_type].processes['crop']['Last_line (w.r.t. original_image)'] = no_lines self.full_swath[date][dat_type].processes['crop']['First_pixel (w.r.t. original_image)'] = '1' self.full_swath[date][dat_type].processes['crop']['Last_pixel (w.r.t. original_image)'] = no_pixels - if dat_type == 'master': - self.full_swath[date][dat_type].processes['crop']['Data_output_file'] = self.master_date + '.raw' + if dat_type == 'main': + self.full_swath[date][dat_type].processes['crop']['Data_output_file'] = self.main_date + '.raw' else: self.full_swath[date][dat_type].processes['crop']['Data_output_file'] = date + '.raw' self.full_swath[date][dat_type].processes['crop'].pop('First_line (w.r.t. tiff_image)') @@ -238,8 +238,8 @@ def create_full_swath(self): os.chdir(folder) # Create res_file - master_path = self.image_path(date, dat_type + '.res') - self.full_swath[date][dat_type].write(new_filename=master_path) + main_path = self.image_path(date, dat_type + '.res') + self.full_swath[date][dat_type].write(new_filename=main_path) self.read_res() @@ -303,13 +303,13 @@ def coarse_correlation(self, ps=False): path = self.burst_path(date, burst, full_path=True) os.chdir(path) if ps is True: - master_file = self.burst_path(key=burst,dat_type='master',full_path=False) - command1 = 'python -m ' + 'get_winpos' + ' ' + master_file + ' master.res 21 winpos_cc.asc' + main_file = self.burst_path(key=burst,dat_type='main',full_path=False) + command1 = 'python -m ' + 'get_winpos' + ' ' + main_file + ' main.res 21 winpos_cc.asc' job_list1.append({"path": path, "command": command1}) command2 = self.doris_path + ' ' + os.path.join(self.input_files, 'input.coarsecorr') job_list2.append({"path": path, "command": command2}) if not self.parallel: - os.system('python -m ' + 'get_winpos' + ' ' + master_file + ' master.res 21 winpos_cc.asc') + os.system('python -m ' + 'get_winpos' + ' ' + main_file + ' main.res 21 winpos_cc.asc') os.system(command2) if ps is False: command = self.doris_path + ' ' + os.path.join(self.input_files, 'input.coarsecorr') @@ -322,7 +322,7 @@ def coarse_correlation(self, ps=False): jobs.run(job_list1) jobs.run(job_list2) - self.fake_master_steps(step='coarse_correl', full_swath=False) + self.fake_main_steps(step='coarse_correl', full_swath=False) def correct_coarse_correlation(self): # Correct coarse orbits to same reference system for whole image. @@ -341,15 +341,15 @@ def correct_coarse_correlation(self): for burst in bursts: - s_first_pix = self.stack[date][burst]['slave'].processes['readfiles']['First_pixel (w.r.t. output_image)'] - s_first_line = self.stack[date][burst]['slave'].processes['readfiles']['First_line (w.r.t. output_image)'] - m_first_pix = self.stack[date][burst]['master'].processes['readfiles']['First_pixel (w.r.t. output_image)'] - m_first_line = self.stack[date][burst]['master'].processes['readfiles']['First_line (w.r.t. output_image)'] + s_first_pix = self.stack[date][burst]['subordinate'].processes['readfiles']['First_pixel (w.r.t. output_image)'] + s_first_line = self.stack[date][burst]['subordinate'].processes['readfiles']['First_line (w.r.t. output_image)'] + m_first_pix = self.stack[date][burst]['main'].processes['readfiles']['First_pixel (w.r.t. output_image)'] + m_first_line = self.stack[date][burst]['main'].processes['readfiles']['First_line (w.r.t. output_image)'] - s_first_pix_c = self.stack[date][burst]['slave'].processes['crop']['First_pixel (w.r.t. original_image)'] - s_first_line_c = self.stack[date][burst]['slave'].processes['crop']['First_line (w.r.t. original_image)'] - m_first_pix_c = self.stack[date][burst]['master'].processes['crop']['First_pixel (w.r.t. original_image)'] - m_first_line_c = self.stack[date][burst]['master'].processes['crop']['First_line (w.r.t. original_image)'] + s_first_pix_c = self.stack[date][burst]['subordinate'].processes['crop']['First_pixel (w.r.t. original_image)'] + s_first_line_c = self.stack[date][burst]['subordinate'].processes['crop']['First_line (w.r.t. original_image)'] + m_first_pix_c = self.stack[date][burst]['main'].processes['crop']['First_pixel (w.r.t. original_image)'] + m_first_line_c = self.stack[date][burst]['main'].processes['crop']['First_line (w.r.t. original_image)'] coarse_p = self.stack[date][burst]['ifgs'].processes['coarse_correl']['Coarse_correlation_translation_pixels'] coarse_l = self.stack[date][burst]['ifgs'].processes['coarse_correl']['Coarse_correlation_translation_lines'] @@ -379,10 +379,10 @@ def correct_coarse_correlation(self): self.update_res(dates=self.coreg_dates) - self.fake_master_steps(step='coarse_correl', burst_proc=False) + self.fake_main_steps(step='coarse_correl', burst_proc=False) - def deramp(self, master=True): - # Deramp slave and masters and slaves of bursts. + def deramp(self, main=True): + # Deramp subordinate and mains and subordinates of bursts. if len(self.coreg_dates) == 0: return @@ -391,39 +391,39 @@ def deramp(self, master=True): job_list1 = [] job_list2 = [] - # Deramp slaves + # Deramp subordinates bursts = self.stack[self.coreg_dates[0]].keys() for date in self.coreg_dates: for burst in bursts: path = self.burst_path(date, burst, full_path=True) - slave_file = self.burst_path(key=burst, dat_type='slave', full_path=False) - slave_deramped = self.burst_path(key=burst, dat_type='slave_deramped', full_path=False) + subordinate_file = self.burst_path(key=burst, dat_type='subordinate', full_path=False) + subordinate_deramped = self.burst_path(key=burst, dat_type='subordinate_deramped', full_path=False) - if not os.path.exists(os.path.join(path, slave_deramped)): - command2 = 'python ' + os.path.join(self.function_path, 'do_deramp_SLC.py') + ' ' + slave_file + ' slave.res' + if not os.path.exists(os.path.join(path, subordinate_deramped)): + command2 = 'python ' + os.path.join(self.function_path, 'do_deramp_SLC.py') + ' ' + subordinate_file + ' subordinate.res' job_list2.append({"path": path, "command": command2}) if not self.parallel: os.chdir(path) os.system(command2) - if self.stack[date][burst]['slave'].processes['crop']['Data_output_file'] != os.path.basename(slave_deramped): - self.stack[date][burst]['slave'].processes['crop']['Data_output_file'] = os.path.basename(slave_deramped) - if self.stack[date][burst]['slave'].processes['readfiles']['deramp'] != '1': - self.stack[date][burst]['slave'].processes['readfiles']['deramp'] = '1' - if self.stack[date][burst]['master'].processes['readfiles']['reramp'] != '0': - self.stack[date][burst]['master'].processes['readfiles']['reramp'] = '0' + if self.stack[date][burst]['subordinate'].processes['crop']['Data_output_file'] != os.path.basename(subordinate_deramped): + self.stack[date][burst]['subordinate'].processes['crop']['Data_output_file'] = os.path.basename(subordinate_deramped) + if self.stack[date][burst]['subordinate'].processes['readfiles']['deramp'] != '1': + self.stack[date][burst]['subordinate'].processes['readfiles']['deramp'] = '1' + if self.stack[date][burst]['main'].processes['readfiles']['reramp'] != '0': + self.stack[date][burst]['main'].processes['readfiles']['reramp'] = '0' - # Deramp master - date = self.master_date + # Deramp main + date = self.main_date for burst in bursts: path = self.burst_path(date, burst, full_path=True) - master_file = self.burst_path(key=burst, dat_type='slave', full_path=False) - master_deramped = self.burst_path(key=burst, dat_type='slave_deramped', full_path=False) + main_file = self.burst_path(key=burst, dat_type='subordinate', full_path=False) + main_deramped = self.burst_path(key=burst, dat_type='subordinate_deramped', full_path=False) - if not os.path.exists(os.path.join(path, master_deramped)) or not master: - command1 = 'python ' + os.path.join(self.function_path, 'do_deramp_SLC.py') + ' ' + master_file + ' slave.res' + if not os.path.exists(os.path.join(path, main_deramped)) or not main: + command1 = 'python ' + os.path.join(self.function_path, 'do_deramp_SLC.py') + ' ' + main_file + ' subordinate.res' job_list1.append({"path": path, "command": command1}) if not self.parallel: os.chdir(path) @@ -434,20 +434,20 @@ def deramp(self, master=True): jobs.run(job_list1) jobs.run(job_list2) - # Create links for master if needed. + # Create links for main if needed. for burst in bursts: - master_file = self.burst_path(key=burst, date=date, dat_type='slave_deramped', full_path=True) - - for date_slave in self.coreg_dates: - slave_file = self.burst_path(key=burst, date=date_slave, dat_type='master_deramped', full_path=True) - if not os.path.exists(slave_file): - os.symlink(master_file, slave_file) - if self.stack[date_slave][burst]['master'].processes['crop']['Data_output_file'] != os.path.basename(slave_file): - self.stack[date_slave][burst]['master'].processes['crop']['Data_output_file'] = os.path.basename(slave_file) - if self.stack[date_slave][burst]['master'].processes['readfiles']['deramp'] != '1': - self.stack[date_slave][burst]['master'].processes['readfiles']['deramp'] = '1' - if self.stack[date_slave][burst]['master'].processes['readfiles']['reramp'] != '0': - self.stack[date_slave][burst]['master'].processes['readfiles']['reramp'] = '0' + main_file = self.burst_path(key=burst, date=date, dat_type='subordinate_deramped', full_path=True) + + for date_subordinate in self.coreg_dates: + subordinate_file = self.burst_path(key=burst, date=date_subordinate, dat_type='main_deramped', full_path=True) + if not os.path.exists(subordinate_file): + os.symlink(main_file, subordinate_file) + if self.stack[date_subordinate][burst]['main'].processes['crop']['Data_output_file'] != os.path.basename(subordinate_file): + self.stack[date_subordinate][burst]['main'].processes['crop']['Data_output_file'] = os.path.basename(subordinate_file) + if self.stack[date_subordinate][burst]['main'].processes['readfiles']['deramp'] != '1': + self.stack[date_subordinate][burst]['main'].processes['readfiles']['deramp'] = '1' + if self.stack[date_subordinate][burst]['main'].processes['readfiles']['reramp'] != '0': + self.stack[date_subordinate][burst]['main'].processes['readfiles']['reramp'] = '0' self.update_res(dates=self.coreg_dates) @@ -465,11 +465,11 @@ def icc_burst(self, ps=False): for burst in self.stack[date].keys(): if self.stack[date][burst]['ifgs'].process_control['fine_coreg'] != '1': path = self.burst_path(date, burst, full_path=True) - master_file = self.burst_path(key=burst,dat_type='master',full_path=False) + main_file = self.burst_path(key=burst,dat_type='main',full_path=False) if not(self.parallel): os.chdir(path) if ps == True: - command1 = 'python -m' + 'get_winpos' + ' ' + master_file + ' master.res 101 winpos_fine.asc' + command1 = 'python -m' + 'get_winpos' + ' ' + main_file + ' main.res 101 winpos_fine.asc' job_list1.append({"path": path, "command": command1}) command2 = self.doris_path + ' ' + os.path.join(self.input_files,'input.finecoreg_icc_pointscat') job_list2.append({"path": path, "command": command2}) @@ -486,7 +486,7 @@ def icc_burst(self, ps=False): jobs.run(job_list1) jobs.run(job_list2) - self.fake_master_steps(step='fine_coreg', full_swath=False) + self.fake_main_steps(step='fine_coreg', full_swath=False) def coreg_full_swath(self): # Do the combined icc and dem coregistration for the full swath @@ -508,7 +508,7 @@ def coreg_full_swath(self): for burst in bursts: icc = self.stack[date][burst]['ifgs'].processes['fine_coreg'] - position = self.stack[date][burst]['master'].processes['readfiles'] + position = self.stack[date][burst]['main'].processes['readfiles'] trans_p = self.stack[date][burst]['ifgs'].processes['coarse_correl']['Coarse_correlation_translation_pixels'] trans_l = self.stack[date][burst]['ifgs'].processes['coarse_correl']['Coarse_correlation_translation_lines'] @@ -538,7 +538,7 @@ def coreg_full_swath(self): res_path = self.image_path(date,file_path='ifgs.res') self.full_swath[date]['ifgs'].write(new_filename=res_path) - self.fake_master_steps(step='fine_coreg', burst_proc=False) + self.fake_main_steps(step='fine_coreg', burst_proc=False) def dac_bursts(self): # Do the DEM coregistration and coregpm for the full swath @@ -562,7 +562,7 @@ def dac_bursts(self): jobs = Jobs(self.nr_of_jobs, self.doris_parameters) jobs.run(job_list) - self.fake_master_steps(step='dem_assist', full_swath=False) + self.fake_main_steps(step='dem_assist', full_swath=False) def coreg_bursts(self,no_poly=True): # Write coregistration results from full swath to individual bursts @@ -615,8 +615,8 @@ def coreg_bursts(self,no_poly=True): for burst in self.stack[date].keys(): # Now convert to burst coreg using the pixel and line offset - line_burst = int(self.stack[date][burst]['master'].processes['readfiles']['First_line (w.r.t. output_image)']) - pixel_burst = int(self.stack[date][burst]['master'].processes['readfiles']['First_pixel (w.r.t. output_image)']) + line_burst = int(self.stack[date][burst]['main'].processes['readfiles']['First_line (w.r.t. output_image)']) + pixel_burst = int(self.stack[date][burst]['main'].processes['readfiles']['First_pixel (w.r.t. output_image)']) # And convert to an offset in the [-2,2] domain l0 = (line_burst-norm_line[0]) / (norm_line[1]-norm_line[0]) * 4 @@ -670,20 +670,20 @@ def coreg_bursts(self,no_poly=True): coreg['row_10'] = ["{0:.8e}".format(p_poly[3]), '1', '1'] coreg['row_11'] = ["{0:.8e}".format(p_poly[5]), '0', '2'] - coreg['Deltaline_slave00_poly'] = "{0:.8e}".format(-l_eq(-2.0, -2.0)) - coreg['Deltapixel_slave00_poly'] = "{0:.8e}".format(-p_eq(-2.0, -2.0)) - coreg['Deltaline_slave0N_poly'] = "{0:.8e}".format(-l_eq(-2.0, 2.0)) - coreg['Deltapixel_slave0N_poly'] = "{0:.8e}".format(-p_eq(-2, 2.0)) - coreg['Deltaline_slaveN0_poly'] = "{0:.8e}".format(-l_eq(2.0, -2.0)) - coreg['Deltapixel_slaveN0_poly'] = "{0:.8e}".format(-p_eq(2.0, -2.0)) - coreg['Deltaline_slaveNN_poly'] = "{0:.8e}".format(-l_eq(2.0, 2.0)) - coreg['Deltapixel_slaveNN_poly'] = "{0:.8e}".format(-p_eq(2.0, 2.0)) + coreg['Deltaline_subordinate00_poly'] = "{0:.8e}".format(-l_eq(-2.0, -2.0)) + coreg['Deltapixel_subordinate00_poly'] = "{0:.8e}".format(-p_eq(-2.0, -2.0)) + coreg['Deltaline_subordinate0N_poly'] = "{0:.8e}".format(-l_eq(-2.0, 2.0)) + coreg['Deltapixel_subordinate0N_poly'] = "{0:.8e}".format(-p_eq(-2, 2.0)) + coreg['Deltaline_subordinateN0_poly'] = "{0:.8e}".format(-l_eq(2.0, -2.0)) + coreg['Deltapixel_subordinateN0_poly'] = "{0:.8e}".format(-p_eq(2.0, -2.0)) + coreg['Deltaline_subordinateNN_poly'] = "{0:.8e}".format(-l_eq(2.0, 2.0)) + coreg['Deltapixel_subordinateNN_poly'] = "{0:.8e}".format(-p_eq(2.0, 2.0)) # Finally add the Normalization lines / pixels - lines = (int(self.stack[date][burst]['master'].processes['crop']['Last_line (w.r.t. original_image)']) - - int(self.stack[date][burst]['master'].processes['crop']['First_line (w.r.t. original_image)'])) - pixels = (int(self.stack[date][burst]['master'].processes['crop']['Last_pixel (w.r.t. original_image)']) - - int(self.stack[date][burst]['master'].processes['crop']['First_pixel (w.r.t. original_image)'])) + lines = (int(self.stack[date][burst]['main'].processes['crop']['Last_line (w.r.t. original_image)']) - + int(self.stack[date][burst]['main'].processes['crop']['First_line (w.r.t. original_image)'])) + pixels = (int(self.stack[date][burst]['main'].processes['crop']['Last_pixel (w.r.t. original_image)']) - + int(self.stack[date][burst]['main'].processes['crop']['First_pixel (w.r.t. original_image)'])) # Save pixels lines coreg['Normalization_Lines'] = "{0:.8e}".format(1) + ' ' + "{0:.8e}".format(lines) @@ -724,7 +724,7 @@ def fake_fine_coreg(self): self.update_res(dates=self.coreg_dates) - self.fake_master_steps(step='fine_coreg', full_swath=False) + self.fake_main_steps(step='fine_coreg', full_swath=False) def fake_coregmp(self): # This function is used if only geometrical coregistatration is used. @@ -742,22 +742,22 @@ def fake_coregmp(self): coreg['Estimated_coefficientsP'] = '' coreg['row_1'] = ["{0:.8e}".format(0), '0', '0'] - coreg['Deltaline_slave00_poly'] = "{0:.8e}".format(0) - coreg['Deltapixel_slave00_poly'] = "{0:.8e}".format(0) - coreg['Deltaline_slave0N_poly'] = "{0:.8e}".format(0) - coreg['Deltapixel_slave0N_poly'] = "{0:.8e}".format(0) - coreg['Deltaline_slaveN0_poly'] = "{0:.8e}".format(0) - coreg['Deltapixel_slaveN0_poly'] = "{0:.8e}".format(0) - coreg['Deltaline_slaveNN_poly'] = "{0:.8e}".format(0) - coreg['Deltapixel_slaveNN_poly'] = "{0:.8e}".format(0) + coreg['Deltaline_subordinate00_poly'] = "{0:.8e}".format(0) + coreg['Deltapixel_subordinate00_poly'] = "{0:.8e}".format(0) + coreg['Deltaline_subordinate0N_poly'] = "{0:.8e}".format(0) + coreg['Deltapixel_subordinate0N_poly'] = "{0:.8e}".format(0) + coreg['Deltaline_subordinateN0_poly'] = "{0:.8e}".format(0) + coreg['Deltapixel_subordinateN0_poly'] = "{0:.8e}".format(0) + coreg['Deltaline_subordinateNN_poly'] = "{0:.8e}".format(0) + coreg['Deltapixel_subordinateNN_poly'] = "{0:.8e}".format(0) for date in self.coreg_dates: for burst in self.stack[date].keys(): # Now convert to burst coreg using the pixel and line offset - lines = (int(self.stack[date][burst]['master'].processes['crop']['Last_line (w.r.t. original_image)']) - - int(self.stack[date][burst]['master'].processes['crop']['First_line (w.r.t. original_image)'])) - pixels = (int(self.stack[date][burst]['master'].processes['crop']['Last_pixel (w.r.t. original_image)']) - - int(self.stack[date][burst]['master'].processes['crop']['First_pixel (w.r.t. original_image)'])) + lines = (int(self.stack[date][burst]['main'].processes['crop']['Last_line (w.r.t. original_image)']) - + int(self.stack[date][burst]['main'].processes['crop']['First_line (w.r.t. original_image)'])) + pixels = (int(self.stack[date][burst]['main'].processes['crop']['Last_pixel (w.r.t. original_image)']) - + int(self.stack[date][burst]['main'].processes['crop']['First_pixel (w.r.t. original_image)'])) # Save pixels lines coreg['Normalization_Lines'] = "{0:.8e}".format(1) + ' ' + "{0:.8e}".format(lines) @@ -769,7 +769,7 @@ def fake_coregmp(self): self.update_res(dates=self.coreg_dates) - self.fake_master_steps(step='comp_coregpm', full_swath=False) + self.fake_main_steps(step='comp_coregpm', full_swath=False) def dac_full_swath(self): # This function reads the dem shift result files from the full swath and saves them to both data and result @@ -782,9 +782,9 @@ def dac_full_swath(self): for date in self.coreg_dates: for burst in self.stack[date].keys(): - master_dat = self.stack[date][burst]['master'].processes['crop'] - lines = int(master_dat['Last_line (w.r.t. original_image)']) - int(master_dat['First_line (w.r.t. original_image)']) - pixels = int(master_dat['Last_pixel (w.r.t. original_image)']) - int(master_dat['First_pixel (w.r.t. original_image)']) + main_dat = self.stack[date][burst]['main'].processes['crop'] + lines = int(main_dat['Last_line (w.r.t. original_image)']) - int(main_dat['First_line (w.r.t. original_image)']) + pixels = int(main_dat['Last_pixel (w.r.t. original_image)']) - int(main_dat['First_pixel (w.r.t. original_image)']) ref_offset_p = int(self.full_swath[date]['ifgs'].processes['coarse_orbits']['Coarse_orbits_translation_pixels']) ref_offset_l = int(self.full_swath[date]['ifgs'].processes['coarse_orbits']['Coarse_orbits_translation_lines']) offset_p = int(self.stack[date][burst]['ifgs'].processes['coarse_correl']['Coarse_correlation_translation_pixels']) @@ -814,16 +814,16 @@ def dac_full_swath(self): bursts = self.stack[date].keys() res_dem = deepcopy(self.stack[date][bursts[0]]['ifgs'].processes['dem_assist']) - master_crop = deepcopy(self.full_swath[date]['master'].processes['crop']) - - # Update fields to dimensions of master burst. - res_dem['First_line (w.r.t. original_master)'] = master_crop['First_line (w.r.t. original_image)'] - res_dem['Last_line (w.r.t. original_master)'] = master_crop['Last_line (w.r.t. original_image)'] - res_dem['First_pixel (w.r.t. original_master)'] = master_crop['First_pixel (w.r.t. original_image)'] - res_dem['Last_pixel (w.r.t. original_master)'] = master_crop['Last_pixel (w.r.t. original_image)'] - lines = int(master_crop['Last_line (w.r.t. original_image)']) - int(master_crop['First_line (w.r.t. original_image)']) + main_crop = deepcopy(self.full_swath[date]['main'].processes['crop']) + + # Update fields to dimensions of main burst. + res_dem['First_line (w.r.t. original_main)'] = main_crop['First_line (w.r.t. original_image)'] + res_dem['Last_line (w.r.t. original_main)'] = main_crop['Last_line (w.r.t. original_image)'] + res_dem['First_pixel (w.r.t. original_main)'] = main_crop['First_pixel (w.r.t. original_image)'] + res_dem['Last_pixel (w.r.t. original_main)'] = main_crop['Last_pixel (w.r.t. original_image)'] + lines = int(main_crop['Last_line (w.r.t. original_image)']) - int(main_crop['First_line (w.r.t. original_image)']) res_dem['Number of lines'] = str(lines + 1) - pixels = int(master_crop['Last_pixel (w.r.t. original_image)']) - int(master_crop['First_pixel (w.r.t. original_image)']) + pixels = int(main_crop['Last_pixel (w.r.t. original_image)']) - int(main_crop['First_pixel (w.r.t. original_image)']) res_dem['Number of pixels'] = str(pixels + 1) # Load image data @@ -838,23 +838,23 @@ def dac_full_swath(self): # Correct for corner information. res_dem['Number of pixels'] = str(pixels + 1) - res_dem['Deltaline_slave00_dem'] = str(-d_line[0,0]) - res_dem['Deltapixel_slave00_dem'] = str(-d_pixel[0,0]) - res_dem['Deltaline_slave0N_dem'] = str(-d_line[0,-1]) - res_dem['Deltapixel_slave0N_dem'] = str(-d_pixel[0,-1]) - res_dem['Deltaline_slaveN0_dem'] = str(-d_line[-1,0]) - res_dem['Deltapixel_slaveN0_dem'] = str(-d_pixel[-1,0]) - res_dem['Deltaline_slaveNN_dem'] = str(-d_line[-1,-1]) - res_dem['Deltapixel_slaveNN_dem'] = str(-d_pixel[-1,-1]) + res_dem['Deltaline_subordinate00_dem'] = str(-d_line[0,0]) + res_dem['Deltapixel_subordinate00_dem'] = str(-d_pixel[0,0]) + res_dem['Deltaline_subordinate0N_dem'] = str(-d_line[0,-1]) + res_dem['Deltapixel_subordinate0N_dem'] = str(-d_pixel[0,-1]) + res_dem['Deltaline_subordinateN0_dem'] = str(-d_line[-1,0]) + res_dem['Deltapixel_subordinateN0_dem'] = str(-d_pixel[-1,0]) + res_dem['Deltaline_subordinateNN_dem'] = str(-d_line[-1,-1]) + res_dem['Deltapixel_subordinateNN_dem'] = str(-d_pixel[-1,-1]) self.full_swath[date]['ifgs'].insert(res_dem,process='dem_assist') self.update_res(dates=self.coreg_dates) - self.fake_master_steps(step='dem_assist', burst_proc=False) + self.fake_main_steps(step='dem_assist', burst_proc=False) def resample(self, type=''): - # Resample slave bursts + # Resample subordinate bursts if len(self.coreg_dates) == 0: return @@ -865,7 +865,7 @@ def resample(self, type=''): for date in self.coreg_dates: for burst in self.stack[date].keys(): - if self.stack[date][burst]['slave'].process_control['resample'] != '1': + if self.stack[date][burst]['subordinate'].process_control['resample'] != '1': path = self.burst_path(date, burst, full_path=True) command1 = self.doris_path + ' ' + os.path.join(self.input_files, 'input.resample') @@ -883,8 +883,8 @@ def resample(self, type=''): jobs.run(jobList2) def reramp(self, type=''): - # This function reramps the radar data. If master is True, we assume that there is still an original master file - # Which means that it is not needed to reramp that one. If master is false, only the slave is reramped. + # This function reramps the radar data. If main is True, we assume that there is still an original main file + # Which means that it is not needed to reramp that one. If main is false, only the subordinate is reramped. if len(self.coreg_dates) == 0: return @@ -898,28 +898,28 @@ def reramp(self, type=''): for burst in self.stack[date].keys(): path = self.burst_path(date, burst, full_path=True) - if not os.path.exists(os.path.join(path, 'slave_rsmp_reramped.raw')): + if not os.path.exists(os.path.join(path, 'subordinate_rsmp_reramped.raw')): # If we are before the ESD step and reramp is not jet done. - command1 = 'python ' + os.path.join(self.function_path, 'do_reramp_SLC.py') + ' slave_rsmp.raw slave.res' + command1 = 'python ' + os.path.join(self.function_path, 'do_reramp_SLC.py') + ' subordinate_rsmp.raw subordinate.res' jobList1.append({"path": path, "command": command1}) if not self.parallel: os.chdir(path) os.system(command1) - if self.stack[date][burst]['slave'].processes['resample']['Data_output_file'] != 'slave_rsmp_reramped.raw': - self.stack[date][burst]['slave'].processes['resample']['Data_output_file'] = 'slave_rsmp_reramped.raw' - if self.stack[date][burst]['slave'].processes['readfiles']['reramp'] != '1': - self.stack[date][burst]['slave'].processes['readfiles']['reramp'] = '1' + if self.stack[date][burst]['subordinate'].processes['resample']['Data_output_file'] != 'subordinate_rsmp_reramped.raw': + self.stack[date][burst]['subordinate'].processes['resample']['Data_output_file'] = 'subordinate_rsmp_reramped.raw' + if self.stack[date][burst]['subordinate'].processes['readfiles']['reramp'] != '1': + self.stack[date][burst]['subordinate'].processes['readfiles']['reramp'] = '1' - # Create links for master if needed. + # Create links for main if needed. for burst in bursts: for date in self.coreg_dates: # TODO If steps like simamp are added, we have to link back to these files. - slave_file = self.burst_path(key=burst, date=date, dat_type='master', full_path=True) - if self.stack[date][burst]['master'].processes['crop']['Data_output_file'] != os.path.basename(slave_file): - self.stack[date][burst]['master'].processes['crop']['Data_output_file'] = os.path.basename(slave_file) - if self.stack[date][burst]['master'].processes['readfiles']['reramp'] != '1': - self.stack[date][burst]['master'].processes['readfiles']['reramp'] = '1' + subordinate_file = self.burst_path(key=burst, date=date, dat_type='main', full_path=True) + if self.stack[date][burst]['main'].processes['crop']['Data_output_file'] != os.path.basename(subordinate_file): + self.stack[date][burst]['main'].processes['crop']['Data_output_file'] = os.path.basename(subordinate_file) + if self.stack[date][burst]['main'].processes['readfiles']['reramp'] != '1': + self.stack[date][burst]['main'].processes['readfiles']['reramp'] = '1' if self.parallel: jobs = Jobs(self.nr_of_jobs, self.doris_parameters) @@ -927,67 +927,67 @@ def reramp(self, type=''): self.update_res(dates=self.coreg_dates) - self.fake_master_steps(step='resample') + self.fake_main_steps(step='resample') - def fake_master_resample(self): - # This script fakes a resample step for the master file (this is of course not really needed) + def fake_main_resample(self): + # This script fakes a resample step for the main file (this is of course not really needed) # This will save us a lot of time in exception handling in steps later on.... - # - create a master.res / copy slave.res + # - create a main.res / copy subordinate.res # - add resampling step (We assume a reramped result) - # - add slave_rsmp.raw and slave_rsmp_reramped.raw in complex64 format. - # - add the master original and deramp step same as the slave file. + # - add subordinate_rsmp.raw and subordinate_rsmp_reramped.raw in complex64 format. + # - add the main original and deramp step same as the subordinate file. - date = self.master_date + date = self.main_date date_1 = self.stack.keys()[0] bursts = self.stack[date_1].keys() burst_res = dict() image_res = dict() - self.read_res(dates=[self.master_date], bursts=bursts, burst_stack=burst_res, image_stack=image_res) + self.read_res(dates=[self.main_date], bursts=bursts, burst_stack=burst_res, image_stack=image_res) for burst in self.stack[self.coreg_dates[0]].keys(): # burst_path - if not burst_res[date][burst]['slave'].process_control['resample'] == '1': - burst_res[date][burst]['slave'].insert(self.stack[date_1][burst]['slave'].processes['resample'], 'resample') + if not burst_res[date][burst]['subordinate'].process_control['resample'] == '1': + burst_res[date][burst]['subordinate'].insert(self.stack[date_1][burst]['subordinate'].processes['resample'], 'resample') - # Now create symlink to master data - slave_dat = self.burst_path(self.master_date, burst, full_path=True, dat_type='slave') - slave_deramped_dat = self.burst_path(self.master_date, burst, full_path=True, dat_type='slave_deramped') - master_dat = self.burst_path(self.master_date, burst, full_path=True, dat_type='master') - master_deramped_dat = self.burst_path(self.master_date, burst, full_path=True, dat_type='master_deramped') + # Now create symlink to main data + subordinate_dat = self.burst_path(self.main_date, burst, full_path=True, dat_type='subordinate') + subordinate_deramped_dat = self.burst_path(self.main_date, burst, full_path=True, dat_type='subordinate_deramped') + main_dat = self.burst_path(self.main_date, burst, full_path=True, dat_type='main') + main_deramped_dat = self.burst_path(self.main_date, burst, full_path=True, dat_type='main_deramped') - if not os.path.exists(master_dat): - os.symlink(slave_dat, master_dat) - if not os.path.exists(master_deramped_dat): - os.symlink(slave_deramped_dat, master_deramped_dat) + if not os.path.exists(main_dat): + os.symlink(subordinate_dat, main_dat) + if not os.path.exists(main_deramped_dat): + os.symlink(subordinate_deramped_dat, main_deramped_dat) # Finally copy the resampled files in complex64 format. - resample_dat = self.burst_path(self.master_date, burst, full_path=True, file_path='slave_rsmp.raw') - resample_reramped_dat = self.burst_path(self.master_date, burst, full_path=True, file_path='slave_rsmp_reramped.raw') + resample_dat = self.burst_path(self.main_date, burst, full_path=True, file_path='subordinate_rsmp.raw') + resample_reramped_dat = self.burst_path(self.main_date, burst, full_path=True, file_path='subordinate_rsmp_reramped.raw') - lines = int(burst_res[date][burst]['slave'].processes['readfiles']['Last_line (w.r.t. output_image)']) - \ - int(burst_res[date][burst]['slave'].processes['readfiles']['First_line (w.r.t. output_image)']) + 1 - pixels = int(burst_res[date][burst]['slave'].processes['readfiles']['Last_pixel (w.r.t. output_image)']) - \ - int(burst_res[date][burst]['slave'].processes['readfiles']['First_pixel (w.r.t. output_image)']) + 1 + lines = int(burst_res[date][burst]['subordinate'].processes['readfiles']['Last_line (w.r.t. output_image)']) - \ + int(burst_res[date][burst]['subordinate'].processes['readfiles']['First_line (w.r.t. output_image)']) + 1 + pixels = int(burst_res[date][burst]['subordinate'].processes['readfiles']['Last_pixel (w.r.t. output_image)']) - \ + int(burst_res[date][burst]['subordinate'].processes['readfiles']['First_pixel (w.r.t. output_image)']) + 1 dtype = np.dtype([('re', np.int16), ('im', np.int16)]) if not os.path.exists(resample_dat): resample = np.memmap(resample_dat, dtype='complex64', mode='w+', shape=(lines, pixels)) - slc_dat = np.memmap(slave_deramped_dat, dtype=dtype, mode='r', shape=(lines, pixels)).view( + slc_dat = np.memmap(subordinate_deramped_dat, dtype=dtype, mode='r', shape=(lines, pixels)).view( np.int16).astype(np.float32).view(np.complex64) resample[:, :] = slc_dat resample.flush() if not os.path.exists(resample_reramped_dat): resample_reramped = np.memmap(resample_reramped_dat, dtype='complex64', mode='w+', shape=(lines, pixels)) - slc_ramped_dat = np.memmap(slave_dat, dtype=dtype, mode='r', shape=(lines, pixels)).view( + slc_ramped_dat = np.memmap(subordinate_dat, dtype=dtype, mode='r', shape=(lines, pixels)).view( np.int16).astype(np.float32).view(np.complex64) resample_reramped[:, :] = slc_ramped_dat resample_reramped.flush() self.update_res(dates=[date], image_stack=image_res, burst_stack=burst_res) - def fake_master_steps(self, step='subtr_refdem', network=True, burst_proc=True, full_swath=True): - # This fakes different steps for the ifgs for the master date. These are needed for further processing in a + def fake_main_steps(self, step='subtr_refdem', network=True, burst_proc=True, full_swath=True): + # This fakes different steps for the ifgs for the main date. These are needed for further processing in a # network setup. Note that we just copy data from one of the other resampled datasets, which means that the actual # information in the .res files is not correct. @@ -1000,27 +1000,27 @@ def fake_master_steps(self, step='subtr_refdem', network=True, burst_proc=True, print('Step ' + step + ' does not exist in processing') return elif step == 'resample': - self.fake_master_resample() + self.fake_main_resample() return - date = self.master_date + date = self.main_date date_1 = self.stack.keys()[0] bursts = self.stack[date_1].keys() burst_res = dict() image_res = dict() self.read_res() # Read the information from other steps first. - self.read_res(dates=[self.master_date], bursts=bursts, burst_stack=burst_res, image_stack=image_res) + self.read_res(dates=[self.main_date], bursts=bursts, burst_stack=burst_res, image_stack=image_res) if burst_proc: for burst in bursts: if burst_res[date][burst]['ifgs'].process_control[step] != '1': - lines = int(burst_res[date][burst]['master'].processes['readfiles']['Last_line (w.r.t. output_image)']) - \ - int(burst_res[date][burst]['master'].processes['readfiles']['First_line (w.r.t. output_image)']) + 1 - pixels = int(burst_res[date][burst]['master'].processes['readfiles']['Last_line (w.r.t. output_image)']) - \ - int(burst_res[date][burst]['master'].processes['readfiles']['First_line (w.r.t. output_image)']) + 1 + lines = int(burst_res[date][burst]['main'].processes['readfiles']['Last_line (w.r.t. output_image)']) - \ + int(burst_res[date][burst]['main'].processes['readfiles']['First_line (w.r.t. output_image)']) + 1 + pixels = int(burst_res[date][burst]['main'].processes['readfiles']['Last_line (w.r.t. output_image)']) - \ + int(burst_res[date][burst]['main'].processes['readfiles']['First_line (w.r.t. output_image)']) + 1 - rsmp_file = self.burst_path(self.master_date, burst, full_path=True, file_path='slave_rsmp_reramped.raw') - ifg_file = self.burst_path(self.master_date, burst, full_path=True, file_path='cint.raw') + rsmp_file = self.burst_path(self.main_date, burst, full_path=True, file_path='subordinate_rsmp_reramped.raw') + ifg_file = self.burst_path(self.main_date, burst, full_path=True, file_path='cint.raw') # Cases where we create output files relevant for further processing if not network and step == 'interfero': @@ -1041,7 +1041,7 @@ def fake_master_steps(self, step='subtr_refdem', network=True, burst_proc=True, else: # For other steps we only have to link to the interferogram. This does not make sense for the case # we are using a network for unwrapping and filtphase. But in that case it will not be used... - step_file = self.burst_path(self.master_date, burst, full_path=True, file_path=file_steps[step]) + step_file = self.burst_path(self.main_date, burst, full_path=True, file_path=file_steps[step]) if network and not os.path.exists(step_file) and os.path.exists(rsmp_file): os.symlink(rsmp_file, step_file) elif not os.path.exists(ifg_file) and os.path.exists(ifg_file): @@ -1051,20 +1051,20 @@ def fake_master_steps(self, step='subtr_refdem', network=True, burst_proc=True, res_step = copy.deepcopy(self.stack[date_1][burst]['ifgs'].processes[step]) burst_res[date][burst]['ifgs'].insert(res_step, step) # This is generally the same. - # And from the main files if needed. Works only if the master resampled slave is also concatenated... + # And from the main files if needed. Works only if the main resampled subordinate is also concatenated... if full_swath: if image_res[date]['ifgs'].process_control[step] != '1': # Follow a similar procedure for the full swath - lines = int(image_res[date]['master'].processes['readfiles']['Last_line (w.r.t. output_image)']) - \ - int(image_res[date]['master'].processes['readfiles']['First_line (w.r.t. output_image)']) + 1 - pixels = int(image_res[date]['master'].processes['readfiles']['Last_line (w.r.t. output_image)']) - \ - int(image_res[date]['master'].processes['readfiles']['First_line (w.r.t. output_image)']) + 1 + lines = int(image_res[date]['main'].processes['readfiles']['Last_line (w.r.t. output_image)']) - \ + int(image_res[date]['main'].processes['readfiles']['First_line (w.r.t. output_image)']) + 1 + pixels = int(image_res[date]['main'].processes['readfiles']['Last_line (w.r.t. output_image)']) - \ + int(image_res[date]['main'].processes['readfiles']['First_line (w.r.t. output_image)']) + 1 - rsmp_file = self.image_path(self.master_date, file_path='slave_rsmp_reramped.raw') - ifg_file = self.image_path(self.master_date, file_path='cint.raw') + rsmp_file = self.image_path(self.main_date, file_path='subordinate_rsmp_reramped.raw') + ifg_file = self.image_path(self.main_date, file_path='cint.raw') if not os.path.exists(rsmp_file) and network: - print('Please concatenate the resampled reramped master if you want to do network processing!') + print('Please concatenate the resampled reramped main if you want to do network processing!') # Cases where we create output files relevant for further processing if network == False and step == 'interfero': @@ -1085,7 +1085,7 @@ def fake_master_steps(self, step='subtr_refdem', network=True, burst_proc=True, else: # For other steps we only have to link to the interferogram. This does not make sense for the case # we are using a network for unwrapping and filtphase. But in that case it will not be used... - step_file = self.image_path(self.master_date, file_path=file_steps[step]) + step_file = self.image_path(self.main_date, file_path=file_steps[step]) if network and not os.path.exists(step_file) and os.path.exists(rsmp_file): os.symlink(rsmp_file, step_file) elif not os.path.exists(step_file) and os.path.exists(ifg_file): @@ -1098,19 +1098,19 @@ def fake_master_steps(self, step='subtr_refdem', network=True, burst_proc=True, self.update_res(dates=[date], image_stack=image_res, burst_stack=burst_res) def fake_interferogram(self): - # This step fakes the creation of an interferogram by renaming the resampled slave + # This step fakes the creation of an interferogram by renaming the resampled subordinate if len(self.coreg_dates) == 0: return self.read_res(dates=self.coreg_dates) interfero_dummy = OrderedDict() - interfero_dummy['Data_output_file'] = 'slave_rsmp_reramped.raw' + interfero_dummy['Data_output_file'] = 'subordinate_rsmp_reramped.raw' interfero_dummy['Data_output_format'] = 'complex_real4' - interfero_dummy['First_line (w.r.t. original_master)'] = '' - interfero_dummy['First_pixel (w.r.t. original_master)'] = '' - interfero_dummy['Last_line (w.r.t. original_master)'] = '' - interfero_dummy['Last_pixel (w.r.t. original_master)'] = '' + interfero_dummy['First_line (w.r.t. original_main)'] = '' + interfero_dummy['First_pixel (w.r.t. original_main)'] = '' + interfero_dummy['Last_line (w.r.t. original_main)'] = '' + interfero_dummy['Last_pixel (w.r.t. original_main)'] = '' interfero_dummy['Multilookfactor_azimuth_direction'] = '1' interfero_dummy['Multilookfactor_range_direction'] = '1' interfero_dummy['Number of lines (multilooked)'] = '' @@ -1122,13 +1122,13 @@ def fake_interferogram(self): if self.stack[date][burst]['ifgs'].process_control['interfero'] != '1': - m_dat = self.stack[date][burst]['master'].processes['crop'] + m_dat = self.stack[date][burst]['main'].processes['crop'] interfero = copy.deepcopy(interfero_dummy) - interfero['First_line (w.r.t. original_master)'] = m_dat['First_line (w.r.t. original_image)'] - interfero['First_pixel (w.r.t. original_master)'] = m_dat['First_pixel (w.r.t. original_image)'] - interfero['Last_line (w.r.t. original_master)'] = m_dat['Last_line (w.r.t. original_image)'] - interfero['Last_pixel (w.r.t. original_master)'] = m_dat['Last_pixel (w.r.t. original_image)'] + interfero['First_line (w.r.t. original_main)'] = m_dat['First_line (w.r.t. original_image)'] + interfero['First_pixel (w.r.t. original_main)'] = m_dat['First_pixel (w.r.t. original_image)'] + interfero['Last_line (w.r.t. original_main)'] = m_dat['Last_line (w.r.t. original_image)'] + interfero['Last_pixel (w.r.t. original_main)'] = m_dat['Last_pixel (w.r.t. original_image)'] n_lines = int(m_dat['Last_line (w.r.t. original_image)']) - int( m_dat['First_line (w.r.t. original_image)']) + 1 n_pixels = int(m_dat['Last_pixel (w.r.t. original_image)']) - int( @@ -1139,10 +1139,10 @@ def fake_interferogram(self): if not self.stack[date][burst]['ifgs'].process_control['interfero'] == '1': self.stack[date][burst]['ifgs'].insert(interfero, 'interfero') - # The master and slave results files are switched to get the right correction of the slave file. + # The main and subordinate results files are switched to get the right correction of the subordinate file. self.update_res(dates=self.coreg_dates) - self.fake_master_steps(step='interfero', network=True, full_swath=False) + self.fake_main_steps(step='interfero', network=True, full_swath=False) def interferogram(self, concatenate=True, overwrite=False, ras=False): @@ -1179,20 +1179,20 @@ def interferogram(self, concatenate=True, overwrite=False, ras=False): for date in self.coreg_dates: if self.full_swath[date]['ifgs'].process_control['interfero'] != '1' or overwrite is True: # Add res file information - no_lines = self.full_swath[date]['master'].processes['readfiles']['Number_of_lines_original'] - no_pixels = self.full_swath[date]['master'].processes['readfiles']['Number_of_pixels_original'] - line_0 = self.full_swath[date]['master'].processes['readfiles']['First_line (w.r.t. output_image)'] - line_1 = self.full_swath[date]['master'].processes['readfiles']['Last_line (w.r.t. output_image)'] - pix_0 = self.full_swath[date]['master'].processes['readfiles']['First_pixel (w.r.t. output_image)'] - pix_1 = self.full_swath[date]['master'].processes['readfiles']['Last_pixel (w.r.t. output_image)'] + no_lines = self.full_swath[date]['main'].processes['readfiles']['Number_of_lines_original'] + no_pixels = self.full_swath[date]['main'].processes['readfiles']['Number_of_pixels_original'] + line_0 = self.full_swath[date]['main'].processes['readfiles']['First_line (w.r.t. output_image)'] + line_1 = self.full_swath[date]['main'].processes['readfiles']['Last_line (w.r.t. output_image)'] + pix_0 = self.full_swath[date]['main'].processes['readfiles']['First_pixel (w.r.t. output_image)'] + pix_1 = self.full_swath[date]['main'].processes['readfiles']['Last_pixel (w.r.t. output_image)'] burst = self.stack[date].keys()[0] res = copy.deepcopy(self.stack[date][burst]['ifgs'].processes['interfero']) - res['First_line (w.r.t. original_master)'] = line_0 - res['Last_line (w.r.t. original_master)'] = line_1 - res['First_pixel (w.r.t. original_master)'] = pix_0 - res['Last_pixel (w.r.t. original_master)'] = pix_1 + res['First_line (w.r.t. original_main)'] = line_0 + res['Last_line (w.r.t. original_main)'] = line_1 + res['First_pixel (w.r.t. original_main)'] = pix_0 + res['Last_pixel (w.r.t. original_main)'] = pix_1 res['Number of lines (multilooked)'] = no_lines res['Number of pixels (multilooked)'] = no_pixels @@ -1203,7 +1203,7 @@ def interferogram(self, concatenate=True, overwrite=False, ras=False): # Finally show preview based on cpxfiddle if ras: - pixels = self.full_swath[date]['master'].processes['readfiles']['Number_of_pixels_original'] + pixels = self.full_swath[date]['main'].processes['readfiles']['Number_of_pixels_original'] if not os.path.exists('interferogram_mag.ras') or overwrite: mag = ' -w ' + pixels + ' -e 0.3 -s 1.0 -q mag -o sunraster -b -c gray -M 20/5 -f cr4 -l1 ' \ @@ -1220,7 +1220,7 @@ def interferogram(self, concatenate=True, overwrite=False, ras=False): self.update_res(dates=self.coreg_dates) - self.fake_master_steps(step='interfero', network=False, full_swath=concatenate) + self.fake_main_steps(step='interfero', network=False, full_swath=concatenate) def overlapping(self): # This function calculates the overlapping areas between different bursts. This function will give a list of @@ -1261,9 +1261,9 @@ def esd(self, esd_type='ps', max_baseline='200'): stack_folder = self.folder overlap = burst + '_' + next_burst ps_select = '1' - master_date = self.master_date + main_date = self.main_date command = 'python ' + os.path.join(self.function_path, 'ESD_ps_ds.py') + ' ' + stack_folder + ' ' \ - + overlap + ' ' + esd_type + ' ' + max_baseline + ' ' + master_date + ' ' + ps_select + + overlap + ' ' + esd_type + ' ' + max_baseline + ' ' + main_date + ' ' + ps_select jobList.append({"path": stack_folder, "command": command}) if not (self.parallel): @@ -1299,7 +1299,7 @@ def network_esd(self, esd_type='ps', var_calc=False): # This function calculates the ESD values using a network approach dates = (self.stack.keys()) - dates.append(self.master_date) + dates.append(self.main_date) dates = sorted(dates) w_matrix = np.sum(self.weight_matrix[esd_type], 0) @@ -1326,16 +1326,16 @@ def network_esd(self, esd_type='ps', var_calc=False): m_s = np.where(diff_matrix != 0) weight = w_matrix[diff_matrix != 0] - # Find the master date - master_num = dates.index(self.master_date) - slave_nums = range(len(dates)) - slave_nums.remove(master_num) + # Find the main date + main_num = dates.index(self.main_date) + subordinate_nums = range(len(dates)) + subordinate_nums.remove(main_num) # Create the A matrix A = np.zeros(shape=(len(m_s[0]), np.max([np.max(m_s[0]), np.max(m_s[1])]) + 1)) A[range(len(m_s[0])), m_s[0]] = 1 A[range(len(m_s[0])), m_s[1]] = -1 - A = np.hstack((A[:, :master_num], A[:, master_num + 1:])) + A = np.hstack((A[:, :main_num], A[:, main_num + 1:])) # Create the weight matrix W = np.zeros((len(m_s[0]), len(m_s[0]))) @@ -1351,25 +1351,25 @@ def network_esd(self, esd_type='ps', var_calc=False): sigma = np.std(esd_residue) dates = sorted(self.stack.keys()) - for date, shift, n in zip(dates, esd_diff, slave_nums): + for date, shift, n in zip(dates, esd_diff, subordinate_nums): self.ESD_shift[date] = shift - self.ESD_angle_pixel[date] = np.max([angle_pixel[n, master_num], angle_pixel[master_num, n]]) + self.ESD_angle_pixel[date] = np.max([angle_pixel[n, main_num], angle_pixel[main_num, n]]) def ESD_correct_ramp(self, filename='cint_srd.raw', network=False): - # This function correct for ESD using the expected ramp in the resampled slave image + # This function correct for ESD using the expected ramp in the resampled subordinate image self.read_res() jobList = [] for date in self.stack.keys(): for burst in self.stack[date].keys(): - if self.stack[date][burst]['slave'].processes['readfiles']['ESD_correct'] == '0': + if self.stack[date][burst]['subordinate'].processes['readfiles']['ESD_correct'] == '0': path = self.burst_path(date, burst, full_path=True) offset = self.ESD_shift[date] angle = self.ESD_angle_pixel[date] if not network and filename.startswith('cint'): - # Because after interferogram the slave is subtracted from the master we have to compensate. + # Because after interferogram the subordinate is subtracted from the main we have to compensate. angle_pixel = str(-offset / angle) else: angle_pixel = str(offset / angle) @@ -1377,7 +1377,7 @@ def ESD_correct_ramp(self, filename='cint_srd.raw', network=False): command = 'python ' + script + ' ' + filename + ' ' + angle_pixel jobList.append({"path": path, "command": command}) - self.stack[date][burst]['slave'].processes['readfiles']['ESD_correct'] = '1' + self.stack[date][burst]['subordinate'].processes['readfiles']['ESD_correct'] = '1' if not (self.parallel): os.chdir(path) @@ -1389,8 +1389,8 @@ def ESD_correct_ramp(self, filename='cint_srd.raw', network=False): self.update_res() - def combine_slave(self, overwrite=False, ramped=False, deramped=True, ras=False): - # This function concatenates the different slave values. Both ramped and deramped. + def combine_subordinate(self, overwrite=False, ramped=False, deramped=True, ras=False): + # This function concatenates the different subordinate values. Both ramped and deramped. # Add the resample step to the .res file if len(self.coreg_dates) == 0: @@ -1398,52 +1398,52 @@ def combine_slave(self, overwrite=False, ramped=False, deramped=True, ras=False) self.read_res(dates=self.coreg_dates) if deramped: - self.concatenate('slave_rsmp.raw', 'slave_rsmp.raw', dt= np.dtype('complex64'), overwrite=overwrite) + self.concatenate('subordinate_rsmp.raw', 'subordinate_rsmp.raw', dt= np.dtype('complex64'), overwrite=overwrite) if ramped: - self.concatenate('slave_rsmp_reramped.raw', 'slave_rsmp_reramped.raw', dt=np.dtype('complex64'), overwrite=overwrite) + self.concatenate('subordinate_rsmp_reramped.raw', 'subordinate_rsmp_reramped.raw', dt=np.dtype('complex64'), overwrite=overwrite) for date in self.coreg_dates: - if self.full_swath[date]['slave'].process_control != '1': + if self.full_swath[date]['subordinate'].process_control != '1': path = self.image_path(date) os.chdir(path) burst = self.stack[date].keys()[0] - slave_res = copy.deepcopy(self.stack[date][burst]['slave'].processes['resample']) + subordinate_res = copy.deepcopy(self.stack[date][burst]['subordinate'].processes['resample']) # Read number of lines - lines = int(self.full_swath[date]['master'].processes['readfiles']['Number_of_lines_original']) - pixels = int(self.full_swath[date]['master'].processes['readfiles']['Number_of_pixels_original']) + lines = int(self.full_swath[date]['main'].processes['readfiles']['Number_of_lines_original']) + pixels = int(self.full_swath[date]['main'].processes['readfiles']['Number_of_pixels_original']) # Add information to interfero step about lines and pixels. - slave_res['First_line (w.r.t. original_master)'] = str(1) - slave_res['Last_line (w.r.t. original_master)'] = str(lines) - slave_res['First_pixel (w.r.t. original_master)'] = str(1) - slave_res['Last_pixel (w.r.t. original_master)'] = str(pixels) - slave_res['Data_output_file'] = 'slave_rsmp_reramped.raw' + subordinate_res['First_line (w.r.t. original_main)'] = str(1) + subordinate_res['Last_line (w.r.t. original_main)'] = str(lines) + subordinate_res['First_pixel (w.r.t. original_main)'] = str(1) + subordinate_res['Last_pixel (w.r.t. original_main)'] = str(pixels) + subordinate_res['Data_output_file'] = 'subordinate_rsmp_reramped.raw' # Finally add to result file - self.full_swath[date]['slave'].insert(slave_res, 'resample') + self.full_swath[date]['subordinate'].insert(subordinate_res, 'resample') - pixels = self.full_swath[date]['master'].processes['readfiles']['Number_of_pixels_original'] + pixels = self.full_swath[date]['main'].processes['readfiles']['Number_of_pixels_original'] if ras: - if deramped and (not os.path.exists('slave_rsmp.ras') or overwrite): + if deramped and (not os.path.exists('subordinate_rsmp.ras') or overwrite): mag = ' -w ' + pixels + ' -e 0.3 -s 1.0 -q mag -o sunraster -b -c gray -M 20/5 -f cr4 -l1 ' \ - '-p1 -P' + pixels + ' slave_rsmp.raw > slave_rsmp.ras' + '-p1 -P' + pixels + ' subordinate_rsmp.raw > subordinate_rsmp.ras' os.system(self.cpxfiddle + mag) - if ramped and (not os.path.exists('slaver_rsmp_reramped.ras') or overwrite): + if ramped and (not os.path.exists('subordinater_rsmp_reramped.ras') or overwrite): mag = ' -w ' + pixels + ' -e 0.3 -s 1.0 -q mag -o sunraster -b -c gray -M 20/5 -f cr4 -l1 ' \ - '-p1 -P' + pixels + ' slave_rsmp_reramped.raw > slave_rsmp_reramped.ras' + '-p1 -P' + pixels + ' subordinate_rsmp_reramped.raw > subordinate_rsmp_reramped.ras' os.system(self.cpxfiddle + mag) self.update_res(dates=self.coreg_dates) - def combine_master(self, overwrite=False, ramped=False, deramped=True, ras=False): - # This function concatenates the master files to one image. Afterwards the full master files are linked using + def combine_main(self, overwrite=False, ramped=False, deramped=True, ras=False): + # This function concatenates the main files to one image. Afterwards the full main files are linked using # symbolic links. - date = self.master_date + date = self.main_date date_1 = self.stack.keys()[0] bursts = self.stack[date_1].keys() burst_res = dict() @@ -1451,43 +1451,43 @@ def combine_master(self, overwrite=False, ramped=False, deramped=True, ras=False self.read_res(dates=[date], bursts=bursts, burst_stack=burst_res, image_stack=image_res) if deramped: - self.concatenate('slave_rsmp.raw', 'slave_rsmp.raw', dt=np.dtype('complex64'), + self.concatenate('subordinate_rsmp.raw', 'subordinate_rsmp.raw', dt=np.dtype('complex64'), overwrite=overwrite, dates=[date]) if ramped: - self.concatenate('slave_rsmp_reramped.raw', 'slave_rsmp_reramped.raw', dt=np.dtype('complex64'), + self.concatenate('subordinate_rsmp_reramped.raw', 'subordinate_rsmp_reramped.raw', dt=np.dtype('complex64'), overwrite=overwrite, dates=[date]) path = self.image_path(date) os.chdir(path) - if image_res[date]['slave'].process_control != '1': + if image_res[date]['subordinate'].process_control != '1': burst = burst_res[date].keys()[0] - slave_res = copy.deepcopy(burst_res[date][burst]['slave'].processes['resample']) + subordinate_res = copy.deepcopy(burst_res[date][burst]['subordinate'].processes['resample']) # Read number of lines - lines = int(image_res[date]['master'].processes['readfiles']['Number_of_lines_original']) - pixels = int(image_res[date]['master'].processes['readfiles']['Number_of_pixels_original']) + lines = int(image_res[date]['main'].processes['readfiles']['Number_of_lines_original']) + pixels = int(image_res[date]['main'].processes['readfiles']['Number_of_pixels_original']) # Add information to interfero step about lines and pixels. - slave_res['First_line (w.r.t. original_master)'] = str(1) - slave_res['Last_line (w.r.t. original_master)'] = str(lines) - slave_res['First_pixel (w.r.t. original_master)'] = str(1) - slave_res['Last_pixel (w.r.t. original_master)'] = str(pixels) - slave_res['Data_output_file'] = 'slave_rsmp_reramped.raw' + subordinate_res['First_line (w.r.t. original_main)'] = str(1) + subordinate_res['Last_line (w.r.t. original_main)'] = str(lines) + subordinate_res['First_pixel (w.r.t. original_main)'] = str(1) + subordinate_res['Last_pixel (w.r.t. original_main)'] = str(pixels) + subordinate_res['Data_output_file'] = 'subordinate_rsmp_reramped.raw' # Finally add to result file - image_res[date]['slave'].insert(slave_res, 'resample') + image_res[date]['subordinate'].insert(subordinate_res, 'resample') - pixels = image_res[date]['master'].processes['readfiles']['Number_of_pixels_original'] + pixels = image_res[date]['main'].processes['readfiles']['Number_of_pixels_original'] if ras: - if deramped and (not os.path.exists('slave_rsmp.ras') or overwrite): + if deramped and (not os.path.exists('subordinate_rsmp.ras') or overwrite): mag = ' -w ' + pixels + ' -e 0.3 -s 1.0 -q mag -o sunraster -b -c gray -M 20/5 -f cr4 -l1 ' \ - '-p1 -P' + pixels + ' slave_rsmp.raw > slave_rsmp.ras' + '-p1 -P' + pixels + ' subordinate_rsmp.raw > subordinate_rsmp.ras' os.system(self.cpxfiddle + mag) - if ramped and (not os.path.exists('slaver_rsmp_reramped.ras') or overwrite): + if ramped and (not os.path.exists('subordinater_rsmp_reramped.ras') or overwrite): mag = ' -w ' + pixels + ' -e 0.3 -s 1.0 -q mag -o sunraster -b -c gray -M 20/5 -f cr4 -l1 ' \ - '-p1 -P' + pixels + ' slave_rsmp_reramped.raw > slave_rsmp_reramped.ras' + '-p1 -P' + pixels + ' subordinate_rsmp_reramped.raw > subordinate_rsmp_reramped.ras' os.system(self.cpxfiddle + mag) self.update_res(dates=[date], image_stack=image_res, burst_stack=burst_res) @@ -1519,7 +1519,7 @@ def compref_phase(self, network=False): self.read_res(dates=self.coreg_dates) self.update_res(dates=self.coreg_dates, switch=True) - self.fake_master_steps(step='comp_refphase', full_swath=False) + self.fake_main_steps(step='comp_refphase', full_swath=False) def ref_phase(self,concatenate=True, overwrite=False, network=False, ras=False): # This function performs the final steps in making an interferogram for all full images. @@ -1550,21 +1550,21 @@ def ref_phase(self,concatenate=True, overwrite=False, network=False, ras=False): if self.full_swath[date]['ifgs'].process_control['subtr_refphase'] != '1' or overwrite is True: # Add res file information - no_lines = self.full_swath[date]['master'].processes['readfiles']['Number_of_lines_original'] - no_pixels = self.full_swath[date]['master'].processes['readfiles']['Number_of_pixels_original'] - line_0 = self.full_swath[date]['master'].processes['readfiles']['First_line (w.r.t. output_image)'] - line_1 = self.full_swath[date]['master'].processes['readfiles']['Last_line (w.r.t. output_image)'] - pix_0 = self.full_swath[date]['master'].processes['readfiles']['First_pixel (w.r.t. output_image)'] - pix_1 = self.full_swath[date]['master'].processes['readfiles']['Last_pixel (w.r.t. output_image)'] + no_lines = self.full_swath[date]['main'].processes['readfiles']['Number_of_lines_original'] + no_pixels = self.full_swath[date]['main'].processes['readfiles']['Number_of_pixels_original'] + line_0 = self.full_swath[date]['main'].processes['readfiles']['First_line (w.r.t. output_image)'] + line_1 = self.full_swath[date]['main'].processes['readfiles']['Last_line (w.r.t. output_image)'] + pix_0 = self.full_swath[date]['main'].processes['readfiles']['First_pixel (w.r.t. output_image)'] + pix_1 = self.full_swath[date]['main'].processes['readfiles']['Last_pixel (w.r.t. output_image)'] burst = self.stack[date].keys()[0] res_1 = copy.deepcopy(self.stack[date][burst]['ifgs'].processes['comp_refphase']) res_2 = copy.deepcopy(self.stack[date][burst]['ifgs'].processes['subtr_refphase']) - res_2['First_line (w.r.t. original_master)'] = line_0 - res_2['Last_line (w.r.t. original_master)'] = line_1 - res_2['First_pixel (w.r.t. original_master)'] = pix_0 - res_2['Last_pixel (w.r.t. original_master)'] = pix_1 + res_2['First_line (w.r.t. original_main)'] = line_0 + res_2['Last_line (w.r.t. original_main)'] = line_1 + res_2['First_pixel (w.r.t. original_main)'] = pix_0 + res_2['Last_pixel (w.r.t. original_main)'] = pix_1 res_2['Number of lines (multilooked)'] = no_lines res_2['Number of pixels (multilooked)'] = no_pixels @@ -1576,7 +1576,7 @@ def ref_phase(self,concatenate=True, overwrite=False, network=False, ras=False): # Finally show preview based on cpxfiddle if ras: - pixels = self.full_swath[date]['master'].processes['readfiles']['Number_of_pixels_original'] + pixels = self.full_swath[date]['main'].processes['readfiles']['Number_of_pixels_original'] if not os.path.exists('interferogram_srp_mag.ras') or overwrite: mag = ' -w ' + pixels + ' -e 0.3 -s 1.0 -q mag -o sunraster -b -c gray -M 20/5 -f cr4 -l1 ' \ @@ -1593,7 +1593,7 @@ def ref_phase(self,concatenate=True, overwrite=False, network=False, ras=False): self.update_res(dates=self.coreg_dates) - self.fake_master_steps(step='subtr_refphase', full_swath=concatenate) + self.fake_main_steps(step='subtr_refphase', full_swath=concatenate) def compref_dem(self, network=False): # This function performs the final steps in making an interferogram for all full images. @@ -1615,7 +1615,7 @@ def compref_dem(self, network=False): jobs = Jobs(self.nr_of_jobs, self.doris_parameters) jobs.run(job_list1) - self.fake_master_steps(step='comp_refdem', full_swath=False) + self.fake_main_steps(step='comp_refdem', full_swath=False) def ref_dem(self,concatenate=True, overwrite=False, network=False, ras=False): # This function performs the final steps in making an interferogram for all full images. @@ -1656,28 +1656,28 @@ def ref_dem(self,concatenate=True, overwrite=False, network=False, ras=False): if self.full_swath[date]['ifgs'].process_control['subtr_refdem'] != '1' or overwrite is True: # Add res file information - no_lines = self.full_swath[date]['master'].processes['readfiles']['Number_of_lines_original'] - no_pixels = self.full_swath[date]['master'].processes['readfiles']['Number_of_pixels_original'] - line_0 = self.full_swath[date]['master'].processes['readfiles']['First_line (w.r.t. output_image)'] - line_1 = self.full_swath[date]['master'].processes['readfiles']['Last_line (w.r.t. output_image)'] - pix_0 = self.full_swath[date]['master'].processes['readfiles']['First_pixel (w.r.t. output_image)'] - pix_1 = self.full_swath[date]['master'].processes['readfiles']['Last_pixel (w.r.t. output_image)'] + no_lines = self.full_swath[date]['main'].processes['readfiles']['Number_of_lines_original'] + no_pixels = self.full_swath[date]['main'].processes['readfiles']['Number_of_pixels_original'] + line_0 = self.full_swath[date]['main'].processes['readfiles']['First_line (w.r.t. output_image)'] + line_1 = self.full_swath[date]['main'].processes['readfiles']['Last_line (w.r.t. output_image)'] + pix_0 = self.full_swath[date]['main'].processes['readfiles']['First_pixel (w.r.t. output_image)'] + pix_1 = self.full_swath[date]['main'].processes['readfiles']['Last_pixel (w.r.t. output_image)'] burst = self.stack[date].keys()[0] res_1 = copy.deepcopy(self.stack[date][burst]['ifgs'].processes['comp_refdem']) res_2 = copy.deepcopy(self.stack[date][burst]['ifgs'].processes['subtr_refdem']) - res_1['First_line (w.r.t. original_master)'] = line_0 - res_1['Last_line (w.r.t. original_master)'] = line_1 - res_1['First_pixel (w.r.t. original_master)'] = pix_0 - res_1['Last_pixel (w.r.t. original_master)'] = pix_1 + res_1['First_line (w.r.t. original_main)'] = line_0 + res_1['Last_line (w.r.t. original_main)'] = line_1 + res_1['First_pixel (w.r.t. original_main)'] = pix_0 + res_1['Last_pixel (w.r.t. original_main)'] = pix_1 res_1['Number of lines (multilooked)'] = no_lines res_1['Number of pixels (multilooked)'] = no_pixels - res_2['First_line (w.r.t. original_master)'] = line_0 - res_2['Last_line (w.r.t. original_master)'] = line_1 - res_2['First_pixel (w.r.t. original_master)'] = pix_0 - res_2['Last_pixel (w.r.t. original_master)'] = pix_1 + res_2['First_line (w.r.t. original_main)'] = line_0 + res_2['Last_line (w.r.t. original_main)'] = line_1 + res_2['First_pixel (w.r.t. original_main)'] = pix_0 + res_2['Last_pixel (w.r.t. original_main)'] = pix_1 res_2['Number of lines (multilooked)'] = no_lines res_2['Number of pixels (multilooked)'] = no_pixels @@ -1689,7 +1689,7 @@ def ref_dem(self,concatenate=True, overwrite=False, network=False, ras=False): # Finally show preview based on cpxfiddle if ras: - pixels = self.full_swath[date]['master'].processes['readfiles']['Number_of_pixels_original'] + pixels = self.full_swath[date]['main'].processes['readfiles']['Number_of_pixels_original'] if not os.path.exists('interferogram_srd_mag.ras') or overwrite: mag = ' -w ' + pixels + ' -e 0.3 -s 1.0 -q mag -o sunraster -b -c gray -M 20/5 -f cr4 -l1 ' \ @@ -1706,10 +1706,10 @@ def ref_dem(self,concatenate=True, overwrite=False, network=False, ras=False): self.update_res(dates=self.coreg_dates) - self.fake_master_steps(step='comp_refdem', full_swath=concatenate) - self.fake_master_steps(step='subtr_refdem', full_swath=concatenate) + self.fake_main_steps(step='comp_refdem', full_swath=concatenate) + self.fake_main_steps(step='subtr_refdem', full_swath=concatenate) - def coherence(self, concatenate=True, overwrite=False, coh_type='single_master', ras=False): + def coherence(self, concatenate=True, overwrite=False, coh_type='single_main', ras=False): # This function performs the final steps in making an interferogram for all full images. if len(self.coreg_dates) == 0: return @@ -1720,7 +1720,7 @@ def coherence(self, concatenate=True, overwrite=False, coh_type='single_master', for burst in self.stack[date].keys(): if self.stack[date][burst]['ifgs'].process_control['coherence'] != '1': path = self.burst_path(date, burst, full_path=True) - if coh_type == 'single_master': + if coh_type == 'single_main': command = self.doris_path + ' ' + os.path.join(self.input_files, 'input.coherence') elif coh_type == 'network': command = self.doris_path + ' ' + os.path.join(self.input_files, 'input.coherence_network') @@ -1741,20 +1741,20 @@ def coherence(self, concatenate=True, overwrite=False, coh_type='single_master', if self.full_swath[date]['ifgs'].process_control['coherence'] != '1' or overwrite is True: # Add res file information - no_lines = self.full_swath[date]['master'].processes['readfiles']['Number_of_lines_original'] - no_pixels = self.full_swath[date]['master'].processes['readfiles']['Number_of_pixels_original'] - line_0 = self.full_swath[date]['master'].processes['readfiles']['First_line (w.r.t. output_image)'] - line_1 = self.full_swath[date]['master'].processes['readfiles']['Last_line (w.r.t. output_image)'] - pix_0 = self.full_swath[date]['master'].processes['readfiles']['First_pixel (w.r.t. output_image)'] - pix_1 = self.full_swath[date]['master'].processes['readfiles']['Last_pixel (w.r.t. output_image)'] + no_lines = self.full_swath[date]['main'].processes['readfiles']['Number_of_lines_original'] + no_pixels = self.full_swath[date]['main'].processes['readfiles']['Number_of_pixels_original'] + line_0 = self.full_swath[date]['main'].processes['readfiles']['First_line (w.r.t. output_image)'] + line_1 = self.full_swath[date]['main'].processes['readfiles']['Last_line (w.r.t. output_image)'] + pix_0 = self.full_swath[date]['main'].processes['readfiles']['First_pixel (w.r.t. output_image)'] + pix_1 = self.full_swath[date]['main'].processes['readfiles']['Last_pixel (w.r.t. output_image)'] burst = self.stack[date].keys()[0] res = copy.deepcopy(self.stack[date][burst]['ifgs'].processes['coherence']) - res['First_line (w.r.t. original_master)'] = line_0 - res['Last_line (w.r.t. original_master)'] = line_1 - res['First_pixel (w.r.t. original_master)'] = pix_0 - res['Last_pixel (w.r.t. original_master)'] = pix_1 + res['First_line (w.r.t. original_main)'] = line_0 + res['Last_line (w.r.t. original_main)'] = line_1 + res['First_pixel (w.r.t. original_main)'] = pix_0 + res['Last_pixel (w.r.t. original_main)'] = pix_1 res['Number of lines (multilooked)'] = no_lines res['Number of pixels (multilooked)'] = no_pixels @@ -1765,7 +1765,7 @@ def coherence(self, concatenate=True, overwrite=False, coh_type='single_master', # Finally show preview based on cpxfiddle if ras: - pixels = self.full_swath[date]['master'].processes['readfiles']['Number_of_pixels_original'] + pixels = self.full_swath[date]['main'].processes['readfiles']['Number_of_pixels_original'] if not os.path.exists('coherence.ras') or overwrite: mag = ' -w ' + pixels + ' -q normal -o sunraster -b -c gray -M 20/5 -r 0.0/1.0 -f r4 -l1 ' \ @@ -1774,7 +1774,7 @@ def coherence(self, concatenate=True, overwrite=False, coh_type='single_master', self.update_res(dates=self.coreg_dates) - self.fake_master_steps(step='coherence', full_swath=concatenate) + self.fake_main_steps(step='coherence', full_swath=concatenate) def phasefilt(self,concatenate=True, overwrite=False, ras=False): # This function performs the phase filtering of the individual bursts. @@ -1806,20 +1806,20 @@ def phasefilt(self,concatenate=True, overwrite=False, ras=False): if self.full_swath[date]['ifgs'].process_control['filtphase'] != '1' or overwrite is True: # Add res file information - no_lines = self.full_swath[date]['master'].processes['readfiles']['Number_of_lines_original'] - no_pixels = self.full_swath[date]['master'].processes['readfiles']['Number_of_pixels_original'] - line_0 = self.full_swath[date]['master'].processes['readfiles']['First_line (w.r.t. output_image)'] - line_1 = self.full_swath[date]['master'].processes['readfiles']['Last_line (w.r.t. output_image)'] - pix_0 = self.full_swath[date]['master'].processes['readfiles']['First_pixel (w.r.t. output_image)'] - pix_1 = self.full_swath[date]['master'].processes['readfiles']['Last_pixel (w.r.t. output_image)'] + no_lines = self.full_swath[date]['main'].processes['readfiles']['Number_of_lines_original'] + no_pixels = self.full_swath[date]['main'].processes['readfiles']['Number_of_pixels_original'] + line_0 = self.full_swath[date]['main'].processes['readfiles']['First_line (w.r.t. output_image)'] + line_1 = self.full_swath[date]['main'].processes['readfiles']['Last_line (w.r.t. output_image)'] + pix_0 = self.full_swath[date]['main'].processes['readfiles']['First_pixel (w.r.t. output_image)'] + pix_1 = self.full_swath[date]['main'].processes['readfiles']['Last_pixel (w.r.t. output_image)'] burst = self.stack[date].keys()[0] res = copy.deepcopy(self.stack[date][burst]['ifgs'].processes['filtphase']) - res['First_line (w.r.t. original_master)'] = line_0 - res['Last_line (w.r.t. original_master)'] = line_1 - res['First_pixel (w.r.t. original_master)'] = pix_0 - res['Last_pixel (w.r.t. original_master)'] = pix_1 + res['First_line (w.r.t. original_main)'] = line_0 + res['Last_line (w.r.t. original_main)'] = line_1 + res['First_pixel (w.r.t. original_main)'] = pix_0 + res['Last_pixel (w.r.t. original_main)'] = pix_1 res['Number of lines (multilooked)'] = no_lines res['Number of pixels (multilooked)'] = no_pixels @@ -1830,7 +1830,7 @@ def phasefilt(self,concatenate=True, overwrite=False, ras=False): # Finally show preview based on cpxfiddle if ras: - pixels = self.full_swath[date]['master'].processes['readfiles']['Number_of_pixels_original'] + pixels = self.full_swath[date]['main'].processes['readfiles']['Number_of_pixels_original'] if not os.path.exists('interferogram_filt_mag.ras') or overwrite: mag = ' -w ' + pixels + ' -e 0.3 -s 1.0 -q mag -o sunraster -b -c gray -M 20/5 -f cr4 -l1 ' \ @@ -1847,7 +1847,7 @@ def phasefilt(self,concatenate=True, overwrite=False, ras=False): self.update_res(dates=self.coreg_dates) - self.fake_master_steps(step='filtphase', full_swath=concatenate) + self.fake_main_steps(step='filtphase', full_swath=concatenate) def unwrap(self, ras=True): # This function is used to call the unwrapping program snaphu via doris. @@ -1872,21 +1872,21 @@ def unwrap(self, ras=True): '-p1 -P' + pixels + ' unwrapped.raw > unwrapped.ras' os.system(self.cpxfiddle + pha) - self.fake_master_steps(step='unwrap', burst_proc=False) + self.fake_main_steps(step='unwrap', burst_proc=False) def calc_coordinates(self, createdem=True): # Calculate the coordinates of grid cells - # choose date closest to master as reference - date = self.master_date + # choose date closest to main as reference + date = self.main_date date_1 = self.stack.keys()[0] bursts = self.stack[date_1].keys() burst_res = dict() image_res = dict() - self.read_res(dates=[self.master_date], bursts=bursts, burst_stack=burst_res, image_stack=image_res) + self.read_res(dates=[self.main_date], bursts=bursts, burst_stack=burst_res, image_stack=image_res) - print('Coordinates are created for master date ' + date) + print('Coordinates are created for main date ' + date) doris_dir = self.doris_path @@ -1904,8 +1904,8 @@ def calc_coordinates(self, createdem=True): # dem_inputfile = os.path.join(self.input_files, 'input.createdem') # Run if one of the files does not exist... - # geocode_master(folder, geocode_inputfile, dem_inputfile, doris_dir) - # this function geocode the bursts of a master file, based on a DEM + # geocode_main(folder, geocode_inputfile, dem_inputfile, doris_dir) + # this function geocode the bursts of a main file, based on a DEM # Run the create DEM command # command1 = self.doris_path + ' ' + dem_inputfile @@ -1917,7 +1917,7 @@ def calc_coordinates(self, createdem=True): # jobs = Jobs(self.nr_of_jobs, self.doris_parameters) # jobs.run(job_list1) - self.read_res(dates=[self.master_date], bursts=bursts, burst_stack=burst_res, image_stack=image_res) + self.read_res(dates=[self.main_date], bursts=bursts, burst_stack=burst_res, image_stack=image_res) for burst in burst_res[date].keys(): if not burst_res[date][burst]['ifgs'].process_control['slant2h'] == 1: @@ -1928,14 +1928,14 @@ def calc_coordinates(self, createdem=True): sl2h_dat['Method'] = 'schwabisch' sl2h_dat['Data_output_file'] = 'dem_radar.raw' sl2h_dat['Data_output_format'] = 'real4' - sl2h_dat['First_line (w.r.t. original_master)'] = resultfile.processes['comp_refdem'][ - 'First_line (w.r.t. original_master)'] - sl2h_dat['Last_line (w.r.t. original_master)'] = resultfile.processes['comp_refdem'][ - 'Last_line (w.r.t. original_master)'] - sl2h_dat['First_pixel (w.r.t. original_master)'] = resultfile.processes['comp_refdem'][ - 'First_pixel (w.r.t. original_master)'] - sl2h_dat['Last_pixel (w.r.t. original_master)'] = resultfile.processes['comp_refdem'][ - 'Last_pixel (w.r.t. original_master)'] + sl2h_dat['First_line (w.r.t. original_main)'] = resultfile.processes['comp_refdem'][ + 'First_line (w.r.t. original_main)'] + sl2h_dat['Last_line (w.r.t. original_main)'] = resultfile.processes['comp_refdem'][ + 'Last_line (w.r.t. original_main)'] + sl2h_dat['First_pixel (w.r.t. original_main)'] = resultfile.processes['comp_refdem'][ + 'First_pixel (w.r.t. original_main)'] + sl2h_dat['Last_pixel (w.r.t. original_main)'] = resultfile.processes['comp_refdem'][ + 'Last_pixel (w.r.t. original_main)'] sl2h_dat['Multilookfactor_azimuth_direction'] = resultfile.processes['comp_refdem'][ 'Multilookfactor_azimuth_direction'] sl2h_dat['Multilookfactor_range_direction'] = resultfile.processes['comp_refdem'][ @@ -1982,9 +1982,9 @@ def calc_coordinates(self, createdem=True): # Create symlinks for bursts for burst in burst_res[date].keys(): - dat_lam = self.burst_path(self.master_date, burst, 'lam.raw', full_path=True) - dat_phi = self.burst_path(self.master_date, burst, 'phi.raw', full_path=True) - dat_dem = self.burst_path(self.master_date, burst, 'dem_radar.raw', full_path=True) + dat_lam = self.burst_path(self.main_date, burst, 'lam.raw', full_path=True) + dat_phi = self.burst_path(self.main_date, burst, 'phi.raw', full_path=True) + dat_dem = self.burst_path(self.main_date, burst, 'dem_radar.raw', full_path=True) for date_s in dates: link_lam = self.burst_path(date_s, burst, 'lam.raw', full_path=True) @@ -2000,9 +2000,9 @@ def calc_coordinates(self, createdem=True): # Create symlinks for images for date in dates: - dat_lam = self.image_path(self.master_date, 'lam.raw') - dat_phi = self.image_path(self.master_date, 'phi.raw') - dat_dem = self.image_path(self.master_date, 'dem_radar.raw') + dat_lam = self.image_path(self.main_date, 'lam.raw') + dat_phi = self.image_path(self.main_date, 'phi.raw') + dat_dem = self.image_path(self.main_date, 'dem_radar.raw') link_lam = self.image_path(date, 'lam.raw') link_phi = self.image_path(date, 'phi.raw') @@ -2015,8 +2015,8 @@ def calc_coordinates(self, createdem=True): if not os.path.exists(link_dem): os.symlink(dat_dem, link_dem) - def concatenate(self, burst_file, master_file, dt=np.dtype(np.float32), overwrite=False, dates=[], multilooked='False', res_type='master'): - # Concatenate all burst to a single full swath product. If burst_file = 'master' then the input master files are read... + def concatenate(self, burst_file, main_file, dt=np.dtype(np.float32), overwrite=False, dates=[], multilooked='False', res_type='main'): + # Concatenate all burst to a single full swath product. If burst_file = 'main' then the input main files are read... # This function also accepts cpxint16 datatype if not dates: @@ -2025,7 +2025,7 @@ def concatenate(self, burst_file, master_file, dt=np.dtype(np.float32), overwrit for date in dates: path = self.image_path(date) - final_path = os.path.join(path, master_file) + final_path = os.path.join(path, main_file) if not os.path.exists(final_path) or overwrite == True: command1 = 'python ' + os.path.join(self.function_path, 'concatenate_decatenate.py') + ' ' + path \ @@ -2072,8 +2072,8 @@ def multilook(self, ra=40, az=10, step='filtphase'): for date in self.coreg_dates: print(date) - lines = int(self.full_swath[date]['master'].processes['readfiles']['Number_of_lines_original']) - pixels = int(self.full_swath[date]['master'].processes['readfiles']['Number_of_pixels_original']) + lines = int(self.full_swath[date]['main'].processes['readfiles']['Number_of_lines_original']) + pixels = int(self.full_swath[date]['main'].processes['readfiles']['Number_of_pixels_original']) date_path = self.image_path(date) os.chdir(date_path) @@ -2121,7 +2121,7 @@ def multilook(self, ra=40, az=10, step='filtphase'): self.update_res() - def decatenate(self, burst_file, master_file, dt=np.dtype(np.float32), dates=[], multilooked=False, res_type='master'): + def decatenate(self, burst_file, main_file, dt=np.dtype(np.float32), dates=[], multilooked=False, res_type='main'): # Split full swath into different burst products. (to be used for DEM result splitting) if not dates: @@ -2148,9 +2148,9 @@ def burst_path(self, date='', key='', file_path='', stack_folder=False, dat_type if dat_type: file_path = '_iw_' + key[6] + '_burst_' + key[14:] - if dat_type == 'master' or dat_type == 'slave': + if dat_type == 'main' or dat_type == 'subordinate': file_path = dat_type + file_path + '.raw' - elif dat_type == 'master_deramped' or dat_type == 'slave_deramped': + elif dat_type == 'main_deramped' or dat_type == 'subordinate_deramped': file_path = dat_type[:-9] + file_path + '_deramped.raw' if full_path is True: @@ -2240,19 +2240,19 @@ def image_paths(self, stack, dates=[], file_path='', stack_folder=False): return paths @staticmethod - def read_image_paths(master_key, stack_folder): + def read_image_paths(main_key, stack_folder): # This functions reads all the current folders from a stack. # Select different categories of directories. stack_dirs = next(os.walk(stack_folder))[1] - master = os.path.join(stack_folder, master_key) + main = os.path.join(stack_folder, main_key) esd = os.path.join(stack_folder, 'esd') - slaves = [os.path.join(stack_folder, dir_s) for dir_s in stack_dirs if dir_s != master_key and len(dir_s) == 8] + subordinates = [os.path.join(stack_folder, dir_s) for dir_s in stack_dirs if dir_s != main_key and len(dir_s) == 8] ifg = [os.path.join(stack_folder, dir_s) for dir_s in stack_dirs if len(dir_s) == 21] - return master, slaves, ifg, esd + return main, subordinates, ifg, esd - def read_burst_paths(self, master_key, stack_folder, dat_type='list'): + def read_burst_paths(self, main_key, stack_folder, dat_type='list'): # The output can be in 2 formats. A list with all # folders, including image and burst folders, or a dict structure. if dat_type == 'list': @@ -2263,10 +2263,10 @@ def read_burst_paths(self, master_key, stack_folder, dat_type='list'): print('dat_type should either be a list or dict') return - master, slaves, ifg = self.read_image_paths(master_key, stack_folder)[:3] + main, subordinates, ifg = self.read_image_paths(main_key, stack_folder)[:3] # And find the corresponding folders: - for fold, dirs in zip(folders, [[master], slaves, ifg]): + for fold, dirs in zip(folders, [[main], subordinates, ifg]): for direc in dirs: if dat_type == 'list': fold.append(os.path.basename(direc)) @@ -2283,7 +2283,7 @@ def read_burst_paths(self, master_key, stack_folder, dat_type='list'): elif dat_type == 'list': fold.append(os.path.join(os.path.basename(direc), swath, burst)) - # Now return master, slave and ifg setup + # Now return main, subordinate and ifg setup return folders[0], folders[1], folders[2] def update_res(self, dates='default', stack_folder='', burst_stack=list(), image_stack=list()): @@ -2301,23 +2301,23 @@ def update_res(self, dates='default', stack_folder='', burst_stack=list(), image for burst in burst_stack[date].keys(): files = burst_stack[date][burst].keys() - if 'slave' in files: - slave_res = self.burst_path(date, burst, 'slave.res', stack_folder=stack_folder, full_path=True) - burst_stack[date][burst]['slave'].write(new_filename=slave_res) - if 'master' in files: - master_res = self.burst_path(date, burst, 'master.res', stack_folder=stack_folder, full_path=True) - burst_stack[date][burst]['master'].write(new_filename=master_res) + if 'subordinate' in files: + subordinate_res = self.burst_path(date, burst, 'subordinate.res', stack_folder=stack_folder, full_path=True) + burst_stack[date][burst]['subordinate'].write(new_filename=subordinate_res) + if 'main' in files: + main_res = self.burst_path(date, burst, 'main.res', stack_folder=stack_folder, full_path=True) + burst_stack[date][burst]['main'].write(new_filename=main_res) if 'ifgs' in files: ifgs_res = self.burst_path(date,burst,'ifgs.res', stack_folder=stack_folder, full_path=True) burst_stack[date][burst]['ifgs'].write(new_filename=ifgs_res) files = image_stack[date].keys() - if 'slave' in files: - slave_res = self.image_path(date, 'slave.res', stack_folder=stack_folder) - image_stack[date]['slave'].write(new_filename=slave_res) - if 'master' in files: - master_res = self.image_path(date, 'master.res', stack_folder=stack_folder) - image_stack[date]['master'].write(new_filename=master_res) + if 'subordinate' in files: + subordinate_res = self.image_path(date, 'subordinate.res', stack_folder=stack_folder) + image_stack[date]['subordinate'].write(new_filename=subordinate_res) + if 'main' in files: + main_res = self.image_path(date, 'main.res', stack_folder=stack_folder) + image_stack[date]['main'].write(new_filename=main_res) if 'ifgs' in files: ifgs_res = self.image_path(date, 'ifgs.res', stack_folder=stack_folder) image_stack[date]['ifgs'].write(new_filename=ifgs_res) @@ -2347,28 +2347,28 @@ def read_res(self, coreg_dates=False, dates='default', stack_folder='', burst_st if not burst in burst_stack[date].keys(): burst_stack[date][burst] = dict() - slave_res = self.burst_path(date, burst, 'slave.res', stack_folder=stack_folder, full_path=True) - master_res = self.burst_path(date, burst, 'master.res', stack_folder=stack_folder, full_path=True) + subordinate_res = self.burst_path(date, burst, 'subordinate.res', stack_folder=stack_folder, full_path=True) + main_res = self.burst_path(date, burst, 'main.res', stack_folder=stack_folder, full_path=True) ifgs_res = self.burst_path(date, burst,'ifgs.res', stack_folder=stack_folder, full_path=True) - if os.path.exists(slave_res): - burst_stack[date][burst]['slave'] = ResData(filename=slave_res) - if os.path.exists(master_res): - burst_stack[date][burst]['master'] = ResData(filename=master_res) + if os.path.exists(subordinate_res): + burst_stack[date][burst]['subordinate'] = ResData(filename=subordinate_res) + if os.path.exists(main_res): + burst_stack[date][burst]['main'] = ResData(filename=main_res) if os.path.exists(ifgs_res): burst_stack[date][burst]['ifgs'] = ResData(filename=ifgs_res) if not date in image_stack.keys(): image_stack[date] = dict() - slave_res = self.image_path(date, 'slave.res', stack_folder=stack_folder) - master_res = self.image_path(date, 'master.res', stack_folder=stack_folder) + subordinate_res = self.image_path(date, 'subordinate.res', stack_folder=stack_folder) + main_res = self.image_path(date, 'main.res', stack_folder=stack_folder) ifgs_res = self.image_path(date, 'ifgs.res', stack_folder=stack_folder) - if os.path.exists(slave_res): - image_stack[date]['slave'] = ResData(filename=slave_res) - if os.path.exists(master_res): - image_stack[date]['master'] = ResData(filename=master_res) + if os.path.exists(subordinate_res): + image_stack[date]['subordinate'] = ResData(filename=subordinate_res) + if os.path.exists(main_res): + image_stack[date]['main'] = ResData(filename=main_res) if os.path.exists(ifgs_res): image_stack[date]['ifgs'] = ResData(filename=ifgs_res) diff --git a/doris_stack/main_code/stack.py b/doris_stack/main_code/stack.py index f7a2101..4ac70e7 100644 --- a/doris_stack/main_code/stack.py +++ b/doris_stack/main_code/stack.py @@ -38,7 +38,7 @@ def __init__(self, track_dir, shape_dat, buffer=0.02, start_date='2014-04-01', e self.search_path = [] self.start_date = [] self.end_date = [] - self.master_date = [] + self.main_date = [] self.shape = [] self.shape_filename = shape_dat self.buffer = [] @@ -219,15 +219,15 @@ def create_shape(self,shape_dat,buffer=0.02): self.shape = load_shape(shape_dat, buffer) self.buffer = buffer - def check_new_images(self, master): + def check_new_images(self, main): # This function checks which images are already processed, and which are not. If certain dates are already - # processed they are removed from the list. You have to specify the master date, otherwise the script will not + # processed they are removed from the list. You have to specify the main date, otherwise the script will not # know how many burst are expected per date. # Which dates are available? image_dates = [im.astype('datetime64[D]') for im in self.image_dates] - # What is the master date - date = np.datetime64(master).astype('datetime64[D]') + # What is the main date + date = np.datetime64(main).astype('datetime64[D]') date_folders = [d for d in next(os.walk(self.path))[1] if len(d) == 8] rm_id = [] @@ -238,20 +238,20 @@ def check_new_images(self, master): if date in dates: date_folder = date_folders[np.where(dates == date)[0][0]] - # Check existing files in master folder + # Check existing files in main folder swaths = dict() swath_folders = next(os.walk(os.path.join(self.path, date_folder)))[1] if len(swath_folders) == 0: - print('No swaths in master folder') + print('No swaths in main folder') return for swath in swath_folders: self.swath_names.append(swath) swaths[swath] = sorted(next(os.walk(os.path.join(self.path, date_folder, swath)))[1]) - # Now check if the burst also in slave folders exist.... + # Now check if the burst also in subordinate folders exist.... for folder, d in zip(date_folders, dates): - # Check existing files in master folder + # Check existing files in main folder try: swath_folders = next(os.walk(os.path.join(self.path, folder)))[1] if not set(swath_folders) == set(swaths.keys()): @@ -263,14 +263,14 @@ def check_new_images(self, master): raise LookupError('Amount of bursts is not the same for ' + folder) if d == date: - # If the master is already processed we have to create the list of center and coverage of + # If the main is already processed we have to create the list of center and coverage of # bursts. # TODO make this robust for the case no seperate input data folders are created. res_files = [] for burst in bursts: dat_file = [r for r in next(os.walk(os.path.join(self.path, date_folder, swath, burst)))[2] - if (r.startswith('slave_iw') and len(r) < 25)] - res_file = os.path.join(self.path, date_folder, swath, burst, 'slave.res') + if (r.startswith('subordinate_iw') and len(r) < 25)] + res_file = os.path.join(self.path, date_folder, swath, burst, 'subordinate.res') res_files.append(res_file) center, coverage = center_shape_from_res(resfile=res_file) @@ -330,11 +330,11 @@ def select_burst(self, date=''): # bursts at other dates. This function can be run later on to update the datastack. if self.burst_names: - print('Master data is already loaded from earlier processed data.') + print('Main data is already loaded from earlier processed data.') return image_dates = [im.astype('datetime64[D]') for im in self.image_dates] - # First select which date will be the master + # First select which date will be the main if date: date = np.datetime64(date).astype('datetime64[D]') # date = deepcopy(image_dates[min(abs(self.image_dates-date))]) @@ -353,7 +353,7 @@ def select_burst(self, date=''): # Order the selected images by acquisition time. image_id = [x for (y,x) in sorted(zip([self.image_dates[i] for i in image_id],image_id))] date = date.astype(datetime).strftime('%Y-%m-%d') - self.master_date = date + self.main_date = date self.datastack[date] = dict() swath_nums = ['1', '2', '3'] @@ -430,7 +430,7 @@ def extend_burst(self): continue for i in image_id: - if date_str == self.master_date: + if date_str == self.main_date: continue print('processing data: ' + self.images[i].unzip_path) self.images[i].meta_swath(precise_folder=self.precise_orbits) @@ -485,15 +485,15 @@ def remove_incomplete_images(self): print('Number of burst for ' + key + ' is ' + str(burst_no) + ' instead of ' + str(self.burst_no) + ' and is removed from the datastack.') - def define_burst_coordinates(self,slaves=False): + def define_burst_coordinates(self,subordinates=False): # This function defines the exact coordinates in pixels of every burst based on the lower left corner of the first # burst image. In this way the total overlap of these bursts can easily be monitored. Results are written to the # coordinates variable - if slaves is True: + if subordinates is True: dates = self.datastack.keys() else: - dates = [self.master_date] + dates = [self.main_date] self.coordinates = OrderedDict() @@ -622,8 +622,8 @@ def write_stack(self,write_path='',no_data=False): image_no = str(self.datastack[date][swath][burst].burst_num) stack_no = burst[6:] xml_base = os.path.basename(xml) - res_name = os.path.join(burst_path, 'slave.res') - outdata = os.path.join(burst_path, 'slave_iw_' + xml_base[6] + '_burst_' + stack_no + '.raw') + res_name = os.path.join(burst_path, 'subordinate.res') + outdata = os.path.join(burst_path, 'subordinate_iw_' + xml_base[6] + '_burst_' + stack_no + '.raw') self.datastack[date][swath][burst].write(res_name) if not os.path.exists(res_name) or not os.path.exists(outdata): diff --git a/prepare_stack/create_doris_input_xml.py b/prepare_stack/create_doris_input_xml.py index e63462e..5949687 100644 --- a/prepare_stack/create_doris_input_xml.py +++ b/prepare_stack/create_doris_input_xml.py @@ -134,14 +134,14 @@ def _create_xml(self): input = False while input == False: - user_input = raw_input("What is the master date of your stack in yyyy-mm-dd (can be changed later): ").lower() + user_input = raw_input("What is the main date of your stack in yyyy-mm-dd (can be changed later): ").lower() try: date = datetime.strptime(user_input, '%Y-%m-%d') - self.input_file_dict['master_date'] = user_input + self.input_file_dict['main_date'] = user_input input = True except: print('Format not recognized, 01-01-2016 chosen. Check https://scihub.copernicus.eu/dhus/#/home for valid date') - self.input_file_dict['master_date'] = user_input + self.input_file_dict['main_date'] = user_input xml_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'doris_input_template.xml') tree = ET.parse(xml_file)