Goal
all pypsa-at networks include the energy_totals data directly in the network-output-file in n.meta.energy_totals. in case this exists, data for energy_totals should be read from there, so there is no extra dependency on another file. If n.meta.energy_totals is not present, read the data from an extra file as is. If this file does not exist, raise an error.
Include all code in one central function get_energy_totals_domestic_share in utils, that reliably returns the domestic to international ratio and cache the energy_totals - data, so that it is available after the first call of this function.
Testing
include a mock energy_totals table to mock_network and check all possiblities:
- network includes energy_totals table -> use it
- network does not include energy_totals table and path to energy_totals file exist -> use energy_totals from file
- network does not include energy_totals table and path to energy_totals file does not exist -> raise an Error.
Goal
all pypsa-at networks include the
energy_totalsdata directly in the network-output-file inn.meta.energy_totals. in case this exists, data forenergy_totalsshould be read from there, so there is no extra dependency on another file. Ifn.meta.energy_totalsis not present, read the data from an extra file as is. If this file does not exist, raise an error.Include all code in one central function
get_energy_totals_domestic_shareinutils, that reliably returns the domestic to international ratio and cache theenergy_totals- data, so that it is available after the first call of this function.Testing
include a mock energy_totals table to mock_network and check all possiblities: