fmu-sumo 2.4.1__tar.gz → 2.4.3__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.
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/.github/workflows/build_docs.yaml +1 -1
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/.github/workflows/publish_release.yaml +1 -1
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/.github/workflows/run_tests.yaml +4 -1
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/PKG-INFO +2 -2
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/examples/metrics.ipynb +88 -4
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/pyproject.toml +4 -17
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/_version.py +2 -2
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/_child.py +5 -0
- fmu_sumo-2.4.3/src/fmu/sumo/explorer/objects/_metrics.py +274 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/_search_context.py +34 -1
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu_sumo.egg-info/PKG-INFO +2 -2
- fmu_sumo-2.4.1/src/fmu/sumo/explorer/objects/_metrics.py +0 -135
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/.github/pull_request_template.md +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/.github/workflows/check_formatting.yml +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/.gitignore +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/.pre-commit-config.yaml +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/.readthedocs.yml +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/CONTRIBUTING.md +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/LICENSE +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/README.md +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/SECURITY.md +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/docs/_static/equinor-logo.png +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/docs/_static/equinor-logo2.jpg +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/docs/_static/equinor_logo.jpg +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/docs/_static/equinor_logo_only.jpg +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/docs/_templates/layout.html +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/docs/conf.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/docs/explorer.rst +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/docs/index.rst +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/examples/explorer.ipynb +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/examples/explorer2.ipynb +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/examples/grids-and-properties.ipynb +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/examples/table-aggregation.ipynb +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/examples/tables.ipynb +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/setup.cfg +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/__init__.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/__init__.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/__init__.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/cache.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/explorer.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/filters.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/__init__.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/_document.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/case.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/cases.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/cpgrid.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/cpgrid_property.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/cube.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/dictionary.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/ensemble.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/ensembles.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/iteration.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/iterations.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/polygons.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/realization.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/realizations.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/surface.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/objects/table.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu/sumo/explorer/timefilter.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu_sumo.egg-info/SOURCES.txt +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu_sumo.egg-info/dependency_links.txt +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu_sumo.egg-info/requires.txt +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/src/fmu_sumo.egg-info/top_level.txt +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/tests/conftest.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/tests/context.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/tests/test_explorer.py +0 -0
- {fmu_sumo-2.4.1 → fmu_sumo-2.4.3}/tests/test_objects_table.py +0 -0
|
@@ -11,8 +11,11 @@ jobs:
|
|
|
11
11
|
runs-on: ${{ matrix.os }}
|
|
12
12
|
strategy:
|
|
13
13
|
matrix:
|
|
14
|
-
python-version: ["3.
|
|
14
|
+
python-version: ["3.11", "3.12"]
|
|
15
15
|
os: [ubuntu-latest, windows-latest, macos-13]
|
|
16
|
+
exclude:
|
|
17
|
+
- os: windows-latest
|
|
18
|
+
python-version: "3.11"
|
|
16
19
|
permissions:
|
|
17
20
|
contents: read
|
|
18
21
|
id-token: write
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fmu-sumo
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.3
|
|
4
4
|
Summary: Python package for interacting with Sumo in an FMU setting
|
|
5
5
|
Author: Equinor
|
|
6
6
|
License: Apache License
|
|
@@ -209,7 +209,7 @@ Project-URL: Repository, https://github.com/equinor/fmu-sumo
|
|
|
209
209
|
Platform: any
|
|
210
210
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
211
211
|
Classifier: Programming Language :: Python
|
|
212
|
-
Requires-Python: >=3.
|
|
212
|
+
Requires-Python: >=3.11
|
|
213
213
|
Description-Content-Type: text/markdown
|
|
214
214
|
License-File: LICENSE
|
|
215
215
|
Requires-Dist: sumo-wrapper-python
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"metadata": {},
|
|
18
18
|
"outputs": [],
|
|
19
19
|
"source": [
|
|
20
|
-
"exp = Explorer(env=\"
|
|
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(\"
|
|
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\")
|
|
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.
|
|
250
|
+
"version": "3.11.12"
|
|
167
251
|
}
|
|
168
252
|
},
|
|
169
253
|
"nbformat": 4,
|
|
@@ -8,7 +8,7 @@ version_file = "src/fmu/sumo/explorer/_version.py"
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "fmu-sumo"
|
|
10
10
|
description = "Python package for interacting with Sumo in an FMU setting"
|
|
11
|
-
requires-python = ">=3.
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
12
|
dynamic = ["version"]
|
|
13
13
|
license = { file = "LICENSE" }
|
|
14
14
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
@@ -17,10 +17,7 @@ classifiers = [
|
|
|
17
17
|
"License :: OSI Approved :: Apache Software License",
|
|
18
18
|
"Programming Language :: Python",
|
|
19
19
|
]
|
|
20
|
-
dependencies = [
|
|
21
|
-
"sumo-wrapper-python",
|
|
22
|
-
"deprecation",
|
|
23
|
-
]
|
|
20
|
+
dependencies = ["sumo-wrapper-python", "deprecation"]
|
|
24
21
|
|
|
25
22
|
[project.urls]
|
|
26
23
|
Repository = "https://github.com/equinor/fmu-sumo"
|
|
@@ -58,21 +55,12 @@ platforms = ["any"]
|
|
|
58
55
|
where = ["src"]
|
|
59
56
|
|
|
60
57
|
[tool.ruff]
|
|
61
|
-
exclude = [
|
|
62
|
-
".env",
|
|
63
|
-
".git",
|
|
64
|
-
".github",
|
|
65
|
-
".venv",
|
|
66
|
-
"venv",
|
|
67
|
-
]
|
|
58
|
+
exclude = [".env", ".git", ".github", ".venv", "venv"]
|
|
68
59
|
|
|
69
60
|
line-length = 79
|
|
70
61
|
|
|
71
62
|
[tool.ruff.lint]
|
|
72
|
-
ignore = [
|
|
73
|
-
"E501",
|
|
74
|
-
"PD901",
|
|
75
|
-
]
|
|
63
|
+
ignore = ["E501", "PD901"]
|
|
76
64
|
|
|
77
65
|
extend-select = [
|
|
78
66
|
"C4", # Flake8-comprehensions
|
|
@@ -88,4 +76,3 @@ extend-select = [
|
|
|
88
76
|
"__init__.py" = ["F401"]
|
|
89
77
|
"tests/context.py" = ["F401"]
|
|
90
78
|
"examples/explorer.ipynb" = ["F821"]
|
|
91
|
-
|
|
@@ -140,6 +140,11 @@ class Child(Document):
|
|
|
140
140
|
"""Object iteration"""
|
|
141
141
|
return self.get_property("fmu.iteration.name")
|
|
142
142
|
|
|
143
|
+
@property
|
|
144
|
+
def ensemble(self) -> str:
|
|
145
|
+
"""Object ensemble"""
|
|
146
|
+
return self.get_property("fmu.ensemble.name")
|
|
147
|
+
|
|
143
148
|
@property
|
|
144
149
|
def context(self) -> str:
|
|
145
150
|
"""Object context"""
|
|
@@ -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": [
|
|
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.
|
|
3
|
+
Version: 2.4.3
|
|
4
4
|
Summary: Python package for interacting with Sumo in an FMU setting
|
|
5
5
|
Author: Equinor
|
|
6
6
|
License: Apache License
|
|
@@ -209,7 +209,7 @@ Project-URL: Repository, https://github.com/equinor/fmu-sumo
|
|
|
209
209
|
Platform: any
|
|
210
210
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
211
211
|
Classifier: Programming Language :: Python
|
|
212
|
-
Requires-Python: >=3.
|
|
212
|
+
Requires-Python: >=3.11
|
|
213
213
|
Description-Content-Type: text/markdown
|
|
214
214
|
License-File: LICENSE
|
|
215
215
|
Requires-Dist: sumo-wrapper-python
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|