Skip to content

Commit e1cbc57

Browse files
seongsujeongLiangJYugshiromavbrancatscottstanie
authored
Azimuth FM rate mismatch mitigation (#80)
* Replacing the loaders in Burst* class into class methods, with further implementation for thermal and EAP correction * fix on determining beta_naught; addressing PEP8 issues * Bug fix and feature addition to BurstEAP; restructuring LUT exportation * Readibility improvement; removing unnecessary imports * Format change on `burst_id`; keeping the absolute orbit number inside `Sentinel1BurstSlc` * updates on test_bursts.py * keeping the basename of the CADS and NADS for populating RTC metadata * Update src/s1reader/s1_annotation.py Readability improvement on equation Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_annotation.py Removing commented out code Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_annotation.py Reverting the docstring to be split into two lines for PEP8 compliance Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_annotation.py Improving docstring of the code copied from isce2 Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py Removing the commented out codes Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py improvement on code brevity Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py renaming variable for better clarity Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py renaming variable name for clarity Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py variable name revised for clarity Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py variable renamed for clarity Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py improvement on docstring Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py Readability improvement of equation Co-authored-by: Liang Yu <[email protected]> * addressing comments bt @LiangJYu * docstring fix; variables renamed for clarity * implemented s1_annotation.AucCal.load_from_zip_file() * readability improvement * s1_annotation.py - code cleanup; excention handling for AUX_CAL; PEP8 compliance * docstring for `s1_burst_slc.eap_compensation_lut()` * class import scheme changed * PEP8 compliance * initial structure of modification * less mod compared to the branch fork * extended coeffs for FM rate and Doppler centroid to be used for azimuth FM mismatch rate mitigation * Working version of azimuth FM rate mismatch mitigation * Update src/s1reader/s1_orbit.py Co-authored-by: Gustavo H. X. Shiroma <[email protected]> * Update src/s1reader/s1_orbit.py Co-authored-by: Gustavo H. X. Shiroma <[email protected]> * Update src/s1reader/s1_orbit.py Co-authored-by: Gustavo H. X. Shiroma <[email protected]> * Update src/s1reader/s1_orbit.py Co-authored-by: Gustavo H. X. Shiroma <[email protected]> * Update src/s1reader/s1_orbit.py Co-authored-by: Gustavo H. X. Shiroma <[email protected]> * Update src/s1reader/s1_orbit.py Co-authored-by: Gustavo H. X. Shiroma <[email protected]> * addressing comments from @gshiroma * trailing white spaces are removed * docstring updated * Code cleanup and docstrings * code cleanup * trailing white space removed * docsrting added; variable renaming for less verbosity; * code cleanup and simplification * variable name simplification * clde cleanup * Output as isce3.core.LUT2d * threshold and num_iter for rdr2geo * Addressing codacy issue * Trailing whitespace removed * codacy issue * docstring clarification on `BurstExtendedCoeffs` * whitespace removed * Update src/s1reader/s1_orbit.py Co-authored-by: vbrancat <[email protected]> * Update src/s1reader/s1_orbit.py Co-authored-by: vbrancat <[email protected]> * Update src/s1reader/s1_annotation.py Co-authored-by: Liang Yu <[email protected]> * comment added for clarity * Update src/s1reader/s1_annotation.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_annotation.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_annotation.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: Liang Yu <[email protected]> * mod on the suggested commit to reuse the topo output filenames * fix on variable * Update src/s1reader/s1_burst_slc.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_annotation.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: vbrancat <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: vbrancat <[email protected]> * typo fix * Update src/s1reader/s1_burst_slc.py Co-authored-by: vbrancat <[email protected]> * Re-using the parsed polynomials; mitigation results as ISCE3 LUT2d * revision on import format * TODO removed * Option to turn on / off the functionalities for az fm rate mismatch mitigation * removing alias for `Rdr2Geo` * whitespace removed after resolving conflict * addressing codacy issue * Update src/s1reader/s1_burst_slc.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_annotation.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_annotation.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: Liang Yu <[email protected]> * Update src/s1reader/s1_reader.py Co-authored-by: Liang Yu <[email protected]> * variable name changed * bug fixed; variable name updated * addressing codacy issues * codacy issue * variable name changed * pulling out functions that does not need to be methods * whitespace removed * updates after linting * Docstring for `_burst_from_safe_dir` revised * Docstring for `_burst_from_zip` revised * Docstring for `load_bursts` revised * Docstring for `burst_from_xml` revised * Update src/s1reader/s1_burst_slc.py Co-authored-by: Liang Yu <[email protected]> * Docstring for `az_fm_rate_mismatch_mitigation` revised * Use temporary directory when `path_scratch` was not provided; take in az/rg steps as options to define radargrid * codacy issue * docstring updated; variable name changed * unnecessary members removed; docstring revised * temporary filename format changed * Update src/s1reader/s1_annotation.py Co-authored-by: Scott Staniewicz <[email protected]> * Update src/s1reader/s1_annotation.py Co-authored-by: Scott Staniewicz <[email protected]> * Update src/s1reader/s1_annotation.py Co-authored-by: Scott Staniewicz <[email protected]> * Update src/s1reader/s1_annotation.py Co-authored-by: Scott Staniewicz <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: Scott Staniewicz <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: Scott Staniewicz <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: Scott Staniewicz <[email protected]> * unit_degree -> in_degree * Update src/s1reader/s1_burst_slc.py Co-authored-by: Scott Staniewicz <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: Scott Staniewicz <[email protected]> * Update src/s1reader/s1_burst_slc.py Co-authored-by: Scott Staniewicz <[email protected]> * Apply suggestions from code review Co-authored-by: Scott Staniewicz <[email protected]> * variable name format revised * `mitigate_az_fmrate_mismatch` removed * PEP8 issues Co-authored-by: Seongsu Jeong <[email protected]> Co-authored-by: Liang Yu <[email protected]> Co-authored-by: Gustavo H. X. Shiroma <[email protected]> Co-authored-by: vbrancat <[email protected]> Co-authored-by: Scott Staniewicz <[email protected]>
1 parent ae88a1d commit e1cbc57

File tree

4 files changed

+522
-19
lines changed

4 files changed

+522
-19
lines changed

src/s1reader/s1_annotation.py

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
from scipy.interpolate import InterpolatedUnivariateSpline, interp1d
1616
from packaging import version
1717

18+
from isce3.core import speed_of_light
19+
1820
# Minimum IPF version from which the S1 product's Noise Annotation
1921
# Data Set (NADS) includes azimuth noise vector annotation
2022
min_ipf_version_az_noise_vector = version.parse('2.90')
@@ -333,6 +335,7 @@ class ProductAnnotation(AnnotationBase):
333335

334336
slant_range_time: float
335337

338+
336339
@classmethod
337340
def from_et(cls, et_in: ET):
338341
'''
@@ -897,3 +900,120 @@ def _anx2height(cls, delta_anx):
897900
h_t += h_i * np.sin((i+1) * worb * delta_anx + phi[i])
898901

899902
return h_t
903+
904+
905+
@dataclass
906+
class BurstExtendedCoeffs:
907+
'''
908+
Segments of FM rate / Doppler centroid polynomial coefficients.
909+
For (linear) interpolation of FM rate / Doppler Centroid along azimuth.
910+
To be used for calculating azimuth FM rate mismatch mitigation
911+
'''
912+
913+
# FM rate
914+
fm_rate_aztime_vec: np.ndarray
915+
fm_rate_coeff_arr: np.ndarray
916+
fm_rate_tau0_vec:np.ndarray
917+
918+
# Doppler centroid
919+
dc_aztime_vec: np.ndarray
920+
dc_coeff_arr: np.ndarray
921+
dc_tau0_vec: np.ndarray
922+
923+
@classmethod
924+
def from_polynomial_lists(cls,
925+
az_fm_rate_list: list,
926+
doppler_centroid_list: list,
927+
sensing_start: datetime.datetime,
928+
sensing_end: datetime.datetime):
929+
'''
930+
Extract coefficients from the list of the polynomial lists that fall within
931+
the provided sensing start / end times of a burst.
932+
933+
Parameters:
934+
-----------
935+
az_fm_rate_list: list[isce3.core.Poly1d]
936+
List of azimuth FM rate polynomials
937+
doppler_centroid_list: list[isce3.core.Poly1d]
938+
List of doppler centroid polynomials
939+
sensing_start: datetime.datetime
940+
Azimuth start time of the burst
941+
sensing_end: datetime.datetime
942+
Azimuth end time of the burst
943+
'''
944+
945+
# Extract polynomial info for azimuth FM rate
946+
(fm_rate_aztime_burst_vec,
947+
fm_rate_coeff_burst_arr,
948+
fm_rate_tau0_burst_vec) = cls.extract_polynomial_sequence(az_fm_rate_list,
949+
sensing_start,
950+
sensing_end)
951+
952+
(dc_aztime_burst_vec,
953+
dc_coeff_burst_arr,
954+
dc_tau0_burst_vec) = cls.extract_polynomial_sequence(doppler_centroid_list,
955+
sensing_start,
956+
sensing_end)
957+
958+
return cls(fm_rate_aztime_burst_vec, fm_rate_coeff_burst_arr, fm_rate_tau0_burst_vec,
959+
dc_aztime_burst_vec, dc_coeff_burst_arr, dc_tau0_burst_vec)
960+
961+
962+
@classmethod
963+
def extract_polynomial_sequence(cls, polynomial_list: list,
964+
datetime_start: datetime.datetime,
965+
datetime_end: datetime.datetime):
966+
'''
967+
Scan `vec_azimuth_time` end find indices of the vector
968+
that covers the period defined with
969+
`datetime_start` and `datetime_end`
970+
971+
Parameters:
972+
-----------
973+
polynomial_list: list
974+
list of (azimuth_time, isce3.core.Poly1d)
975+
datetime_start: datetime.datetime
976+
Start time of the period
977+
datetime_end: datetime.datetime
978+
end time of the period
979+
980+
Returns:
981+
--------
982+
tuple
983+
Tuple of (vec_aztime_sequence,
984+
arr_coeff_sequence,
985+
vec_tau0_sequence)
986+
as a sequence of polynomial info that covers the period
987+
defined in the parameters.
988+
vec_aztime_sequence: azimuth time of each sample in the sequence
989+
arr_coeff_sequence: N by 3 npy array whose row is coefficients of
990+
each sample in the sequence
991+
vec_tau0_sequence: Range start time of each sample in the sequence
992+
'''
993+
994+
# NOTE: dt is defined as: [azimuth time] - [start/end time]
995+
# find index of poly time closest to start time that is less than start time
996+
dt_wrt_start = np.array([(poly[0] - datetime_start).total_seconds() for poly in polynomial_list])
997+
dt_wrt_start = np.ma.masked_array(dt_wrt_start, mask=dt_wrt_start > 0)
998+
index_start = np.argmax(dt_wrt_start)
999+
1000+
# find index of poly time closest to end time that is greater than end time
1001+
dt_wrt_end = np.array([(poly[0] - datetime_end).total_seconds() for poly in polynomial_list])
1002+
dt_wrt_end = np.ma.masked_array(dt_wrt_end, mask=dt_wrt_end < 0)
1003+
index_end = np.argmin(dt_wrt_end)
1004+
1005+
# Done extracting the IDs. Extract the polynomial sequence
1006+
vec_aztime_sequence = []
1007+
arr_coeff_sequence = []
1008+
vec_tau0_sequence = []
1009+
1010+
# Scale factor to convert range (in meters) to seconds (tau)
1011+
range_to_tau = 2.0 / speed_of_light
1012+
for poly in polynomial_list[index_start:index_end+1]:
1013+
vec_aztime_sequence.append(poly[0])
1014+
arr_coeff_sequence.append(poly[1].coeffs)
1015+
vec_tau0_sequence.append(poly[1].mean * range_to_tau)
1016+
1017+
return (np.array(vec_aztime_sequence),
1018+
np.array(arr_coeff_sequence),
1019+
np.array(vec_tau0_sequence))

0 commit comments

Comments
 (0)