Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions message_ix_models/tools/bilateralize/historical_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,13 @@ def build_historical_price(
)
bacidf["YEAR"] = "broadcast"

# Add costs for piped gas based on LNG prices
bacidf_pg = bacidf[bacidf['MESSAGE COMMODITY'] == 'LNG_shipped'].copy()
bacidf_pg['MESSAGE COMMODITY'] = 'gas_piped'
print(bacidf_pg)

bacidf = pd.concat([bacidf, bacidf_pg])

outdf = reformat_to_parameter(
indf=bacidf,
message_regions=message_regions,
Expand All @@ -860,7 +867,8 @@ def build_historical_price(

outdf["value"] = outdf["value"] * 0.50 # TODO: Fix this deflator (2024-2005?)
outdf["value"] = round(outdf["value"], 0)

print(outdf)

return outdf


Expand Down Expand Up @@ -932,4 +940,4 @@ def build_hist_new_capacity_flow(
imodf = imodf[["node_loc", "technology", "year_vtg", "value", "unit"]]
imodf = imodf[imodf["node_loc"] != ""]

return imodf
return imodf
8 changes: 4 additions & 4 deletions message_ix_models/tools/bilateralize/prepare_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1342,10 +1342,10 @@ def prepare_edit_files(
costdf["technology"] = costdf["technology"].str.replace("ethanol_", "eth_")
costdf["technology"] = costdf["technology"].str.replace("fueloil_", "foil_")

for tec in [i for i in covered_tec if i != "gas_piped"]:
for tec in covered_tec: #[i for i in covered_tec if i != "gas_piped"]:
log.info("Add fix cost for " + tec)

if "piped" in tec:
if "piped" in tec and tec != 'gas_piped':
tec_shipped = tec.replace("piped", "shipped")
add_df = costdf[costdf["technology"].str.contains(tec_shipped)].copy()
add_df["technology"] = add_df["technology"].str.replace(
Expand Down Expand Up @@ -1383,7 +1383,7 @@ def prepare_edit_files(
add_df["value"] = np.where(
add_df["value"].isnull(), mean_cost, add_df["value"]
)
add_df["value"] = round(add_df["value"] / 5, 0)
add_df["value"] = round(add_df["value"], 0)

add_df["unit"] = "USD/GWa"

Expand All @@ -1401,4 +1401,4 @@ def prepare_edit_files(
)
add_df.to_csv(
os.path.join(data_path, tec, "bare_files", "fix_cost.csv"), index=False
)
)
Loading