Skip to content

Commit 3f18705

Browse files
authored
Unit test fixes (#58)
* added manifest.safe to test SAFE/zip * updated burst ID format * fixed directory structure in zip to match S1 SAFE spec * documentation fix
1 parent 6a391db commit 3f18705

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/s1reader/s1_burst_slc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class Sentinel1BurstSlc:
142142
doppler: Doppler
143143
range_bandwidth: float
144144
polarization: str # {VV, VH, HH, HV}
145-
burst_id: str # t{track_number}_iw{1,2,3}_b{burst_index}
145+
burst_id: str # t{track_number}_{burst_index}_iw{1,2,3}
146146
platform_id: str # S1{A,B}
147147
center: tuple # {center lon, center lat} in degrees
148148
border: list # list of lon, lat coordinate tuples (in degrees) representing burst border

src/s1reader/s1_reader.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from s1reader.s1_burst_slc import Doppler, Sentinel1BurstSlc
1313

1414

15-
esa_track_burst_id_file = f"{os.path.dirname(os.path.realpath(__file__))}/data/sentinel1_track_burst_id.txt"
15+
esa_track_burst_id_file = f"{os.path.dirname(os.path.realpath(__file__))}/data/sentinel1_track_burst_id.txt"
1616

1717
# TODO evaluate if it make sense to combine below into a class
1818
def as_datetime(t_str, fmt = "%Y-%m-%dT%H:%M:%S.%f"):
@@ -275,8 +275,8 @@ def burst_from_xml(annotation_path: str, orbit_path: str, tiff_path: str,
275275
List of Sentinel1BurstSlc objects found in annotation XML.
276276
'''
277277

278-
# a 1D array where the indices are the Sentinel-1 track number
279-
# and the data at each row are the corresponding cumulative ID
278+
# a 1D array where the indices are the Sentinel-1 track number
279+
# and the data at each row are the corresponding cumulative ID
280280
# number for the last burst of the given track (i.e., line number)
281281
# get last burst ID number of each track and prepend 0
282282
tracks_burst_id = np.insert(np.loadtxt(esa_track_burst_id_file,
@@ -366,12 +366,12 @@ def burst_from_xml(annotation_path: str, orbit_path: str, tiff_path: str,
366366
dt = sensing_times[i] - ascending_node_time
367367
id_burst = int((dt.seconds + dt.microseconds / 1e6) // burst_interval)
368368

369-
# To be consistent with ESA let's start the counter of the ID
370-
# from 1 instead of from 0, i,e, the ID of the first burst of the
369+
# To be consistent with ESA let's start the counter of the ID
370+
# from 1 instead of from 0, i,e, the ID of the first burst of the
371371
# first track is 1
372372
id_burst += 1
373373

374-
# the IDs are currently local to one track. Let's adjust based on
374+
# the IDs are currently local to one track. Let's adjust based on
375375
# the last ID of the previous track
376376
id_burst += tracks_burst_id[track_number-1]
377377

22 KB
Binary file not shown.

tests/test_bursts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_burst(bursts):
2828
[-2056.701472691132, 353389.9614836443, -54143009.57327797]]
2929

3030
for i, burst in enumerate(bursts):
31-
expected_burst_id = f't71_iw3_b{844 + i}'
31+
expected_burst_id = f't71_{151200 + i}_iw3'
3232
assert burst.burst_id == expected_burst_id
3333
assert burst.i_burst == i
3434

0 commit comments

Comments
 (0)