Hi all,
I want to create a Sentinel 2 Satellite Image Time Series on 30 different polygons described by a geojson. Each of the polygon belong to the same S2 tile and have the following dimension: 1280m*1280m. They were generated in the corresponding S2 tile UTM coordinate, then converted WGS 84.
To extract only time series on those defined polygons, I am using the function filter_spatial. The full code is given here:
import json
from pathlib import Path
import openeo
if __name__=="__main__":
temporal_extent=TIMERANGE = ["2020-01-01", "2020-02-27"]
OUTDIR = Path("/home/dumeuri/Documents/dataset/MMDC_OE")
S2_BANDS = [
"B02",
"B03",
"B04"
]
if temporal_extent is None:
temporal_extent = TIMERANGE
connection = openeo.connect("openeo.cloud")
connection.authenticate_oidc()
sentinel2 = connection.load_collection(
"SENTINEL2_L2A_SENTINELHUB", temporal_extent=temporal_extent, bands=S2_BANDS
)
features="/home/dumeuri/Documents/dataset/datacubes/geojson/pretrain_val_31TEK.geojson"
with open(features) as feat:
print(feat)
features = json.load(feat)
datacube = sentinel2.filter_spatial(features)
job = datacube.create_job(
title="S2_minimal_T31TEK",
description="S2_minimal_T31TEK",
out_format="netCDF",
sample_by_feature=True
)
job.start_job()
I can also share the geojson file used if needed. The id of the job which has executed this code is: vito-j-f5f0d0cbdf5845649e392177b0261d5b
However, when I download the generated datacubes, I observe that the extent of the different Satellite Image Time Series (SITS) are wider than the polygons given. More precisely, outside the defined polygon, the Satellite Image Time Series is filled with no data. The following image displays the issue. In the image given below : in yellow the given polygon in the geojson file, outside the polygon the black color corresponds to no-data. In this example, contrary to expectations, the SITS is not 128pix128pix but 256pix512pix.
It should be noted that the extent is not always the same for the different polygons, I have observed for instance 256pix512pix, 512pix512pix, 256pix*256pix.
Therefore, I am wondering if I have misunderstood filter_spatial function. And is there another function which could enable me to crop the final SITS on the given polygon ?
Best regards,
Iris