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 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] | None = None, filters: List[Callable[[DataFrame, Any | None], DataFrame]] | None = None, attributes: List[Attribute] | None = None, nan_policy: Literal['propagate', 'raise'] = 'propagate')#
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])#
Add filter method to list of filters to run before calling main method.
- 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
- nan_policy#
Describe how metric should handle NaN found in dependencies.
propagate: if a NaN is present in the dependencies, return NaN for
this metric as well. - raise: if a NaN is present, a ValueError will be raised.
- nan_value#
Value to denote empty space or invalid values.
- 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] #