Commit c6897a12 authored by Le Roux Erwan's avatar Le Roux Erwan
Browse files

[SCM MODELS DATA] refactor abstract study file

parent 2872efd9
No related merge requests found
Showing with 205 additions and 195 deletions
+205 -195
This diff is collapsed.
......@@ -67,7 +67,7 @@ if __name__ == '__main__':
# print(study.all_massif_names)
# print(study.massif_name_to_altitudes)
# print(study.year_to_daily_time_serie_array[1958].shape)
print(study.missing_massif_name)
# print(study.missing_massif_name)
# print(len(d.variables['time']))
# print(study.year_to_annual_total)
......
......@@ -749,9 +749,16 @@ class StudyVisualizer(object):
for massif_name in self.study.study_massif_names}
return pd.DataFrame(massif_to_gev_mle, columns=self.study.study_massif_names)
@property
def df_all_daily_time_series_concatenated(self) -> pd.DataFrame:
df_list = [pd.DataFrame(time_serie, columns=self.study.study_massif_names) for time_serie in
self.study.year_to_daily_time_serie_array.values()]
df_concatenated = pd.concat(df_list)
return df_concatenated
def df_gpd_mle(self, threshold) -> pd.DataFrame:
# Fit a margin fit on each massif
massif_to_gev_mle = {massif_name: GpdMleFit(self.study.df_all_daily_time_series_concatenated[massif_name],
massif_to_gev_mle = {massif_name: GpdMleFit(self.df_all_daily_time_series_concatenated[massif_name],
threshold=threshold).gpd_params.summary_serie
for massif_name in self.study.study_massif_names}
return pd.DataFrame(massif_to_gev_mle, columns=self.study.study_massif_names)
......@@ -32,7 +32,7 @@ class TestSCMAllStudy(unittest.TestCase):
only_first_one=False, verbose=False,
altitudes=sample(set(ALL_ALTITUDES), k=nb_sample), nb_days=nb_days):
self.assertTrue('day' in study.variable_name)
first_path_file = study.ordered_years_and_path_files()[0][0]
first_path_file = study.ordered_years_and_path_files[0][0]
variable_array = study.load_variables(path_file=first_path_file)
variable_object = study.instantiate_variable_object(variable_array)
self.assertEqual((365, 263), variable_object.daily_time_serie_array.shape,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment