diff --git a/.github/workflows/tests-docker.yml b/.github/workflows/tests-docker.yml index 1f5475256..70ead8c52 100644 --- a/.github/workflows/tests-docker.yml +++ b/.github/workflows/tests-docker.yml @@ -63,6 +63,15 @@ jobs: python3 wis2box-ctl.py execute wis2box auth add-token -p wis2downloader github123 -y echo '{"topic": "origin/a/wis2/+/data/core/#"}' > test.json curl -X POST http://localhost/wis2downloader/subscriptions -H "Content-Type: application/json" -H "Authorization: Bearer github123" -d @test.json + - name: add CAP data, cap-publish + env: + DISCOVERY_METADATA: /data/wis2box/metadata/discovery/int-wmo-test-cap.yml + DISCOVERY_METADATA_ID: urn:wmo:md:int-wmo-test:cap + run: | + python3 wis2box-ctl.py execute wis2box dataset publish $DISCOVERY_METADATA + curl -s http://localhost/data/metadata/$DISCOVERY_METADATA_ID.json --output /tmp/$DISCOVERY_METADATA_ID + pywcmp ets validate /tmp/$DISCOVERY_METADATA_ID + python3 tests/send_CAP_as_message.py - name: add Malawi synop data (csv2bufr synop_bufr template) 🇲🇼 env: TOPIC_HIERARCHY: origin/a/wis2/mw-mw_met_centre-test/data/core/weather/surface-based-observations/synop diff --git a/tests/data/CAP/cap_example.xml b/tests/data/CAP/cap_example.xml new file mode 100644 index 000000000..5886f5fda --- /dev/null +++ b/tests/data/CAP/cap_example.xml @@ -0,0 +1,71 @@ + + + + urn:oid:2.49.0.0.690.0.2024.5.19.13.18.0 + info@meteo.gov.sc + 2024-05-19T17:18:00+04:00 + Actual + Alert + Public + + en + Met + Strong Winds + Immediate + Moderate + Observed + General Public + 2024-05-19T17:30:00+04:00 + 2024-05-19T17:30:00+04:00 + 2024-05-19T23:30:00+04:00 + Seychelles Meteorological Authority + Moderate to strong south-easterly winds over Aldabra area + Moderate to strong south-easterly winds over Aldabra area associated with a severe tropical storm Ialy on 19th May 2024 from 5pm to 11pm + Beware of strong south-easterly winds of 40km/hr gusting to 60km/hr causing rough seas. Mariners are advised to take extra precautions when navigating these areas + https://www.meteo.sc/alerts/severe-tropical-storm-ialy-is-expected-to-cause-moderate-to-strong-south-easterly-winds-over-aldabra-area-on-19th-may-2024/ + info@meteo.gov.sc + + Aldabra area + -9.186965,46.078276 -9.336746,45.936002 -9.57065,45.983427 -9.748309,46.116216 -9.897844,46.249006 -10.000609,46.42922 -9.953902,46.694799 -9.692216,46.770679 -9.467752,46.770679 -9.327387,46.742224 -9.186965,46.694799 -9.140146,46.533555 -9.121416,46.362825 -9.186965,46.078276 + + + + + + + + + + + + + s9RKcAph3khDLX4nOQQDZ7c23uVZqCDJziRZznnh3nA= + + + liScT3sHEpNO1TXEDY1nMC5FoBnQruioH/xkU1rNRKfK8Y3y4/lRz64ueJfoWGYB/N3NWLkMhQ6V0X4lHGPyfA== + + + MIIDeTCCAv6gAwIBAgISA7FZkY9qfwdIeZgOZUlggQr+MAoGCCqGSM49BAMDMDIx +CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQDEwJF +NTAeFw0yNDA3MDIxMTIzNDlaFw0yNDA5MzAxMTIzNDhaMBcxFTATBgNVBAMTDHd3 +dy5tZXRlby5zYzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABPnwJK7C7LIL7c3L +DXDTbFlLSHx8VXbbSKFqkr0v8xjseuNjh8IXFm95mvkdk7q1S0SUYyYn3d8a0krt +2qhGqCKjggINMIICCTAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0lBBYwFAYIKwYBBQUH +AwEGCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFCQFyLRIaHFpqT8I +nTKhv8oSaTW1MB8GA1UdIwQYMBaAFJ8rX888IU+dBLftKyzExnCL0tcNMFUGCCsG +AQUFBwEBBEkwRzAhBggrBgEFBQcwAYYVaHR0cDovL2U1Lm8ubGVuY3Iub3JnMCIG +CCsGAQUFBzAChhZodHRwOi8vZTUuaS5sZW5jci5vcmcvMBcGA1UdEQQQMA6CDHd3 +dy5tZXRlby5zYzATBgNVHSAEDDAKMAgGBmeBDAECATCCAQMGCisGAQQB1nkCBAIE +gfQEgfEA7wB2AHb/iD8KtvuVUcJhzPWHujS0pM27KdxoQgqf5mdMWjp0AAABkHNm +tr8AAAQDAEcwRQIhANX48FhFLRl8W0qsVh12vz2F92wr2aKId+AQ/0kvE+a0AiA/ +eB4KudtHm4LJL7VSVL7UvffuEPOsY+PvoongycjZpQB1AEiw42vapkc0D+VqAvqd +MOscUgHLVt0sgdm7v6s52IRzAAABkHNmvkUAAAQDAEYwRAIgFtFOST10XUPf2BYT +xBBvHVqU98eB2hwQtgVJ4hJP5RoCIF0wDotvI7r+kamXqgvee+/ig4NP2ZbqaLP6 +a2/T5cjnMAoGCCqGSM49BAMDA2kAMGYCMQCyLgDsI/yPYKkI1zM3zs0w7iI23MfZ +BGuNKUUa7qHLR1O6eNnEmrSH24bdzXdacRoCMQCLW6bf0Y1mwuJN+jBCjTbyCe+F +1ZEDJBb2AKxTZpWdVdtfRErY5BxHuACOm9SlXGE= + + + + + \ No newline at end of file diff --git a/tests/data/metadata/discovery/cd-surface-weather-observations.yml b/tests/data/metadata/discovery/cd-surface-weather-observations.yml index 2acda5756..8c13ac0f4 100644 --- a/tests/data/metadata/discovery/cd-surface-weather-observations.yml +++ b/tests/data/metadata/discovery/cd-surface-weather-observations.yml @@ -39,7 +39,7 @@ identification: keywords_type: theme vocabulary: name: Earth system disciplines as defined by the WMO Unified Data Policy, Resolution 1 (Cg-Ext(2021), Annex 1. - url: https://codes.wmo.int/topic-hierarchy/earth-system-discipline + url: https://codes.wmo.int/wis/topic-hierarchy/earth-system-discipline extents: spatial: - bbox: [11.0937728207,-5.03798674888,18.4530652198,3.72819651938] diff --git a/tests/data/metadata/discovery/int-wmo-test-cap.yml b/tests/data/metadata/discovery/int-wmo-test-cap.yml index 70cfd4fd5..34f82d8e1 100644 --- a/tests/data/metadata/discovery/int-wmo-test-cap.yml +++ b/tests/data/metadata/discovery/int-wmo-test-cap.yml @@ -15,7 +15,7 @@ mcf: version: 1.0 metadata: - identifier: urn:wmo:md:int_wmo_test:cap + identifier: urn:wmo:md:int-wmo-test:cap hierarchylevel: dataset identification: @@ -32,10 +32,10 @@ identification: wmo: keywords: - weather - keywords_type: themes + keywords_type: theme vocabulary: name: Earth system disciplines as defined by the WMO Unified Data Policy, Resolution 1 (Cg-Ext(2021), Annex 1. - url: https://codes.wmo.int/topic-hierarchy/earth-system-discipline + url: https://codes.wmo.int/wis/topic-hierarchy/earth-system-discipline extents: spatial: - bbox: [-180.0, -90.0, 180.0, 90.0] @@ -44,12 +44,13 @@ identification: - begin: 2024-07-02 end: null resolution: P1H - wmo_data_policy: core + rights: WMO Unified Policy for the International Exchange of Earth System Data + url: https://example.org/fixme contact: - host: - organization: WMO - url: https://wmo.int + host: &contact_poc + organization: World Meteorological Organisation + url: https://www.wmo.int/ individualname: Firstname Lastname positionname: Position Name phone: null @@ -58,7 +59,7 @@ contact: city: null administrativearea: null postalcode: null - country: Switzerland - email: you@example.com - hoursofservice: 0700h - 1500h UTC + country: null + email: null + hoursofservice: 0800h - 1600h UTC contactinstructions: email diff --git a/tests/data/metadata/discovery/int-wmo-test-drifting-buoys.yml b/tests/data/metadata/discovery/int-wmo-test-drifting-buoys.yml index 1f356f7d9..065b54158 100644 --- a/tests/data/metadata/discovery/int-wmo-test-drifting-buoys.yml +++ b/tests/data/metadata/discovery/int-wmo-test-drifting-buoys.yml @@ -37,7 +37,7 @@ identification: keywords_type: theme vocabulary: name: Earth system disciplines as defined by the WMO Unified Data Policy, Resolution 1 (Cg-Ext(2021), Annex 1. - url: https://github.com/wmo-im/wis2-topic-hierarchy/blob/main/topic-hierarchy/earth-system-discipline/index.csv + url: https://codes.wmo.int/wis/topic-hierarchy/earth-system-discipline extents: spatial: - bbox: [-180.0, -90.0, 180.0, 90.0] diff --git a/tests/data/metadata/discovery/int-wmo-test-ship-hourly.yml b/tests/data/metadata/discovery/int-wmo-test-ship-hourly.yml index 3d5bd9f80..0e5308e80 100644 --- a/tests/data/metadata/discovery/int-wmo-test-ship-hourly.yml +++ b/tests/data/metadata/discovery/int-wmo-test-ship-hourly.yml @@ -37,7 +37,7 @@ identification: keywords_type: theme vocabulary: name: Earth system disciplines as defined by the WMO Unified Data Policy, Resolution 1 (Cg-Ext(2021), Annex 1. - url: https://github.com/wmo-im/wis2-topic-hierarchy/blob/main/topic-hierarchy/earth-system-discipline/index.csv + url: https://codes.wmo.int/wis/topic-hierarchy/earth-system-discipline extents: spatial: - bbox: [-180.0, -90.0, 180.0, 90.0] diff --git a/tests/data/metadata/discovery/int-wmo-test-wind-profile.yml b/tests/data/metadata/discovery/int-wmo-test-wind-profile.yml index 1e12f3395..ec4abb6dc 100644 --- a/tests/data/metadata/discovery/int-wmo-test-wind-profile.yml +++ b/tests/data/metadata/discovery/int-wmo-test-wind-profile.yml @@ -34,7 +34,7 @@ identification: keywords_type: theme vocabulary: name: Earth system disciplines as defined by the WMO Unified Data Policy, Resolution 1 (Cg-Ext(2021), Annex 1. - url: https://github.com/wmo-im/wis2-topic-hierarchy/blob/main/topic-hierarchy/earth-system-discipline/index.csv + url: https://codes.wmo.int/wis/topic-hierarchy/earth-system-discipline extents: spatial: - bbox: [-180.0, -90.0, 180.0, 90.0] diff --git a/tests/integration/test_workflow.py b/tests/integration/test_workflow.py index 513536730..6b8806dfc 100644 --- a/tests/integration/test_workflow.py +++ b/tests/integration/test_workflow.py @@ -57,7 +57,8 @@ def test_wis2downloader(): 'origin/a/wis2/int-wmo-test/data/core/ocean/surface-based-observations/drifting-buoys': 2, # noqa 'origin/a/wis2/int-wmo-test/data/core/weather/surface-based-observations/wind-profile': 1, # noqa 'origin/a/wis2/int-wmo-test/data/core/weather/surface-based-observations/ship-hourly': 5, # noqa - 'origin/a/wis2/it-meteoam/data/core/weather/surface-based-observations/synop': 31 # noqa + 'origin/a/wis2/it-meteoam/data/core/weather/surface-based-observations/synop': 31, # noqa + 'origin/a/wis2/int-wmo-test/data/core/weather/advisories-warnings': 1 # noqa } topic_nfiles_dict_found = {} @@ -125,7 +126,7 @@ def test_metadata_discovery_publish(): """Test discovery metadata publishing""" r = SESSION.get(f'{API_URL}/collections/discovery-metadata/items').json() - assert r['numberMatched'] == 9 + assert r['numberMatched'] == 10 r = SESSION.get(f'{API_URL}/collections/discovery-metadata/items/{ID}').json() # noqa @@ -302,7 +303,7 @@ def test_message_api(): 'dz-meteoalgerie': 29, 'ro-rnimh': 50, 'cg-met': 15, - 'int-wmo': 11, + 'int-wmo': 13, 'cn-cma': 11 } for key, value in counts.items(): diff --git a/tests/test_publish_cap_message.py b/tests/send_CAP_as_message.py similarity index 94% rename from tests/test_publish_cap_message.py rename to tests/send_CAP_as_message.py index 8958c373f..7566f7c3d 100644 --- a/tests/test_publish_cap_message.py +++ b/tests/send_CAP_as_message.py @@ -29,7 +29,7 @@ BROKER_HOST = 'localhost' BROKER_PORT = '1883' -filename = 'tests/data/cap/sc_example.xml' +filename = 'tests/data/CAP/cap_example.xml' # create a message containing the CAP alert in # the data field as base64 encoded bytes @@ -37,7 +37,7 @@ data = base64.b64encode(file.read()).decode() msg = { - 'metadata_id': 'urn:wmo:md:int_wmo_test:cap', + 'metadata_id': 'urn:wmo:md:int-wmo-test:cap', 'data': data, 'filename': filename.split('/')[-1] }