Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanity-check the config? #373

Closed
perolavsvendsen opened this issue Sep 28, 2023 · 6 comments
Closed

Sanity-check the config? #373

perolavsvendsen opened this issue Sep 28, 2023 · 6 comments
Assignees
Labels
question Further information is requested

Comments

@perolavsvendsen
Copy link
Member

In an asset, the _stratigraphy block from the global_variables.yml was written like this:

HorName:
  name: Proper Name
  alias:
  stratigraphic: true

...with an empty entry for alias. After being consumed through fmu-config, it ended up like this:

HorName:
  name: Proper Name
  alias: null
  stratigraphic: true

This lead to this failure in fmu-datio:

Traceback (most recent call last):
  Python script, line 69
  Python script, line 38, in main
  Python script, line 67, in _export
  File "/prog/res/roxapi/x86_64_RH_7/matrix/13.1/lib/python3.8/site-packages/fmu/dataio/dataio.py", line 835, in export
    self.generate_metadata(obj, compute_md5=False, **kwargs)
  File "/prog/res/roxapi/x86_64_RH_7/matrix/13.1/lib/python3.8/site-packages/fmu/dataio/dataio.py", line 805, in generate_metadata
    self._metadata = metaobj.generate_export_metadata()
  File "/prog/res/roxapi/x86_64_RH_7/matrix/13.1/lib/python3.8/site-packages/fmu/dataio/_metadata.py", line 373, in generate_export_metadata
    self._populate_meta_objectdata()
  File "/prog/res/roxapi/x86_64_RH_7/matrix/13.1/lib/python3.8/site-packages/fmu/dataio/_metadata.py", line 240, in _populate_meta_objectdata
    self.objdata.derive_metadata()
  File "/prog/res/roxapi/x86_64_RH_7/matrix/13.1/lib/python3.8/site-packages/fmu/dataio/_objectdata_provider.py", line 674, in derive_metadata
    nameres = self._derive_name_stratigraphy()
  File "/prog/res/roxapi/x86_64_RH_7/matrix/13.1/lib/python3.8/site-packages/fmu/dataio/_objectdata_provider.py", line 183, in _derive_name_stratigraphy
    result["alias"].append(name)  # type: ignore
AttributeError: 'NoneType' object has no attribute 'append'

This is a copy/paste error which we may encounter again. Should there be some sanity checks of the config which will give more informative error messages? (This could also be done in fmu-config.)

@perolavsvendsen perolavsvendsen added the question Further information is requested label Sep 28, 2023
@perolavsvendsen
Copy link
Member Author

There is also the case of having empty entries in the lists in the stratigraphy, e.g.

MyFormation:
  stratigraphic: True
  name: My Fm. Top
  alias:
    - MyFormation
    - OtherAlias
    -                   # <-- PROBLEM!
  stratigraphic_alias:
    - Some GP. Top
    - SomeOther GP. Base   
    -                   # <-- PROBLEM!

---> This will currently export with null in outgoing metadata. In validation, it is expected to be string hence not validated. Tricky to debug. fmu-dataio should catch this and either warn or ignore or both.

@perolavsvendsen
Copy link
Member Author

It could be an option/possibility to create a utility script for doing this as well. Could be useful for debugging and setup.

  • Read the global_variables, find the stratigraphic column
  • Parse the stratigraphic column from SMDA
  • Minimum viable version: Compare and QC the stratigraphy block against the stratigraphy column
    • Detect if units are not in stratigraphic column, but flagged as stratigraphic: true

@perolavsvendsen
Copy link
Member Author

#386

@mferrera
Copy link
Collaborator

mferrera commented May 2, 2024

Is this reasonable to close when we have fully moved to Pydantic validation?

@perolavsvendsen
Copy link
Member Author

Is this reasonable to close when we have fully moved to Pydantic validation?

Yes, that sounds right

@mferrera
Copy link
Collaborator

Closed in lieu of having completed the move to Pydantic which does such validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants