API Reference#

The API Reference contains auto-generated function documentation. This kind of documentation is meant to be concise and more technically oriented. The functions are grouped into different categories. As a regular user, you will mainly use the functions in the Components and Building Blocks categories to build and execute query recipes within a specific context. The functions in the Processor category are those internally used for query processing, and mainly of interest for advanced users and developers. The Exceptions category contains the custom exception classes of semantique.

Components#

Recipe#

QueryRecipe

Dict-like container to store instructions of a query recipe.

Mapping#

mapping.Mapping

Base class for mapping configurations.

mapping.Semantique

Semantique specific mapping configuration.

EO data cube#

datacube.Datacube

Base class for EO data cube configurations.

datacube.Opendatacube

Opendatacube specific EO data cube configuration.

datacube.GeotiffArchive

EO data cube configuration for zipped GeoTIFF files.

datacube.STACCube

EO data cube configuration for results from STAC searches.

Spatio-temporal extent#

extent.SpatialExtent

Dict-like representation of a spatial extent.

extent.TemporalExtent

Dict-like representation of a temporal extent.

Building blocks#

References#

concept

Reference to a semantic concept.

entity

Reference to a semantic concept being an entity.

event

Reference to a semantic concept being an event.

layer

Reference to a data layer in an EO data cube.

appearance

Reference to a data layer describing appearance.

artifacts

Reference to a data layer describing artifacts.

atmosphere

Reference to a data layer describing atmosphere.

reflectance

Reference to a data layer describing reflectance.

topography

Reference to a data layer describing topography.

result

Reference to a another result definition.

self

Reference to the active evaluation object itself.

collection

Reference to a collection of multiple arrays.

Verbs#

Verbs for single arrays#

ArrayProxy.evaluate

Evaluate an expression for each pixel in an array.

ArrayProxy.extract

Extract coordinate labels of a dimension as a new array.

ArrayProxy.filter

Filter the values in an array.

ArrayProxy.filter_time

Filter an array along the temporal dimension.

ArrayProxy.filter_space

Filter an array along the spatial dimension.

ArrayProxy.assign

Assign new values to the pixels in an array.

ArrayProxy.assign_time

Assign temporal coordinates as values to the pixels in an array.

ArrayProxy.assign_space

Assign spatial coordinates as values to the pixels in an array.

ArrayProxy.groupby

Group the values in an array.

ArrayProxy.groupby_time

Group an array along the temporal dimension.

ArrayProxy.groupby_space

Group an array along the spatial dimension.

ArrayProxy.reduce

Reduce the dimensionality of an array.

ArrayProxy.shift

Shift the values in an array along a dimension.

ArrayProxy.smooth

Smooth the values in an array through a moving window.

ArrayProxy.trim

Trim the dimensions of an array.

ArrayProxy.delineate

Delineate spatio-temporal objects in a binary array.

ArrayProxy.fill

Fill nodata values in array by interpolating valid data values.

ArrayProxy.apply_custom

Apply a user-defined verb to the array.

Verbs for array collections#

CollectionProxy.compose

Create a categorical composition of multiple binary arrays.

CollectionProxy.concatenate

Concatenate multiple arrays along a new or existing dimension.

CollectionProxy.merge

Merge pixel values of multiple arrays into a single value per pixel.

CollectionProxy.evaluate

Apply the evaluate verb to each array in a collection.

CollectionProxy.extract

Apply the extract verb to each array in a collection.

CollectionProxy.filter

Apply the filter verb to each array in a collection.

CollectionProxy.filter_time

Apply the filter_time verb to each array in a collection.

CollectionProxy.filter_space

Apply the filter_space verb to each array in a collection.

CollectionProxy.assign

Apply the assign verb to each array in a collection.

CollectionProxy.assign_time

Apply the assign_time verb to each array in a collection.

CollectionProxy.assign_space

Apply the assign_space verb to each array in a collection.

CollectionProxy.reduce

Apply the reduce verb to each array in a collection.

CollectionProxy.shift

