Closed moorotter closed 1 year ago
Dear @moorotter,
Your output says:
Extracting XML data from 0 datasets
Extracted 0 datasets in 0.12 seconds
This means that the SingleOutputEcospold2Importer did not find any datasets in the provided path. Make sure you provided the correct path, which contains ecospold2 files.
More generally, I recommend you to use brightway25, which provides a functionality to automatically download and import the USEEIO database:
import bw2data as bd
import bw2io as bi
bd.projects.set_current("USEEIO example")
bi.create_default_biosphere3()
bi.useeio11()
useeio = bd.Database("US EEIO 1.1")
useeio.random()
# 'GIBBERELLIC ACID' (, None, ('water', 'unspecified'))
Note: This issue relates to https://github.com/brightway-lca/brightway2-io/issues/97
Closing due to inactivity. Feel free to re-open if the issue persists.
Hey,
I am pretty new to bw2 as well as python so this issue might be easy to solve or I might be committing an obvious mistake.
I am trying to import a new database into bw2, I got the database here: https://github.com/uslci-admin/uslci-content/blob/dev/docs/release_info/release-downloads.md I downloaded it in the ecospold2 format (because I thought, this is the easiest for me??) and then used the following code in Jupyter notebook to try to import it:
`path = r"/Users/.../EcoSpold01" useeio = bw.SingleOutputEcospold2Importer(path, 'USeeio') useeio.apply_strategies() useeio.statistics() useeio.write_database()
useeio = bw.Database("USeeio")`
After running this, I get the following error:
Extracting XML data from 0 datasets Extracted 0 datasets in 0.12 seconds Applying strategy: normalize_units Applying strategy: update_ecoinvent_locations Applying strategy: remove_zero_amount_coproducts Applying strategy: remove_zero_amount_inputs_with_no_activity Applying strategy: remove_unnamed_parameters Applying strategy: es2_assign_only_product_with_amount_as_reference_product Applying strategy: assign_single_product_as_activity Applying strategy: create_composite_code Applying strategy: drop_unspecified_subcategories Applying strategy: fix_ecoinvent_flows_pre35 Applying strategy: drop_temporary_outdated_biosphere_flows Applying strategy: link_biosphere_by_flow_uuid Applying strategy: link_internal_technosphere_by_composite_code Applying strategy: delete_exchanges_missing_activity Applying strategy: delete_ghost_exchanges Applying strategy: remove_uncertainty_from_negative_loss_exchanges Applying strategy: fix_unreasonably_high_lognormal_uncertainties Applying strategy: set_lognormal_loc_value Applying strategy: convert_activity_parameters_to_list Applying strategy: add_cpc_classification_from_single_reference_product Applying strategy: delete_none_synonyms Applied 21 strategies in 0.00 seconds 0 datasets 0 exchanges 0 unlinked exchanges
WrongDatabase Traceback (most recent call last) Input In [10], in
3 useeio.apply_strategies()
4 useeio.statistics()
----> 5 useeio.write_database()
7 useeio = bw.Database("USeeio")
File ~/opt/anaconda3/envs/buildingretrofit/lib/python3.9/site-packages/bw2io/importers/base_lci.py:237, in LCIImporter.write_database(self, data, delete_existing, backend, activate_parameters, **kwargs) 233 if {o["database"] for o in data} != {self.db_name}: 234 error = "Activity database must be {}, but {} was also found".format( 235 self.db_name, {o["database"] for o in data}.difference({self.db_name}) 236 ) --> 237 raise WrongDatabase(error) 238 if len({o["code"] for o in data}) < len(data): 239 seen, duplicates = set(), []
WrongDatabase: Activity database must be USeeio, but set() was also found
I don't know, what I am doing wrong, if I am even using an appropriate approach. Any help on how to import this specific database would be greatly appreciated. Thank you!