-
Notifications
You must be signed in to change notification settings - Fork 13
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
Problem adding Annual Technology Emissions to config file #26
Comments
Hi @FraGard - actually the full text of the long-error would be useful to see. Please could you paste it here in a "code block"? |
Thanks, sure. Note that I installed the package in my base environment. Perhaps not very clever. (base) francescogardumi@Francescos-MBP iamc % osemosys2iamc osemosys_inputs osemosys_outputs config.yaml iamc_outputs.xlsx
Traceback (most recent call last):
File "/Users/francescogardumi/anaconda3/bin/osemosys2iamc", line 8, in <module>
sys.exit(entry_point())
File "/Users/francescogardumi/anaconda3/lib/python3.10/site-packages/osemosys2iamc/resultify.py", line 404, in entry_point
all_data = main(config, inputs_path, results_path)
File "/Users/francescogardumi/anaconda3/lib/python3.10/site-packages/osemosys2iamc/resultify.py", line 359, in main
data.index = data.index.set_levels(data.index.levels[2].map(iso_mapping), level=2)
File "/Users/francescogardumi/anaconda3/lib/python3.10/site-packages/pandas/util/_decorators.py", line 331, in wrapper
return func(*args, **kwargs)
File "/Users/francescogardumi/anaconda3/lib/python3.10/site-packages/pandas/core/indexes/multi.py", line 943, in set_levels
idx._set_levels(
File "/Users/francescogardumi/anaconda3/lib/python3.10/site-packages/pandas/core/indexes/multi.py", line 826, in _set_levels
new_codes = self._verify_integrity(levels=new_levels)
File "/Users/francescogardumi/anaconda3/lib/python3.10/site-packages/pandas/core/indexes/multi.py", line 418, in _verify_integrity
raise ValueError(
ValueError: Level values must be unique: [nan, nan] on level 2 |
I tried this, copied-pasted from OSeMBE_ECEMF/config.yaml: - iamc_variable: 'Emissions|CO2|Energy|Supply|Electricity'
emission: [CO2]
unit: ktCO2/yr
osemosys_param: AnnualTechnologyEmission But I got the error: (base) francescogardumi@Francescos-MBP iamc % osemosys2iamc osemosys_inputs osemosys_outputs config.yaml iamc_outputs
Traceback (most recent call last):
File "/Users/francescogardumi/anaconda3/bin/osemosys2iamc", line 8, in <module>
sys.exit(entry_point())
File "/Users/francescogardumi/anaconda3/lib/python3.10/site-packages/osemosys2iamc/resultify.py", line 404, in entry_point
all_data = main(config, inputs_path, results_path)
File "/Users/francescogardumi/anaconda3/lib/python3.10/site-packages/osemosys2iamc/resultify.py", line 318, in main
data = extract_results(results, technologies)
UnboundLocalError: local variable 'technologies' referenced before assignment |
I think this might be caused by not having the openentrance package installed in editable mode. Did you follow the installation instructions in the readme to install the openentrance package like so: pip install -e git+https://github.com/openENTRANCE/openentrance.git@main#egg=openentrance
pip install git+https://github.com/osemosys/osemosys2iamc@main#egg=osemosys2iamc |
Changing the order of the two command lines above did not solve the problem. I uninstalled both packages, then reinstalled them in the order above, then tried what I had tried in my comment above and got the same error. To be noted that the config for Production By Activity Annual and Total Capacity Annual works fine and produces the expected results (despite the region being RE1). |
Hi @FraGard - I think I've spotted the issue. You need to use the key |
Thanks @willu47 , I have changed it to emissions as follows
And the error goes back to
|
This is how it is written in the OSeMBE config:
That's where I had taken from |
Yep, the OSeMBE config is also incorrect. |
I got csv result files for a test models using otoole and would like now to pick some of the results and convert them to the iamc format. I wrote a config file for that, attached (I just turned it to a txt file cause I was not allowed to upload yaml). It worked well for production by technology annual and for total capacity annual but I cannot make it work for the emissions. I get a long error, the end of which is:
'Level values must be unique: [nan, nan] on level 2'
config.txt
AnnualTechnologyEmission.csv
I upload also the csv result file of the emissions, for reference
The text was updated successfully, but these errors were encountered: