equinor / flownet

FlowNet - Data-Driven Reservoir Predictions
GNU General Public License v3.0
63 stars 29 forks source link

Added option to run multiple analytics workflows during history matching #337

Closed wouterjdb closed 3 years ago

wouterjdb commented 3 years ago

This PR adds the option to include multiple analytics workflows in the FlowNet config, like so:


ert:
  static_include_files: ./brugge_static
  realizations:
    num_realizations: 200
    required_success_percent: 80
    max_runtime: 600
  queue:
    system: LOCAL
    name: mr
    max_running: 5
  ensemble_weights: [4, 2, 1]
  analysis:
    - metric: [RMSE, MAE]
      quantity: ['WOPR:', 'WBHP:']
      start: 2000-01-01
      end: 2008-12-31
      outfile: analysis_metrics_iteration_2000_2008
    - metric: [RMSE, MAE]
      quantity: ['WOPR:', 'WBHP:']
      start: 2009-01-01
      end: 2010-01-01
      outfile: analysis_metrics_iteration_2009

This is a ❗ breaking change ❗ as you now must define the analysis workflows as list items under the analysis keyword.

A new issue was identified during this work https://github.com/equinor/flownet/issues/338.


Contributor checklist

edubarrosTNO commented 3 years ago

@wouterjdb , I did not get a request for review. But I did find a solution to allow it to work for quantity: [WOPR:BR-P-, WBHP:BR-P-] (in Brugge) (i.e., closes https://github.com/equinor/flownet/issues/338). The following code in _ahm_iteration_analytics.py worked for me locally:

        truth_data = (
            df_obs_filtered.pivot(
                index="DATE", columns="WELL_NAME", values=key.split(":")[0]
            )
            .add_prefix(key.split(":")[0] + ":")
            .fillna(0)
            .reset_index()
        )

        obs_opm = prepare_opm_reference_data(truth_data, key, nb_real)
        truth_data = truth_data.loc[:, truth_data.columns.str.startswith(key)]

        # Prepare data from ensemble of FlowNet
        ens_flownet = []
        ens_flownet.append(
            prepare_flownet_data(
                filter_dataframe(
                    df_sim[list(truth_data.columns) + ["DATE"]],
                    "DATE",
                    args.start,
                    args.end,
                ),
                key,
                nb_real,
            )
        )

Let's continue tomorrow. Hopefully we can merge this PR still in the morning