CommodityMultiSourceSink

Class Description

class paminco.net.demand.CommodityMultiSourceSink(data: dict, is_label=True, check_validity=False, dtype_float=<class 'numpy.float64'>)[source]

Commodity with multiple sources and/or multiple sinks.

A CommodityMultiSourceSink can be comprised of any number of sources (N_in) and any number of sinks (N_out). The total number of nodes that make up a CommodityMultiSourceSink is thus N_tot = N_in + N_out.

Parameters
datadict

Keys are node labels or ids, values are rate (in/outflow).

is_labelbool, default=True,

Whether keys in data are labels.

check_validitybool, default=False

Check whether sum of values in data equals 0.

dtype_floattype, default=numpy.float_

Datatype to save rate values.

Methods

CommodityMultiSourceSink.from_data(data, ...)

Construct commodity from data.

CommodityMultiSourceSink.decompose([...])

Decompose CommodityMultiSourceSink into several single commodities.

CommodityMultiSourceSink.node_in_comm(node)

Check whether commodity is made up by node in node.

CommodityMultiSourceSink.to_dict([labels])

Get commodity as dict.

CommodityMultiSourceSink.get_scaled_copy([...])

Get copy where every rate is scaled by scale_factor.

CommodityMultiSourceSink.get_sparse_elements([...])

Extract commodity data for sparse demand matrix.

CommodityMultiSourceSink.map_node_labels(d)

Map labels -> ids by d.

CommodityMultiSourceSink.map_node_ids(d)

Map ids -> labels by d.

CommodityMultiSourceSink.from_label_and_id(data)

Construct from fully specified data (labels and ids).

Attributes

CommodityMultiSourceSink.N_tot

Total number of nodes in commodity: sinks + sources.

CommodityMultiSourceSink.N_in

Number of sources.

CommodityMultiSourceSink.N_out

Number of sinks.

CommodityMultiSourceSink.is_sink

ndarray (N_tot, ) of bool: whether node is sink.

CommodityMultiSourceSink.has_valid_indices

bool: whether nodes have proper indices.

CommodityMultiSourceSink.has_valid_labels

bool: whether nodes have proper labels.

CommodityMultiSourceSink.is_single

bool: whether commodity has single source and single sink.

CommodityMultiSourceSink.node_ids

ndarray (N_tot, ) of int: node indices.

CommodityMultiSourceSink.node_labels

ndarray (N_tot, ) of str: node labels.

CommodityMultiSourceSink.source_lbl

ndarray (N_in, ) of str: source labels.

CommodityMultiSourceSink.source_id

ndarray (N_in, ) of int: source indices.

CommodityMultiSourceSink.sink_lbl

ndarray (N_out, ) of str: sink labels.

CommodityMultiSourceSink.sink_id

ndarray (N_out, ) of int: sink indices.

CommodityMultiSourceSink.rate

ndarray (N_tot, ) of float: in/outflow per node.

CommodityMultiSourceSink.total_rate

float: total flow on commodity.