Commit 373c3560 authored by Le Roux Erwan's avatar Le Roux Erwan
Browse files

[projection snowfall] add global temperature for 2020

parent debd8caf
No related merge requests found
Showing with 32 additions and 6 deletions
+32 -6
......@@ -2,6 +2,7 @@
Source:
https://www.jpl.nasa.gov/edu/teach/activity/graphing-global-temperature-trends/
We took the csv file correspond to "Global annual mean temperature data"
"""
import pandas as pd
......@@ -11,8 +12,7 @@ from root_utils import get_full_path
relative_path = r'local/NASA_data/global_annual_mean_temp_anomalies_land-ocean_1880-2016_modified.csv'
edf_filepath = get_full_path(relative_path=relative_path)
def load_year_to_mean_global_temperature():
def load_year_to_mean_global_temperature_until_2016():
df = pd.read_csv(edf_filepath)
df = df.astype({'Year': 'float'})
d = dict(zip(df['Year'], df['Actual Temp']))
......@@ -22,3 +22,4 @@ def load_year_to_mean_global_temperature():
# d[2016 + idx] = d[2016]
return d
"""
Source:
https://www.jpl.nasa.gov/edu/teach/activity/graphing-global-temperature-trends/
We took the csv file correspond to "Global annual mean temperature data"
"""
import pandas as pd
from root_utils import get_full_path
# relative_path = r'local/NASA_data/global_annual_mean_temp_anomalies_land-ocean_1880-2016_modified.csv'
# edf_filepath = get_full_path(relative_path=relative_path)
# def load_year_to_mean_global_temperature_until_2020():
# df = pd.read_csv(edf_filepath)
# df = df.astype({'Year': 'float'})
# d = dict(zip(df['Year'], df['Actual Temp']))
# # # Cheat for the last years
# # print('Warning: using fake values for the last few years !!!')
# # for idx in range(1, 5):
# # d[2016 + idx] = d[2016]
# return d
from extreme_data.meteo_france_data.adamont_data.adamont_scenario import str_to_scenario
from extreme_data.meteo_france_data.adamont_data.cmip5.climate_explorer_cimp5 import year_to_global_mean_temp
from extreme_data.meteo_france_data.mean_alps_temperature import load_year_to_mean_alps_temperatures
from extreme_data.nasa_data.global_mean_temperature import load_year_to_mean_global_temperature
from extreme_data.nasa_data.global_mean_temperature_until_2016 import load_year_to_mean_global_temperature_until_2016
from root_utils import classproperty
from spatio_temporal_dataset.coordinates.abstract_coordinates import AbstractCoordinates
from spatio_temporal_dataset.coordinates.temporal_coordinates.abstract_temporal_covariate_for_fit import \
......@@ -35,7 +35,7 @@ class MeanGlobalTemperatureCovariate(AbstractTemperatureCovariate):
@classmethod
def load_year_to_temperature_covariate(cls):
return load_year_to_mean_global_temperature()
return load_year_to_mean_global_temperature_until_2016()
class MeanAlpsTemperatureCovariate(AbstractTemperatureCovariate):
......
import unittest
from extreme_data.meteo_france_data.mean_alps_temperature import load_year_to_mean_alps_temperatures
from extreme_data.nasa_data.global_mean_temperature import load_year_to_mean_global_temperature
from extreme_data.nasa_data.global_mean_temperature_until_2016 import load_year_to_mean_global_temperature_until_2016
class TestMeanGlobalTemperatures(unittest.TestCase):
def test_year_to_mean_global_temperature(self):
d = load_year_to_mean_global_temperature()
d = load_year_to_mean_global_temperature_until_2016()
self.assertNotIn(2019, d)
self.assertIn(2009, d)
key = list(d.keys())[0]
......
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