Nodes¶
Class Description¶
- class paminco.net.Nodes(data, dtype_float=None, dtype_int=None, map_labels=True, copy: bool = False)[source]¶
Class that contains the nodes/vertices of a network.
- A Nodes object can be instantiated in several ways:
- Nodes(n)
where
n
is a Nodes object.- Nodes(nodes)
where
nodes
is array_like and contains either node labels or node indices. If no indices are given, they are set automatically.- Nodes(nodes, zone)
where
nodes
andzone
are array_like of shape (n, ).zone
must be boolean array denoting if a node is a zone, mostly used for traffic networks.- Nodes(nodes, xy, zone)
where
nodes
andzone
are array_like of shape (n, ) andxy
is array_like of shape (n, 2) and contains the coordinates of the nodes.- Nodes(node_labels, node_indices, xy, zone)
where
node_labels
andnode_indices
andzone
are are array_like of shape (n, ) andxy
is array_like of shape (n, 2).
- Parameters
- datanode_data
Input data.
- dtype_floatdtype, default=numpy.float_
Datatype for X and Y coordinates.
- dtype_intdtype, default=int
Datatype for node indices.
- map_labels: None, bool, dict, or callable, default=True
Determines mapping of labels to indices if no indices are given or vice versa. If
None
orFalse
, indices / labels are set to -9999 / ‘invalid’. Ifdict
, mapping by this dict. IfTrue
, indices are set to 0, 1, …, n-1, labels to indices as str. Ifcallable
, use callable with signatureindices = callable(labels)
orlabels = callable(indices)
.- copybool, default=False
Whether to create a copy of the inputs in data.
- Attributes
- index
- node
- zone
has_zones
bool: Whether Nodes object has any zone.
x
ndarray (m, ) of floats: X coordinates.
y
ndarray (m, ) of floats: Y coordinates.
Methods¶
|
|
|
Load object from |
|
Construct object from |
(Re)-set labels <-> indices mappings. |
|
|
Delete nodes from Nodes object. |
|
Get object as pandas DataFrame. |
|
Add node data to xml.etree.ElementTree.Element. |
|
Generate dict to save object with numpy.savez. |
|
Save object into a single file in uncompressed |