Skip to content

Allow Flowmap to receive either list of flows objects or path to json flow list #43

@fjuniorr

Description

@fjuniorr

Currently Flowmap accepts a list of Flow objects as arguments. This generates the following type of code1 when performing the map operation with python code instead of using the CLI interface:

from flowmapper.utils import read_field_mapping, read_flowlist
from flowmapper.flowmap import Flowmap
from flowmapper.flow import Flow

fields = read_field_mapping('config/simapro-ecoinvent.toml')
source_flows = [Flow.from_dict(flow, fields['source']) for flow in read_flowlist('data/agribalyse-3.1.1-biosphere.json')]
target_flows = [Flow.from_dict(flow, fields['target']) for flow in read_flowlist('data/ecoinvent-3.7-biosphere.json')]

flowmap = Flowmap(source_flows, target_flows)

It would be convenient if the following was possible:

from flowmapper.flowmap import Flowmap

flowmap = Flowmap('data/agribalyse-3.1.1-biosphere.json', 'data/ecoinvent-3.7-biosphere.json', 'config/simapro-ecoinvent.toml')

Footnotes

  1. For example to generate status.md in status.qmd

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions