diff --git a/metcalcpy/agg_eclv.py b/metcalcpy/agg_eclv.py index 6624cf71..62e527aa 100644 --- a/metcalcpy/agg_eclv.py +++ b/metcalcpy/agg_eclv.py @@ -209,7 +209,7 @@ def _get_bootstrapped_stats(self, series_data, thresholds): save_data=False, block_length=block_length, eclv=True - ) + ) logger.info(f"Bootstrapped statistics calculated for threshold {thresh}.") except KeyError as err: logger.error(f"Failed to calculate bootstrapped statistics due to missing key: {err}", exc_info=True) diff --git a/metcalcpy/agg_stat.py b/metcalcpy/agg_stat.py index 02b486b2..6389d702 100644 --- a/metcalcpy/agg_stat.py +++ b/metcalcpy/agg_stat.py @@ -1075,7 +1075,8 @@ def _get_bootstrapped_stats_for_derived(self, series, distributions, axis="1"): alpha=self.params['alpha'], save_data=False, save_distributions=(derived_curve_component.derived_operation == 'DIFF_SIG'), - block_length=block_length) + block_length=block_length + ) except KeyError as err: logger.error(f"Error during bootstrapping: {err}", exc_info=True) return BootstrapResults(None, None, None) diff --git a/metcalcpy/calc_difficulty_index.py b/metcalcpy/calc_difficulty_index.py index 8c544a4b..fec19738 100644 --- a/metcalcpy/calc_difficulty_index.py +++ b/metcalcpy/calc_difficulty_index.py @@ -43,7 +43,7 @@ def safe_log(logger, log_method, message): if logger: log_method(message) -def _input_check(sigmaij, muij, threshold, fieldijn, sigma_over_mu_ref, under_factor, logger): +def _input_check(logger, sigmaij, muij, threshold, fieldijn, sigma_over_mu_ref, under_factor): """ Check for valid input to _difficulty_index. @@ -93,7 +93,7 @@ def _input_check(sigmaij, muij, threshold, fieldijn, sigma_over_mu_ref, under_fa assert 0.0 <= under_factor <= 1.0 safe_log(logger, logger.debug, "under_factor is valid and within range.") -def _difficulty_index(sigmaij, muij, threshold, fieldijn, Aplin, sigma_over_mu_ref=EPS, under_factor=0.5, logger): +def _difficulty_index(logger, sigmaij, muij, threshold, fieldijn, Aplin, sigma_over_mu_ref=EPS, under_factor=0.5): """ Calculates version 6.1 of forecast difficulty index. The threshold terms all penalize equal (or slightly unequal) spread. @@ -160,8 +160,8 @@ def _difficulty_index(sigmaij, muij, threshold, fieldijn, Aplin, sigma_over_mu_r return dij -def forecast_difficulty(sigmaij, muij, threshold, fieldijn, - Aplin, sigma_over_mu_ref=EPS, logger): +def forecast_difficulty(logger, sigmaij, muij, threshold, fieldijn, + Aplin, sigma_over_mu_ref=EPS): """ Calls private function _difficulty_index, to calculate version (v6.1) of forecast difficulty index. diff --git a/test/test_calc_difficulty_index.py b/test/test_calc_difficulty_index.py index bfd8c95f..c9df1471 100644 --- a/test/test_calc_difficulty_index.py +++ b/test/test_calc_difficulty_index.py @@ -46,12 +46,12 @@ def test_forecast_difficulty(): thresh_eps = 2.0 kwargs = {'thresh_eps': thresh_eps, 'threshold_type': 'proximity'} - assert 0.9095608641027515 == forecast_difficulty(sigmaij, muij, threshold, fieldijn, - Aplin=None, sigma_over_mu_ref=EPS, None)[0][0] - assert 0.8191620255148825 == forecast_difficulty(sigmaij, muij, threshold, fieldijn, - Aplin=None, sigma_over_mu_ref=EPS, None)[8][17] - assert 1.227707670365556 == forecast_difficulty(sigmaij, muij, threshold, fieldijn, - Aplin=None, sigma_over_mu_ref=EPS, None)[4][9] + assert 0.9095608641027515 == forecast_difficulty(None, sigmaij, muij, threshold, fieldijn, + Aplin=None, sigma_over_mu_ref=EPS)[0][0] + assert 0.8191620255148825 == forecast_difficulty(None, sigmaij, muij, threshold, fieldijn, + Aplin=None, sigma_over_mu_ref=EPS)[8][17] + assert 1.227707670365556 == forecast_difficulty(None, sigmaij, muij, threshold, fieldijn, + Aplin=None, sigma_over_mu_ref=EPS)[4][9] if __name__ == "__main__": diff --git a/test/test_scorecard.py b/test/test_scorecard.py index 5ae16702..627dc989 100644 --- a/test/test_scorecard.py +++ b/test/test_scorecard.py @@ -84,7 +84,7 @@ def settings(): 'NoahMPv3.5.1_d01']}, 'stat_flag': 'NCAR', 'sum_stat_input': f'{cwd}/data/scorecard.data', - 'sum_stat_output': f'{cwd}/data/scorecard_output.data' + 'sum_stat_output': f'{cwd}/data/scorecard_output.data', 'log_dir': f'{cwd}/logs/', 'log_filename': 'log_scorecard.txt', 'log_level': 'WARNING'