fmu-sumo 2.4.1__tar.gz → 2.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/PKG-INFO +1 -1
  2. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/examples/metrics.ipynb +88 -4
  3. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/_version.py +2 -2
  4. fmu_sumo-2.4.2/src/fmu/sumo/explorer/objects/_metrics.py +274 -0
  5. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/_search_context.py +34 -1
  6. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu_sumo.egg-info/PKG-INFO +1 -1
  7. fmu_sumo-2.4.1/src/fmu/sumo/explorer/objects/_metrics.py +0 -135
  8. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/.github/pull_request_template.md +0 -0
  9. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/.github/workflows/build_docs.yaml +0 -0
  10. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/.github/workflows/check_formatting.yml +0 -0
  11. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/.github/workflows/publish_release.yaml +0 -0
  12. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/.github/workflows/run_tests.yaml +0 -0
  13. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/.gitignore +0 -0
  14. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/.pre-commit-config.yaml +0 -0
  15. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/.readthedocs.yml +0 -0
  16. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/CONTRIBUTING.md +0 -0
  17. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/LICENSE +0 -0
  18. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/README.md +0 -0
  19. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/SECURITY.md +0 -0
  20. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/docs/_static/equinor-logo.png +0 -0
  21. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/docs/_static/equinor-logo2.jpg +0 -0
  22. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/docs/_static/equinor_logo.jpg +0 -0
  23. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/docs/_static/equinor_logo_only.jpg +0 -0
  24. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/docs/_templates/layout.html +0 -0
  25. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/docs/conf.py +0 -0
  26. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/docs/explorer.rst +0 -0
  27. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/docs/index.rst +0 -0
  28. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/examples/explorer.ipynb +0 -0
  29. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/examples/explorer2.ipynb +0 -0
  30. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/examples/grids-and-properties.ipynb +0 -0
  31. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/examples/table-aggregation.ipynb +0 -0
  32. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/examples/tables.ipynb +0 -0
  33. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/pyproject.toml +0 -0
  34. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/setup.cfg +0 -0
  35. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/__init__.py +0 -0
  36. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/__init__.py +0 -0
  37. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/__init__.py +0 -0
  38. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/cache.py +0 -0
  39. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/explorer.py +0 -0
  40. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/filters.py +0 -0
  41. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/__init__.py +0 -0
  42. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/_child.py +0 -0
  43. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/_document.py +0 -0
  44. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/case.py +0 -0
  45. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/cases.py +0 -0
  46. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/cpgrid.py +0 -0
  47. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/cpgrid_property.py +0 -0
  48. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/cube.py +0 -0
  49. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/dictionary.py +0 -0
  50. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/ensemble.py +0 -0
  51. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/ensembles.py +0 -0
  52. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/iteration.py +0 -0
  53. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/iterations.py +0 -0
  54. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/polygons.py +0 -0
  55. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/realization.py +0 -0
  56. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/realizations.py +0 -0
  57. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/surface.py +0 -0
  58. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/objects/table.py +0 -0
  59. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu/sumo/explorer/timefilter.py +0 -0
  60. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu_sumo.egg-info/SOURCES.txt +0 -0
  61. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu_sumo.egg-info/dependency_links.txt +0 -0
  62. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu_sumo.egg-info/requires.txt +0 -0
  63. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/src/fmu_sumo.egg-info/top_level.txt +0 -0
  64. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/tests/conftest.py +0 -0
  65. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/tests/context.py +0 -0
  66. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/tests/test_explorer.py +0 -0
  67. {fmu_sumo-2.4.1 → fmu_sumo-2.4.2}/tests/test_objects_table.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fmu-sumo
3
- Version: 2.4.1
3
+ Version: 2.4.2
4
4
  Summary: Python package for interacting with Sumo in an FMU setting
5
5
  Author: Equinor
6
6
  License: Apache License
@@ -17,7 +17,7 @@
17
17
  "metadata": {},
18
18
  "outputs": [],
19
19
  "source": [
20
- "exp = Explorer(env=\"preview\")"
20
+ "exp = Explorer(env=\"dev\")"
21
21
  ]
