spatialdata.models.PointsModel#

class spatialdata.models.PointsModel#

Attributes table#

ATTRS_KEY

FEATURE_KEY

INSTANCE_KEY

NPARTITIONS

TRANSFORM_KEY

Methods table#

parse(data, **kwargs)

Validate (or parse) points data.

validate(data)

Validate data.

Attributes#

PointsModel.ATTRS_KEY = 'spatialdata_attrs'#
PointsModel.FEATURE_KEY = 'feature_key'#
PointsModel.INSTANCE_KEY = 'instance_key'#
PointsModel.NPARTITIONS = 1#
PointsModel.TRANSFORM_KEY = 'transform'#

Methods#

PointsModel.parse(data, **kwargs)#

Validate (or parse) points data.

Parameters:
  • data (Any) –

    Data to parse:

    • If numpy.ndarray, an annotation pandas.DataFrame must be provided, as well as the feature_key in the annotation. Furthermore, numpy.ndarray is assumed to have shape (n_points, axes), with axes being “x”, “y” and optionally “z”.

    • If pandas.DataFrame, a coordinates mapping must be provided with key as valid axes and value as column names in dataframe.

  • annotation – Annotation dataframe. Only if data is numpy.ndarray. If data is an array, the index of the annotations will be used as the index of the parsed points.

  • coordinates – Mapping of axes names (keys) to column names (valus) in data. Only if data is pandas.DataFrame. Example: {‘x’: ‘my_x_column’, ‘y’: ‘my_y_column’}. If not provided and data is pandas.DataFrame, and x, y and optinally z are column names, then they will be used as coordinates.

  • feature_key – Feature key in annotation or data.

  • instance_key – Instance key in annotation or data.

  • transformations – Transformations of points.

  • kwargs (Any) – Additional arguments for dask.dataframe.from_array().

Return type:

DataFrame

Returns:

: dask.dataframe.core.DataFrame

classmethod PointsModel.validate(data)#

Validate data.

Parameters:

data (DataFrame) – dask.dataframe.core.DataFrame to validate.

Return type:

None

Returns:

: None