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

Relaxed on requirement for parameters.txt #226

Open
alifbe opened this issue Nov 1, 2022 · 3 comments
Open

Relaxed on requirement for parameters.txt #226

alifbe opened this issue Nov 1, 2022 · 3 comments

Comments

@alifbe
Copy link

alifbe commented Nov 1, 2022

In some cases, we run prediction using restart file from other ensembles. For example in Drogon, we have a prediction run that is based on iter-3 of automatic history matching (AHM) model. For these cases, there won't be parameters.txt in the RUNPATH. FMU Ensemble will not read the data from those cases and causing crash in Webviz plugin StructuralUncertainty.

I have tried to put an empty parameters.txt and the plugin seems to work fine.

So, I am suggesting to relaxed the requirement for parameters.txt in this code

def parameters(self):
"""Build a dataframe of the information in each
realizations parameters.txt.
If no realizations have the file, an empty dataframe is returned.
Returns:
pd.DataFrame
"""
try:
return self.load_txt("parameters.txt")
except KeyError:
return pd.DataFrame()

@asnyv
Copy link
Collaborator

asnyv commented Nov 30, 2022

Sorry that you haven't gotten any response on this.

From the code you refer to, it seems like an empty dataframe is returned, and not that it crashes. That makes sense to me: no data -> blank output? the alternative is to maybe still add the realization column and nothing else.
But based on the attached code, this seems to me like a problem that likely needs to be resolved in the webviz plugin you refer to

@asnyv
Copy link
Collaborator

asnyv commented Nov 30, 2022

But: Even for restarts / prediction runs it is generally recommended to add uncertainty.

  1. It is often useful to transfer the parameters from history into prediction to see if you can get some insight into which AHM parameters that affect the predictions, considering predictions are what really matters (the history is water under the bridge)
  2. You generally have other factors that are uncertain for the predictions, e.g. minimum flow in wells and pipelines, risk factors for sand / scale issues or other things that affect productivity, capacity limitations on water handling, timing of future projects, productivity of new wells and so on.

@alifbe
Copy link
Author

alifbe commented Nov 30, 2022

Ideally, it will be great if it loads the result per realization into the data frame instead of returning empty data frame because these data are needed for the plugin.

def load_file(self, localpath, fformat, convert_numeric=False, force_reread=False):
"""Function for calling load_file() in every realization
This function may utilize multithreading.
Args:
localpath (str): path to the text file, relative to each realization
fformat (str): string identifying the file format. Supports 'txt'
and 'csv'.
convert_numeric (boolean): If set to True, numerical columns
will be searched for and have their dtype set
to integers or floats. If scalars, only numerical
data will be loaded.
force_reread (boolean): Force reread from file system. If
False, repeated calls to this function will
returned cached results.
Returns:
pd.Dataframe: with loaded data aggregated. Column 'REAL'
distuinguishes each realizations data.
"""
for index, realization in self.realizations.items():
try:
realization.load_file(localpath, fformat, convert_numeric, force_reread)
except ValueError as exc:
# This would at least occur for unsupported fileformat,
# and that we should not skip.
logger.critical("load_file() failed in realization %d", index)
raise ValueError from exc
except IOError:
# At ensemble level, we allow files to be missing in
# some realizations
logger.warning("Could not read %s for realization %d", localpath, index)
if self.get_df(localpath).empty:
raise ValueError("No ensemble data found for {}".format(localpath))
return self.get_df(localpath)

In fmu-drogon, we have created a forward model that transfer the parameters.txt from history (equinor/fmu-drogon@a7aa6d5), but I just think it will be great that we can still support the runs that are already performed (without this new forward model)

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

No branches or pull requests

2 participants