@@ -282,15 +282,8 @@ def worldcereal_preprocessed_inputs_gfmap(
282
282
spatial_extent : BoundingBoxExtent ,
283
283
temporal_extent : TemporalContext ,
284
284
fetch_type : Optional [FetchType ] = FetchType .TILE ,
285
- collections : Optional [ List [ str ]] = None ,
285
+ disable_meteo : bool = False ,
286
286
) -> DataCube :
287
- if not all (
288
- coll in {"sentinel1" , "sentinel2" , "cop_dem" , "meteo" } for coll in collections
289
- ):
290
- raise ValueError (
291
- f"Invalid collection name. Choose from { ['sentinel1' , 'sentinel2' , 'cop_dem' , 'meteo' ]} "
292
- )
293
- cube_list = []
294
287
# Extraction of S2 from GFMAP
295
288
s2_data = raw_datacube_S2 (
296
289
connection = connection ,
@@ -320,14 +313,9 @@ def worldcereal_preprocessed_inputs_gfmap(
320
313
# Cast to uint16
321
314
s2_data = s2_data .linear_scale_range (0 , 65534 , 0 , 65534 )
322
315
323
- # Append the S2 data to the list
324
- if collections is None or "sentinel2" in collections :
325
- cube_list .append (s2_data )
326
-
327
- # Decide on the orbit direction from the maximum overlapping area of
328
- # available products.
329
-
330
316
# Extraction of the S1 data
317
+ # Decides on the orbit direction from the maximum overlapping area of
318
+ # available products.
331
319
s1_data = raw_datacube_S1 (
332
320
connection = connection ,
333
321
backend_context = backend_context ,
@@ -345,10 +333,6 @@ def worldcereal_preprocessed_inputs_gfmap(
345
333
s1_data = mean_compositing (s1_data , period = "month" )
346
334
s1_data = compress_backscatter_uint16 (backend_context , s1_data )
347
335
348
- # Append the S1 data to the list
349
- if collections is None or "sentinel1" in collections :
350
- cube_list .append (s1_data )
351
-
352
336
dem_data = raw_datacube_DEM (
353
337
connection = connection ,
354
338
backend_context = backend_context ,
@@ -358,23 +342,16 @@ def worldcereal_preprocessed_inputs_gfmap(
358
342
359
343
dem_data = dem_data .linear_scale_range (0 , 65534 , 0 , 65534 )
360
344
361
- # Append the copernicus data to the list
362
- if collections is None or "cop_dem" in collections :
363
- cube_list .append (dem_data )
345
+ data = s2_data .merge_cubes (s1_data )
346
+ data = data .merge_cubes (dem_data )
364
347
365
- meteo_data = precomposited_datacube_METEO (
366
- connection = connection ,
367
- spatial_extent = spatial_extent ,
368
- temporal_extent = temporal_extent ,
369
- )
370
-
371
- # Append the copernicus data to the list
372
- if collections is None or "meteo" in collections :
373
- cube_list .append (meteo_data )
348
+ if not disable_meteo :
349
+ meteo_data = precomposited_datacube_METEO (
350
+ connection = connection ,
351
+ spatial_extent = spatial_extent ,
352
+ temporal_extent = temporal_extent ,
353
+ )
374
354
375
- # Merge the cubes
376
- data = cube_list [0 ]
377
- for cube in cube_list [1 :]:
378
- data = data .merge_cubes (cube )
355
+ data = data .merge_cubes (meteo_data )
379
356
380
357
return data
0 commit comments