{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring the WMS with OWSLib" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CRW_DHW\n", "CRW_DHW_mask\n", "CRW_HOTSPOT\n", "CRW_HOTSPOT_mask\n", "CRW_SSTANOMALY\n", "CRW_SSTANOMALY_mask\n", "CRW_BAA\n", "CRW_BAA_mask\n", "CRW_BAA_7D_MAX\n", "CRW_BAA_7D_MAX_mask\n", "CRW_SEAICE\n", "CRW_SST\n" ] } ], "source": [ "from owslib.wms import WebMapService\n", "\n", "\n", "url = \"https://pae-paha.pacioos.hawaii.edu/thredds/wms/dhw_5km?service=WMS\"\n", "\n", "web_map_services = WebMapService(url)\n", "\n", "print(\"\\n\".join(web_map_services.contents.keys()))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Layer metadata" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "layer = \"CRW_SST\"\n", "wms = web_map_services.contents[layer]\n", "\n", "name = wms.title\n", "\n", "lon = (wms.boundingBox[0] + wms.boundingBox[2]) / 2.0\n", "lat = (wms.boundingBox[1] + wms.boundingBox[3]) / 2.0\n", "center = lat, lon\n", "\n", "time_interval = \"{0}/{1}\".format(\n", " wms.timepositions[0].strip(), wms.timepositions[-1].strip()\n", ")\n", "style = \"boxfill/sst_36\"\n", "\n", "if style not in wms.styles:\n", " style = None" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Single layer" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "