From 1a9bf7cc7bfea4fd4a97e5757545dd4ba34c0d84 Mon Sep 17 00:00:00 2001 From: David Robert Verelst <dave@dtu.dk> Date: Wed, 16 Jan 2019 16:33:20 +0100 Subject: [PATCH] prepost: raise UserWarning if power channel for AEP does not exist --- wetb/prepost/Simulations.py | 6 ++++++ wetb/prepost/dlctemplate.py | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/wetb/prepost/Simulations.py b/wetb/prepost/Simulations.py index b7aae58b..80cfd64b 100755 --- a/wetb/prepost/Simulations.py +++ b/wetb/prepost/Simulations.py @@ -4747,6 +4747,12 @@ class Cases(object): save=save, check_datatypes=True, xlsx=xlsx, complib=self.complib) + # check if the power channel actually exists first! + if ch_powe not in dfs[chan_col_name].unique(): + msg = 'The defined channel for the electrical power does not ' + msg =+ 'exist: %s' % ch_powe + raise UserWarning(msg) + # and select only the power channels dfs_powe = dfs[dfs[chan_col_name]==ch_powe] diff --git a/wetb/prepost/dlctemplate.py b/wetb/prepost/dlctemplate.py index 6602cd3d..f59a80de 100644 --- a/wetb/prepost/dlctemplate.py +++ b/wetb/prepost/dlctemplate.py @@ -462,11 +462,6 @@ def post_launch(sim_id, statistics=True, rem_failed=True, check_logs=True, ch_powe = 'DLL-2-inpvec-2' elif 'DLL-dtu_we_controller-inpvec-2' in df_stats['channel'].unique(): ch_powe = 'DLL-dtu_we_controller-inpvec-2' - else: - if ch_powe not in df_stats['channel'].unique(): - msg = 'The defined channel for the electrical power does not ' - msg =+ 'exist: %s' % ch_powe - raise UserWarning(msg) df_AEP = cc.AEP(df_stats, csv=csv, update=update, save=True, ch_powe=ch_powe) -- GitLab