ngageoint / sarpy

A basic Python library to demonstrate reading, writing, display, and simple processing of complex SAR data using the NGA SICD standard.
MIT License
262 stars 87 forks source link

PALSAR ALOS1 SICD format #540

Closed syu-tan closed 2 weeks ago

syu-tan commented 2 months ago

Thanks to NGA for their great work

Added conversion of SICD format for PALSAR ALOS1.

https://github.com/ngageoint/sarpy/issues/539#issuecomment-2318668439

As per the important shared information here,i think too, the native doppler has distortion in the azimuth direction from zero doppler in the geometry. The further away the iso doppler is, the more severe the distortion in the timing of the reflection at zero doppler is.

Visualized in kmz as a sample. The distortion is not very severe, but the position is incorrect.

https://github.com/user-attachments/assets/0d289bf8-822f-45ad-b6d3-0e65e154484e https://github.com/user-attachments/assets/87296524-5fa5-43f8-9d68-f697fb2e6b94

There is no problem with subapertures on the image such as reforcus.

スクリーンショット 2024-08-30 0 12 56

If there are still problems with the code please let me know. Thanks in advance.

syu-tan commented 2 months ago

As a test sample, please use the public data provided by NASA and ASF.

https://search.asf.alaska.edu/#/?zoom=10.130&center=130.830,31.294&dataset=ALOS&resultsLoaded=true&granule=ALPSRP095910620-L2.2&searchType=List%20Search&searchList=ALPSRP095910620

mstewart-vsc commented 2 months ago

To assess the quality of resulting SICDs, I chose a scene for which I knew ground truthed reflectors exist. The scene was ALPSRP257780680 and the ground truth can be found at https://uavsar.jpl.nasa.gov/cgi-bin/calibration.pl

Using the SICD geolocation model from the resulting SICD, the Rosamond reflectors were off by ~500m along track. At close range, an identifiable clutter interface was off by ~1300m along track, but in the opposite direction. So the geolocation of the SICD is quite unreliable. I don't believe SarPy should be producing SICDs with this level of geolocation error.

The sarpy.consistency.sicd_consistency also points to other problems.

ERROR:validation:INCAType: the populated INCA.DRateSFPoly constant term (0.9427153734145648)
    and expected constant term (0.9012082372263309) are not consistent.
WARNING:validation:RadiometricType: No Radiometric.NoiseLevel provided, so noise estimates will not be possible.
ERROR:validation:DirParamType: ImpRespWid expected as 3.9827956041265535 from weighting,
but populated as 4.5
ERROR:validation:
SICD: output/ALPSRP257780680_001_061959_ST0653R_35N118W_001L___DHH_0101_SPY_SICD.nitf has apparent errors

A DRSF of 0.94 is inconsistent with the imaging geometry.

Finally, the SICD.Grid.Col.DeltaKCOAPoly does not match the spectrum of the complex image.

ALPSRP257780680_001_061959_ST0653R_35N118W_001L___DHH_0101_SPY_SICD_spatial_frequency_support As far as I can tell from inspection of the complex image, the spectral content does not shift, but there is a non-zero SICD.Grid.Col.DeltaKCOAPoly. This is likely to cause significant problems for subsequent processing that relies on accurate knowledge of the spectrum's location.

syu-tan commented 2 months ago

the test pass

