semantique.processor.core.QueryProcessor.parse#
- classmethod QueryProcessor.parse(recipe, datacube, mapping, space, time, spatial_resolution, crs=None, tz=None, **config)[source]#
Parse a semantic query.
During query parsing, the required components for processing are read and converted all together into a single object which will be used internally for further processing of the query. Hence, query parsing takes care of initializing a
QueryProcessor
instance. It also rasterizes the given spatial extent and combines it with the temporal extent into a single spatio-temporal array (seeparse_extent()
<semantique.processor.utils.parse_extent>`).- Parameters:
recipe (
QueryRecipe
) – The query recipe to be processed.datacube (
Datacube
) – The datacube instance to process the query against.mapping (
Mapping
) – The mapping instance to process the query against.space (
SpatialExtent
) – The spatial extent in which the query should be processed.time (
TemporalExtent
) – The temporal extent in which the query should be processed.spatial_resolution (
list
) – Spatial resolution in which the query should be processed. Should be given as a list in the format [y, x], where y is the cell size along the y-axis, x is the cell size along the x-axis, and both are given asint
orfloat
value expressed in the units of the CRS. These values should include the direction of the axes. For most CRSs, the y-axis has a negative direction, and hence the cell size along the y-axis is given as a negative number.crs (optional) – Spatial coordinate reference system in which the query should be processed. Can be given as any object understood by the initializer of
pyproj.crs.CRS
. This includespyproj.crs.CRS
objects themselves, as well as EPSG codes and WKT strings. IfNone
, the CRS of the provided spatial extent is used.tz (optional) – Time zone in which the query should be processed. Can be given as
str
referring to the name of a time zone in the tz database, or as instance of any class inheriting fromdatetime.tzinfo
. IfNone
, the timezone of the provided temporal extent is used.**config – Additional configuration parameters forwarded to the initializer of the QueryProcessor instance. See
QueryProcessor
.
- Returns:
QueryProcessor
– A query processor instance.
Note
Ideally, parsing should also take care of validating the components and their interrelations. For example, it should check if referenced concepts in the provided query recipe are actually defined in the provided mapping. Such functionality is not implemented yet.