def test_adoption_is_single_source(): s = 'Greenpeace AER' ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source=s) ad = adoptiondata.AdoptionData(ac=ac, data_sources=g_data_sources, adconfig=g_adconfig) assert ad.adoption_is_single_source() == True s = 'ALL SOURCES' ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source=s) ad = adoptiondata.AdoptionData(ac=ac, data_sources=g_data_sources, adconfig=g_adconfig) assert ad.adoption_is_single_source() == False s = 'Ambitious Cases' ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source=s) ad = adoptiondata.AdoptionData(ac=ac, data_sources=g_data_sources, adconfig=g_adconfig) assert ad.adoption_is_single_source() == False s = 'No such name' ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source=s) ad = adoptiondata.AdoptionData(ac=ac, data_sources=g_data_sources, adconfig=g_adconfig) with pytest.raises(ValueError): _ = ad.adoption_is_single_source()
def test_regional_data_sources(): data_sources = { 'Baseline Cases': { '10': str(datadir.joinpath('ad_region_constant10.csv')), '20': str(datadir.joinpath('ad_region_constant20.csv')), }, 'Region: OECD90': { 'Baseline Cases': { '10': str(datadir.joinpath('ad_region_constant10.csv')), }, }, } ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source='ALL SOURCES', soln_pds_adoption_prognostication_growth='Medium') ad = adoptiondata.AdoptionData(ac=ac, data_sources=data_sources, adconfig=g_adconfig) result = ad.adoption_trend_per_region() assert result.loc[2019, 'World'] == pytest.approx(15.0) assert result.loc[2019, 'OECD90'] == pytest.approx(10.0) assert result.loc[2019, 'Latin America'] == pytest.approx(15.0) ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source='Baseline Cases', soln_pds_adoption_prognostication_growth='Medium') ad = adoptiondata.AdoptionData(ac=ac, data_sources=data_sources, adconfig=g_adconfig) result = ad.adoption_trend_per_region() assert result.loc[2019, 'World'] == pytest.approx(15.0) assert result.loc[2019, 'OECD90'] == pytest.approx(10.0)
def test_adoption_low_med_high_with_zero(): data_sources = { 'Baseline Cases': { 'zero': str(datadir.joinpath('ad_all_zero.csv')), 'one': str(datadir.joinpath('ad_all_one.csv')), }, 'Conservative Cases': {}, 'Ambitious Cases': {}, '100% RES2050 Case': {}, } ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source='ALL SOURCES', soln_pds_adoption_prognostication_growth='Medium') ad = adoptiondata.AdoptionData(ac=ac, data_sources=data_sources, adconfig=g_adconfig) result = ad.adoption_low_med_high(region='World') # Zero should be dropped for the mean, to match Excel behavior. assert all(result.loc[:, 'Medium'] == 1.0) # With a single source, zero should not be dropped. ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source='zero', soln_pds_adoption_prognostication_growth='Medium') ad = adoptiondata.AdoptionData(ac=ac, data_sources=data_sources, adconfig=g_adconfig) result = ad.adoption_low_med_high(region='World') expected = pd.read_csv(str(datadir.joinpath('ad_all_zero.csv')), index_col=0) pd.testing.assert_series_equal(result.loc[:, 'Medium'], expected.loc[:, 'World'], check_names=False, check_exact=True)
def test_adoption_trend_global(): s = 'Greenpeace AER' ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source=s, soln_pds_adoption_prognostication_growth='Medium') ad = adoptiondata.AdoptionData(ac=ac, data_sources=g_data_sources, adconfig=g_adconfig) result = ad.adoption_trend(region='World', trend='Linear') expected = pd.DataFrame(linear_trend_global_list[1:], columns=linear_trend_global_list[0], dtype=np.float64).set_index('Year') expected.index = expected.index.astype(int) expected.index.name = 'Year' pd.testing.assert_frame_equal(result, expected, check_exact=False) result = ad.adoption_trend(region='World', trend='Degree2') expected = pd.DataFrame(poly_degree2_trend_global_list[1:], columns=poly_degree2_trend_global_list[0], dtype=np.float64).set_index('Year') expected.index = expected.index.astype(int) expected.index.name = 'Year' pd.testing.assert_frame_equal(result, expected, check_exact=False) result = ad.adoption_trend(region='World', trend='Degree3') expected = pd.DataFrame(poly_degree3_trend_global_list[1:], columns=poly_degree3_trend_global_list[0], dtype=np.float64).set_index('Year') expected.index = expected.index.astype(int) expected.index.name = 'Year' pd.testing.assert_frame_equal(result, expected, check_exact=False) result = ad.adoption_trend(region='World', trend='Exponential') expected = pd.DataFrame(exponential_trend_global_list[1:], columns=exponential_trend_global_list[0], dtype=np.float64).set_index('Year') expected.index = expected.index.astype(int) expected.index.name = 'Year' pd.testing.assert_frame_equal(result, expected, check_exact=False) adconfig_mod = g_adconfig.copy() adconfig_mod.loc['trend', 'World'] = 'Exponential' ad = adoptiondata.AdoptionData(ac=ac, data_sources=g_data_sources, adconfig=adconfig_mod) result = ad.adoption_trend(region='World') expected = pd.DataFrame(exponential_trend_global_list[1:], columns=exponential_trend_global_list[0], dtype=np.float64).set_index('Year') expected.index = expected.index.astype(int) expected.index.name = 'Year' pd.testing.assert_frame_equal(result, expected, check_exact=False)
def test_CSP_World(): # ConcentratedSolar World exposed a corner case, test it specifically. data_sources = { 'Ambitious Cases': { 'source1': str(datadir.joinpath('ad_CSP_World_source1.csv')), 'source2': str(datadir.joinpath('ad_CSP_World_source2.csv')), 'source3': str(datadir.joinpath('ad_CSP_World_source3.csv')), 'source4': str(datadir.joinpath('ad_CSP_World_source4.csv')), 'source5': str(datadir.joinpath('ad_CSP_World_source5.csv')), 'source6': str(datadir.joinpath('ad_CSP_World_source6.csv')), }, 'Conservative Cases': {}, 'Baseline Cases': {}, '100% RES2050 Case': {}, } ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source='Ambitious Cases', soln_pds_adoption_prognostication_growth='Low') ad = adoptiondata.AdoptionData(ac=ac, data_sources=data_sources, adconfig=g_adconfig) result = ad.adoption_trend(region='World') assert result.loc[2014, 'adoption'] == pytest.approx(34.94818207) assert result.loc[2015, 'adoption'] == pytest.approx(24.85041545) assert result.loc[2016, 'adoption'] == pytest.approx(17.78567283) assert result.loc[2060, 'adoption'] == pytest.approx(4079.461034)
def test_adoption_data_per_region_source_None(): ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source=None) ad = adoptiondata.AdoptionData(ac=ac, data_sources=g_data_sources, adconfig=g_adconfig) assert all(ad.adoption_data_per_region().isna())
def test_adoption_data(): ad = adoptiondata.AdoptionData(ac=None, data_sources=g_data_sources, adconfig=None) a = ad.adoption_data(region='World') assert a['4DS'][2035] == pytest.approx(898.010968835815) assert a['Greenpeace R'][2027] == pytest.approx(327.712635691309) a = ad.adoption_data(region='OECD90') assert a['Greenpeace AER'][2040] == pytest.approx(58) a = ad.adoption_data(region='Eastern Europe') assert a['Greenpeace AER'][2050] == pytest.approx(117) a = ad.adoption_data(region='Asia (Sans Japan)') assert a['Greenpeace AER'][2014] == pytest.approx(15) a = ad.adoption_data(region='Middle East and Africa') assert a['Greenpeace AER'][2017] == pytest.approx(42) a = ad.adoption_data(region='Latin America') assert a['Greenpeace AER'][2057] == pytest.approx(506) a = ad.adoption_data(region='China') assert a['Greenpeace AER'][2036] == pytest.approx(325) a = ad.adoption_data(region='India') assert a['Greenpeace AER'][2022] == pytest.approx(187) a = ad.adoption_data(region='EU') assert a['Greenpeace AER'][2031] == pytest.approx(380) a = ad.adoption_data(region='USA') assert a['Greenpeace AER'][2053] == pytest.approx(966)
def test_name_to_ident(): ad = adoptiondata.AdoptionData(ac=None, data_sources=g_data_sources, adconfig=None) assert ad._name_to_identifier( "Middle East and Africa") == "middle_east_and_africa" assert ad._name_to_identifier("Asia (Sans Japan)") == "asia_sans_japan" assert ad._name_to_identifier("USA") == "usa"
def test_adoption_min_max_sd(): s = 'Greenpeace AER' ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source=s) ad = adoptiondata.AdoptionData(ac=ac, data_sources=g_data_sources, adconfig=g_adconfig) result = ad.adoption_min_max_sd(region='World') expected = pd.DataFrame(adoption_min_max_sd_global_list[1:], columns=adoption_min_max_sd_global_list[0], dtype=np.float64).set_index('Year') expected.index = expected.index.astype(int) expected.index.name = 'Year' pd.testing.assert_frame_equal(result, expected, check_exact=False)
def test_adoption_low_med_high_global_all_sources(): ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source='ALL SOURCES') ad = adoptiondata.AdoptionData(ac=ac, data_sources=g_data_sources, adconfig=g_adconfig) result = ad.adoption_low_med_high(region='World') expected = pd.DataFrame( adoption_low_med_high_global_all_sources_list[1:], columns=adoption_low_med_high_global_all_sources_list[0], dtype=np.float64).set_index('Year') expected.index = expected.index.astype(int) expected.index.name = 'Year' pd.testing.assert_frame_equal(result, expected, check_exact=False)
def test_adoption_trend_per_region(): ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source='ALL SOURCES', soln_pds_adoption_prognostication_growth='Medium') ad = adoptiondata.AdoptionData(ac=ac, data_sources=g_data_sources, adconfig=g_adconfig) result = ad.adoption_trend_per_region() for region in result.columns: # the first year is overwritten by the 'Medium' result from low_med_high. first_year = result.first_valid_index() pd.testing.assert_series_equal( result.loc[first_year + 1:, region], ad.adoption_trend(region=region).loc[first_year + 1:, 'adoption'], check_names=False)
def test_adoption_data_per_region(): data_sources = { 'Baseline Cases': { 'george': str(datadir.joinpath('ad_all_regions.csv')), }, 'Conservative Cases': {}, 'Ambitious Cases': {}, '100% RES2050 Case': {}, } ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source='george', soln_pds_adoption_prognostication_growth='Medium') ad = adoptiondata.AdoptionData(ac=ac, data_sources=data_sources, adconfig=g_adconfig) result = ad.adoption_data_per_region() assert result.loc[2030, 'EU'] == pytest.approx(437.0) assert result.loc[2046, 'Eastern Europe'] == pytest.approx(175.0)
def test_adoption_min_max_source_None(): adconfig_mod = g_adconfig.copy() adconfig_mod.loc['trend', :] = None adconfig_mod.loc['growth', :] = None ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source=None) ad = adoptiondata.AdoptionData(ac=ac, data_sources=g_data_sources, adconfig=g_adconfig) assert all(ad.adoption_min_max_sd(region='World').loc[:, 'S.D'].isna()) # Regional min_max_sd always uses ALL SOURCES, so it won't be NaN even if # soln_pds_adoption_prognostication_source=None assert not all(ad.adoption_min_max_sd(region='China').loc[:, 'S.D'].isna()) assert all(ad.adoption_low_med_high(region='World').isna()) assert all(ad.adoption_low_med_high(region='Latin America').isna()) # check that adoption_trend_* doesn't die if adconfig[trend, :] = None _ = ad.adoption_trend(region='World') _ = ad.adoption_trend(region='India')
def test_adoption_data_per_region_no_data(): # Verify that if there is no data, the returned DF contains N/A not filled with 0.0. data_sources = { 'Baseline Cases': { 's1': str(datadir.joinpath('ad_all_regions_no_data.csv')), }, 'Conservative Cases': {}, 'Ambitious Cases': {}, '100% RES2050 Case': {}, } ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source='s1', soln_pds_adoption_prognostication_growth='Medium') ad = adoptiondata.AdoptionData(ac=ac, data_sources=data_sources, adconfig=g_adconfig) result = ad.adoption_data_per_region() for region in result.columns: assert result.loc[:, region].count() == 0
def test_adoption_low_med_high_with_zero(): data_sources = { 'Baseline Cases': { 'zero': str(datadir.joinpath('ad_all_zero.csv')), 'one': str(datadir.joinpath('ad_all_one.csv')), }, 'Conservative Cases': {}, 'Ambitious Cases': {}, '100% RES2050 Case': {}, } ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source='ALL SOURCES', soln_pds_adoption_prognostication_growth='Medium') ad = adoptiondata.AdoptionData(ac=ac, data_sources=data_sources, adconfig=g_adconfig) result = ad.adoption_low_med_high(region='World') # Zero should be dropped for the mean, to match Excel. assert all(result.loc[:, 'Medium'] == 1.0)
def test_adoption_trend_region_growth_not_match_pds(): """Test case where region growth differs from soln_pds_adoption_prognostication_growth.""" data_sources = { 'Baseline Cases': { 'source1': str(datadir.joinpath('ad_CSP_LA_source1.csv')), 'source2': str(datadir.joinpath('ad_CSP_LA_source2.csv')), 'source3': str(datadir.joinpath('ad_CSP_LA_source3.csv')), 'source4': str(datadir.joinpath('ad_CSP_LA_source4.csv')), }, 'Conservative Cases': {}, 'Ambitious Cases': {}, '100% RES2050 Case': {}, } ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source='Baseline Cases', soln_pds_adoption_prognostication_growth='High') ad = adoptiondata.AdoptionData(ac=ac, data_sources=data_sources, adconfig=g_adconfig) result = ad.adoption_trend(region='Latin America') assert result.loc[2037, 'adoption'] == pytest.approx(13.14383564892)
def test_adoption_data_per_region_missing_data(): # regional data with NaN for 2012-2013 data_sources = { 'Baseline Cases': { 's1': str(datadir.joinpath('ad_missing_region_data_s1.csv')), 's2': str(datadir.joinpath('ad_missing_region_data_s2.csv')), 's3': str(datadir.joinpath('ad_missing_region_data_s3.csv')), }, 'Conservative Cases': {}, 'Ambitious Cases': {}, '100% RES2050 Case': {}, } ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source='ALL SOURCES', soln_pds_adoption_prognostication_growth='Medium') ad = adoptiondata.AdoptionData(ac=ac, data_sources=data_sources, adconfig=g_adconfig) result = ad.adoption_trend_per_region() # Expected values from LandfillMethane Middle East (renamed OECD90 here) expected = pd.DataFrame([ 0.04274361694, 0.10439941173, 0.16201388582, 0.21580091091, 0.26597435870, 0.31274810090, 0.35633600920, 0.39695195531, 0.43480981094, 0.47012344779, 0.50310673755, 0.53397355194, 0.56293776265, 0.59021324139, 0.61601385986, 0.64055348976, 0.66404600281, 0.68670527069, 0.70874516512, 0.73037955779, 0.75182232041, 0.77328732468, 0.79498844231, 0.81713954500, 0.83995450444, 0.86364719235, 0.88843148043, 0.91452124038, 0.94213034390, 0.97147266269, 1.00276206847, 1.03621243292, 1.07203762776, 1.11045152469, 1.15166799540, 1.19590091161, 1.24336414502, 1.29427156733, 1.34883705023, 1.40727446545, 1.46979768467, 1.53662057960, 1.60795702194, 1.68402088340, 1.76502603569, 1.85118635049, 1.94271569952 ], index=list(range(2014, 2061)), columns=['OECD90']) pd.testing.assert_frame_equal(result[['OECD90']].loc[2015:], expected.loc[2015:], check_exact=False, check_names=False)
def test_adoption_with_regional_data(): data_sources = { 'Baseline Cases': { 'B1': str(datadir.joinpath('ad_all_regions.csv')), }, 'Conservative Cases': {}, 'Ambitious Cases': {}, '100% RES2050 Case': {}, } ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source='ALL SOURCES', soln_pds_adoption_prognostication_growth='Medium') ad = adoptiondata.AdoptionData(ac=ac, data_sources=data_sources, adconfig=g_adconfig, main_includes_regional=True) result = ad.adoption_min_max_sd(region='World') # There is only one source, without regional data SD will be 0.0. assert result.loc[2030, 'S.D'] == pytest.approx(351.49999999) result = ad.adoption_low_med_high(region='World') # Without regional data, the result is 29.0. assert result.loc[2040, 'Medium'] == pytest.approx(594.5)
def test_CSP_LA(): # ConcentratedSolar Latin America exposed a corner case, test it specifically. data_sources = { 'Baseline Cases': { 'source1': str(datadir.joinpath('ad_CSP_LA_source1.csv')), 'source2': str(datadir.joinpath('ad_CSP_LA_source2.csv')), 'source3': str(datadir.joinpath('ad_CSP_LA_source3.csv')), 'source4': str(datadir.joinpath('ad_CSP_LA_source4.csv')), }, 'Conservative Cases': {}, 'Ambitious Cases': {}, '100% RES2050 Case': {}, } ac = advanced_controls.AdvancedControls( soln_pds_adoption_prognostication_source='Baseline Cases', soln_pds_adoption_prognostication_growth='Medium') ad = adoptiondata.AdoptionData(ac=ac, data_sources=data_sources, adconfig=g_adconfig) result = ad.adoption_trend(region='Latin America') assert result.loc[2014, 'adoption'] == pytest.approx(-3.39541250661) assert result.loc[2037, 'adoption'] == pytest.approx(13.14383564892) assert result.loc[2060, 'adoption'] == pytest.approx(295.34923165295)
def __init__(self, scenario=None): if scenario is None: scenario = list(scenarios.keys())[0] self.scenario = scenario self.ac = scenarios[scenario] # TAM tamconfig_list = [ [ 'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA' ], [ 'source_until_2014', self.ac.source_until_2014, self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES' ], [ 'source_after_2014', self.ac.ref_source_post_2014, self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES' ], [ 'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly' ], [ 'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium' ], [ 'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], [ 'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ] tamconfig = pd.DataFrame(tamconfig_list[1:], columns=tamconfig_list[0], dtype=np.object).set_index('param') tam_ref_data_sources = { 'Baseline Cases': { 'Based on: CES ITU AMPERE Baseline': THISDIR.joinpath('tam', 'tam_based_on_CES_ITU_AMPERE_Baseline.csv'), 'Based on: CES ITU AMPERE 550': THISDIR.joinpath('tam', 'tam_based_on_CES_ITU_AMPERE_550.csv'), 'Based on: CES ITU AMPERE 450': THISDIR.joinpath('tam', 'tam_based_on_CES_ITU_AMPERE_450.csv'), }, } self.tm = tam.TAM(tamconfig=tamconfig, tam_ref_data_sources=tam_ref_data_sources, tam_pds_data_sources=tam_ref_data_sources) ref_tam_per_region = self.tm.ref_tam_per_region() pds_tam_per_region = self.tm.pds_tam_per_region() adconfig_list = [ [ 'param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA' ], [ 'trend', self.ac.soln_pds_adoption_prognostication_trend, '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly' ], [ 'growth', self.ac.soln_pds_adoption_prognostication_growth, 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium' ], ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] ] adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0], dtype=np.object).set_index('param') ad_data_sources = {} self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources, adconfig=adconfig) # Custom PDS Data ca_pds_data_sources = [ { 'name': 'Aggressive, Low', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_Low.csv') }, { 'name': 'Conservative, Low', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Conservative_Low.csv') }, { 'name': 'Aggressive, high', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_high.csv') }, { 'name': 'Aggressive, high, early', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_high_early.csv') }, { 'name': 'Drawdown Book Ed.1 Scenario 1', 'include': False, 'filename': THISDIR.joinpath( 'ca_pds_data', 'custom_pds_ad_Drawdown_Book_Ed_1_Scenario_1.csv') }, { 'name': 'Drawdown Book Ed.1 Scenario 2', 'include': False, 'filename': THISDIR.joinpath( 'ca_pds_data', 'custom_pds_ad_Drawdown_Book_Ed_1_Scenario_2.csv') }, { 'name': 'Drawdown Book Ed.1 Scenario 3', 'include': False, 'filename': THISDIR.joinpath( 'ca_pds_data', 'custom_pds_ad_Drawdown_Book_Ed_1_Scenario_3.csv') }, ] self.pds_ca = customadoption.CustomAdoption( data_sources=ca_pds_data_sources, soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name, high_sd_mult=1.0, low_sd_mult=1.0, total_adoption_limit=pds_tam_per_region) ref_adoption_data_per_region = None if False: # One may wonder why this is here. This file was code generated. # This 'if False' allows subsequent conditions to all be elif. pass elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS': pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region( ) pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region( ) pds_adoption_is_single_source = None elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications': pds_adoption_data_per_region = self.ad.adoption_data_per_region() pds_adoption_trend_per_region = self.ad.adoption_trend_per_region() pds_adoption_is_single_source = self.ad.adoption_is_single_source() ht_ref_adoption_initial = pd.Series( [3.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7, 2.5], index=dd.REGIONS) ht_ref_adoption_final = ref_tam_per_region.loc[2050] * ( ht_ref_adoption_initial / ref_tam_per_region.loc[2014]) ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0) ht_pds_adoption_initial = ht_ref_adoption_initial ht_regions, ht_percentages = zip( *self.ac.pds_adoption_final_percentage) ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages), index=list(ht_regions)) ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[ 2050] ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0) self.ht = helpertables.HelperTables( ac=self.ac, ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints, pds_adoption_data_per_region=pds_adoption_data_per_region, ref_adoption_limits=ref_tam_per_region, pds_adoption_limits=pds_tam_per_region, pds_adoption_trend_per_region=pds_adoption_trend_per_region, pds_adoption_is_single_source=pds_adoption_is_single_source) self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac) self.ua = unitadoption.UnitAdoption( ac=self.ac, ref_total_adoption_units=ref_tam_per_region, pds_total_adoption_units=pds_tam_per_region, soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(), soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(), bug_cfunits_double_count=True) soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd() soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd() conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits() soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted( ) self.fc = firstcost.FirstCost( ac=self.ac, pds_learning_increase_mult=2, ref_learning_increase_mult=2, conv_learning_increase_mult=2, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_tot_iunits=conv_ref_tot_iunits, soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), fc_convert_iunit_factor=1000000.0) self.oc = operatingcost.OperatingCost( ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(), soln_pds_annual_world_first_cost=self.fc. soln_pds_annual_world_first_cost(), soln_ref_annual_world_first_cost=self.fc. soln_ref_annual_world_first_cost(), conv_ref_annual_world_first_cost=self.fc. conv_ref_annual_world_first_cost(), single_iunit_purchase_year=2017, soln_pds_install_cost_per_iunit=self.fc. soln_pds_install_cost_per_iunit(), conv_ref_install_cost_per_iunit=self.fc. conv_ref_install_cost_per_iunit(), conversion_factor=1.0) self.c4 = ch4calcs.CH4Calcs( ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted) self.c2 = co2calcs.CO2Calcs( ac=self.ac, ch4_ppb_calculator=self.c4.ch4_ppb_calculator(), soln_pds_net_grid_electricity_units_saved=self.ua. soln_pds_net_grid_electricity_units_saved(), soln_pds_net_grid_electricity_units_used=self.ua. soln_pds_net_grid_electricity_units_used(), soln_pds_direct_co2_emissions_saved=self.ua. soln_pds_direct_co2_emissions_saved(), soln_pds_direct_ch4_co2_emissions_saved=self.ua. soln_pds_direct_ch4_co2_emissions_saved(), soln_pds_direct_n2o_co2_emissions_saved=self.ua. soln_pds_direct_n2o_co2_emissions_saved(), soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(), conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(), soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, fuel_in_liters=False) self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014, 'World'], soln_avg_annual_use=self.ac.soln_avg_annual_use, conv_avg_annual_use=self.ac.conv_avg_annual_use)
def __init__(self, scenario=None): if scenario is None: scenario = list(scenarios.keys())[0] self.scenario = scenario self.ac = scenarios[scenario] # TAM tamconfig_list = [ [ 'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA' ], [ 'source_until_2014', self.ac.source_until_2014, self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES' ], [ 'source_after_2014', self.ac.ref_source_post_2014, self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES' ], [ 'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly' ], [ 'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium' ], [ 'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], [ 'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ] tamconfig = pd.DataFrame(tamconfig_list[1:], columns=tamconfig_list[0], dtype=np.object).set_index('param') self.tm = tam.TAM( tamconfig=tamconfig, tam_ref_data_sources=rrs.energy_tam_1_ref_data_sources, tam_pds_data_sources=rrs.energy_tam_1_pds_data_sources) ref_tam_per_region = self.tm.ref_tam_per_region() pds_tam_per_region = self.tm.pds_tam_per_region() adconfig_list = [ [ 'param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA' ], [ 'trend', self.ac.soln_pds_adoption_prognostication_trend, '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly' ], [ 'growth', self.ac.soln_pds_adoption_prognostication_growth, 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium' ], ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] ] adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0], dtype=np.object).set_index('param') ad_data_sources = { 'Baseline Cases': { 'Based on: AMPERE 2014 IMAGE TIMER Reference': THISDIR.joinpath( 'ad', 'ad_based_on_AMPERE_2014_IMAGE_TIMER_Reference.csv'), 'Based on: AMPERE 2014 MESSAGE MACRO Reference': THISDIR.joinpath( 'ad', 'ad_based_on_AMPERE_2014_MESSAGE_MACRO_Reference.csv'), 'Based on: AMPERE 2014 GEM E3 Reference': THISDIR.joinpath( 'ad', 'ad_based_on_AMPERE_2014_GEM_E3_Reference.csv'), 'Based on: IEA ETP 2016 6DS': THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2016_6DS.csv'), }, 'Conservative Cases': { 'Based on: AMPERE 2014 IMAGE TIMER 550': THISDIR.joinpath( 'ad', 'ad_based_on_AMPERE_2014_IMAGE_TIMER_550.csv'), 'Based on: AMPERE 2014 MESSAGE MACRO 550': THISDIR.joinpath( 'ad', 'ad_based_on_AMPERE_2014_MESSAGE_MACRO_550.csv'), 'Based on: AMPERE 2014 GEM E3 550': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_GEM_E3_550.csv'), 'Based on: IEA ETP 2016 4DS': THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2016_4DS.csv'), 'Based on: Greenpeace Reference (2015)': THISDIR.joinpath('ad', 'ad_based_on_Greenpeace_Reference_2015.csv'), }, 'Ambitious Cases': { 'Based on: AMPERE 2014 IMAGE TIMER 450': THISDIR.joinpath( 'ad', 'ad_based_on_AMPERE_2014_IMAGE_TIMER_450.csv'), 'Based on: AMPERE 2014 MESSAGE MACRO 450': THISDIR.joinpath( 'ad', 'ad_based_on_AMPERE_2014_MESSAGE_MACRO_450.csv'), 'Based on: AMPERE 2014 GEM E3 450': THISDIR.joinpath('ad', 'ad_based_on_AMPERE_2014_GEM_E3_450.csv'), 'Based on: IEA ETP 2016 2DS': THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2016_2DS.csv'), 'Based on: Greenpeace 2015 Energy Revolution': THISDIR.joinpath( 'ad', 'ad_based_on_Greenpeace_2015_Energy_Revolution.csv'), }, '100% RES2050 Case': { 'Based on: Greenpeace 2015 Advanced Revolution': THISDIR.joinpath( 'ad', 'ad_based_on_Greenpeace_2015_Advanced_Revolution.csv'), }, } self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources, adconfig=adconfig) ref_adoption_data_per_region = None if False: # One may wonder why this is here. This file was code generated. # This 'if False' allows subsequent conditions to all be elif. pass elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications': pds_adoption_data_per_region = self.ad.adoption_data_per_region() pds_adoption_trend_per_region = self.ad.adoption_trend_per_region() pds_adoption_is_single_source = self.ad.adoption_is_single_source() ht_ref_adoption_initial = pd.Series([ 75.43696666666665, 50.234754444444434, 0.22261666666666663, 14.113495555555552, 1.0549222222222219, 9.81238111111111, 10.027777777777775, 1.8406988888888887, 37.01894555555555, 8.790349999999998 ], index=dd.REGIONS) ht_ref_adoption_final = ref_tam_per_region.loc[2050] * ( ht_ref_adoption_initial / ref_tam_per_region.loc[2014]) ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0) ht_pds_adoption_initial = ht_ref_adoption_initial ht_regions, ht_percentages = zip( *self.ac.pds_adoption_final_percentage) ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages), index=list(ht_regions)) ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[ 2050] ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0) self.ht = helpertables.HelperTables( ac=self.ac, ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints, pds_adoption_data_per_region=pds_adoption_data_per_region, ref_adoption_limits=ref_tam_per_region, pds_adoption_limits=pds_tam_per_region, pds_adoption_trend_per_region=pds_adoption_trend_per_region, pds_adoption_is_single_source=pds_adoption_is_single_source) self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac) self.ua = unitadoption.UnitAdoption( ac=self.ac, ref_total_adoption_units=ref_tam_per_region, pds_total_adoption_units=pds_tam_per_region, soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(), soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(), bug_cfunits_double_count=True) soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd() soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd() conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits() soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted( ) self.fc = firstcost.FirstCost( ac=self.ac, pds_learning_increase_mult=2, ref_learning_increase_mult=2, conv_learning_increase_mult=2, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_tot_iunits=conv_ref_tot_iunits, soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), fc_convert_iunit_factor=rrs.TERAWATT_TO_KILOWATT) self.oc = operatingcost.OperatingCost( ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(), soln_pds_annual_world_first_cost=self.fc. soln_pds_annual_world_first_cost(), soln_ref_annual_world_first_cost=self.fc. soln_ref_annual_world_first_cost(), conv_ref_annual_world_first_cost=self.fc. conv_ref_annual_world_first_cost(), single_iunit_purchase_year=2017, soln_pds_install_cost_per_iunit=self.fc. soln_pds_install_cost_per_iunit(), conv_ref_install_cost_per_iunit=self.fc. conv_ref_install_cost_per_iunit(), conversion_factor=rrs.TERAWATT_TO_KILOWATT) self.c4 = ch4calcs.CH4Calcs( ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted) self.c2 = co2calcs.CO2Calcs( ac=self.ac, ch4_ppb_calculator=self.c4.ch4_ppb_calculator(), soln_pds_net_grid_electricity_units_saved=self.ua. soln_pds_net_grid_electricity_units_saved(), soln_pds_net_grid_electricity_units_used=self.ua. soln_pds_net_grid_electricity_units_used(), soln_pds_direct_co2_emissions_saved=self.ua. soln_pds_direct_co2_emissions_saved(), soln_pds_direct_ch4_co2_emissions_saved=self.ua. soln_pds_direct_ch4_co2_emissions_saved(), soln_pds_direct_n2o_co2_emissions_saved=self.ua. soln_pds_direct_n2o_co2_emissions_saved(), soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(), conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(), soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, fuel_in_liters=False) self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014, 'World'], soln_avg_annual_use=self.ac.soln_avg_annual_use, conv_avg_annual_use=self.ac.conv_avg_annual_use)
def __init__(self, scenario=None): if scenario is None: scenario = list(scenarios.keys())[0] self.scenario = scenario self.ac = scenarios[scenario] # TAM tamconfig_list = [ ['param', 'World', 'PDS World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'], ['source_until_2014', self.ac.source_until_2014, self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'], ['source_after_2014', self.ac.ref_source_post_2014, self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'], ['trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'], ['growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'], ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]] tamconfig = pd.DataFrame(tamconfig_list[1:], columns=tamconfig_list[0], dtype=np.object).set_index('param') tam_ref_data_sources = { 'Baseline Cases': { 'Custom (See TAM Factoring) based on http://www.gbpn.org/databases-tools/mrv-tool/methodology.': THISDIR.joinpath('tam', 'tam_Custom_See_TAM_Factoring_based_on_httpwww_gbpn_orgdatabasestoolsmrvtoolmethodology_.csv'), 'Based on GBPN - BEST PRACTICE POLICIES FOR LOW CARBON & ENERGY BUILDINGS BASED ON SCENARIO ANALYSIS May 2012': THISDIR.joinpath('tam', 'tam_based_on_GBPN_BEST_PRACTICE_POLICIES_FOR_LOW_CARBON_ENERGY_BUILDINGS_BASED_ON_SCENARIO_A_c7e92439.csv'), 'IEA (2013)': THISDIR.joinpath('tam', 'tam_IEA_2013.csv'), }, 'Conservative Cases': { 'McKinsey': THISDIR.joinpath('tam', 'tam_McKinsey.csv'), 'Navigant (2014)': THISDIR.joinpath('tam', 'tam_Navigant_2014.csv'), }, } self.tm = tam.TAM(tamconfig=tamconfig, tam_ref_data_sources=tam_ref_data_sources, tam_pds_data_sources=tam_ref_data_sources) ref_tam_per_region=self.tm.ref_tam_per_region() pds_tam_per_region=self.tm.pds_tam_per_region() adconfig_list = [ ['param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'], ['trend', self.ac.soln_pds_adoption_prognostication_trend, '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'], ['growth', self.ac.soln_pds_adoption_prognostication_growth, 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'], ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]] adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0], dtype=np.object).set_index('param') ad_data_sources = { } self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources, adconfig=adconfig) sconfig_list = [['region', 'base_year', 'last_year'], ['World', 2014, 2050], ['OECD90', 2014, 2050], ['Eastern Europe', 2014, 2050], ['Asia (Sans Japan)', 2014, 2050], ['Middle East and Africa', 2014, 2050], ['Latin America', 2014, 2050], ['China', 2014, 2050], ['India', 2014, 2050], ['EU', 2014, 2050], ['USA', 2014, 2050]] sconfig = pd.DataFrame(sconfig_list[1:], columns=sconfig_list[0], dtype=np.object).set_index('region') sconfig['pds_tam_2050'] = pds_tam_per_region.loc[[2050]].T sc_regions, sc_percentages = zip(*self.ac.pds_base_adoption) sconfig['base_adoption'] = pd.Series(list(sc_percentages), index=list(sc_regions)) sconfig['base_percent'] = sconfig['base_adoption'] / pds_tam_per_region.loc[2014] sc_regions, sc_percentages = zip(*self.ac.pds_adoption_final_percentage) sconfig['last_percent'] = pd.Series(list(sc_percentages), index=list(sc_regions)) if self.ac.pds_adoption_s_curve_innovation is not None: sc_regions, sc_percentages = zip(*self.ac.pds_adoption_s_curve_innovation) sconfig['innovation'] = pd.Series(list(sc_percentages), index=list(sc_regions)) if self.ac.pds_adoption_s_curve_imitation is not None: sc_regions, sc_percentages = zip(*self.ac.pds_adoption_s_curve_imitation) sconfig['imitation'] = pd.Series(list(sc_percentages), index=list(sc_regions)) self.sc = s_curve.SCurve(transition_period=16, sconfig=sconfig) ref_adoption_data_per_region = None if False: # One may wonder why this is here. This file was code generated. # This 'if False' allows subsequent conditions to all be elif. pass elif self.ac.soln_pds_adoption_basis == 'Logistic S-Curve': pds_adoption_data_per_region = None pds_adoption_trend_per_region = self.sc.logistic_adoption() pds_adoption_is_single_source = None elif self.ac.soln_pds_adoption_basis == 'Bass Diffusion S-Curve': pds_adoption_data_per_region = None pds_adoption_trend_per_region = self.sc.bass_diffusion_adoption() pds_adoption_is_single_source = None elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications': pds_adoption_data_per_region = self.ad.adoption_data_per_region() pds_adoption_trend_per_region = self.ad.adoption_trend_per_region() pds_adoption_is_single_source = self.ad.adoption_is_single_source() ht_ref_adoption_initial = pd.Series( [165284837.0, 153214036.0, 2001574.0, 10001070.0, 1759.0, 66398.0, 10000000.0, 1070.0, 129000000.0, 21532448.0], index=dd.REGIONS) ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (ht_ref_adoption_initial / ref_tam_per_region.loc[2014]) ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0) ht_pds_adoption_initial = ht_ref_adoption_initial ht_regions, ht_percentages = zip(*self.ac.pds_adoption_final_percentage) ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages), index=list(ht_regions)) ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[2050] ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0) self.ht = helpertables.HelperTables(ac=self.ac, ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints, pds_adoption_data_per_region=pds_adoption_data_per_region, ref_adoption_limits=ref_tam_per_region, pds_adoption_limits=pds_tam_per_region, pds_adoption_trend_per_region=pds_adoption_trend_per_region, pds_adoption_is_single_source=pds_adoption_is_single_source) self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac) self.ua = unitadoption.UnitAdoption(ac=self.ac, ref_total_adoption_units=ref_tam_per_region, pds_total_adoption_units=pds_tam_per_region, soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(), soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(), bug_cfunits_double_count=True) soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd() soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd() conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits() soln_net_annual_funits_adopted=self.ua.soln_net_annual_funits_adopted() self.fc = firstcost.FirstCost(ac=self.ac, pds_learning_increase_mult=2, ref_learning_increase_mult=2, conv_learning_increase_mult=2, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_tot_iunits=conv_ref_tot_iunits, soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), fc_convert_iunit_factor=1.0) self.oc = operatingcost.OperatingCost(ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(), soln_pds_annual_world_first_cost=self.fc.soln_pds_annual_world_first_cost(), soln_ref_annual_world_first_cost=self.fc.soln_ref_annual_world_first_cost(), conv_ref_annual_world_first_cost=self.fc.conv_ref_annual_world_first_cost(), single_iunit_purchase_year=2017, soln_pds_install_cost_per_iunit=self.fc.soln_pds_install_cost_per_iunit(), conv_ref_install_cost_per_iunit=self.fc.conv_ref_install_cost_per_iunit(), conversion_factor=1.0) self.c4 = ch4calcs.CH4Calcs(ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted) self.c2 = co2calcs.CO2Calcs(ac=self.ac, ch4_ppb_calculator=self.c4.ch4_ppb_calculator(), soln_pds_net_grid_electricity_units_saved=self.ua.soln_pds_net_grid_electricity_units_saved(), soln_pds_net_grid_electricity_units_used=self.ua.soln_pds_net_grid_electricity_units_used(), soln_pds_direct_co2_emissions_saved=self.ua.soln_pds_direct_co2_emissions_saved(), soln_pds_direct_ch4_co2_emissions_saved=self.ua.soln_pds_direct_ch4_co2_emissions_saved(), soln_pds_direct_n2o_co2_emissions_saved=self.ua.soln_pds_direct_n2o_co2_emissions_saved(), soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(), conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(), soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, fuel_in_liters=False) self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014, 'World'], soln_avg_annual_use=self.ac.soln_avg_annual_use, conv_avg_annual_use=self.ac.conv_avg_annual_use)
def __init__(self, scenario=None): if scenario is None: scenario = list(scenarios.keys())[0] self.scenario = scenario self.ac = scenarios[scenario] # TAM tamconfig_list = [ ['param', 'World', 'PDS World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'], ['source_until_2014', self.ac.source_until_2014, self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'], ['source_after_2014', self.ac.ref_source_post_2014, self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'], ['trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'], ['growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'], ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]] tamconfig = pd.DataFrame(tamconfig_list[1:], columns=tamconfig_list[0], dtype=np.object).set_index('param') tam_ref_data_sources = { 'Baseline Cases': { 'Custom calculated from (GBPN, Urge-Vorsatz Factored by IEA Building Data)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_UrgeVorsatz_Factored_by_IEA_Building_Data.csv'), 'IEA 6DS (2016), Residential & Commercial Water Heating': THISDIR.joinpath('tam', 'tam_IEA_6DS_2016_Residential_Commercial_Water_Heating.csv'), 'GBPN Energy for water heating, Urban & Rural / All buildings, All Vintages, Frozen efficiency (Water Heating Thermal energy use in TWHth)': THISDIR.joinpath('tam', 'tam_GBPN_Energy_for_water_heating_Urban_Rural_All_buildings_All_Vintages_Frozen_efficiency_W_e86b69eb.csv'), }, 'Conservative Cases': { 'Custom calculated from (GBPN and Urge-Vorsatz)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_and_UrgeVorsatz.csv'), 'IEA 4DS (2016), Residential & Commercial Water Heating': THISDIR.joinpath('tam', 'tam_IEA_4DS_2016_Residential_Commercial_Water_Heating.csv'), }, 'Region: OECD90': { 'Baseline Cases': { 'Custom calculated from (GBPN, Urge-Vorsatz Factored by IEA Building Data)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_UrgeVorsatz_Factored_by_IEA_Building_Data.csv'), 'Custom calculated from (GBPN and Urge-Vorsatz)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_and_UrgeVorsatz.csv'), 'GBPN Energy for water heating, Urban & Rural / All buildings, All Vintages, Frozen efficiency (Water Heating Thermal energy use in TWHth)': THISDIR.joinpath('tam', 'tam_GBPN_Energy_for_water_heating_Urban_Rural_All_buildings_All_Vintages_Frozen_efficiency_W_e86b69eb.csv'), }, }, 'Region: Eastern Europe': { 'Baseline Cases': { 'Custom calculated from (GBPN, Urge-Vorsatz Factored by IEA Building Data)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_UrgeVorsatz_Factored_by_IEA_Building_Data.csv'), 'Custom calculated from (GBPN and Urge-Vorsatz)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_and_UrgeVorsatz.csv'), 'GBPN Energy for water heating, Urban & Rural / All buildings, All Vintages, Frozen efficiency (Water Heating Thermal energy use in TWHth)': THISDIR.joinpath('tam', 'tam_GBPN_Energy_for_water_heating_Urban_Rural_All_buildings_All_Vintages_Frozen_efficiency_W_e86b69eb.csv'), }, }, 'Region: Asia (Sans Japan)': { 'Baseline Cases': { 'Custom calculated from (GBPN, Urge-Vorsatz Factored by IEA Building Data)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_UrgeVorsatz_Factored_by_IEA_Building_Data.csv'), 'Custom calculated from (GBPN and Urge-Vorsatz)': THISDIR.joinpath('tam', 'tam_Custom_calculated_from_GBPN_and_UrgeVorsatz.csv'), 'GBPN Energy for water heating, Urban & Rural / All buildings, All Vintages, Frozen efficiency (Water Heating Thermal energy use in TWHth)': THISDIR.joinpath('tam', 'tam_GBPN_Energy_for_water_heating_Urban_Rural_All_buildings_All_Vintages_Frozen_efficiency_W_e86b69eb.csv'), }, }, } tam_pds_data_sources = { 'Baseline Cases': { 'Drawdown TAM: PDS1 - post-Low-Flow': THISDIR.joinpath('tam', 'tam_pds_Drawdown_TAM_PDS1_postLowFlow.csv'), }, 'Conservative Cases': { 'Drawdown TAM: PDS2 - post-Low-Flow': THISDIR.joinpath('tam', 'tam_pds_Drawdown_TAM_PDS2_postLowFlow.csv'), }, 'Ambitious Cases': { 'Drawdown TAM: PDS3 - post-Low-Flow': THISDIR.joinpath('tam', 'tam_pds_Drawdown_TAM_PDS3_postLowFlow.csv'), }, } self.tm = tam.TAM(tamconfig=tamconfig, tam_ref_data_sources=tam_ref_data_sources, tam_pds_data_sources=tam_pds_data_sources) ref_tam_per_region=self.tm.ref_tam_per_region() pds_tam_per_region=self.tm.pds_tam_per_region() adconfig_list = [ ['param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'], ['trend', self.ac.soln_pds_adoption_prognostication_trend, '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'], ['growth', self.ac.soln_pds_adoption_prognostication_growth, 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'], ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]] adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0], dtype=np.object).set_index('param') ad_data_sources = { 'Conservative Cases': { 'IEA (2012) Technology Roadmap Solar Heating and Cooling - Cons': THISDIR.joinpath('ad', 'ad_IEA_2012_Technology_Roadmap_Solar_Heating_and_Cooling_Cons.csv'), }, 'Ambitious Cases': { 'Solar Heat Worldwide http://www.iea-shc.org/solar-heat-worldwide': THISDIR.joinpath('ad', 'ad_Solar_Heat_Worldwide_httpwww_ieashc_orgsolarheatworldwide.csv'), }, } self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources, adconfig=adconfig) # Custom PDS Data ca_pds_data_sources = [ {'name': 'Conservative, based on IEA 2012', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Conservative_based_on_IEA_2012.csv')}, {'name': 'Aggressive, High Growth, early', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_High_Growth_early.csv')}, {'name': 'Aggressive, High Growth, based on IEA', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_High_Growth_based_on_IEA.csv')}, {'name': 'Aggressive, High Growth, late', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_High_Growth_late.csv')}, {'name': 'Aggressive, V. High Growth, late', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_V__High_Growth_late.csv')}, {'name': 'Aggressive, V. High Growth', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Aggressive_V__High_Growth.csv')}, {'name': 'Conservative Growth, late', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Conservative_Growth_late.csv')}, {'name': 'Conservative Growth, early', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Conservative_Growth_early.csv')}, {'name': 'Low Growth', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Low_Growth.csv')}, ] self.pds_ca = customadoption.CustomAdoption(data_sources=ca_pds_data_sources, soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name, high_sd_mult=1.0, low_sd_mult=1.0, total_adoption_limit=pds_tam_per_region) ref_adoption_data_per_region = None if False: # One may wonder why this is here. This file was code generated. # This 'if False' allows subsequent conditions to all be elif. pass elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS': pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region() pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region() pds_adoption_is_single_source = None elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications': pds_adoption_data_per_region = self.ad.adoption_data_per_region() pds_adoption_trend_per_region = self.ad.adoption_trend_per_region() pds_adoption_is_single_source = self.ad.adoption_is_single_source() ht_ref_adoption_initial = pd.Series( [335.463, 56.493, 2.374, 240.305, 9.948, 9.113, 231.838, 6.4350000000000005, 23.777, 17.233], index=dd.REGIONS) ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (ht_ref_adoption_initial / ref_tam_per_region.loc[2014]) ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0) ht_pds_adoption_initial = ht_ref_adoption_initial ht_regions, ht_percentages = zip(*self.ac.pds_adoption_final_percentage) ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages), index=list(ht_regions)) ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[2050] ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0) self.ht = helpertables.HelperTables(ac=self.ac, ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints, pds_adoption_data_per_region=pds_adoption_data_per_region, ref_adoption_limits=ref_tam_per_region, pds_adoption_limits=pds_tam_per_region, pds_adoption_trend_per_region=pds_adoption_trend_per_region, pds_adoption_is_single_source=pds_adoption_is_single_source) self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac) self.ua = unitadoption.UnitAdoption(ac=self.ac, ref_total_adoption_units=ref_tam_per_region, pds_total_adoption_units=pds_tam_per_region, soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(), soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(), repeated_cost_for_iunits=False, bug_cfunits_double_count=False) soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd() soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd() conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits() soln_net_annual_funits_adopted=self.ua.soln_net_annual_funits_adopted() self.fc = firstcost.FirstCost(ac=self.ac, pds_learning_increase_mult=2, ref_learning_increase_mult=2, conv_learning_increase_mult=2, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_tot_iunits=conv_ref_tot_iunits, soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), fc_convert_iunit_factor=1000000000.0) self.oc = operatingcost.OperatingCost(ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(), soln_pds_annual_world_first_cost=self.fc.soln_pds_annual_world_first_cost(), soln_ref_annual_world_first_cost=self.fc.soln_ref_annual_world_first_cost(), conv_ref_annual_world_first_cost=self.fc.conv_ref_annual_world_first_cost(), single_iunit_purchase_year=2017, soln_pds_install_cost_per_iunit=self.fc.soln_pds_install_cost_per_iunit(), conv_ref_install_cost_per_iunit=self.fc.conv_ref_install_cost_per_iunit(), conversion_factor=1000000000.0) self.c4 = ch4calcs.CH4Calcs(ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted) self.c2 = co2calcs.CO2Calcs(ac=self.ac, ch4_ppb_calculator=self.c4.ch4_ppb_calculator(), soln_pds_net_grid_electricity_units_saved=self.ua.soln_pds_net_grid_electricity_units_saved(), soln_pds_net_grid_electricity_units_used=self.ua.soln_pds_net_grid_electricity_units_used(), soln_pds_direct_co2_emissions_saved=self.ua.soln_pds_direct_co2_emissions_saved(), soln_pds_direct_ch4_co2_emissions_saved=self.ua.soln_pds_direct_ch4_co2_emissions_saved(), soln_pds_direct_n2o_co2_emissions_saved=self.ua.soln_pds_direct_n2o_co2_emissions_saved(), soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(), conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(), soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, fuel_in_liters=False) self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014, 'World'], soln_avg_annual_use=self.ac.soln_avg_annual_use, conv_avg_annual_use=self.ac.conv_avg_annual_use)
def __init__(self, scenario=None): if scenario is None: scenario = list(scenarios.keys())[0] self.scenario = scenario self.ac = scenarios[scenario] # TAM tamconfig_list = [ [ 'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA' ], [ 'source_until_2014', self.ac.source_until_2014, self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES' ], [ 'source_after_2014', self.ac.ref_source_post_2014, self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES' ], [ 'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly' ], [ 'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium' ], [ 'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], [ 'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ] tamconfig = pd.DataFrame(tamconfig_list[1:], columns=tamconfig_list[0], dtype=np.object).set_index('param') self.tm = tam.TAM( tamconfig=tamconfig, tam_ref_data_sources=rrs.energy_tam_2_ref_data_sources, tam_pds_data_sources=rrs.energy_tam_2_pds_data_sources) ref_tam_per_region = self.tm.ref_tam_per_region() pds_tam_per_region = self.tm.pds_tam_per_region() adconfig_list = [ [ 'param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA' ], [ 'trend', self.ac.soln_pds_adoption_prognostication_trend, '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly' ], [ 'growth', self.ac.soln_pds_adoption_prognostication_growth, 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium' ], ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] ] adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0], dtype=np.object).set_index('param') ad_data_sources = { 'Baseline Cases': { 'Based on IEA, WEO-2018, Current Policies Scenario (CPS)': THISDIR.joinpath( 'ad', 'ad_based_on_IEA_WEO2018_Current_Policies_Scenario_CPS.csv' ), 'Based on: IEA ETP 2017 Ref Tech': THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2017_Ref_Tech.csv'), 'Based on IEEJ Outlook - 2019, Ref Scenario': THISDIR.joinpath( 'ad', 'ad_based_on_IEEJ_Outlook_2019_Ref_Scenario.csv'), 'Based on IRENA (2018), Roadmap-2050, Reference Case': THISDIR.joinpath( 'ad', 'ad_based_on_IRENA_2018_Roadmap2050_Reference_Case.csv'), }, 'Conservative Cases': { 'Based on IEA, WEO-2018, New Policies Scenario (NPS)': THISDIR.joinpath( 'ad', 'ad_based_on_IEA_WEO2018_New_Policies_Scenario_NPS.csv'), 'Based on IEEJ Outlook - 2019, Advanced Tech Scenario': THISDIR.joinpath( 'ad', 'ad_based_on_IEEJ_Outlook_2019_Advanced_Tech_Scenario.csv' ), }, 'Ambitious Cases': { 'Based on IEA, WEO-2018, SDS Scenario': THISDIR.joinpath('ad', 'ad_based_on_IEA_WEO2018_SDS_Scenario.csv'), 'Based on: IEA ETP 2017 B2DS': THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2017_B2DS.csv'), 'Based on Grantham Institute and Carbon Tracker (2017) Strong PV Scenario': THISDIR.joinpath( 'ad', 'ad_based_on_Grantham_Institute_and_Carbon_Tracker_2017_Strong_PV_Scenario.csv' ), 'Based on IRENA. 2018) Roadmap-2050, REmap Case': THISDIR.joinpath( 'ad', 'ad_based_on_IRENA__2018_Roadmap2050_REmap_Case.csv'), 'Based on: IEA ETP 2017 2DS': THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2017_2DS.csv'), }, '100% RES2050 Case': { 'Based on average of: LUT/EWG 2019 100% RES, Ecofys 2018 1.5C and Greenpeace 2015 Advanced Revolution': THISDIR.joinpath( 'ad', 'ad_based_on_average_of_LUTEWG_2019_100_RES_Ecofys_2018_1_5C_and_Greenpeace_2015_Advanced_Revolution.csv' ), }, } self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources, adconfig=adconfig) ref_adoption_data_per_region = None if False: # One may wonder why this is here. This file was code generated. # This 'if False' allows subsequent conditions to all be elif. pass elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications': pds_adoption_data_per_region = self.ad.adoption_data_per_region() pds_adoption_trend_per_region = self.ad.adoption_trend_per_region() pds_adoption_is_single_source = self.ad.adoption_is_single_source() ht_ref_adoption_initial = pd.Series(list( self.ac.ref_base_adoption.values()), index=dd.REGIONS) ht_ref_adoption_final = ref_tam_per_region.loc[2050] * ( ht_ref_adoption_initial / ref_tam_per_region.loc[2014]) ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_ref_datapoints.loc[2018] = ht_ref_adoption_initial ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0) ht_pds_adoption_initial = ht_ref_adoption_initial ht_regions, ht_percentages = zip( *self.ac.pds_adoption_final_percentage) ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages), index=list(ht_regions)) ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[ 2050] ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0) self.ht = helpertables.HelperTables( ac=self.ac, ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints, pds_adoption_data_per_region=pds_adoption_data_per_region, ref_adoption_limits=ref_tam_per_region, pds_adoption_limits=pds_tam_per_region, use_first_pds_datapoint_main=False, adoption_base_year=2018, copy_pds_to_ref=True, pds_adoption_trend_per_region=pds_adoption_trend_per_region, pds_adoption_is_single_source=pds_adoption_is_single_source) self.ef = emissionsfactors.ElectricityGenOnGrid( ac=self.ac, grid_emissions_version=2) self.ua = unitadoption.UnitAdoption( ac=self.ac, ref_total_adoption_units=ref_tam_per_region, pds_total_adoption_units=pds_tam_per_region, soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(), soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(), bug_cfunits_double_count=False) soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd() soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd() conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits() soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted( ) self.fc = firstcost.FirstCost( ac=self.ac, pds_learning_increase_mult=2, ref_learning_increase_mult=2, conv_learning_increase_mult=2, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_tot_iunits=conv_ref_tot_iunits, soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), fc_convert_iunit_factor=rrs.TERAWATT_TO_KILOWATT) self.oc = operatingcost.OperatingCost( ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(), soln_pds_annual_world_first_cost=self.fc. soln_pds_annual_world_first_cost(), soln_ref_annual_world_first_cost=self.fc. soln_ref_annual_world_first_cost(), conv_ref_annual_world_first_cost=self.fc. conv_ref_annual_world_first_cost(), single_iunit_purchase_year=2017, soln_pds_install_cost_per_iunit=self.fc. soln_pds_install_cost_per_iunit(), conv_ref_install_cost_per_iunit=self.fc. conv_ref_install_cost_per_iunit(), conversion_factor=rrs.TERAWATT_TO_KILOWATT) self.c4 = ch4calcs.CH4Calcs( ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted) self.c2 = co2calcs.CO2Calcs( ac=self.ac, ch4_ppb_calculator=self.c4.ch4_ppb_calculator(), soln_pds_net_grid_electricity_units_saved=self.ua. soln_pds_net_grid_electricity_units_saved(), soln_pds_net_grid_electricity_units_used=self.ua. soln_pds_net_grid_electricity_units_used(), soln_pds_direct_co2_emissions_saved=self.ua. soln_pds_direct_co2_emissions_saved(), soln_pds_direct_ch4_co2_emissions_saved=self.ua. soln_pds_direct_ch4_co2_emissions_saved(), soln_pds_direct_n2o_co2_emissions_saved=self.ua. soln_pds_direct_n2o_co2_emissions_saved(), soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(), conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(), soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, fuel_in_liters=False) self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014, 'World'], soln_avg_annual_use=self.ac.soln_avg_annual_use, conv_avg_annual_use=self.ac.conv_avg_annual_use)
def __init__(self, scenario=None): if scenario is None: scenario = list(scenarios.keys())[0] self.scenario = scenario self.ac = scenarios[scenario] # TLA self.ae = aez.AEZ(solution_name=self.name, cohort=2020, regimes=dd.THERMAL_MOISTURE_REGIMES8) if self.ac.use_custom_tla: self.c_tla = tla.CustomTLA( filename=THISDIR.joinpath('custom_tla_data.csv')) custom_world_vals = self.c_tla.get_world_values() else: custom_world_vals = None self.tla_per_region = tla.tla_per_region( self.ae.get_land_distribution(), custom_world_values=custom_world_vals) adconfig_list = [ [ 'param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA' ], [ 'trend', self.ac.soln_pds_adoption_prognostication_trend, 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium' ], [ 'growth', self.ac.soln_pds_adoption_prognostication_growth, 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE' ], ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] ] adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0], dtype=np.object).set_index('param') ad_data_sources = { 'Raw Data for ALL LAND TYPES': { 'FAO 2010': THISDIR.joinpath('ad', 'ad_FAO_2010.csv'), }, } self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources, main_includes_regional=True, adconfig=adconfig) # Custom PDS Data ca_pds_columns = ['Year'] + dd.REGIONS adoption_2014 = self.ac.ref_base_adoption['World'] tla_2050 = self.tla_per_region.loc[2050, 'World'] ds4_percent_adoption_2050 = 0.85 ds4_adoption_2050 = ds4_percent_adoption_2050 * tla_2050 ca_pds_data_sources = [ { 'name': 'Low growth, linear trend', 'include': True, 'datapoints_degree': 1, # This scenario projects the future adoption of bamboo based on historical regional # growth reported for the 1990-2010 period in the Global Forest Resource Assessment # 2010 report, published by the FAO. 'datapoints': pd.DataFrame([ [ 1990, np.nan, 0.0, 0.0, 15.412, 3.688, 10.399, 0.0, 0.0, 0.0, 0.0 ], [ 2000, np.nan, 0.0, 0.0, 16.311, 3.656, 10.399, 0.0, 0.0, 0.0, 0.0 ], [ 2005, np.nan, 0.0, 0.0, 16.943, 3.640, 10.399, 0.0, 0.0, 0.0, 0.0 ], [ 2010, np.nan, 0.0, 0.0, 17.360, 3.627, 10.399, 0.0, 0.0, 0.0, 0.0 ], ], columns=ca_pds_columns).set_index('Year') }, { 'name': 'Medium growth, linear trend', 'include': True, # This scenario projects the future adoption of bamboo based on the highest # historical regional annual growth rate, based on 1990-2010 FAO data. The highest # annual growth rate was reported in the Asia region (0.0974 Mha/year). Thus, it # was assumed that bamboo plantation in other regions will grow by half of the # growth rate calculated in Asia (0.05 Mha/year), while bamboo plantation in Asia # continues to grow with the same rate. 'filename': THISDIR.joinpath( 'ca_pds_data', 'custom_pds_ad_Medium_growth_linear_trend.csv') }, { 'name': 'High growth, linear trend', 'include': True, # This scenario projects the future adoption of bamboo based on the highest # historical regional annual growth rate, based on 1990-2010 FAO data. The highest # annual growth rate was reported in the Asia region. Thus, it was assumed that # bamboo plantation in other regions will grow at the same growth rate calculated # in Asia (0.0974 Mha/year), while bamboo plantation in Asia continues to grow at # double this rate (0.19 Mha/year). 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_High_growth_linear_trend.csv') }, { 'name': 'Max growth, linear trend', 'include': True, # Considering the limited total land available for bamboo, this scenario # projects an aggressive adoption of bamboo plantation and projects a worldwide # 85% adoption of bamboo plantation by 2050. 'datapoints': pd.DataFrame([ [ 2014, adoption_2014, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], [ 2050, ds4_adoption_2050, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], ], columns=ca_pds_columns).set_index('Year') }, { 'name': 'Song et al. 2013', 'include': True, # "Annual increase in global bamboo forests based on a global historical annual # expansion of bamboo forests of 3%, as reported in Song et al. 2013 (see p.7 # of publication). 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Song_et_al__2013.csv') }, ] self.pds_ca = customadoption.CustomAdoption( data_sources=ca_pds_data_sources, soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name, high_sd_mult=1.0, low_sd_mult=1.0, total_adoption_limit=self.tla_per_region) # Manual adjustment made in spreadsheet for Drawdown 2020. for s in self.pds_ca.scenarios.values(): df = s['df'] df.loc[2014] = [ 32.8913636108367000, 0.0, 0.0, 18.0440250214314000, 3.9611495064729000, 10.8861890829324000, 0.0, 0.0, 0.0, 0.0 ] df.loc[2015] = [ 33.0453659423780000, 0.0, 0.0, 18.1703910504150000, 3.9772571687142000, 10.8977177232488000, 0.0, 0.0, 0.0, 0.0 ] df.loc[2016] = [ 33.2014226143695000, 0.0, 0.0, 18.2979284861039000, 3.9938159101118100, 10.9096782181539000, 0.0, 0.0, 0.0, 0.0 ] df.loc[2017] = [ 33.3595689913150000, 0.0, 0.0, 18.4266654288099000, 4.0108468526825300, 10.9220567098226000, 0.0, 0.0, 0.0, 0.0 ] df.loc[2018] = [ 33.5198404377181000, 0.0, 0.0, 18.5566299788448000, 4.0283711184431500, 10.9348393404302000, 0.0, 0.0, 0.0, 0.0 ] # Custom REF Data ca_ref_data_sources = [ { 'name': '[Type Scenario 1 Name Here (REF CASE)...]', 'include': True, 'filename': THISDIR.joinpath( 'ca_ref_data', 'custom_ref_ad_Type_Scenario_1_Name_Here_REF_CASE_.csv') }, ] self.ref_ca = customadoption.CustomAdoption( data_sources=ca_ref_data_sources, soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name, high_sd_mult=1.0, low_sd_mult=1.0, total_adoption_limit=self.tla_per_region) if self.ac.soln_ref_adoption_basis == 'Custom': ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region( ) else: ref_adoption_data_per_region = None if False: # One may wonder why this is here. This file was code generated. # This 'if False' allows subsequent conditions to all be elif. pass elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS': pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region( ) pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region( ) pds_adoption_is_single_source = None elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications': pds_adoption_data_per_region = self.ad.adoption_data_per_region() pds_adoption_trend_per_region = self.ad.adoption_trend_per_region() pds_adoption_is_single_source = self.ad.adoption_is_single_source() ht_ref_adoption_initial = pd.Series(list( self.ac.ref_base_adoption.values()), index=dd.REGIONS) ht_ref_adoption_final = self.tla_per_region.loc[2050] * ( ht_ref_adoption_initial / self.tla_per_region.loc[2014]) ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_ref_datapoints.loc[2018] = ht_ref_adoption_initial ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0) ht_pds_adoption_initial = ht_ref_adoption_initial ht_pds_adoption_final_percentage = pd.Series( list(self.ac.pds_adoption_final_percentage.values()), index=list(self.ac.pds_adoption_final_percentage.keys())) ht_pds_adoption_final = ht_pds_adoption_final_percentage * self.tla_per_region.loc[ 2050] ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_pds_datapoints.loc[2018] = ht_pds_adoption_initial ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0) self.ht = helpertables.HelperTables( ac=self.ac, ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints, pds_adoption_data_per_region=pds_adoption_data_per_region, ref_adoption_limits=self.tla_per_region, pds_adoption_limits=self.tla_per_region, ref_adoption_data_per_region=ref_adoption_data_per_region, use_first_pds_datapoint_main=False, adoption_base_year=2018, copy_pds_to_ref=False, copy_ref_datapoint=False, pds_adoption_trend_per_region=pds_adoption_trend_per_region, pds_adoption_is_single_source=pds_adoption_is_single_source) self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac) self.ua = unitadoption.UnitAdoption( ac=self.ac, ref_total_adoption_units=self.tla_per_region, pds_total_adoption_units=self.tla_per_region, electricity_unit_factor=1000000.0, soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(), soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(), bug_cfunits_double_count=True) soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd() soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd() conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits() soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted( ) self.fc = firstcost.FirstCost( ac=self.ac, pds_learning_increase_mult=2, ref_learning_increase_mult=2, conv_learning_increase_mult=2, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_tot_iunits=conv_ref_tot_iunits, soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), conv_ref_first_cost_uses_tot_units=True, fc_convert_iunit_factor=land.MHA_TO_HA) self.oc = operatingcost.OperatingCost( ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(), soln_pds_annual_world_first_cost=self.fc. soln_pds_annual_world_first_cost(), soln_ref_annual_world_first_cost=self.fc. soln_ref_annual_world_first_cost(), conv_ref_annual_world_first_cost=self.fc. conv_ref_annual_world_first_cost(), single_iunit_purchase_year=2017, soln_pds_install_cost_per_iunit=self.fc. soln_pds_install_cost_per_iunit(), conv_ref_install_cost_per_iunit=self.fc. conv_ref_install_cost_per_iunit(), conversion_factor=land.MHA_TO_HA) self.c4 = ch4calcs.CH4Calcs( ac=self.ac, soln_pds_direct_ch4_co2_emissions_saved=self.ua. direct_ch4_co2_emissions_saved_land(), soln_net_annual_funits_adopted=soln_net_annual_funits_adopted) self.c2 = co2calcs.CO2Calcs( ac=self.ac, ch4_ppb_calculator=self.c4.ch4_ppb_calculator(), soln_pds_net_grid_electricity_units_saved=self.ua. soln_pds_net_grid_electricity_units_saved(), soln_pds_net_grid_electricity_units_used=self.ua. soln_pds_net_grid_electricity_units_used(), soln_pds_direct_co2eq_emissions_saved=self.ua. direct_co2eq_emissions_saved_land(), soln_pds_direct_co2_emissions_saved=self.ua. direct_co2_emissions_saved_land(), soln_pds_direct_n2o_co2_emissions_saved=self.ua. direct_n2o_co2_emissions_saved_land(), soln_pds_direct_ch4_co2_emissions_saved=self.ua. direct_ch4_co2_emissions_saved_land(), soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(), conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(), soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, annual_land_area_harvested=self.ua. soln_pds_annual_land_area_harvested(), regime_distribution=self.ae.get_land_distribution(), regimes=dd.THERMAL_MOISTURE_REGIMES8)
def __init__(self, scenario=None): if scenario is None: scenario = list(scenarios.keys())[0] self.scenario = scenario self.ac = scenarios[scenario] # TAM tamconfig_list = [ [ 'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA' ], [ 'source_until_2014', self.ac.source_until_2014, self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES' ], [ 'source_after_2014', self.ac.ref_source_post_2014, self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES' ], [ 'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly' ], [ 'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium' ], [ 'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], [ 'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ] tamconfig = pd.DataFrame(tamconfig_list[1:], columns=tamconfig_list[0], dtype=np.object).set_index('param') tam_ref_data_sources = { 'Baseline Cases': { 'IEA, 2013, "Transition to Sustainable Buildings" – see TAM Factoring': THISDIR.joinpath( 'tam', 'tam_IEA_2013_Transition_to_Sustainable_Buildings_see_TAM_Factoring.csv' ), 'Ürge-Vorsatz et al. (2015) – see TAM Factoring': THISDIR.joinpath( 'tam', 'tam_ÜrgeVorsatz_et_al__2015_see_TAM_Factoring.csv'), }, 'Region: USA': { 'Baseline Cases': { 'Annual Energy Outlook 2016, U.S. Energy Information Administration, 2016.': THISDIR.joinpath( 'tam', 'tam_Annual_Energy_Outlook_2016_U_S__Energy_Information_Administration_2016_.csv' ), }, }, } tam_pds_data_sources = { 'Baseline Cases': { 'Drawdown TAM: Adjusted GBPN Data - Commercial Floor Area': THISDIR.joinpath( 'tam', 'tam_pds_Drawdown_TAM_Adjusted_GBPN_Data_Commercial_Floor_Area.csv' ), }, } self.tm = tam.TAM(tamconfig=tamconfig, tam_ref_data_sources=tam_ref_data_sources, tam_pds_data_sources=tam_pds_data_sources) ref_tam_per_region = self.tm.ref_tam_per_region() pds_tam_per_region = self.tm.pds_tam_per_region() adconfig_list = [ [ 'param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA' ], [ 'trend', self.ac.soln_pds_adoption_prognostication_trend, '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly' ], [ 'growth', self.ac.soln_pds_adoption_prognostication_growth, 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium' ], ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] ] adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0], dtype=np.object).set_index('param') ad_data_sources = {} self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources, adconfig=adconfig) # Custom PDS Data ca_pds_data_sources = [ { 'name': 'PDS1 - Adoption based on Navigant Sales and World Green Buildings Council Targets', 'include': True, 'filename': THISDIR.joinpath( 'ca_pds_data', 'custom_pds_ad_PDS1_Adoption_based_on_Navigant_Sales_and_World_Green_Buildings_Council_Targets.csv' ) }, { 'name': 'PDS2 - Adoption based on Navigant Sales and World Green Buildings Council Targets', 'include': True, 'filename': THISDIR.joinpath( 'ca_pds_data', 'custom_pds_ad_PDS2_Adoption_based_on_Navigant_Sales_and_World_Green_Buildings_Council_Targets.csv' ) }, { 'name': 'PDS3 - Adoption based on Navigant Sales and World Green Buildings Council Targets', 'include': True, 'filename': THISDIR.joinpath( 'ca_pds_data', 'custom_pds_ad_PDS3_Adoption_based_on_Navigant_Sales_and_World_Green_Buildings_Council_Targets.csv' ) }, { 'name': 'Drawdown Book (Edition 1) Scenario 3', 'include': True, 'filename': THISDIR.joinpath( 'ca_pds_data', 'custom_pds_ad_Drawdown_Book_Edition_1_Scenario_3.csv') }, ] self.pds_ca = customadoption.CustomAdoption( data_sources=ca_pds_data_sources, soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name, high_sd_mult=1.0, low_sd_mult=1.0, total_adoption_limit=pds_tam_per_region) ref_adoption_data_per_region = None if False: # One may wonder why this is here. This file was code generated. # This 'if False' allows subsequent conditions to all be elif. pass elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS': pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region( ) pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region( ) pds_adoption_is_single_source = None elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications': pds_adoption_data_per_region = self.ad.adoption_data_per_region() pds_adoption_trend_per_region = self.ad.adoption_trend_per_region() pds_adoption_is_single_source = self.ad.adoption_is_single_source() ht_ref_adoption_initial = pd.Series( [1.9734999131249993, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], index=dd.REGIONS) ht_ref_adoption_final = ref_tam_per_region.loc[2050] * ( ht_ref_adoption_initial / ref_tam_per_region.loc[2014]) ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0) ht_pds_adoption_initial = ht_ref_adoption_initial ht_regions, ht_percentages = zip( *self.ac.pds_adoption_final_percentage) ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages), index=list(ht_regions)) ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[ 2050] ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0) self.ht = helpertables.HelperTables( ac=self.ac, ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints, pds_adoption_data_per_region=pds_adoption_data_per_region, ref_adoption_limits=ref_tam_per_region, pds_adoption_limits=pds_tam_per_region, pds_adoption_trend_per_region=pds_adoption_trend_per_region, pds_adoption_is_single_source=pds_adoption_is_single_source) self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac) self.ua = unitadoption.UnitAdoption( ac=self.ac, ref_total_adoption_units=ref_tam_per_region, pds_total_adoption_units=pds_tam_per_region, soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(), soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(), repeated_cost_for_iunits=False, bug_cfunits_double_count=False) soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd() soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd() conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits() soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted( ) self.fc = firstcost.FirstCost( ac=self.ac, pds_learning_increase_mult=2, ref_learning_increase_mult=2, conv_learning_increase_mult=2, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_tot_iunits=conv_ref_tot_iunits, soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), fc_convert_iunit_factor=1.0) self.oc = operatingcost.OperatingCost( ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(), soln_pds_annual_world_first_cost=self.fc. soln_pds_annual_world_first_cost(), soln_ref_annual_world_first_cost=self.fc. soln_ref_annual_world_first_cost(), conv_ref_annual_world_first_cost=self.fc. conv_ref_annual_world_first_cost(), single_iunit_purchase_year=2017, soln_pds_install_cost_per_iunit=self.fc. soln_pds_install_cost_per_iunit(), conv_ref_install_cost_per_iunit=self.fc. conv_ref_install_cost_per_iunit(), conversion_factor=1.0) self.c4 = ch4calcs.CH4Calcs( ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted) self.c2 = co2calcs.CO2Calcs( ac=self.ac, ch4_ppb_calculator=self.c4.ch4_ppb_calculator(), soln_pds_net_grid_electricity_units_saved=self.ua. soln_pds_net_grid_electricity_units_saved(), soln_pds_net_grid_electricity_units_used=self.ua. soln_pds_net_grid_electricity_units_used(), soln_pds_direct_co2_emissions_saved=self.ua. soln_pds_direct_co2_emissions_saved(), soln_pds_direct_ch4_co2_emissions_saved=self.ua. soln_pds_direct_ch4_co2_emissions_saved(), soln_pds_direct_n2o_co2_emissions_saved=self.ua. soln_pds_direct_n2o_co2_emissions_saved(), soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(), conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(), soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, fuel_in_liters=False) self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014, 'World'], soln_avg_annual_use=self.ac.soln_avg_annual_use, conv_avg_annual_use=self.ac.conv_avg_annual_use)
def __init__(self, scenario=None): if scenario is None: scenario = list(scenarios.keys())[0] self.scenario = scenario self.ac = scenarios[scenario] # TAM tamconfig_list = [ [ 'param', 'World', 'PDS World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA' ], [ 'source_until_2014', self.ac.source_until_2014, self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES' ], [ 'source_after_2014', self.ac.ref_source_post_2014, self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES' ], [ 'trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly' ], [ 'growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium' ], [ 'low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], [ 'high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] ] tamconfig = pd.DataFrame(tamconfig_list[1:], columns=tamconfig_list[0], dtype=np.object).set_index('param') tam_ref_data_sources = { 'Baseline Cases': { 'Based on IEA (2016), "Energy Technology Perspectives - 6DS", IEA/OECD': THISDIR.joinpath( 'tam', 'tam_based_on_IEA_2016_Energy_Technology_Perspectives_6DS_IEAOECD.csv' ), 'Based on ICCT (2012) "Global Transport Roadmap Model", http://www.theicct.org/global-transportation-roadmap-model': THISDIR.joinpath( 'tam', 'tam_based_on_ICCT_2012_Global_Transport_Roadmap_Model_httpwww_theicct_orgglobaltransportatio_8916596a.csv' ), }, 'Conservative Cases': { 'Based on IEA (2016), "Energy Technology Perspectives - 4DS", IEA/OECD': THISDIR.joinpath( 'tam', 'tam_based_on_IEA_2016_Energy_Technology_Perspectives_4DS_IEAOECD.csv' ), }, 'Ambitious Cases': { 'Based on IEA (2016), "Energy Technology Perspectives - 2DS", IEA/OECD': THISDIR.joinpath( 'tam', 'tam_based_on_IEA_2016_Energy_Technology_Perspectives_2DS_IEAOECD.csv' ), }, } self.tm = tam.TAM(tamconfig=tamconfig, tam_ref_data_sources=tam_ref_data_sources, tam_pds_data_sources=tam_ref_data_sources) ref_tam_per_region = self.tm.ref_tam_per_region() pds_tam_per_region = self.tm.pds_tam_per_region() adconfig_list = [ [ 'param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA' ], [ 'trend', self.ac.soln_pds_adoption_prognostication_trend, '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly' ], [ 'growth', self.ac.soln_pds_adoption_prognostication_growth, 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium' ], ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] ] adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0], dtype=np.object).set_index('param') ad_data_sources = { 'Conservative Cases': { 'Navigant Research': THISDIR.joinpath('ad', 'ad_Navigant_Research.csv'), 'Based on: IEA ETP 2016 4DS': THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2016_4DS.csv'), 'Based on Clean Energy Manufacturing Analysis Center': THISDIR.joinpath( 'ad', 'ad_based_on_Clean_Energy_Manufacturing_Analysis_Center.csv' ), }, 'Ambitious Cases': { 'Based on: IEA ETP 2016 2DS': THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2016_2DS.csv'), 'Interpolation Based on World Energy Council 2011 - Global Transport Scenarios 2050': THISDIR.joinpath( 'ad', 'ad_Interpolation_based_on_World_Energy_Council_2011_Global_Transport_Scenarios_2050.csv' ), }, } self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources, adconfig=adconfig) # Custom PDS Data wb = xlrd.open_workbook( filename=THISDIR.joinpath('hybridcarsdata.xlsx')) raw_sales = pd.read_excel(io=wb, sheet_name='HEV Sales', header=0, index_col=0, usecols='A:K', dtype='float', engine='xlrd', skiprows=7, nrows=43) hev_sales = raw_sales.rename( axis='columns', mapper={ 'World ': 'World', 'OECD90 (US, EU Japan, Canada)': 'OECD90', 'Asia sans Japan (China, India & Other.)': 'Asia (Sans Japan)', 'Middle East & Africa': 'Middle East and Africa' }).fillna(0.0) lifetime = int(np.ceil(self.ac.soln_lifetime_replacement)) sales_extended = hev_sales.copy() for year in range(2019, 2061): sales_extended.loc[year, :] = 0.0 vehicle_retirements = sales_extended.shift(periods=lifetime, fill_value=0.0) hev_stock = (hev_sales - vehicle_retirements).cumsum() pass_km_adoption = hev_stock * self.ac.soln_avg_annual_use # HybridCars.xlsm 'Data Interpolator'!H1582, Adoption Data # Project Drawdown Analysis based on Market Reports and a Drop in HEV # in later years (replaced by EVs) - PDS2 predict = pd.read_csv(THISDIR.joinpath('ca_pds_data', 'pass_km_datapoints_PDS2.csv'), skipinitialspace=True, comment='#', index_col=0, squeeze=True) pass_km_predicted = interpolation.poly_degree3_trend( predict)['adoption'] pass_km_predicted.update( predict.loc[:2018]) # Early years adjusted to be actual values integration_pds2 = pd.read_csv(THISDIR.joinpath( 'tam', 'integration_PDS2.csv'), skipinitialspace=True, comment='#', index_col=0) tam_limit_pds2 = 0.95 * (integration_pds2['URBAN'] + integration_pds2['NONURBAN']) * 1e9 world = pd.concat([ pass_km_adoption.loc[2012:2016, 'World'], pass_km_predicted.loc[2017:] ]) ds1_df = pd.DataFrame(0, columns=dd.REGIONS, index=range(2012, 2061)) ds1_df['World'] = world.clip(upper=tam_limit_pds2, lower=0.0, axis=0) # Data Source 2 predict = pd.read_csv(THISDIR.joinpath('ca_pds_data', 'pass_km_datapoints_PDS3.csv'), skipinitialspace=True, comment='#', index_col=0, squeeze=True) pass_km_predicted = interpolation.poly_degree3_trend( predict)['adoption'] pass_km_predicted.update( predict.loc[:2018]) # Early years adjusted to be actual values integration_pds3 = pd.read_csv(THISDIR.joinpath( 'tam', 'integration_PDS3.csv'), skipinitialspace=True, comment='#', index_col=0) intg_limit = (integration_pds3['URBAN'] + integration_pds3['NONURBAN']) * 1e9 tam_limit_pds3 = pd.concat([(intg_limit.loc[:2035] * 0.95), (intg_limit.loc[2036:] * 0.9)]) world = pd.concat([ pass_km_adoption.loc[2012:2016, 'World'], pass_km_predicted.loc[2017:] ]) ds2_df = pd.DataFrame(0, columns=dd.REGIONS, index=range(2012, 2061)) ds2_df['World'] = world.clip(upper=tam_limit_pds3, lower=0.0, axis=0) ca_pds_data_sources = [ { 'name': 'PDS2-Transition to EVs in Cities', 'include': True, 'description': ('Considering that Electric Vehicles (BEV or PHEV) are a better technology ' 'from a lifetime emissions perspective, HEV are considered as a transition ' 'technology in the PDS2 where the target is drawdown by 2050 particularly ' 'within cities where there is minimal range anxiety. In this Drawdown ' 'scenario, then, the focus is on growing EV after all higher priority ' 'solutions (like non-motorized transportation) in cities are grown to their ' "maximum potential. For HEV's then, the adoption is projected to only occur " 'where BEV or PHEV cars cannot easily be used, such as for long distance ' 'intercity trips until perhaps around 2025 when EV battery technology can be ' 'assumed to be adequate enough to eliminate all range anxiety. The HEV ' 'adoption is projected to continue its growth until around 2025 when it ' 'starts to decline and trend to zero by or before 2050. Sales data for ' 'multiple key countries and regions were used to estimate the actual global ' "sales. Using the model's lifetime data, the older HEVs are removed from the " 'fleet while aggregating the total sales to get the total stock per year. ' 'With these, the projected sales from IEA are used to project increments to ' 'the existing stock to 2050 (latest data vailable). Stock data are converted ' "to usage with model's Advanced Controls input. All scenarios are limited " 'by integrated TAM after removing adoptions of higher priority solutions. ' ), 'dataframe': ds1_df }, { 'name': 'PDS3-Transition to EVs', 'include': True, 'description': ('Considering that Electric Vehicles (BEV or PHEV) are a better technology ' 'from a lifetime emissions perspective, HEV are considered as a transition ' 'technology in the PDS3 where the target is maximizing emissions reduction. ' 'In this scenario, then, the focus is on growing EV after all higher ' 'priority solutions (like non-motorized transportation) are grown to their ' 'maximum potential. As soon as possible, HEV sales will rapidly decline. ' 'Sales data for multiple key countries and regions were used to estimate the ' "actual global sales. Using the model's lifetime data, the older HEVs are " 'removed from the fleet while aggregating the total sales to get the total ' "stock per year. Stock data are converted to usage with model's Advanced " 'Controls input. All scenarios are limited by integrated TAM after removing ' 'adoptions of higher priority solutions. '), 'dataframe': ds2_df }, { 'name': 'Drawdown Book - Edition 1- Quick Doubling of Hybrid Car Occupancy', 'include': True, 'description': ('We take the Average of two Ambitious adoption scenarios (on Adoption Data ' 'tab): Interpolation of IEA 2016 ETP 2DS(2016), and World Energy Council ' '(2011) (both with annual use of ICCT Roadmap Model). We then double the HEV ' 'car occupancy from 2017 and interpolate back to current adoption for 2014. ' ), 'filename': THISDIR.joinpath( 'ca_pds_data', 'custom_pds_ad_Drawdown_Book_Edition_1_Quick_Doubling_of_Hybrid_Car_Occupancy.csv' ) }, { 'name': 'PDS1 - Aggressive Growth from Existing Stock based on IEA 2DS', 'include': True, 'description': ('Sales data for multiple key countries and regions were used to estimate the ' "global sales. Using the model's lifetime data, the older HEVs are removed " 'from the fleet while aggregating the total sales to get the total stock per ' 'year. With these, the projected sales from IEA are used to project ' 'increments to the existing stock to 2050 (latest data vailable). Stock data ' "are converted to usage with model's Advanced Controls input. All scenarios " 'are limited by integrated TAM after removing adoptions of higher priority ' 'solutions. '), 'filename': THISDIR.joinpath( 'ca_pds_data', 'custom_pds_ad_PDS1_Aggressive_Growth_from_Existing_Stock_based_on_IEA_2DS.csv' ) }, ] self.pds_ca = customadoption.CustomAdoption( data_sources=ca_pds_data_sources, soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name, high_sd_mult=self.ac.soln_pds_adoption_custom_high_sd_mult, low_sd_mult=self.ac.soln_pds_adoption_custom_low_sd_mult, total_adoption_limit=pds_tam_per_region) # Custom REF Data ca_ref_data_sources = [ { 'name': 'Default REF Projection with Adjustment for Recent Historical Adoptions', 'include': True, 'description': ('We take the Default Project Drawdown REF adoption using Average Baseline ' 'TAM data and then adjust the years 2012-2018 to be the estimated historical ' 'adoptions from the HEV Pass-Km tab. '), 'filename': THISDIR.joinpath( 'ca_ref_data', 'custom_ref_ad_Default_REF_Projection_with_Adjustment_for_Recent_Historical_Adoptions.csv' ) }, ] self.ref_ca = customadoption.CustomAdoption( data_sources=ca_ref_data_sources, soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name, high_sd_mult=1.0, low_sd_mult=1.0, total_adoption_limit=ref_tam_per_region) if self.ac.soln_ref_adoption_basis == 'Custom': ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region( ) else: ref_adoption_data_per_region = None if False: # One may wonder why this is here. This file was code generated. # This 'if False' allows subsequent conditions to all be elif. pass elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS': pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region( ) pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region( ) pds_adoption_is_single_source = None elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications': pds_adoption_data_per_region = self.ad.adoption_data_per_region() pds_adoption_trend_per_region = self.ad.adoption_trend_per_region() pds_adoption_is_single_source = self.ad.adoption_is_single_source() ht_ref_adoption_initial = pd.Series(list( self.ac.ref_base_adoption.values()), index=dd.REGIONS) ht_ref_adoption_final = ref_tam_per_region.loc[2050] * ( ht_ref_adoption_initial / ref_tam_per_region.loc[2018]) ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_ref_datapoints.loc[2018] = ht_ref_adoption_initial ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0) ht_pds_adoption_initial = ht_ref_adoption_initial ht_pds_adoption_final_percentage = pd.Series( list(self.ac.pds_adoption_final_percentage.values()), index=list(self.ac.pds_adoption_final_percentage.keys())) ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[ 2050] ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_pds_datapoints.loc[2018] = ht_pds_adoption_initial ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0) self.ht = helpertables.HelperTables( ac=self.ac, ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints, pds_adoption_data_per_region=pds_adoption_data_per_region, ref_adoption_limits=ref_tam_per_region, pds_adoption_limits=pds_tam_per_region, ref_adoption_data_per_region=ref_adoption_data_per_region, use_first_pds_datapoint_main=False, copy_pds_to_ref=False, copy_ref_datapoint=False, copy_pds_datapoint=False, pds_adoption_trend_per_region=pds_adoption_trend_per_region, pds_adoption_is_single_source=pds_adoption_is_single_source) self.ef = emissionsfactors.ElectricityGenOnGrid( ac=self.ac, grid_emissions_version=3) self.ua = unitadoption.UnitAdoption( ac=self.ac, ref_total_adoption_units=ref_tam_per_region, pds_total_adoption_units=pds_tam_per_region, soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(), soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(), bug_cfunits_double_count=True) soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd() soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd() conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits() soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted( ) self.fc = firstcost.FirstCost( ac=self.ac, pds_learning_increase_mult=2, ref_learning_increase_mult=2, conv_learning_increase_mult=2, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_tot_iunits=conv_ref_tot_iunits, soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), fc_convert_iunit_factor=1.0) self.oc = operatingcost.OperatingCost( ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(), soln_pds_annual_world_first_cost=self.fc. soln_pds_annual_world_first_cost(), soln_ref_annual_world_first_cost=self.fc. soln_ref_annual_world_first_cost(), conv_ref_annual_world_first_cost=self.fc. conv_ref_annual_world_first_cost(), single_iunit_purchase_year=2017, soln_pds_install_cost_per_iunit=self.fc. soln_pds_install_cost_per_iunit(), conv_ref_install_cost_per_iunit=self.fc. conv_ref_install_cost_per_iunit(), conversion_factor=1.0) self.c4 = ch4calcs.CH4Calcs( ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted) self.c2 = co2calcs.CO2Calcs( ac=self.ac, ch4_ppb_calculator=self.c4.ch4_ppb_calculator(), soln_pds_net_grid_electricity_units_saved=self.ua. soln_pds_net_grid_electricity_units_saved(), soln_pds_net_grid_electricity_units_used=self.ua. soln_pds_net_grid_electricity_units_used(), soln_pds_direct_co2_emissions_saved=self.ua. soln_pds_direct_co2_emissions_saved(), soln_pds_direct_ch4_co2_emissions_saved=self.ua. soln_pds_direct_ch4_co2_emissions_saved(), soln_pds_direct_n2o_co2_emissions_saved=self.ua. soln_pds_direct_n2o_co2_emissions_saved(), soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(), conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(), soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, fuel_in_liters=False) self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014, 'World'], soln_avg_annual_use=self.ac.soln_avg_annual_use, conv_avg_annual_use=self.ac.conv_avg_annual_use)
def __init__(self, scenario=None): if scenario is None: scenario = list(scenarios.keys())[0] self.scenario = scenario self.ac = scenarios[scenario] # TLA self.ae = aez.AEZ(solution_name=self.name, cohort=2020, regimes=dd.THERMAL_MOISTURE_REGIMES8) if self.ac.use_custom_tla: self.c_tla = tla.CustomTLA( filename=THISDIR.joinpath('custom_tla_data.csv')) custom_world_vals = self.c_tla.get_world_values() else: custom_world_vals = None self.tla_per_region = tla.tla_per_region( self.ae.get_land_distribution(), custom_world_values=custom_world_vals) adconfig_list = [ [ 'param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA' ], [ 'trend', self.ac.soln_pds_adoption_prognostication_trend, 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium' ], [ 'growth', self.ac.soln_pds_adoption_prognostication_growth, 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE', 'NOTE' ], ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] ] adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0], dtype=np.object).set_index('param') ad_data_sources = { 'Raw Data for ALL LAND TYPES': { 'Nair 2012 & Lal et al. 2018': THISDIR.joinpath('ad', 'ad_Nair_2012_Lal_et_al__2018.csv'), }, } self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources, main_includes_regional=True, adconfig=adconfig) # Custom PDS Data ca_pds_columns = ['Year'] + dd.REGIONS tla_2050 = self.tla_per_region.loc[2050, 'World'] adoption_vma = VMAs['Current Adoption'] adoption_2018 = adoption_vma.avg_high_low(key='mean') # SOURCE: den Herder, M., Moreno, G., Mosquera-Losada, R. M., Palma, J. H., Sidiropoulou, # A., Freijanes, J. J. S., ... & Papanastasis, V. P. (2017). Current extent and # stratification of agroforestry in the European Union. Agriculture, Ecosystems & # Environment, 241, 121-132. ds4_silvo_of_grassland = 0.35 ds4_total_grassland = 3621.237045 ds4_potential_adoption = ds4_silvo_of_grassland * ds4_total_grassland ds4_adopt_2050 = 0.6 * ds4_potential_adoption # SOURCE: Somarriba, E., Beer, J., Alegre-Orihuela, J., Andrade, H. J., Cerda, R., DeClerck, # F., ... & Krishnamurthy, L. (2012). Mainstreaming agroforestry in Latin America. In # Agroforestry-The Future of Global Land Use (pp. 429-453). Springer, Dordrecht. ds5_adoption_rate = 0.45 pg_vma = VMAs['Total Pasture/Grazing Area'] pasture_grassland_area = pg_vma.avg_high_low(key='mean') ds5_potential_adoption = ds5_adoption_rate * pasture_grassland_area ds5_adopt_2050 = 0.6 * ds5_potential_adoption # SOURCE: Holman et al., 2004, http://www.lrrd.org/lrrd16/12/holm16098.htm growth_initial = pd.DataFrame( [[2018] + list(self.ac.ref_base_adoption.values())], columns=ca_pds_columns).set_index('Year') ds6_rate = 0.006 # SOURCE: Holman et al., 2004, http://www.lrrd.org/lrrd16/12/holm16098.htm ds7_rate = 0.013 ca_pds_data_sources = [ { 'name': 'Linear trend based on Zomers >30% tree cover percent area applied in grassland area', 'include': False, # This is a proxy adoption scenario which is created in the absence of any data # available either on historical growth rate of silvopasture or any future # projections. Thus, the present scenario builds the future adoption using the # Zoomer 2014 information available on tree coverage in the agricultural area. # Country level data on agricultural area with > 30 percent tree cover was available # at Zomer 2014. This data was compiled at the Project Drawdown regions, which is # then used to get their percent with respect to the total agricultural area. # Those percentages were then applied on the grassland area to get the regional # grassland area under >30 percent tree cover. The future adoption of the silvopasture # area under was thus projected based on the regional linear trend applied to the # grassland area with >30 percent tree coverage. The projections were based on the # regional linear trend. (Refer PD region wise - silvopasture sheet) 'filename': THISDIR.joinpath( 'ca_pds_data', 'custom_pds_ad_Linear_trend_based_on_Zomers_30_tree_cover_percent_area_applied_in_grassland_area.csv' ) }, { 'name': 'Linear trend based on Zomers >30% tree cover percent area and conversion of >10% are to 30% tree cover area applied in grassland area', 'include': False, # In this scenario, the future area in silvopasture is projected based on scenario # one, in addition it was assumed that there will be some extra area available for # silvopasture by the conversion of 0-10 percent/11-20 percent tree coverage # grassland area to >30 percent tree coverage areas as required for a silvopasture # system. The projections are based on regional linear trends. 'filename': THISDIR.joinpath( 'ca_pds_data', 'custom_pds_ad_Linear_trend_based_on_Zomers_30_tree_cover_percent_area_and_conversion_of_10_are_to_30_t_d419700f.csv' ) }, { 'name': 'Linear Interpolation for Adoption Data based on Nair 2012 & Lal et al. 2018', 'include': True, # In the absence of comprehensive historical data for silvopasture adoption, this # scenario uses available global adoption estimates reported in peer-reviewed # publications. Data points ffrom 2012 (Nair 2012) and 2018 (Lal et al. 2018) were # used for a linear interpolation of future adoption based on historic expansion of # silvopasture adoption. 'datapoints': pd.DataFrame([ [ 2018, self.ac.ref_base_adoption['World'], 0., 0., 0., 0., 0., 0., 0., 0., 0. ], [ 2050, 1083.33333333333, 0., 0., 0., 0., 0., 0., 0., 0., 0. ], ], columns=ca_pds_columns).set_index('Year') }, { 'name': 'Medium interpolation based on current adoption, linear trend (high regional proportion of grazing land under silvopasture)', 'include': True, # Future area in silvopasture is projected based on the proportion of current area # of grazing or pasture land under silvopasture practice in the EU, which currently # has the highest regional proportion of grazing land under silvopasture worldwide # (35%), as reported by den Herder et al 2017 (see VMA, Variable 31). This percentage # was applied to the total global grazing area to obtain a medium estimate of # potential projected area for future silvopasture adoption. This scenario assumes # 60 percent of future silvopasture adoption by 2050. 'datapoints': pd.DataFrame([ [ 2018, self.ac.ref_base_adoption['World'], 0., 0., 0., 0., 0., 0., 0., 0., 0. ], [2050, ds4_adopt_2050, 0., 0., 0., 0., 0., 0., 0., 0., 0.], ], columns=ca_pds_columns).set_index('Year') }, { 'name': 'High interpolation based on current adoption, linear trend (high national proportion of grazing land under silvopasture)', 'include': True, # Future area in silvopasture is projected based on the proportion of current area # of grazing or pasture land under silvopasture practice in Nicaragua, which currently # has the highest national proportion of grazing land under silvopasture worldwide # (45%), as reported by Somarriba et al 2012 (see VMA, Variable 31). This percentage # was applied to the total global grazing area to obtain a high estimate of potential # projected area for future silvopasture adoption. This scenario assumes 60 percent # of future silvopasture adoption by 2050. 'datapoints': pd.DataFrame([ [ 2018, self.ac.ref_base_adoption['World'], 0., 0., 0., 0., 0., 0., 0., 0., 0. ], [2050, ds5_adopt_2050, 0., 0., 0., 0., 0., 0., 0., 0., 0.], ], columns=ca_pds_columns).set_index('Year') }, { 'name': 'Low growth, linear trend (based on improved pasture area)', 'include': True, # This is a proxy adoption scenario which is created in the absence of any data # available either on historical growth rate of silvopasture or any future projections # on silvopasture. In this scenario future adoption of silvopasture area was projected # using the Thorton 2010 future adoption rates given for improved pasture. The # silvopasture adoption is projected based on the average annual adoption percent # (0.60%) increase in the improved pasture area given for the five countries (Mexico, # Honduras, Nicaragua, Costa Rica, and Panama) by Holman et al 2004 and reported by # Thorton et al 2010. With the limitation of data at the regional level, the # projections are made only at the global scale. 'growth_rate': ds6_rate, 'growth_initial': growth_initial }, { 'name': 'High growth, linear trend (based on improved pasture area)', 'include': True, # This is a proxy adoption scenario which is created in the absence of any data # available either on historical growth rate of silvopasture or any future projections # on silvopasture. In this scenario future adoption of silvopasture area was projected # using the Thorton 2010 future adoption rates given for improved pasture. The # silvopasture adoption is projected based on the maximum annual adoption percent # (1.30%) increase in the improved pasture area given for the five countries (Mexico, # Honduras, Nicaragua, Costa Rica, and Panama) by Holman et al 2004 and reported by # Thorton et al 2010. With the limitation of data at the regional level, the # projections are made only at the global scale. 'growth_rate': ds7_rate, 'growth_initial': growth_initial }, ] self.pds_ca = customadoption.CustomAdoption( data_sources=ca_pds_data_sources, soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name, high_sd_mult=1.0, low_sd_mult=1.0, total_adoption_limit=self.tla_per_region) # Manual adjustment made in spreadsheet for Drawdown 2020. for source in ca_pds_data_sources: if 'filename' in source: # only the interpolated sources are adjusted continue name = source['name'] s = self.pds_ca.scenarios[name] df = s['df'] df.loc[2012, 'World'] = 450.0 df.loc[2013, 'World'] = 466.666666666667 df.loc[2014, 'World'] = 483.333333333333 df.loc[2015, 'World'] = 500.0 df.loc[2016, 'World'] = 516.666666666667 df.loc[2017, 'World'] = 533.333333333333 df.loc[2018, 'World'] = 550.0 # Custom REF Data ca_ref_data_sources = [ { 'name': '[Type Scenario 1 Name Here (REF CASE)...]', 'include': True, 'filename': THISDIR.joinpath( 'ca_ref_data', 'custom_ref_ad_Type_Scenario_1_Name_Here_REF_CASE_.csv') }, ] self.ref_ca = customadoption.CustomAdoption( data_sources=ca_ref_data_sources, soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name, high_sd_mult=1.0, low_sd_mult=1.0, total_adoption_limit=self.tla_per_region) if self.ac.soln_ref_adoption_basis == 'Custom': ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region( ) else: ref_adoption_data_per_region = None if False: # One may wonder why this is here. This file was code generated. # This 'if False' allows subsequent conditions to all be elif. pass elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS': pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region( ) pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region( ) pds_adoption_is_single_source = None elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications': pds_adoption_data_per_region = self.ad.adoption_data_per_region() pds_adoption_trend_per_region = self.ad.adoption_trend_per_region() pds_adoption_is_single_source = self.ad.adoption_is_single_source() ht_ref_adoption_initial = pd.Series(list( self.ac.ref_base_adoption.values()), index=dd.REGIONS) ht_ref_adoption_final = self.tla_per_region.loc[2050] * ( ht_ref_adoption_initial / self.tla_per_region.loc[2014]) ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_ref_datapoints.loc[2018] = ht_ref_adoption_initial ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0) ht_pds_adoption_initial = ht_ref_adoption_initial ht_pds_adoption_final_percentage = pd.Series( list(self.ac.pds_adoption_final_percentage.values()), index=list(self.ac.pds_adoption_final_percentage.keys())) ht_pds_adoption_final = ht_pds_adoption_final_percentage * self.tla_per_region.loc[ 2050] ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_pds_datapoints.loc[2018] = ht_pds_adoption_initial ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0) self.ht = helpertables.HelperTables( ac=self.ac, ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints, pds_adoption_data_per_region=pds_adoption_data_per_region, ref_adoption_limits=self.tla_per_region, pds_adoption_limits=self.tla_per_region, ref_adoption_data_per_region=ref_adoption_data_per_region, use_first_pds_datapoint_main=False, adoption_base_year=2018, copy_pds_to_ref=False, pds_adoption_trend_per_region=pds_adoption_trend_per_region, pds_adoption_is_single_source=pds_adoption_is_single_source) self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac) self.ua = unitadoption.UnitAdoption( ac=self.ac, ref_total_adoption_units=self.tla_per_region, pds_total_adoption_units=self.tla_per_region, electricity_unit_factor=1000000.0, soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(), soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(), bug_cfunits_double_count=True) soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd() soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd() conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits() soln_net_annual_funits_adopted = self.ua.soln_net_annual_funits_adopted( ) self.fc = firstcost.FirstCost( ac=self.ac, pds_learning_increase_mult=2, ref_learning_increase_mult=2, conv_learning_increase_mult=2, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_tot_iunits=conv_ref_tot_iunits, soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), conv_ref_first_cost_uses_tot_units=True, fc_convert_iunit_factor=land.MHA_TO_HA) self.oc = operatingcost.OperatingCost( ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(), soln_pds_annual_world_first_cost=self.fc. soln_pds_annual_world_first_cost(), soln_ref_annual_world_first_cost=self.fc. soln_ref_annual_world_first_cost(), conv_ref_annual_world_first_cost=self.fc. conv_ref_annual_world_first_cost(), single_iunit_purchase_year=2017, soln_pds_install_cost_per_iunit=self.fc. soln_pds_install_cost_per_iunit(), conv_ref_install_cost_per_iunit=self.fc. conv_ref_install_cost_per_iunit(), conversion_factor=land.MHA_TO_HA) self.c4 = ch4calcs.CH4Calcs( ac=self.ac, soln_pds_direct_ch4_co2_emissions_saved=self.ua. direct_ch4_co2_emissions_saved_land(), soln_net_annual_funits_adopted=soln_net_annual_funits_adopted) self.c2 = co2calcs.CO2Calcs( ac=self.ac, ch4_ppb_calculator=self.c4.ch4_ppb_calculator(), soln_pds_net_grid_electricity_units_saved=self.ua. soln_pds_net_grid_electricity_units_saved(), soln_pds_net_grid_electricity_units_used=self.ua. soln_pds_net_grid_electricity_units_used(), soln_pds_direct_co2eq_emissions_saved=self.ua. direct_co2eq_emissions_saved_land(), soln_pds_direct_co2_emissions_saved=self.ua. direct_co2_emissions_saved_land(), soln_pds_direct_n2o_co2_emissions_saved=self.ua. direct_n2o_co2_emissions_saved_land(), soln_pds_direct_ch4_co2_emissions_saved=self.ua. direct_ch4_co2_emissions_saved_land(), soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(), conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(), soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, annual_land_area_harvested=self.ua. soln_pds_annual_land_area_harvested(), regime_distribution=self.ae.get_land_distribution(), regimes=dd.THERMAL_MOISTURE_REGIMES8)
def __init__(self, scenario=None): if scenario is None: scenario = list(scenarios.keys())[0] self.scenario = scenario self.ac = scenarios[scenario] # TAM tamconfig_list = [ ['param', 'World', 'PDS World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'], ['source_until_2014', self.ac.source_until_2014, self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'], ['source_after_2014', self.ac.ref_source_post_2014, self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'], ['trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'], ['growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'], ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]] tamconfig = pd.DataFrame(tamconfig_list[1:], columns=tamconfig_list[0], dtype=np.object).set_index('param') tam_ref_data_sources = { 'Baseline Cases': { 'IEA (2016), "Energy Technology Perspectives - 6DS", IEA/OECD': THISDIR.joinpath('tam', 'tam_IEA_2016_Energy_Technology_Perspectives_6DS_IEAOECD.csv'), 'ICCT (2012) "Global Transport Roadmap Model", http://www.theicct.org/global-transportation-roadmap-model': THISDIR.joinpath('tam', 'tam_ICCT_2012_Global_Transport_Roadmap_Model_httpwww_theicct_orgglobaltransportationroadmapmodel.csv'), }, 'Conservative Cases': { 'IEA (2016), "Energy Technology Perspectives - 4DS", IEA/OECD': THISDIR.joinpath('tam', 'tam_IEA_2016_Energy_Technology_Perspectives_4DS_IEAOECD.csv'), }, 'Ambitious Cases': { 'IEA (2016), "Energy Technology Perspectives - 2DS", IEA/OECD': THISDIR.joinpath('tam', 'tam_IEA_2016_Energy_Technology_Perspectives_2DS_IEAOECD.csv'), }, } self.tm = tam.TAM(tamconfig=tamconfig, tam_ref_data_sources=tam_ref_data_sources, tam_pds_data_sources=tam_ref_data_sources) ref_tam_per_region=self.tm.ref_tam_per_region() pds_tam_per_region=self.tm.pds_tam_per_region() adconfig_list = [ ['param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'], ['trend', self.ac.soln_pds_adoption_prognostication_trend, '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'], ['growth', self.ac.soln_pds_adoption_prognostication_growth, 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'], ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]] adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0], dtype=np.object).set_index('param') ad_data_sources = { 'Baseline Cases': { 'Based on IEA Reference Tech Scenario- 2017': THISDIR.joinpath('ad', 'ad_based_on_IEA_Reference_Tech_Scenario_2017.csv'), }, 'Conservative Cases': { 'Based on OPEC World Energy Outlook 2016': THISDIR.joinpath('ad', 'ad_based_on_OPEC_World_Energy_Outlook_2016.csv'), 'Based on The Paris Declaration as Cited in (IEA, 2017- EV Outlook)': THISDIR.joinpath('ad', 'ad_based_on_The_Paris_Declaration_as_Cited_in_IEA_2017_EV_Outlook.csv'), }, 'Ambitious Cases': { 'Based on: IEA ETP 2016 2DS': THISDIR.joinpath('ad', 'ad_based_on_IEA_ETP_2016_2DS.csv'), 'Based on Bloomberg New Energy Finance - EV Outlook 2017': THISDIR.joinpath('ad', 'ad_based_on_Bloomberg_New_Energy_Finance_EV_Outlook_2017.csv'), 'Based on IEA Beyond 2DS/B2DS Scenario': THISDIR.joinpath('ad', 'ad_based_on_IEA_Beyond_2DSB2DS_Scenario.csv'), }, 'Maximum Cases': { 'Double EV occupancy on PDS2 = double pass-km': THISDIR.joinpath('ad', 'ad_Double_EV_occupancy_on_PDS2_double_passkm.csv'), 'Drawdown Projections based on adjusted IEA data (ETP 2012) on projected growth in each year, and recent sales Data (IEA - ETP 2016)': THISDIR.joinpath('ad', 'ad_Drawdown_Projections_based_on_adjusted_IEA_data_ETP_2012_on_projected_growth_in_each_yea_72fb5617.csv'), }, } self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources, adconfig=adconfig) # Custom PDS Data ca_pds_data_sources = [ {'name': 'PDS2-Based on IEA (2017) B2DS+50% Occupancy Increase', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_PDS2based_on_IEA_2017_B2DS50_Occupancy_Increase.csv')}, {'name': 'PDS3-Based on IEA B2DS with 100% Increase in Car Occupancy', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_PDS3based_on_IEA_B2DS_with_100_Increase_in_Car_Occupancy.csv')}, {'name': 'Book Ed.1 Scenario 1', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Book_Ed_1_Scenario_1.csv')}, {'name': 'Book Ed.1 Scenario 2', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Book_Ed_1_Scenario_2.csv')}, {'name': 'Book Ed.1 Scenario 3', 'include': True, 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_Book_Ed_1_Scenario_3.csv')}, ] self.pds_ca = customadoption.CustomAdoption(data_sources=ca_pds_data_sources, soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name, high_sd_mult=1.0, low_sd_mult=1.0, total_adoption_limit=pds_tam_per_region) ref_adoption_data_per_region = None if False: # One may wonder why this is here. This file was code generated. # This 'if False' allows subsequent conditions to all be elif. pass elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS': pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region() pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region() pds_adoption_is_single_source = None elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications': pds_adoption_data_per_region = self.ad.adoption_data_per_region() pds_adoption_trend_per_region = self.ad.adoption_trend_per_region() pds_adoption_is_single_source = self.ad.adoption_is_single_source() ht_ref_adoption_initial = pd.Series( [16.701444916159307, 14.405959906291683, 8.68248837596512e-05, 2.7858260096477, 8.68248837596512e-05, 8.68248837596512e-05, 2.6861138324271523, 0.09962535233678836, 4.508096807458965, 6.7600117997589235], index=dd.REGIONS) ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (ht_ref_adoption_initial / ref_tam_per_region.loc[2014]) ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_ref_datapoints.loc[2014] = ht_ref_adoption_initial ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0) ht_pds_adoption_initial = ht_ref_adoption_initial ht_regions, ht_percentages = zip(*self.ac.pds_adoption_final_percentage) ht_pds_adoption_final_percentage = pd.Series(list(ht_percentages), index=list(ht_regions)) ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[2050] ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_pds_datapoints.loc[2014] = ht_pds_adoption_initial ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0) self.ht = helpertables.HelperTables(ac=self.ac, ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints, pds_adoption_data_per_region=pds_adoption_data_per_region, ref_adoption_limits=ref_tam_per_region, pds_adoption_limits=pds_tam_per_region, pds_adoption_trend_per_region=pds_adoption_trend_per_region, pds_adoption_is_single_source=pds_adoption_is_single_source) self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac) self.ua = unitadoption.UnitAdoption(ac=self.ac, ref_total_adoption_units=ref_tam_per_region, pds_total_adoption_units=pds_tam_per_region, soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(), soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(), repeated_cost_for_iunits=False, bug_cfunits_double_count=False) soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd() soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd() conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits() soln_net_annual_funits_adopted=self.ua.soln_net_annual_funits_adopted() self.fc = firstcost.FirstCost(ac=self.ac, pds_learning_increase_mult=2, ref_learning_increase_mult=2, conv_learning_increase_mult=2, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_tot_iunits=conv_ref_tot_iunits, soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), fc_convert_iunit_factor=1.0) self.oc = operatingcost.OperatingCost(ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(), soln_pds_annual_world_first_cost=self.fc.soln_pds_annual_world_first_cost(), soln_ref_annual_world_first_cost=self.fc.soln_ref_annual_world_first_cost(), conv_ref_annual_world_first_cost=self.fc.conv_ref_annual_world_first_cost(), single_iunit_purchase_year=2017, soln_pds_install_cost_per_iunit=self.fc.soln_pds_install_cost_per_iunit(), conv_ref_install_cost_per_iunit=self.fc.conv_ref_install_cost_per_iunit(), conversion_factor=1.0) self.c4 = ch4calcs.CH4Calcs(ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted) self.c2 = co2calcs.CO2Calcs(ac=self.ac, ch4_ppb_calculator=self.c4.ch4_ppb_calculator(), soln_pds_net_grid_electricity_units_saved=self.ua.soln_pds_net_grid_electricity_units_saved(), soln_pds_net_grid_electricity_units_used=self.ua.soln_pds_net_grid_electricity_units_used(), soln_pds_direct_co2_emissions_saved=self.ua.soln_pds_direct_co2_emissions_saved(), soln_pds_direct_ch4_co2_emissions_saved=self.ua.soln_pds_direct_ch4_co2_emissions_saved(), soln_pds_direct_n2o_co2_emissions_saved=self.ua.soln_pds_direct_n2o_co2_emissions_saved(), soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(), conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(), soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, fuel_in_liters=False) self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014, 'World'], soln_avg_annual_use=self.ac.soln_avg_annual_use, conv_avg_annual_use=self.ac.conv_avg_annual_use)
def __init__(self, scenario=None): if scenario is None: scenario = list(scenarios.keys())[0] self.scenario = scenario self.ac = scenarios[scenario] # TAM tamconfig_list = [ ['param', 'World', 'PDS World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'], ['source_until_2014', self.ac.source_until_2014, self.ac.source_until_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'], ['source_after_2014', self.ac.ref_source_post_2014, self.ac.pds_source_post_2014, 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES', 'ALL SOURCES'], ['trend', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'], ['growth', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'], ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]] tamconfig = pd.DataFrame(tamconfig_list[1:], columns=tamconfig_list[0], dtype=np.object).set_index('param') tam_ref_data_sources = { 'Baseline Cases': { 'ETP 2016, URBAN 6 DS + Non-motorized Travel Adjustment': THISDIR.joinpath('tam', 'tam_ETP_2016_URBAN_6_DS_Nonmotorized_Travel_Adjustment.csv'), 'ICCT, 2012, "Global Transportation Roadmap Model" + Non-motorized Travel Adjustment': THISDIR.joinpath('tam', 'tam_ICCT_2012_Global_Transportation_Roadmap_Model_Nonmotorized_Travel_Adjustment.csv'), }, 'Conservative Cases': { 'ETP 2016, URBAN 4 DS + Non-motorized Travel Adjustment': THISDIR.joinpath('tam', 'tam_ETP_2016_URBAN_4_DS_Nonmotorized_Travel_Adjustment.csv'), 'ITDP/UC Davis 2014 Global High Shift Baseline': THISDIR.joinpath('tam', 'tam_ITDPUC_Davis_2014_Global_High_Shift_Baseline.csv'), }, 'Ambitious Cases': { 'ETP 2016, URBAN 2 DS + Non-motorized Travel Adjustment': THISDIR.joinpath('tam', 'tam_ETP_2016_URBAN_2_DS_Nonmotorized_Travel_Adjustment.csv'), 'ITDP/UC Davis 2014 Global High Shift HighShift': THISDIR.joinpath('tam', 'tam_ITDPUC_Davis_2014_Global_High_Shift_HighShift.csv'), }, } self.tm = tam.TAM(tamconfig=tamconfig, tam_ref_data_sources=tam_ref_data_sources, tam_pds_data_sources=tam_ref_data_sources) ref_tam_per_region=self.tm.ref_tam_per_region() pds_tam_per_region=self.tm.pds_tam_per_region() adconfig_list = [ ['param', 'World', 'OECD90', 'Eastern Europe', 'Asia (Sans Japan)', 'Middle East and Africa', 'Latin America', 'China', 'India', 'EU', 'USA'], ['trend', self.ac.soln_pds_adoption_prognostication_trend, '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly', '3rd Poly'], ['growth', self.ac.soln_pds_adoption_prognostication_growth, 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium', 'Medium'], ['low_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], ['high_sd_mult', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]] adconfig = pd.DataFrame(adconfig_list[1:], columns=adconfig_list[0], dtype=np.object).set_index('param') ad_data_sources = { 'Ambitious Cases': { 'ITDP/UCD (2015) A Global High Shift Cycling Scenario - High Shift Scenario - Early Years replaced with Recent Historical Data': THISDIR.joinpath('ad', 'ad_ITDPUCD_2015_A_Global_High_Shift_Cycling_Scenario_High_Shift_Scenario_Early_Years_replac_b131f9f6.csv'), }, } self.ad = adoptiondata.AdoptionData(ac=self.ac, data_sources=ad_data_sources, adconfig=adconfig) # Custom PDS Data ca_pds_data_sources = [ {'name': 'PDS2 - Density remains Constant and is the key driver of walking in cities.', 'include': True, 'description': ( 'We project the amount of walking that would happen in 1,737 cities ' 'worldwide representing 57% of the global urban population then we scale the ' 'total amount of walking to 100% of the world’s urban population. The ' 'background calculations of this scenario use the population and density of ' 'each of the 1737 cities from Demographia’s report and projects the fraction ' 'of each country’s urban population in that city. We assume that that ' 'fraction is constant and then project the city’s population each year to ' '2050 using UN projections of each country’s urban population to 2050. With ' 'the TAM and total urban population projections, we estimate the mobility ' 'per urban resident each year and then apply 6.5% to walking in each city in ' 'each year when the density is over the "dense city threshold" (~3,000 ' 'p/sqkm) and 2% otherwise. Each year is scaled to the global urban ' 'population. ' ), 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_PDS2_Density_remains_Constant_and_is_the_key_driver_of_walking_in_cities_.csv')}, {'name': 'PDS2 - Increasing Urban Density with Density Driving Urban Walking (Book Ed.1)', 'include': True, 'description': ( 'We project the amount of walking that would happen in 1,737 cities ' 'worldwide representing 57% of the global urban population then we scale the ' 'total amount of walking to 100% of the world’s urban population. The ' 'background calculations of this scenario use the population and density of ' 'each of the 1737 cities from Demographia’s report and projects the fraction ' 'of each country’s urban population in that city. We assume that that ' 'fraction is constant and then project the city’s population each year to ' '2050 using UN projections of each country’s urban population to 2050. With ' 'the TAM and total urban population projections, we estimate the mobility ' 'per urban resident each year and then apply 7% to walking in each city in ' 'each year when the density is over the "dense city threshold" (~3,000 ' 'p/sqkm) and 2% otherwise. Each year is scaled to the global urban ' 'population. City densities are assumed to increased by around 2.4% annually ' 'which reverses historical declines of around 2%. This scenario was ' 'calculated for the Drawdown book Edition 1. Some variables may have been ' 'updated. ' ), 'filename': THISDIR.joinpath('ca_pds_data', 'custom_pds_ad_PDS2_Increasing_Urban_Density_with_Density_Driving_Urban_Walking_Book_Ed_1.csv')}, ] self.pds_ca = customadoption.CustomAdoption(data_sources=ca_pds_data_sources, soln_adoption_custom_name=self.ac.soln_pds_adoption_custom_name, high_sd_mult=self.ac.soln_pds_adoption_custom_high_sd_mult, low_sd_mult=self.ac.soln_pds_adoption_custom_low_sd_mult, total_adoption_limit=pds_tam_per_region) # Custom REF Data ca_ref_data_sources = [ {'name': 'Custom REF Scenario 1: Fixed Passenger-km Annual after 2014', 'include': True, 'description': ( 'Taking the estimated passenger-km adoption value from 2014, we hold that ' 'constant out to 2050 which assumes that the total amount of walking remains ' 'constant despite increasing populations. The rapid rise in populations ' 'generally happens in developing countries, and as these countries urbanise ' 'and get wealthier, there is a large trend towards increased motorization ' 'following the historical patterns of Western Nations. This then, although a ' 'pessimistic case, is not unrealistic. ' ), 'filename': THISDIR.joinpath('ca_ref_data', 'custom_ref_ad_Custom_REF_Scenario_1_Fixed_Passengerkm_Annual_after_2018.csv')}, {'name': 'Reference Growth in Walking', 'include': True, 'description': ( 'Here the Drawdown Model of Urban density for 1,737 cities across the world ' 'in the Demographia Dataset was used to develop a reasonable Reference ' 'Scenario for Walking out to the end of the analysis period. While full ' 'details are described in the [Mobility Output] sheet, here is the summary: ' 'The urban density of these cities (representing 57% of the world urban ' 'population), was obtained from the data source and projected out to 2050 ' 'using an assumed global urban density change as listed below. Research on ' 'walking in cities indicates that higher density is correlated with more ' 'walking, so an assumed walking mode share in cities with at least the ' 'minimum threshold urban density, and another assumed walking mode share for ' 'cities below this threshold were together used to estimate the average ' 'walking for each city in each year (considering that density change is ' 'assumed). The total walking mobility in these cities was summed and then ' 'scaled linearly to 100% of the global urban population. This projection to ' '2050 was then interpolated and extrapolated to develop a smooth curve for ' 'the entire analysis period. Also taken into account: increasing urban ' 'population, assumed fixed total mobility per capita, recent historical ' 'walking estimates have been used (2012-2018) instead of curve fit. ' ), 'filename': THISDIR.joinpath('ca_ref_data', 'custom_ref_ad_Reference_Growth_in_Walking.csv')}, {'name': 'ITDP/ UCDavis (2015) Global Highshift Cycling Scenario - Baseline Case for Walking', 'include': True, 'description': ( 'The Source listed below estimated a Baseline Walking Case which generally ' 'shows an increae in walking, but not in line with total mobility increase, ' 'so the walking mode share declines over time. The source published data in ' '5-year increments, these have been interpolated for missing years (on Data- ' 'Interpolator) and pasted here. ' ), 'filename': THISDIR.joinpath('ca_ref_data', 'custom_ref_ad_ITDP_UCDavis_2015_Global_Highshift_Cycling_Scenario_Baseline_Case_for_Walking.csv')}, ] self.ref_ca = customadoption.CustomAdoption(data_sources=ca_ref_data_sources, soln_adoption_custom_name=self.ac.soln_ref_adoption_custom_name, high_sd_mult=1.0, low_sd_mult=1.0, total_adoption_limit=ref_tam_per_region) ref_adoption_data_per_region = self.ref_ca.adoption_data_per_region() if False: # One may wonder why this is here. This file was code generated. # This 'if False' allows subsequent conditions to all be elif. pass elif self.ac.soln_pds_adoption_basis == 'Fully Customized PDS': pds_adoption_data_per_region = self.pds_ca.adoption_data_per_region() pds_adoption_trend_per_region = self.pds_ca.adoption_trend_per_region() pds_adoption_is_single_source = None elif self.ac.soln_pds_adoption_basis == 'Existing Adoption Prognostications': pds_adoption_data_per_region = self.ad.adoption_data_per_region() pds_adoption_trend_per_region = self.ad.adoption_trend_per_region() pds_adoption_is_single_source = self.ad.adoption_is_single_source() elif self.ac.soln_pds_adoption_basis == 'Linear': pds_adoption_data_per_region = None pds_adoption_trend_per_region = None pds_adoption_is_single_source = None ht_ref_adoption_initial = pd.Series( list(self.ac.ref_base_adoption.values()), index=dd.REGIONS) ht_ref_adoption_final = ref_tam_per_region.loc[2050] * (ht_ref_adoption_initial / ref_tam_per_region.loc[2014]) ht_ref_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_ref_datapoints.loc[2018] = ht_ref_adoption_initial ht_ref_datapoints.loc[2050] = ht_ref_adoption_final.fillna(0.0) ht_pds_adoption_initial = ht_ref_adoption_initial ht_pds_adoption_final_percentage = pd.Series( list(self.ac.pds_adoption_final_percentage.values()), index=list(self.ac.pds_adoption_final_percentage.keys())) ht_pds_adoption_final = ht_pds_adoption_final_percentage * pds_tam_per_region.loc[2050] ht_pds_datapoints = pd.DataFrame(columns=dd.REGIONS) ht_pds_datapoints.loc[2018] = ht_pds_adoption_initial ht_pds_datapoints.loc[2050] = ht_pds_adoption_final.fillna(0.0) self.ht = helpertables.HelperTables(ac=self.ac, ref_datapoints=ht_ref_datapoints, pds_datapoints=ht_pds_datapoints, pds_adoption_data_per_region=pds_adoption_data_per_region, ref_adoption_limits=ref_tam_per_region, pds_adoption_limits=pds_tam_per_region, ref_adoption_data_per_region=ref_adoption_data_per_region, use_first_pds_datapoint_main=False, copy_pds_to_ref=False, copy_ref_datapoint=False, pds_adoption_trend_per_region=pds_adoption_trend_per_region, pds_adoption_is_single_source=pds_adoption_is_single_source) self.ef = emissionsfactors.ElectricityGenOnGrid(ac=self.ac, grid_emissions_version=3) self.ua = unitadoption.UnitAdoption(ac=self.ac, ref_total_adoption_units=ref_tam_per_region, pds_total_adoption_units=pds_tam_per_region, soln_ref_funits_adopted=self.ht.soln_ref_funits_adopted(), soln_pds_funits_adopted=self.ht.soln_pds_funits_adopted(), bug_cfunits_double_count=True) soln_pds_tot_iunits_reqd = self.ua.soln_pds_tot_iunits_reqd() soln_ref_tot_iunits_reqd = self.ua.soln_ref_tot_iunits_reqd() conv_ref_tot_iunits = self.ua.conv_ref_tot_iunits() soln_net_annual_funits_adopted=self.ua.soln_net_annual_funits_adopted() self.fc = firstcost.FirstCost(ac=self.ac, pds_learning_increase_mult=2, ref_learning_increase_mult=2, conv_learning_increase_mult=2, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_tot_iunits=conv_ref_tot_iunits, soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), fc_convert_iunit_factor=1.0) self.oc = operatingcost.OperatingCost(ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, soln_pds_tot_iunits_reqd=soln_pds_tot_iunits_reqd, soln_ref_tot_iunits_reqd=soln_ref_tot_iunits_reqd, conv_ref_annual_tot_iunits=self.ua.conv_ref_annual_tot_iunits(), soln_pds_annual_world_first_cost=self.fc.soln_pds_annual_world_first_cost(), soln_ref_annual_world_first_cost=self.fc.soln_ref_annual_world_first_cost(), conv_ref_annual_world_first_cost=self.fc.conv_ref_annual_world_first_cost(), single_iunit_purchase_year=2017, soln_pds_install_cost_per_iunit=self.fc.soln_pds_install_cost_per_iunit(), conv_ref_install_cost_per_iunit=self.fc.conv_ref_install_cost_per_iunit(), conversion_factor=1.0) self.c4 = ch4calcs.CH4Calcs(ac=self.ac, soln_net_annual_funits_adopted=soln_net_annual_funits_adopted) self.c2 = co2calcs.CO2Calcs(ac=self.ac, ch4_ppb_calculator=self.c4.ch4_ppb_calculator(), soln_pds_net_grid_electricity_units_saved=self.ua.soln_pds_net_grid_electricity_units_saved(), soln_pds_net_grid_electricity_units_used=self.ua.soln_pds_net_grid_electricity_units_used(), soln_pds_direct_co2_emissions_saved=self.ua.soln_pds_direct_co2_emissions_saved(), soln_pds_direct_ch4_co2_emissions_saved=self.ua.soln_pds_direct_ch4_co2_emissions_saved(), soln_pds_direct_n2o_co2_emissions_saved=self.ua.soln_pds_direct_n2o_co2_emissions_saved(), soln_pds_new_iunits_reqd=self.ua.soln_pds_new_iunits_reqd(), soln_ref_new_iunits_reqd=self.ua.soln_ref_new_iunits_reqd(), conv_ref_new_iunits=self.ua.conv_ref_new_iunits(), conv_ref_grid_CO2_per_KWh=self.ef.conv_ref_grid_CO2_per_KWh(), conv_ref_grid_CO2eq_per_KWh=self.ef.conv_ref_grid_CO2eq_per_KWh(), soln_net_annual_funits_adopted=soln_net_annual_funits_adopted, fuel_in_liters=False) self.r2s = rrs.RRS(total_energy_demand=ref_tam_per_region.loc[2014, 'World'], soln_avg_annual_use=self.ac.soln_avg_annual_use, conv_avg_annual_use=self.ac.conv_avg_annual_use)