diff --git a/scripts/extractions/patch_extractions/extract_optical.py b/scripts/extractions/patch_extractions/extract_optical.py index e20ab97d..570ec373 100644 --- a/scripts/extractions/patch_extractions/extract_optical.py +++ b/scripts/extractions/patch_extractions/extract_optical.py @@ -219,8 +219,9 @@ def create_datacube_optical( bands_to_download, FetchType.POLYGON, filter_tile=s2_tile, - apply_mask=False, - additional_masks=True, + distance_to_cloud_flag=True, + apply_mask_flag=False, + additional_masks_flag=True, ) # Increase the memory of the jobs depending on the number of polygons to extract diff --git a/scripts/extractions/point_extractions/point_extractions.py b/scripts/extractions/point_extractions/point_extractions.py index e833f090..1338cd3f 100644 --- a/scripts/extractions/point_extractions/point_extractions.py +++ b/scripts/extractions/point_extractions/point_extractions.py @@ -9,10 +9,8 @@ import geopandas as gpd import openeo import pandas as pd -from openeo.processes import ProcessBuilder, array_create from openeo_gfmap import Backend, BackendContext, FetchType, TemporalContext from openeo_gfmap.backend import cdse_connection -from openeo_gfmap.fetching.s2 import build_sentinel2_l2a_extractor from openeo_gfmap.manager.job_manager import GFMAPJobManager from openeo_gfmap.manager.job_splitters import split_job_s2grid from openeo_gfmap.preprocessing import linear_interpolation, median_compositing @@ -146,7 +144,7 @@ def create_datacube( backend = Backend(row.backend_name) backend_context = BackendContext(backend) - # Select some bands to download (chosen at random at this point) + # TODO: Adjust this to the desired bands to download bands_to_download = [ "S2-L2A-B04", "S2-L2A-B08", @@ -166,24 +164,12 @@ def create_datacube( apply_mask_flag=True, ) - cube = 2.5 * (cube.band('S2-L2A-B08') - cube.band('S2-L2A-B04')) / \ - (cube.band('S2-L2A-B08') + 2.4 * cube.band('S2-L2A-B04') + 1) - cube = cube.add_dimension("bands", 'S2-L2A-EVI', "bands") - # Create monthly median composites cube = median_compositing(cube=cube, period="month") + # Perform linear interpolation cube = linear_interpolation(cube) -# # Map the time dimension to the bands dimension -# nsteps = 20 -# cube = cube.apply_dimension(dimension='t', -# target_dimension='bands', -# process=lambda d: array_create(data=d), -# ) - -# tstep_labels = [f'S2-L2A-EVI_t{i}' for i in range(0,nsteps)] -# cube = cube.rename_labels('bands', tstep_labels) - + # Finally, create a vector cube based on the Point geometries cube = cube.aggregate_spatial(geometries=spatial_extent, reducer="mean") diff --git a/src/worldcereal/openeo/preprocessing.py b/src/worldcereal/openeo/preprocessing.py index ff57b274..4e74d272 100644 --- a/src/worldcereal/openeo/preprocessing.py +++ b/src/worldcereal/openeo/preprocessing.py @@ -278,8 +278,9 @@ def worldcereal_preprocessed_inputs_gfmap( ], fetch_type=FetchType.TILE, filter_tile=False, - additional_masks=False, - apply_mask=True, + distance_to_cloud_flag=True, + additional_masks_flag=False, + apply_mask_flag=True, ) s2_data = median_compositing(s2_data, period="month")