Skip to content

Commit

Permalink
Merge branch 'develop' into integration
Browse files Browse the repository at this point in the history
  • Loading branch information
perrotcap committed Aug 23, 2024
2 parents 5d5109c + f020de0 commit fc6dc30
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,12 @@ def get_post_processing_list(self, chart_filters=None):
chart_list = chart_filter.selected_values
carboncycle_df = self.get_sosdisc_outputs(GlossaryCore.CarbonCycleDfValue)
carboncycle_df = resize_df(carboncycle_df)

years = list(carboncycle_df[GlossaryCore.Years].values)
if 'atmosphere concentration' in chart_list:

#carboncycle_df = discipline.get_sosdisc_outputs(GlossaryCore.CarbonCycleDfValue)
atmo_conc = carboncycle_df['atmo_conc']

years = list(atmo_conc.index)

year_start = years[0]
year_end = years[len(years) - 1]

Expand Down Expand Up @@ -143,8 +141,6 @@ def get_post_processing_list(self, chart_filters=None):
#carboncycle_df = discipline.get_sosdisc_outputs(GlossaryCore.CarbonCycleDfValue)
ppm = carboncycle_df['ppm']

years = list(ppm.index)

year_start = years[0]
year_end = years[len(years) - 1]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def get_post_processing_list(self, chart_filters=None):
chart_list = chart_filter.selected_values
emissions_df = self.get_sosdisc_outputs('emissions_df')
emissions_df = resize_df(emissions_df)
years = list(emissions_df[GlossaryCore.Years].values)

if 'carbon emission' in chart_list:

Expand All @@ -115,8 +116,6 @@ def get_post_processing_list(self, chart_filters=None):

total_emission = emissions_df['total_emissions']

years = list(emissions_df.index)

year_start = years[0]
year_end = years[len(years) - 1]

Expand Down Expand Up @@ -152,8 +151,6 @@ def get_post_processing_list(self, chart_filters=None):

total_emission = emissions_df['total_emissions']

years = list(total_emission.index)

year_start = years[0]
year_end = years[len(years) - 1]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,14 @@ def get_post_processing_list(self, chart_filters=None):
if chart_filter.filter_key == 'charts':
chart_list = chart_filter.selected_values

damage_df = self.get_sosdisc_outputs(GlossaryCore.DamageDfValue)
years = list(damage_df[GlossaryCore.Years].values)
if GlossaryCore.Damages in chart_list:
to_plot = [GlossaryCore.Damages]
damage_df = self.get_sosdisc_outputs(GlossaryCore.DamageDfValue)
damage_df = resize_df(damage_df)

damage = damage_df[GlossaryCore.Damages]

years = list(damage_df.index)

year_start = years[0]
year_end = years[len(years) - 1]

Expand Down Expand Up @@ -169,8 +168,6 @@ def get_post_processing_list(self, chart_filters=None):

abatecost = damage_df['abatecost']

years = list(abate_df.index)

year_start = years[0]
year_end = years[len(years) - 1]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def get_post_processing_list(self, chart_filters=None):

economics_df = self.get_sosdisc_outputs(GlossaryCore.EconomicsDfValue)
economics_df = resize_df(economics_df)
years = list(economics_df[GlossaryCore.Years].values)

if 'economic output' in chart_list:

Expand All @@ -130,7 +131,6 @@ def get_post_processing_list(self, chart_filters=None):
legend = {GlossaryCore.GrossOutput: 'world gross output',
GlossaryCore.OutputNetOfDamage: 'world output net of damage'}

years = list(economics_df.index)

year_start = years[0]
year_end = years[len(years) - 1]
Expand Down Expand Up @@ -165,7 +165,6 @@ def get_post_processing_list(self, chart_filters=None):

to_plot = [GlossaryCore.PopulationValue]

years = list(economics_df.index)

year_start = years[0]
year_end = years[len(years) - 1]
Expand Down Expand Up @@ -200,7 +199,6 @@ def get_post_processing_list(self, chart_filters=None):

to_plot = [GlossaryCore.Productivity]

years = list(economics_df.index)

year_start = years[0]
year_end = years[len(years) - 1]
Expand Down Expand Up @@ -235,7 +233,6 @@ def get_post_processing_list(self, chart_filters=None):

to_plot = [GlossaryCore.Consumption]

years = list(economics_df.index)

