Open clausmichele opened 1 month ago
Sample code:
import json
import geopandas as gpd
from openeo.local import LocalConnection
local_conn = LocalConnection("./")
url = "https://earth-search.aws.element84.com/v1/collections/sentinel-2-l2a"
spatial_extent = {"east": 11.40, "north": 46.52, "south": 46.46, "west": 11.25}
temporal_extent = ["2022-06-01", "2022-06-30"]
bands = ["red"]
properties = {"eo:cloud_cover": dict(lt=80)}
s2_datacube = local_conn.load_stac(
url=url,
spatial_extent=spatial_extent,
temporal_extent=temporal_extent,
bands=bands,
properties=properties,
)
s2_datacube = s2_datacube.resample_spatial(projection="EPSG:4326",resolution=0.0001).drop_dimension("band")
data = s2_datacube.execute().compute() # Try also without compute
from exactextract import exact_extract
import fiona
import rioxarray
import xarray
polys = fiona.open('./sample_polygons.geojson')
results = exact_extract(data, polys, 'mean')
results
Tasks:
Roadmap issue for reference: https://github.com/EOEPCA/roadmap/issues/56