Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test fixes #2

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/s1reader/s1_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from s1reader.s1_burst_slc import Doppler, Sentinel1BurstSlc


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 @@ -275,8 +275,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 @@ -366,12 +366,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