resolve cherry merge conflict 1

This commit is contained in:
Fabian Neumann 2022-03-28 12:02:08 +02:00
parent 1fd6a685ab
commit 7a52b6bc45
2 changed files with 28 additions and 5 deletions

View File

@ -50,7 +50,7 @@ if config['enable'].get('prepare_links_p_nom', False):
datafiles = ['ch_cantons.csv', 'je-e-21.03.02.xls',
'eez/World_EEZ_v8_2014.shp', 'EIA_hydro_generation_2000_2014.csv',
'eez/World_EEZ_v8_2014.shp',
'hydro_capacities.csv', 'naturalearth/ne_10m_admin_0_countries.shp',
'NUTS_2013_60M_SH/data/NUTS_RG_60M_2013.shp', 'nama_10r_3popgdp.tsv.gz',
'nama_10r_3gdp.tsv.gz', 'corine/g250_clc06_V18_5.tif']
@ -208,7 +208,7 @@ rule build_renewable_profiles:
rule build_hydro_profile:
input:
country_shapes='resources/country_shapes.geojson',
eia_hydro_generation='data/bundle/EIA_hydro_generation_2000_2014.csv',
eia_hydro_generation='data/eia_hydro_annual_generation.csv',
cutout=f"cutouts/{config['renewable']['hydro']['cutout']}.nc" if "hydro" in config["renewable"] else "config['renewable']['hydro']['cutout'] not configured",
output: 'resources/profile_hydro.nc'
log: "logs/build_hydro_profile.log"

View File

@ -64,7 +64,29 @@ from _helpers import configure_logging
import atlite
import geopandas as gpd
from vresutils import hydro as vhydro
import pandas as pd
import country_converter as coco
cc = coco.CountryConverter()
def get_eia_annual_hydro_generation(fn, countries):
# in billion kWh/a = TWh/a
df = pd.read_csv(fn, skiprows=2, index_col=1, na_values=[u' ','--']).iloc[1:, 1:]
df.index = df.index.str.strip()
df.loc["Germany"] = df.filter(like='Germany', axis=0).sum()
df.loc["Serbia"] += df.loc["Kosovo"]
df = df.loc[~df.index.str.contains('Former')]
df.index = cc.convert(df.index, to='iso2')
df.index.name = 'countries'
df = df.T[countries] * 1e6 # in MWh/a
return df
logger = logging.getLogger(__name__)
@ -82,8 +104,9 @@ if __name__ == "__main__":
.set_index('name')['geometry'].reindex(countries))
country_shapes.index.name = 'countries'
eia_stats = vhydro.get_eia_annual_hydro_generation(
snakemake.input.eia_hydro_generation).reindex(columns=countries)
fn = snakemake.input.eia_hydro_generation
eia_stats = get_eia_annual_hydro_generation(fn, countries)
inflow = cutout.runoff(shapes=country_shapes,
smooth=True,
lower_threshold_quantile=True,