Skip to content

Commit

Permalink
[snap.gpt] attempt S1 border noise removal only if IPF<2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
johntruckenbrodt committed Sep 11, 2020
1 parent 41e83fc commit c85a9cb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pyroSAR/snap/auxil.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@ def gpt(xmlfile, groups=None, cleanup=True,
"""

workflow = Workflow(xmlfile)
read = workflow['Read']
write = workflow['Write']
scene = identify(read.parameters['file'])
outname = write.parameters['file']
suffix = workflow.suffix
format = write.parameters['formatName']
Expand All @@ -310,13 +312,14 @@ def gpt(xmlfile, groups=None, cleanup=True,
else:
dem_nodata = 0

if 'Remove-GRD-Border-Noise' in workflow.ids and removeS1BorderNoiseMethod == 'pyroSAR':
if 'Remove-GRD-Border-Noise' in workflow.ids \
and removeS1BorderNoiseMethod == 'pyroSAR' \
and scene.meta['IPF_version'] < 2.9:
if 'SliceAssembly' in workflow.operators:
raise RuntimeError("pyroSAR's custom border noise removal is not yet implemented for multiple scene inputs")
xmlfile = os.path.join(outname,
os.path.basename(xmlfile.replace('_bnr', '')))
if not os.path.isdir(outname):
os.makedirs(outname)
os.makedirs(outname, exist_ok=True)
# border noise removal is done outside of SNAP and the node is thus removed from the workflow
del workflow['Remove-GRD-Border-Noise']
# remove the node name from the groups
Expand All @@ -328,9 +331,7 @@ def gpt(xmlfile, groups=None, cleanup=True,
del groups[i]
else:
i += 1
# identify the input scene, unpack it and perform the custom border noise removal
read = workflow['Read']
scene = identify(read.parameters['file'])
# unpack the scene if necessary and perform the custom border noise removal
print('unpacking scene')
if scene.compression is not None:
scene.unpack(outname)
Expand Down

0 comments on commit c85a9cb

Please sign in to comment.