Skip to content

Commit

Permalink
Needed a line of code to be added
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishita Srivastava committed Sep 12, 2024
1 parent 67de179 commit c6b4931
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions metcalcpy/agg_stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def _calc_stats(self, values):
stat_values = [stat_function(values, self.column_names)]
else:
stat_values = [stat_function(values, self.column_names, True)]
logger.info("Statistics calculated successfully for single value case.")

except Exception as e:
logger.error(f"Failed to calculate statistics: {e}", exc_info=True)
raise
Expand Down Expand Up @@ -413,7 +413,7 @@ def _calc_stats_derived(self, values_both_arrays):
stat_values = [stat_values]
except Exception as e:
logger.error(f"Error calculating derived statistics: {e}", exc_info=True)
raise
raise

elif values_both_arrays is not None and values_both_arrays.ndim == 3:
# bootstrapped case
Expand Down Expand Up @@ -757,6 +757,8 @@ def _prepare_ecnt_data(self, data_for_prepare):
data_for_prepare['variance_plus_oerr'] = variance_plus_oerr * data_for_prepare['total'].values
logger.debug("Basic statistical calculations completed.")

self.column_names = data_for_prepare.columns.values

if self.statistic in self.STATISTIC_TO_FIELDS.keys():
for column in self.STATISTIC_TO_FIELDS[self.statistic]:
if column == 'me_ge_obs':
Expand All @@ -775,12 +777,15 @@ def _prepare_ecnt_data(self, data_for_prepare):
logger.warning(f"Statistic '{self.statistic}' does not have associated fields for ECNT preparation.")
logger.info("ECNT data preparation completed successfully.")


except KeyError as e:
logger.error(f"Key error during data preparation: {e}", exc_info=True)
raise
except Exception as e:
logger.error(f"Unexpected error during data preparation: {e}", exc_info=True)
raise
print(self.statistic)
print('786')

def _prepare_rps_data(self, data_for_prepare):
"""Prepares rps data.
Expand Down Expand Up @@ -1598,7 +1603,7 @@ def calculate_stats_and_ci(self):
header = False
mode = 'a'
logger.debug(f"Writing mode set to: {mode}, header: {header}")

print(out_frame)
# Write the output to a CSV file
output_file = self.params['agg_stat_output']
logger.info(f"Writing results to file: {output_file}")
Expand Down

0 comments on commit c6b4931

Please sign in to comment.