22
22
  },
23
23
  {
@@ -27,7 +27,7 @@
27
27
  "metadata": {},
28
28
  "outputs": [],
29
29
  "source": [
30
- "case = exp.get_case_by_uuid(\"359e7c72-a4ca-43ee-9203-f09cd0f149a9\")"
30
+ "case = exp.get_case_by_uuid(\"8ffeb5f8-ca60-42ee-998e-53d34e47d3e2\")"
31
31
  ]
32
32
  },
33
33
  {
@@ -135,7 +135,7 @@
135
135
  "metadata": {},
136
136
  "outputs": [],
137
137
  "source": [
138
- "summaries.metrics.sum(field=\"_sumo.blob_size\")[\"value\"] / (1024 * 1024 * 1024)"
138
+ "summaries.metrics.sum(field=\"_sumo.blob_size\") / (1024 * 1024 * 1024)"
139
139
  ]
140
140
  },
141
141
  {
@@ -144,6 +144,90 @@
144
144
  "id": "cb3be689-6db2-483e-8195-2fcc3e1cdc69",
145
145
  "metadata": {},
146
146
  "outputs": [],
147
+ "source": [
148
+ "await summaries.metrics.min_async(field=\"_sumo.blob_size\")"
149
+ ]
150
+ },
151
+ {
152
+ "cell_type": "code",
153
+ "execution_count": null,
154
+ "id": "532cfd01-af75-4267-849f-f6852459af0a",
155
+ "metadata": {},
156
+ "outputs": [],
157
+ "source": [
158
+ "await summaries.metrics.max_async(field=\"_sumo.blob_size\")"
159
+ ]
160
+ },
161
+ {
162
+ "cell_type": "code",
163
+ "execution_count": null,
164
+ "id": "4f9f19a3-2564-46c4-b483-aae8e190eac6",
165
+ "metadata": {},
166
+ "outputs": [],
167
+ "source": [
168
+ "await summaries.metrics.avg_async(field=\"_sumo.blob_size\")"
169
+ ]
170
+ },
171
+ {
172
+ "cell_type": "code",
173
+ "execution_count": null,
174
+ "id": "0b344ee2-11e0-4a9d-b670-9e966b81b7a2",
175
+ "metadata": {},
176
+ "outputs": [],
177
+ "source": [
178
+ "await summaries.metrics.stats_async(field=\"_sumo.blob_size\")"
179
+ ]
180
+ },
181
+ {
182
+ "cell_type": "code",
183
+ "execution_count": null,
184
+ "id": "bba953f2-1bf0-49c9-a5b6-e5e4620b1e4d",
185
+ "metadata": {},
186
+ "outputs": [],
187
+ "source": [
188
+ "await summaries.metrics.extended_stats_async(field=\"_sumo.blob_size\")"
189
+ ]
190
+ },
191
+ {
192
+ "cell_type": "code",
193
+ "execution_count": null,
194
+ "id": "81aa0f72-647c-4336-8db1-572c44a5e94b",
195
+ "metadata": {},
196
+ "outputs": [],
197
+ "source": [
198
+ "await summaries.metrics.percentiles_async(field=\"_sumo.blob_size\")"
199
+ ]
200
+ },
201
+ {
202
+ "cell_type": "code",
203
+ "execution_count": null,
204
+ "id": "1f9427df-33e7-460a-a62c-2e7cae150b69",
205
+ "metadata": {},
206
+ "outputs": [],
207
+ "source": [
208
+ "await summaries.metrics.percentiles_async(\n",
209
+ " field=\"_sumo.blob_size\", percents=[95, 99, 99.9]\n",
210
+ ")"
211
+ ]
212
+ },
213
+ {
214
+ "cell_type": "code",
215
+ "execution_count": null,
216
+ "id": "4488928b-175f-4a03-a4bf-ca1c9dec0401",
217
+ "metadata": {},
218
+ "outputs": [],
219
+ "source": [
220
+ "(await summaries.metrics.sum_async(field=\"_sumo.blob_size\")) / (\n",
221
+ " 1024 * 1024 * 1024\n",
222
+ ")"
223
+ ]
224
+ },
225
+ {
226
+ "cell_type": "code",
227
+ "execution_count": null,
228
+ "id": "924c829f-0193-4f82-9c41-3f48d52af2c6",
229
+ "metadata": {},
230
+ "outputs": [],
147
231
  "source": []
148
232
  }
