Object Attributes🍋
ObjectAttribute
🍋
Bases: Entity
Base class holding elements information/meta-data defining object attributes. It does not hold the attribute data directly but simply points to the database to retrieve it dynamically so that the values are always up-to-date.
An attribute can be either static or dynamic, i-e its value will be recomputed according to the defined expression/condition each time. Therefore it is not valid to have a dynamic attribute without expression.
An ObjectAttribute requires a parent ObjectDB, it is therefore not advised to instantiate any descendant of this class directly. Object attribute creation should be done through the GeoRefObject instead.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
db
|
ObjectDB
|
reference ObjectDB to get data from. |
required |
name
|
str
|
attribute name. |
required |
expr
|
Optional[str]
|
attribute is computed as a condition or expression of other attributes. |
None
|
dynamic
|
bool
|
attributes values are recomputed each time the data is requested. expr must be defined if attribute is dynamic. |
False
|
read_only
|
bool
|
attribute data is protected. |
False
|
Raises:
Type | Description |
---|---|
ValueError
|
|
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
name of the attribute. |
expr |
str
|
expression or condition to compute the attribute data. |
dynamic |
bool
|
if True, data is recomputed by ObjectDB each time it is accessed. |
read_only |
bool
|
whether the attribute is considered read-only. |
dynamic: bool
property
writable
🍋
Return whether the attribute is dynamic, i-e. its data is recomputed using the provided expression.
Returns:
Type | Description |
---|---|
bool
|
True if dynamic, False otherwise. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
prop_x = point_cloud.property("X")
prop_x.dynamic
False
expr: str
property
🍋
Return the attribute expression if provided at creation, otherwise None.
Returns:
Type | Description |
---|---|
str
|
Attribute expression. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
point_cloud.set_property_expr('XYZ', 'X * Y * Z', False)
prop_xyz = point_cloud.property("XYZ")
prop_xyz.expr
'X * Y * Z'
name: str
property
writable
🍋
Return the attribute name.
Returns:
Type | Description |
---|---|
str
|
Attribute name. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
prop_x = point_cloud.property("X")
prop_x.name
'X'
read_only: bool
property
writable
🍋
Return whether the attribute is read-only, i-e. its data is protected.
Returns:
Type | Description |
---|---|
bool
|
True if read-only, False otherwise. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
prop_x = point_cloud.property("X")
prop_x.read_only
False
data(region=None)
🍋
Return the data associated to this attribute. If dynamic, the data will be recomputed first according to its provided expression.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
region
|
str
|
Region or condition to filter data. |
None
|
Returns:
Type | Description |
---|---|
ndarray
|
Underlying attribute data array. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
prop_x = point_cloud.property("X")
prop_x.data()
array([ 0, 3, 6, 9, 12, 15, 18, 21, 24, 27])
ObjectGISRepresentation
🍋
Bases: ObjectDB
Geometrical database for spatially represented objects (see GISObject). This database is specific to handle spatial data (see geopandas.GeoDataFrame) and therefore must be provided when instantiating it.
attributes: List[str]
property
🍋
internals: List[str]
property
🍋
object
property
🍋
Return the object associated to the database.
Returns:
Type | Description |
---|---|
Geo-ref or GIS object. |
properties: List[str]
property
🍋
regions: List[str]
property
🍋
size: int
property
🍋
count(region=None)
🍋
drop(region)
🍋
Delete the data in the specified region.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
region
|
str
|
region name or condition. |
required |
from_file(version, object, manifest, filepath, attributes)
classmethod
🍋
Read the database from the object folder path, its manifest and its corresponding version format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
version
|
str
|
version format. |
required |
object
|
Union[GeoRefObject, GISObject]
|
object attached to this database. |
required |
manifest
|
Dict
|
contents of the manifest file. |
required |
filepath
|
str
|
path to the object folder path. |
required |
attributes
|
List[str]
|
list of attributes to read from the object. |
required |
Raise
ValueError: if there is any data file read error.
Returns:
Type | Description |
---|---|
ObjectDB
|
The newly created object database read from the file. |
generate_attribute_name(prefix='_')
🍋
Generate a random attribute name with the given prefix guaranteed to be available and valid. This method is typically useful for temporary property or region names.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prefix
|
str
|
prefix to start the attribute name with. |
'_'
|
Returns:
Type | Description |
---|---|
str
|
The attribute name string. |
get_attribute(name, return_none=False)
🍋
Return the object attribute associated to the given name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
name to get attribute from. |
required |
return_none
|
bool
|
if True, returns None instead of raising an error. |
False
|
Returns:
Type | Description |
---|---|
ObjectAttribute
|
Object attribute. |
Raises:
Type | Description |
---|---|
ValueError
|
Attribute does not exist. |
get_data(names, region=None)
🍋
Return the object attribute associated to the given name(s).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
names
|
Union[List[str], str]
|
list of names or single name to get data from. |
required |
region
|
str
|
name of the region or condition to optionally filter the data to be returned. |
None
|
Returns:
Type | Description |
---|---|
Data
|
Underlying data array. |
Raises:
Type | Description |
---|---|
ValueError
|
Any property does not exist. |
get_property(name, return_none=False)
🍋
Return the object property associated to the given name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
name to get property from. |
required |
return_none
|
bool
|
if True, returns None instead of raising an error. |
False
|
Returns:
Type | Description |
---|---|
ObjectProperty
|
Object attribute. |
Raises:
Type | Description |
---|---|
ValueError
|
|
get_region(name, return_none=False)
🍋
Return the object region associated to the given name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
name to get region from. |
required |
return_none
|
bool
|
if True, returns None instead of raising an error. |
False
|
Returns:
Type | Description |
---|---|
ObjectRegion
|
Object attribute. |
Raises:
Type | Description |
---|---|
ValueError
|
|
get_region_mask(region)
🍋
Return the boolean mask corresponding to the given region or condition.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
region
|
str
|
region name or condition. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
|
Returns:
Type | Description |
---|---|
ndarray
|
Region mask as boolean np.ndarray. |
group_by(attributes, properties=None, agg_methods=[AggregationMethod.SUM, AggregationMethod.MIN, AggregationMethod.MAX, AggregationMethod.MEAN, AggregationMethod.FIRST, AggregationMethod.MEDIAN])
🍋
Return the object data grouped by the specified attributes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
attributes
|
List[str]
|
attributes to use for the grouping. |
required |
properties
|
List[str]
|
list of properties name to transfer to the GIS Object. Setting to None or empty list will select all existing properties. |
None
|
agg_methods
|
Optional[List[Union[AggregationMethod, Callable]]]
|
aggregation data methods. See Pandas - Group By to find out supported methods. Specifying None will yield the data grouped without aggregation. |
[SUM, MIN, MAX, MEAN, FIRST, MEDIAN]
|
Returns:
Type | Description |
---|---|
Union[DataFrame, DataFrameGroupBy]
|
DataFrame of aggregated data. |
Raises:
Type | Description |
---|---|
ValueError
|
|
AttributeError
|
One of the aggregation methods is not supported. |
keep(region)
🍋
Keep the data in the specified region and delete the data elsewhere.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
region
|
str
|
region name or condition. |
required |
overlay(other_gis_repr, **kwargs)
🍋
Perform spatial overlay between two ObjectGISRepresentation.
Allowed kwargs are GeoPandas overlay
function arguments.
See GeoPandas - Overlay.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other_gis_repr
|
ObjectGISRepresentation
|
ObjectGISRepresentation. |
required |
Returns:
Type | Description |
---|---|
GeoDataFrame
|
New GeoDataFrame. |
plot(interactive_map=False, interactive_max_sample=5000, **kwargs)
🍋
Display the data on a regular plot or an interactive map.
Notes
- interactive map requires
folium
andmapclassify
packages to be installed. - a CRS must be defined for the data to be properly plotted. If the data doesn't have a CRS, the Project CRS will be used by default. See Project.
- interactive map works within a Jupyter Notebook context, please see
folium
for more information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
interactive_map
|
bool
|
if True, |
False
|
interactive_max_sample
|
int
|
maximum number of samples to display in interactive mode. Above 10 000 samples, loading time and interactivity will be impacted. |
5000
|
**kwargs
|
extra arguments to pass to GeoPandas - Plot or GeoPandas - Explore. |
{}
|
Returns:
Type | Description |
---|---|
Union[Axes, Map]
|
A folium Map in interactive mode, or an instance of Matplotlib Axes otherwise. |
Raises:
Type | Description |
---|---|
ValueError
|
Packages are missing for interactive mode. |
refresh_attributes(names)
🍋
remove_attribute(name)
🍋
Remove the object attribute (property or region) associated to the given name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
Union[str, List[str]]
|
name of the attribute or a list of names of the attribute(s) to remove. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
Property is built-in or internal or doesn't exist. |
remove_property(name)
🍋
Remove the object property associated to the given name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
Union[str, List[str]]
|
name of the property or a list of names of the propertie(s) to remove. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
|
ValueError
|
Property is built-in or internal. |
remove_region(name)
🍋
Remove the object region associated to the given name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
Union[str, List[str]]
|
name of the region or a list of names of region(s) to remove. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
|
rename_attribute(current_name, new_name)
🍋
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_name
|
str
|
the current name of the attribute. |
required |
new_name
|
str
|
the new name of the attribute. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
|
KeyError
|
Any of the current names is not found in the database. |
rename_property(current_name, new_name)
🍋
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_name
|
str
|
the current name of the property. |
required |
new_name
|
str
|
the new name of the property. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
|
KeyError
|
Any of the current names is not found in the database. |
rename_region(current_name, new_name)
🍋
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_name
|
str
|
the current name of the region. |
required |
new_name
|
str
|
the new name of the region. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
|
KeyError
|
Any of the current names is not found in the database. |
set_crs(crs)
🍋
Set the Coordinate Reference System (CRS) of the GISObject.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
crs
|
CRS
|
PyProj CRS. |
required |
set_property_data(name, data, update_only, kind=None, unit=None, read_only=False, region=None)
🍋
Creates or replaces a property with the given data. See ObjectProperty for more information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
property name. |
required |
data
|
Data
|
property data array. |
required |
update_only
|
bool
|
only updates the data of an existing property. |
required |
kind
|
PropertyKind
|
property kind, see PropertyKind for available kinds. |
None
|
unit
|
Unit
|
property unit, see Pint Unit for more information. |
None
|
read_only
|
bool
|
whether attribute data is protected. |
False
|
region
|
Optional[str]
|
region or condition in which to set the property data. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
|
set_property_expr(name, expr, dynamic=False, kind=None, unit=None, read_only=False, region=None, default=None)
🍋
Creates or replaces a property with the given expression. See ObjectProperty for more information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
property name. |
required |
expr
|
Union[str, int, float]
|
expression use to compute the property values. Use backquotes when attribute names contains whitespace. |
required |
dynamic
|
bool
|
set to True to have property values recomputed each time the data is requested. |
False
|
kind
|
PropertyKind
|
property kind, see PropertyKind for available kinds. |
None
|
unit
|
Unit
|
property unit, see Pint Unit for more information. |
None
|
read_only
|
bool
|
set to True if attribute data is protected. |
False
|
region
|
Optional[str]
|
region or condition in which to set the property data. |
None
|
default
|
Optional[str]
|
default value used outside of the region. This must be used in combination with a region parameter. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
|
set_region_condition(name, condition, dynamic=False, read_only=False, region=None)
🍋
Creates or replaces a region with the given expression. See ObjectProperty for more information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
region name. |
required |
condition
|
str
|
condition use to compute the region values. Use backquotes when attribute names contains whitespace. |
required |
dynamic
|
bool
|
set to True to have region values recomputed each time the data is requested. |
False
|
read_only
|
bool
|
set to True if region data is protected. |
False
|
region
|
Optional[str]
|
region or condition in which to set the region data. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
|
set_region_data(name, data, update_only, read_only=False, region=None)
🍋
Creates or replaces a region with the given data. See ObjectProperty for more information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
region name. |
required |
data
|
Data
|
region data array. |
required |
update_only
|
bool
|
only updates the data of an existing property. |
required |
read_only
|
bool
|
set to True if region data is protected. |
False
|
region
|
Optional[str]
|
region or condition in which to set the region data. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
|
to_csv(filename, names=None, region=None, skip_nan=False, sort_by=None, sort_ascending=True, mapping=None, **kwargs)
🍋
Export the given attribute(s) to a CSV-file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str
|
path to export the file to. |
required |
names
|
Optional[Union[List[str], str]]
|
list of names or single name of the attribute(s) to export. If not specified, all attributes are exported. |
None
|
region
|
Optional[str]
|
region name or condition to filter data to export. |
None
|
skip_nan
|
bool
|
True will drop NaN values from the exported file. Otherwise NaN values will
be exported as NumericalConstants.NDV (-99999). To overwrite the NaN values,
use |
False
|
sort_by
|
Union[str, List[str]]
|
sort the data by the given attributes. |
None
|
sort_ascending
|
Union[bool, List[bool]]
|
sorting order when |
True
|
mapping
|
Dict
|
rename given columns in the exported CSV. |
None
|
**kwargs
|
extra arguments to pass along to Pandas - To CSV. |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
Attribute does not exist. |
to_dataframe(names=None, region=None)
🍋
Export the given attribute(s) to a pandas DataFrame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
names
|
Optional[Union[List[str], str]]
|
list of names or single name of the attribute(s) to export. If not specified, all attributes are exported. |
None
|
region
|
Optional[str]
|
region name or condition to filter data to export. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
Attribute does not exist. |
to_file(version, filepath, attributes)
🍋
Dump the database to the given object folder path in the specified version format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
version
|
str
|
version format. |
required |
filepath
|
str
|
path to the object folder path. |
required |
attributes
|
List[str]
|
list of attributes to write to the object. |
required |
Raise
ValueError: - if there is any data file read error. - if there is no writer for the given version.
Returns:
Type | Description |
---|---|
Dict
|
The updated manifest. |
to_geojson(filename)
🍋
Export the geometry to a geojson.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str
|
path to export the file to. |
required |
to_shp(filename)
🍋
Export the geometry to a shpfile.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str
|
path to export the file to. |
required |
transform(attributes, properties=None, agg_methods=AggregationMethod.FIRST)
🍋
Return the object data grouped by the specified attributes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
attributes
|
List[str]
|
attributes to use for the grouping. |
required |
properties
|
Optional[List[str]]
|
list of properties name to transfer to the GIS Object. Setting to None or empty list will select all existing properties. |
None
|
agg_methods
|
Union[AggregationMethod, Callable]
|
aggregation data methods. See Pandas - Group By to find out supported methods. |
FIRST
|
Returns:
Type | Description |
---|---|
DataFrame
|
DataFrame of aggregated data. |
Raises:
Type | Description |
---|---|
ValueError
|
|
AttributeError
|
One of the aggregation methods is not supported. |
translate_coord(coord, expr, region=None)
🍋
Shift the given existing coordinate by the given expression or value regardless of the coordinate being read only or not.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
coord
|
Union[Attribute, Coord]
|
coordinate property. |
required |
expr
|
str
|
expression use to compute the property values. Use backquotes when attribute names contains whitespace. |
required |
region
|
Optional[str]
|
region or condition in which to set the property data. |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
Coord doesn't exist. |
update_coord(coord, data)
🍋
Update the existing coordinate to the given data, regardless of the coordinate being read only or not.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
coord
|
Coord
|
coordinate property. |
required |
data
|
Data
|
value to set the coordinate to. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
Coord doesn't exist. |
ObjectProperty
🍋
Bases: ObjectAttribute
Property attribute class. See ObjectAttribute for more information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
db
|
ObjectDB
|
reference ObjectDB to get data from. |
required |
name
|
str
|
property name. |
required |
kind
|
Optional[PropertyKind]
|
property kind, see PropertyKind enum for more available kind. |
None
|
unit
|
Optional[Unit]
|
property unit, see Unit in pint for more information. |
None
|
expr
|
Optional[str]
|
property is computed as an expression of other attributes. |
None
|
dynamic
|
bool
|
attributes values are recomputed each time the data is requested. expr must be defined if property is dynamic. |
False
|
read_only
|
bool
|
attribute data is protected. |
False
|
Raises:
Type | Description |
---|---|
ValueError
|
|
Attributes:
Name | Type | Description |
---|---|---|
kind |
PropertyKind
|
property kind if defined, otherwise None. |
unit |
Unit
|
property unit if defined, otherwise None. |
dynamic: bool
property
writable
🍋
Return whether the attribute is dynamic, i-e. its data is recomputed using the provided expression.
Returns:
Type | Description |
---|---|
bool
|
True if dynamic, False otherwise. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
prop_x = point_cloud.property("X")
prop_x.dynamic
False
expr: str
property
🍋
Return the attribute expression if provided at creation, otherwise None.
Returns:
Type | Description |
---|---|
str
|
Attribute expression. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
point_cloud.set_property_expr('XYZ', 'X * Y * Z', False)
prop_xyz = point_cloud.property("XYZ")
prop_xyz.expr
'X * Y * Z'
kind: PropertyKind
property
writable
🍋
Return the kind associated to the property if any, None otherwise.
Returns:
Type | Description |
---|---|
PropertyKind
|
Property kind. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
prop_x = point_cloud.property("X")
prop_x.kind
<PropertyKind.GEOMETRY: 'GEOMETRY'>
name: str
property
writable
🍋
Return the attribute name.
Returns:
Type | Description |
---|---|
str
|
Attribute name. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
prop_x = point_cloud.property("X")
prop_x.name
'X'
read_only: bool
property
writable
🍋
Return whether the attribute is read-only, i-e. its data is protected.
Returns:
Type | Description |
---|---|
bool
|
True if read-only, False otherwise. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
prop_x = point_cloud.property("X")
prop_x.read_only
False
unit: Unit
property
writable
🍋
Return the unit associated to the property if any, None otherwise.
Returns:
Type | Description |
---|---|
Unit
|
Pint Unit. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
prop_x = point_cloud.property("X")
prop_x.unit
<Unit('meter')>
data(region=None)
🍋
Return the data associated to this attribute. If dynamic, the data will be recomputed first according to its provided expression.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
region
|
str
|
Region or condition to filter data. |
None
|
Returns:
Type | Description |
---|---|
ndarray
|
Underlying attribute data array. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
prop_x = point_cloud.property("X")
prop_x.data()
array([ 0, 3, 6, 9, 12, 15, 18, 21, 24, 27])
ObjectRegion
🍋
Bases: ObjectAttribute
Region attribute class. See ObjectAttribute for more information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
db
|
ObjectDB
|
reference ObjectDB to get data from. |
required |
name
|
str
|
region name. |
required |
condition
|
Optional[str]
|
region is computed as a condition of other attributes. |
None
|
dynamic
|
bool
|
attributes values are recomputed each time the data is requested. expr must be defined if property is dynamic. |
False
|
read_only
|
bool
|
attribute data is protected. |
False
|
Raises:
Type | Description |
---|---|
ValueError
|
|
dynamic: bool
property
writable
🍋
Return whether the attribute is dynamic, i-e. its data is recomputed using the provided expression.
Returns:
Type | Description |
---|---|
bool
|
True if dynamic, False otherwise. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
prop_x = point_cloud.property("X")
prop_x.dynamic
False
expr: str
property
🍋
Return the attribute expression if provided at creation, otherwise None.
Returns:
Type | Description |
---|---|
str
|
Attribute expression. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
point_cloud.set_property_expr('XYZ', 'X * Y * Z', False)
prop_xyz = point_cloud.property("XYZ")
prop_xyz.expr
'X * Y * Z'
name: str
property
writable
🍋
Return the attribute name.
Returns:
Type | Description |
---|---|
str
|
Attribute name. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
prop_x = point_cloud.property("X")
prop_x.name
'X'
read_only: bool
property
writable
🍋
Return whether the attribute is read-only, i-e. its data is protected.
Returns:
Type | Description |
---|---|
bool
|
True if read-only, False otherwise. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
prop_x = point_cloud.property("X")
prop_x.read_only
False
data(region=None)
🍋
Return the data associated to this attribute. If dynamic, the data will be recomputed first according to its provided expression.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
region
|
str
|
Region or condition to filter data. |
None
|
Returns:
Type | Description |
---|---|
ndarray
|
Underlying attribute data array. |
Example
import geolime as geo
import numpy as np
xyz = np.arange(30).reshape(10, 3)
point_cloud = geo.PointCloud("MyPointCloud", xyz)
prop_x = point_cloud.property("X")
prop_x.data()
array([ 0, 3, 6, 9, 12, 15, 18, 21, 24, 27])