Skip to content

Commit

Permalink
Merge pull request #2 from LiangJYu/unit_test_fixes
Browse files Browse the repository at this point in the history
Unit test fixes from isce-framework#58
  • Loading branch information
seongsujeong authored Aug 2, 2022
2 parents 2986152 + 2b4b8e7 commit 092b4d4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/s1reader/s1_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from s1reader import s1_annotation


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

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

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

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

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

Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/test_bursts.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_burst(bursts):
[-2056.701472691132, 353389.9614836443, -54143009.57327797]]

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

Expand Down

0 comments on commit 092b4d4

Please sign in to comment.