149
233
  ],
@@ -163,7 +247,7 @@
163
247
  "name": "python",
164
248
  "nbconvert_exporter": "python",
165
249
  "pygments_lexer": "ipython3",
166
- "version": "3.9.6"
250
+ "version": "3.11.12"
167
251
  }
168
252
  },
169
253
  "nbformat": 4,
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '2.4.1'
21
- __version_tuple__ = version_tuple = (2, 4, 1)
20
+ __version__ = version = '2.4.2'
21
+ __version_tuple__ = version_tuple = (2, 4, 2)
@@ -0,0 +1,274 @@
1
+ class Metrics:
2
+ def __init__(self, search_context):
3
+ self._search_context = search_context
4
+ return
5
+
6
+ def _aggregate(self, op, **kwargs):
7
+ aggs = {
8
+ "agg": {op: {k: v for k, v in kwargs.items() if v is not None}}
9
+ }
10
+ qdoc = {"query": self._search_context._query, "aggs": aggs, "size": 0}
11
+ res = self._search_context._sumo.post("/search", json=qdoc).json()
12
+ return res["aggregations"]["agg"]
13
+
14
+ async def _aggregate_async(self, op, **kwargs):
15
+ aggs = {
16
+ "agg": {op: {k: v for k, v in kwargs.items() if v is not None}}
17
+ }
18
+ qdoc = {"query": self._search_context._query, "aggs": aggs, "size": 0}
19
+ res = (
20
+ await self._search_context._sumo.post_async("/search", json=qdoc)
21
+ ).json()
22
+ return res["aggregations"]["agg"]
23
+
24
+ def min(self, field):
25
+ """Find the minimum value for the specified property across the
26
+ current set of objects.
27
+
28
+ Arguments:
29
+ - field (str): the name of a property in the metadata.
30
+
31
+ Returns:
32
+ The minimum value.
33
+
34
+ """
35
+ return self._aggregate("min", field=field)["value"]
36
+
37
+ async def min_async(self, field):
38
+ """Find the minimum value for the specified property across the
39
+ current set of objects.
40
+
41
+ Arguments:
42
+ - field (str): the name of a property in the metadata.
43
+
44
+ Returns:
45
+ The minimum value.
46
+
47
+ """
48
+ return (await self._aggregate_async("min", field=field))["value"]
49
+
50
+ def max(self, field):
51
+ """Find the maximum value for the specified property across the
52
+ current set of objects.
53
+
54
+ Arguments:
55
+ - field (str): the name of a property in the metadata.
56
+
57
+ Returns:
58
+ The maximum value.
59
+
60
+ """
61
+ return self._aggregate("max", field=field)["value"]
62
+
63
+ async def max_async(self, field):
64
+ """Find the maximum value for the specified property across the
65
+ current set of objects.
66
+
67
+ Arguments:
68
+ - field (str): the name of a property in the metadata.
69
+
70
+ Returns:
71
+ The maximum value.
72
+
73
+ """
74
+ return (await self._aggregate_async("max", field=field))["value"]
75
+
76
+ def avg(self, field):
77
+ """Find the average value for the specified property across the
78
+ current set of objects.
79
+
80
+ Arguments:
81
+ - field (str): the name of a property in the metadata.
82
+
83
+ Returns:
84
+ The average value.
85
+
86
+ """
87
+ return self._aggregate("avg", field=field)["value"]
88
+
89
+ async def avg_async(self, field):
90
+ """Find the average value for the specified property across the
91
+ current set of objects.
92
+
93
+ Arguments:
94
+ - field (str): the name of a property in the metadata.
95
+
96
+ Returns:
97
+ The average value.
98
+
99
+ """
100
+ return (await self._aggregate_async("avg", field=field))["value"]
101
+
102
+ def sum(self, field):
103
+ """Find the sumo of all values for the specified property across
104
+ the current set of objects.
105
+
106
+ Arguments:
107
+ - field (str): the name of a property in the metadata.
108
+
109
+ Returns:
110
+ The sum of all values.
111
+
112
+ """
113
+ return self._aggregate("sum", field=field)["value"]
114
+
115
+ async def sum_async(self, field):
116
+ """Find the sumo of all values for the specified property across
117
+ the current set of objects.
118
+
119
+ Arguments:
120
+ - field (str): the name of a property in the metadata.
121
+
122
+ Returns:
123
+ The sum of all values.
124
+
125
+ """
126
+ return (await self._aggregate_async("sum", field=field))["value"]
127
+
128
+ def value_count(self, field):
129
+ """Find the count of values for the specified property across the
130
+ current set of objects.
131
+
132
+ Arguments:
133
+ - field (str): the name of a property in the metadata.
134
+
135
+ Returns:
136
+ The total number of values.
137
+
138
+ """
139
+ return self._aggregate("value_count", field=field)["value"]
140
+
141
+ async def value_count_async(self, field):
142
+ """Find the count of values for the specified property across the
143
+ current set of objects.
144
+
145
+ Arguments:
146
+ - field (str): the name of a property in the metadata.
147
+
148
+ Returns:
149
+ The total number of values.
150
+
151
+ """
152
+ return (await self._aggregate_async("value_count", field=field))[
153
+ "value"
154
+ ]
155
+
156
+ def cardinality(self, field):
157
+ """Find the count of distinct values for the specified property
158
+ across the current set of objects.
159
+
160
+ Arguments:
161
+ - field (str): the name of a property in the metadata.
162
+
163
+ Returns:
164
+ The number of distinct values.
165
+
166
+ Note: The value returned is approximate.
167
+
168
+ """
169
+ return self._aggregate("cardinality", field=field)["value"]
170
+
171
+ async def cardinality_async(self, field):
172
+ """Find the count of distinct values for the specified property
173
+ across the current set of objects.
174
+
175
+ Arguments:
176
+ - field (str): the name of a property in the metadata.
177
+
178
+ Returns:
179
+ The number of distinct values.
180
+
181
+ Note: The value returned is approximate.
182
+
183
+ """
184
+ return (await self._aggregate_async("cardinality", field=field))[
185
+ "value"
186
+ ]
187
+
188
+ def stats(self, field):
189
+ """Compute a basic set of statistics of the values for the specified
190
+ property across the current set of objects.
191
+
192
+ Arguments:
193
+ - field (str): the name of a property in the metadata.
194
+
195
+ Returns:
196
+ A dictionary of statistical metrics.
197
+
198
+ """
199
+ return self._aggregate("stats", field=field)
200
+
201
+ async def stats_async(self, field):
202
+ """Compute a basic set of statistics of the values for the specified
203
+ property across the current set of objects.
204
+
205
+ Arguments:
206
+ - field (str): the name of a property in the metadata.
207
+
208
+ Returns:
209
+ A dictionary of statistical metrics.
210
+
211
+ """
212
+ return await self._aggregate_async("stats", field=field)
213
+
214
+ def extended_stats(self, field):
215
+ """Compute an extended set of statistics of the values for the
216
+ specified property across the current set of objects.
217
+
218
+ Arguments:
219
+ - field (str): the name of a property in the metadata.
220
+
221
+ Returns:
222
+ A dictionary of statistical metrics.
223
+
224
+ """
225
+ return self._aggregate("extended_stats", field=field)
226
+
227
+ async def extended_stats_async(self, field):
228
+ """Compute an extended set of statistics of the values for the
229
+ specified property across the current set of objects.
230
+
231
+ Arguments:
232
+ - field (str): the name of a property in the metadata.
233
+
234
+ Returns:
235
+ A dictionary of statistical metrics.
236
+
237
+ """
238
+ return await self._aggregate_async("extended_stats", field=field)
239
+
240
+ def percentiles(self, field, percents=None):
241
+ """Find the values at specific percentiles for the specified
242
+ property across the current set of objects.
243
+
244
+ Arguments:
245
+ - field (str): the name of a property in the metadata.
246
+ - percents ([number]): list of percent values. If omitted, uses
247
+ a default set of values.
248
+
249
+ Returns:
250
+ A dictionary of percentiles.
251
+
252
+ """
253
+ return self._aggregate("percentiles", field=field, percents=percents)[
254
+ "values"
255
+ ]
256
+
257
+ async def percentiles_async(self, field, percents=None):
258
+ """Find the values at specific percentiles for the specified
259
+ property across the current set of objects.
260
+
261
+ Arguments:
262
+ - field (str): the name of a property in the metadata.
263
+ - percents ([number]): list of percent values. If omitted, uses
264
+ a default set of values.
265
+
266
+ Returns:
267
+ A dictionary of percentiles.
268
+
269
+ """
270
+ return (
271
+ await self._aggregate_async(
272
+ "percentiles", field=field, percents=percents
273
+ )
274
+ )["values"]
@@ -64,6 +64,28 @@ def _gen_filter_gen(attr):
64
64
  return _fn