pytest Python version ```shell python -V # Python 3.10.13 ``` test logs ```log pytest ./tests/ ?[alos_palsar1_sicd] ======================================================================= test session starts ======================================================================== platform darwin -- Python 3.8.17, pytest-7.1.3, pluggy-1.0.0 rootdir: /Users/syu/src/git/sarpy plugins: dash-2.1.0, anyio-3.3.4 collected 784 items tests/test_class_string.py . [ 0%] tests/consistency/test_consistency.py ........ [ 1%] tests/consistency/test_cphd_consistency.py sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 8%] tests/consistency/test_sicd_consistency.py ss. [ 9%] tests/consistency/test_sidd_consistency.py ss.. [ 9%] tests/geometry/test_geocoords.py .......... [ 11%] tests/geometry/test_geometry_elements.py .......... [ 12%] tests/geometry/test_latlon.py ... [ 12%] tests/geometry/test_point_projection.py .............. [ 14%] tests/io/test_kml.py . [ 14%] tests/io/DEM/test_dted.py ss [ 14%] tests/io/DEM/test_geoid.py s [ 15%] tests/io/DEM/test_geotiff1deg_list.py .... [ 15%] tests/io/DEM/test_geotiff1deg_reader.py .ss..ss. [ 16%] tests/io/complex/test_other_nitf.py s [ 16%] tests/io/complex/test_reader.py sssssssssss [ 18%] tests/io/complex/test_remote.py s [ 18%] tests/io/complex/test_sicd.py s [ 18%] tests/io/complex/test_utils.py . [ 18%] tests/io/complex/sicd_elements/test_sicd_elements_antenna.py ... [ 18%] tests/io/complex/sicd_elements/test_sicd_elements_base.py ... [ 19%] tests/io/complex/sicd_elements/test_sicd_elements_blocks.py ..................... [ 21%] tests/io/complex/sicd_elements/test_sicd_elements_collectioninfo.py .. [ 22%] tests/io/complex/sicd_elements/test_sicd_elements_errorstatistics.py . [ 22%] tests/io/complex/sicd_elements/test_sicd_elements_geodata.py ... [ 22%] tests/io/complex/sicd_elements/test_sicd_elements_grid.py .. [ 22%] tests/io/complex/sicd_elements/test_sicd_elements_imagecreation.py . [ 23%] tests/io/complex/sicd_elements/test_sicd_elements_imagedata.py . [ 23%] tests/io/complex/sicd_elements/test_sicd_elements_imageformation.py ...... [ 23%] tests/io/complex/sicd_elements/test_sicd_elements_matchinfo.py . [ 24%] tests/io/complex/sicd_elements/test_sicd_elements_pfa.py . [ 24%] tests/io/complex/sicd_elements/test_sicd_elements_position.py ... [ 24%] tests/io/complex/sicd_elements/test_sicd_elements_radarcollection.py .............. [ 26%] tests/io/complex/sicd_elements/test_sicd_elements_radiometric.py . [ 26%] tests/io/complex/sicd_elements/test_sicd_elements_rgazcomp.py . [ 26%] tests/io/complex/sicd_elements/test_sicd_elements_rma.py ... [ 27%] tests/io/complex/sicd_elements/test_sicd_elements_scpcoa.py ................... [ 29%] tests/io/complex/sicd_elements/test_sicd_elements_sicd.py .................................. [ 33%] tests/io/complex/sicd_elements/test_sicd_elements_timeline.py .................. [ 36%] tests/io/complex/sicd_elements/test_sicd_elements_utils.py ... [ 36%] tests/io/general/test_base.py ... [ 36%] tests/io/general/test_data_segment.py .......... [ 38%] tests/io/general/test_format_function.py ........ [ 39%] tests/io/general/test_nitf.py .. [ 39%] tests/io/general/test_nitf_headers.py s [ 39%] tests/io/general/test_nitf_image.py .... [ 40%] tests/io/general/test_tre.py ... [ 40%] tests/io/phase_history/test_cphd.py ssss [ 40%] tests/io/phase_history/test_cphd_versions.py ..... [ 41%] tests/io/phase_history/cphd1_elements/test_cphd.py ...... [ 42%] tests/io/phase_history/cphd1_elements/test_cphd1_elements_antenna.py ..... [ 42%] tests/io/phase_history/cphd1_elements/test_cphd1_elements_blocks.py .... [ 43%] tests/io/phase_history/cphd1_elements/test_cphd1_elements_channel.py . [ 43%] tests/io/phase_history/cphd1_elements/test_cphd1_elements_data.py . [ 43%] tests/io/phase_history/cphd1_elements/test_cphd1_elements_dwell.py . [ 43%] tests/io/phase_history/cphd1_elements/test_cphd1_elements_geoinfo.py ... [ 44%] tests/io/phase_history/cphd1_elements/test_cphd1_elements_global.py .. [ 44%] tests/io/phase_history/cphd1_elements/test_cphd1_elements_pvp.py . [ 44%] tests/io/phase_history/cphd1_elements/test_cphd1_elements_referencegeometry.py . [ 44%] tests/io/phase_history/cphd1_elements/test_cphd1_elements_supportarray.py .. [ 45%] tests/io/phase_history/cphd1_elements/test_cphd1_elements_txrcv.py . [ 45%] tests/io/phase_history/cphd1_elements/test_utils.py . [ 45%] tests/io/product/test_reader.py ...s [ 45%] tests/io/product/test_sidd.py ssssss [ 46%] tests/io/product/test_sidd_schema.py ......... [ 47%] tests/io/product/test_sidd_writing.py .s [ 47%] tests/io/product/sidd1_elements/test_exploitationfeatures.py ......................................................... [ 55%] tests/io/product/sidd2_elements/test_exploitationfeatures.py .................................................................... [ 63%] tests/io/product/sidd3_elements/test_exploitationfeatures.py ............................................................................................... [ 76%] ...................................................................................................................................... [ 93%] tests/io/product/sidd3_elements/test_sidd3_elements.py ..... [ 93%] tests/io/received/test_crsd.py s [ 93%] tests/processing/sicd/test_spectral_taper.py ..................... [ 96%] tests/utils/test_sicd_sidelobe_control.py .s [ 96%] tests/visualization/test_cphd_kmz_product_creation.py ss [ 97%] tests/visualization/test_crsd_kmz_product_creation.py s [ 97%] tests/visualization/test_kmz_product_creation.py ss [ 97%] tests/visualization/test_remap.py .................... [100%] ========================================================================= warnings summary ========================================================================= tests/geometry/test_point_projection.py::test_image_to_ground_errors tests/geometry/test_point_projection.py::test_image_to_ground_dem /Users/syu/src/git/sarpy/sarpy/geometry/point_projection.py:1882: RuntimeWarning: divide by zero encountered in double_scalars lon_grid_size = min(10, lat_grid_size/abs(numpy.sin(numpy.deg2rad(ref_llh[0])))) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================================================== 678 passed, 106 skipped, 2 warnings in 5.87s =========================================================== ```
pressler-vsc commented 2 weeks ago

@syu-tan, thanks again for the nice write-up, discussion, and contribution. Given the issue @utwade pointed out and the analysis by @mstewart-vsc, we think that in its present state the converted SICDs are misleading in a way that does not yet belong in SARPy and are closing this PR for now but please reopen if you find a way to address these shortcomings.