@@ -1533,7 +1533,6 @@ def constant(args: dict, env: EvalEnv):
1533
1533
1534
1534
def apply_process (process_id : str , args : dict , namespace : Union [str , None ], env : EvalEnv ):
1535
1535
_log .debug (f"apply_process { process_id } with { args } " )
1536
- parent_process = env .get ('parent_process' )
1537
1536
parameters = env .collect_parameters ()
1538
1537
1539
1538
if process_id == "mask" and args .get ("replacement" , None ) is None \
@@ -1557,69 +1556,6 @@ def apply_process(process_id: str, args: dict, namespace: Union[str, None], env:
1557
1556
args = {name : convert_node (expr , env = env ) for (name , expr ) in sorted (args .items ())}
1558
1557
1559
1558
# when all arguments and dependencies are resolved, we can run the process
1560
- if parent_process == "apply" :
1561
- # TODO EP-3404 this code path is for version <1.0.0, soon to be deprecated
1562
- image_collection = extract_arg_list (args , ['x' , 'data' ])
1563
- if not isinstance (image_collection , DriverDataCube ):
1564
- raise ProcessParameterInvalidException (
1565
- parameter = "[x, data]" , process = "apply_process" ,
1566
- reason = f"Invalid data type { type (image_collection )!r} expected raster-cube."
1567
- )
1568
- if process_id == "run_udf" :
1569
- udf , runtime = _get_udf (args , env = env )
1570
- # TODO replace non-standard apply_tiles with standard "reduce_dimension" https://github.com/Open-EO/openeo-python-client/issues/140
1571
- return image_collection .apply_tiles (udf , {}, runtime )
1572
- else :
1573
- # TODO : add support for `apply` with non-trivial child process graphs #EP-3404
1574
- return image_collection .apply (process_id , args )
1575
- elif parent_process == 'apply_dimension' :
1576
- # TODO EP-3285 this code path is for version <1.0.0, soon to be deprecated
1577
- image_collection = extract_arg (args , 'data' , process_id = process_id )
1578
- if not isinstance (image_collection , DriverDataCube ):
1579
- raise ProcessParameterInvalidException (
1580
- parameter = "data" , process = "apply_process" ,
1581
- reason = f"Invalid data type { type (image_collection )!r} expected raster-cube."
1582
- )
1583
- dimension = parameters .get ('dimension' , None ) # By default, applies the the process on all pixel values (as apply does).
1584
- target_dimension = parameters .get ('target_dimension' , None )
1585
- dimension , band_dim , temporal_dim = _check_dimension (cube = image_collection , dim = dimension , process = parent_process )
1586
- transformed_collection = None
1587
- if process_id == "run_udf" :
1588
- udf , runtime = _get_udf (args , env = env )
1589
- context = args .get ("context" ,{})
1590
- if dimension == temporal_dim :
1591
- transformed_collection = image_collection .apply_tiles_spatiotemporal (udf ,context )
1592
- else :
1593
- # TODO replace non-standard apply_tiles with standard "reduce_dimension" https://github.com/Open-EO/openeo-python-client/issues/140
1594
- transformed_collection = image_collection .apply_tiles (udf ,context ,runtime )
1595
- else :
1596
- transformed_collection = image_collection .apply_dimension (process_id , dimension )
1597
- if target_dimension is not None :
1598
- transformed_collection .rename_dimension (dimension , target_dimension )
1599
- return transformed_collection
1600
- elif parent_process == 'aggregate_temporal' :
1601
- # TODO EP-3285 this code path is for version <1.0.0, soon to be deprecated
1602
- image_collection = extract_arg (args , 'data' , process_id = process_id )
1603
- if not isinstance (image_collection , DriverDataCube ):
1604
- raise ProcessParameterInvalidException (
1605
- parameter = "data" , process = "apply_process" ,
1606
- reason = f"Invalid data type { type (image_collection )!r} expected raster-cube."
1607
- )
1608
- intervals = extract_arg (parameters , 'intervals' )
1609
- labels = extract_arg (parameters , 'labels' )
1610
- dimension = parameters .get ('dimension' , None )
1611
- if dimension is not None :
1612
- dimension , _ , _ = _check_dimension (cube = image_collection , dim = dimension , process = parent_process )
1613
- else :
1614
- #default: there is a single temporal dimension
1615
- try :
1616
- dimension = image_collection .metadata .temporal_dimension .name
1617
- except MetadataException :
1618
- raise ProcessParameterInvalidException (
1619
- parameter = "dimension" , process = process_id ,
1620
- reason = "No dimension was set, and no temporal dimension could be found. Available dimensions: {n!r}" .format ( n = image_collection .metadata .dimension_names ()))
1621
- return image_collection .aggregate_temporal (intervals , labels , process_id , dimension )
1622
-
1623
1559
if namespace and any (namespace .startswith (p ) for p in ["http://" , "https://" ]):
1624
1560
# TODO: HTTPS only by default and config to also allow HTTP (e.g. for localhost dev and testing)
1625
1561
# TODO: security aspects: only allow for certain users, only allow whitelisted domains, ...?
0 commit comments