muspan.query#

The muspan.query module provides tools for querying spatial data. This module includes the following submodules:

Query methods

query

A helper class to standardise formatting of boolean queries - this does not return the result of the query, just stores the question.

query_container

A helper class to standardize formatting of boolean queries.

interpret_query

Interpret and filter a query.

is_query_like

Test whether something can be interpreted as a recognisable muspan query.

validate_query

Validate and convert a tuple-like query into a muspan.query object.

is_A_contained_by_B

Determine if each object in population_A is contained by any object in population_B.

filter_objects_to_included_regions

Helper function to filter objects returned by a query down to those inside (or on the boundary of) a set of include_regions, specified by a set of shape IDs

Retrieval methods

get_centroids

Retrieve the centroids of specified objects within a domain.

get_children

Get the children of the objects in the query.

get_collections

Retrieve collections and their corresponding object indices from a domain.

get_family_tree

Constructs a directed graph of the family tree of the objects in the domain.

get_labels

Get labels from a muspan domain.

get_minimum_distances_boundaries

Calculates the smallest distance from each object specified by objects_identifier_A to an object specified by objects_identifier_B.

get_minimum_distances_centroids

Calculates the smallest distance from each object specified by objects_identifier_A to an object specified by objects_identifier_B.

get_object_components

Extracts components of specified dimension from objects in a given domain.

get_object_types

Retrieve the types and indices of objects within a given domain.

get_parents

Get the parents of the objects in the population.

return_object_IDs_from_query_like

Wrapper function to ensure that tuple-like queries are converted into a query before being passed to interpret_query.