Commit 598c29ab authored by Le Roux Erwan's avatar Le Roux Erwan
Browse files

[contrasting project] add test anticyclonic days

parent aaaaf1c5
No related merge requests found
Showing with 14 additions and 13 deletions
+14 -13
...@@ -46,19 +46,20 @@ class TestWeatherTypes(unittest.TestCase): ...@@ -46,19 +46,20 @@ class TestWeatherTypes(unittest.TestCase):
# wp_to_found_percentages = wp_to_found_percentages.astype(int) # wp_to_found_percentages = wp_to_found_percentages.astype(int)
self.assertEqual(wp_to_expected_percentages, wp_to_found_percentages) self.assertEqual(wp_to_expected_percentages, wp_to_found_percentages)
# def test_anticyclonique_weather_pattern(self): def test_anticyclonique_weather_pattern(self):
# study = SafranPrecipitation1Day(altitude=900, year_min=1954, year_max=2008) study = SafranPrecipitation1Day(altitude=900, year_min=1954, year_max=2008)
# p = [] no_rain = []
# for year, wps in study.year_to_wps.items(): rain = []
# daily_time_serie_array = study.year_to_daily_time_serie_array[year] for year, wps in study.year_to_wps.items():
# self.assertEqual(len(daily_time_serie_array), len(wps)) daily_time_serie_array = study.year_to_daily_time_serie_array[year]
# precipitation_on_anticlonic_days = np.max(daily_time_serie_array[np.array(wps) == 8, :], axis=1) self.assertEqual(len(daily_time_serie_array), len(wps))
# print('NB anticlonic days', len(precipitation_on_anticlonic_days)) mask = np.array(wps) == 8
# p.extend(precipitation_on_anticlonic_days) no_rain.extend(np.max(daily_time_serie_array[mask, :], axis=1))
# p = sorted(p)[::-1] rain.extend(np.max(daily_time_serie_array[~mask, :], axis=1))
# print(p[:5]) # For 90% of the anticyclonic days, the daily max precipitation (snowfall + rainfall) for a massifs is < 0.2mm
# self.assertLess(p[0], 10) # Valid that the anticyclonic days seems to well defined (but with a big variety still...)
self.assertLess(np.quantile(no_rain, 0.5), 0.2)
self.assertLess(5, np.quantile(rain, 0.5))
if __name__ == '__main__': if __name__ == '__main__':
......
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