sertit / eoreader

Remote-sensing opensource python library reading optical and SAR sensors, loading and stacking bands, clouds, DEM and spectral indices in a sensor-agnostic way.
https://eoreader.readthedocs.io/en/latest/
Apache License 2.0
271 stars 22 forks source link

Missing ogr2ogr in PATH: error in ‘wgs84_extent’ when processing Sentinel-1 products #60

Closed TK12331 closed 1 year ago

TK12331 commented 1 year ago

Assigning CRS to a GeoDataFrame without a geometry column is not supported. Use GeoDataFrame.set_geometry to set the active geometry column. Traceback (most recent call last): File "d:\SAR_DATA\process\eoreader-main\eoreader\products\sar\s1_product.py", line 187, in wgs84_extent raise InvalidProductError( eoreader.exceptions.InvalidProductError: Cannot determine the WGS84 extent of S1A_IW_GRDH_1SDV_20200308T121318_20200308T121343_031584_03A39B_5C41

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\10992.conda\envs\DL1\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\10992.conda\envs\DL1\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "c:\Users\10992.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\lib\python\debugpy__main.py", line 45, in cli.main() File "c:\Users\10992.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main run() File "c:\Users\10992.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file runpy.run_path(target_as_str, run_name=compat.force_str("main")) File "C:\Users\10992.conda\envs\DL1\lib\runpy.py", line 268, in run_path return _run_module_code(code, init_globals, run_name, File "C:\Users\10992.conda\envs\DL1\lib\runpy.py", line 97, in _run_module_code _run_code(code, mod_globals, init_globals, File "C:\Users\10992.conda\envs\DL1\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "d:\SAR_DATA\process\eoreader-main\K.py", line 15, in s1_prod.wgs84_extent() File "C:\Users\10992.conda\envs\DL1\lib\site-packages\methodtools.py", line 72, in call return self.call(*args, **kwargs) File "d:\SAR_DATA\process\eoreader-main\eoreader\init__.py", line 31, in wrapper return func(*args, **kwargs) File "d:\SAR_DATA\process\eoreader-main\eoreader\products\sar\s1_product.py", line 196, in wgs84_extent raise InvalidProductError(ex) from ex eoreader.exceptions.InvalidProductError: Cannot determine the WGS84 extent of S1A_IW_GRDH_1SDV_20200308T121318_20200308T121343_031584_03A39B_5C41

TK12331 commented 1 year ago

I follow the tutorial and here is my code:

from eoreader.reader import Reader from eoreader.bands import * import sys sys.path.append('D:/Software/SNAP/snap/bin/')

s1_path = "E:\SAR_DATA\Sentinel1\S1A_IW_GRDH_1SDV_20200308T121318_20200308T121343_031584_03A39B_5C41.zip"

reader = Reader()

s1_prod = reader.open(s1_path)

s1_prod.get_band_paths([VV, HH])

An error occured, and I checked into the inner function and found the error is through in function of 'eoreader/products/sar/s1_product.py': s1_prod.wgs84_extent()

When run the code 'extent_wgs84 = vectors.read(preview_overlay)', it will throw the message: Assigning CRS to a GeoDataFrame without a geometry column is not supported. Use GeoDataFrame.set_geometry to set the active geometry column.

Finally, the code 'vect.crs = WGS84' throw the error.

How can I solve this problem? Thanks in advance!

TK12331 commented 1 year ago

Besides, I read the message that image

I've installed the SNAP locally, but how can I satisfy the requirement ''Ensure that you have the folder containing your gpt executable in your PATH.''?

In addition, the message shown in SNAP official website image , which requires python to be 3.3 or 3.6, while EOReader requires python to >= 3.8, will this cause conflict between the two of them?

remi-braun commented 1 year ago

Hello,

Do you have ogr2ogr accessible as pointed out in the latest FAQ ? For some reason Sentinel-1 KML files sometimes fails to be read by geopandas (I don't know why) and I need to convert them to geojson thanks to ogr2ogr as a workaround. To know if you have it available, just type ogr2ogr in a terminal. If the help section is displayed, it will work. However, you are right, I should better handle this error (at least throw a proper exception).

Concerning your last comment, I don't use snappy as it is slow and buggy. SNAP GPT is ran directly. If you have properly installed SNAP, this should work. Once again, to check if gpt is available, just type it in a terminal. If the help section is displayed, it will work.

remi-braun commented 1 year ago

Using sertit 1.19.6 may correct your issue (pip install sertit[full]>=1.19.6)

TK12331 commented 1 year ago

I installed GDAL and that worked for me. Thank you for the quick response!

Do you have ogr2ogr accessible as pointed out in the latest FAQ ? For some reason Sentinel-1 KML files sometimes fails to be read by geopandas (I don't know why) and I need to convert them to geojson thanks to ogr2ogr as a workaround. To know if you have it available, just type ogr2ogr in a terminal. If the help section is displayed, it will work. However, you are right, I should better handle this error (at least throw a proper exception).

remi-braun commented 1 year ago

🙏