I am trying PyPSA-EUR tutorial Electrycity-Only.
After running the only code:
snakemake results/test-elec/networks/base_s_6_elec_lcopt_.nc --configfile config/test/config.electricity.yaml
I got a rule exception:
RuleException:
CalledProcessError in file E:PyPSApypsa-eurrules/build_electricity.smk, line 28:Command 'E:/Anaconda/envs/pypsa-eur/python.exe "E:PyPSApypsa-eur .snakemakescriptsitmp 0ckuen5.build_electricity_demand.py"" returned non-zero exit status 1.[Mon Dec 2 21:16:09 2024]
Error in rule build electricity demand:
jobid: 19
input: data/electricity_demand_raw.csv, data/load_synthetic_raw.csvoutput: resources/test/electricity demand.csvlog: logs/test/build_electricity_demand.log (check log file(s) for error details)conda-env: E:PyPSApypsa-eur.snakemakeconda59121625383c6740896e1ce4ceee23ff
And when I look into the log file “build_electricity_demand.log” it says:
Traceback (most recent call last):
File "E:PyPSApypsa-eur.snakemakescriptstmpmdsfe0c7.build_electricity_demand.py", line 319, in <module>
synthetic_load = synthetic_load.loc[snapshots, countries]
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "E:Anacondaenvspypsa-eurLibsite-packagespandascoreindexing.py", line 1184, in __getitem__
return self._getitem_tuple(key)
^^^^^^^^^^^^^^^^^^^^^^^^
File "E:Anacondaenvspypsa-eurLibsite-packagespandascoreindexing.py", line 1375, in _getitem_tuple
return self._multi_take(tup)
^^^^^^^^^^^^^^^^^^^^^
File "E:Anacondaenvspypsa-eurLibsite-packagespandascoreindexing.py", line 1327, in _multi_take
axis: self._get_listlike_indexer(key, axis)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:Anacondaenvspypsa-eurLibsite-packagespandascoreindexing.py", line 1558, in _get_listlike_indexer
keyarr, indexer = ax._get_indexer_strict(key, axis_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:Anacondaenvspypsa-eurLibsite-packagespandascoreindexesbase.py", line 6200, in _get_indexer_strict
self._raise_if_missing(keyarr, indexer, axis_name)
File "E:Anacondaenvspypsa-eurLibsite-packagespandascoreindexesbase.py", line 6249, in _raise_if_missing
raise KeyError(f"None of [{key}] are in the [{axis_name}]")
KeyError: "None of [DatetimeIndex(['2013-03-01 00:00:00', '2013-03-01 01:00:00',n '2013-03-01 02:00:00', '2013-03-01 03:00:00',n '2013-03-01 04:00:00', '2013-03-01 05:00:00',n '2013-03-01 06:00:00', '2013-03-01 07:00:00',n '2013-03-01 08:00:00', '2013-03-01 09:00:00',n ...n '2013-03-07 14:00:00', '2013-03-07 15:00:00',n '2013-03-07 16:00:00', '2013-03-07 17:00:00',n '2013-03-07 18:00:00', '2013-03-07 19:00:00',n '2013-03-07 20:00:00', '2013-03-07 21:00:00',n '2013-03-07 22:00:00', '2013-03-07 23:00:00'],n dtype='datetime64[ns]', length=168, freq='h')] are in the [index]"
Does anybody know what casued the error? And how to fix it?
I tried to debug it, thinking the problem may lie in the file retrive.smk, line 180 : rule retrieve_synthetic_electricity_demand, where the code generated a wrong load_synthetic_raw.csv file who didn’t have the expected timesteps.
Chen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.