Skip to content

Commit 6189706

Browse files
committed
Issue #47 remove unreachable 0.4-style apply_process code path
`parent_process` env val is not being set anymore
1 parent f94efa7 commit 6189706

File tree

1 file changed

+0
-64
lines changed

1 file changed

+0
-64
lines changed

openeo_driver/ProcessGraphDeserializer.py

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,6 @@ def constant(args: dict, env: EvalEnv):
15331533

15341534
def apply_process(process_id: str, args: dict, namespace: Union[str, None], env: EvalEnv):
15351535
_log.debug(f"apply_process {process_id} with {args}")
1536-
parent_process = env.get('parent_process')
15371536
parameters = env.collect_parameters()
15381537

15391538
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:
15571556
args = {name: convert_node(expr, env=env) for (name, expr) in sorted(args.items())}
15581557

15591558
# 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-
16231559
if namespace and any(namespace.startswith(p) for p in ["http://", "https://"]):
16241560
# TODO: HTTPS only by default and config to also allow HTTP (e.g. for localhost dev and testing)
16251561
# TODO: security aspects: only allow for certain users, only allow whitelisted domains, ...?

0 commit comments

Comments
 (0)