1{ 2 "cells": [ 3 { 4 "cell_type": "markdown", 5 "metadata": {}, 6 "source": [ 7 "### Exploring the WMS with OWSLib" 8 ] 9 }, 10 { 11 "cell_type": "code", 12 "execution_count": 1, 13 "metadata": {}, 14 "outputs": [ 15 { 16 "name": "stdout", 17 "output_type": "stream", 18 "text": [ 19 "CRW_DHW\n", 20 "CRW_DHW_mask\n", 21 "CRW_HOTSPOT\n", 22 "CRW_HOTSPOT_mask\n", 23 "CRW_SSTANOMALY\n", 24 "CRW_SSTANOMALY_mask\n", 25 "CRW_BAA\n", 26 "CRW_BAA_mask\n", 27 "CRW_BAA_7D_MAX\n", 28 "CRW_BAA_7D_MAX_mask\n", 29 "CRW_SEAICE\n", 30 "CRW_SST\n" 31 ] 32 } 33 ], 34 "source": [ 35 "from owslib.wms import WebMapService\n", 36 "\n", 37 "\n", 38 "url = \"https://pae-paha.pacioos.hawaii.edu/thredds/wms/dhw_5km?service=WMS\"\n", 39 "\n", 40 "web_map_services = WebMapService(url)\n", 41 "\n", 42 "print(\"\\n\".join(web_map_services.contents.keys()))" 43 ] 44 }, 45 { 46 "cell_type": "markdown", 47 "metadata": {}, 48 "source": [ 49 "### Layer metadata" 50 ] 51 }, 52 { 53 "cell_type": "code", 54 "execution_count": 2, 55 "metadata": {}, 56 "outputs": [], 57 "source": [ 58 "layer = \"CRW_SST\"\n", 59 "wms = web_map_services.contents[layer]\n", 60 "\n", 61 "name = wms.title\n", 62 "\n", 63 "lon = (wms.boundingBox[0] + wms.boundingBox[2]) / 2.0\n", 64 "lat = (wms.boundingBox[1] + wms.boundingBox[3]) / 2.0\n", 65 "center = lat, lon\n", 66 "\n", 67 "time_interval = \"{0}/{1}\".format(\n", 68 " wms.timepositions[0].strip(), wms.timepositions[-1].strip()\n", 69 ")\n", 70 "style = \"boxfill/sst_36\"\n", 71 "\n", 72 "if style not in wms.styles:\n", 73 " style = None" 74 ] 75 }, 76 { 77 "cell_type": "markdown", 78 "metadata": {}, 79 "source": [ 80 "### Single layer" 81 ] 82 }, 83 { 84 "cell_type": "code", 85 "execution_count": 3, 86 "metadata": {}, 87 "outputs": [ 88 { 89 "data": { 90 "text/html": [ 91 "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe src=\"about:blank\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" data-html=PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgCiAgICAgICAgPHNjcmlwdD4KICAgICAgICAgICAgTF9OT19UT1VDSCA9IGZhbHNlOwogICAgICAgICAgICBMX0RJU0FCTEVfM0QgPSBmYWxzZTsKICAgICAgICA8L3NjcmlwdD4KICAgIAogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS42LjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2NvZGUuanF1ZXJ5LmNvbS9qcXVlcnktMS4xMi40Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0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cmlidXRpb24iOiAiIiwgImZvcm1hdCI6ICJpbWFnZS9wbmciLCAibGF5ZXJzIjogIkNSV19TU1QiLCAic3R5bGVzIjogImJveGZpbGwvc3N0XzM2IiwgInRyYW5zcGFyZW50IjogdHJ1ZSwgInZlcnNpb24iOiAiMS4xLjEifQogICAgICAgICAgICApLmFkZFRvKG1hcF81OWExOWIxYjcwMDg0OGJlODA1NDU2YjE2MGU5MzllMCk7CiAgICAgICAgCiAgICAKICAgICAgICAgICAgbWFwXzU5YTE5YjFiNzAwODQ4YmU4MDU0NTZiMTYwZTkzOWUwLnRpbWVEaW1lbnNpb24gPSBMLnRpbWVEaW1lbnNpb24oCiAgICAgICAgICAgICAgICB7InBlcmlvZCI6ICJQVDFIIiwgInRpbWVJbnRlcnZhbCI6ICIxOTg1LTA0LTAxVDEyOjAwOjAwLjAwMFovMjAyMC0xMS0xNFQxMjowMDowMC4wMDBaIn0KICAgICAgICAgICAgKTsKICAgICAgICAgICAgbWFwXzU5YTE5YjFiNzAwODQ4YmU4MDU0NTZiMTYwZTkzOWUwLnRpbWVEaW1lbnNpb25Db250cm9sID0KICAgICAgICAgICAgICAgIEwuY29udHJvbC50aW1lRGltZW5zaW9uKAogICAgICAgICAgICAgICAgICAgIHsiYXV0b1BsYXkiOiBmYWxzZSwgInBsYXllck9wdGlvbnMiOiB7Imxvb3AiOiBmYWxzZSwgInRyYW5zaXRpb25UaW1lIjogMjAwfSwgInBvc2l0aW9uIjogImJvdHRvbWxlZnQifQogICAgICAgICAgICAgICAgKTsKICAgICAgICAgICAgbWFwXzU5YTE5YjFiNzAwODQ4YmU4MDU0NTZiMTYwZTkzOWUwLmFkZENvbnRyb2woCiAgICAgICAgICAgICAgICBtYXBfNTlhMTliMWI3MDA4NDhiZTgwNTQ1NmIxNjBlOTM5ZTAudGltZURpbWVuc2lvbkNvbnRyb2wKICAgICAgICAgICAgKTsKCiAgICAgICAgICAgIAogICAgICAgICAgICB2YXIgbWFjcm9fZWxlbWVudF8yOTZmOTk3YWYwN2I0NGVmYWM4ZjFmYWZjZDI3YmZhZSA9IEwudGltZURpbWVuc2lvbi5sYXllci53bXMoCiAgICAgICAgICAgICAgICBtYWNyb19lbGVtZW50XzI5NmY5OTdhZjA3YjQ0ZWZhYzhmMWZhZmNkMjdiZmFlLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHVwZGF0ZVRpbWVEaW1lbnNpb246IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdtc1ZlcnNpb246ICIxLjEuMSIsCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFwXzU5YTE5YjFiNzAwODQ4YmU4MDU0NTZiMTYwZTkzOWUwKTsKICAgICAgICAgICAgCiAgICAgICAgCiAgICAKICAgICAgICAgICAgdmFyIGxheWVyX2NvbnRyb2xfNDM1MGM3YmE5ZmUxNDk1YWE4MDQ5ZmIzZTRhMGM1YWYgPSB7CiAgICAgICAgICAgICAgICBiYXNlX2xheWVycyA6IHsKICAgICAgICAgICAgICAgICAgICAib3BlbnN0cmVldG1hcCIgOiB0aWxlX2xheWVyX2RhODI1ZTNiNDJiMzQ0ODk5NWY3ZmM5ZWVlZDMyODQyLAogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgIG92ZXJsYXlzIDogIHsKICAgICAgICAgICAgICAgICAgICAic2VhX3N1cmZhY2VfdGVtcGVyYXR1cmUiIDogbWFjcm9fZWxlbWVudF8yOTZmOTk3YWYwN2I0NGVmYWM4ZjFmYWZjZDI3YmZhZSwKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEwuY29udHJvbC5sYXllcnMoCiAgICAgICAgICAgICAgICBsYXllcl9jb250cm9sXzQzNTBjN2JhOWZlMTQ5NWFhODA0OWZiM2U0YTBjNWFmLmJhc2VfbGF5ZXJzLAogICAgICAgICAgICAgICAgbGF5ZXJfY29udHJvbF80MzUwYzdiYTlmZTE0OTVhYTgwNDlmYjNlNGEwYzVhZi5vdmVybGF5cywKICAgICAgICAgICAgICAgIHsiYXV0b1pJbmRleCI6IHRydWUsICJjb2xsYXBzZWQiOiB0cnVlLCAicG9zaXRpb24iOiAidG9wcmlnaHQifQogICAgICAgICAgICApLmFkZFRvKG1hcF81OWExOWIxYjcwMDg0OGJlODA1NDU2YjE2MGU5MzllMCk7CiAgICAgICAgCjwvc2NyaXB0Pg== onload=\"this.contentDocument.open();this.contentDocument.write(atob(this.getAttribute('data-html')));this.contentDocument.close();\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>" 92 ], 93 "text/plain": [ 94 "<folium.folium.Map at 0x7fa2e80cbb20>" 95 ] 96 }, 97 "execution_count": 3, 98 "metadata": {}, 99 "output_type": "execute_result" 100 } 101 ], 102 "source": [ 103 "import folium\n", 104 "from folium import plugins\n", 105 "\n", 106 "lon, lat = -50, -40\n", 107 "\n", 108 "m = folium.Map(location=[lat, lon], zoom_start=5, control_scale=True)\n", 109 "\n", 110 "w = folium.raster_layers.WmsTileLayer(\n", 111 " url=url,\n", 112 " name=name,\n", 113 " styles=style,\n", 114 " fmt=\"image/png\",\n", 115 " transparent=True,\n", 116 " layers=layer,\n", 117 " overlay=True,\n", 118 " COLORSCALERANGE=\"1.2,28\",\n", 119 ")\n", 120 "\n", 121 "w.add_to(m)\n", 122 "\n", 123 "time = plugins.TimestampedWmsTileLayers(w, period=\"PT1H\", time_interval=time_interval)\n", 124 "\n", 125 "time.add_to(m)\n", 126 "\n", 127 "folium.LayerControl().add_to(m)\n", 128 "\n", 129 "m" 130 ] 131 }, 132 { 133 "cell_type": "markdown", 134 "metadata": {}, 135 "source": [ 136 "### Multiple layers" 137 ] 138 }, 139 { 140 "cell_type": "code", 141 "execution_count": 4, 142 "metadata": {}, 143 "outputs": [ 144 { 145 "data": { 146 "text/html": [ 147 "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe src=\"about:blank\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" data-html=PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgCiAgICAgICAgPHNjcmlwdD4KICAgICAgICAgICAgTF9OT19UT1VDSCA9IGZhbHNlOwogICAgICAgICAgICBMX0RJU0FCTEVfM0QgPSBmYWxzZTsKICAgICAgICA8L3NjcmlwdD4KICAgIAogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS42LjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2NvZGUuanF1ZXJ5LmNvbS9qcXVlcnktMS4xMi40Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdH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+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vY2RuLmpzZGVsaXZyLm5ldC9ucG0vbGVhZmxldC10aW1lZGltZW5zaW9uQDEuMS4xL2Rpc3QvbGVhZmxldC50aW1lZGltZW5zaW9uLmNvbnRyb2wuY3NzIi8+CjwvaGVhZD4KPGJvZHk+ICAgIAogICAgCiAgICAgICAgICAgIDxkaXYgY2xhc3M9ImZvbGl1bS1tYXAiIGlkPSJtYXBfZmFiMjczYTQ5Nzg2NDYwN2E0M2ZjNmM5NTRhYjMzYWMiID48L2Rpdj4KICAgICAgICAKPC9ib2R5Pgo8c2NyaXB0PiAgICAKICAgIAogICAgICAgICAgICB2YXIgbWFwX2ZhYjI3M2E0OTc4NjQ2MDdhNDNmYzZjOTU0YWIzM2FjID0gTC5tYXAoCiAgICAgICAgICAgICAgICAibWFwX2ZhYjI3M2E0OTc4NjQ2MDdhNDNmYzZjOTU0YWIzM2FjIiwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBjZW50ZXI6IFstNDAuMCwgLTUwLjBdLAogICAgICAgICAgICAgICAgICAgIGNyczogTC5DUlMuRVBTRzM4NTcsCiAgICAgICAgICAgICAgICAgICAgem9vbTogNSwKICAgICAgICAgICAgICAgICAgICB6b29tQ29udHJvbDogdHJ1ZSwKICAgICAgICAgICAgICAgICAgICBwcmVmZXJDYW52YXM6IGZhbHNlLAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApOwogICAgICAgICAgICBMLmNvbnRyb2wuc2NhbGUoKS5hZGRUbyhtYXBfZmFiMjczYTQ5Nzg2NDYwN2E0M2ZjNmM5NTRhYjMzYWMpOwoKICAgICAgICAgICAgCgogICAgICAgIAogICAgCiAgICAgICAgICAgIHZhciB0aWxlX2xheWVyX2IzMmFkMWE1YTQxZDRhYjI4ZTU4YmM5MWE2NmExNDhjID0gTC50aWxlTGF5ZXIoCiAgICAgICAgICAgICAgICAiaHR0cHM6Ly97c30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W5zaXRpb25UaW1lIjogMjAwfSwgInBvc2l0aW9uIjogImJvdHRvbWxlZnQifQogICAgICAgICAgICAgICAgKTsKICAgICAgICAgICAgbWFwX2ZhYjI3M2E0OTc4NjQ2MDdhNDNmYzZjOTU0YWIzM2FjLmFkZENvbnRyb2woCiAgICAgICAgICAgICAgICBtYXBfZmFiMjczYTQ5Nzg2NDYwN2E0M2ZjNmM5NTRhYjMzYWMudGltZURpbWVuc2lvbkNvbnRyb2wKICAgICAgICAgICAgKTsKCiAgICAgICAgICAgIAogICAgICAgICAgICB2YXIgbWFjcm9fZWxlbWVudF9lNWY0ZDhlNWRlNDI0NzVhYjBhMjBkYWQ5ZjZkNTZlYiA9IEwudGltZURpbWVuc2lvbi5sYXllci53bXMoCiAgICAgICAgICAgICAgICBtYWNyb19lbGVtZW50X2U1ZjRkOGU1ZGU0MjQ3NWFiMGEyMGRhZDlmNmQ1NmViLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIHVwZGF0ZVRpbWVEaW1lbnNpb246IGZhbHNlLAogICAgICAgICAgICAgICAgICAgIHdtc1ZlcnNpb246ICIxLjEuMSIsCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFwX2ZhYjI3M2E0OTc4NjQ2MDdhNDNmYzZjOTU0YWIzM2FjKTsKICAgICAgICAgICAgCiAgICAgICAgICAgIHZhciBtYWNyb19lbGVtZW50X2JjNmEwMWI0ZjFiMDQxM2ZiZTRiYzE1YjliZTI0MmNjID0gTC50aW1lRGltZW5zaW9uLmxheWVyLndtcygKICAgICAgICAgICAgICAgIG1hY3JvX2VsZW1lbnRfYmM2YTAxYjRmMWIwNDEzZmJlNGJjMTViOWJlMjQyY2MsCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgdXBkYXRlVGltZURpbWVuc2lvbjogZmFsc2UsCiAgICAgICAgICAgICAgICAgICAgd21zVmVyc2lvbjogIjEuMS4xIiwKICAgICAgICAgICAgIC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tYXBfZmFiMjczYTQ5Nzg2NDYwN2E0M2ZjNmM5NTRhYjMzYWMpOwogICAgICAgIAo8L3NjcmlwdD4= onload=\"this.contentDocument.open();this.contentDocument.write(atob(this.getAttribute('data-html')));this.contentDocument.close();\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>" 148 ], 149 "text/plain": [ 150 "<folium.folium.Map at 0x7fa28c2dd130>" 151 ] 152 }, 153 "execution_count": 4, 154 "metadata": {}, 155 "output_type": "execute_result" 156 } 157 ], 158 "source": [ 159 "m = folium.Map(location=[lat, lon], zoom_start=5, control_scale=True)\n", 160 "\n", 161 "w0 = folium.raster_layers.WmsTileLayer(\n", 162 " url=url,\n", 163 " name=\"sea_surface_temperature\",\n", 164 " styles=style,\n", 165 " fmt=\"image/png\",\n", 166 " transparent=True,\n", 167 " layers=\"CRW_SST\",\n", 168 " overlay=True,\n", 169 ")\n", 170 "\n", 171 "w1 = folium.raster_layers.WmsTileLayer(\n", 172 " url=url,\n", 173 " name=\"analysed sea surface temperature anomaly\",\n", 174 " styles=style,\n", 175 " fmt=\"image/png\",\n", 176 " transparent=True,\n", 177 " layers=\"CRW_SSTANOMALY\",\n", 178 " overlay=True,\n", 179 ")\n", 180 "\n", 181 "w0.add_to(m)\n", 182 "w1.add_to(m)\n", 183 "\n", 184 "time = folium.plugins.TimestampedWmsTileLayers(\n", 185 " [w0, w1], period=\"PT1H\", time_interval=time_interval\n", 186 ")\n", 187 "\n", 188 "time.add_to(m)\n", 189 "\n", 190 "folium.LayerControl().add_to(m)\n", 191 "\n", 192 "m" 193 ] 194 } 195 ], 196 "metadata": { 197 "kernelspec": { 198 "display_name": "Python 3", 199 "language": "python", 200 "name": "python3" 201 }, 202 "language_info": { 203 "codemirror_mode": { 204 "name": "ipython", 205 "version": 3 206 }, 207 "file_extension": ".py", 208 "mimetype": "text/x-python", 209 "name": "python", 210 "nbconvert_exporter": "python", 211 "pygments_lexer": "ipython3", 212 "version": "3.9.0" 213 } 214 }, 215 "nbformat": 4, 216 "nbformat_minor": 2 217} 218