Issue with create_datapackage in 2.30.dev
When trying to create a Pathways datapackage with the mining updates in the 2.30.dev_mining branch, the code fails because of the lines https://github.com/polca/premise/blob/7e4c1d8cdc78f113f200ad3543e4fe01be815ffc/premise/pathways.py#L82C1-L91C48
energy = FinalEnergy(
database=scenario["database"],
iam_data=scenario["iam data"],
model=scenario["model"],
pathway=scenario["pathway"],
year=scenario["year"],
version=self.datapackage.version,
system_model=self.datapackage.system_model,
)
energy.import_heating_inventories()
import_heating_inventories() was only a method of the Energy class, not of FinalEnergy - maybe a leftover line that should be removed / replaced?
@romainsacchi @alvarojhahn Is this an issue that requires a larger fix, or something that could be fixed or worked around quickly?
@dbantje indeed. Actually the code should look like this now:
final_energy = FinalEnergy(
database=scenario["database"],
iam_data=scenario["iam data"],
model=scenario["model"],
pathway=scenario["pathway"],
year=scenario["year"],
version=version,
system_model=system_model,
)
final_energy.regionalize_heating_datasets()
final_energy.relink_datasets()
scenario["database"] = final_energy.database
scenario["index"] = final_energy.index
scenario["cache"] = final_energy.cache
so maybe you have not pulled recently?
I am working on a new version of the 'mining' update. It should be finished today and then merged. I suggest not working with 2.30.dev_mining
Ah, sorry. Yes, I was referring to 2.30.dev
Perfect, thanks @alvarojhahn ! :)
@alvarojhahn: Are there any updates about this?
Hi @dbantje .
2.3.0.dev_mining is updated, and the changes planned to sulfidic tailings are there.
I am waiting for @romainsacchi to finish some development in 2.3.0.dev, then we will merge.
@dbantje 2.3.0.dev is now working and update("mining") is available
Thanks you for the work on those features and the merging!
I'm still getting issues when trying to create a Pathways datapackage:
- the lines that initially caused the error are still in
pathways.py: https://github.com/polca/premise/blob/5f00640e7e3132b8120aecb713edffc3a16c8d6e/premise/pathways.py#L82C1-L94C36 Since the heating markets are now regionalized when calling_update_final_energy, it should be ok to replace the above lines with (old code commented out), right?
for scenario in self.datapackage.scenarios:
scenario = load_database(scenario)
# energy = FinalEnergy(
# database=scenario["database"],
# iam_data=scenario["iam data"],
# model=scenario["model"],
# pathway=scenario["pathway"],
# year=scenario["year"],
# version=self.datapackage.version,
# system_model=self.datapackage.system_model,
# )
# energy.import_heating_inventories()
# scenario["database"] = energy.database
dump_database(scenario)
- I get another error in
add_scenario_data:
Traceback (most recent call last):
File "/p/projects/ariadne/scenarioLCA/01_run_premise_from_config.py", line 120, in <module>
ndb.create_datapackage(name=f"output/{dirname}/{fname}", transformations=transformations)
File "/p/projects/ariadne/scenarioLCA/software/premise/premise/pathways.py", line 96, in create_datapackage
self.export_datapackage(
File "/p/projects/ariadne/scenarioLCA/software/premise/premise/pathways.py", line 118, in export_datapackage
self.add_scenario_data()
File "/p/projects/ariadne/scenarioLCA/software/premise/premise/pathways.py", line 311, in add_scenario_data
extra_units.update(scenario["iam data"].energy_use_volumes.attrs["unit"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'IAMDataCollection' object has no attribute 'energy_use_volumes'
srun: error: csp14c01: task 0: Exited with exit code 1
This is for the default SSP2-NPi scenario. Could you check whether you run into the same issue on your end?
Is this still an issue?
I couldn't check yet due to the errors with unlinked exchanges.
No, it's is resolved now :)