New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter nodes from results by input/output or name #426

wants to merge 5 commits into
base: dev


None yet
1 participant
Copy link

henhuy commented Jan 9, 2018

I wrote two little functions to filter results for certain nodes.

Located in: outputlib.views-module.
Functionality: Nodes can either be filtered by input/output flows or by name.
Usage: Results, plots or other outputs can be grouped by certain criteria. For example, I can use this functions to dynamically determine sources and plot their energy output.

Filter by name:

To filter nodes by name, function get_node_by_nameis provided, which takes results and node label(s) and returns related (list of) node(s). If label is not found None is returned.
b_el, pp_oil = get_node_by_name(results, 'b_el', 'pp_oil')

Filter by inputs/outputs:

Nodes from results can be filtered by functionfilter_nodes by 5 different filter options found in views.NodeOptions: All, HasOutputs, HasInputs, HasOnlyOutputs, HasOnlyInputs. Additionally, busses can be excluded by parameter exclude_busses.
Get all sources:

nodes = filter_nodes(

Further examples can be found in tests.test_outputlib.test_views

henhuy added some commits Jan 9, 2018

Added function to filter results for nodes
Nodes can be filtered by NodeOptions (All, HasOutputs, HasInputs, HasOnlyOutputs, HasOnlyInputs)
Busses can be negelected
Added string support for node options
Now, node options for function `filter_nodes` can be provided as strings

@henhuy henhuy requested a review from oemof/oemof-outputlib Jan 9, 2018

@henhuy henhuy self-assigned this Jan 9, 2018

@henhuy henhuy added the enhancement label Jan 9, 2018

@henhuy henhuy closed this Jan 9, 2018

@henhuy henhuy deleted the henhuy:filter_nodes branch Jan 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment