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

FIX: Allow user input on vertical_domain #733

Merged
merged 1 commit into from
Jul 4, 2024

Conversation

tnatt
Copy link
Collaborator

@tnatt tnatt commented Jul 4, 2024

PR that closes #624.

Main problems were:

  • vertical_domain were hardcoded to {"depth": "msl"} where the dict value was the depth_reference
  • the depth_reference was previously only possible to input for content="depth" (according to the schema)

I have been very much back and forth on how to best solve this one. But after discussions with @jcrivenaes we landed on adding a new general domain_reference argument in ExportData and as field in the schema as the best solution. This will be applicable both for time/depth domains.

Other changes

  • deprecate unused depth_reference argument in ExportData
  • support giving in vertical_domain as string ("time" or "depth") and deprecate dictionary input
  • set the vertical_domain according to the content if content is depth/time,

@tnatt tnatt self-assigned this Jul 4, 2024
@@ -290,8 +294,10 @@ class ExportData:
[[20200101, "monitor"], [20180101, "base"]] or just [[2021010]]. The output
to metadata will from version 0.9 be different (API change)

vertical_domain: This is dictionary with a key and a reference e.g.
{"depth": "msl"} which is default if missing.
vertical_domain: Optional. String with vertical domain either "time" or "depth".
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see we use "Optional ", "Optional. ", and "Optional, " to indicate optionality. It's not relevant to this PR, just an observation, but maybe we should align all of these to one if it's reasonable to do so.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I agree the entire argument documentation should have a go through

Copy link
Collaborator

@mferrera mferrera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 👍 a few uniformity nits but not important ones

src/fmu/dataio/dataio.py Outdated Show resolved Hide resolved
src/fmu/dataio/dataio.py Outdated Show resolved Hide resolved
src/fmu/dataio/dataio.py Outdated Show resolved Hide resolved
Comment on lines +106 to +107
metadata["vertical_domain"] = self.dataio.vertical_domain
metadata["domain_reference"] = self.dataio.domain_reference
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much nicer 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

datum could possibly also be used. Is it a risk that we will have different (whitelisted) allowed domain_references for each content? E.g. "rkb" would make sense for "content: wellpath", but not for "content: field_outline". Would this be messy? (Perhaps that was the reasoning behind the dict input 🤷‍♂️)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Different topic, but this is also an example of how the data model struggle to scale beyond data objects containing a single dataset. E.g. for a depth surface, this is fine. But for a table containing different things which have different references, it doesn't work. (Same as with "unit".)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Different topic, but this is also an example of how the data model struggle to scale beyond data objects containing a single dataset. E.g. for a depth surface, this is fine. But for a table containing different things which have different references, it doesn't work. (Same as with "unit".)

I think we have to live with that. I think the only way to mitigate that may be something like domain_reference="multiple" og "n/a" at top level, and then give spesific data per "sub-type" (like columns in a table).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

datum could possibly also be used. Is it a risk that we will have different (whitelisted) allowed domain_references for each content? E.g. "rkb" would make sense for "content: wellpath", but not for "content: field_outline". Would this be messy? (Perhaps that was the reasoning behind the dict input 🤷‍♂️)

Would data like "field-outline" actually need a domain reference? Since the data itself is "2D" (bird view)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the dict input would help in the matter of contents having different allowed references.. it was just a way of setting the vertical_domain together with the reference.
And at the moment I find it difficult to put any logic on the content 🤔 .. some of the contents are quite clear and should be obvious what data it is providing, but many of our contents are general and can be attached to various data... My hope is that much of this gets clearer once we start focusing on 'products' 🤞

Copy link
Collaborator

@jcrivenaes jcrivenaes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is good to go. It is now more scalable for "unknown" future needs; e.g. a domain reference for land-based seismics may be something else than we have currently, but we can easily extend the list.

@tnatt tnatt force-pushed the vertical_domain_bug branch from 5be796e to c32b1c3 Compare July 4, 2024 11:55
@tnatt tnatt merged commit 113fcaf into equinor:main Jul 4, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use vertical_domain from input if given
4 participants