add weather_year wildcard to mock_snakemake objects
This commit is contained in:
parent
0b27e40710
commit
ec4a45b46b
@ -550,7 +550,7 @@ def add_nice_carrier_names(n, config):
|
||||
if __name__ == "__main__":
|
||||
if 'snakemake' not in globals():
|
||||
from _helpers import mock_snakemake
|
||||
snakemake = mock_snakemake('add_electricity')
|
||||
snakemake = mock_snakemake('add_electricity', weather_year='')
|
||||
configure_logging(snakemake)
|
||||
|
||||
n = pypsa.Network(snakemake.input.base_network)
|
||||
|
@ -189,7 +189,7 @@ def attach_hydrogen_pipelines(n, costs, elec_opts):
|
||||
if __name__ == "__main__":
|
||||
if 'snakemake' not in globals():
|
||||
from _helpers import mock_snakemake
|
||||
snakemake = mock_snakemake('add_extra_components', network='elec',
|
||||
snakemake = mock_snakemake('add_extra_components', weather_year='',
|
||||
simpl='', clusters=5)
|
||||
configure_logging(snakemake)
|
||||
|
||||
|
@ -71,7 +71,7 @@ logger = logging.getLogger(__name__)
|
||||
if __name__ == "__main__":
|
||||
if 'snakemake' not in globals():
|
||||
from _helpers import mock_snakemake
|
||||
snakemake = mock_snakemake('build_hydro_profile')
|
||||
snakemake = mock_snakemake('build_hydro_profile', weather_year='')
|
||||
configure_logging(snakemake)
|
||||
|
||||
config_hydro = snakemake.config['renewable']['hydro']
|
||||
|
@ -192,11 +192,11 @@ if __name__ == "__main__":
|
||||
|
||||
if 'snakemake' not in globals():
|
||||
from _helpers import mock_snakemake
|
||||
snakemake = mock_snakemake('build_load_data')
|
||||
snakemake = mock_snakemake('build_load_data', weather_year='')
|
||||
|
||||
configure_logging(snakemake)
|
||||
|
||||
weather_year = snakemake.wildcard.weather_year
|
||||
weather_year = snakemake.wildcards.weather_year
|
||||
if weather_year:
|
||||
snapshots = dict(
|
||||
start=weather_year,
|
||||
|
@ -198,7 +198,7 @@ logger = logging.getLogger(__name__)
|
||||
if __name__ == '__main__':
|
||||
if 'snakemake' not in globals():
|
||||
from _helpers import mock_snakemake
|
||||
snakemake = mock_snakemake('build_renewable_profiles', technology='solar')
|
||||
snakemake = mock_snakemake('build_renewable_profiles', technology='solar', weather_year='')
|
||||
configure_logging(snakemake)
|
||||
pgb.streams.wrap_stderr()
|
||||
|
||||
|
@ -329,7 +329,7 @@ def plot_busmap_for_n_clusters(n, n_clusters, fn=None):
|
||||
if __name__ == "__main__":
|
||||
if 'snakemake' not in globals():
|
||||
from _helpers import mock_snakemake
|
||||
snakemake = mock_snakemake('cluster_network', network='elec', simpl='', clusters='5')
|
||||
snakemake = mock_snakemake('cluster_network', simpl='', clusters='5', weather_year='')
|
||||
configure_logging(snakemake)
|
||||
|
||||
n = pypsa.Network(snakemake.input.network)
|
||||
|
@ -426,8 +426,8 @@ def to_csv(dfs, dir):
|
||||
if __name__ == "__main__":
|
||||
if 'snakemake' not in globals():
|
||||
from _helpers import mock_snakemake
|
||||
snakemake = mock_snakemake('make_summary', network='elec', simpl='',
|
||||
clusters='5', ll='copt', opts='Co2L-24H', country='all')
|
||||
snakemake = mock_snakemake('make_summary', simpl='',
|
||||
clusters='5', ll='copt', opts='Co2L-24H', country='all', weather_year='')
|
||||
network_dir = os.path.join('..', 'results', 'networks')
|
||||
else:
|
||||
network_dir = os.path.join('results', 'networks')
|
||||
|
@ -251,9 +251,9 @@ def plot_total_cost_bar(n, opts, ax=None):
|
||||
if __name__ == "__main__":
|
||||
if 'snakemake' not in globals():
|
||||
from _helpers import mock_snakemake
|
||||
snakemake = mock_snakemake('plot_network', network='elec', simpl='',
|
||||
snakemake = mock_snakemake('plot_network', simpl='',
|
||||
clusters='5', ll='copt', opts='Co2L-24H',
|
||||
attr='p_nom', ext="pdf")
|
||||
attr='p_nom', ext="pdf", weather_year='')
|
||||
configure_logging(snakemake)
|
||||
|
||||
set_plot_style()
|
||||
|
@ -48,9 +48,9 @@ def cum_p_nom_max(net, tech, country=None):
|
||||
if __name__ == "__main__":
|
||||
if 'snakemake' not in globals():
|
||||
from _helpers import mock_snakemake
|
||||
snakemake = mock_snakemake('plot_p_nom_max', network='elec', simpl='',
|
||||
snakemake = mock_snakemake('plot_p_nom_max', simpl='',
|
||||
techs='solar,onwind,offwind-dc', ext='png',
|
||||
clusts= '5,full', country= 'all')
|
||||
clusts= '5,full', country= 'all', weather_year='')
|
||||
configure_logging(snakemake)
|
||||
|
||||
plot_kwds = dict(drawstyle="steps-post")
|
||||
|
@ -165,9 +165,9 @@ def plot_energy(infn, config, fn=None):
|
||||
if __name__ == "__main__":
|
||||
if 'snakemake' not in globals():
|
||||
from _helpers import mock_snakemake
|
||||
snakemake = mock_snakemake('plot_summary', summary='energy', network='elec',
|
||||
snakemake = mock_snakemake('plot_summary', summary='energy',
|
||||
simpl='', clusters=5, ll='copt', opts='Co2L-24H',
|
||||
attr='', ext='png', country='all')
|
||||
attr='', ext='png', country='all', weather_year='')
|
||||
configure_logging(snakemake)
|
||||
|
||||
config = snakemake.config
|
||||
|
@ -60,7 +60,7 @@ def extract_coordinates(s):
|
||||
if __name__ == "__main__":
|
||||
if 'snakemake' not in globals():
|
||||
from _helpers import mock_snakemake #rule must be enabled in config
|
||||
snakemake = mock_snakemake('prepare_links_p_nom', simpl='', network='elec')
|
||||
snakemake = mock_snakemake('prepare_links_p_nom', simpl='', weather_year='')
|
||||
configure_logging(snakemake)
|
||||
|
||||
links_p_nom = pd.read_html('https://en.wikipedia.org/wiki/List_of_HVDC_projects', header=0, match="SwePol")[0]
|
||||
|
@ -202,7 +202,7 @@ def set_line_nom_max(n, s_nom_max_set=np.inf, p_nom_max_set=np.inf):
|
||||
if __name__ == "__main__":
|
||||
if 'snakemake' not in globals():
|
||||
from _helpers import mock_snakemake
|
||||
snakemake = mock_snakemake('prepare_network', network='elec', simpl='',
|
||||
snakemake = mock_snakemake('prepare_network', weather_year='', simpl='',
|
||||
clusters='40', ll='v0.3', opts='Co2L-24H')
|
||||
configure_logging(snakemake)
|
||||
|
||||
|
@ -384,7 +384,7 @@ def cluster(n, n_clusters, config):
|
||||
if __name__ == "__main__":
|
||||
if 'snakemake' not in globals():
|
||||
from _helpers import mock_snakemake
|
||||
snakemake = mock_snakemake('simplify_network', simpl='', network='elec')
|
||||
snakemake = mock_snakemake('simplify_network', weather_year='', simpl='')
|
||||
configure_logging(snakemake)
|
||||
|
||||
n = pypsa.Network(snakemake.input.network)
|
||||
|
@ -274,7 +274,7 @@ def solve_network(n, config, opts='', **kwargs):
|
||||
if __name__ == "__main__":
|
||||
if 'snakemake' not in globals():
|
||||
from _helpers import mock_snakemake
|
||||
snakemake = mock_snakemake('solve_network', network='elec', simpl='',
|
||||
snakemake = mock_snakemake('solve_network', weather_year='', simpl='',
|
||||
clusters='5', ll='copt', opts='Co2L-BAU-CCL-24H')
|
||||
configure_logging(snakemake)
|
||||
|
||||
|
@ -96,7 +96,7 @@ def set_parameters_from_optimized(n, n_optim):
|
||||
if __name__ == "__main__":
|
||||
if 'snakemake' not in globals():
|
||||
from _helpers import mock_snakemake
|
||||
snakemake = mock_snakemake('solve_operations_network', network='elec',
|
||||
snakemake = mock_snakemake('solve_operations_network', weather_year='',
|
||||
simpl='', clusters='5', ll='copt', opts='Co2L-BAU-24H')
|
||||
configure_logging(snakemake)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user