Skip to content
Snippets Groups Projects
Commit 6755f502 authored by David Radu's avatar David Radu
Browse files

updated CAPV locations fetch; to be tested on complementarity book case

parent 6f0deb95
No related branches found
No related tags found
No related merge requests found
......@@ -820,19 +820,19 @@ def retrieve_site_data(model_parameters, capacity_factor_data, criticality_data,
country_data_avg_at_load_max = country_data.sel(time=load_country_max).mean(dim='time')
n = deployment_dict[region][tech]
if n > 0:
locs_legacy = set(legacy_sites[tech]).intersection(set(country_data_avg_at_load_max.locations.values.flatten()))
locs_legacy = list(set(legacy_sites[tech]).intersection(set(country_data_avg_at_load_max.locations.values.flatten())))
if len(locs_legacy) > 0:
locs_new = set(country_data_avg_at_load_max.locations.values.flatten()).difference(locs_legacy)
country_data_no_legacy = country_data_avg_at_load_max.sel(locations=list(locs_new))
n_new = n - len(locs_legacy)
if n_new > 0:
locs_new_best_idx = set(country_data_no_legacy.argsort()[-n_new:].values.flatten())
locs_new_best_idx = country_data_no_legacy.argsort()[-n_new:].values.flatten()
locs_new_best = country_data_no_legacy.isel(locations=locs_new_best_idx).locations.values.flatten()
locs = list(locs_legacy.union(locs_new_best))
locs = sorted(list(set(locs_legacy).union(set(locs_new_best))))
else:
locs = sorted(list(locs_legacy))
locs = sorted(locs_legacy)
else:
locs_idx = sorted(list(set(country_data_avg_at_load_max.argsort()[-n:].values.flatten())))
locs_idx = country_data_avg_at_load_max.argsort()[-n:].values.flatten()
locs = country_data_avg_at_load_max.isel(locations=locs_idx).locations.values.flatten()
country_sites = locs
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment