Python S1-TOPS-SPLIT Analyzer

Thank you for your insight. I decided to update my project with an Apache License.

1 Like

Hi everyone.

Just sharing that I’ve updated STSA and now it includes the option to use the Copernicus OData API to download XML files (Thank you for the suggestion @cristianoLopes). You may view it in the Github repo.

This means you do not need to have a full 4 GB file to view the TOPS SPLIT data. You can just enter your Copernicus credentials and enter the Sentinel-1 scene ID.

I’ve also updated it so that you can easily install and use this library. Here is a screenshot of me importing stsa in Google Colab and viewing some data:

Code used in picture:

import stsa

swaths = stsa.TopsSplitAnalyzer()
swaths.load_data(
    download_id='S1B_IW_SLC__1SDV_20210905T085737_20210905T085806_028561_036888_4C6F',
    api_user='MY_COPERNICUS_USERNAME',
    api_password='MY_COPERNICUS_PASSWORD',
    download_folder='/content/sample_data',
)
swaths.visualize_webmap()

4 Likes

This is great, thank you, Panji!

Had you tried if this work for offline products?
I am not sure annotations are available despite the data availability online/offline.

Thanks.
Nice peace of work :wink:

Good you noticed that @mdelgado. I was only testing with online products. It seems to be that you cannot view old products. Although the scene ID is still in the database the XML data is also erased.

According to their documentation, there is a process to restore the data using the API but I will have to experiment with this. It seems to take some time to restore the data. For now I will add a check that will warn the user if the product is offline.

For now, i recommend to use online products. In most cases, it should be okay since the alignment of the Sentinel scenes is very good :slightly_smiling_face:

1 Like

Is also this new version being able to read the annotations from a local Sentinel-1 file (in local folder)?

Yes it should still work. You can use the --zip argument if you are using the terminal. If you are making a python file you can do something like this:

import stsa

image = 'S1_SLC_image.zip'

swaths = stsa.TopsSplitAnalyzer()
swaths.load_data(zip_path=image)
2 Likes

I was wondering… that the script downloads annotations for both vv and vh polarizations, and being the same burst / subwath extent for both is a bit redundant.
Could the script get only for vv?

in line 67 of the search.py… wiriting: if url.endswith(".xml’)") and ‘vv’ in url:
instead of if url.endswith(".xml’)"):

could make it. Not sure if the cleanest option

Sure. I think that’s a good idea and it will make the output more clear. I can make an additional filter to include VV or VH only (depending on what polarization the user selects when loading data). Thank you for the suggestion.

Just want to share that I have made a web app implementation of this Python code. You can view it here.

https://share.streamlit.io/pbrotoisworo/s1-tops-split-analyzer/main/app.py

Thank you.

6 Likes

works like charm - this is really great! Makes image/burst selection so much easier.

1 Like

This is really a great tool. Thank you.
I think if you can add the geographic coordinates to the web app, it will be more useful too. But GeoJSON solves this perfectly!

1 Like

Thank you for this tool. This is brilliant tool and works very well on some of the S1 scenes.

However for some of the scenes I receive an error. Even though scenes are not offline.
Few scenes that I receive an error via streamlit app and when I run your code on my machine:
S1A_IW_SLC__1SDH_20220203T131703_20220203T131730_041749_04F7D2_E61E
S1A_IW_SLC__1SDH_20220207T124412_20220207T124439_041807_04F9E1_8829
S1A_IW_SLC__1SDH_20220225T133413_20220225T133440_042070_0502FD_0077

Hmm. It’s unable to download the XML files. I’m not sure why.

I’ve created an issue report to track this bug.

Unfortunately, I’m very busy right now so I can’t give any more information but hopefully I can test the scenes before they go offline.

I’ve found the issue. It’s related to your images only having HH/HV polarization. I didn’t consider SLC imagery with HH/HV polarizations. I will release an update by today to fix this issue.

EDIT: The bug fix is deployed and I tested it with one of your scenes successfully.

2 Likes

Dear @ABraun ,This is my area. Can you create something like this for me?Please?
km.zip (1.7 KB)

The tool does not take kml inputs. You simply check which scene covers it (e.g. in the official Sentinel hub or the EO-Browser) and enter the ID and the Sentinel Hub credentials to have the bursts displayed online.

Dear @panjibrotoisworo i think the previous version is better than new one. Because i can simply input AOI files wkt or other formats. Can you downgrade it or give us a choose to use which one we need.

Thank you.

Hi @suat,

I’ve added WKT again as input. There is a drop down where you can select which method you want to use for overlay input.

Let me know if there is any mistake.

Thank you @panjibrotoisworo its done.