From 842420c35e9470c319e5e95431fc477d072e9559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Eide?= Date: Thu, 23 Feb 2023 09:33:11 +0100 Subject: [PATCH] Catch error if analysis fails and propagate empty dataframe --- semeio/workflows/ahm_analysis/ahmanalysis.py | 34 +++++++++++++------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/semeio/workflows/ahm_analysis/ahmanalysis.py b/semeio/workflows/ahm_analysis/ahmanalysis.py index 6e992c65..6ab7cb80 100644 --- a/semeio/workflows/ahm_analysis/ahmanalysis.py +++ b/semeio/workflows/ahm_analysis/ahmanalysis.py @@ -9,6 +9,7 @@ import numpy as np import pandas as pd import xtgeo +from ert.analysis import ErtAnalysisError from ert.shared.plugins.plugin_manager import hook_implementation from scipy.stats import ks_2samp from sklearn.decomposition import PCA @@ -168,17 +169,28 @@ def run( # Use localization to evaluate change of parameters for each observation with tempfile.TemporaryDirectory() as update_log_path: - _run_ministep( - self.facade, - obs_group, - field_parameters + scalar_parameters, - prior_name, - target_name, - update_log_path, - ) - # Get the active vs total observation info - df_update_log = make_update_log_df(update_log_path) - + try: + _run_ministep( + self.facade, + obs_group, + field_parameters + scalar_parameters, + prior_name, + target_name, + update_log_path, + ) + # Get the active vs total observation info + df_update_log = make_update_log_df(update_log_path) + except ErtAnalysisError: + df_update_log = pd.DataFrame( + columns=[ + "obs_key", + "obs_mean", + "obs_std", + "status", + "sim_mean", + "sim_std", + ] + ) # Get the updated scalar parameter distributions self.reporter.publish_csv( group_name, self.facade.load_all_gen_kw_data(target_name)