-
Notifications
You must be signed in to change notification settings - Fork 15
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
DOC: Add more docstrings with some renaming #712
Conversation
@@ -114,18 +114,28 @@ class User(BaseModel): | |||
) | |||
|
|||
|
|||
class FMUCase(BaseModel): | |||
class Case(BaseModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed some of these prefix FMU
on the class names because I felt it should be clear that we are coming from FMU
@@ -341,23 +398,25 @@ class Context(BaseModel): | |||
stage: enums.FmuContext | |||
|
|||
|
|||
class FMUClassMetaCase(BaseModel): | |||
class FMUCaseAttributes(BaseModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An exception about the FMU
prefix is here, because we are speaking explicitly about the fmu:
block in the data model.
Would appreciate feedback for possibly better names for this class
|
||
|
||
class FMUClassMetaData(BaseModel): | ||
class FMUAttributes(FMUCaseAttributes): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FMUAttributes
is derived from the simpler FMUCaseAttributes, where case of course corresponds to the reduced metadata included in just case metadata
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems logical
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"of course"... :)
@@ -393,27 +452,47 @@ def __get_pydantic_json_schema__( | |||
return json_schema | |||
|
|||
|
|||
class ClassMeta(BaseModel): | |||
class MetadataBase(BaseModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed this to reflect that the fields in this class are the base top-level fields in our current two metadata cases: case metadata and object metadata
class CaseMetadata(MetadataBase): | ||
"""The FMU metadata model for an FMU case.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better name for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I can think of
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "case" concept is tricky. It is highly conventional, but over the years I guess it has become so institutionalized that it is difficult to get away from. ERT however has no concept of the "case". There is the concept of "experiment", but these are not 1:1. It is also a bit chaotic with many different implementation of a corresponding variable across different FMU workflows. The word "case" is also used to describe different things. E.g. some would refer to realizations as "cases" and so on. So there is some confusion.
We could consider adding a description here of what we mean with the term "case" in this context, perhaps in a note or something. This is the definition we have included in the Sumo docs:
A case represent a set of iterations that belong together, either by being part of the same run (i.e. history matching) or by being placed together by the user, corresponding to /scratch/<asset>/<user>/<my case name>/.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated with this comment both here and on the Case
model specifically
class ObjectMetadata(MetadataBase): | ||
"""The FMU metadata model for a given data object.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better name for this?
case: FMUCase | ||
model: FMUModel | ||
case: Case | ||
model: Model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Model
may not be an improvement over FMUModel
, from the code perspective, but it matches the schema field name
1ef496c
to
95c105f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems OK with me, but I would like to have an opinion from the other reviewers
"""The name of the iteration. This is typically reflecting the folder name on | ||
scratch. In ERT, custom names for iterations are supported, e.g. "pred". For this | ||
reason, if logic is implied, the name can be risky to trust - even if it often | ||
contains the ID, e.g. "iter-0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this should be rephrased - it is actually the id
which is difficult to trust. I can run a case with 3 ensembles named "pred1", "pred2" and "pred3" and they will all be given fmu.iteration.id: 0
I believe.
Currently all logic is put on fmu.iteration.name
when consuming data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just cut it off after the second third sentence so it doesn't become stale documentation, but am happy to add additional context if you think it should be there
bb354aa
to
03c147e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I need to see the end result in ReadTheDocs. Perhaps we can just push it, and iterate from there? Or does this have other implications that just docs?
class CaseMetadata(MetadataBase): | ||
"""The FMU metadata model for an FMU case.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "case" concept is tricky. It is highly conventional, but over the years I guess it has become so institutionalized that it is difficult to get away from. ERT however has no concept of the "case". There is the concept of "experiment", but these are not 1:1. It is also a bit chaotic with many different implementation of a corresponding variable across different FMU workflows. The word "case" is also used to describe different things. E.g. some would refer to realizations as "cases" and so on. So there is some confusion.
We could consider adding a description here of what we mean with the term "case" in this context, perhaps in a note or something. This is the definition we have included in the Sumo docs:
A case represent a set of iterations that belong together, either by being part of the same run (i.e. history matching) or by being placed together by the user, corresponding to /scratch/<asset>/<user>/<my case name>/.
|
||
|
||
class FMUClassMetaData(BaseModel): | ||
class FMUAttributes(FMUCaseAttributes): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"of course"... :)
03c147e
to
81f321a
Compare
@perolavsvendsen it looks like this. This will only affect documentation. (User shows a bit weird here because that documentation has not been docstring'd yet) |
81f321a
to
5221978
Compare
Resolves #711
Works on #696
This PR suppresses the large number of warnings that were occurring when documentation was built as well as transfers some of the documentation that existed in
datamodel.rst
as docstrings.Resolves #711 because the errors emitted will slowly disappear as more docstrings are added to the the items listed in every toctree page.