SimaPro CSV should extract and apply unit conversions when possible

Issue #7 new
Chris Mutel repo owner created an issue

No description provided.

Comments (3)

  1. Pascal Lesage

    Importing datasets with electricity inputs expressed in MJ breaks import with this error:

    C:\bw2-python\envs\bw2\lib\site-packages\bw2data\backends\peewee\ in _efficient_write_many_data(self, data, indices)
    156 for exchange in ds.get('exchanges', []):
    157 if 'input' not in exchange or 'amount' not in exchange:
    --> 158 raise InvalidExchange
    159 if 'type' not in exchange:
    160 raise UntypedExchange


  2. Chris Mutel reporter

    This is basically impossible to fix - at least for me, with my current knowledge and skills.

    We already do some conversions to default units.

    However, the example you give is exactly what makes it difficult. MJ and kWh are both used for energy in common practice and ecoinvent. So there is no "default" energy unit. As far as I know, SimaPro does provide unit conversions (see the end of the CSV file), but doesn't specify which unit process should use which conversion to match against ecoinvent. I think this is because SimaPro uses a different strategy to match against ecoinvent - we use a combination of name, product, unit, etc.

    So, basically this is a known issue, but I have no idea how to fix it. Our guidance is to not use unit conversions in SimaPro.

  3. Pascal Lesage

    However, given that importing datasets from SimaPro that have MJ as unit for exchanges results in import failure, perhaps a clunky strategy like if 'electricity' in exchange['name'] and exchange['unit'] == 'MJ' then exchange['unit'] = 'kWh' and exchange['amount'] = exchange['amount'] * 1/3.6
    I can't think of cases where this would break (but perhaps there are).

  4. Log in to comment