diff --git a/docs/dir_structure.md b/docs/dir_structure.md index 82726e8de..0ef30fc06 100644 --- a/docs/dir_structure.md +++ b/docs/dir_structure.md @@ -388,6 +388,10 @@ mintpy.load.waterMaskFile = $DATA_DIR/SanFranSenDT42/mask/watermask.msk Here is an example workflow: [smallbaselineApp_hyp3](https://nbviewer.jupyter.org/github/insarlab/MintPy-tutorial/blob/main/smallbaselineApp_hyp3.ipynb). +HyP3 produces two types of InSAR products: 1) scene-wide products using Gamma and 2) burst-wide products using ISCE2. + ++ INSAR_GAMMA directory structure: + ``` $DATA_DIR/RidgecrestSenDT71 ├── hyp3 @@ -410,6 +414,30 @@ $DATA_DIR/RidgecrestSenDT71 └── RidgecrestSenDT71.txt ``` ++ INSAR_ISCE2_BURST directory structure: + +``` +$DATA_DIR/MtEdgecumbeSenAT174 +├── hyp3 +│ ├── S1_372326_IW3_20141017_20141110_VV_INT80_7044 +│   │   ├── S1_372326_IW3_20141017_20141110_VV_INT80_7044_dem_clipped.tif +│   │   ├── S1_372326_IW3_20141017_20141110_VV_INT80_7044_corr_clipped.tif +│   │   ├── S1_372326_IW3_20141017_20141110_VV_INT80_7044_lv_theta_clipped.tif +│   │   ├── S1_372326_IW3_20141017_20141110_VV_INT80_7044_lv_phi_clipped.tif +│   │   ├── S1_372326_IW3_20141017_20141110_VV_INT80_7044_unw_phase_clipped.tif +│   │   ├── S1_372326_IW3_20141017_20141110_VV_INT80_7044_water_mask_clipped.tif +│   │   ├── S1_372326_IW3_20141017_20141110_VV_INT80_7044.txt +│   │   └── ... +│ ├── S1_372326_IW3_20141110_20141204_VV_INT80_1894 +│   │   ├── S1_372326_IW3_20141110_20141204_VV_INT80_1894_corr_clipped.tif +│   │   ├── S1_372326_IW3_20141110_20141204_VV_INT80_1894_unw_phase_clipped.tif +│   │   ├── S1_372326_IW3_20141110_20141204_VV_INT80_1894.txt +│   │   └── ... +│   └── ... +└── mintpy + └── MtEdgecumbeSenAT174.txt +``` + The corresponding template options for `load_data`: ```cfg diff --git a/src/mintpy/prep_hyp3.py b/src/mintpy/prep_hyp3.py index d9282a3a5..2817d1b1b 100644 --- a/src/mintpy/prep_hyp3.py +++ b/src/mintpy/prep_hyp3.py @@ -26,19 +26,29 @@ def add_hyp3_metadata(fname, meta, is_ifg=True): Metadata dictionary (meta) ''' - # determine interferogram pair info and hyp3 metadata file name - sat, date1_str, date2_str, pol, res, soft, proc, ids, *_ = os.path.basename(fname).split('_') - job_id = '_'.join([sat, date1_str, date2_str, pol, res, soft, proc, ids]) - directory = os.path.dirname(fname) - meta_file = f'{os.path.join(directory,job_id)}.txt' - - # open and read hyp3 metadata + # read hyp3 metadata file + # e.g.: burst-wide product using ISCE2: {SAT}_{FRAME}_{SUBSWATH}_{DATE1}_{DATE2}_{POL}_{RES}_{IDS}.txt + # scene-wide product using Gamma: {SAT}_{DATE1}_{DATE2}_{POL}_{RES}_{SOFT}_{PROC}_{IDS}.txt + job_id = '_'.join(os.path.basename(fname).split('_')[:8]) + meta_file = os.path.join(os.path.dirname(fname), f'{job_id}.txt') hyp3_meta = {} with open(meta_file) as f: for line in f: key, value = line.strip().replace(' ','').split(':')[:2] hyp3_meta[key] = value + # get date1/2 objects + if job_id.split('_')[2].startswith('IW'): + # burst-wide product using ISCE2 + date1_str, date2_str = job_id.split('_')[3:5] + date1 = dt.datetime.strptime(f'{date1_str}','%Y%m%d') + date2 = dt.datetime.strptime(f'{date2_str}','%Y%m%d') + else: + # scene-wide product using Gamma + date1_str, date2_str = job_id.split('_')[1:3] + date1 = dt.datetime.strptime(date1_str,'%Y%m%dT%H%M%S') + date2 = dt.datetime.strptime(date2_str,'%Y%m%dT%H%M%S') + # add universal hyp3 metadata meta['PROCESSOR'] = 'hyp3' meta['CENTER_LINE_UTC'] = hyp3_meta['UTCtime'] @@ -96,11 +106,6 @@ def add_hyp3_metadata(fname, meta, is_ifg=True): # add metadata that is only relevant to interferogram files if is_ifg: - date1 = dt.datetime.strptime(date1_str,'%Y%m%dT%H%M%S') - date2 = dt.datetime.strptime(date2_str,'%Y%m%dT%H%M%S') - #date_avg = date1 + (date2 - date1) / 2 - #date_avg_seconds = (date_avg - date_avg.replace(hour=0, minute=0, second=0, microsecond=0)).total_seconds() - #meta['CENTER_LINE_UTC'] = date_avg_seconds meta['DATE12'] = f'{date1.strftime("%y%m%d")}-{date2.strftime("%y%m%d")}' meta['P_BASELINE_TOP_HDR'] = hyp3_meta['Baseline'] meta['P_BASELINE_BOTTOM_HDR'] = hyp3_meta['Baseline']