Apply the shift verb to each array in a collection.

CollectionProxy.smooth

Apply the smooth verb to each array in a collection.

CollectionProxy.trim

Apply the trim verb to each array in a collection.

CollectionProxy.delineate

Apply the delineate verb to each array in a collection.

CollectionProxy.fill

Apply the fill verb to each array in a collection.

CollectionProxy.apply_custom

Apply a user-defined verb to each array in a collection.

Utility verbs#

ArrayProxy.name

Give a name to an array.

Special values#

label

Character label of a numeric index.

set

Finite set of values.

interval

Interval of numerical or ordinal values.

geometry

Spatial geometry object.

time_instant

Time instant.

time_interval

Time interval.

Dimensions#

Reserved dimension names#

dimensions.TIME

Reserved dimension name for the temporal dimension.

dimensions.SPACE

Reserved dimension name for the stacked spatial (X, Y) dimension.

dimensions.X

Reserved dimension name for the spatial X dimension.

dimensions.Y

Reserved dimension name for the spatial Y dimension.

Dimension components#

components.time.YEAR

Component storing the year of a timestamp.

components.time.SEASON

Component storing the season of a timestamp.

components.time.QUARTER

Component storing the year quarter of a timestamp.

components.time.MONTH

Component storing the month number of a timestamp.

components.time.WEEK

Component storing the week number of a timestamp.

components.time.DAY

Component storing the day number of a timestamp.

components.time.DAY_OF_WEEK

Component storing the day of the week of a timestamp.

components.time.DAY_OF_YEAR

Component storing the day of the year of a timestamp.

components.time.HOUR

Component storing the hour of a timestamp.

components.time.MINUTE

Component storing the minute of a timestamp.

components.time.SECOND

Component storing the second of a timestamp.

components.space.X

Component storing the X coordinate of a coordinate tuple.

components.space.Y

Component storing the Y coordinate of a coordinate tuple.

components.space.FEATURE

Component storing feature index of a coordinate tuple.

Operators#

Univariate operators#

operators.NOT

Reference to operator function not.

operators.IS_MISSING

Reference to operator function is_missing.

operators.NOT_MISSING

Reference to operator function not_missing.

operators.ABSOLUTE

Reference to operator function absolute.

operators.EXPONENTIAL

Reference to operator function exponential.

operators.CUBE_ROOT

Reference to operator function cube_root.

operators.NATURAL_LOGARITHM

Reference to operator function natural_logarithm.

operators.SQUARE_ROOT

Reference to operator function square_root.

operators.FLOOR

Reference to operator function floor.

operators.CEILING

Reference to operator function ceiling.

operators.COSINE

Reference to operator function cosine.

operators.SINE

Reference to operator function sine.

operators.TANGENT

Reference to operator function tangent.

operators.SECANT

Reference to operator function secant.

operators.COSECANT

Reference to operator function cosecant.

operators.COTANGENT

Reference to operator function cotangent.

operators.TO_DEGREES

Reference to operator function to_degrees.

operators.TO_RADIANS

Reference to operator function to_radians.

Algebraic operators#

operators.ADD

Reference to operator function add.

operators.DIVIDE

Reference to operator function divide.

operators.MULTIPLY

Reference to operator function multiply.

operators.POWER

Reference to operator function power.

operators.SUBTRACT

Reference to operator function subtract.

operators.NORMALIZED_DIFFERENCE

Reference to operator function normalized_difference.

Boolean operators#

operators.AND

Reference to operator function and.

operators.OR

Reference to operator function or.

operators.EXCLUSIVE_OR

Reference to operator function exclusive_or.

Relational operators#

operators.EQUAL

Reference to operator function equal.

operators.NOT_EQUAL

Reference to operator function not_equal.

operators.IN

Reference to operator function in.

operators.NOT_IN

Reference to operator function not_in.

operators.GREATER

Reference to operator function greater.

operators.GREATER_EQUAL

Reference to operator function greater_equal.

operators.LESS

Reference to operator function less.

