Skip to content

Commit

Permalink
[snap.geocode] generalized error message in case attrs cannot be read:
Browse files Browse the repository at this point in the history
incidence and image_geometry are needed, which are currently only
extracted from Sentinel-1 metadata
  • Loading branch information
johntruckenbrodt committed Feb 27, 2019
1 parent cd15dcf commit 2f7e3f0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pyroSAR/snap/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,18 @@ def geocode(infile, outdir, t_srs=4326, tr=20, polarizations='all', shapefile=No

############################################
# Multilook node configuration
if id.sensor not in ['S1A', 'S1B']:
raise RuntimeError('This function is currently limited to Sentinel-1')

try:
image_geometry = id.meta['image_geometry']
incidence = id.meta['incidence']
except KeyError:
raise RuntimeError('This function does not yet support sensor {}'.format(id.sensor))

ml_az = int(math.floor(tr / id.spacing[1]))
if id.meta['image_geometry'] == 'Ground Range':
if image_geometry == 'Ground Range':
ml_rg = ml_az
else:
spacing_gr = id.spacing[0] / math.sin(math.radians(id.meta['incidence']))
spacing_gr = id.spacing[0] / math.sin(math.radians(incidence))
ml_rg = int(math.floor(tr / spacing_gr))

if ml_az > 1 or ml_rg > 1:
Expand Down

0 comments on commit 2f7e3f0

Please sign in to comment.