Skip to content

Commit 76ffe9f

Browse files
authored
Merge pull request #45 from equinor/77073
Added endpoint for aggregation service
2 parents 16678a4 + 94537d2 commit 76ffe9f

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

src/sumo/wrapper/_call_sumo_api.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,27 @@ def save_blob_and_json(self, parent_id, metadata_json, blob, bearer=None):
283283
_ = self.save_blob(blob, url=blob_url, bearer=bearer)
284284
return response_json
285285

286+
def aggregate_surfaces(self, operation, object_ids, bearer=None):
287+
"""
288+
Perform an aggregation on surfaces described by the operation parameter for
289+
the objects in the object_ids list. A new surface object is returned.
290+
291+
Parameters
292+
operation: string, the operation to perfomr. MEAN, MEDIAN, MIN, MAX, STD
293+
and PXX for a specific percentile.
294+
object_ids: list, the object-ids to
295+
bearer: string, Azure OAuth2 bear token Default: will create one.
296+
297+
Return
298+
surface: The aggregated surface
299+
"""
300+
301+
json = {}
302+
json['operation'] = operation
303+
json['object_ids'] = object_ids
304+
url = f'{self.base_url}/aggregate'
305+
return self._post_objects(url = url, json=json, bearer=bearer)
306+
286307
def _post_objects(self, json, blob=None, object_id=None, bearer=None, url=None):
287308
"""
288309
Post a new object into sumo.
@@ -331,3 +352,5 @@ def _put_objects(self, object_id=None, blob=None, json=None, bearer=None, url=No
331352
url = f'{url}/blob'
332353

333354
return self.callAzureApi.put(url=url, blob=blob, json=json, bearer=bearer)
355+
356+

0 commit comments

Comments
 (0)