Comments (4)
Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).
Thanks for the bug report!
It looks like this parameter distribution is incorrect. In the triangular distribution, the "left" (minimum) must be less than or equal to the mode, which must be less or equal to the maximum ("right"). See https://en.wikipedia.org/wiki/Triangular_distribution.
What database are you working with? Or can you say which tutorial, specifically?
Thanks,
Chris
from brightway2-calc.
Original comment by Caroline Nadel (Bitbucket: cazcazn, ).
Like I say, it happened with both tutorials 2 and 3 after following them from 1. In order to import the US-LCI database I had to fix a few things in the code, as when checking if a category is in the biosphere, it crashed. In addition, the database folder structure has changed so it makes sense to update the tutorial.
I would make a pull request, but it entailed forcing the checker to accept some database values that might not have been correct. Import failed with "Incorrect category for biosphere flow". The changes I made to get around this were in bw2data/io/import_ecospold.py
:
21:BIOSPHERE = ("air", "water", "soil", "resource", "final-waste-flow", "raw", "others", "non-material")
431: assert exc[u"matching"][u"categories"][0].lower() in BIOSPHERE, \
Specifically, "Air" was rejected so I added a .lower
, and "others" and "non-material" were rejected so I added those to the biosphere list. This may have messed up the database in some unknown way.
Perhaps you could try running through the tutorials from scratch with the latest US-LCI and see what fixes need to be made? Then once I understand the code a bit more I'm more than happy to contribute!
from brightway2-calc.
Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).
Hi Cazcazn-
Thanks again, sorry for the delay.
I can't import the US LCI cleanly, due partly to the reasons you have noticed, but also because there are some internal inconsistencies, partly due it looks like to some entries being manually typed in (with the resulting typos), but also due to some pollution from SimaPro. I have also added the SimaPro biosphere categories (https://bitbucket.org/cmutel/brightway2-io/src/b7dca26debaaae2df834ed51df154e3192ac838f/bw2io/compatibility.py?at=default&fileviewer=file-view-default). However, I still have a number of issues with the import, as seen here: http://nbviewer.ipython.org/urls/bitbucket.org/cmutel/brightway2/raw/2.0/notebooks/IO%20-%20Importing%20US%20LCI%20database.ipynb
I would love to have an example database that could be used in the tutorials, but haven't found a good one yet. Maybe you have some ideas?
BTW, you can fix the MC problem with something like this (adapt as needed):
#!python
from brightway2 import *
from stats_arrays import *
import numpy as np
db = Database("whatever")
data = db.load()
for ds in data.values():
for exc in ds.get('exchanges'):
if exc['uncertainty type'] == TriangularUncertainty.id and \
(exc['minimum'] >= exc['loc'] or exc['maximum'] <= exc['loc']):
# Invalid triangular, switch to no uncertainty
exc['uncertainty type'] = NoUncertainty.id
exc['minimum'] = exc['maximum'] = np.nan
db.write(data)
In the development version (see http://brightwaylca.org/dev-docs/), it would be:
#!python
from brightway2 import *
from stats_arrays import *
import numpy as np
for ds in Database("whatever"):
for exc in ds.exchanges():
if exc['uncertainty type'] == TriangularUncertainty.id and \
(exc['minimum'] >= exc['loc'] or exc['maximum'] <= exc['loc']):
# Invalid triangular, switch to no uncertainty
exc['uncertainty type'] = NoUncertainty.id
exc['minimum'] = exc['maximum'] = np.nan
exc.save()
from brightway2-calc.
Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).
If there is a problem, it isn't with bw2calc
, so closing this for now.
from brightway2-calc.
Related Issues (20)
- Empty characterization matrix arrays for MultiLCA HOT 7
- Proposal: Allow user to calculate non-diagonalized results HOT 1
- Proposal: Cache Impact Assessment items
- Poor error message when no LCIA data is supplied
- Missing ability to create RNGs for Monte Carlo in Brightway 2.5? HOT 3
- Fail to install activity browser (Windows x64) HOT 1
- Install brightway error HOT 1
- Use the expected value to parametrize lognormal distributions HOT 2
- Prevent multiple ``remap_inventory_dicts``
- Allow for selective use of distributions or arrays depending on matrix label
- `MappedMatrixDict` should support `__mul__` HOT 1
- Dependency Dashboard
- MultiLCA: Check that `method_config` resources are present in data objects
- MultiLCA: Filter data objects to those referred to in `method_config`
- Add tests for `scikit-umfpack` and `sparselu` solvers HOT 5
- Prepare for switch to sparse arrays
- MultiLCA checklist
- Document/Clarify Removal of GraphTraversal Functionality HOT 6
- Characterization matrix ... rabbit hole HOT 3
- Factorizing matrices with pypardiso is not a no-op
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-calc.