Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion cookbook/sections/data-consumers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

=== Search the Global Discovery Catalogue

The https://wmo-im.github.io/wis2-guide/guide/wis2-guide-DRAFT.html#_2_4_4_global_discovery_catalogue[Global Discovery Catalogue (GDC)] allows for a wide range of query predicates to search for data in WIS2 as per the OGC API - Records - Part 1: Core specification.
The https://wmo-im.github.io/wis2-guide/guide/wis2-guide-APPROVED.html#_2_4_4_global_discovery_catalogue[Global Discovery Catalogue (GDC)] allows for a wide range of query predicates to search for data in WIS2 as per the OGC API - Records - Part 1: Core specification.

The GDC can be searched via the `/collections/wis2-discovery-metadata/items` endpoint. This endpoint provides a number query parameters as described in the examples below.

Expand Down Expand Up @@ -50,3 +50,43 @@ Note that the format of `bbox` is comma-separated values in the following order:
- present search results 1-10: `limit=10`
- present search results 11-20: `limit=10&offset=10`
- limit to 3 search results: `limit=3`

=== Finding data subscription services from the Global Discovery Catalogue

The https://wmo-im.github.io/wis2-guide/guide/wis2-guide-DRAFT.html#_2_4_4_global_discovery_catalogue[Global Discovery Catalogue (GDC)] contains both real-time and non real-time data. The https://wmo-im.github.io/wcmp2/standard/wcmp2-STABLE.html[WMO Core Metadata Profile (WCMP2)] allows for description of real-time data via its https://wmo-im.github.io/wcmp2/standard/wcmp2-STABLE.html#_1_19_links_and_distribution_information[distribution information], which data publishers use to describe and define connectivity and subscription information for a given dataset.

A typical WCMP2 distribution link for data subscriptions can be found below:

[source,json]
----
{
"rel": "items",
"href": "mqtts://everyone:everyone@globalbroker.meteo.fr:8883",
"channel": "origin/a/wis2/ca-eccc-msc/data/core/hydrology",
"type": "application/geo+json",
"title": "Data notifications"
}
----

Programatically, a GDC client can query the catalogue and filter the results for real-time subscriptions in the following manner:

[source,python]
----
import requests

response = requests.get('https://wis2-gdc.weather.gc.ca/collections/wis2-discovery-metadata/items').json()


def is_wis2_subscription_link(link) -> bool:
if (link['href'].startswith('mqtt') and
link.get('channel', '').startswith(('origin/a/wis2', 'cache/a/wis2'))):
return True


for feature in response['features']:
for link in feature['links']:
if is_wis2_subscription_link(link):
print('WIS2 subscription link')
----

Using the `href` and `channel` properties of a matching link object, a client can connect and subscribe to data notifications for a given dataset.