Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tropo_pyaps3: bugfix for hyp3 product #1061

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/mintpy/prep_hyp3.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


#########################################################################
def add_hyp3_metadata(fname,meta,is_ifg=True):
def add_hyp3_metadata(fname, meta, is_ifg=True):
'''Read/extract attribute data from HyP3 metadata file and add to metadata dictionary
Inputs:
*unw_phase.tif, *corr.tif file name, *dem.tif, *inc_map.tif, e.g.
Expand Down Expand Up @@ -57,6 +57,10 @@ def add_hyp3_metadata(fname,meta,is_ifg=True):
S = N + float(meta['Y_STEP']) * int(meta['LENGTH'])
E = W + float(meta['X_STEP']) * int(meta['WIDTH'])

# convert UTM to lat/lon
N, W = ut.utm2latlon(meta, W, N)
S, E = ut.utm2latlon(meta, E, S)

if meta['ORBIT_DIRECTION'] == 'ASCENDING':
meta['LAT_REF1'] = str(S)
meta['LAT_REF2'] = str(S)
Expand Down
8 changes: 2 additions & 6 deletions src/mintpy/tropo_pyaps3.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ def get_bounding_box(meta, geom_file=None):
# e.g. meters for UTM projection from ASF HyP3
y_unit = meta.get('Y_UNIT', 'degrees').lower()
if not y_unit.startswith('deg'):
lat0, lon0 = ut.to_latlon(meta['OG_FILE_PATH'], lon0, lat0)
lat1, lon1 = ut.to_latlon(meta['OG_FILE_PATH'], lon1, lat1)
lat0, lon0 = ut.utm2latlon(meta, easting=lon0, northing=lat0)
lat1, lon1 = ut.utm2latlon(meta, easting=lon1, northing=lat1)

else:
# radar coordinates
Expand Down Expand Up @@ -561,10 +561,6 @@ def calc_delay_timeseries(inps):
# for lookup table in geo-coded (gamma, roipac) and obs. in geo-coord
inps.lat, inps.lon = ut.get_lat_lon(geom_obj.metadata)

# convert coordinates to lat/lon, e.g. from UTM for ASF HyPP3
if not geom_obj.metadata.get('Y_UNIT', 'degrees').startswith('deg'):
inps.lat, inps.lon = ut.to_latlon(inps.atr['OG_FILE_PATH'], inps.lon, inps.lat)

else:
# for lookup table in geo-coded (gamma, roipac) and obs. in radar-coord
inps.lat, inps.lon = ut.get_lat_lon_rdc(inps.atr)
Expand Down
4 changes: 2 additions & 2 deletions src/mintpy/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ def prepare_geo_los_geometry(geom_file, unit='rad'):
E = W + x_step * width

# SNWE in meter --> degree
lat0, lon0 = to_latlon(atr['OG_FILE_PATH'], W, N)
lat1, lon1 = to_latlon(atr['OG_FILE_PATH'], E, S)
lat0, lon0 = utm2latlon(atr, W, N)
lat1, lon1 = utm2latlon(atr, E, S)
lat_step = (lat1 - lat0) / length
lon_step = (lon1 - lon0) / width

Expand Down
1 change: 1 addition & 0 deletions src/mintpy/utils/utils0.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ def get_lat_lon(meta, geom_file=None, box=None, dimension=2, ystep=1, xstep=1):

# UTM to lat/lon
if not meta['Y_UNIT'].startswith('deg') and 'UTM_ZONE' in meta.keys():
print('UTM coordinates detected, convert UTM into lat/lon')
lats, lons = utm2latlon(meta, easting=lons, northing=lats)

else:
Expand Down