diff --git a/experiment/meteo_france_SCM_study/abstract_study.py b/experiment/meteo_france_SCM_study/abstract_study.py index 31e8db9e452f355147e114353665365f1958bb32..901970a80606e1b4cea7651d70ccb002c72835e8 100644 --- a/experiment/meteo_france_SCM_study/abstract_study.py +++ b/experiment/meteo_france_SCM_study/abstract_study.py @@ -82,7 +82,6 @@ class AbstractStudy(object): # Map each year to an array of size nb_massif year_to_annual_mean = OrderedDict() for year, time_serie in self._year_to_daily_time_serie_array.items(): - print(time_serie.shape) year_to_annual_mean[year] = self.annual_aggregation_function(time_serie, axis=0) return year_to_annual_mean @@ -105,8 +104,6 @@ class AbstractStudy(object): def _year_to_max_daily_time_serie(self) -> OrderedDict: return self._year_to_daily_time_serie_array - - ########## @property diff --git a/experiment/meteo_france_SCM_study/abstract_variable.py b/experiment/meteo_france_SCM_study/abstract_variable.py index 00b0a98afdad54040f00e70cb0211d7e035b25cc..7a59e49decd85e2fa9d92da8b273054f4e40a8d0 100644 --- a/experiment/meteo_france_SCM_study/abstract_variable.py +++ b/experiment/meteo_france_SCM_study/abstract_variable.py @@ -1,3 +1,4 @@ +import numpy as np class AbstractVariable(object): @@ -9,6 +10,6 @@ class AbstractVariable(object): self.altitude = altitude @property - def daily_time_serie_array(self): + def daily_time_serie_array(self) -> np.ndarray: # Return an array of size length of time series x nb_massif raise NotImplementedError \ No newline at end of file diff --git a/experiment/meteo_france_SCM_study/crocus/crocus_variables.py b/experiment/meteo_france_SCM_study/crocus/crocus_variables.py index 947cece70df2f30924d20a627ff4080f2f5df6a9..1018669998df569899de81e072f3f46be9ecdbbf 100644 --- a/experiment/meteo_france_SCM_study/crocus/crocus_variables.py +++ b/experiment/meteo_france_SCM_study/crocus/crocus_variables.py @@ -10,7 +10,7 @@ class CrocusVariable(AbstractVariable): self.variable_name = variable_name @property - def daily_time_serie_array(self): + def daily_time_serie_array(self) -> np.ndarray: time_serie_every_6_hours = np.array(self.dataset.variables[self.variable_name])[:, 0, :] if self.altitude == 2400: time_serie_daily = time_serie_every_6_hours diff --git a/experiment/meteo_france_SCM_study/safran/safran_variable.py b/experiment/meteo_france_SCM_study/safran/safran_variable.py index c07cfb7cf6de773a37cac15d1e8cfd3332e4e64f..41a24eb379c97e38838f9a9e88855f4d5b322c78 100644 --- a/experiment/meteo_france_SCM_study/safran/safran_variable.py +++ b/experiment/meteo_france_SCM_study/safran/safran_variable.py @@ -35,7 +35,7 @@ class SafranSnowfallVariable(AbstractVariable): self.daily_snowfall = [sum(hourly_snowfall[24 * i:24 * (i + 1)]) for i in range(nb_days)] @property - def daily_time_serie_array(self): + def daily_time_serie_array(self) -> np.ndarray: # Aggregate the daily snowfall by the number of consecutive days shifted_list = [self.daily_snowfall[i:] for i in range(self.nb_consecutive_days_of_snowfall)] # First element of shifted_list is of length n, Second element of length n-1, Third element n-2.... @@ -57,11 +57,12 @@ class SafranTemperatureVariable(AbstractVariable): super().__init__(dataset, altitude) # Temperature are in K, I transform them as celsius self.hourly_temperature = np.array(dataset.variables[keyword]) - 273.15 + print(self.hourly_temperature.shape) nb_days = len(self.hourly_temperature) // 24 self.daily_temperature = [np.mean(self.hourly_temperature[24 * i:24 * (i + 1)]) for i in range(nb_days)] @property def daily_time_serie_array(self): - return self.daily_temperature + return np.array(self.daily_temperature)