combine time selection with weather year
This commit is contained in:
parent
fa66c50dc1
commit
8055e45b68
@ -12,7 +12,7 @@ configfile: "config.yaml"
|
||||
|
||||
|
||||
wildcard_constraints:
|
||||
weather_year="[0-9]*",
|
||||
weather_year="[0-9]{4}|",
|
||||
lv="[a-z0-9\.]+",
|
||||
simpl="[a-zA-Z0-9]*",
|
||||
clusters="[0-9]+m?",
|
||||
@ -68,6 +68,7 @@ if config.get('retrieve_sector_databundle', True):
|
||||
|
||||
rule build_population_layouts:
|
||||
input:
|
||||
cutout=pypsaeur("cutouts/" + snakemake.config['atlite']['cutout'] + ".nc"),
|
||||
nuts3_shapes=pypsaeur('resources/nuts3_shapes.geojson'),
|
||||
urban_percent="data/urban_percent.csv"
|
||||
output:
|
||||
@ -82,6 +83,7 @@ rule build_population_layouts:
|
||||
|
||||
rule build_clustered_population_layouts:
|
||||
input:
|
||||
cutout=pypsaeur("cutouts/" + snakemake.config['atlite']['cutout'] + ".nc"),
|
||||
pop_layout_total="resources/pop_layout_total{weather_year}.nc",
|
||||
pop_layout_urban="resources/pop_layout_urban{weather_year}.nc",
|
||||
pop_layout_rural="resources/pop_layout_rural{weather_year}.nc",
|
||||
@ -163,6 +165,7 @@ else:
|
||||
|
||||
rule build_heat_demands:
|
||||
input:
|
||||
cutout=pypsaeur("cutouts/" + snakemake.config['atlite']['cutout'] + ".nc"),
|
||||
pop_layout_total="resources/pop_layout_total{weather_year}.nc",
|
||||
pop_layout_urban="resources/pop_layout_urban{weather_year}.nc",
|
||||
pop_layout_rural="resources/pop_layout_rural{weather_year}.nc",
|
||||
@ -178,6 +181,7 @@ rule build_heat_demands:
|
||||
|
||||
rule build_temperature_profiles:
|
||||
input:
|
||||
cutout=pypsaeur("cutouts/" + snakemake.config['atlite']['cutout'] + ".nc"),
|
||||
pop_layout_total="resources/pop_layout_total{weather_year}.nc",
|
||||
pop_layout_urban="resources/pop_layout_urban{weather_year}.nc",
|
||||
pop_layout_rural="resources/pop_layout_rural{weather_year}.nc",
|
||||
@ -216,6 +220,7 @@ rule build_cop_profiles:
|
||||
|
||||
rule build_solar_thermal_profiles:
|
||||
input:
|
||||
cutout=pypsaeur("cutouts/" + snakemake.config['atlite']['cutout'] + ".nc"),
|
||||
pop_layout_total="resources/pop_layout_total{weather_year}.nc",
|
||||
pop_layout_urban="resources/pop_layout_urban{weather_year}.nc",
|
||||
pop_layout_rural="resources/pop_layout_rural{weather_year}.nc",
|
||||
|
@ -66,7 +66,8 @@ snapshots:
|
||||
closed: left # end is not inclusive
|
||||
|
||||
atlite:
|
||||
cutout: ../pypsa-eur/cutouts/europe-2013-era5.nc
|
||||
cutout: europe-era5-{weather_year}
|
||||
drop_leap_day: false
|
||||
|
||||
# this information is NOT used but needed as an argument for
|
||||
# pypsa-eur/scripts/add_electricity.py/load_costs in make_summary.py
|
||||
|
@ -15,10 +15,10 @@ if __name__ == '__main__':
|
||||
clusters=48,
|
||||
)
|
||||
|
||||
cutout_name = snakemake.input.cutout
|
||||
year = snakemake.wildcards.weather_year
|
||||
cutout_config = snakemake.config['atlite']['cutout']
|
||||
if year: cutout_name = cutout_config.format(weather_year=year)
|
||||
cutout = atlite.Cutout(cutout_config)
|
||||
if year: cutout_name = cutout_name.format(weather_year=year)
|
||||
cutout = atlite.Cutout(cutout_name)
|
||||
|
||||
clustered_regions = gpd.read_file(
|
||||
snakemake.input.regions_onshore).set_index('name').buffer(0).squeeze()
|
||||
|
@ -16,22 +16,21 @@ if __name__ == '__main__':
|
||||
clusters=48,
|
||||
)
|
||||
|
||||
if 'snakemake' not in globals():
|
||||
from vresutils import Dict
|
||||
import yaml
|
||||
snakemake = Dict()
|
||||
with open('config.yaml') as f:
|
||||
snakemake.config = yaml.safe_load(f)
|
||||
snakemake.input = Dict()
|
||||
snakemake.output = Dict()
|
||||
|
||||
cutout_name = snakemake.input.cutout
|
||||
year = snakemake.wildcards.weather_year
|
||||
snapshots = dict(start=year, end=str(int(year)+1), closed="left") if year else snakemake.config['snapshots']
|
||||
time = pd.date_range(freq='m', **snapshots)
|
||||
drop_leap_day = snakemake.config["atlite"].get("drop_leap_day", False)
|
||||
|
||||
cutout_config = snakemake.config['atlite']['cutout']
|
||||
if year: cutout_name = cutout_config.format(weather_year=year)
|
||||
cutout = atlite.Cutout(cutout_config).sel(time=time)
|
||||
if year:
|
||||
snapshots = dict(start=year, end=str(int(year)+1), closed="left")
|
||||
cutout_name = cutout_name.format(weather_year=year)
|
||||
else:
|
||||
snapshots = snakemake.config['snapshots']
|
||||
|
||||
time = pd.date_range(freq='m', **snapshots)
|
||||
if drop_leap_day:
|
||||
time = time[~((time.month == 2) & (time.day == 29))]
|
||||
|
||||
cutout = atlite.Cutout(cutout_name).sel(time=time)
|
||||
|
||||
clustered_regions = gpd.read_file(
|
||||
snakemake.input.regions_onshore).set_index('name').buffer(0).squeeze()
|
||||
|
@ -17,10 +17,10 @@ if __name__ == '__main__':
|
||||
weather_year='',
|
||||
)
|
||||
|
||||
cutout_name = snakemake.input.cutout
|
||||
year = snakemake.wildcards.weather_year
|
||||
cutout_config = snakemake.config['atlite']['cutout']
|
||||
if year: cutout_name = cutout_config.format(weather_year=year)
|
||||
cutout = atlite.Cutout(cutout_config)
|
||||
if year: cutout_name = cutout_name.format(weather_year=year)
|
||||
cutout = atlite.Cutout(cutout_name)
|
||||
|
||||
grid_cells = cutout.grid_cells()
|
||||
|
||||
|
@ -16,24 +16,23 @@ if __name__ == '__main__':
|
||||
clusters=48,
|
||||
)
|
||||
|
||||
if 'snakemake' not in globals():
|
||||
from vresutils import Dict
|
||||
import yaml
|
||||
snakemake = Dict()
|
||||
with open('config.yaml') as f:
|
||||
snakemake.config = yaml.safe_load(f)
|
||||
snakemake.input = Dict()
|
||||
snakemake.output = Dict()
|
||||
|
||||
config = snakemake.config['solar_thermal']
|
||||
|
||||
cutout_name = snakemake.input.cutout
|
||||
year = snakemake.wildcards.weather_year
|
||||
snapshots = dict(start=year, end=str(int(year)+1), closed="left") if year else snakemake.config['snapshots']
|
||||
time = pd.date_range(freq='m', **snapshots)
|
||||
drop_leap_day = snakemake.config["atlite"].get("drop_leap_day", False)
|
||||
|
||||
cutout_config = snakemake.config['atlite']['cutout']
|
||||
if year: cutout_name = cutout_config.format(weather_year=year)
|
||||
cutout = atlite.Cutout(cutout_config).sel(time=time)
|
||||
if year:
|
||||
snapshots = dict(start=year, end=str(int(year)+1), closed="left")
|
||||
cutout_name = cutout_name.format(weather_year=year)
|
||||
else:
|
||||
snapshots = snakemake.config['snapshots']
|
||||
|
||||
time = pd.date_range(freq='m', **snapshots)
|
||||
if drop_leap_day:
|
||||
time = time[~((time.month == 2) & (time.day == 29))]
|
||||
|
||||
cutout = atlite.Cutout(cutout_name).sel(time=time)
|
||||
|
||||
clustered_regions = gpd.read_file(
|
||||
snakemake.input.regions_onshore).set_index('name').buffer(0).squeeze()
|
||||
|
@ -16,13 +16,21 @@ if __name__ == '__main__':
|
||||
clusters=48,
|
||||
)
|
||||
|
||||
cutout_name = snakemake.input.cutout
|
||||
year = snakemake.wildcards.weather_year
|
||||
snapshots = dict(start=year, end=str(int(year)+1), closed="left") if year else snakemake.config['snapshots']
|
||||
time = pd.date_range(freq='m', **snapshots)
|
||||
drop_leap_day = snakemake.config["atlite"].get("drop_leap_day", False)
|
||||
|
||||
cutout_config = snakemake.config['atlite']['cutout']
|
||||
if year: cutout_name = cutout_config.format(weather_year=year)
|
||||
cutout = atlite.Cutout(cutout_config).sel(time=time)
|
||||
if year:
|
||||
snapshots = dict(start=year, end=str(int(year)+1), closed="left")
|
||||
cutout_name = cutout_name.format(weather_year=year)
|
||||
else:
|
||||
snapshots = snakemake.config['snapshots']
|
||||
|
||||
time = pd.date_range(freq='m', **snapshots)
|
||||
if drop_leap_day:
|
||||
time = time[~((time.month == 2) & (time.day == 29))]
|
||||
|
||||
cutout = atlite.Cutout(cutout_name).sel(time=time)
|
||||
|
||||
clustered_regions = gpd.read_file(
|
||||
snakemake.input.regions_onshore).set_index('name').buffer(0).squeeze()
|
||||
|
Loading…
Reference in New Issue
Block a user