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.load_wkt_bbox_bounds(wkt: str) str[source]
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.

  • 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 by opensearch:// 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.

  • 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.

get_template_url() str[source]
_prepare_query_url(template_url: str, params: Dict) Tuple[str, weaver.typedefs.JSON][source]

Prepare the URL for the OpenSearch query.

  • 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.


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)

  • params – query parameters

  • accept_schemes – only return links of this scheme

  • accept_mime_types – list of accepted mime types, ordered by preference


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.


input_data – Dict containing or not the “additionalParameters” key

class weaver.processes.opensearch.EOImageDescribeProcessHandler(inputs: List[weaver.processes.convert.JSON_IO_Type])[source]
static is_eoimage_input(input_data: weaver.typedefs.JSON) bool[source]
static get_allowed_collections(input_data: weaver.typedefs.JSON) List[str][source]
static make_aoi(id_: str) weaver.typedefs.JSON[source]
static make_collection(identifier: str, allowed_values: List[str]) weaver.typedefs.JSON[source]
static make_toi(id_: str, start_date: bool = True) weaver.typedefs.JSON[source]

Generate the Time-Of-Interest definition.

  • 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.

  • 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.

  • payload

  • wps_inputs


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.

  • payload – Deploy payload

  • wps_inputs – Execute inputs


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.


payload – Deploy payload.


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.

  • 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]
weaver.processes.opensearch.replace_inputs_describe_process(inputs: List[weaver.typedefs.JSON], payload: weaver.typedefs.JSON) List[weaver.typedefs.JSON][source]

Replace EOImage inputs (if additionalParameter -> EOImage -> true) with OpenSearch query parameters.

weaver.processes.opensearch.make_param_id(param_name: str, identifier: str) str[source]

Only adds an underscore between the parameters.