Open kyutecdaichi opened 2 weeks ago
👋 Thanks for opening your first issue here! Please filled out the template with as much details as possible. We appreciate that you took the time to contribute! Make sure you read our contributing guidelines.
The plan to solve the bug involves verifying and correcting the geographic metadata and geocoding processes. The misalignment issue likely stems from discrepancies in the metadata or the geocoding process. The solution involves:
Metadata Verification: Ensure that the input HDF5 files have complete and accurate geographic metadata, including the coordinate reference system (CRS) and geotransform parameters.
Geocoding Process: Verify the accuracy of the lookup tables used in the geocoding process and ensure that the interpolation method is appropriate for the dataset.
Code Enhancements: Implement additional checks and error handling in the conversion and geocoding scripts to ensure metadata consistency and correct geocoding.
The bug is likely caused by incomplete or incorrect geographic metadata in the input HDF5 files or errors in the geocoding process. Specifically:
Metadata Issues: The save_gdal.py
script checks for the X_FIRST
attribute to determine if the file is geocoded. If this attribute or other geographic metadata (like CRS or geotransform parameters) is incorrect or missing, it could lead to misalignment in the output GeoTIFF.
Geocoding Errors: The geocode.py
script relies on lookup tables for accurate geocoding. If these tables are incorrect or misaligned, or if the interpolation method is unsuitable, it could cause the observed misalignment.
Here are some implementation details and code snippets to address the issues:
Metadata Verification in save_gdal.py
:
X_FIRST
attribute and other necessary metadata are present and correct.def verify_metadata(hdf5_file):
required_attributes = ['X_FIRST', 'Y_FIRST', 'X_STEP', 'Y_STEP', 'CRS']
for attr in required_attributes:
if attr not in hdf5_file.attrs:
raise ValueError(f"Missing required metadata attribute: {attr}")
Geocoding Process in geocode.py
:
def geocode_with_verification(input_file, lookup_table, method='nearest'):
if method not in ['nearest', 'linear']:
raise ValueError("Unsupported interpolation method")
# Verify lookup table
if not os.path.exists(lookup_table):
raise FileNotFoundError("Lookup table not found")
# Perform geocoding
# ...
To replicate the bug, follow these steps:
save_gdal.py
script to convert a MintPy HDF5 file (e.g., geo_temporalCoherence.h5
) to a GeoTIFF format.Ensure that the input HDF5 file lacks complete geographic metadata or that the lookup table used in the geocoding process is incorrect to replicate the issue accurately.
Click here to create a Pull Request with the proposed solution
Files used for this task:
@kyutecdaichi could you check the alignment of the KMZ file in Google Earth? If there is misalignment there as well, then the problem is in the data itself, due to the inaccurate geolocation, probably from the reference image used in coregistration while running ISCE2/topsStack
. If there is no misalignment there, then they may be a problem in the code itself, while saving the HDF5 to GeoTIFF.
@yunjunz Thank you for your response. When I checked the KMZ file on Google Maps, I observed that the same misalignment appeared in the KMZ file as well. If I reanalyze the data with ISCE2, could you please advise on any points I should pay attention to, such as parameters for stackSentinel or other related settings? Your help would be much appreciated. Thank you.
Use a reference date in 2019 for coregistration, to avoid potential ionospheric displacement.
How big is this misalignment you observed?
When I displayed the geo_velocity.kmz on Google Maps, I noticed that the roads were slightly misaligned. By the way, the analysis period was from 2015 to 2023 (excluding December, January, and February of each year).
Is it possible that you are using ALOS-2, processed with isce2/stripmapStack, and forgot to run stackStripMap.py
with --zero
optioin?
I am using Sentinel-1 data, not ALOS-2 data. Therefore, I am using the isce2/topsStack's stackSentinel.py for processing.
Interesting. Could you post your basic data info here?
I am not very familiar with 'path number,' but when checking on ASF data search, should I use Path 46 as shown in the photo?
・path number  46 ・bounding box in SNWE  '43.031439 43.279942 141.276939 141.652175' ・stackSentinel.py command  -n '2 3' -c 5 ・dem.py command  dem.py -a stitch -b 42 43 141 142 -r -s 1 -c
My student @weizhenlwz recently encountered the same issue. He re-ran stackSentinel.py
with a different --reference_date
option and the problem disappeared. We suspect it's due to a problem with the reference acquisition orbit, but has not confirmed it yet in the S1 orbit quality website.
I see that the same issue was happening. I will try adding the --reference_date. Thank you!
I am currently conducting InSAR analysis using ISCE2-MintPy with Sentinel data. However, when I convert the geo_temporalCoherence.h5 or geo_velocity.h5 files generated by MintPy to GeoTIFF format (.tif) and display them in QGIS, there is a slight misalignment in the images. I am unsure about the cause or how to resolve this issue. If anyone knows the reason or has a solution, please let me know. I would greatly appreciate your help. Thank you!