ExtendedComponent#
- class glue.core.component.ExtendedComponent(data, center_comp_ids, units=None)[source]#
Bases:
Component
A data component representing an extent or a region.
This component can be used when a dataset describes regions or ranges and is typically used with a RegionData object, since that object provides helper functions to display regions on viewers. For example, a RegionData object might provide properties of geographic regions, and the boundaries of these regions would be an ExtendedComponent.
Data loaders are required to know how to convert regions to a list of Shapely objects which can be used to initialize an ExtendedComponent.
A circular region can be represented as:
>>> circle = shapely.Point(x, y).buffer(rad)
A range in one dimension can be represented as:
>>> range = shapely.LineString([[x0,0],[x1,0]])
(This is a bit of an odd representation, since we are forced to specify a y coordinate for this line. We adopt a convention of y == 0.)
ExtendedComponents are NOT used directly in linking. Instead, ExtendedComponents always have corresponding ComponentIDs that represent the x (and y) coordinates over which the regions are defined. If not specified otherwise, a RegionData object will create ‘representative points’ for each region, representing a point near the center of the reigon that is guaranteed to be inside the region.
NOTE: that this implementation does not support regions in more than two dimensions. (Shapely has limited support for 3D shapes, but not more).
- Parameters:
- datalist of shapely.Geometry` objects
The data to store.
- center_comp_idslist of
glue.core.component_id.ComponentID
objects The ComponentIDs of the center of the extended region. These do not have to be the literal center of the region, but they must be in the x (and y) coordinates of the regions. These ComponentIDs are used in the linking framework to allow an ExtendedComponent to be linked to other components.
- unitsstr, optional
Unit description.
- Raises:
- TypeError
If data is not a list of
shapely.Geometry
objects- ValueError
If center_comp_ids is not a list of length 1 or 2
- Attributes:
- xComponentID
The ComponentID of the x coordinate at the center of the extended region.
- yComponentID
The ComponentID of the y coordinate at the center of the extended region.
Attributes Summary
Whether or not the datatype is categorical.
Whether or not or not the datatype is a date/time
Whether or not or not the datatype represents an extended region
Whether or not the datatype is numeric.
Attributes Documentation