Exemple #1
0
def download_methods():
    logger = get_logger("io-performance.log")
    start = time()
    filepath = download_file("methods-new.bw2package")
    logger.info("Downloading methods package: %.4g" % (time() - start))
    start = time()
    BW2Package.import_file(filepath)
    logger.info("Importing methods package: %.4g" % (time() - start))
Exemple #2
0
def initProject(projectname):
    # Init project and DB
    projects.set_current(projectname)
    bw2setup()
    filepath = download_file("forwast.bw2package.zip", url="http://lca-net.com/wp-content/uploads/")
    dirpath = os.path.dirname(filepath)
    zipfile.ZipFile(filepath).extractall(dirpath)
    BW2Package.import_file(os.path.join(dirpath, "forwast.bw2package"))
def create_world():
    print("Downloading and creating 'world' geocollection with countries")
    geocollections["world"] = {
        "filepath":
        download_file("countries.gpkg",
                      "regional",
                      url="https://geography.ecoinvent.org/files/"),
        "field":
        "isotwolettercode",
    }
    topocollections["world"] = {
        "geocollection": "world",
        "filepath": cg.faces_fp,
        "field": "id",
    }
    topo_data = {k: v for k, v in cg.data.items() if k in COUNTRIES}
    Topography("world").write(topo_data)
def create_ecoinvent():
    print(
        "Downloading and creating 'ecoinvent' geocollection with ecoinvent-specific locations"
    )
    geocollections["ecoinvent"] = {
        "filepath":
        download_file(
            "all-ecoinvent.gpkg",
            "regional",
            url="https://geography.ecoinvent.org/files/",
        ),
        "field":
        "shortname",
    }
    topocollections["ecoinvent"] = {
        "geocollection": "ecoinvent",
        "filepath": cg.faces_fp,
        "field": "id",
    }
    topo_data = {("ecoinvent", k): v
                 for k, v in cg.data.items()
                 if k != "__all__" and "RoW" not in k and k not in COUNTRIES}
    Topography("ecoinvent").write(topo_data)