Skip to content

Commit

Permalink
image_stitch: update REF_Y/X
Browse files Browse the repository at this point in the history
+ image_stitch: update REF_Y/X after stitching, and/or remove SUBSET_Y/XMIN/MAX

+ save_kmz: use a different data png file name to avoid conflict with / overwrite view.py's default output file name
  • Loading branch information
yunjunz committed Mar 9, 2024
1 parent 0363d89 commit 9639993
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion src/mintpy/image_stitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from skimage.transform import rescale

from mintpy.multilook import multilook_data
from mintpy.utils import plot as pp, readfile, writefile
from mintpy.utils import plot as pp, readfile, utils as ut, writefile


#############################################################################################
Expand Down Expand Up @@ -178,6 +178,20 @@ def stitch_two_matrices(mat1, atr1, mat2, atr2, apply_offset=True, print_msg=Tru
atr['LENGTH'] = length
atr['X_FIRST'] = W
atr['Y_FIRST'] = N
print(f'update LENGTH/WIDTH: {length}/{width}')
print(f'update Y/X_FIRST: {N}/{W}')

# update REF_Y/X
coord = ut.coordinate(atr)
ref_y, ref_x = coord.geo2radar(float(atr['REF_LAT']), float(atr['REF_LON']))[:2]
atr['REF_Y'], atr['REF_X'] = ref_y, ref_x
print(f'update REF_Y/X: {ref_y}/{ref_x}')

# delete SUBSET_Y/XMIN/MAX
for key in ['SUBSET_XMIN', 'SUBSET_XMAX', 'SUBSET_YMIN', 'SUBSET_YMAX']:
if key in atr.keys():
atr.pop(key)
print(f'remove {key}')

return mat, atr, mat11, mat22, mat_diff

Expand Down
2 changes: 1 addition & 1 deletion src/mintpy/save_kmz.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def write_kmz_overlay(data, meta, out_file, inps):
ax.set_ylim([length, 0])

out_file_base = os.path.splitext(out_file)[0]
data_png_file = out_file_base + '.png'
data_png_file = out_file_base + '_data.png'
print(f'writing {data_png_file} with dpi={inps.fig_dpi}')
plt.savefig(data_png_file, pad_inches=0.0, transparent=True, dpi=inps.fig_dpi)

Expand Down

0 comments on commit 9639993

Please sign in to comment.