Skip to content

Commit

Permalink
Add geocode of wrap ifg, and bug fix for view.py for dset with -n
Browse files Browse the repository at this point in the history
  • Loading branch information
mgovorcin committed Jan 8, 2024
1 parent 1a344d3 commit 0abd767
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
10 changes: 8 additions & 2 deletions src/mintpy/geocode.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,13 @@ def run_geocode(inps):
box=src_box,
print_msg=False)[0]

# resample
data = res_obj.run_resample(src_data=data, box_ind=i)
# if wrapped interferogram, resample phase and amp separately
if data.dtype == np.complex64:
data_ph = res_obj.run_resample(src_data=np.angle(data), box_ind=i)
data_amp = res_obj.run_resample(src_data=np.abs(data), box_ind=i)
data = data_amp * np.exp(1j*data_ph)
else:
data = res_obj.run_resample(src_data=data, box_ind=i)

# write / save block data
if data.ndim == 3:
Expand All @@ -142,6 +147,7 @@ def run_geocode(inps):

# for binary file: ensure same data type
if not hdf5_file:
print(data.dtype)
dsDict[dsName] = np.array(dsDict[dsName], dtype=data.dtype)

# write binary file
Expand Down
19 changes: 12 additions & 7 deletions src/mintpy/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,11 +828,11 @@ def search_dataset_input(all_list, in_list=[], in_num_list=[], search_dset=True)
"""Get dataset(es) from input dataset / dataset_num"""
# make a copy to avoid weird variable behavior
in_num_list = [x for x in in_num_list]

# in_list --> in_num_list --> outNumList --> outList
if in_list:
if isinstance(in_list, str):
in_list = [in_list]
in_list = [in_list]

tempList = []
if search_dset:
Expand All @@ -847,12 +847,17 @@ def search_dataset_input(all_list, in_list=[], in_num_list=[], search_dset=True)

else:
tempList += [i for i in in_list if i in all_list]
tempList = sorted(list(set(tempList)))
in_num_list += [all_list.index(e) for e in tempList]

# Refine in_list
if in_num_list:
tempList = [ilist for ix, ilist in enumerate(tempList) if ix in in_num_list]

tempList = sorted(list(set(tempList)))
#in_num_list += [all_list.index(e) for e in tempList]
in_num_list = [all_list.index(e) for e in tempList]
# in_num_list --> outNumList
outNumList = sorted(list(set(in_num_list)))

# outNumList --> outList
outList = [all_list[i] for i in outNumList]

Expand Down Expand Up @@ -883,7 +888,7 @@ def read_dataset_input(inps):
in_list=inps.dset,
in_num_list=inps.dsetNumList,
search_dset=inps.search_dset)[1]

else:
# default dataset to display for certain type of files
if inps.key == 'ifgramStack':
Expand Down Expand Up @@ -1270,7 +1275,7 @@ def format_coord(x, y):
# title style depending on the number of subplots
num_subplot = inps.fig_row_num * inps.fig_col_num
if num_subplot <= 6:
subplot_title = title_str
subplot_title = f'{title_ind}\n{title_str}'
elif 6 < num_subplot <= 20:
subplot_title = f'{title_ind}\n{title_str}'
elif 20 < num_subplot <= 50:
Expand Down

0 comments on commit 0abd767

Please sign in to comment.