Skip to content

Commit

Permalink
Syntax edits based on pytest outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishita Srivastava committed Sep 18, 2024
1 parent c87728d commit d38ac82
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion metcalcpy/agg_eclv.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def _get_bootstrapped_stats(self, series_data, thresholds):
logger.debug(f"Using circular block bootstrap with block length {block_length}.")

results = bootstrap_and_value(
logger=logger,
logger,
data,
stat_func=self._calc_stats,
num_iterations=self.params['num_iterations'],
Expand Down
4 changes: 2 additions & 2 deletions metcalcpy/agg_stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ def _get_bootstrapped_stats_for_derived(self, series, distributions, axis="1"):
try:
block_length = int(math.sqrt(len(values_both_arrays))) if 'circular_block_bootstrap' in self.params and parse_bool(self.params['circular_block_bootstrap']) else 1
results = bootstrap_and_value(
logger=logger,
logger,
values_both_arrays,
stat_func=self._calc_stats_derived,
num_iterations=self.params['num_iterations'],
Expand Down Expand Up @@ -1162,7 +1162,7 @@ def _get_bootstrapped_stats(self, series_data, axis="1"):

# Perform bootstrapping and CI calculation
results = bootstrap_and_value(
logger=logger,
logger,
data,
stat_func=self._calc_stats,
num_iterations=self.params['num_iterations'],
Expand Down
8 changes: 4 additions & 4 deletions metcalcpy/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ def do_division(distr):
if save_distributions:
logger.debug("Saving bootstrap distributions to the result.")
result.set_distributions(bootstrap_dist.flatten('F'))
except Exception as e:
logger.error(f"An error occurred during the bootstrap and calculation process: {e}", exc_info=True)
raise
except Exception as e:
logger.error(f"An error occurred during the bootstrap and calculation process: {e}", exc_info=True)
raise
return result


Expand Down Expand Up @@ -538,7 +538,7 @@ def apply_cbb(row):
counter = counter + 1
if counter == block_length:
# start a new block
counter =
counter = 0
return row

if block_length > 1:
Expand Down
4 changes: 2 additions & 2 deletions metcalcpy/calc_difficulty_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _difficulty_index(logger, sigmaij, muij, threshold, fieldijn, Aplin, sigma_o
safe_log(logger, logger.debug, f"Checking input: sigmaij shape: {sigmaij.shape}, muij shape: {muij.shape if isinstance(muij, np.ndarray) else 'scalar'}, "
f"threshold: {threshold}, fieldijn shape: {fieldijn.shape}, sigma_over_mu_ref: {sigma_over_mu_ref}, under_factor: {under_factor}")
# Check for valid input
_input_check(sigmaij, muij, threshold, fieldijn, sigma_over_mu_ref, under_factor, safe_log(logger, logger)
_input_check(sigmaij, muij, threshold, fieldijn, sigma_over_mu_ref, under_factor, logger)
safe_log(logger, logger.debug, "Input check passed successfully.")
# Variance term in range 0 to 1
safe_log(logger, logger.debug, "Calculating variance term.")
Expand Down Expand Up @@ -207,7 +207,7 @@ def forecast_difficulty(logger, sigmaij, muij, threshold, fieldijn,
safe_log(logger, logger.debug, "Default Aplin object created.")
safe_log(logger, logger.debug, "Calling _difficulty_index function.")
dij = _difficulty_index(sigmaij, muij, threshold, fieldijn,
Aplin, sigma_over_mu_ref, safe_log(logger, logger)
Aplin, sigma_over_mu_ref, logger)
safe_log(logger, logger.info, "Forecast difficulty index calculation completed.")
return dij

Expand Down
4 changes: 2 additions & 2 deletions metcalcpy/piecewise_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class PiecewiseLinear():
Xdomain is a numpy array of knot locations. Yrange is a numpy array.
"""

def __init__(self, x_domain, y_range, xunits='feet',
left=np.nan, right=np.nan, name="", logger):
def __init__(self, logger, x_domain, y_range, xunits='feet',
left=np.nan, right=np.nan, name=""):

self.logger = logger
len_x = len(x_domain)
Expand Down

0 comments on commit d38ac82

Please sign in to comment.