year_start = years[0]
year_end = years[len(years) - 1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def get_post_processing_list(self, chart_filters=None):
workforce_df = deepcopy(self.get_sosdisc_outputs(GlossaryCore.WorkforceDfValue))
employment_df = deepcopy(self.get_sosdisc_outputs('employment_df'))
sector_list = self.get_sosdisc_inputs(GlossaryCore.SectorListValue)

years = list(workforce_df[GlossaryCore.Years].values)
# Overload default value with chart filter
if chart_filters is not None:
for chart_filter in chart_filters:
Expand All @@ -161,7 +161,6 @@ def get_post_processing_list(self, chart_filters=None):

if 'employment rate' in chart_list:

years = list(employment_df.index)

year_start = years[0]
year_end = years[len(years) - 1]
Expand All @@ -188,7 +187,6 @@ def get_post_processing_list(self, chart_filters=None):

working_age_pop_df = self.get_sosdisc_inputs(
GlossaryCore.WorkingAgePopulationDfValue)
years = list(workforce_df[GlossaryCore.Years].values)

year_start = years[0]
year_end = years[len(years) - 1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def get_post_processing_list(self, chart_filters=None):
economics_detail_df = deepcopy(self.get_sosdisc_outputs(GlossaryCore.EconomicsDetailDfValue))
inputs_dict = self.get_sosdisc_inputs()
sector_list = inputs_dict[GlossaryCore.SectorListValue]
years = list(economics_detail_df.index)
years = list(economics_detail_df[GlossaryCore.Years].values)
compute_climate_impact_on_gdp = self.get_sosdisc_inputs('assumptions_dict')['compute_climate_impact_on_gdp']
damages_to_productivity = self.get_sosdisc_inputs(GlossaryCore.DamageToProductivity) and compute_climate_impact_on_gdp
damage_detailed_df = self.get_sosdisc_outputs(GlossaryCore.DamageDetailedDfValue)
Expand Down Expand Up @@ -298,7 +298,7 @@ def get_post_processing_list(self, chart_filters=None):
to_plot = [GlossaryCore.Capital, GlossaryCore.UsableCapital]
legend = {GlossaryCore.Capital: 'capital stock',
GlossaryCore.UsableCapital: 'usable capital stock'}
years = list(economics_detail_df.index)
years = list(economics_detail_df[GlossaryCore.Years].values)

chart_name = 'Total capital stock and usable capital'
new_chart = TwoAxesInstanciatedChart(GlossaryCore.Years, 'capital stock [T$]',
Expand Down Expand Up @@ -349,7 +349,7 @@ def get_post_processing_list(self, chart_filters=None):
if 'output growth' in chart_list:

to_plot = [GlossaryCore.OutputGrowth]
years = list(economics_detail_df.index)
years = list(economics_detail_df[GlossaryCore.Years].values)
chart_name = 'Net output growth rate over years'
new_chart = TwoAxesInstanciatedChart(GlossaryCore.Years, ' growth rate [-]',
chart_name=chart_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ def get_post_processing_list(self, chart_filters=None):
compute_climate_impact_on_gdp = self.get_sosdisc_inputs('assumptions_dict')['compute_climate_impact_on_gdp']
damages_to_productivity = self.get_sosdisc_inputs(GlossaryCore.DamageToProductivity) and compute_climate_impact_on_gdp
damage_detailed_df = self.get_sosdisc_outputs(f"{self.sector_name}.{GlossaryCore.DamageDetailedDfValue}")
years = list(production_df[GlossaryCore.Years].values)


if 'sector output' in chart_list:
Expand All @@ -413,7 +414,6 @@ def get_post_processing_list(self, chart_filters=None):
capital_df = self.get_sosdisc_outputs(f"{self.sector_name}.{GlossaryCore.CapitalDfValue}")
first_serie = capital_df[GlossaryCore.Capital]
second_serie = capital_df[GlossaryCore.UsableCapital]
years = list(capital_df.index)

chart_name = 'Productive capital stock and usable capital for production'

Expand Down Expand Up @@ -454,7 +454,6 @@ def get_post_processing_list(self, chart_filters=None):
applied_damages = damage_detailed_df[GlossaryCore.Damages].values
all_damages = damage_detailed_df[GlossaryCore.EstimatedDamages].values

years = list(damage_detailed_df.index)
chart_name = 'Breakdown of damages' + ' (not applied)' * (not compute_climate_impact_on_gdp)

new_chart = TwoAxesInstanciatedChart(GlossaryCore.Years, 'Trillion$2020',
Expand Down Expand Up @@ -482,7 +481,6 @@ def get_post_processing_list(self, chart_filters=None):

if GlossaryCore.Capital in chart_list:
serie = detailed_capital_df[GlossaryCore.Capital]
years = list(detailed_capital_df.index)

chart_name = f'{self.sector_name} capital stock per year'

Expand All @@ -495,7 +493,6 @@ def get_post_processing_list(self, chart_filters=None):
instanciated_charts.append(new_chart)

if GlossaryCore.Workforce in chart_list:
years = list(workforce_df[GlossaryCore.Years])

chart_name = 'Workforce'

Expand All @@ -517,7 +514,6 @@ def get_post_processing_list(self, chart_filters=None):
GlossaryCore.ProductivityWithoutDamage: 'Without damages',
GlossaryCore.ProductivityWithDamage: 'With damages'}
productivity_df = self.get_sosdisc_outputs(GlossaryCore.ProductivityDfValue)
years = list(productivity_df.index)
extra_name = 'damages applied' if damages_to_productivity else 'damages not applied'
chart_name = f'Total Factor Productivity ({extra_name})'

Expand All @@ -539,7 +535,6 @@ def get_post_processing_list(self, chart_filters=None):
if GlossaryCore.EnergyEfficiency in chart_list:

to_plot = [GlossaryCore.EnergyEfficiency]
years = list(detailed_capital_df.index)
chart_name = 'Capital energy efficiency over the years'

new_chart = TwoAxesInstanciatedChart(GlossaryCore.Years, 'Capital energy efficiency [-]',
Expand All @@ -557,7 +552,6 @@ def get_post_processing_list(self, chart_filters=None):
if 'output growth' in chart_list:

to_plot = ['net_output_growth_rate']
years = list(growth_rate_df.index)
chart_name = 'Net output growth rate over years'
new_chart = TwoAxesInstanciatedChart(GlossaryCore.Years, ' growth rate [-]',
chart_name=chart_name)
Expand All @@ -574,7 +568,6 @@ def get_post_processing_list(self, chart_filters=None):
lt_energy_eff = self.get_sosdisc_outputs('longterm_energy_efficiency')
to_plot = [GlossaryCore.EnergyEfficiency]

years = list(lt_energy_eff[GlossaryCore.Years])

chart_name = 'Capital energy efficiency over the years'

Expand All @@ -596,7 +589,6 @@ def get_post_processing_list(self, chart_filters=None):
if GlossaryCore.SectionGdpPart in chart_list:
sections_gdp = self.get_sosdisc_outputs(f"{self.sector_name}.{GlossaryCore.SectionGdpDfValue}")
sections_gdp = sections_gdp.drop('years', axis=1)
years = list(production_df.index)

chart_name = f'Breakdown of GDP per section for {self.sector_name} sector [T$]'

Expand Down Expand Up @@ -624,7 +616,6 @@ def get_post_processing_list(self, chart_filters=None):
if GlossaryCore.SectionEnergyConsumptionPart in chart_list:
sections_energy_consumption = self.get_sosdisc_outputs(f"{self.sector_name}.{GlossaryCore.SectionEnergyConsumptionDfValue}")
sections_energy_consumption = sections_energy_consumption.drop('years', axis=1)
years = list(production_df.index)

chart_name = f'Breakdown of energy consumption per section for {self.sector_name} sector'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,15 @@ def get_post_processing_list(self, chart_filters=None):
if chart_filter.filter_key == 'charts':
chart_list = chart_filter.selected_values

utility_df = deepcopy(self.get_sosdisc_outputs(GlossaryCore.UtilityDfValue))
years = list(utility_df[GlossaryCore.Years].values)

if 'Utility' in chart_list:

to_plot = [GlossaryCore.DiscountedUtility]
utility_df = deepcopy(self.get_sosdisc_outputs(GlossaryCore.UtilityDfValue))

discounted_utility = utility_df[GlossaryCore.DiscountedUtility]

years = list(utility_df.index)

year_start = years[0]
year_end = years[len(years) - 1]

Expand Down Expand Up @@ -346,7 +346,6 @@ def get_post_processing_list(self, chart_filters=None):

utility = utility_df[GlossaryCore.PeriodUtilityPerCapita]

years = list(utility_df.index)

year_start = years[0]
year_end = years[len(years) - 1]
Expand Down Expand Up @@ -391,11 +390,6 @@ def get_post_processing_list(self, chart_filters=None):

energy_price_ratio = energy_price_ref / energy_mean_price

years = list(utility_df.index)

year_start = years[0]
year_end = years[len(years) - 1]

chart_name = 'Energy ratios'

new_chart = TwoAxesInstanciatedChart(GlossaryCore.Years, '',
Expand Down Expand Up @@ -441,11 +435,6 @@ def get_post_processing_list(self, chart_filters=None):

discounted_utility_price_ratio = discounted_utility_final / residential_energy_ratio

years = list(utility_df.index)

year_start = years[0]
year_end = years[len(years) - 1]

chart_name = 'Energy price ratio effect on discounted utility'

new_chart = TwoAxesInstanciatedChart(GlossaryCore.Years, 'Discounted Utility (trill $)',
Expand Down Expand Up @@ -473,7 +462,6 @@ def get_post_processing_list(self, chart_filters=None):

to_plot = [GlossaryCore.Consumption]
utility_df = deepcopy(self.get_sosdisc_outputs('utility_detail_df'))
years = list(utility_df.index)

year_start = years[0]
year_end = years[len(years) - 1]
Expand Down Expand Up @@ -504,7 +492,6 @@ def get_post_processing_list(self, chart_filters=None):

to_plot = [GlossaryCore.PerCapitaConsumption]
utility_df = deepcopy(self.get_sosdisc_outputs('utility_detail_df'))
years = list(utility_df.index)

year_start = years[0]
year_end = years[len(years) - 1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,12 @@ def get_post_processing_list(self, chart_filters=None):
if chart_filter.filter_key == 'charts':
chart_list = chart_filter.selected_values
ghg_cycle_df = deepcopy(self.get_sosdisc_outputs('ghg_cycle_df_detailed'))
years = list(ghg_cycle_df[GlossaryCore.Years].values)
global_warming_potential_df = self.get_sosdisc_outputs(GlossaryCore.GlobalWarmingPotentialdDfValue)

if 'Atmospheric concentrations' in chart_list:

ppm = ghg_cycle_df[GlossaryCore.CO2Concentration]
years = list(ppm.index)
chart_name = 'CO2 atmospheric concentrations [ppm]'
year_start = years[0]
year_end = years[len(years) - 1]
Expand Down Expand Up @@ -309,7 +309,6 @@ def get_post_processing_list(self, chart_filters=None):
instanciated_charts.append(new_chart)

ppm = ghg_cycle_df[GlossaryCore.CH4Concentration]
years = list(ppm.index)
chart_name = 'CH4 atmospheric concentrations [ppb]'
new_chart = TwoAxesInstanciatedChart(GlossaryCore.Years, 'parts per billion',
chart_name=chart_name)
Expand All @@ -329,7 +328,6 @@ def get_post_processing_list(self, chart_filters=None):
instanciated_charts.append(new_chart)

ppm = ghg_cycle_df[GlossaryCore.N2OConcentration]
years = list(ppm.index)
chart_name = 'N2O atmospheric concentrations [ppb]'
new_chart = TwoAxesInstanciatedChart(GlossaryCore.Years, 'parts per billion',
chart_name=chart_name)
Expand All @@ -349,7 +347,6 @@ def get_post_processing_list(self, chart_filters=None):
instanciated_charts.append(new_chart)

if GlossaryCore.ExtraCO2EqSincePreIndustrialValue in chart_list:
years = list(ghg_cycle_df[GlossaryCore.Years].values)
chart_name = GlossaryCore.ExtraCO2EqSincePreIndustrialValue

new_chart = TwoAxesInstanciatedChart(GlossaryCore.Years, GlossaryCore.ExtraCO2EqSincePreIndustrialDf['unit'],
Expand All @@ -371,7 +368,6 @@ def get_post_processing_list(self, chart_filters=None):
instanciated_charts.append(new_chart)

if GlossaryCore.GlobalWarmingPotentialdDfValue in chart_list:
years = list(global_warming_potential_df[GlossaryCore.Years].values)
gwp_pre_indus = self.get_sosdisc_outputs('pre_indus_gwp_20')
chart_name = f"{GlossaryCore.GlobalWarmingPotentialdDfValue} {GlossaryCore.YearBasis20}"

Expand All @@ -397,7 +393,6 @@ def get_post_processing_list(self, chart_filters=None):
instanciated_charts.append(new_chart)

if GlossaryCore.GlobalWarmingPotentialdDfValue in chart_list:
years = list(global_warming_potential_df[GlossaryCore.Years].values)
gwp_pre_indus = self.get_sosdisc_outputs('pre_indus_gwp_100')
chart_name = f"{GlossaryCore.GlobalWarmingPotentialdDfValue} {GlossaryCore.YearBasis100}"

Expand Down
Loading

0 comments on commit fc6dc30

Please sign in to comment.