Repository navigation
prep_nisar: fix the 90 deg offset in azimuthAngle - #1519
Open
s-sasaki-earthsea-wizard wants to merge 1 commit into
Open
s-sasaki-earthsea-wizard wants to merge 1 commit into
s-sasaki-earthsea-wizard wants to merge 1 commit into
Conversation
The GUNW losUnitVectorX/Y layers are the east/north components of the target-to-sensor LOS unit vector, so the LOS azimuth angle in the ISCE-2 convention used across MintPy (measured from north, anti-clockwise positive; see utils0.enu2los) is atan2(-E, N). The previous expression, atan2(-N, -E), is offset from it by a constant -90 deg, which rotated the LOS direction seen by correct_SET and asc_desc2horz_vert.py.
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideFixes the 90-degree azimuth offset written by prep_nisar by applying the correct target-to-sensor ENU-to-azimuth conversion, with validation showing corrected headings for NISAR and converted ALOS-2 GUNWs across orbit and look directions. Flow diagram for corrected NISAR azimuth conversionflowchart LR
A["GUNW LOS components<br/>losUnitVectorX = E<br/>losUnitVectorY = N"] --> B["prep_nisar.interpolate_geometry"]
B --> C["az = degrees(atan2(-losx, losy))"]
C --> D["geometryGeo.h5<br/>azimuthAngle"]
D --> E["Correct ENU-to-LOS consumers<br/>correct_SET and asc_desc2horz_vert"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
prep_nisarwrites anazimuthAngleintogeometryGeo.h5(the layer was added in #1487) that is a constant 90 deg away from the convention the rest of MintPy uses.This one-line change fixes it:
Why. The GUNW attributes define
losUnitVectorX/losUnitVectorYas the east/north components of the LOS unit vector from the target to the sensor, in ENU.So
(losx, losy)is already the ground-to-satellite horizontal vector(E, N)and needs no sign flip.(Numerically,
hypot(losx, losy)equalssin(incidenceAngle)per pixel to 1.2e-7 on every product I checked.)MintPy's
azimuthAnglefollows the ISCE-2 convention documented inutils0.enu2los(), measured from north with anti-clockwise positive, which for(E, N)isatan2(-E, N).The old
atan2(-N, -E)equalsatan2(-E, N) - 90 deg(mod 360).Effect. Nothing raises; the angle is silently rotated.
Phase-only steps (
invert_network,velocity,correct_topography) don't read it, so a routinesmallbaselineApp.pyrun completes and looks normal.What does read it:
correct_SET(tides are projected onto a LOS rotated by 90 deg),asc_desc2horz_vert.py, and any ENU-to-LOS projection a user does from the exported geometry.This is not limited to NISAR data.
prep_nisarreads the GUNW format, and isce3 writes that format for other missions too: it ships converters for ALOS PALSAR (alos_to_nisar_l0b.py) and ALOS-2 PALSAR-2 (alos2_to_nisar_l1.py) undershare/nisar/examples/.GUNWs produced that way load through
prep_nisarlike any NISAR product, and get the same rotated geometry.Verification.
geometryGeo.h5written byprep_nisarbefore and after this change, with the azimuth converted back to a platform heading throughutils0.azimuth2heading_angle().A near-polar orbit has a heading of about -12 deg ascending and -168 deg descending.
The third row is one of those non-NISAR cases: an ALOS-2 stack converted with isce3's
alos2_to_nisar_l1.py, which is where this bug first showed up.Those missions are right-looking while NISAR flies left-looking only, so the row also shows that the fix holds for both look directions.
On that stack,
correct_SETreported the ENU-to-LOS unit vector asE = -0.099, N = 0.526, U = 0.845before the change.Computed the same way from the patched geometry, it becomes
E = -0.526, N = -0.099, U = 0.845, i.e. the sensor lies to the west-southwest, as it should for an ascending right-looking orbit.pre-commit run --all-files: 13 hooks passed, 1 skipped.Reproduction: check the convention on any GUNW file (no MintPy run needed)
Output on the three products in the table:
These come from the raw metadata cube, so they differ from the table above by a few hundredths of a degree.
The table is from the
geometryGeo.h5thatprep_nisarwrites.There is no unit test in this PR:
tests/test_prep_nisar.pyis being introduced by #1507, and I didn't want two open PRs creating the same file.I'm happy to add a regression test there once this lands (recovered heading for ascending/descending x left/right over a synthetic
radarGrid), or here if you prefer.Disclosure: this change was developed with AI assistance. The change was reviewed and verified by the author.
Reminders
pre-commit run --all-files)Summary by Sourcery
Bug Fixes:
prep_nisarso geometry uses MintPy’s standard target-to-sensor convention instead of a 90-degree-rotated heading.