Add module to compare forecasted and observed storm impacts
parent
d05ded9c44
commit
36bbb8390f
@ -0,0 +1,32 @@
|
||||
"""
|
||||
Compares forecasted and observed impacts, putting them into one data frame and exporting the results.
|
||||
"""
|
||||
|
||||
import logging.config
|
||||
import os
|
||||
|
||||
import pandas as pd
|
||||
|
||||
logging.config.fileConfig('./src/logging.conf', disable_existing_loggers=False)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def compare_impacts(df_forecasted, df_observed):
|
||||
"""
|
||||
Merge forecasted and observed storm impacts
|
||||
:param df_forecasted:
|
||||
:param df_observed:
|
||||
:return:
|
||||
"""
|
||||
df_compared = df_forecasted.merge(df_observed, left_index=True, right_index=True,
|
||||
suffixes=['_forecasted', '_observed'])
|
||||
return df_compared
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logger.info('Importing existing data')
|
||||
data_folder = './data/interim'
|
||||
df_forecasted = pd.read_csv(os.path.join(data_folder, 'impacts_forecasted_mean_slope_sto06.csv'), index_col=[0])
|
||||
df_observed = pd.read_csv(os.path.join(data_folder, 'impacts_observed.csv'), index_col=[0])
|
||||
df_compared = compare_impacts(df_forecasted, df_observed)
|
||||
df_compared.to_csv(os.path.join(data_folder, 'impacts_observed_vs_forecasted_mean_slope_sto06.csv'))
|
Loading…
Reference in New Issue