65
65
 
66
66
 
67
+ def _gen_filter_stage(attr):
68
+ """Match property against either single value or list of values.
69
+ If the value given is a boolean, tests for existence or not of the property.
70
+ In addition, if the value is or includes either "iteration" or "ensemble",
71
+ expand to include both values.
72
+ """
73
+
74
+ _inner = _gen_filter_gen(attr)
75
+
76
+ def _fn(value):
77
+ if value == "iteration" or value == "ensemble":
78
+ return _inner(["iteration", "ensemble"])
79
+ elif isinstance(value, list) and set(value).intersection(
80
+ {"iteration", "ensemble"}
81
+ ):
82
+ return _inner(list(set(value).union({"iteration", "ensemble"})))
83
+ else:
84
+ return _inner(value)
85
+
86
+ return _fn
87
+
88
+
67
89
  def _gen_filter_name():
68
90
  """Match against \"data.name\", or \"case.name\" for case objects."""
69
91
 
@@ -144,7 +166,7 @@ _filterspec = {
144
166
  "ensemble": [_gen_filter_gen, "fmu.ensemble.name.keyword"],
145
167
  "realization": [_gen_filter_gen, "fmu.realization.id"],
146
168
  "aggregation": [_gen_filter_gen, "fmu.aggregation.operation.keyword"],
147
- "stage": [_gen_filter_gen, "fmu.context.stage.keyword"],
169
+ "stage": [_gen_filter_stage, "fmu.context.stage.keyword"],
148
170
  "column": [_gen_filter_gen, "data.spec.columns.keyword"],
149
171
  "vertical_domain": [_gen_filter_gen, "data.vertical_domain.keyword"],
150
172
  "content": [_gen_filter_gen, "data.content.keyword"],
@@ -156,6 +178,7 @@ _filterspec = {
156
178
  "is_observation": [_gen_filter_bool, "data.is_observation"],
157
179
  "is_prediction": [_gen_filter_bool, "data.is_prediction"],
158
180
  "standard_result": [_gen_filter_gen, "data.standard_result.name.keyword"],
181
+ "entity": [_gen_filter_gen, "fmu.entity.uuid.keyword"],
159
182
  "complex": [_gen_filter_complex, None],
160
183
  "has": [_gen_filter_none, None],
161
184
  }
@@ -1931,6 +1954,16 @@ class SearchContext:
1931
1954
  "data.standard_result.name.keyword"
1932
1955
  )
