-
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
Agree and describe a generalized pattern for export from FMU with fmu-dataio #395
Comments
What is |
Doesn't exist. Second thought: I removed it. The example above show the same, so it was redundant. |
I do agree that we should not introduce very different patterns, but I feel that this needs a little more of context: E.g:
Here we have two options:
Where I do agree with @perolavsvendsen is that we should not open up for that every single new class developed for this should need to double up with all the arguments that are contained within the export method of ExportData. But I do see some challenges:
But on the inside:
or similar. Hope people get my drift.. |
Yes, there are some assumptions in my proposal that could be a bit off. The recursive use of ExportData should hopefully not be necessary, but I see your point. And could be that this is what would happen... What I worry about is the duplication of code and input arguments that would be necessary when exposing > 1 routes all the way out to end user, in addition to the intuitiveness of the package which could easily (?) be broken if we do that. But these are assumptions... Btw, ref
...this will hopefully be a good first step (not related to this discussion, directly) |
Discussion 10/4-2024 @HansKallekleiv @tnatt @jcrivenaes Current (initialize class, outside loop): from fmu.dataio import ExportData
exp = ExportData()
for x in xx:
exp.export(mydata) Alternative B - initialize class, but inside loop from fmu.dataio import ExportData
for x in xx:
exp = ExportData()
exp.export() Alternative C - export (wrapper) functions: from fmu.dataio import export_data
export_data(mydata) |
Given some time of development and usage, and given that there are different approaches to development of new things. It may be smart and useful to put together a generalized "guideline", or set of principles, for how what patterns we want to have.
The intention is to provide clear guidelines in the documentation, and that we strive to follow these pattern both in development and in implementation (in various FMU workflows). The intention is to avoid situations where fmu-dataio is used differently across all implementations.
The general pattern today looks something like this:
Need for export of
MyData
with context.Represent
MyData
as a Python objectOBJ
of typeTYPE
.pandas.DataFrame
orxtgeo.RegularSurface
, orfmu-dataio
adds context and exportOBJ
.ExportData
is initalized, and some context is provided as arguments.Context is extracted from surroundings (file paths, system information, etc)
OBJ
is passed toExportData.export()
. More context can be provided as arguments.TYPE
is known to fmu-dataio, and more context is extracted from the object itself.Example pseudo-script, Python object from other packages
Example pseudo-script, Python object defined in fmu-dataio
Main point: Pattern is the same regardless of where the data-representation class lives.
This pattern can possibly also help with creating more product-oriented data export, and possibly help with creating convenience wrappers for "well known" data in FMU.
The text was updated successfully, but these errors were encountered: