add script for retrieving lng terminals
This commit is contained in:
parent
01f48a50e7
commit
d37cd49f7d
@ -128,10 +128,13 @@ 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="data/gas_network/Europe-Gas-Tracker-August-2022.xlsx",
|
lng="data/gas_network/Europe-Gas-Tracker-August-2022.geojson",
|
||||||
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,34 +18,10 @@ 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 read_lng_gem(fn):
|
|
||||||
df = pd.read_excel(fn, sheet_name = 'LNG terminals - data')
|
|
||||||
df = df.set_index("ComboID")
|
|
||||||
|
|
||||||
remove_status = ['Cancelled']
|
|
||||||
remove_country = ['Cyprus','Turkey']
|
|
||||||
remove_terminal = ['Puerto de la Luz LNG Terminal','Gran Canaria LNG Terminal']
|
|
||||||
|
|
||||||
for index in df.index:
|
|
||||||
if df.Status[index] in remove_status:
|
|
||||||
df = df.drop([index])
|
|
||||||
elif df.Country[index] in remove_country:
|
|
||||||
df = df.drop([index])
|
|
||||||
elif df.TerminalName[index] in remove_terminal:
|
|
||||||
df = df.drop([index])
|
|
||||||
elif df.CapacityInMtpa[index] == "--":
|
|
||||||
df = df.drop([index])
|
|
||||||
else:
|
|
||||||
continue
|
|
||||||
|
|
||||||
geometry = gpd.points_from_xy(df['Longitude'], df['Latitude'])
|
|
||||||
gdf = gpd.GeoDataFrame(df, geometry=geometry, crs="EPSG:4326")
|
|
||||||
return gdf
|
|
||||||
|
|
||||||
def build_gas_input_locations(lng_fn, entry_fn, prod_fn, countries):
|
def build_gas_input_locations(lng_fn, entry_fn, prod_fn, countries):
|
||||||
|
|
||||||
# LNG terminals
|
# LNG terminals
|
||||||
lng = read_lng_gem(lng_fn)
|
lng = gpd.read_file(lng_fn)
|
||||||
|
|
||||||
# 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)
|
||||||
|
50
scripts/retrieve_gas_input_locations.py
Normal file
50
scripts/retrieve_gas_input_locations.py
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
"""
|
||||||
|
Retrieve gas infrastructure data fro
|
||||||
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
from helper import progress_retrieve
|
||||||
|
|
||||||
|
import zipfile
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if 'snakemake' not in globals():
|
||||||
|
from helper import mock_snakemake
|
||||||
|
snakemake = mock_snakemake('retrieve_gas_network_data')
|
||||||
|
rootpath = '..'
|
||||||
|
else:
|
||||||
|
rootpath = '.'
|
||||||
|
|
||||||
|
# LNG terminals
|
||||||
|
|
||||||
|
lng_url="https://globalenergymonitor.org/wp-content/uploads/2022/09/Europe-Gas-Tracker-August-2022.xlsx",
|
||||||
|
|
||||||
|
storage_options = {'User-Agent': 'Mozilla/5.0'}
|
||||||
|
df = pd.read_excel(lng_url, storage_options=storage_options, sheet_name = 'LNG terminals - data')
|
||||||
|
#df = pd.read_excel(fn, sheet_name = 'LNG terminals - data')
|
||||||
|
df = df.set_index("ComboID")
|
||||||
|
|
||||||
|
remove_status = ['Cancelled']
|
||||||
|
remove_country = ['Cyprus','Turkey']
|
||||||
|
remove_terminal = ['Puerto de la Luz LNG Terminal','Gran Canaria LNG Terminal']
|
||||||
|
|
||||||
|
for index in df.index:
|
||||||
|
if df.Status[index] in remove_status:
|
||||||
|
df = df.drop([index])
|
||||||
|
elif df.Country[index] in remove_country:
|
||||||
|
df = df.drop([index])
|
||||||
|
elif df.TerminalName[index] in remove_terminal:
|
||||||
|
df = df.drop([index])
|
||||||
|
elif df.CapacityInMtpa[index] == "--":
|
||||||
|
df = df.drop([index])
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
|
geometry = gpd.points_from_xy(df['Longitude'], df['Latitude'])
|
||||||
|
lng = gpd.GeoDataFrame(df, geometry=geometry, crs="EPSG:4326")
|
||||||
|
|
||||||
|
lng.to_file(snakemake.output[0])
|
Loading…
Reference in New Issue
Block a user