From df914b1f70a04385eb58ae3d2956049379f85809 Mon Sep 17 00:00:00 2001 From: Gerald Scharitzer Date: Sun, 14 Nov 2021 11:16:09 +0100 Subject: [PATCH 1/3] do not ignore fair depreciation warnings --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index b9bd6ca00..b48715265 100644 --- a/tox.ini +++ b/tox.ini @@ -52,7 +52,6 @@ addopts = --strict-markers --ignore limbo --ignore tools filterwarnings = ignore:.*wmf image format is not supported.*:UserWarning ignore:.*extension is not supported and will be removed.*:UserWarning - ignore:.*will be deprecated in FaIR 2.0.*:DeprecationWarning markers = slow: mark a test as taking a long time. deep: mark a test as "whitebox" testing From 4b7f1a41f737229e2b4cb3d390fc94a7e4dd082f Mon Sep 17 00:00:00 2001 From: Gerald Scharitzer Date: Sun, 14 Nov 2021 11:44:33 +0100 Subject: [PATCH 2/3] fair>=1.6.4 --- environment.yml | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index a1a6810ec..90da51c38 100644 --- a/environment.yml +++ b/environment.yml @@ -11,6 +11,6 @@ dependencies: - pytest - pip - pip: - - fair + - fair>=1.6.4 - numpy-financial - openpyxl diff --git a/requirements.txt b/requirements.txt index 628ed90cc..695631d00 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -fair +fair>=1.6.4 numpy-financial pandas==1.2.4 openpyxl From c7d185a2627e1fdb16f570bc69a222e0ec0427de Mon Sep 17 00:00:00 2001 From: Gerald Scharitzer Date: Sun, 14 Nov 2021 16:34:07 +0100 Subject: [PATCH 3/3] renamed rcp3pd to rcp26 and rcp6 to rcp60 --- model/co2calcs.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/model/co2calcs.py b/model/co2calcs.py index dc60d61ac..8ddfa6fcb 100644 --- a/model/co2calcs.py +++ b/model/co2calcs.py @@ -11,7 +11,7 @@ from io import StringIO import fair -from fair.RCPs import rcp3pd, rcp45, rcp6, rcp85 +from fair.RCPs import rcp26, rcp45, rcp60, rcp85 import numpy as np import pandas as pd import model.advanced_controls @@ -707,7 +707,7 @@ def FaIR_CFT_baseline_RCP3(self): 3: Change in temperature since pre-industrial time in Celsius 4: RCP emissions (39 individual gases) """ - emissions = rcp3pd.Emissions.emissions + emissions = rcp26.Emissions.emissions rcpemissions = pd.DataFrame(emissions, index = range(1765,2501), columns=['Year', 'FossilCO2 (Gt-C)', 'OtherCO2 (Gt-C)', 'CH4 (Mt-CH4)', 'N2O (Mt-N2O)', 'SOx (Mt-S)', 'CO (Mt-CO)', 'NMVOC (Mt)', @@ -723,13 +723,13 @@ def FaIR_CFT_baseline_RCP3(self): rcpemissions.name = 'FaIR_CFT_baseline_emis_rcp3' (C,F,T) = fair.forward.fair_scm(emissions=emissions) - result1 = pd.DataFrame({'CO2(ppm)': C[:,0,], 'CH4(ppb)': C[:,1,], 'N2O(ppb)': C[:,2,]}, index=rcp3pd.Emissions.year) + result1 = pd.DataFrame({'CO2(ppm)': C[:,0,], 'CH4(ppb)': C[:,1,], 'N2O(ppb)': C[:,2,]}, index=rcp26.Emissions.year) result1.index.name="Year" result1.name = 'FaIR_CFT_baseline_conc_rcp3' - result2 = pd.DataFrame({'CO2(Wm-2)': F[:,0,], 'CH4(Wm-2)': F[:,1,], 'N2O(Wm-2)': F[:,2,], 'others(Wm-2)': np.sum(F, axis=1)-F[:,0,]-F[:,1,]-F[:,2,], 'total(Wm-2)': np.sum(F, axis=1)}, index=rcp3pd.Emissions.year) + result2 = pd.DataFrame({'CO2(Wm-2)': F[:,0,], 'CH4(Wm-2)': F[:,1,], 'N2O(Wm-2)': F[:,2,], 'others(Wm-2)': np.sum(F, axis=1)-F[:,0,]-F[:,1,]-F[:,2,], 'total(Wm-2)': np.sum(F, axis=1)}, index=rcp26.Emissions.year) result2.index.name="Year" result2.name = 'FaIR_CFT_baseline_forc_rcp3' - result3 = pd.DataFrame({'TempAnomaly(C)': T}, index=rcp3pd.Emissions.year) + result3 = pd.DataFrame({'TempAnomaly(C)': T}, index=rcp26.Emissions.year) result3.index.name="Year" result3.name = 'FaIR_CFT_baseline_temp_rcp3' return result1, result2, result3, rcpemissions @@ -793,7 +793,7 @@ def FaIR_CFT_baseline_RCP6(self): 3: Change in temperature since pre-industrial time in Celsius 4: RCP emissions (39 individual gases) """ - emissions = rcp6.Emissions.emissions + emissions = rcp60.Emissions.emissions rcpemissions = pd.DataFrame(emissions, index = range(1765,2501), columns=['Year', 'FossilCO2 (Gt-C)', 'OtherCO2 (Gt-C)', 'CH4 (Mt-CH4)', 'N2O (Mt-N2O)', 'SOx (Mt-S)', 'CO (Mt-CO)', 'NMVOC (Mt)', @@ -809,13 +809,13 @@ def FaIR_CFT_baseline_RCP6(self): rcpemissions.name = 'FaIR_CFT_baseline_emis_rcp6' (C,F,T) = fair.forward.fair_scm(emissions=emissions) - result1 = pd.DataFrame({'CO2(ppm)': C[:,0,], 'CH4(ppb)': C[:,1,], 'N2O(ppb)': C[:,2,]}, index=rcp6.Emissions.year) + result1 = pd.DataFrame({'CO2(ppm)': C[:,0,], 'CH4(ppb)': C[:,1,], 'N2O(ppb)': C[:,2,]}, index=rcp60.Emissions.year) result1.index.name="Year" result1.name = 'FaIR_CFT_baseline_conc_rcp6' - result2 = pd.DataFrame({'CO2(Wm-2)': F[:,0,], 'CH4(Wm-2)': F[:,1,], 'N2O(Wm-2)': F[:,2,], 'others(Wm-2)': np.sum(F, axis=1)-F[:,0,]-F[:,1,]-F[:,2,], 'total(Wm-2)': np.sum(F, axis=1)}, index=rcp6.Emissions.year) + result2 = pd.DataFrame({'CO2(Wm-2)': F[:,0,], 'CH4(Wm-2)': F[:,1,], 'N2O(Wm-2)': F[:,2,], 'others(Wm-2)': np.sum(F, axis=1)-F[:,0,]-F[:,1,]-F[:,2,], 'total(Wm-2)': np.sum(F, axis=1)}, index=rcp60.Emissions.year) result2.index.name="Year" result2.name = 'FaIR_CFT_baseline_forc_rcp6' - result3 = pd.DataFrame({'TempAnomaly(C)': T}, index=rcp6.Emissions.year) + result3 = pd.DataFrame({'TempAnomaly(C)': T}, index=rcp60.Emissions.year) result3.index.name="Year" result3.name = 'FaIR_CFT_baseline_temp_rcp6' return result1, result2, result3, rcpemissions @@ -928,7 +928,7 @@ def FaIR_CFT_Drawdown_RCP3(self): # Call on the solution emission reductions annual_reductions = self.ghg_emissions_reductions_global_annual() # Call on the RCP scenario - rcpemissions = rcp3pd.Emissions.emissions + rcpemissions = rcp26.Emissions.emissions rcpemissionsnew = pd.DataFrame(rcpemissions, index = range(1765,2501), columns=['Year','FossilCO2 (Gt-C)', 'OtherCO2 (Gt-C)', 'CH4 (Mt-CH4)', 'N2O (Mt-N2O)', 'SOx (Mt-S)', 'CO (Mt-CO)', 'NMVOC (Mt)', @@ -956,13 +956,13 @@ def FaIR_CFT_Drawdown_RCP3(self): emissionsnew = rcpemissionsnew.to_numpy() (C,F,T) = fair.forward.fair_scm(emissions=emissionsnew) - result1 = pd.DataFrame({'CO2(ppm)': C[:,0,], 'CH4(ppb)': C[:,1,], 'N2O(ppb)': C[:,2,]}, index=rcp3pd.Emissions.year) + result1 = pd.DataFrame({'CO2(ppm)': C[:,0,], 'CH4(ppb)': C[:,1,], 'N2O(ppb)': C[:,2,]}, index=rcp26.Emissions.year) result1.index.name="Year" result1.name = 'FaIR_CFT_Drawdown_conc_rcp3' - result2 = pd.DataFrame({'CO2(Wm-2)': F[:,0,], 'CH4(Wm-2)': F[:,1,], 'N2O(Wm-2)': F[:,2,], 'others(Wm-2)': np.sum(F, axis=1)-F[:,0,]-F[:,1,]-F[:,2,], 'total(Wm-2)': np.sum(F, axis=1)}, index=rcp3pd.Emissions.year) + result2 = pd.DataFrame({'CO2(Wm-2)': F[:,0,], 'CH4(Wm-2)': F[:,1,], 'N2O(Wm-2)': F[:,2,], 'others(Wm-2)': np.sum(F, axis=1)-F[:,0,]-F[:,1,]-F[:,2,], 'total(Wm-2)': np.sum(F, axis=1)}, index=rcp26.Emissions.year) result2.index.name="Year" result2.name = 'FaIR_CFT_Drawdown_forc_rcp3' - result3 = pd.DataFrame({'TempAnomaly(C)': T}, index=rcp3pd.Emissions.year) + result3 = pd.DataFrame({'TempAnomaly(C)': T}, index=rcp26.Emissions.year) result3.index.name="Year" result3.name = 'FaIR_CFT_Drawdown_temp_rcp3' return result1, result2, result3, rcpemissionsnew @@ -1044,7 +1044,7 @@ def FaIR_CFT_Drawdown_RCP6(self): # Call on the solution emission reductions annual_reductions = self.ghg_emissions_reductions_global_annual() # Call on the RCP scenario - rcpemissions = rcp6.Emissions.emissions + rcpemissions = rcp60.Emissions.emissions rcpemissionsnew = pd.DataFrame(rcpemissions, index = range(1765,2501), columns=['Year','FossilCO2 (Gt-C)', 'OtherCO2 (Gt-C)', 'CH4 (Mt-CH4)', 'N2O (Mt-N2O)', 'SOx (Mt-S)', 'CO (Mt-CO)', 'NMVOC (Mt)', @@ -1072,13 +1072,13 @@ def FaIR_CFT_Drawdown_RCP6(self): emissionsnew = rcpemissionsnew.to_numpy() (C,F,T) = fair.forward.fair_scm(emissions=emissionsnew) - result1 = pd.DataFrame({'CO2(ppm)': C[:,0,], 'CH4(ppb)': C[:,1,], 'N2O(ppb)': C[:,2,]}, index=rcp6.Emissions.year) + result1 = pd.DataFrame({'CO2(ppm)': C[:,0,], 'CH4(ppb)': C[:,1,], 'N2O(ppb)': C[:,2,]}, index=rcp60.Emissions.year) result1.index.name="Year" result1.name = 'FaIR_CFT_Drawdown_conc_rcp6' - result2 = pd.DataFrame({'CO2(Wm-2)': F[:,0,], 'CH4(Wm-2)': F[:,1,], 'N2O(Wm-2)': F[:,2,], 'others(Wm-2)': np.sum(F, axis=1)-F[:,0,]-F[:,1,]-F[:,2,], 'total(Wm-2)': np.sum(F, axis=1)}, index=rcp6.Emissions.year) + result2 = pd.DataFrame({'CO2(Wm-2)': F[:,0,], 'CH4(Wm-2)': F[:,1,], 'N2O(Wm-2)': F[:,2,], 'others(Wm-2)': np.sum(F, axis=1)-F[:,0,]-F[:,1,]-F[:,2,], 'total(Wm-2)': np.sum(F, axis=1)}, index=rcp60.Emissions.year) result2.index.name="Year" result2.name = 'FaIR_CFT_Drawdown_forc_rcp6' - result3 = pd.DataFrame({'TempAnomaly(C)': T}, index=rcp6.Emissions.year) + result3 = pd.DataFrame({'TempAnomaly(C)': T}, index=rcp60.Emissions.year) result3.index.name="Year" result3.name = 'FaIR_CFT_Drawdown_temp_rcp6' return result1, result2, result3, rcpemissionsnew