Volume Tables¶
Below is an example of exporting volume tables from csv-files, while an example of a simple export of RMS volumetrics can be found on the Inplace Volumes page.
Python script¶
1"""Re-export already exported volume tables for Sumo."""
2
3from pathlib import Path
4
5import pandas as pd
6from fmu.config import utilities as ut
7
8from fmu.dataio import ExportData
9
10CFG = ut.yaml_load("../../fmuconfig/output/global_variables.yml")
11
12VOL_DIR = Path("../output/volumes/")
13VOL_FILES = ["geogrid_vol.csv", "simgrid_vol.csv"]
14
15
16def load_volume_df(vol_file):
17 """Loads an already exported volumes table into a Pandas dataframe."""
18 fname = VOL_DIR / vol_file
19 return pd.read_csv(fname)
20
21
22def export_volumes(df, grid_name):
23 """Re-export the volume table with metadata for Sumo."""
24
25 export_data = ExportData(
26 name=grid_name,
27 config=CFG,
28 content="volumes",
29 unit="m3",
30 tagname="volumes",
31 workflow="Volume calculation",
32 )
33
34 out_path = export_data.export(df)
35 print(f"Exported volume table for {grid_name} to {out_path}")
36
37
38def main():
39 print("\nExporting volume tables and metadata...")
40
41 for vol_file in VOL_FILES:
42 # Converts a file name like "geogrid_vol.csv" --> "geogrid"
43 grid_name = vol_file.replace("_vol.csv", "")
44
45 df = load_volume_df(vol_file)
46 export_volumes(df, grid_name)
47
48 print("Done exporting volume tables and metadata.")
49
50
51if __name__ == "__main__":
52 main()
Press + to see generated YAML file.
class: table
masterdata:
smda:
coordinate_system:
identifier: ST_WGS84_UTM37N_P32637
uuid: ad214d85-dac7-19da-e053-c918a4889309
country:
- identifier: Norway
uuid: ad214d85-8a1d-19da-e053-c918a4889309
discovery:
- short_identifier: DROGON
uuid: ad214d85-8a1d-19da-e053-c918a4889309
field:
- identifier: DROGON
uuid: 00000000-0000-0000-0000-000000000000
stratigraphic_column:
identifier: DROGON_2020
uuid: ad214d85-8a1d-19da-e053-c918a4889310
tracklog:
- datetime: '2026-06-05T10:36:53.469594Z'
event: created
user:
id: docs
sysinfo:
fmu-dataio:
version: 2.29.2.dev3+g7b3b17db7
operating_system:
hostname: build-33005878-project-703197-fmu-dataio
operating_system: Linux-7.0.0-1004-aws-x86_64-with-glibc2.35
release: 7.0.0-1004-aws
system: Linux
version: '#4-Ubuntu SMP PREEMPT Mon Apr 13 13:14:24 UTC 2026'
source: fmu
version: 0.22.0
$schema: https://main-fmu-schemas-prod.radix.equinor.com/schemas/0.22.0/fmu_results.json
fmu:
case:
name: MyCase
user:
id: docs
uuid: de3299d8-4460-462e-a359-5b274d40164a
model:
name: ff
revision: 21.1.0.dev
context:
stage: realization
ensemble:
name: iter-0
uuid: c68ca28f-f0d5-c895-fe21-63a2d127bb9e
id: 0
iteration:
name: iter-0
uuid: c68ca28f-f0d5-c895-fe21-63a2d127bb9e
id: 0
workflow:
reference: Volume calculation
realization:
id: 0
name: example_exports
uuid: fe066697-5ecf-1432-b881-5a5e7a993a67
entity:
uuid: 4ca0bc26-7c93-952f-ed07-69877a5c3bc8
ert:
experiment:
id: 00000000-0000-0000-0000-000000000000
simulation_mode: test_run
ensemble:
name: iter-0
uuid: b027f225-c45d-477d-8f33-73695217ba14
id: 0
access:
asset:
name: Drogon
classification: internal
ssdl:
access_level: internal
rep_include: false
data:
content: volumes
name: geogrid
alias: []
tagname: volumes
stratigraphic: false
format: csv
is_observation: false
is_prediction: true
layout: table
offset: 0.0
spec:
columns:
- 'Unnamed: 0'
- ZONE
- REGION
- FLUID
- BULK_OIL
- PORV_OIL
- HCPV_OIL
- STOIIP_OIL
- ASSOCIATEDGAS_OIL
- BULK_GAS
- PORV_GAS
- HCPV_GAS
- GIIP_GAS
- ASSOCIATEDOIL_GAS
- BULK_TOTAL
- PORV_TOTAL
num_columns: 16
num_rows: 21
size: 336
undef_is_zero: false
unit: m3
vertical_domain: depth
domain_reference: msl
table_index:
- FLUID
- ZONE
- REGION
file:
absolute_path: /home/docs/checkouts/readthedocs.org/user_builds/fmu-dataio/checkouts/latest/examples/example_exports/share/results/tables/geogrid--volumes.csv
relative_path: example_exports/share/results/tables/geogrid--volumes.csv
runpath_relative_path: share/results/tables/geogrid--volumes.csv
checksum_md5: 0cb778f91e6074c471b4bbce1f919165
size_bytes: 3911
display:
name: geogrid
_preprocessed: false