Closed yunjunz closed 2 weeks ago
This PR introduces a new longitude handling mechanism in the GNSS module to properly handle longitude values that fall outside the standard ranges. The implementation adds a new utility function _set_longitude_range()
that normalizes longitude values to either (-180, 180] or [0, 360) ranges, and updates all GNSS child classes to use this function.
classDiagram
class GNSS {
+_set_longitude_range(lon, lon_range)
}
class GNSSChild1 {
+get_site_lat_lon(print_msg)
}
class GNSSChild2 {
+get_site_lat_lon(print_msg)
}
class GNSSChild3 {
+get_site_lat_lon(print_msg)
}
GNSS <|-- GNSSChild1
GNSS <|-- GNSSChild2
GNSS <|-- GNSSChild3
note for GNSS "New method _set_longitude_range added to handle longitude normalization"
note for GNSSChild1 "Updated to use _set_longitude_range for longitude normalization"
note for GNSSChild2 "Updated to use _set_longitude_range for longitude normalization"
note for GNSSChild3 "Updated to use _set_longitude_range for longitude normalization"
Change | Details | Files |
---|---|---|
Added new longitude normalization utility function |
|
src/mintpy/objects/gnss.py |
Updated longitude handling across GNSS classes |
|
src/mintpy/objects/gnss.py |
This Pull Request addresses a bug in the GNSS module related to handling longitude values that fall outside the typical range, specifically for GNSS_UNR sites in Japan. The changes introduce a new function, standardize_longitude()
, which ensures longitude values are standardized within a specified range, either (-180, 180] or [0, 360). This prevents errors such as NaN values during data processing, particularly in the inc/az_angle extraction from geometry files.
Consider adding unit tests for the standardize_longitude()
function to ensure its robustness and correctness across various input scenarios. This will help maintain code quality and prevent future regressions. Additionally, updating the documentation to reflect these changes and the new function's usage would be beneficial for users and developers.
Description of proposed changes
utils/utils0.py
: addstandardize_longitude()
to handle the longitude data rangelon_range
argobjects/gnss.py
: callut.standardize_longitude()
in all the child class of GNSSThis error occurs for the GNSS_UNR sites in Japan, where the longitude of G073 can be -229. In the old code, this results in a NaN value for inc/az_angle extraction from the geometry file.
Reminders
Summary by Sourcery
Ensure longitude values are correctly handled within the GNSS module by introducing a function to set longitude ranges, preventing errors in data processing.
Bug Fixes:
Enhancements:
_set_longitude_range()
to standardize longitude values across GNSS data processing.