Skip to content

Commit

Permalink
Swap name and tagname for grids
Browse files Browse the repository at this point in the history
  • Loading branch information
equinor-ruaj committed Oct 3, 2024
1 parent 97818be commit 2e7b72a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
7 changes: 1 addition & 6 deletions src/fmu/sumo/sim2sumo/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,11 @@ def get_case_uuid(file_path, parent_level=4):
Returns:
str: the case uuid
"""
logger = logging.getLogger(__name__ + ".get_case_uuid")
logger.debug("Asked for parent %s for %s", parent_level, file_path)
case_meta_path = (
Path(file_path).parents[parent_level] / "share/metadata/fmu_case.yml"
)
logger.debug("Case meta path: %s", case_meta_path)
case_meta = yaml_load(case_meta_path)
uuid = case_meta["fmu"]["case"]["uuid"]
logger.info("Case uuid: %s", uuid)
return uuid


Expand Down Expand Up @@ -424,7 +420,7 @@ def find_datefield(text_string):
return date


def generate_meta(config, datafile_path, tagname, obj, content):
def generate_meta(config, datafile_path, tagname, name, obj, content):
"""Generate metadata for object
Args:
Expand All @@ -443,7 +439,6 @@ def generate_meta(config, datafile_path, tagname, obj, content):
logger.debug("Config: %s", config)
logger.debug("datafile_path: %s", datafile_path)
logger.info("tagname: %s", tagname)
name = give_name(datafile_path)
exp_args = {
"config": config,
"name": name,
Expand Down
12 changes: 5 additions & 7 deletions src/fmu/sumo/sim2sumo/grid3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
from xtgeo.grid3d import _gridprop_import_eclrun as eclrun
from xtgeo.io._file import FileWrapper

from .common import (
generate_meta,
convert_2_sumo_file,
)
from .common import generate_meta, convert_2_sumo_file, give_name


def xtgeo_2_bytestring(obj):
Expand Down Expand Up @@ -64,10 +61,11 @@ def generate_grid3d_meta(datafile, obj, prefix, config, content):
return obj

if prefix == "grid":
tagname = prefix
name = prefix
else:
tagname = f"{prefix}-{obj.name}"
metadata = generate_meta(config, datafile, tagname, obj, content)
name = f"{prefix}-{obj.name}"
tagname = give_name(datafile)
metadata = generate_meta(config, datafile, tagname, name, obj, content)
logger.debug("Generated meta are %s", metadata)

return metadata
Expand Down
8 changes: 3 additions & 5 deletions src/fmu/sumo/sim2sumo/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
vfp_to_arrow_dict,
find_md_log,
)
from .common import (
generate_meta,
convert_2_sumo_file,
)
from .common import generate_meta, convert_2_sumo_file, give_name


SUBMOD_CONTENT = {
Expand Down Expand Up @@ -88,7 +85,8 @@ def generate_table_meta(datafile, obj, tagname, config):
else:
content = SUBMOD_CONTENT.get(tagname, "property")

metadata = generate_meta(config, datafile, tagname, obj, content)
name = give_name(datafile)
metadata = generate_meta(config, datafile, tagname, name, obj, content)
logger.debug("Generated meta are %s", metadata)

return metadata
Expand Down

0 comments on commit 2e7b72a

Please sign in to comment.