Skip to content

Commit 4bea794

Browse files
Merge pull request #333 from johntruckenbrodt/feature/S1C_CDSE
support Sentinel-1C scenes from CDSE
2 parents 3f275c5 + ac33188 commit 4bea794

File tree

5 files changed

+24
-22
lines changed

5 files changed

+24
-22
lines changed

pyroSAR/S1/auxil.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
###############################################################################
22
# general utilities for Sentinel-1
33

4-
# Copyright (c) 2016-2024, the pyroSAR Developers.
4+
# Copyright (c) 2016-2025, the pyroSAR Developers.
55

66
# This file is part of the pyroSAR Project. It is subject to the
77
# license terms in the LICENSE.txt file found in the top-level
@@ -246,21 +246,22 @@ def __catch_step_auxdata(self, sensor, start, stop, osvtype='POE'):
246246
month=date_search.month)
247247
log.info(url_sub)
248248
response = requests.get(url_sub, timeout=self.timeout)
249-
response.raise_for_status()
250-
result = response.text
251-
files_sub = list(set(re.findall(self.pattern, result)))
252-
if len(files_sub) == 0:
253-
break
254-
for file in files_sub:
255-
match = re.match(self.pattern_fine, file)
256-
start2 = datetime.strptime(match.group('start'), '%Y%m%dT%H%M%S')
257-
stop2 = datetime.strptime(match.group('stop'), '%Y%m%dT%H%M%S')
258-
if start2 < stop and stop2 > start:
259-
files.append({'filename': file,
260-
'href': url_sub + '/' + file + '.zip',
261-
'auth': None})
262-
if date_search == date_search_final:
263-
busy = False
249+
if response.status_code != 404:
250+
response.raise_for_status()
251+
result = response.text
252+
files_sub = list(set(re.findall(self.pattern, result)))
253+
if len(files_sub) == 0:
254+
break
255+
for file in files_sub:
256+
match = re.match(self.pattern_fine, file)
257+
start2 = datetime.strptime(match.group('start'), '%Y%m%dT%H%M%S')
258+
stop2 = datetime.strptime(match.group('stop'), '%Y%m%dT%H%M%S')
259+
if start2 < stop and stop2 > start:
260+
files.append({'filename': file,
261+
'href': url_sub + '/' + file + '.zip',
262+
'auth': None})
263+
if date_search == date_search_final:
264+
busy = False
264265
date_search += relativedelta(months=1)
265266
if date_search > datetime.now():
266267
busy = False

pyroSAR/drivers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,9 @@ def _unpack(self, directory, offset=None, overwrite=False, exist_ok=False):
759759
outname = os.path.join(directory, repl)
760760
outname = outname.replace('/', os.path.sep)
761761
if item.endswith('/'):
762-
os.makedirs(outname)
762+
os.makedirs(outname, exist_ok=True)
763763
else:
764+
os.makedirs(os.path.dirname(outname), exist_ok=True)
764765
try:
765766
with open(outname, 'wb') as outfile:
766767
outfile.write(archive.read(item))
@@ -1662,7 +1663,7 @@ def __init__(self, scene):
16621663

16631664
self.pattern = patterns.safe
16641665

1665-
self.pattern_ds = r'^s1[ab]-' \
1666+
self.pattern_ds = r'^s1[abcd]-' \
16661667
r'(?P<swath>s[1-6]|iw[1-3]?|ew[1-5]?|wv[1-2]|n[1-6])-' \
16671668
r'(?P<product>slc|grd|ocn)-' \
16681669
r'(?P<pol>hh|hv|vv|vh)-' \

pyroSAR/gamma/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ def geocode(scene, dem, tmpdir, outdir, spacing, scaling='linear', func_geoback=
705705
scenes = identify_many(scenes)
706706
ref = scenes[0]
707707

708-
if ref.sensor not in ['S1A', 'S1B', 'PALSAR-2']:
708+
if ref.sensor not in ['S1A', 'S1B', 'S1C', 'PALSAR-2']:
709709
raise RuntimeError(
710710
'this function currently only supports Sentinel-1 and PALSAR-2 Path data. Please stay tuned...')
711711

pyroSAR/patterns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
r'(?P<counter>[0-9]{4,})\.' \
8989
r'(?P<satellite_ID>[EN][12])'
9090

91-
safe = r'^(?P<sensor>S1[AB])_' \
91+
safe = r'^(?P<sensor>S1[ABCD])_' \
9292
r'(?P<beam>S1|S2|S3|S4|S5|S6|IW|EW|WV|EN|N1|N2|N3|N4|N5|N6|IM)_' \
9393
r'(?P<product>SLC|GRD|OCN)' \
9494
r'(?P<resolution>F|H|M|_)_' \

pyroSAR/snap/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
###############################################################################
22
# Convenience functions for SAR image batch processing with ESA SNAP
33

4-
# Copyright (c) 2016-2024, the pyroSAR Developers.
4+
# Copyright (c) 2016-2025, the pyroSAR Developers.
55

66
# This file is part of the pyroSAR Project. It is subject to the
77
# license terms in the LICENSE.txt file found in the top-level
@@ -270,7 +270,7 @@ def geocode(infile, outdir, t_srs=4326, spacing=20, polarizations='all', shapefi
270270

271271
if id.sensor in ['ASAR', 'ERS1', 'ERS2']:
272272
formatName = 'ENVISAT'
273-
elif id.sensor in ['S1A', 'S1B']:
273+
elif re.search('S1[A-Z]', id.sensor):
274274
if id.product == 'SLC':
275275
removeS1BorderNoise = False
276276
process_S1_SLC = True

0 commit comments

Comments
 (0)