Skip to content

Commit

Permalink
Cherry picking from Open-EO#128
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoesswe authored and soxofaan committed Apr 2, 2020
1 parent cb717a0 commit 5bd125f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions openeo/rest/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import shutil
import sys
import warnings
from typing import Dict, List, Tuple
from typing import Dict, List, Tuple, Union
from urllib.parse import urljoin

import requests
Expand Down Expand Up @@ -349,7 +349,7 @@ def list_processgraphs(self, process_graph):
def _api_version(self) -> ComparableVersion:
return self.capabilities().api_version_check

def load_collection(self, collection_id: str, **kwargs) -> ImageCollectionClient:
def load_collection(self, collection_id: str, **kwargs) -> Union[ImageCollectionClient, DataCube]:
"""
Load an image collection by collection id
Expand Down
11 changes: 6 additions & 5 deletions openeo/rest/datacube.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,20 +540,21 @@ def apply(self, process: str, data_argument='x') -> 'DataCube':
}
))

def reduce_temporal_simple(self, process_id="max") -> 'DataCube':
def reduce_temporal_simple(self, process_id="max", dimension=None) -> 'DataCube':
"""Do temporal reduce with a simple given process as callback."""
# TODO #128 #116 get rid again of explicit dimension argument?
return self._reduce_temporal(reducer=PGNode(
process_id=process_id,
arguments={"data": {"from_parameter": "data"}}
))
), dimension=dimension)

def min_time(self) -> 'DataCube':
def min_time(self, dimension=None) -> 'DataCube':
"""Finds the minimum value of a time series for all bands of the input dataset.
:return: a DataCube instance
"""

return self.reduce_temporal_simple("min")
# TODO #128 #116 get rid again of explicit dimension argument?
return self.reduce_temporal_simple("min", dimension=dimension)

def max_time(self) -> 'DataCube':
"""
Expand Down

0 comments on commit 5bd125f

Please sign in to comment.