Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates WCMP2 docs, examples and pywis-topics #580

Merged
merged 4 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion config-templates/metadata-synop.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ identification:
keywords_type: theme
vocabulary:
name: WMO WIS2 Topic Hierarchy
url: https://github.com/wmo-im/wis2-topic-hierarchy/blob/main/topic-hierarchy/earth-system-discipline.csv
url: https://github.com/wmo-im/wis2-topic-hierarchy/blob/main/topic-hierarchy/earth-system-discipline/index.csv
extents:
spatial:
- bbox: [$BOUNDING_BOX]
Expand Down
2 changes: 1 addition & 1 deletion config-templates/metadata-temp.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ identification:
keywords_type: theme
vocabulary:
name: WMO WIS2 Topic Hierarchy
url: https://github.com/wmo-im/wis2-topic-hierarchy/blob/main/topic-hierarchy/earth-system-discipline.csv
url: https://github.com/wmo-im/wis2-topic-hierarchy/blob/main/topic-hierarchy/earth-system-discipline/index.csv
extents:
spatial:
- bbox: [$BOUNDING_BOX]
Expand Down
4 changes: 4 additions & 0 deletions docs/source/user/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ You can review the discovery metadata just cached through the new item at ``/oa

Repeat this step for any other discovery metadata you wish to publish, such as the ``temp`` dataset.

.. note::

To ensure that discovery metadata is shared with the WIS2 Global Discovery Catalogue, you must ensure that your discovery metadata is published once the WMO Global Broker is connected and subscribed for your wis2box broker. If you have published discovery metadata before this stage, you must re-publish using the command above.

Finally it is recommended to prepare authentication tokens for updating your stations and ingesting data using the wis2box-webapp.

To create a token for ingesting data:
Expand Down
2 changes: 1 addition & 1 deletion examples/config/surface-weather-observations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ identification:
keywords_type: theme
vocabulary:
name: WMO WIS2 Topic Hierarchy
url: https://github.com/wmo-im/wis2-topic-hierarchy/blob/main/topic-hierarchy/earth-system-discipline.csv
url: https://github.com/wmo-im/wis2-topic-hierarchy/blob/main/topic-hierarchy/earth-system-discipline/index.csv
extents:
spatial:
- bbox: [-180, -90, 190, 90]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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.csv
url: https://github.com/wmo-im/wis2-topic-hierarchy/blob/main/topic-hierarchy/earth-system-discipline/index.csv
extents:
spatial:
- bbox: [11.0937728207,-5.03798674888,18.4530652198,3.72819651938]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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.csv
url: https://github.com/wmo-im/wis2-topic-hierarchy/blob/main/topic-hierarchy/earth-system-discipline/index.csv
extents:
spatial:
- bbox: [-8.68439978681, 19.0573642034, 11.9995056495, 37.1183806422]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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.csv
url: https://github.com/wmo-im/wis2-topic-hierarchy/blob/main/topic-hierarchy/earth-system-discipline/index.csv
extents:
spatial:
- bbox: [6.74995, 36.61998, 18.48024, 47.11539]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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.csv
url: https://github.com/wmo-im/wis2-topic-hierarchy/blob/main/topic-hierarchy/earth-system-discipline/index.csv
extents:
spatial:
- bbox: [32.6881653175,-16.8012997372,35.7719047381,-9.23059905359]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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.csv
url: https://github.com/wmo-im/wis2-topic-hierarchy/blob/main/topic-hierarchy/earth-system-discipline/index.csv
extents:
spatial:
- bbox: [20.2201924985,43.6884447292,29.62654341,48.2208812526]
Expand Down
2 changes: 1 addition & 1 deletion wis2box-management/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RUN apt-get update -y && apt-get install -y ${DEBIAN_PACKAGES} \
https://github.com/wmo-cop/pyoscar/archive/refs/tags/0.6.4.zip \
https://github.com/wmo-im/synop2bufr/archive/refs/tags/v0.6.2.zip \
https://github.com/geopython/pygeometa/archive/master.zip \
https://github.com/wmo-im/pywcmp/archive/refs/tags/0.4.0.zip \
https://github.com/wmo-im/pywis-topics/archive/refs/tags/0.2.0.zip \
# install shapely
&& pip3 install --no-cache-dir cython pygeos==0.13 \
&& pip3 install shapely \
Expand Down
7 changes: 2 additions & 5 deletions wis2box-management/docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ printenv | grep -v "no_proxy" >> /etc/environment
service cron start
service cron status

echo "Caching topic hierarchy JSON"
rm -fr /tmp/all.json /tmp/all.json.zip ~/.pywcmp/wis2-topic-hierarchy
mkdir -p ~/.pywcmp/wis2-topic-hierarchy
curl https://wmo-im.github.io/wis2-topic-hierarchy/all.json.zip --output /tmp/all.json.zip
cd ~/.pywcmp/wis2-topic-hierarchy && unzip -j /tmp/all.json.zip
echo "Caching topic hierarchy CSVs"
pywis-topics bundle sync

# wis2box commands
# TODO: avoid re-creating environment if it already exists
Expand Down
1 change: 1 addition & 0 deletions wis2box-management/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ OWSLib
paho-mqtt
pygeometa
pywis-pubsub
pywis-topics
PyYAML
requests
15 changes: 10 additions & 5 deletions wis2box-management/wis2box/topic_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
from pathlib import Path
from typing import Any, Tuple, Union

# TODO: uncomment once topic hiearchy is approved
# from pywcmp.wcmp2.topics import TopicHierarchy as pywcmp_th
# from pywis_topics.topics import TopicHierarchy as pywis_topics_th

from wis2box.data_mappings import DATADIR_DATA_MAPPINGS
from wis2box.plugin import load_plugin

Expand All @@ -38,6 +38,11 @@ def __init__(self, path: Union[Path, str]) -> None:
self.dotpath = None
self.dirpath = None

if not self.path.startswith('origin/a/wis2'):
self.fullpath = f'origin/a/wis2/{self.dirpath}'
else:
self.fullpath = self.dirpath

if '/' in self.path:
LOGGER.debug('Transforming from directory to dotted path')
self.dirpath = self.path
Expand All @@ -54,10 +59,10 @@ def is_valid(self) -> bool:
:returns: `bool` of whether the topic hierarchy is valid
"""

# TODO: uncomment once topic hiearchy is approved
# TODO: uncomment once WTH is approved
# LOGGER.debug(f'Validating topic {self.dirpath} (fuzzy match)')
# th = pywcmp_th()
# return th.validate(self.dirpath, fuzzy=True)
# th = pywis_topics_th()
# return th.validate(self.fullpath)

return True

Expand Down
Loading