operators.LESS_EQUAL

Reference to operator function less_equal.

Spatial relational operators#

operators.INTERSECTS

Reference to operator function intersects.

Temporal relational operators#

operators.AFTER

Reference to operator function after.

operators.BEFORE

Reference to operator function before.

operators.DURING

Reference to operator function during.

Reducers#

Statistical reducers#

reducers.MEAN

Reference to reducer function mean.

reducers.MEDIAN

Reference to reducer function median.

reducers.MODE

Reference to reducer function mode.

reducers.MAX

Reference to reducer function max.

reducers.MIN

Reference to reducer function min.

reducers.RANGE

Reference to reducer function range.

reducers.N

Reference to reducer function n.

reducers.PRODUCT

Reference to reducer function product.

reducers.STANDARD_DEVIATION

Reference to reducer function standard_deviation.

reducers.SUM

Reference to reducer function sum.

reducers.VARIANCE

Reference to reducer function variance.

Boolean reducers#

reducers.ALL

Reference to reducer function all.

reducers.ANY

Reference to reducer function any.

reducers.NONE

Reference to reducer function none.

Occurence reducers#

reducers.COUNT

Reference to reducer function count.

reducers.PERCENTAGE

Reference to reducer function percentage.

Positional reducers#

reducers.FIRST

Reference to reducer function first.

reducers.LAST

Reference to reducer function last.

Processor#

Core#

processor.core.QueryProcessor

Worker that takes care of processing a semantic query.

processor.core.Cache

Cache of retrieved data layers.

Array objects#

processor.arrays.Array

Internal representation of a multi-dimensional array.

processor.arrays.Collection

Internal representation of a collection of multiple arrays.

Special value objects#

processor.values.Interval

Object to represent a set of values within the bounds of an interval.

Operator functions#

Univariate operators#

processor.operators.not_

Test if x is not true.

processor.operators.is_missing_

Test if x is a missing observation.

processor.operators.not_missing_

Test if x is a valid observation.

processor.operators.absolute_

Compute the absolute value of x.

processor.operators.exponential_

Compute the exponential function of x.

processor.operators.cube_root_

Compute the cube root of x.

processor.operators.natural_logarithm_

Compute the natural logarithm of x.

processor.operators.square_root_

Compute the square root of x.

processor.operators.floor_

Compute the floor of x.

processor.operators.ceiling_

Compute the ceiling of x.

processor.operators.cosine_

Compute the cosine of x.

processor.operators.sine_

Compute the sine of x.

processor.operators.tangent_

Compute the tangent of x.

processor.operators.secant_

Compute the secant of x.

processor.operators.cosecant_

Compute the cosecant of x.

processor.operators.cotangent_

Compute the cotangent of x.

processor.operators.to_degrees_

Converts angles in radians to angles in degrees.

processor.operators.to_radians_

Converts angles in degrees to angles in radians.

Algebraic operators#

processor.operators.add_

Add y to x.

processor.operators.divide_

Divide x by y.

processor.operators.multiply_

Multiply x by y.

processor.operators.power_

Raise x to the yth power.

processor.operators.subtract_

Subtract y from x.

processor.operators.normalized_difference_

Compute the normalized difference between x and y.

Boolean operators#

processor.operators.and_

Test if both x and y are true.

processor.operators.or_

Test if at least one of x and y are true.

processor.operators.exclusive_or_

Test if either x or y is true but not both.

Relational operators#

processor.operators.equal_

Test if x is equal to y.

processor.operators.not_equal_

Test if x is not equal to y.

processor.operators.in_

Test if x is a member of set y.

processor.operators.not_in_

Test if x is not a member of set y.

processor.operators.greater_

Test if x is greater than y.

processor.operators.greater_equal_

Test if x is greater than or equal to y.

processor.operators.less_

Test if x is less than y.

processor.operators.less_equal_

Test if x is less than or equal to y.

Spatial relational operators#

processor.operators.intersects_

Test if x spatially intersects with y.

Temporal relational operators#

