{ "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": [ "surface_flag\n", "CRW_DHW\n", "CRW_HOTSPOT\n", "CRW_SST\n", "CRW_SSTANOMALY\n" ] } ], "source": [ "from owslib.wms import WebMapService\n", "\n", "\n", "url = 'http://oos.soest.hawaii.edu/thredds/wms/hioos/satellite/dhw_5km'\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.\n", "lat = (wms.boundingBox[1] + wms.boundingBox[3]) / 2.\n", "center = lat, lon\n", "\n", "time_interval = '{0}/{1}'.format(\n", " wms.timepositions[0].strip(),\n", " 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": [ "