def new_quantity(self, name=None, unit=None, comment=None): name = name or input('Enter quantity name: ') unit = unit or input('Unit by string: ') comment = comment or ifinput('Quantity Comment: ', '') q = LcQuantity.new(name, unit, Comment=comment) self._catalog[0].add(q) return q
def __init__(self, ref, sheet_name='impact methods', mass_quantity=None, value_tag='CF 3.1', **kwargs): """ :param ref: :param sheet_name: 'impact methods' :param ns_uuid: :param mass_quantity: :param value_tag: 'CF 3.1' :param kwargs: quiet, upstream """ super(EcoinventLcia, self).__init__(ref, **kwargs) self._xl_rows = [] self._sheet_name = sheet_name self._value_tag = value_tag mass = mass_quantity or LcQuantity.new('Mass', self._create_unit('kg')[0]) self.add(mass) self._mass = mass
def __init__(self, source, ref=None, sheet_name='impact methods', mass_quantity=None, value_tag='CF ' + EI_LCIA_VERSION, ns_uuid=EI_LCIA_NSUUID, static=True, **kwargs): """ EI_LCIA_VERSION is presently 3.1 for the spreadsheet named 'LCIA implementation v3.1 2014_08_13.xlsx' :param source: :param ref: hard-coded 'local.ecoinvent.[EI_LCIA_VERSION].lcia'; specify at instantiation to override :param sheet_name: 'impact methods' :param mass_quantity: :param value_tag: 'CF ' + EI_LCIA_VERSION :param ns_uuid: required :param static: this archive type is always static :param kwargs: quiet, upstream """ if ref is None: ref = '.'.join(['local', 'ecoinvent', EI_LCIA_VERSION, 'lcia']) super(EcoinventLcia, self).__init__(source, ref=ref, ns_uuid=ns_uuid, static=True, **kwargs) self._xl_rows = [] self._sheet_name = sheet_name self._value_tag = value_tag mass = mass_quantity or LcQuantity.new('Mass', self._create_unit('kg')[0]) self.add(mass) self._mass = mass
if x.flow['Name'].startswith('Nitrogen oxides')) next(x for x in _petro.exchanges() if x.flow['Name'].startswith('Transport, ocean freighter, r')) if __name__ == '__main__': cat = LcCatalog(CAT_FOLDER) petro = cat.get_archive('local.uslci.olca', 'inventory').get( petro_id) # use get_archive to get entity and not ref grid = cat.get_archive('local.uslci.olca', 'inventory').get(grid_id) # shrink_petro(petro) # let's not bother shrinking this for p in (petro, grid): p._d.pop('processDocumentation') A = LcArchive(None, ref='test.entities', ns_uuid=NS_UUID) A.add_entity_and_children(petro) A.add_entity_and_children(grid) # create a dummy LCIA method q = LcQuantity.new('Emissive Coolness', 'Cool', Indicator='Coolombs') A.add(q) for k, v in cool.items(): A[k].add_characterization(q, value=v) A.check_counter() # assert len([e for e in A.entities()]) + (2 * max_count) == 54 A.write_to_file(DEST_FILE, complete=True)