processor.operators.after_

Test if x comes after y.

processor.operators.before_

Test if x comes before y.

processor.operators.during_

Test if x is during interval y.

Reducer functions#

Statistical reducers#

processor.reducers.mean_

Calculate the mean of a set of values.

processor.reducers.median_

Return the median value in a set.

processor.reducers.mode_

Return the most occuring value in a set.

processor.reducers.max_

Return the maximum value in a set.

processor.reducers.min_

Return the minimum value in a set.

processor.reducers.range_

Return the difference between the maximum and minimum values in a set.

processor.reducers.n_

Return the number of observations in a set.

processor.reducers.product_

Calculate the product of a set of values.

processor.reducers.standard_deviation_

Calculate the standard deviation of a set of values.

processor.reducers.sum_

Calculate the sum of a set of values.

processor.reducers.variance_

Calculate the variance of a set of values.

Boolean reducers#

processor.reducers.all_

Test if all values in a set are true.

processor.reducers.any_

Test if at least one value in a set is true.

processor.reducers.none_

Test if none of the values in a set are true.

Occurence reducers#

processor.reducers.count_

Count the number of true values in a set.

processor.reducers.percentage_

Calculate the percentage of true values in a set.

Positional reducers#

processor.reducers.first_

Return the first value in a set.

processor.reducers.last_

Return the last value in a set.

Utils#

processor.utils.parse_extent

Parse the spatial and temporal extent into a spatio-temporal array.

processor.utils.parse_datetime_component

Parse datetime accessor arrays.

processor.utils.get_null

Return the appropriate nodata value for an array.

processor.utils.allnull

Test whether all elements along a given axis in an array are null.

processor.utils.null_as_zero

Convert all null values in an array to 0.

processor.utils.inf_as_null

Convert all infinite values in an array to null values.

processor.utils.datetime64_as_unix

Convert datetime64 values in an array to unix time values.

processor.utils.convert_datetime64

Convert a numpy datetime object to a different timezone.

Value type handling#

processor.types.TypePromoter

Worker that takes care of promoting value types during an operation.

processor.types.get_value_type

Determine the value type of an object.

processor.types.get_value_labels

Obtain the value labels of an object.

processor.types.DTYPE_MAPPING

Mapping between numpy data types and semantique value types.

processor.types.TYPE_PROMOTION_MANUALS

Type promotion manuals for all built-in operators and reducers.

Exceptions#

exceptions.AlignmentError

Raised when an array cannot be aligned to a given shape.

exceptions.EmptyDataError

Raised when a retrieved array does not contain any valid values.

exceptions.InvalidValueTypeError

Raised when an array has a value type which a process does not allow.

exceptions.InvalidIntervalError

Raised when an intervals upper bound is smaller than its lower bound.

exceptions.InvalidBuildingBlockError

Raised when a query recipe contains an invalid building block.

exceptions.UnknownConceptError

Raised when an unexisting semantic concept is referenced.

exceptions.UnknownLayerError

Raised when an unexisting data layer is referenced.

exceptions.UnknownResultError

Raised when an unexisting query result is referenced.

exceptions.UnknownVerbError

Raised when an undefined custom verb function is used.

exceptions.UnknownReducerError

Raised when an undefined reducer function is used.

exceptions.UnknownOperatorError

Raised when an undefined operator function.

exceptions.UnknownDimensionError

Raised when an unexisting dimension is referenced.

exceptions.UnknownComponentError

Raised when an unexisting dimension component is referenced.

exceptions.UnknownLabelError

Raised when a referenced label is not used for any value in an array.

exceptions.TooManyDimensionsError

Raised when an array has more dimensions than a process allows.

exceptions.MissingDimensionError

Raised when an array does not contain a required dimension.

exceptions.MixedDimensionsError

Raised when arrays in a collection have differing dimensions.

exceptions.ReservedDimensionError

Raised when a reserved dimension name is being used for a new dimension.

exceptions.MixedTimeZonesError

Raised when the bounds of a time interval have differing time zones.