1933
1956
 
1957
+ @property
1958
+ def entities(self) -> List[str]:
1959
+ """List of entity uuids."""
1960
+ return self.get_field_values("fmu.entity.uuid.keyword")
1961
+
1962
+ @property
1963
+ async def entities_async(self) -> List[str]:
1964
+ """List of entity uuids."""
1965
+ return await self.get_field_values_async("fmu.entity.uuid.keyword")
1966
+
1934
1967
 
1935
1968
  def _gen_filter_doc(spec):
1936
1969
  fmap = {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fmu-sumo
3
- Version: 2.4.1
3
+ Version: 2.4.2
4
4
  Summary: Python package for interacting with Sumo in an FMU setting
5
5
  Author: Equinor
6
6
  License: Apache License
@@ -1,135 +0,0 @@
1
- class Metrics:
2
- def __init__(self, search_context):
3
- self._search_context = search_context
4
- return
5
-
6
- def _aggregate(self, op, **kwargs):
7
- aggs = {
8
- "agg": {op: {k: v for k, v in kwargs.items() if v is not None}}
9
- }
10
- qdoc = {"query": self._search_context._query, "aggs": aggs, "size": 0}
11
- res = self._search_context._sumo.post("/search", json=qdoc).json()
12
- return res["aggregations"]["agg"]
13
-
14
- def min(self, field):
15
- """Find the minimum value for the specified property across the
16
- current set of objects.
17
-
18
- Arguments:
19
- - field (str): the name of a property in the metadata.
20
-
21
- Returns:
22
- The minimum value.
23
-
24
- """
25
- return self._aggregate("min", field=field)["value"]
26
-
27
- def max(self, field):
28
- """Find the maximum value for the specified property across the
29
- current set of objects.
30
-
31
- Arguments:
32
- - field (str): the name of a property in the metadata.
33
-
34
- Returns:
35
- The maximum value.
36
-
37
- """
38
- return self._aggregate("max", field=field)["value"]
39
-
40
- def avg(self, field):
41
- """Find the average value for the specified property across the
42
- current set of objects.
43
-
44
- Arguments:
45
- - field (str): the name of a property in the metadata.
46
-
47
- Returns:
48
- The average value.
49
-
50
- """
51
- return self._aggregate("avg", field=field)["value"]
52
-
53
- def sum(self, field):
54
- """Find the sumo of all values for the specified property across
55
- the current set of objects.
56
-
57
- Arguments:
58
- - field (str): the name of a property in the metadata.
59
-
60
- Returns:
61
- The sum of all values.
62
-
63
- """
64
- return self._aggregate("sum", field=field)["value"]
65
-
66
- def value_count(self, field):
67
- """Find the count of values for the specified property across the
68
- current set of objects.
69
-
70
- Arguments:
71
- - field (str): the name of a property in the metadata.
72
-
73
- Returns:
74
- The total number of values.
75
-
76
- """
77
- return self._aggregate("value_count", field=field)["value"]
78
-
79
- def cardinality(self, field):
80
- """Find the count of distinct values for the specified property
81
- across the current set of objects.
82
-
83
- Arguments:
84
- - field (str): the name of a property in the metadata.
85
-
86
- Returns:
87
- The number of distinct values.
88
-
89
- Note: The value returned is approximate.
90
-
91
- """
92
- return self._aggregate("cardinality", field=field)["value"]
93
-
94
- def stats(self, field):
95
- """Compute a basic set of statistics of the values for the specified
96
- property across the current set of objects.
97
-
98
- Arguments:
99
- - field (str): the name of a property in the metadata.
100
-
101
- Returns:
102
- A dictionary of statistical metrics.
103
-
104
- """
105
- return self._aggregate("stats", field=field)
106
-
107
- def extended_stats(self, field):
108
- """Compute an extended set of statistics of the values for the
109
- specified property across the current set of objects.
110
-
111
- Arguments:
112
- - field (str): the name of a property in the metadata.
113
-
114
- Returns:
115
- A dictionary of statistical metrics.
116
-
117
- """
118
- return self._aggregate("extended_stats", field=field)
119
-
120
- def percentiles(self, field, percents=None):
121
- """Find the values at specific percentiles for the specified
122
- property across the current set of objects.
123
-
124
- Arguments:
125
- - field (str): the name of a property in the metadata.
126
- - percents ([number]): list of percent values. If omitted, uses
127
- a default set of values.
128
-
129
- Returns:
130
- A dictionary of percentiles.
131
-
132
- """
133
- return self._aggregate("percentiles", field=field, percents=percents)[
134
- "values"
135
- ]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes