Skip to content

Commit

Permalink
Merge pull request #398 from GermanZero-de/year_baseline_2
Browse files Browse the repository at this point in the history
entries: rename m_year_today -> m_year_baseline
  • Loading branch information
Jeniffere authored Jul 22, 2024
2 parents 471dd61 + d2b73eb commit 2055bf0
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 17 deletions.
9 changes: 6 additions & 3 deletions commands/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
from climatevision.generator.years import (
YEAR_REF_DEFAULT,
YEAR_REF_CHOICES,
YEAR_REF_HELP,
YEAR_BASELINE_DEFAULT,
YEAR_BASELINE_CHOICES,
YEAR_BASELINE_HELP,
YEAR_TARGET_DEFAULT,
YEAR_TARGET_CHOICES,
YEAR_TARGET_HELP,
)


Expand All @@ -20,7 +23,7 @@ def add_year_ref_argument(parser: Any):
type=int,
default=YEAR_REF_DEFAULT,
choices=YEAR_REF_CHOICES,
help="year of the reference data",
help=YEAR_REF_HELP,
)


Expand All @@ -30,7 +33,7 @@ def add_year_baseline_argument(parser: Any):
type=int,
default=YEAR_BASELINE_DEFAULT,
choices=YEAR_BASELINE_CHOICES,
help="the baseline year should nearly be the current year - it represents the year which separates the past (based on reference data) and the future (where the path to CO2 neutrality starts)",
help=YEAR_BASELINE_HELP,
)


Expand All @@ -40,7 +43,7 @@ def add_year_target_argument(parser: Any):
type=int,
default=YEAR_TARGET_DEFAULT,
choices=YEAR_TARGET_CHOICES,
help="target year",
help=YEAR_TARGET_HELP,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,15 +636,17 @@ def make_entry(ags: str, year: int):
currentDateTime = datetime.datetime.now()
date = currentDateTime.date()

entry["In_M_year_today"] = 2022 # int(date.strftime("%Y"))
entry["In_M_year_baseline"] = 2022 # int(date.strftime("%Y"))

entry["In_M_AGS_com"] = ags
entry["In_M_AGS_dis"] = ags_dis
entry["In_M_AGS_sta"] = ags_sta

entry["In_M_year_target"] = year

entry["In_M_duration_target"] = entry["In_M_year_target"] - entry["In_M_year_today"]
entry["In_M_duration_target"] = (
entry["In_M_year_target"] - entry["In_M_year_baseline"]
)
entry["In_M_duration_target_until_2050"] = 2050 - entry["In_M_year_target"]
entry["In_M_duration_neutral"] = float(
entry["In_M_duration_target_until_2050"] + entry["In_M_duration_target"] / 2
Expand Down
8 changes: 4 additions & 4 deletions src/climatevision/generator/entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,16 @@ class Entries:
m_area_water_com: float
m_area_wood_com: float
m_duration_neutral: float # duration of CO2 neutrality in years until 2050
m_duration_target: int # duration from today until target year
m_duration_target: int # duration from baseline until target year
m_nonCO2_budget_2016_to_year_target: float
m_population_com_2018: int # population of commune in 2018
m_population_com_203X: int
m_population_dis: int # population of district in 2018
m_population_nat: int # population of germany in 2018
m_population_sta: int # population of state in 2018
m_year_target: int
m_year_today: int
m_year_ref: int # reference year for data (i.e RefData.year_ref() )
m_year_target: int # see years.py
m_year_baseline: int # see years.py
m_year_ref: int # see years.py (i.e RefData.year_ref() )
r_area_m2: float
r_area_m2_1flat: float
r_area_m2_2flat: float
Expand Down
12 changes: 7 additions & 5 deletions src/climatevision/generator/makeentries.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ def make_entries(
m_AGS_dis = ags_dis
m_AGS_sta = ags_sta

m_year_today = year_baseline
m_year_baseline = year_baseline
m_year_target = year_target
m_year_ref = data.year_ref()

m_duration_target = m_year_target - m_year_today
duration_baseline_until_target = m_year_target - m_year_baseline
duration_target_until_2050 = 2050 - m_year_target
m_duration_neutral = float(duration_target_until_2050 + m_duration_target / 2)
m_duration_neutral = float(
duration_target_until_2050 + duration_baseline_until_target / 2
)

m_population_com_2018 = data.population(ags).int("total")
m_population_com_203X = m_population_com_2018
Expand Down Expand Up @@ -680,15 +682,15 @@ def compute_efactor_from_n2o(
m_area_water_com=m_area_water_com,
m_area_wood_com=m_area_wood_com,
m_duration_neutral=m_duration_neutral,
m_duration_target=m_duration_target,
m_duration_target=duration_baseline_until_target,
m_nonCO2_budget_2016_to_year_target=m_nonCO2_budget_2016_to_year_target,
m_population_com_2018=m_population_com_2018,
m_population_com_203X=m_population_com_203X,
m_population_dis=m_population_dis,
m_population_nat=m_population_nat,
m_population_sta=m_population_sta,
m_year_target=m_year_target,
m_year_today=m_year_today,
m_year_baseline=m_year_baseline,
m_year_ref=m_year_ref,
r_area_m2=r_area_m2,
r_area_m2_1flat=r_area_m2_1flat,
Expand Down
2 changes: 1 addition & 1 deletion src/climatevision/generator/methodology183x.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def calc_budget(
### beginning with LULUCF ###
################################################
start_year = 2015
current_year = entries.m_year_today
current_year = entries.m_year_baseline
year_ref = entries.m_year_ref

years_list = list(range(start_year, current_year))
Expand Down
3 changes: 3 additions & 0 deletions src/climatevision/generator/years.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
YEAR_REF_DEFAULT = 2018
YEAR_REF_CHOICES = [2018, 2021]
YEAR_REF_HELP = "year of the reference data"

YEAR_BASELINE_DEFAULT = 2022
YEAR_BASELINE_CHOICES = [2022]
YEAR_BASELINE_HELP = "the baseline year should nearly be the current year - it represents the year which separates the past (based on reference data) and the future (where the path to CO2 neutrality starts)"

YEAR_TARGET_DEFAULT = 2035
YEAR_TARGET_CHOICES = range(2025, 2051)
YEAR_TARGET_HELP = "target year"
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"m_population_nat": 83019213,
"m_population_sta": 7982448,
"m_year_target": 2035,
"m_year_today": 2022,
"m_year_baseline": 2022,
"m_year_ref": 2018,
"r_area_m2": 5125600.0,
"r_area_m2_1flat": 1238094.45,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"m_population_nat": 83019213,
"m_population_sta": 7982448,
"m_year_target": 2035,
"m_year_today": 2022,
"m_year_baseline": 2022,
"m_year_ref": 2021,
"r_area_m2": 5125600.0,
"r_area_m2_1flat": 1238094.45,
Expand Down

0 comments on commit 2055bf0

Please sign in to comment.