Comments (5)
Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).
Well, that is embarrassing...
This is part of a broader discussion on when existing codes should be used or not. I am leaning towards the following:
- Existing codes are never used, unless 1) a flag is set, or 2) the import comes from the manual CSV where nice human codes are more or less expected. In either exception, code uniqueness should be checked.
- Internal linking should follow the same algorithm, i.e. linking by dataset attributes, which would fix the
InvalidExchange
error (though I have to figure out why linking wouldn't work after allocation, this is a bit confusing).
Big thanks for providing a sample dataset, this is a huge help. In general, we need much better testing and test input data in brightway2-io; the comparison with Ocelot, which has ~100% coverage for IO and transformation functions, is not pretty.
from brightway2-io.
Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).
The reason Pascal says
Creating and assigning a new code when allocating fixes this problem, but creates a new one:
activities that have an input of one pf the products from the multifunctional dataset no longer
can link to the dataset, resulting in an `InvalidExchange` error, which is not better.
is that even if we fix the code
, we don't fix the linking. So, from his example dataset:
Process name
Rice, at farm (WFLDB 3.0)/kg/IN
Products
Rice, at farm (WFLDB 3.0)/IN U;kg;6250;95.8;not defined;_WFLDB 3.0\Plant products\Arable\Rice;INDIA�
Rice straw, at farm (WFLDB 3.0)/IN U;kg;3125.0;4.2;not defined;_WFLDB 3.0\Plant products\Arable\Rice;
Process name
Something else
Materials/fuels
Rice straw, at farm (WFLDB 3.0)/IN U;kg;0.771;Undefined;0;0;0;Default humidity of 13.1%�
Even if we adjust the code, the thing that would change would be the reference product, not the process name, so neither the default linking strategy, or the Simapro-specific link_technosphere_based_on_name_unit_location
, would match Rice straw, at farm
against a process named Rice, at farm
with the reference product Rice straw, at farm
.
This should be fixable with a new linking strategy that would use the reference product, but we need to make sure this doesn't raise non-uniqueness problems. In the end, I think this is an inherent problem with trying to link only by process name or product name, but not both. Alternatively, we could change the name of the allocated processes to their reference products.
from brightway2-io.
Original comment by Pascal Lesage (Bitbucket: MPa, ).
Thanks for looking into this.
How about something inspired by how LCIA method names are stored: first characters of the process name, first characters of the product name, and then the MD5 hash of the entire identifier (or, alternatively, simply a UUID)?
from brightway2-io.
Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).
The codes should now be fixed, but we still have the problem of names not matching the products.
from brightway2-io.
Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).
Should be fixed in 41276a8. Added a sanitized version of the sample data as a test case.
from brightway2-io.
Related Issues (20)
- How to export database with location information of technosphere HOT 1
- [BW2 Legacy] Using older versions of Biosphere HOT 2
- database writing failed due to unlinked exchanges in ecoinvent 3.10 HOT 4
- Some extractor methods do not have the `use_mp` flag implemented, causing them to fail. HOT 1
- [BW2 legacy] Error with easy ecoinvent biosphere flows/LCI/LCIA import of bw2io version 0.8.11 HOT 3
- SimaPro CSV importer doesn't fix broken uncertainty values HOT 8
- US EEIO import is broken
- [Discussion/Feature request] Adding `database` field to Linking Iterables by field on import HOT 2
- Excel file import - AttributeError: 'int' object has no attribute 'lower' HOT 1
- Few type hints not compatible with python 3.9 & python 3.8 HOT 1
- Encoding erorr when running `import_ecoinvent_release` on `v3.10` HOT 3
- Backport fix for "chemical formulas" from 0.9.DEV7 to 0.8.X ? HOT 1
- AttributeError in add_missing_cfs(): 'ExcelLCIAImporter' object has no attribute 'biosphere_name' HOT 1
- Importing in BW processes written in SP HOT 2
- errors importing exiobase in monetary units HOT 1
- KeyError in IOTable backend HOT 2
- update README to use cookiecutterlib format
- Configurable multiprocessing for large data import (Ecoinvent ecospold2) HOT 2
- `ExcelImporter` should convert integer codes to strings HOT 5
- minor compatibility issue HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brightway2-io.