Skip to content

Commit

Permalink
tsview: print ref_yx/lalo info
Browse files Browse the repository at this point in the history
+ tsview: print out ref_yx/lalo info if available
+ simulatiton/iono: fix typo
+ utils.map.auto_lalo_seq*(): check input args for a more meaningful diagnose
  • Loading branch information
yunjunz committed Jan 14, 2024
1 parent 5a76db6 commit 5654d85
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/mintpy/simulation/iono.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def incidence_angle_ground2iono(inc_angle, iono_height=450e3):
def lalo_ground2iono(lat, lon, inc_angle, az_angle=None, head_angle=None, iono_height=450e3, method='spherical_distance'):
"""Calculate lat/lon of IPP with the given lat/lon on the ground and LOS geometry
Equation (12) in Yunjun et al. (2021, TGRS).
Equation (12) in Yunjun et al. (2022, TGRS).
Parameters: lat/lon - float, latitude/longitude of the point on the ground in degrees
inc_angle - float/np.ndarray, incidence angle of the line-of-sight vector on the ground in degrees
Expand Down
13 changes: 8 additions & 5 deletions src/mintpy/tsview.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,21 @@ def read_init_info(inps):
if not inps.ref_yx and 'REF_Y' in atr.keys():
inps.ref_yx = (int(atr['REF_Y']), int(atr['REF_X']))

# ref_yx --> ref_lalo if in geo-coord
# for plotting purpose only
if inps.ref_yx and 'Y_FIRST' in atr.keys():
inps.ref_lalo = inps.coord.radar2geo(inps.ref_yx[0], inps.ref_yx[1], print_msg=False)[0:2]
# print/plot ref_yx/lalo info
if inps.ref_yx:
vprint(f'reference point in y/x: {inps.ref_yx}')
# ref_yx --> ref_lalo if in geo-coord [for plotting purpose only]
if 'Y_FIRST' in atr.keys():
inps.ref_lalo = inps.coord.radar2geo(inps.ref_yx[0], inps.ref_yx[1], print_msg=False)[0:2]
vprint(f'reference point in lat/lon: {inps.ref_lalo}')

# do not plot native reference point if it's out of the coverage due to subset
if (inps.ref_yx and 'Y_FIRST' in atr.keys()
and inps.ref_yx == (int(atr.get('REF_Y',-999)), int(atr.get('REF_X',-999)))
and not ( inps.pix_box[0] <= inps.ref_yx[1] < inps.pix_box[2]
and inps.pix_box[1] <= inps.ref_yx[0] < inps.pix_box[3])):
inps.disp_ref_pixel = False
print('the native REF_Y/X is out of subset box, thus do not display')
vprint('the native REF_Y/X is out of subset box, thus do not display')

## initial pixel coord
if inps.lalo:
Expand Down
5 changes: 5 additions & 0 deletions src/mintpy/utils/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ def auto_lalo_sequence(geo_box, lalo_step=None, lalo_max_num=4, step_candidate=[
Example: geo_box = (128.0, 37.0, 138.0, 30.0)
lats, lons, step = m.auto_lalo_sequence(geo_box)
"""
# check input arguments
if geo_box[1] <= geo_box[3] or geo_box[2] < geo_box[0]:
raise ValueError(f'Input geo_box {geo_box} has N <= S or E <= W! Check the order of (W, N, E, S).')
if lalo_step and lalo_step <= 0:
raise ValueError(f'Input lalo_step ({lalo_step}) must be positive!')

max_lalo_dist = max([geo_box[1] - geo_box[3], geo_box[2] - geo_box[0]])

Expand Down

0 comments on commit 5654d85

Please sign in to comment.