brightway-lca / brightway2-calc

The calculation engine for the Brightway2 life cycle assessment framework.
BSD 3-Clause "New" or "Revised" License
14 stars 16 forks source link

`uncertainty_type` vs `uncertainty type` in `uncertainty dictionary` creating problems #16

Closed aleksandra-kim closed 7 years ago

aleksandra-kim commented 7 years ago

Original report by Pascal Lesage (Bitbucket: MPa, ).


As reported here, Brightway and stats_arrays uncertainty dictionaries are different: one uses the key uncertainty_type, and the other uncertainty type.

This sometimes causes confusion.

It also sometimes appear to cause errors when defining new distributions (code available upon request).

Harmonization would be great.

aleksandra-kim commented 7 years ago

Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


This is an annoying inconsistency. There are clear rules that distinguish between the two, but they are not properly explained in the documentation or code.

Brightway2-data uses the name uncertainty type when defining an uncertain value. When this input data to converted to a parameter array, which can be an input to the RNG in stats_arrays, this field is named uncertainty_type. uncertainty_type is used exclusively in stats_arrays.

Both libraries are in widespread use now, and so introducing a breaking change would be difficult. Stats_arrays needs the underscore to allow attribute access, e.g. foo.uncertainty_type. Updating Brightway2-data would require that everyone rewrites all their databases, which is also suboptimal. It would also make all the Excel import data spreadsheets obsolete. I guess you could write a function that would slowly introduce one form or the other, while still tolerating the older version.

Please post code that raises errors (rather than annoyances).

aleksandra-kim commented 7 years ago

Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


Closing for now. I made stats_arrays be more forgiving in what it accepts in from_dicts, and added a line to the documentation: https://bitbucket.org/cmutel/stats_arrays/commits/486e973e682ee07db39bc71788b7cda5e30f1509