Exemplo n.º 1
0
def test_sp_import_allocation():
    Migration("default-units").write(get_default_units_migration_data(),
                                     "Convert to default units")

    sp = SimaProCSVImporter(os.path.join(SP_FIXTURES_DIR, "allocation.csv"),
                            normalize_biosphere=False)
    sp.apply_strategies()
    assert sp.statistics() == (3, 5, 0)
    sp.write_database()
Exemplo n.º 2
0
def test_set_lognormal_loc_value_on_import():
    import numpy as np
    Migration("default-units").write(get_default_units_migration_data(),
                                     "Convert to default units")
    sp = SimaProCSVImporter(os.path.join(SP_FIXTURES_DIR, "inventory.csv"),
                            normalize_biosphere=False)
    sp.apply_strategies()
    amount = list(sp)[0].get("exchanges")[1]["amount"]
    loc = list(sp)[0].get("exchanges")[1]["loc"]
    assert np.abs(loc - np.log(amount)) < 1E-10