Attribute#
- class silvimetric.resources.attribute.Attribute(name: str, dtype)#
Bases:
object
Represents point data from a PDAL execution that has been binned, and provides the information necessary to transfer that data to the database.
- dtype: AttributeDtype#
SilviMetric representation of array of numpy dtype
- entry_name() str #
Return TileDB attribute name.
- static from_string(data: str) Attribute #
Create Attribute from string or dict version of it.
- Parameters:
data – Stringified or json object of attribute
- Raises:
TypeError – Incorrect type of incoming data, must be string or dict
- Returns:
Return derived Attribute
- make_array(data, copy=False)#
Create Pandas Extension array for TileDB compatibility.
- name#
Name of the attribute, eg. Intensity.
- schema() Attr #
Create the tiledb schema for this attribute. :return: TileDB attribute schema
- to_json() object #
Metric#
- class silvimetric.resources.metric.Metric(name: str, dtype: dtype, method: Callable[[DataFrame, Any], DataFrame], dependencies: list[Self] = [], filters: List[Callable[[DataFrame, Any | None], DataFrame]] = [], attributes: List[Attribute] = [])#
Bases:
object
A Metric is a TileDB entry representing derived cell data. There is a base set of metrics available through Silvimetric, or you can create your own. A Metric object has all the information necessary to facilitate the derivation of data as well as its insertion into the database.
- add_filter(fn: Callable[[DataFrame, Any | None], DataFrame], desc: str)#
Add filter method to list of filters to run before calling main method.
- attributes#
List of Attributes this Metric applies to. If empty it’s used for all Attributes
- dependencies#
Metrics this is dependent on.
- do(data: DataFrame, *args) DataFrame #
Run metric and filters. Use previously run metrics to avoid running the same thing multiple times.
- dtype#
Numpy data type.
- entry_name(attr: str) str #
Name for use in TileDB and extract file generation.
- filters#
List of user-defined filters to perform before performing method.
- static from_string(data: str) Self #
- name#
Metric name. eg. mean
- run_filters(data: DataFrame) DataFrame #
- sanitize_and_run(d, locs, args)#
Sanitize arguments, find the indices
- schema(attr: Attribute) Any #
Create schema for TileDB creation.
- Parameters:
attr –
silvimetric.resources.entry.Atttribute
- Returns:
TileDB Attribute
- to_json() dict[str, any] #