Skip to content

Commit

Permalink
Read average azimuth pixel spacing from S1 annotation files (#140)
Browse files Browse the repository at this point in the history
* read az. pixel spacing from S1 annotation files; update burst unit test accordingly

* remove repeated code

* bump version to 0.2.4
  • Loading branch information
gshiroma authored Mar 13, 2024
1 parent 30c42c6 commit bb585c7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
3 changes: 0 additions & 3 deletions src/s1reader/s1_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,6 @@ def from_et(cls, et_in: ET):
cls.number_of_samples = \
cls._parse_scalar('imageAnnotation/imageInformation/numberOfSamples',
'scalar_int')
cls.number_of_samples = \
cls._parse_scalar('imageAnnotation/imageInformation/numberOfSamples',
'scalar_int')
cls.range_sampling_rate = \
cls._parse_scalar('generalAnnotation/productInformation/rangeSamplingRate',
'scalar_float')
Expand Down
1 change: 1 addition & 0 deletions src/s1reader/s1_burst_slc.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ class Sentinel1BurstSlc:
radar_center_frequency: float
wavelength: float
azimuth_steer_rate: float
average_azimuth_pixel_spacing: float
azimuth_time_interval: float
slant_range_time: float
starting_range: float
Expand Down
4 changes: 3 additions & 1 deletion src/s1reader/s1_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,7 @@ def burst_from_xml(annotation_path: str, orbit_path: str, tiff_path: str,
orbit_direction = product_info_element.find('pass').text

image_info_element = tree.find('imageAnnotation/imageInformation')
average_azimuth_pixel_spacing = float(image_info_element.find('azimuthPixelSpacing').text)
azimuth_time_interval = float(image_info_element.find('azimuthTimeInterval').text)
slant_range_time = float(image_info_element.find('slantRangeTime').text)
ascending_node_time_annotation =\
Expand Down Expand Up @@ -1014,7 +1015,8 @@ def burst_from_xml(annotation_path: str, orbit_path: str, tiff_path: str,
burst_misc_metadata = swath_misc_metadata.extract_by_aztime(sensing_start)

bursts[i] = Sentinel1BurstSlc(ipf_version, sensing_start, radar_freq, wavelength,
azimuth_steer_rate, azimuth_time_interval,
azimuth_steer_rate, average_azimuth_pixel_spacing,
azimuth_time_interval,
slant_range_time, starting_range, iw2_mid_range,
range_sampling_rate, range_pxl_spacing,
(n_lines, n_samples), az_fm_rate, doppler,
Expand Down
1 change: 1 addition & 0 deletions src/s1reader/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# release history
Tag = collections.namedtuple('Tag', 'version date')
release_history = (
Tag('0.2.4', '2024-03-11'),
Tag('0.2.3', '2023-09-21'),
Tag('0.2.2', '2023-09-08'),
Tag('0.2.1', '2023-08-23'),
Expand Down
5 changes: 5 additions & 0 deletions tests/test_bursts.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ def test_burst(bursts):
assert burst.radar_center_frequency == 5405000454.33435
assert burst.wavelength == 0.05546576
assert burst.azimuth_steer_rate == 0.024389943375862838

# the average azimuth pixel spacing varies across bursts
assert burst.average_azimuth_pixel_spacing > 13.9
assert burst.average_azimuth_pixel_spacing < 14.0

assert burst.starting_range == 901673.89084624
assert burst.iw2_mid_range == 875604.926001518
assert burst.range_sampling_rate == 64345238.12571428
Expand Down

0 comments on commit bb585c7

Please sign in to comment.