Skip to content

Commit

Permalink
swap pywcmp for pywis-topics for WTH handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Nov 21, 2023
1 parent cb9b726 commit 78b6396
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
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
17 changes: 10 additions & 7 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,12 +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)

return True
# th = pywis_topics_th()
# return th.validate(self.fullpath)


def validate_and_load(
Expand Down

0 comments on commit 78b6396

Please sign in to comment.