adugnag / gee_s1_ard

Creates an analysis ready sentinel-1 SAR image collection in Google Earth Engine by applying additional border noise correction, speckle filtering and radiometric terrain normalization.
MIT License
233 stars 83 forks source link

issues with .py functions #13

Closed treetexan closed 1 year ago

treetexan commented 2 years ago

Hi there, I just downloaded the python version of your module and tried to get it to run. the javascript functions run well, and thank you for sharing this really wonderful work.

But the python versions have a few issues. First, you refer to two parameters in the wrapper.py function that do not exist in the s1_ard.py function, specifically ORBIT_NUM and PLATFORM_NUMBER. And I want to note for others who might have issues going forward that one parameter is named differently in javascript and python, and that's the ADDITIONAL BORDER CORRECTION one. Finally, and I think I am right here, the following parameters are not optional as your comments say in python, so I had to specify them: 'CLIP_TO_ROI': False, 'SAVE_ASSET': False, 'ASSET_ID': 'Bob'

Maybe all the above is because I got an odd version in my recent download. But I wanted to post one more issue here, for some other person who might be trying to adapt your python code. In your javascript code, you export s1 and s1_1 from wrapper.js and don't do a linear to db transform. So that way, your code for calculating ratios and visualization in s1_ard.js doesn't throw an error. But in your s1_ard.py code, you do the DB conversion (if the parameter is set) and only export the s1_1, and that entire visualization section is missing. So for those looking to add that visualization code back in Python, don't forget that you must have your parameter 'FORMAT' : 'LINEAR', not 'DB', to quickly adapt that visualization code. then if you run this code in geemap it will output a map:

s1_preprocces_view = s1_processed.map(helper.add_ratio_lin).map(helper.lin_to_db2)
visparam = {'bands': ['VV', 'VH', 'VVVH_ratio'], 'min': -25, 'max':10}
Map.addLayer(s1_preprocces_view , visparam, 'Median proc BOTH input S1 collection', True)
Map

Cheers, and thanks again for the awesome work! Matt

adugnag commented 2 years ago

Hello,

Thank you for bringing these issues to my attention. The ORBIT_NUM and PLATFORM_NUMBER parameters were added by a user after the publication of the original manuscript, so I have to go back and review it. Please look out for an updated code in the coming days. As to the naming of some parameters in the JavaScript version, some parameters may not be identical to the Python version but users should be able to identify what the parameters represent. The parameters 'CLIP_TO_ROI', 'SAVE_ASSET' and 'ASSET_ID' are referred to optional because you don't need to set them to 'True' every time you run the code.

As for computing of ratio images in the JavaScript but not in the Python version is intentional. The JavaScript version was implemented for prototyping. So the ratio images are created entirely for visualizing (that is why I included the original images for comparison). During exporting of the ARD images, only the original bands are exported. On the contrary, the Python version is designed for production, therefore, we do not synthesize ratio images and export original images. I hope I have answered your questions. Let me know if you have more. Best, Adugna