nasa-jpl / autoRIFT

A Python module of a fast and intelligent algorithm for finding the pixel displacement between two images
Apache License 2.0
212 stars 52 forks source link

Unable to get geogrid and autoRIFT working #96

Open franbaldacchino opened 6 months ago

franbaldacchino commented 6 months ago

Hi,

I have been having quite a bit of trouble to get geogrid/autoRIFT to work for my satellite images. I have a few questions:

(1) What datatype should the satellite images be in? Currently, I have downloaded L8 and S2 optical images with one band in a tiff format. And for S1 I have downloaded GRD in a tiff format. Is this correct? My test datasets are here: https://urldefense.us/v3/__https:/drive.google.com/drive/folders/1tMxP4_YJzf2-VDc-I1xwIsV48SYY00az?usp=drive_link__;!!PvBDto6Hs4WbVuu7! Pak9HC-4GVvc9ClqMkAckfawAhHZMnsuhd0GtHWnc5Oz4LZI_iqqr-nJoLhIoFYNbIdSLEQOmfzgEICDwosQEylmwyXzDFYusgv10Rw$ (2) I am able to run autoRIFT with my satellite images, but this produces no tiff outputs in the form of velocity maps. It only produces a mett file. This is the code that I use:

python testautoRIFT_ISCE.py -m /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/S1_1.tif -s /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/S1_2.tif -fo 1 -nc S1

python testautoRIFT.py -m /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/S2_1Test.tif -s /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/S2_2Test.tif -fo 1 -nc S2

python testautoRIFT.py -m /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/L1Test.TIF -s /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/L2Test.TIF -fo 1 -nc L8

What I am doing wrong here?

(3) Now when I try to run Geogrid before autoRIFT, I get a range of errors for each satellite image. Fundamentally, I think it is due to my data. It would be really really helpful if the data used for the demo was shared so that I could check through it and compare with my data. Is this possible?

These are the errors I am getting with running Geogrid:

python testGeogrid_ISCE.py -m /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/S2_144036_20220803.tif -s /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/S2_145036_20220828.tif -d /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/output_COP30.tif -fo 1 Traceback (most recent call last): File "/home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/testGeogrid_ISCE.py", line 392, in main() File "/home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/testGeogrid_ISCE.py", line 384, in main runGeogridOptical(metadata_m, metadata_s, inps.demfile, inps.dhdxfile, inps.dhdyfile, inps.vxfile, inps.vyfile, inps.srxfile, inps.sryfile, inps.csminxfile, inps.csminyfile, inps.csmaxxfile, inps.csmaxyfile, inps.ssmfile) File "/home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/testGeogrid_ISCE.py", line 312, in runGeogridOptical d0 = date(int(info.time[0:4]),int(info.time[4:6]),int(info.time[6:8])) ^^^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: 'Trac'

python testGeogrid_ISCE.py -m /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/S1_20220803.tif -s /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/S1_20220828.tif -d /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/output_COP30.tif Traceback (most recent call last): File "/home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/testGeogrid_ISCE.py", line 392, in main() File "/home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/testGeogrid_ISCE.py", line 386, in main metadata_m = loadMetadata(inps.indir_m) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/testGeogrid_ISCE.py", line 131, in loadMetadata info.sensingStart = min([x.sensingStart for x in frames]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: min() arg is an empty sequence

python testGeogrid_ISCE.py -m /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/LC08_145036_20220803.TIF -s /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/LC08_144036_20220828.TIF -d /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/output_COP30.tif -fo 1

Optical Image parameters: X-direction coordinate: 384885 30 Y-direction coordinate: 3.94652e+06 -30 Dimensions: 7661 7811

Map inputs: EPSG: 4326 Smallest Allowable Chip Size in m: 240 Grid spacing in m: 0.000277778 Repeat Time: 2.16e+06 XLimits: 33.5434 35.6558 YLimits: 79.7283 82.267 Extent in km: 0.00211247 0.00253866 DEM: /home/fran/Documents/PostDoc_Research/Code/Feature_Tracking_Code/autoRIFT-master/autoRIFT-master/output_COP30.tif

Outputs: Window locations: window_location.tif Output Nodata Value: -32767

Starting processing .... Xlimits : 80.1011 35.6558 Ylimits : 79.7282 37.096 Origin index (in DEM) of geogrid: 0 0 Dimensions of geogrid: -160003 x -153476 terminate called after throwing an instance of 'std::length_error' what(): cannot create std::vector larger than max_size() Aborted (core dumped)

Thank you, I would really appreciate any help on this so I can get autoRIFT working!

leiyangleon commented 6 months ago

Thanks for all questions and we would like to put together a notebook with all working examples soon... It may take a while so for now please first go through the details in the Instructions of Geogrid followed by the Instructions of autoRIFT.

  1. About your data, S2 and L8 single-band GeoTiff images are completely fine. However, for S1, Geogrid only supports SLC images not GRD as detailed in the Geogrid instructions in the above link. So that means you can still run autoRIFT without geocoding information on GRD images (have to be converted to tif or something that GDAL can open though; see below) but if you want to get geocoded info, you need to use ISCE to process SLCs up to the step called "mergeBursts". This piece of information can be found in the instructions as said earlier.
  2. You can run autoRIFT by just giving -m and -s options, as you showed in the examples. S2 and L8 run smoothly except S1. Because GRD cannot be opened by GDAL, you would need to convert the data to something like geotiff. Then run the image pair just as optical ones. That should be pretty quick. However, as stated in the demo, this step without giving the other options (-g and etc) will only create a .mat file, meaning not geocoded.
  3. For the geocoded results, you need to provide at least the -d option (DEM) to Geogrid. For S1 SLCs, a real DEM (.tif format) must be provided; for S1 GRD-converted tifs, S2 and L8 tifs, a "fake" DEM is required meaning a DEM tif file with all zero values is okay. Please remember the format of DEM only supports X/Y cartesian coordinates (in meters) not in lat/lon.
leiyangleon commented 6 months ago

FYI, below are the file IDs for the radar and optical dataset used in the demo of autoRIFT/Geogrid:

Landsat-8: LC08_L1TP_020007_20170708_20170716_01_T1_B8.TIF LC08_L1TP_020007_20170724_20170809_01_T1_B8.TIF

Sentinel-1: S1A_IW_SLC__1SSH_20170221T204710_20170221T204737_015387_0193F6_AB07.zip S1B_IW_SLC__1SSH_20170227T204628_20170227T204655_004491_007D11_6654.zip