weaver.processes.opensearch
Module Contents
- weaver.processes.opensearch.alter_payload_after_query(payload: weaver.typedefs.JSON) weaver.typedefs.JSON [source]
When redeploying the package on ADES, strip out any EOImage parameter.
- weaver.processes.opensearch.validate_bbox(bbox: str) None [source]
Validate bounding box formatted as
x1, y1, x2, y2
string composed of floating point numbers.
- weaver.processes.opensearch.query_eo_images_from_wps_inputs(wps_inputs: Dict[str, Deque], eoimage_source_info: Dict[str, weaver.typedefs.DataSourceOpenSearch], accept_mime_types: Dict[str, List[str]], settings: weaver.typedefs.AnySettingsContainer | None = None) Dict[str, Deque[weaver.processes.convert.WPS_Input_Type]] [source]
Query OpenSearch using parameters in inputs and return file links.
- Parameters:
wps_inputs – inputs containing info to query
eoimage_source_info – data source info of eoimages
accept_mime_types – dict of list of accepted mime types, ordered by preference
settings – application settings to retrieve request options as necessary.
- weaver.processes.opensearch.replace_with_opensearch_scheme(link: str) str [source]
Replaces
file://
scheme byopensearch://
scheme.
- class weaver.processes.opensearch.OpenSearchQuery(collection_identifier: str, osdd_url: str, catalog_search_field: str = 'parentIdentifier', settings: weaver.typedefs.AnySettingsContainer | None = None)[source]
Container to handle OpenSearch queries.
- Parameters:
collection_identifier – Collection ID to query
osdd_url – Global OSDD url for OpenSearch queries.
catalog_search_field – Name of the field for the collection identifier.
settings – application settings to retrieve request options as necessary.
- _prepare_query_url(template_url: str, params: Dict) Tuple[str, weaver.typedefs.JSON] [source]
Prepare the URL for the OpenSearch query.
- Parameters:
template_url – url containing query parameters.
params – parameters to insert in formatted URL.
- _query_features_paginated(params: weaver.typedefs.JSON) Iterator[weaver.typedefs.JSON, str] [source]
Iterates over paginated results until all features are retrieved.
- Parameters:
params – query parameters
- query_datasets(params: weaver.typedefs.JSON, accept_schemes: List[str], accept_mime_types: List[str]) Iterator[str] [source]
Query the specified datasets.
Loop on every OpenSearch result feature and yield URL matching required mime-type and scheme. Log a warning if a feature cannot yield a valid URL (either no compatible mime-type or scheme)
- Parameters:
params – query parameters
accept_schemes – only return links of this scheme
accept_mime_types – list of accepted mime types, ordered by preference
- Raises:
KeyError – If the feature doesn’t contain a json data section or an atom alternative link
- weaver.processes.opensearch.get_additional_parameters(input_data: weaver.typedefs.JSON) List[Tuple[str, str]] [source]
Retrieve the values from the
additionalParameters
of the input.- Parameters:
input_data – Dict containing or not the “additionalParameters” key
- class weaver.processes.opensearch.EOImageDescribeProcessHandler(inputs: List[weaver.processes.convert.JSON_IO_Type])[source]
-
- static make_toi(id_: str, start_date: bool = True) weaver.typedefs.JSON [source]
Generate the Time-Of-Interest definition.
- Parameters:
id – ID of the input.
start_date – (Default value = True)
- to_opensearch(unique_aoi: bool, unique_toi: bool) List[weaver.typedefs.JSON] [source]
Convert the inputs with OpenSearch request parameters considering Area-Of-Interest and Time-Of-Interest.
- Parameters:
unique_aoi – indicate if a single/global AOI must be applied or individual ones for each input.
unique_toi – indicate if a single/global TOI must be applied or individual ones for each input.
- weaver.processes.opensearch.get_eo_images_inputs_from_payload(payload: weaver.typedefs.JSON) List[weaver.typedefs.JSON] [source]
Extracts only inputs that correspond to an EOImage based on provided
additionalParameters
.
- weaver.processes.opensearch.get_original_collection_id(payload: weaver.typedefs.JSON, wps_inputs: Dict[str, collections.deque[weaver.processes.convert.WPS_Input_Type]]) Dict[str, collections.deque[weaver.processes.convert.WPS_Input_Type]] [source]
Obtains modified WPS inputs considering mapping to known OpenSearch collection IDs.
When we deploy a Process that contains OpenSearch parameters, the collection identifier is modified:
Ex: files -> collection Ex: s2 -> collection_s2, probav -> collection_probav
This function changes the ID in the execute request to the one from the deployed Process description.
- Parameters:
payload
wps_inputs
- Returns:
- weaver.processes.opensearch.get_eo_images_data_sources(payload: Dict, wps_inputs: Dict[str, collections.deque[weaver.processes.convert.WPS_Input_Type]]) Dict[str, weaver.typedefs.DataSourceOpenSearch] [source]
Resolve the data source of an
EOImage
input reference.- Parameters:
payload – Deploy payload
wps_inputs – Execute inputs
- Returns:
Data source of the
EOImage
.
- weaver.processes.opensearch.get_eo_images_mime_types(payload: weaver.typedefs.JSON) Dict[str, List[str]] [source]
Get the accepted media-types from the deployment payload.
- Parameters:
payload – Deploy payload.
- Returns:
Accepted media-type.
- weaver.processes.opensearch.insert_max_occurs(payload: weaver.typedefs.JSON, wps_inputs: Dict[str, Deque[weaver.processes.convert.WPS_Input_Type]]) None [source]
Insert maxOccurs value in wps inputs using the deploy payload.
- Parameters:
payload – Deploy payload.
wps_inputs – WPS inputs.
- weaver.processes.opensearch.modified_collection_identifiers(eo_image_identifiers: List[str]) List[str] [source]
- weaver.processes.opensearch.get_data_source(collection_id: str) weaver.typedefs.DataSourceOpenSearch [source]
Obtain the applicable Data Source based on the provided collection identifier.
- weaver.processes.opensearch.get_eo_images_ids_from_payload(payload: weaver.typedefs.JSON) List[str] [source]