gas_input: use HTTP remote, rename conversion factors, fix undesired rule removal
This commit is contained in:
parent
963e7cdbcf
commit
ece64a73c1
11
Snakefile
11
Snakefile
@ -129,6 +129,12 @@ if config["sector"]["gas_network"] or config["sector"]["H2_retrofit"]:
|
|||||||
"IGGIELGN_PipeSegments.geojson",
|
"IGGIELGN_PipeSegments.geojson",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
rule retrieve_gas_infrastructure_data:
|
||||||
|
output: expand("data/gas_network/scigrid-gas/data/{files}", files=datafiles)
|
||||||
|
script: 'scripts/retrieve_gas_infrastructure_data.py'
|
||||||
|
|
||||||
|
|
||||||
rule build_gas_network:
|
rule build_gas_network:
|
||||||
input:
|
input:
|
||||||
gas_network="data/gas_network/scigrid-gas/data/IGGIELGN_PipeSegments.geojson"
|
gas_network="data/gas_network/scigrid-gas/data/IGGIELGN_PipeSegments.geojson"
|
||||||
@ -137,13 +143,10 @@ if config["sector"]["gas_network"] or config["sector"]["H2_retrofit"]:
|
|||||||
resources: mem_mb=4000
|
resources: mem_mb=4000
|
||||||
script: "scripts/build_gas_network.py"
|
script: "scripts/build_gas_network.py"
|
||||||
|
|
||||||
rule retrieve_gas_input_locations:
|
|
||||||
output: "data/gas_network/Europe-Gas-Tracker-August-2022.geojson"
|
|
||||||
script: 'scripts/retrieve_gas_input_locations.py'
|
|
||||||
|
|
||||||
rule build_gas_input_locations:
|
rule build_gas_input_locations:
|
||||||
input:
|
input:
|
||||||
lng="https://globalenergymonitor.org/wp-content/uploads/2022/09/Europe-Gas-Tracker-August-2022.xlsx",
|
lng=HTTP.remote("https://globalenergymonitor.org/wp-content/uploads/2022/09/Europe-Gas-Tracker-August-2022.xlsx", keep_local=True),
|
||||||
entry="data/gas_network/scigrid-gas/data/IGGIELGN_BorderPoints.geojson",
|
entry="data/gas_network/scigrid-gas/data/IGGIELGN_BorderPoints.geojson",
|
||||||
production="data/gas_network/scigrid-gas/data/IGGIELGN_Productions.geojson",
|
production="data/gas_network/scigrid-gas/data/IGGIELGN_Productions.geojson",
|
||||||
regions_onshore=pypsaeur("resources/regions_onshore_elec_s{simpl}_{clusters}.geojson"),
|
regions_onshore=pypsaeur("resources/regions_onshore_elec_s{simpl}_{clusters}.geojson"),
|
||||||
|
@ -18,28 +18,30 @@ def read_scigrid_gas(fn):
|
|||||||
df.drop(["param", "uncertainty", "method"], axis=1, inplace=True)
|
df.drop(["param", "uncertainty", "method"], axis=1, inplace=True)
|
||||||
return df
|
return df
|
||||||
|
|
||||||
def retrieve_gem_lng_data(lng_url):
|
|
||||||
df = pd.read_excel(lng_url,storage_options={'User-Agent': 'Mozilla/5.0'}, sheet_name = 'LNG terminals - data')
|
def build_gem_lng_data(lng_fn):
|
||||||
|
df = pd.read_excel(lng_fn[0], sheet_name='LNG terminals - data')
|
||||||
df = df.set_index("ComboID")
|
df = df.set_index("ComboID")
|
||||||
|
|
||||||
remove_status = ['Cancelled']
|
remove_status = ['Cancelled']
|
||||||
remove_country = ['Cyprus','Turkey']
|
remove_country = ['Cyprus','Turkey']
|
||||||
remove_terminal = ['Puerto de la Luz LNG Terminal','Gran Canaria LNG Terminal']
|
remove_terminal = ['Puerto de la Luz LNG Terminal', 'Gran Canaria LNG Terminal']
|
||||||
|
|
||||||
df = df.query("Status != 'Cancelled' \
|
df = df.query("Status != 'Cancelled' \
|
||||||
& Country != @remove_country \
|
& Country != @remove_country \
|
||||||
& TerminalName != @remove_terminal \
|
& TerminalName != @remove_terminal \
|
||||||
& CapacityInMtpa != '--'")
|
& CapacityInMtpa != '--'")
|
||||||
|
|
||||||
|
df.CapacityInMtpa = df.CapacityInMtpa.astype(float)
|
||||||
|
|
||||||
geometry = gpd.points_from_xy(df['Longitude'], df['Latitude'])
|
geometry = gpd.points_from_xy(df['Longitude'], df['Latitude'])
|
||||||
return gpd.GeoDataFrame(df, geometry=geometry, crs="EPSG:4326")
|
return gpd.GeoDataFrame(df, geometry=geometry, crs="EPSG:4326")
|
||||||
|
|
||||||
|
|
||||||
def build_gas_input_locations(lng_url, entry_fn, prod_fn, countries):
|
def build_gas_input_locations(lng_fn, entry_fn, prod_fn, countries):
|
||||||
|
|
||||||
# LNG terminals
|
# LNG terminals
|
||||||
lng = retrieve_gem_lng_data(lng_url)
|
lng = build_gem_lng_data(lng_fn)
|
||||||
lng.CapacityInMtpa = lng.CapacityInMtpa.astype(float)
|
|
||||||
|
|
||||||
# Entry points from outside the model scope
|
# Entry points from outside the model scope
|
||||||
entry = read_scigrid_gas(entry_fn)
|
entry = read_scigrid_gas(entry_fn)
|
||||||
@ -58,11 +60,11 @@ def build_gas_input_locations(lng_url, entry_fn, prod_fn, countries):
|
|||||||
(prod.country_code != "DE")
|
(prod.country_code != "DE")
|
||||||
]
|
]
|
||||||
|
|
||||||
conversion_factor = 437.5 # MCM/day to MWh/h
|
mcm_per_day_to_mw = 437.5 # MCM/day to MWh/h
|
||||||
conversion_factor_lng = 1649.224 # mtpa to MWh/h
|
mtpa_to_mw = 1649.224 # mtpa to MWh/h
|
||||||
lng["p_nom"] = lng["CapacityInMtpa"] * conversion_factor_lng
|
lng["p_nom"] = lng["CapacityInMtpa"] * mtpa_to_mw
|
||||||
entry["p_nom"] = entry["max_cap_from_to_M_m3_per_d"] * conversion_factor
|
entry["p_nom"] = entry["max_cap_from_to_M_m3_per_d"] * mcm_per_day_to_mw
|
||||||
prod["p_nom"] = prod["max_supply_M_m3_per_d"] * conversion_factor
|
prod["p_nom"] = prod["max_supply_M_m3_per_d"] * mcm_per_day_to_mw
|
||||||
|
|
||||||
lng["type"] = "lng"
|
lng["type"] = "lng"
|
||||||
entry["type"] = "pipeline"
|
entry["type"] = "pipeline"
|
||||||
@ -78,7 +80,7 @@ if __name__ == "__main__":
|
|||||||
if 'snakemake' not in globals():
|
if 'snakemake' not in globals():
|
||||||
from helper import mock_snakemake
|
from helper import mock_snakemake
|
||||||
snakemake = mock_snakemake(
|
snakemake = mock_snakemake(
|
||||||
'build_gas_import_locations',
|
'build_gas_input_locations',
|
||||||
simpl='',
|
simpl='',
|
||||||
clusters='37',
|
clusters='37',
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user