Skip to content

Commit be68b5e

Browse files
Merge pull request #416 from johntruckenbrodt/bugfix/gamma_grd_noise
[convert2gamma] fix S1 GRD thermal noise removal
2 parents 4353f74 + 7e80450 commit be68b5e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

pyroSAR/gamma/util.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from ..drivers import ID, identify_many
3535
from . import ISPPar, Namespace, par2hdr
3636
from ..ancillary import multilook_factors, hasarg, groupby, Lock
37-
from pyroSAR.examine import ExamineSnap
37+
from pyroSAR.examine import ExamineSnap, ExamineGamma
3838
from .auxil import do_execute
3939

4040
import logging
@@ -336,11 +336,15 @@ def convert2gamma(id, directory, S1_tnr=True, S1_bnr=True,
336336

337337
product = match.group('product')
338338

339-
# specify noise calibration file
340-
# L1 GRD product: thermal noise already subtracted, specify xml_noise to add back thermal noise
341-
# SLC products: specify noise file to remove noise
342-
# xml_noise = '-': noise file not specified
343-
if (S1_tnr and product == 'slc') or (not S1_tnr and product == 'grd'):
339+
# In versions released before July 2015, it was assumed that noise was already
340+
# removed in GRDs and specifying the XML file meant adding it back to the data.
341+
version = ExamineGamma().version
342+
if version < '20150701':
343+
c = (S1_tnr and product == 'slc') or (not S1_tnr and product == 'grd')
344+
else:
345+
c = S1_tnr
346+
347+
if c:
344348
xml_noise = os.path.join(id.scene, 'annotation', 'calibration', 'noise-' + base)
345349
else:
346350
xml_noise = '-'

0 commit comments

Comments
 (0)