Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve filename consistency in the sources #178

Closed
wants to merge 10 commits into from
2 changes: 2 additions & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Upcoming Release

* Align `snakemake` version and the related `mock_snakemake` to PyPSA-Eur (https://github.com/PyPSA/technology-data/pull/177)

* Improve filename consistency in the sources (https://github.com/PyPSA/technology-data/pull/178)

* Include further unit tests for compile_cost_assumptions_usa.py (https://github.com/PyPSA/technology-data/pull/182)

* Updates the documentation with compile_cost_assumptions_usa.py (https://github.com/PyPSA/technology-data/pull/186)
Expand Down
672 changes: 336 additions & 336 deletions outputs/US/costs_2020.csv

Large diffs are not rendered by default.

672 changes: 336 additions & 336 deletions outputs/US/costs_2025.csv

Large diffs are not rendered by default.

672 changes: 336 additions & 336 deletions outputs/US/costs_2030.csv

Large diffs are not rendered by default.

672 changes: 336 additions & 336 deletions outputs/US/costs_2035.csv

Large diffs are not rendered by default.

672 changes: 336 additions & 336 deletions outputs/US/costs_2040.csv

Large diffs are not rendered by default.

672 changes: 336 additions & 336 deletions outputs/US/costs_2045.csv

Large diffs are not rendered by default.

672 changes: 336 additions & 336 deletions outputs/US/costs_2050.csv

Large diffs are not rendered by default.

698 changes: 349 additions & 349 deletions outputs/costs_2020.csv

Large diffs are not rendered by default.

698 changes: 349 additions & 349 deletions outputs/costs_2025.csv

Large diffs are not rendered by default.

698 changes: 349 additions & 349 deletions outputs/costs_2030.csv

Large diffs are not rendered by default.

698 changes: 349 additions & 349 deletions outputs/costs_2035.csv

Large diffs are not rendered by default.

698 changes: 349 additions & 349 deletions outputs/costs_2040.csv

Large diffs are not rendered by default.

698 changes: 349 additions & 349 deletions outputs/costs_2045.csv

Large diffs are not rendered by default.

698 changes: 349 additions & 349 deletions outputs/costs_2050.csv

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions scripts/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# coding: utf-8

import logging
import os
import re
import sys
from pathlib import Path
Expand Down Expand Up @@ -64,6 +65,12 @@ def __dir__(self):
return dict_keys + obj_attrs


def get_relative_fn(fn):
if isinstance(fn, str):
fn = Path(fn).resolve()
return fn.relative_to(os.path.commonpath([fn, os.getcwd()]))


def mock_snakemake(
rulename,
root_dir=None,
Expand Down
13 changes: 9 additions & 4 deletions scripts/compile_cost_assumptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@

import numpy as np
import pandas as pd
from _helpers import adjust_for_inflation, configure_logging, mock_snakemake
from _helpers import (
adjust_for_inflation,
configure_logging,
get_relative_fn,
mock_snakemake,
)
from currency_converter import ECB_URL, CurrencyConverter
from scipy import interpolate

Expand Down Expand Up @@ -428,7 +433,7 @@ def get_dea_maritime_data(
df.loc[df_i, "unit"] = df.loc[df_i, "unit"].str.replace("GJ", "MWh")

# add source + cost year
df["source"] = f"Danish Energy Agency, {fn}"
df["source"] = f"Danish Energy Agency, {get_relative_fn(fn)}"
# cost year is 2023 p.10
df["currency_year"] = 2023
# add sheet name
Expand Down Expand Up @@ -552,7 +557,7 @@ def get_dea_vehicle_data(
df.loc["Upfront vehicle cost", "unit"] += "/vehicle"

# add source + cost year
df["source"] = f"Danish Energy Agency, {fn}"
df["source"] = f"Danish Energy Agency, {get_relative_fn(fn)}"
# cost year is 2022 p.12
df["currency_year"] = 2022
# add sheet name
Expand Down Expand Up @@ -982,7 +987,7 @@ def get_data_DEA(
# if year-specific data is missing and not fixed by interpolation fill forward with same values
df_final = df_final.ffill(axis=1)

df_final["source"] = source_dict["DEA"] + ", " + excel_file.replace("inputs/", "")
df_final["source"] = f"{source_dict['DEA']}, {get_relative_fn(excel_file)}"
if (
tech_name in cost_year_2020
and ("for_carbon_capture_transport_storage" not in excel_file)
Expand Down