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

[SCM][HYPERCUBE] catch more exception in abstract_gev_trend_test

parent 66c65c95
No related merge requests found
Showing with 16 additions and 10 deletions
+16 -10
...@@ -37,10 +37,10 @@ def full_trends_with_quantity_altitude_hypercube(): ...@@ -37,10 +37,10 @@ def full_trends_with_quantity_altitude_hypercube():
save_to_file = True save_to_file = True
only_first_one = False only_first_one = False
fast = False fast = False
add_detailed_plots = False add_detailed_plots = True
altitudes = ALL_ALTITUDES[3:-6] altitudes = ALL_ALTITUDES[3:-6]
study_classes = SCM_STUDIES study_classes = SCM_STUDIES
for trend_test_class in [MannKendallTrendTest, GevLocationTrendTest, GevScaleTrendTest, GevShapeTrendTest][1:2]: for trend_test_class in [MannKendallTrendTest, GevLocationTrendTest, GevScaleTrendTest, GevShapeTrendTest][:]:
visualizers = [StudyVisualizer(study, temporal_non_stationarity=True, verbose=False, multiprocessing=True) visualizers = [StudyVisualizer(study, temporal_non_stationarity=True, verbose=False, multiprocessing=True)
for study in study_iterator_global(study_classes=study_classes, only_first_one=only_first_one, for study in study_iterator_global(study_classes=study_classes, only_first_one=only_first_one,
altitudes=altitudes)] altitudes=altitudes)]
...@@ -94,8 +94,8 @@ def fast_trends_with_quantity_altitude_hypercube(): ...@@ -94,8 +94,8 @@ def fast_trends_with_quantity_altitude_hypercube():
def main_run(): def main_run():
# fast_trends_with_altitude_hypercube() # fast_trends_with_altitude_hypercube()
fast_trends_with_quantity_altitude_hypercube() # fast_trends_with_quantity_altitude_hypercube()
# full_trends_with_quantity_altitude_hypercube() full_trends_with_quantity_altitude_hypercube()
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -81,7 +81,10 @@ class AbstractGevTrendTest(AbstractTrendTest): ...@@ -81,7 +81,10 @@ class AbstractGevTrendTest(AbstractTrendTest):
@property @property
def test_trend_strength(self): def test_trend_strength(self):
return self.percentage_of_change_per_year if self.crashed:
return 0.0
else:
return self.percentage_of_change_per_year
@property @property
def percentage_of_change_per_year(self): def percentage_of_change_per_year(self):
......
...@@ -21,6 +21,11 @@ class AbstractTrendTest(object): ...@@ -21,6 +21,11 @@ class AbstractTrendTest(object):
SIGNIFICANCE_LEVEL = 0.05 SIGNIFICANCE_LEVEL = 0.05
def __init__(self, years_after_change_point, maxima_after_change_point):
self.years_after_change_point = years_after_change_point
self.maxima_after_change_point = maxima_after_change_point
assert len(self.years_after_change_point) == len(self.maxima_after_change_point)
@classmethod @classmethod
def trend_type_to_style(cls): def trend_type_to_style(cls):
d = OrderedDict() d = OrderedDict()
...@@ -49,10 +54,7 @@ class AbstractTrendTest(object): ...@@ -49,10 +54,7 @@ class AbstractTrendTest(object):
else: else:
return plt.cm.binary return plt.cm.binary
def __init__(self, years_after_change_point, maxima_after_change_point):
self.years_after_change_point = years_after_change_point
self.maxima_after_change_point = maxima_after_change_point
assert len(self.years_after_change_point) == len(self.maxima_after_change_point)
@property @property
def n(self): def n(self):
......
...@@ -55,10 +55,11 @@ class WarningWhileRunningR(Warning): ...@@ -55,10 +55,11 @@ class WarningWhileRunningR(Warning):
class WarningMaximumAbsoluteValueTooHigh(Warning): class WarningMaximumAbsoluteValueTooHigh(Warning):
pass pass
class OptimizationConstants(object):
class OptimizationConstants(object):
USE_MAXIT = False USE_MAXIT = False
class SafeRunException(Exception): class SafeRunException(Exception):
pass pass
......
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