arguments in function calls instead of kwarg-style

This commit is contained in:
martacki 2022-01-14 11:30:15 +01:00
parent 8cb5bd27d5
commit f28a088ea3
6 changed files with 13 additions and 19 deletions

View File

@ -549,11 +549,11 @@ if __name__ == "__main__":
n = pypsa.Network(paths.base_network)
Nyears = n.snapshot_weightings.objective.sum() / 8760.
costs = load_costs(paths.tech_costs, config['costs'], config['electricity'], Nyears=Nyears)
costs = load_costs(paths.tech_costs, config['costs'], config['electricity'], Nyears)
ppl = load_powerplants(paths.powerplants)
attach_load(n, paths.regions, paths.load, paths.nuts3_shapes, config['countries'],
scaling=config['load']['scaling_factor'])
config['load']['scaling_factor'])
update_transmission_costs(n, costs, config['lines']['length_factor'])

View File

@ -199,7 +199,7 @@ if __name__ == "__main__":
elec_config = config['electricity']
Nyears = n.snapshot_weightings.objective.sum() / 8760.
costs = load_costs(paths.tech_costs, config['costs'], elec_config, Nyears=Nyears)
costs = load_costs(paths.tech_costs, config['costs'], elec_config, Nyears)
attach_storageunits(n, costs, elec_config)
attach_stores(n, costs, elec_config)

View File

@ -374,12 +374,10 @@ if __name__ == "__main__":
custom_busmap = pd.read_csv(paths.custom_busmap, index_col=0, squeeze=True)
custom_busmap.index = custom_busmap.index.astype(str)
logger.info(f"Imported custom busmap from {paths.custom_busmap}")
clustering = clustering_for_n_clusters(n, n_clusters, custom_busmap, aggregate_carriers,
line_length_factor=line_length_factor,
potential_mode=potential_mode,
solver_name=config['solving']['solver']['name'],
extended_link_costs=hvac_overhead_cost,
focus_weights=focus_weights)
line_length_factor, potential_mode, config['solving']['solver']['name'],
"kmeans", hvac_overhead_cost, focus_weights)
update_p_nom_max(n)

View File

@ -140,7 +140,7 @@ def average_every_nhours(n, offset):
return m
def apply_time_segmentation(n, segments, solver_name="cplex"):
def apply_time_segmentation(n, segments, solver_name="cbc"):
logger.info(f"Aggregating time series to {segments} segments.")
try:
import tsam.timeseriesaggregation as tsam
@ -212,11 +212,9 @@ if __name__ == "__main__":
n = pypsa.Network(paths[0])
Nyears = n.snapshot_weightings.objective.sum() / 8760.
costs = load_costs(tech_costs = paths.tech_costs,
config = config['costs'],
elec_config = config['electricity'], Nyears = Nyears)
costs = load_costs(paths.tech_costs, config['costs'], config['electricity'], Nyears)
set_line_s_max_pu(n, s_max_pu=config['lines']['s_max_pu'])
set_line_s_max_pu(n, config['lines']['s_max_pu'])
for o in opts:
m = re.match(r'^\d+h$', o, re.IGNORECASE)
@ -228,7 +226,7 @@ if __name__ == "__main__":
m = re.match(r'^\d+seg$', o, re.IGNORECASE)
if m is not None:
solver_name = config["solving"]["solver"]["name"]
n = apply_time_segmentation(n, m.group(0)[:-3], solver_name=solver_name)
n = apply_time_segmentation(n, m.group(0)[:-3], solver_name)
break
for o in opts:

View File

@ -285,8 +285,7 @@ if __name__ == "__main__":
with memory_logger(filename=fn, interval=30.) as mem:
n = pypsa.Network(paths[0])
n = prepare_network(n, solve_opts)
n = solve_network(n, config=config, opts=opts,
solver_dir=tmpdir,
n = solve_network(n, config, opts, solver_dir=tmpdir,
solver_logfile=logs.solver)
n.export_to_netcdf(out[0])

View File

@ -116,9 +116,8 @@ if __name__ == "__main__":
fn = getattr(logs, 'memory', None)
with memory_logger(filename=fn, interval=30.) as mem:
n = prepare_network(n, solve_opts=config['solving']['options'])
n = solve_network(n, config=config, opts=opts,
solver_dir=tmpdir,
n = prepare_network(n, config['solving']['options'])
n = solve_network(n, config, opts, solver_dir=tmpdir,
solver_logfile=logs.solver)
n.export_to_netcdf(out[0])