update for atlite version 0.2.4

This commit is contained in:
lisazeyen 2021-06-21 07:58:10 +02:00
parent c5b3551687
commit e4dad6429d
6 changed files with 12 additions and 15 deletions

View File

@ -5,9 +5,9 @@ import pandas as pd
import atlite
import helper
cutout_path = snakemake.config['atlite']['cutout_dir'] + "/" + snakemake.config['atlite']['cutout_name']+ ".nc"
cutout = atlite.Cutout(snakemake.config['atlite']['cutout_name'],
cutout_dir=snakemake.config['atlite']['cutout_dir'])
cutout = atlite.Cutout(path=cutout_path)
clustered_busregions_as_geopd = gpd.read_file(snakemake.input.regions_onshore).set_index('name', drop=True)

View File

@ -18,8 +18,8 @@ if 'snakemake' not in globals():
time = pd.date_range(freq='m', **snakemake.config['snapshots'])
params = dict(years=slice(*time.year[[0, -1]]), months=slice(*time.month[[0, -1]]))
cutout = atlite.Cutout(snakemake.config['atlite']['cutout_name'],
cutout_dir=snakemake.config['atlite']['cutout_dir'],
cutout_path = snakemake.config['atlite']['cutout_dir'] + "/" + snakemake.config['atlite']['cutout_name']+ ".nc"
cutout = atlite.Cutout(path=cutout_path,
**params)
clustered_busregions_as_geopd = gpd.read_file(snakemake.input.regions_onshore).set_index('name', drop=True)

View File

@ -18,11 +18,10 @@ if 'snakemake' not in globals():
snakemake.config = yaml.safe_load(f)
snakemake.input = Dict()
snakemake.output = Dict()
snakemake.input["urban_percent"] = "data/urban_percent.csv"
cutout = atlite.Cutout(snakemake.config['atlite']['cutout_name'],
cutout_dir=snakemake.config['atlite']['cutout_dir'])
cutout_path = snakemake.config['atlite']['cutout_dir'] + "/" + snakemake.config['atlite']['cutout_name']+ ".nc"
cutout = atlite.Cutout(path=cutout_path)
grid_cells = cutout.grid_cells()

View File

@ -441,7 +441,7 @@ def prepare_temperature_data():
temperature_factor = (t_threshold - temperature_average_d_heat) * d_heat * 1/365
"""
temperature = xr.open_dataarray(snakemake.input.air_temperature).T.to_pandas()
temperature = xr.open_dataarray(snakemake.input.air_temperature).to_pandas()
d_heat = (temperature.groupby(temperature.columns.str[:2], axis=1).mean()
.resample("1D").mean()<t_threshold).sum()
temperature_average_d_heat = (temperature.groupby(temperature.columns.str[:2], axis=1)
@ -834,7 +834,7 @@ if __name__ == "__main__":
wildcards=dict(
network='elec',
simpl='',
clusters='48',
clusters='50',
lv='1',
opts='Co2L-3H',
sector_opts="[Co2L0p0-168H-T-H-B-I]"),

View File

@ -19,9 +19,8 @@ time = pd.date_range(freq='m', **snakemake.config['snapshots'])
params = dict(years=slice(*time.year[[0, -1]]), months=slice(*time.month[[0, -1]]))
cutout = atlite.Cutout(snakemake.config['atlite']['cutout_name'],
cutout_dir=snakemake.config['atlite']['cutout_dir'],
cutout_path = snakemake.config['atlite']['cutout_dir'] + "/" + snakemake.config['atlite']['cutout_name']+ ".nc"
cutout = atlite.Cutout(path=cutout_path,
**params)
clustered_busregions_as_geopd = gpd.read_file(snakemake.input.regions_onshore).set_index('name', drop=True)

View File

@ -18,9 +18,8 @@ if 'snakemake' not in globals():
time = pd.date_range(freq='m', **snakemake.config['snapshots'])
params = dict(years=slice(*time.year[[0, -1]]), months=slice(*time.month[[0, -1]]))
cutout = atlite.Cutout(snakemake.config['atlite']['cutout_name'],
cutout_dir=snakemake.config['atlite']['cutout_dir'],
cutout_path = snakemake.config['atlite']['cutout_dir'] + "/" + snakemake.config['atlite']['cutout_name']+ ".nc"
cutout = atlite.Cutout(path=cutout_path,
**params)
clustered_busregions_as_geopd = gpd.read_file(snakemake.input.regions_onshore).set_index('name', drop=True)