Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transport demand workflow missing country data infilling #395

Open
brynpickering opened this issue Jun 10, 2024 · 2 comments · May be fixed by #394
Open

Transport demand workflow missing country data infilling #395

brynpickering opened this issue Jun 10, 2024 · 2 comments · May be fixed by #394
Assignees
Labels
bug Something isn't working

Comments

@brynpickering
Copy link
Member

brynpickering commented Jun 10, 2024

What happened?

Running the full workflow, it has become apparent that the rule create_controlled_road_transport_annual_demand_and_installed_capacities misses data from some countries. This creates an error in the workflow in this set of method calls:

df_ev_chargeable_distance = (
df_ev_numbers.align(battery_size, level="vehicle_type")[1]
.squeeze()
.mul(df_ev_numbers)
.groupby(level=["country_code", "year"])
.sum()
.loc[country_codes]
.unstack("year")
.mul(transport_scaling_factor)
)

Version

1.2.0.dev

Relevant log output


Traceback (most recent call last):
  File "/Users/bryn.pickering/Repos/calliope-project/euro-calliope/.snakemake/scripts/tmpwia8kyhz.road_transport_controlled_charging.py", line 159, in <module>
    df_charging_potentials = extract_national_ev_charging_potentials(
  File "/Users/bryn.pickering/Repos/calliope-project/euro-calliope/.snakemake/scripts/tmpwia8kyhz.road_transport_controlled_charging.py", line 100, in extract_national_ev_charging_potentials
    df_ev_numbers.align(battery_size, level="vehicle_type")[1]
  File "/Users/bryn.pickering/Repos/calliope-project/envs/snakemake/euro-calliope/ca1e86f4514e6b35aa58fd05115d87c1_/lib/python3.9/site-packages/pandas/core/indexing.py", line 889, in __getitem__
    return self._getitem_tuple(key)
  File "/Users/bryn.pickering/Repos/calliope-project/envs/snakemake/euro-calliope/ca1e86f4514e6b35aa58fd05115d87c1_/lib/python3.9/site-packages/pandas/core/indexing.py", line 1060, in _getitem_tuple
    return self._getitem_lowerdim(tup)
  File "/Users/bryn.pickering/Repos/calliope-project/envs/snakemake/euro-calliope/ca1e86f4514e6b35aa58fd05115d87c1_/lib/python3.9/site-packages/pandas/core/indexing.py", line 791, in _getitem_lowerdim
    return self._getitem_nested_tuple(tup)
  File "/Users/bryn.pickering/Repos/calliope-project/envs/snakemake/euro-calliope/ca1e86f4514e6b35aa58fd05115d87c1_/lib/python3.9/site-packages/pandas/core/indexing.py", line 865, in _getitem_nested_tuple
    obj = getattr(obj, self.name)._getitem_axis(key, axis=axis)
  File "/Users/bryn.pickering/Repos/calliope-project/envs/snakemake/euro-calliope/ca1e86f4514e6b35aa58fd05115d87c1_/lib/python3.9/site-packages/pandas/core/indexing.py", line 1113, in _getitem_axis
    return self._getitem_iterable(key, axis=axis)
  File "/Users/bryn.pickering/Repos/calliope-project/envs/snakemake/euro-calliope/ca1e86f4514e6b35aa58fd05115d87c1_/lib/python3.9/site-packages/pandas/core/indexing.py", line 1053, in _getitem_iterable
    keyarr, indexer = self._get_listlike_indexer(key, axis, raise_missing=False)
  File "/Users/bryn.pickering/Repos/calliope-project/envs/snakemake/euro-calliope/ca1e86f4514e6b35aa58fd05115d87c1_/lib/python3.9/site-packages/pandas/core/indexing.py", line 1254, in _get_listlike_indexer
    indexer, keyarr = ax._convert_listlike_indexer(key)
  File "/Users/bryn.pickering/Repos/calliope-project/envs/snakemake/euro-calliope/ca1e86f4514e6b35aa58fd05115d87c1_/lib/python3.9/site-packages/pandas/core/indexes/multi.py", line 2568, in _convert_listlike_indexer
    raise KeyError(f"{keyarr[mask]} not in index")
KeyError: "['ALB' 'BIH' 'MKD' 'MNE' 'NOR' 'SRB' 'CHE'] not in index"
@brynpickering brynpickering added the bug Something isn't working label Jun 10, 2024
@adrienmellot
Copy link
Contributor

Good spot, I guess that's the issue of usually only running the minimal workflow. Perhaps we should adjust the minimal workflow to include one of the countries for which data is usually missing?
It seems that it's the JRC data missing countries. Should we directly address that in the JRC data processing upstream or should we do it in the transports script directly?

adrienmellot added a commit to adrienmellot/euro-calliope that referenced this issue Jun 11, 2024
@adrienmellot
Copy link
Contributor

Addressed in #394 directly as the code is anyway modified.

@adrienmellot adrienmellot linked a pull request Jun 11, 2024 that will close this issue
5 tasks
@timtroendle timtroendle linked a pull request Jun 20, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants