From bc8c4aaf0b08397ccc5947475531777cf335e91b Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Thu, 19 Dec 2024 14:14:29 -0500 Subject: [PATCH] Docker updates for dev-31, pygeoapi 0.19.0 and Ubuntu:jammy - Point deploy-nightly-docker.sh to jammy branch - Use pygeoapi 0.19.0 - Add project-name docker-compose command for nightly deploy - Update collection.html template; removed Output formats and added Parameters table - Add edr/query.html, edr/instance.html, edr/instances.html and map/metadata.html templates - Update french translations - Other minor updates using collections_path and dataset_path for ease of pathing in templates - Update README with i18n instructions --- .gitignore | 3 +- Dockerfile | 10 +- README.md | 16 + deploy/default/msc-pygeoapi-config.yml | 66 ---- deploy/default/msc-pygeoapi-openapi.yml | 292 ------------------ deploy/nightly/deploy-nightly-docker.sh | 6 +- locale/fr/LC_MESSAGES/messages.po | 270 ++++++++++++---- msc_pygeoapi/loader/hydrometric_realtime.py | 14 +- msc_pygeoapi/provider/elasticsearch.py | 36 +-- theme/templates/collections/collection.html | 171 ++++++++-- .../collections/coverage/rangetype.html | 4 +- theme/templates/collections/edr/instance.html | 42 +++ .../templates/collections/edr/instances.html | 24 ++ theme/templates/collections/edr/query.html | 290 +++++++++++++++++ theme/templates/collections/map/metadata.html | 39 +++ theme/templates/collections/queryables.html | 8 +- theme/templates/collections/schema.html | 8 +- 17 files changed, 794 insertions(+), 505 deletions(-) create mode 100644 theme/templates/collections/edr/instance.html create mode 100644 theme/templates/collections/edr/instances.html create mode 100644 theme/templates/collections/edr/query.html create mode 100644 theme/templates/collections/map/metadata.html diff --git a/.gitignore b/.gitignore index 10983d6a..231d4853 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ dist node_modules schemas.opengis.net .pot -theme/static/themes-gcweb \ No newline at end of file +theme/static/themes-gcweb +locale/messages.pot \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 00a47038..ab79af83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,12 +27,14 @@ # ################################################################### +FROM ubuntu:jammy FROM ubuntu:jammy ARG PYGEOAPI_GITREPO=https://github.com/geopython/pygeoapi.git ENV BASEDIR=/data/web/msc-pygeoapi-nightly ENV DEBIAN_FRONTEND=noninteractive +ENV DEBIAN_FRONTEND=noninteractive WORKDIR $BASEDIR @@ -43,13 +45,18 @@ RUN apt-get update && \ add-apt-repository ppa:gcpp-kalxas/wmo-staging && \ add-apt-repository ppa:ubuntugis/ppa && apt update RUN apt-get install -y python3 python3-setuptools python3-pip git curl unzip python3-click python3-fiona python3-gdal python3-lxml python3-parse python3-pyproj python3-rasterio python3-requests python3-slugify python3-sqlalchemy python3-unicodecsv python3-xarray python3-yaml + apt-get install -y software-properties-common && \ + add-apt-repository ppa:gcpp-kalxas/wmo-staging && \ + add-apt-repository ppa:ubuntugis/ppa && apt update +RUN apt-get install -y python3 python3-setuptools python3-pip git curl unzip python3-click python3-fiona python3-gdal python3-lxml python3-parse python3-pyproj python3-rasterio python3-requests python3-slugify python3-sqlalchemy python3-unicodecsv python3-xarray python3-yaml # install pygeoapi -RUN git clone $PYGEOAPI_GITREPO -b 0.18.0 && \ +RUN git clone $PYGEOAPI_GITREPO -b 0.19.0 && \ cd pygeoapi && \ pip3 install -r requirements.txt && \ pip3 install flask_cors gunicorn gevent greenlet && \ pip3 install . && \ + pip3 install . && \ cd .. # requirement of GEOMET_CLIMATE_CONFIG file @@ -76,6 +83,7 @@ RUN cd msc-pygeoapi && \ rm -f ./themes-gcweb.zip && \ # install msc-pygeoapi pip3 install . && \ + pip3 install . && \ # show version MSC_PYGEOAPI_VERSION=$(dpkg-parsechangelog -SVersion) && \ sed -i "s/MSC_PYGEOAPI_VERSION/$MSC_PYGEOAPI_VERSION/" theme/templates/_base.html && \ diff --git a/README.md b/README.md index 4f613299..835e48ff 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,22 @@ pytest test/test_hydat.py --url https://example.org/dev pytest -k 'not api' ``` +### Multilingual Updates + +```bash +# Extract from latest code the keys to be translated +pybabel extract -F babel-mapping.ini -o locale/messages.pot ./ + +# Update the existing .po language file with new/updated keys: +pybabel update -d locale -l fr -i locale/messages.pot + +# Open the relevant .po file and contribute your translations +vi locale/fr/LC_MESSAGES/messages.po + +# Then compile a .mo file to be used by the application +pybabel compile -d locale -l fr +``` + ## Releasing ```bash diff --git a/deploy/default/msc-pygeoapi-config.yml b/deploy/default/msc-pygeoapi-config.yml index 4053d215..7f27baff 100644 --- a/deploy/default/msc-pygeoapi-config.yml +++ b/deploy/default/msc-pygeoapi-config.yml @@ -4302,72 +4302,6 @@ resources: data: ${MSC_PYGEOAPI_ES_URL}/coastal_flood_risk_index id_field: id - wis2-discovery-metadata: - type: collection - title: WMO WIS2 discovery metadata (experimental) - description: WMO WIS2 discovery metadata (experimental) - keywords: - en: [wmo, wis2, discovery, metadata] - fr: [wmo, wis2, discovery, metadata] - crs: - - CRS84 - links: - - type: text/html - rel: canonical - title: - en: WMO Information System - fr: WMO Information System - href: - en: https://community.wmo.int/activity-areas/wis - fr: https://community.wmo.int/activity-areas/wis - hreflang: - en: en-US - fr: en-US - extents: - spatial: - bbox: [-180, -90, 180, 90] - crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84 - providers: - - type: record - name: msc_pygeoapi.provider.elasticsearch.ElasticsearchCatalogueWMOWIS2GDCProvider - data: ${MSC_PYGEOAPI_ES_URL}/wis2-discovery-metadata - id_field: id - - wis2-notification-messages: - type: collection - title: - en: WMO WIS2 notification messages (experimental) - fr: WMO WIS2 notification messages (experimental) - description: - en: WMO WIS2 notification messages (experimental) - fr: WMO WIS2 notification messages (experimental) - keywords: - en: [wmo, wis2, notification, messages] - fr: [wmo, wis2, notification, messages] - crs: - - CRS84 - links: - - type: text/html - rel: canonical - title: - en: WMO Information System - fr: WMO Information System - href: - en: https://community.wmo.int/activity-areas/wis - fr: https://community.wmo.int/activity-areas/wis - hreflang: - en: en-US - fr: en-US - extents: - spatial: - bbox: [-180, -90, 180, 90] - crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84 - providers: - - type: feature - name: msc_pygeoapi.provider.elasticsearch.ElasticsearchWMOWIS2BrokerMessagesProvider - data: ${MSC_PYGEOAPI_ES_URL}/wis2-notification-messages* - id_field: id - raster-drill: type: process processor: diff --git a/deploy/default/msc-pygeoapi-openapi.yml b/deploy/default/msc-pygeoapi-openapi.yml index 7fc8f9f6..361c1c2d 100644 --- a/deploy/default/msc-pygeoapi-openapi.yml +++ b/deploy/default/msc-pygeoapi-openapi.yml @@ -18185,294 +18185,6 @@ paths: accumulation at 15 km resolution coverage range type tags: - weather:rdpa:15km:6f - /collections/wis2-discovery-metadata: - get: - description: WMO WIS2 discovery metadata (experimental) - operationId: describeWis2-discovery-metadataCollection - parameters: - - $ref: '#/components/parameters/f' - - $ref: '#/components/parameters/lang' - responses: - '200': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/Collection - '400': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/InvalidParameter - '404': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/NotFound - '500': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/ServerError - summary: Get WMO WIS2 discovery metadata (experimental) metadata - tags: - - wis2-discovery-metadata - /collections/wis2-discovery-metadata/items: - get: - description: WMO WIS2 discovery metadata (experimental) - operationId: getWis2-discovery-metadataFeatures - parameters: - - *id001 - - *id002 - - $ref: '#/components/parameters/bbox' - - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/parameters/limit - - $ref: '#/components/parameters/crs' - - $ref: '#/components/parameters/bbox-crs' - - description: The properties that should be included for each feature. The - parameter value is a comma-separated list of property names. - explode: false - in: query - name: properties - required: false - schema: - items: - enum: - - created - - description - - formats - - identifier - - language - - rights - - title - - type - - updated - - wmo:topicHierarchy - - q - type: string - type: array - style: form - - $ref: '#/components/parameters/vendorSpecificParameters' - - $ref: '#/components/parameters/skipGeometry' - - $ref: https://raw.githubusercontent.com/opengeospatial/ogcapi-records/master/core/openapi/parameters/sortby.yaml - - $ref: '#/components/parameters/offset' - - $ref: https://raw.githubusercontent.com/opengeospatial/ogcapi-records/master/core/openapi/parameters/q.yaml - - explode: false - in: query - name: created - required: false - schema: - format: date - type: string - style: form - - explode: false - in: query - name: description - required: false - schema: - type: string - style: form - - explode: false - in: query - name: formats - required: false - schema: - type: string - style: form - - explode: false - in: query - name: identifier - required: false - schema: - type: string - style: form - - explode: false - in: query - name: language - required: false - schema: - type: string - style: form - - explode: false - in: query - name: rights - required: false - schema: - type: string - style: form - - explode: false - in: query - name: title - required: false - schema: - type: string - style: form - - explode: false - in: query - name: type - required: false - schema: - type: string - style: form - - explode: false - in: query - name: updated - required: false - schema: - format: date - type: string - style: form - - explode: false - in: query - name: wmo:topicHierarchy - required: false - schema: - type: string - style: form - responses: - '200': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/Features - '400': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/InvalidParameter - '404': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/NotFound - '500': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/ServerError - summary: Get WMO WIS2 discovery metadata (experimental) items - tags: - - wis2-discovery-metadata - /collections/wis2-discovery-metadata/items/{featureId}: - get: - description: WMO WIS2 discovery metadata (experimental) - operationId: getWis2-discovery-metadataFeature - parameters: - - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/parameters/featureId - - $ref: '#/components/parameters/crs' - - $ref: '#/components/parameters/f' - - $ref: '#/components/parameters/lang' - responses: - '200': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/Feature - '400': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/InvalidParameter - '404': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/NotFound - '500': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/ServerError - summary: Get WMO WIS2 discovery metadata (experimental) item by id - tags: - - wis2-discovery-metadata - /collections/wis2-discovery-metadata/queryables: - get: - description: WMO WIS2 discovery metadata (experimental) - operationId: getWis2-discovery-metadataQueryables - parameters: - - *id001 - - *id002 - responses: - '200': - $ref: '#/components/responses/Queryables' - '400': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/InvalidParameter - '404': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/NotFound - '500': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/ServerError - summary: Get WMO WIS2 discovery metadata (experimental) queryables - tags: - - wis2-discovery-metadata - /collections/wis2-notification-messages: - get: - description: WMO WIS2 notification messages (experimental) - operationId: describeWis2-notification-messagesCollection - parameters: - - $ref: '#/components/parameters/f' - - $ref: '#/components/parameters/lang' - responses: - '200': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/Collection - '400': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/InvalidParameter - '404': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/NotFound - '500': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/ServerError - summary: Get WMO WIS2 notification messages (experimental) metadata - tags: - - wis2-notification-messages - /collections/wis2-notification-messages/items: - get: - description: WMO WIS2 notification messages (experimental) - operationId: getWis2-notification-messagesFeatures - parameters: - - *id001 - - *id002 - - $ref: '#/components/parameters/bbox' - - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/parameters/limit - - $ref: '#/components/parameters/crs' - - $ref: '#/components/parameters/bbox-crs' - - description: The properties that should be included for each feature. The - parameter value is a comma-separated list of property names. - explode: false - in: query - name: properties - required: false - schema: - items: - enum: - - q - type: string - type: array - style: form - - $ref: '#/components/parameters/vendorSpecificParameters' - - $ref: '#/components/parameters/skipGeometry' - - $ref: https://raw.githubusercontent.com/opengeospatial/ogcapi-records/master/core/openapi/parameters/sortby.yaml - - $ref: '#/components/parameters/offset' - - explode: false - in: query - name: q - required: false - schema: - type: string - style: form - responses: - '200': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/Features - '400': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/InvalidParameter - '404': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/NotFound - '500': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/ServerError - summary: Get WMO WIS2 notification messages (experimental) items - tags: - - wis2-notification-messages - /collections/wis2-notification-messages/items/{featureId}: - get: - description: WMO WIS2 notification messages (experimental) - operationId: getWis2-notification-messagesFeature - parameters: - - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/parameters/featureId - - $ref: '#/components/parameters/crs' - - $ref: '#/components/parameters/f' - - $ref: '#/components/parameters/lang' - responses: - '200': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/Feature - '400': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/InvalidParameter - '404': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/NotFound - '500': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/ServerError - summary: Get WMO WIS2 notification messages (experimental) item by id - tags: - - wis2-notification-messages - /collections/wis2-notification-messages/queryables: - get: - description: WMO WIS2 notification messages (experimental) - operationId: getWis2-notification-messagesQueryables - parameters: - - *id001 - - *id002 - responses: - '200': - $ref: '#/components/responses/Queryables' - '400': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/InvalidParameter - '404': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/NotFound - '500': - $ref: ${MSC_PYGEOAPI_OGC_API_URL}/schemas/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/ServerError - summary: Get WMO WIS2 notification messages (experimental) queryables - tags: - - wis2-notification-messages /conformance: get: description: API conformance definition @@ -19346,10 +19058,6 @@ tags: name: weather:cansips:250km:forecast:members - description: MSC datasets footprints inventory name: datasets-footprints -- description: WMO WIS2 discovery metadata (experimental) - name: wis2-discovery-metadata -- description: WMO WIS2 notification messages (experimental) - name: wis2-notification-messages - description: GeoMet-Climate Raster Drill process name: raster-drill - description: extract sounding data by point diff --git a/deploy/nightly/deploy-nightly-docker.sh b/deploy/nightly/deploy-nightly-docker.sh index 19b25f75..728e4881 100644 --- a/deploy/nightly/deploy-nightly-docker.sh +++ b/deploy/nightly/deploy-nightly-docker.sh @@ -60,9 +60,9 @@ echo "Cloning Git repository" git clone $MSC_PYGEOAPI_GITREPO . -b jammy --depth=1 echo "Stopping/building/starting Docker setup" -docker compose -f docker/docker-compose.yml -f docker/docker-compose.override.yml build --no-cache -docker compose -f docker/docker-compose.yml -f docker/docker-compose.override.yml down -docker compose -f docker/docker-compose.yml -f docker/docker-compose.override.yml up -d +docker compose -f docker/docker-compose.yml -f docker/docker-compose.override.yml --project-name msc-pygeoapi-nightly build --no-cache +docker compose -f docker/docker-compose.yml -f docker/docker-compose.override.yml --project-name msc-pygeoapi-nightly down +docker compose -f docker/docker-compose.yml -f docker/docker-compose.override.yml --project-name msc-pygeoapi-nightly up -d cat > msc-pygeoapi-nightly.conf < diff --git a/locale/fr/LC_MESSAGES/messages.po b/locale/fr/LC_MESSAGES/messages.po index 0d5452c7..9bc971ff 100644 --- a/locale/fr/LC_MESSAGES/messages.po +++ b/locale/fr/LC_MESSAGES/messages.po @@ -7,16 +7,16 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2024-08-12 17:10+0000\n" +"POT-Creation-Date: 2025-01-10 18:46+0000\n" "PO-Revision-Date: 2022-07-05 09:20-0700\n" "Last-Translator: \n" "Language: fr_CA\n" "Language-Team: \n" -"Plural-Forms: nplurals=2; plural=(n > 1)\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.7.0\n" +"Generated-By: Babel 2.16.0\n" #: theme/templates/_base.html:46 msgid "Skip to main content" @@ -187,9 +187,12 @@ msgstr "Exception" msgid "MSC GeoMet User Documentation" msgstr "Documentation utilisateur de la plateforme GeoMet du SMC" -#: theme/templates/collections/collection.html:4 +#: theme/templates/collections/collection.html:6 #: theme/templates/collections/coverage/domainset.html:4 #: theme/templates/collections/coverage/rangetype.html:4 +#: theme/templates/collections/edr/instance.html:4 +#: theme/templates/collections/edr/instances.html:4 +#: theme/templates/collections/edr/query.html:4 #: theme/templates/collections/index.html:2 #: theme/templates/collections/index.html:4 #: theme/templates/collections/items/index.html:16 @@ -292,6 +295,7 @@ msgstr "Instructions de contact" msgid "Use of service" msgstr "Utilisation du service" +#: theme/templates/collections/collection.html:38 #: theme/templates/landing_page.html:139 msgid "License" msgstr "Licence" @@ -300,49 +304,80 @@ msgstr "Licence" msgid "Terms of service" msgstr "Conditions d'utilisation" -#: theme/templates/collections/collection.html:32 +#: theme/templates/collections/collection.html:51 msgid "Browse" msgstr "Parcourir" -#: theme/templates/collections/collection.html:37 -#, python-format -msgid "Browse through the items of \"%(data_title)s\"" +#: theme/templates/collections/collection.html:55 +#, fuzzy +msgid "Browse items" +msgstr "Aucun items" + +#: theme/templates/collections/collection.html:56 +#, fuzzy +msgid "Browse through the items of" msgstr "Parcourez les items de « %(data_title)s »" -#: theme/templates/collections/collection.html:40 +#: theme/templates/collections/collection.html:59 #: theme/templates/collections/queryables.html:6 #: theme/templates/collections/queryables.html:17 msgid "Queryables" msgstr "Interrogeables" -#: theme/templates/collections/collection.html:44 +#: theme/templates/collections/collection.html:63 msgid "Display queryables" msgstr "Afficher les tables de requêtes" -#: theme/templates/collections/collection.html:45 -#, python-format -msgid "Display queryables of \"%(data_title)s\"" -msgstr "Afficher les tables de requêtes de \"%(data_title)s\"" +#: theme/templates/collections/collection.html:64 +#, fuzzy +msgid "Display queryables of" +msgstr "Afficher les tables de requêtes" -#: theme/templates/collections/collection.html:54 -#, python-format -msgid "Display tiles of \"%(title)s\"" -msgstr "Afficher les tuiles de \"%(title)s\"." +#: theme/templates/collections/collection.html:67 +#: theme/templates/collections/schema.html:6 +#: theme/templates/collections/schema.html:17 +msgid "Schema" +msgstr "Schéma" -#: theme/templates/collections/collection.html:61 -msgid "Output Formats" -msgstr "Formats de fichiers" +#: theme/templates/collections/collection.html:71 +#, fuzzy +msgid "Display schema" +msgstr "Afficher le schéma" + +#: theme/templates/collections/collection.html:72 +#, fuzzy +msgid "Display schema of" +msgstr "Afficher le schéma de" #: theme/templates/collections/collection.html:77 -#: theme/templates/jobs/job.html:49 theme/templates/processes/process.html:77 -#: theme/templates/stac/catalog.html:13 -msgid "Links" -msgstr "Liens" +#: theme/templates/collections/tiles/index.html:6 +#: theme/templates/collections/tiles/index.html:29 +#: theme/templates/collections/tiles/metadata.html:6 +msgid "Tiles" +msgstr "Tuiles" -#: theme/templates/collections/index.html:8 -msgid "Collections in this service" -msgstr "Collections dans ce service" +#: theme/templates/collections/collection.html:81 +#, fuzzy +msgid "Display tiles" +msgstr "Afficher les tables de requêtes" + +#: theme/templates/collections/collection.html:81 +#, fuzzy +msgid "Display Tiles of" +msgstr "Afficher les tuiles de \"%(title)s\"." +#: theme/templates/collections/collection.html:90 +#: theme/templates/jobs/job.html:26 +msgid "Parameters" +msgstr "Paramètres" + +#: theme/templates/collections/collection.html:93 +#: theme/templates/processes/process.html:22 +#: theme/templates/processes/process.html:53 +msgid "ID" +msgstr "ID" + +#: theme/templates/collections/collection.html:94 #: theme/templates/collections/index.html:23 #: theme/templates/collections/index.html:79 #: theme/templates/collections/schema.html:19 @@ -353,6 +388,38 @@ msgstr "Collections dans ce service" msgid "Name" msgstr "Nom" +#: theme/templates/collections/collection.html:95 +#: theme/templates/collections/schema.html:22 +msgid "Units" +msgstr "Unités" + +#: theme/templates/collections/collection.html:107 +#: theme/templates/collections/edr/instance.html:25 +#: theme/templates/jobs/job.html:49 theme/templates/processes/process.html:77 +#: theme/templates/stac/catalog.html:13 +msgid "Links" +msgstr "Liens" + +#: theme/templates/collections/collection.html:118 +msgid "Reference Systems" +msgstr "Systèmes de référence" + +#: theme/templates/collections/collection.html:126 +msgid "Storage CRS" +msgstr "Stockage SRC" + +#: theme/templates/collections/collection.html:129 +msgid "CRS" +msgstr "SRC" + +#: theme/templates/collections/collection.html:132 +msgid "Epoch" +msgstr "Époque" + +#: theme/templates/collections/index.html:8 +msgid "Collections in this service" +msgstr "Collections dans ce service" + #: theme/templates/collections/index.html:29 #: theme/templates/collections/index.html:83 #: theme/templates/collections/schema.html:21 @@ -368,21 +435,12 @@ msgstr "Type" msgid "Description" msgstr "Description" -#: theme/templates/collections/schema.html:6 -#: theme/templates/collections/schema.html:17 -msgid "Schema" -msgstr "Schéma" - #: theme/templates/collections/schema.html:20 #: theme/templates/processes/process.html:23 #: theme/templates/processes/process.html:54 msgid "Title" msgstr "Titre" -#: theme/templates/collections/schema.html:22 -msgid "Units" -msgstr "Unités" - #: theme/templates/collections/schema.html:23 msgid "Values" msgstr "Valeurs" @@ -420,6 +478,7 @@ msgid "Coordinate reference system:" msgstr "Système de référence des coordonnées :" #: theme/templates/collections/coverage/domainset.html:26 +#: theme/templates/collections/map/metadata.html:13 #: theme/templates/stac/catalog.html:36 theme/templates/stac/catalog.html:114 #: theme/templates/stac/item.html:34 msgid "Size" @@ -458,6 +517,25 @@ msgstr "Champs" msgid "%(id)s: %(name)s (%(definition)s)" msgstr "%(id)s : %(name)s (%(definition)s)" +#: theme/templates/collections/edr/instance.html:11 +#: theme/templates/collections/edr/instances.html:6 +#: theme/templates/collections/edr/instances.html:17 +msgid "Instances" +msgstr "Instances" + +#: theme/templates/collections/edr/instance.html:23 +msgid "Instance" +msgstr "Instance" + +#: theme/templates/collections/edr/query.html:11 +#, python-format +msgid "%(query_type)s" +msgstr "%(query_type)s" + +#: theme/templates/collections/edr/query.html:38 +msgid "No items" +msgstr "Aucun items" + #: theme/templates/collections/items/index.html:8 #: theme/templates/collections/items/index.html:9 msgid "CSV" @@ -479,8 +557,8 @@ msgstr "Afficher les items uniquement par la vue de la carte" #: theme/templates/collections/items/index.html:53 msgid "" "No results. Please modify your search query or reset the table." msgstr "" "Aucun résultat. Veuillez modifier votre requête de recherche ou reset the table." +#~ msgstr "" +#~ "Aucun résultat. Veuillez modifier votre " +#~ "requête de recherche ou remettre le tableau." + +#~ msgid "Display queryables of \"%(data_title)s\"" +#~ msgstr "Afficher les tables de requêtes de \"%(data_title)s\"" + +#~ msgid "Output Formats" +#~ msgstr "Formats de fichiers" + diff --git a/msc_pygeoapi/loader/hydrometric_realtime.py b/msc_pygeoapi/loader/hydrometric_realtime.py index 821325fc..22b3f365 100644 --- a/msc_pygeoapi/loader/hydrometric_realtime.py +++ b/msc_pygeoapi/loader/hydrometric_realtime.py @@ -283,15 +283,17 @@ def generate_observations(self, filepath): next(reader) for row in reader: - if len(row) > 10: - LOGGER.warning(f'Data row in {filepath} has too many values:' # noqa - f' {row} (using only first 10)') - elif len(row) < 10: + if len(row) < 10: LOGGER.error(f'Data row in {filepath} has too few values: {row}') # noqa continue - station, date_, level, _, level_symbol, _, \ - discharge, _, discharge_symbol, _ = row + try: + station, date_, level, _, level_symbol, _, \ + discharge, _, discharge_symbol, _ = row[:10] + except ValueError as err: + LOGGER.error(err) + LOGGER.error(f'Row: {row}') + continue if station in self.stations: stn_info = self.stations[station] diff --git a/msc_pygeoapi/provider/elasticsearch.py b/msc_pygeoapi/provider/elasticsearch.py index e2360b4e..fb00c4b6 100644 --- a/msc_pygeoapi/provider/elasticsearch.py +++ b/msc_pygeoapi/provider/elasticsearch.py @@ -30,10 +30,7 @@ from datetime import datetime import logging -from pygeoapi.provider.elasticsearch_ import ( - ElasticsearchProvider, - ElasticsearchCatalogueProvider -) +from pygeoapi.provider.elasticsearch_ import ElasticsearchProvider from msc_pygeoapi.util import DATETIME_RFC3339_FMT @@ -156,34 +153,3 @@ def query(self, *args, **kwargs): def __repr__(self): return f' {self.data}' - - -class ElasticsearchCatalogueWMOWIS2GDCProvider(ElasticsearchCatalogueProvider): - """Elasticsearch Provider for WMO WIS2 Global Discovery Catalogue""" - - def __init__(self, provider_def): - super().__init__(provider_def) - - def mask_prop(self, property_name): - """ - generate property name based on ES backend setup - - :param property_name: property name - - :returns: masked property name - """ - - return property_name - - def __repr__(self): - return f' {self.data}' - - -class ElasticsearchWMOWIS2BrokerMessagesProvider(ElasticsearchCatalogueWMOWIS2GDCProvider): # noqa - """Elasticsearch Provider for WMO WIS2 Notification Messages""" - - def __init__(self, provider_def): - super().__init__(provider_def) - - def __repr__(self): - return f' {self.data}' diff --git a/theme/templates/collections/collection.html b/theme/templates/collections/collection.html index e769aebb..987a1054 100644 --- a/theme/templates/collections/collection.html +++ b/theme/templates/collections/collection.html @@ -1,8 +1,10 @@ {% extends "_base.html" %} {% block title %}{{ super() }} {{ data['title'] }} {% endblock %} +{% block desc %}{{ data.get('description','') | truncate(250) }}{% endblock %} +{% block tags %}{{ data.get('keywords',[]) | join(',') }}{% endblock %} {% block crumbs %}{{ super() }}
  • {% trans %}Collections{% endtrans %}
  • -
  • {{ data['title'] | truncate( 25 ) }}
  • +
  • {{ data['title'] | truncate( 25 ) }}
  • {% endblock %} {% block extrahead %} @@ -28,52 +30,80 @@

    {{ data['title'] }}

    + + {% set ns = namespace(header_printed=false) %} + {% for link in data['links'] %} + {% if link['rel'] == 'license' %} + {% if not ns.header_printed %} +

    {% trans %}License{% endtrans %}

    + {% set ns.header_printed = true %} + {% endif %} + + {% endif %} + {% endfor %} + {% if data['itemType'] == 'feature' or data['itemType'] == 'record' %}

    {% trans %}Browse{% endtrans %}

    {% trans %}Queryables{% endtrans %}

    +

    {% trans %}Schema{% endtrans %}

    + {% for provider in config['resources'][data['id']]['providers'] %} {% if 'tile' in provider['type'] %} -

    Tiles

    +

    {% trans %}Tiles{% endtrans %}

    {% endif %} {% endfor %} + {% endif %} + + {% if 'parameter_names' in data %} +

    {% trans %}Parameters{% endtrans %}

    + + + + + + + {% for parameter in data['parameter_names'].values() %} + + + + + + {% endfor %} +
    {% trans %}ID{% endtrans %}{% trans %}Name{% endtrans %}{% trans %}Units{% endtrans %}
    {{ parameter['id'] }}{{ parameter['name'] }}{{ parameter['unit']['symbol']['value'] }}
    {% endif %} -

    {% trans %}Output Formats{% endtrans %}

    -
      - {% for link in data['links'] %} - {# oapiFeatures datasets; shows the primary 'f=[format]' #} - {% if link['rel'] == 'items' %} -
    • {{ link['href'].split('?')[1].split('=')[1] }} ({{ link['type'] }})
    • - {% if link['type'] == 'application/geo+json' %} -
    • CSV
    • {# generally supported with pygeoapi feature collections #} - {% endif %} - {% endif %} - {# oapiCoverage datasets; shows the primary 'f=[format]' #} - {% if link['rel'] == 'http://www.opengis.net/def/rel/ogc/1.0/coverage' %} -
    • {{ link['href'].split('?')[1].split('=')[1] }} ({{ link['type'] }})
    • - {% endif %} - {% endfor %} -
    +

    {% trans %}Links{% endtrans %}

      {% for link in data['links'] %} @@ -83,6 +113,26 @@

      {% trans %}Links{% endtrans %}

      {% endfor %}
    + + {% if data['itemType'] == 'feature' %} +

    {% trans %}Reference Systems{% endtrans %}

    +
      + {% for crs in data['crs'] %} +
    • + {{ crs }} +
    • + {% endfor %} +
    +

    {% trans %}Storage CRS{% endtrans %}

    +
      +
    • + {% trans %}CRS{% endtrans %}: {{ data['storageCRS'] }} +
    • +
    • + {% trans %}Epoch{% endtrans %}: {{ data['storageCrsCoordinateEpoch'] or '_(not specified)' }} +
    • +
    + {% endif %} {% endblock %} @@ -96,6 +146,14 @@

    {% trans %}Links{% endtrans %}

    } )); + {# if this collection has a map representation, add it to the map #} + {% for link in data['links'] %} + {% if link['rel'] == 'http://www.opengis.net/def/rel/ogc/1.0/map' and link['href'] %} + L.tileLayer.wms("{{ link['href'] }}", {"opacity": .7, "transparent": true, "crs": L.CRS.EPSG4326}).addTo(map); + {% endif %} + {% endfor %} + + var bbox_layer = L.polygon([ ['{{ data['extent']['spatial']['bbox'][0][1] }}', '{{ data['extent']['spatial']['bbox'][0][0] }}'], ['{{ data['extent']['spatial']['bbox'][0][3] }}', '{{ data['extent']['spatial']['bbox'][0][0] }}'], @@ -105,5 +163,70 @@

    {% trans %}Links{% endtrans %}

    map.addLayer(bbox_layer); map.fitBounds(bbox_layer.getBounds(), {maxZoom: 10}); + + // Allow to get bbox query parameter of a rectangular area specified by + // dragging the mouse while pressing the Ctrl key + var firstCorner; + var secondCorner; + var currentBoundingBox; + var boundingBox; + var drawingBoundingBox = false; + + map.on('mousedown', setFirstCorner); + map.on('mouseup', setSecondCorner); + map.on('mousemove', drawCurrentBoundingBox); + map.on('click', boundingBoxInfo); + + function boundingBoxInfo(e) { + if (map.hasLayer(boundingBox)) { + var bboxCoords = boundingBox.getBounds().toBBoxString(); + L.popup({maxWidth:"auto"}) + .setLatLng(boundingBox.getBounds().getCenter()) + .setContent(`bbox=${bboxCoords}`) + .addTo(map); + } + } + + function setFirstCorner(e) { + if (e.originalEvent.ctrlKey) { + if (map.hasLayer(boundingBox)) { + map.removeLayer(boundingBox); + } + map.dragging.disable(); + firstCorner = e.latlng; + drawingBoundingBox = true; + } else if (map.hasLayer(boundingBox) && !boundingBox.getBounds().contains(e.latlng)) { + map.removeLayer(boundingBox); + } + } + + function setSecondCorner(e) { + if (map.hasLayer(currentBoundingBox)) { + map.removeLayer(currentBoundingBox); + } + if (e.originalEvent.ctrlKey) { + if (drawingBoundingBox) { + drawingBoundingBox = false; + secondCorner = e.latlng; + var bounds = [firstCorner, secondCorner]; + boundingBox = L.rectangle(bounds, {color:"#ff7800", weight:1}); + boundingBox.addTo(map); + } + } + drawingBoundingBox = false; + map.dragging.enable(); + } + + function drawCurrentBoundingBox(e) { + if (drawingBoundingBox) { + if (map.hasLayer(currentBoundingBox)) { + map.removeLayer(currentBoundingBox); + } + secondCorner = e.latlng; + var bounds = [firstCorner, secondCorner]; + currentBoundingBox = L.rectangle(bounds, {dashArray:"4 1", weight:0.4}); + currentBoundingBox.addTo(map); + } + } -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/theme/templates/collections/coverage/rangetype.html b/theme/templates/collections/coverage/rangetype.html index 23bbd261..5ad25c7c 100644 --- a/theme/templates/collections/coverage/rangetype.html +++ b/theme/templates/collections/coverage/rangetype.html @@ -1,8 +1,8 @@ {% extends "_base.html" %} {% block title %}{{ super() }} {{ data['title'] }} {% endblock %} {% block crumbs %}{{ super() }} -
  • {% trans %}Collections{% endtrans %}
  • -
  • {{ data['title'] }}
  • +
  • {% trans %}Collections{% endtrans %}
  • +
  • {{ data['title'] }}
  • {% endblock %} {% block body %}
    diff --git a/theme/templates/collections/edr/instance.html b/theme/templates/collections/edr/instance.html new file mode 100644 index 00000000..44754c4e --- /dev/null +++ b/theme/templates/collections/edr/instance.html @@ -0,0 +1,42 @@ +{% extends "_base.html" %} +{% block title %}{{ super() }} {{ data['title'] }} {% endblock %} +{% block crumbs %}{{ super() }} +
  • {% trans %}Collections{% endtrans %}
  • +{% for link in data['links'] %} + {% if link.rel == 'collection' %} +
  • {{ link['title'] | truncate( 25 ) }}
  • + {% set col_title = link['title'] %} + {% endif %} +{% endfor %} +
  • {% trans %}Instances{% endtrans %}
  • +
  • {{ data['id'] }}
  • +{% endblock %} +{% block body %} +
    +

    {{ data['title'] }}

    +

    {{ data['description'] }}

    +
      + {% for kw in data['keywords'] %} +
    • {{ kw }}
    • + {% endfor %} +
    +

    {% trans %}Instance{% endtrans %} {{ data['id'] }}

    +
    +

    {% trans %}Links{% endtrans %}

    + +{% endblock %} \ No newline at end of file diff --git a/theme/templates/collections/edr/instances.html b/theme/templates/collections/edr/instances.html new file mode 100644 index 00000000..5bc8e2b6 --- /dev/null +++ b/theme/templates/collections/edr/instances.html @@ -0,0 +1,24 @@ +{% extends "_base.html" %} +{% block title %}{{ super() }} {{ data['title'] }} {% endblock %} +{% block crumbs %}{{ super() }} +
  • {% trans %}Collections{% endtrans %}
  • +
  • {{ data['title'][(locale|lower)[:2]] | truncate( 25 ) }}
  • +
  • {% trans %}Instances{% endtrans %}
  • +{% endblock %} +{% block body %} +
    +

    {{ data['title'][(locale|lower)[:2]] }}

    +

    {{ data['description'][(locale|lower)[:2]] }}

    +
      + {% for kw in data['keywords'][(locale|lower)[:2]] %} +
    • {{ kw }}
    • + {% endfor %} +
    +

    {% trans %}Instances{% endtrans %}

    + +
    +{% endblock %} \ No newline at end of file diff --git a/theme/templates/collections/edr/query.html b/theme/templates/collections/edr/query.html new file mode 100644 index 00000000..b7edf215 --- /dev/null +++ b/theme/templates/collections/edr/query.html @@ -0,0 +1,290 @@ +{% extends "_base.html" %} +{% block title %}{{ super() }} {{ data['title'] }} {% endblock %} +{% block crumbs %}{{ super() }} +
  • {% trans %}Collections{% endtrans %}
  • +{% for link in data['links'] %} + {% if link.rel == 'collection' %} / +
  • {{ link['title'] | truncate( 25 ) }}
  • + {% set col_title = link['title'] %} + {% endif %} +{% endfor %} +
  • {% trans query_type=data.query_type %}{{ query_type }}{% endtrans %}
  • +{% endblock %} +{% block extrahead %} + + + + {% if data.type == "Coverage" or data.type == "CoverageCollection" %} + + + + + + + {% elif data.type == "Feature" or data.type == "FeatureCollection" %} + + + + {% endif %} +{% endblock %} + +{% block body %} +
    + {% if data.features or data.coverages or data.ranges or data.references %} +
    + {% else %} +
    +
    +

    {% trans %}No items{% endtrans %}

    +
    +
    + {% endif %} +
    +{% endblock %} + +{% block extrafoot %} +{% if data %} + +{% endif %} +{% endblock %} \ No newline at end of file diff --git a/theme/templates/collections/map/metadata.html b/theme/templates/collections/map/metadata.html new file mode 100644 index 00000000..888a3b89 --- /dev/null +++ b/theme/templates/collections/map/metadata.html @@ -0,0 +1,39 @@ +{% extends "_base.html" %} +{% block title %}{{ super() }} {{ data['title'] }} {% endblock %} +{% block crumbs %}{{ super() }} +
  • Collections
  • +
  • {{ data['title'] | truncate( 25 ) }}
  • +
  • Map
  • +
  • Metadata
  • +{% endblock %} +{% block body %} +
    +

    {{ data['title'] }}

    +

    {% trans %}Map metadata{% endtrans %}

    +

    {% trans %}Size{% endtrans %}

    +
      +
    • {% trans %}Width:{% endtrans %} {{ data['maxWidth'] }}
    • +
    • {% trans %}Height:{% endtrans %} {{ data['maxHeight'] }}
    • +
    +

    {% trans %}Extents{% endtrans %}

    +
    {% trans %}Spatial{% endtrans %}
    +
      +
    • {% trans %}Minx:{% endtrans %} {{ data['extent']['spatial']['bbox'][0] }}
    • +
    • {% trans %}Miny:{% endtrans %} {{ data['extent']['spatial']['bbox'][1] }}
    • +
    • {% trans %}Maxx:{% endtrans %} {{ data['extent']['spatial']['bbox'][2] }}
    • +
    • {% trans %}Maxy:{% endtrans %} {{ data['extent']['spatial']['bbox'][3] }}
    • +
    • {% trans %}CRS:{% endtrans %} {{ data['extent']['spatial']['crs'] }}
    • +
    + {% if data['extent']['temporal'] %} +
    {% trans %}Temporal{% endtrans %}
    +
      +
    • {% trans %}Begin:{% endtrans %} {{ data['extent']['temporal']['begin'] }}
    • +
    • {% trans %}Begin:{% endtrans %} {{ data['extent']['temporal']['end'] }}
    • +
    +

    {% trans %}Recommended format{% endtrans %}

    +
      +
    • {{ data['recommendedFormat'] }}
    • +
    + {% endif %} +
    +{% endblock %} \ No newline at end of file diff --git a/theme/templates/collections/queryables.html b/theme/templates/collections/queryables.html index 557d4244..d86d0b8a 100644 --- a/theme/templates/collections/queryables.html +++ b/theme/templates/collections/queryables.html @@ -2,12 +2,8 @@ {% block title %}{{ super() }} {{ data['title'] }} {% endblock %} {% block crumbs %}{{ super() }}
  • {% trans %}Collections{% endtrans %}
  • -{% if 'id' in data %} -
  • {{ data['title'] | truncate( 25 ) }}
  • -{% else %} -
  • {{ data['title'] | truncate( 25 ) }}
  • -{% endif %} -
  • {% trans %}Queryables{% endtrans %}
  • +
  • {{ data['title'] | truncate( 25 ) }}
  • +
  • {% trans %}Queryables{% endtrans %}
  • {% endblock %} {% block body %}
    diff --git a/theme/templates/collections/schema.html b/theme/templates/collections/schema.html index f5959663..e222b79c 100644 --- a/theme/templates/collections/schema.html +++ b/theme/templates/collections/schema.html @@ -2,12 +2,8 @@ {% block title %}{{ super() }} {{ data['title'] }} {% endblock %} {% block crumbs %}{{ super() }}
  • {% trans %}Collections{% endtrans %}
  • -{% if 'id' in data %} -
  • {{ data['title'] | truncate( 25 ) }}
  • -{% else %} -
  • {{ data['title'] | truncate( 25 ) }}
  • -{% endif %} -
  • {% trans %}Schema{% endtrans %}
  • +
  • {{ data['title'] | truncate( 25 ) }}
  • +
  • {% trans %}Schema{% endtrans %}
  • {% endblock %} {% block body %}