Thanks for a good overview!
1. filter_spatial
It seems that it does not want to accept my geojson file.
Code:
s2_cube = connection.load_collection(
'SENTINEL2_L2A_SENTINELHUB',
# spatial_extent = spatial_extent,
temporal_extent = [start_date_exclusion, end_date],
bands = bands)
aoi = "../../aoi/DK/DK.geojson"
# aoi = "https://github.com/DHI-GRAS/worldwater-toolbox/blob/main/openeo_platform_notebooks/DK.geojson"
bbox = dict(zip(["west", "south", "east", "north"], gpd.read_file(aoi).total_bounds))
print(bbox)
s2_cube = s2_cube.filter_spatial(aoi)
s2_cube_save = s2_cube.save_result(format='netCDF') #GTiff #netCDF
my_job = s2_cube_save.send_job(title="s2_cube")
results = my_job.start_and_wait().get_results()
results.download_files("s2_cube")
Error message: OpenEoApiError: [500] Internal: Server error: NotImplementedError("filter_spatial only supports dict but got DelayedVector('../../aoi/DK/DK.geojson')") (ref: r-1aaf592938bc41c69d022ee03bfb26e0)
The geojson file is uploaded on GitHub . The file is in EPSG:4326.
2. mask_polygon (another option which I have tried)
I have followed this instructions but it seems there is a problem to work with my geojson file. The bbox can be print {‘west’: 8.07638931, ‘south’: 54.55902863, ‘east’: 15.19305611, ‘north’: 57.75152588} so I believe that my file is fine but it can not be used with mask_ polygon or in filter_spatial
Code:
s2_cube = connection.load_collection(
'SENTINEL2_L2A_SENTINELHUB',
# spatial_extent = spatial_extent,
temporal_extent = [start_date_exclusion, end_date],
bands = bands)
aoi = "../../aoi/DK/DK.geojson"
bbox = dict(zip(["west", "south", "east", "north"], gpd.read_file(aoi).total_bounds))
s2_cube = s2_cube.filter_bbox(bbox)
s2_cube = s2_cube.mask_polygon(aoi)
s2_cube_save = s2_cube.save_result(format='netCDF') #GTiff #netCDF
my_job = s2_cube_save.send_job(title="S2L2A_cube")
results = my_job.start_and_wait().get_results()
Error:
OpenEoApiError: [500] Internal: Server error: FileNotFoundError(2, 'No such file or directory') (ref: r-53be7db1c4934f15a2b6a6dd0c19064e)
Would you advice me what is incorrect in these codes please?