-
+
"
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/javascript": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = true;\n const py_version = '3.5.2'.replace('rc', '-rc.').replace('.dev', '-dev.');\n const reloading = false;\n const Bokeh = root.Bokeh;\n\n // Set a timeout for this load but only if we are not already initializing\n if (typeof (root._bokeh_timeout) === \"undefined\" || (force || !root._bokeh_is_initializing)) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) {\n if (callback != null)\n callback();\n });\n } finally {\n delete root._bokeh_onload_callbacks;\n }\n console.debug(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(css_urls, js_urls, js_modules, js_exports, callback) {\n if (css_urls == null) css_urls = [];\n if (js_urls == null) js_urls = [];\n if (js_modules == null) js_modules = [];\n if (js_exports == null) js_exports = {};\n\n root._bokeh_onload_callbacks.push(callback);\n\n if (root._bokeh_is_loading > 0) {\n // Don't load bokeh if it is still initializing\n console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n } else if (js_urls.length === 0 && js_modules.length === 0 && Object.keys(js_exports).length === 0) {\n // There is nothing to load\n run_callbacks();\n return null;\n }\n\n function on_load() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n run_callbacks()\n }\n }\n window._bokeh_on_load = on_load\n\n function on_error(e) {\n const src_el = e.srcElement\n console.error(\"failed to load \" + (src_el.href || src_el.src));\n }\n\n const skip = [];\n if (window.requirejs) {\n window.requirejs.config({'packages': {}, 'paths': {}, 'shim': {}});\n root._bokeh_is_loading = css_urls.length + 0;\n } else {\n root._bokeh_is_loading = css_urls.length + js_urls.length + js_modules.length + Object.keys(js_exports).length;\n }\n\n const existing_stylesheets = []\n const links = document.getElementsByTagName('link')\n for (let i = 0; i < links.length; i++) {\n const link = links[i]\n if (link.href != null) {\n existing_stylesheets.push(link.href)\n }\n }\n for (let i = 0; i < css_urls.length; i++) {\n const url = css_urls[i];\n const escaped = encodeURI(url)\n if (existing_stylesheets.indexOf(escaped) !== -1) {\n on_load()\n continue;\n }\n const element = document.createElement(\"link\");\n element.onload = on_load;\n element.onerror = on_error;\n element.rel = \"stylesheet\";\n element.type = \"text/css\";\n element.href = url;\n console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n document.body.appendChild(element);\n } var existing_scripts = []\n const scripts = document.getElementsByTagName('script')\n for (let i = 0; i < scripts.length; i++) {\n var script = scripts[i]\n if (script.src != null) {\n existing_scripts.push(script.src)\n }\n }\n for (let i = 0; i < js_urls.length; i++) {\n const url = js_urls[i];\n const escaped = encodeURI(url)\n if (skip.indexOf(escaped) !== -1 || existing_scripts.indexOf(escaped) !== -1) {\n if (!window.requirejs) {\n on_load();\n }\n continue;\n }\n const element = document.createElement('script');\n element.onload = on_load;\n element.onerror = on_error;\n element.async = false;\n element.src = url;\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n for (let i = 0; i < js_modules.length; i++) {\n const url = js_modules[i];\n const escaped = encodeURI(url)\n if (skip.indexOf(escaped) !== -1 || existing_scripts.indexOf(escaped) !== -1) {\n if (!window.requirejs) {\n on_load();\n }\n continue;\n }\n var element = document.createElement('script');\n element.onload = on_load;\n element.onerror = on_error;\n element.async = false;\n element.src = url;\n element.type = \"module\";\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n for (const name in js_exports) {\n const url = js_exports[name];\n const escaped = encodeURI(url)\n if (skip.indexOf(escaped) >= 0 || root[name] != null) {\n if (!window.requirejs) {\n on_load();\n }\n continue;\n }\n var element = document.createElement('script');\n element.onerror = on_error;\n element.async = false;\n element.type = \"module\";\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n element.textContent = `\n import ${name} from \"${url}\"\n window.${name} = ${name}\n window._bokeh_on_load()\n `\n document.head.appendChild(element);\n }\n if (!js_urls.length && !js_modules.length) {\n on_load()\n }\n };\n\n function inject_raw_css(css) {\n const element = document.createElement(\"style\");\n element.appendChild(document.createTextNode(css));\n document.body.appendChild(element);\n }\n\n const js_urls = [\"https://cdn.holoviz.org/panel/1.5.0/dist/bundled/reactiveesm/es-module-shims@^1.10.0/dist/es-module-shims.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-3.5.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.5.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.5.2.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.5.2.min.js\", \"https://cdn.holoviz.org/panel/1.5.0/dist/panel.min.js\"];\n const js_modules = [];\n const js_exports = {};\n const css_urls = [];\n const inline_js = [ function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\nfunction(Bokeh) {} // ensure no trailing comma for IE\n ];\n\n function run_inline_js() {\n if ((root.Bokeh !== undefined) || (force === true)) {\n for (let i = 0; i < inline_js.length; i++) {\n try {\n inline_js[i].call(root, root.Bokeh);\n } catch(e) {\n if (!reloading) {\n throw e;\n }\n }\n }\n // Cache old bokeh versions\n if (Bokeh != undefined && !reloading) {\n var NewBokeh = root.Bokeh;\n if (Bokeh.versions === undefined) {\n Bokeh.versions = new Map();\n }\n if (NewBokeh.version !== Bokeh.version) {\n Bokeh.versions.set(NewBokeh.version, NewBokeh)\n }\n root.Bokeh = Bokeh;\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n }\n root._bokeh_is_initializing = false\n }\n\n function load_or_wait() {\n // Implement a backoff loop that tries to ensure we do not load multiple\n // versions of Bokeh and its dependencies at the same time.\n // In recent versions we use the root._bokeh_is_initializing flag\n // to determine whether there is an ongoing attempt to initialize\n // bokeh, however for backward compatibility we also try to ensure\n // that we do not start loading a newer (Panel>=1.0 and Bokeh>3) version\n // before older versions are fully initialized.\n if (root._bokeh_is_initializing && Date.now() > root._bokeh_timeout) {\n // If the timeout and bokeh was not successfully loaded we reset\n // everything and try loading again\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_is_initializing = false;\n root._bokeh_onload_callbacks = undefined;\n root._bokeh_is_loading = 0\n console.log(\"Bokeh: BokehJS was loaded multiple times but one version failed to initialize.\");\n load_or_wait();\n } else if (root._bokeh_is_initializing || (typeof root._bokeh_is_initializing === \"undefined\" && root._bokeh_onload_callbacks !== undefined)) {\n setTimeout(load_or_wait, 100);\n } else {\n root._bokeh_is_initializing = true\n root._bokeh_onload_callbacks = []\n const bokeh_loaded = root.Bokeh != null && (root.Bokeh.version === py_version || (root.Bokeh.versions !== undefined && root.Bokeh.versions.has(py_version)));\n if (!reloading && !bokeh_loaded) {\n if (root.Bokeh) {\n root.Bokeh = undefined;\n }\n console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n }\n load_libs(css_urls, js_urls, js_modules, js_exports, function() {\n console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n }\n // Give older versions of the autoload script a head-start to ensure\n // they initialize before we start loading newer version.\n setTimeout(load_or_wait, 100)\n}(window));",
- "application/vnd.holoviews_load.v0+json": ""
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/javascript": "\nif ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n}\n\n\n function JupyterCommManager() {\n }\n\n JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n comm_manager.register_target(comm_id, function(comm) {\n comm.on_msg(msg_handler);\n });\n } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n comm.onMsg = msg_handler;\n });\n } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n var messages = comm.messages[Symbol.asyncIterator]();\n function processIteratorResult(result) {\n var message = result.value;\n console.log(message)\n var content = {data: message.data, comm_id};\n var buffers = []\n for (var buffer of message.buffers || []) {\n buffers.push(new DataView(buffer))\n }\n var metadata = message.metadata || {};\n var msg = {content, buffers, metadata}\n msg_handler(msg);\n return messages.next().then(processIteratorResult);\n }\n return messages.next().then(processIteratorResult);\n })\n }\n }\n\n JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n if (comm_id in window.PyViz.comms) {\n return window.PyViz.comms[comm_id];\n } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n if (msg_handler) {\n comm.on_msg(msg_handler);\n }\n } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n comm.open();\n if (msg_handler) {\n comm.onMsg = msg_handler;\n }\n } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n var comm_promise = google.colab.kernel.comms.open(comm_id)\n comm_promise.then((comm) => {\n window.PyViz.comms[comm_id] = comm;\n if (msg_handler) {\n var messages = comm.messages[Symbol.asyncIterator]();\n function processIteratorResult(result) {\n var message = result.value;\n var content = {data: message.data};\n var metadata = message.metadata || {comm_id};\n var msg = {content, metadata}\n msg_handler(msg);\n return messages.next().then(processIteratorResult);\n }\n return messages.next().then(processIteratorResult);\n }\n }) \n var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n return comm_promise.then((comm) => {\n comm.send(data, metadata, buffers, disposeOnDone);\n });\n };\n var comm = {\n send: sendClosure\n };\n }\n window.PyViz.comms[comm_id] = comm;\n return comm;\n }\n window.PyViz.comm_manager = new JupyterCommManager();\n \n\n\nvar JS_MIME_TYPE = 'application/javascript';\nvar HTML_MIME_TYPE = 'text/html';\nvar EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\nvar CLASS_NAME = 'output';\n\n/**\n * Render data to the DOM node\n */\nfunction render(props, node) {\n var div = document.createElement(\"div\");\n var script = document.createElement(\"script\");\n node.appendChild(div);\n node.appendChild(script);\n}\n\n/**\n * Handle when a new output is added\n */\nfunction handle_add_output(event, handle) {\n var output_area = handle.output_area;\n var output = handle.output;\n if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n return\n }\n var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n if (id !== undefined) {\n var nchildren = toinsert.length;\n var html_node = toinsert[nchildren-1].children[0];\n html_node.innerHTML = output.data[HTML_MIME_TYPE];\n var scripts = [];\n var nodelist = html_node.querySelectorAll(\"script\");\n for (var i in nodelist) {\n if (nodelist.hasOwnProperty(i)) {\n scripts.push(nodelist[i])\n }\n }\n\n scripts.forEach( function (oldScript) {\n var newScript = document.createElement(\"script\");\n var attrs = [];\n var nodemap = oldScript.attributes;\n for (var j in nodemap) {\n if (nodemap.hasOwnProperty(j)) {\n attrs.push(nodemap[j])\n }\n }\n attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n oldScript.parentNode.replaceChild(newScript, oldScript);\n });\n if (JS_MIME_TYPE in output.data) {\n toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n }\n output_area._hv_plot_id = id;\n if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n window.PyViz.plot_index[id] = Bokeh.index[id];\n } else {\n window.PyViz.plot_index[id] = null;\n }\n } else if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n var bk_div = document.createElement(\"div\");\n bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n var script_attrs = bk_div.children[0].attributes;\n for (var i = 0; i < script_attrs.length; i++) {\n toinsert[toinsert.length - 1].childNodes[1].setAttribute(script_attrs[i].name, script_attrs[i].value);\n }\n // store reference to server id on output_area\n output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n }\n}\n\n/**\n * Handle when an output is cleared or removed\n */\nfunction handle_clear_output(event, handle) {\n var id = handle.cell.output_area._hv_plot_id;\n var server_id = handle.cell.output_area._bokeh_server_id;\n if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n if (server_id !== null) {\n comm.send({event_type: 'server_delete', 'id': server_id});\n return;\n } else if (comm !== null) {\n comm.send({event_type: 'delete', 'id': id});\n }\n delete PyViz.plot_index[id];\n if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n var doc = window.Bokeh.index[id].model.document\n doc.clear();\n const i = window.Bokeh.documents.indexOf(doc);\n if (i > -1) {\n window.Bokeh.documents.splice(i, 1);\n }\n }\n}\n\n/**\n * Handle kernel restart event\n */\nfunction handle_kernel_cleanup(event, handle) {\n delete PyViz.comms[\"hv-extension-comm\"];\n window.PyViz.plot_index = {}\n}\n\n/**\n * Handle update_display_data messages\n */\nfunction handle_update_output(event, handle) {\n handle_clear_output(event, {cell: {output_area: handle.output_area}})\n handle_add_output(event, handle)\n}\n\nfunction register_renderer(events, OutputArea) {\n function append_mime(data, metadata, element) {\n // create a DOM node to render to\n var toinsert = this.create_output_subarea(\n metadata,\n CLASS_NAME,\n EXEC_MIME_TYPE\n );\n this.keyboard_manager.register_events(toinsert);\n // Render to node\n var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n render(props, toinsert[0]);\n element.append(toinsert);\n return toinsert\n }\n\n events.on('output_added.OutputArea', handle_add_output);\n events.on('output_updated.OutputArea', handle_update_output);\n events.on('clear_output.CodeCell', handle_clear_output);\n events.on('delete.Cell', handle_clear_output);\n events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n\n OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n safe: true,\n index: 0\n });\n}\n\nif (window.Jupyter !== undefined) {\n try {\n var events = require('base/js/events');\n var OutputArea = require('notebook/js/outputarea').OutputArea;\n if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n register_renderer(events, OutputArea);\n }\n } catch(err) {\n }\n}\n",
- "application/vnd.holoviews_load.v0+json": ""
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.holoviews_exec.v0+json": "",
- "text/html": [
- "
\n",
- ""
- ]
- },
- "metadata": {
- "application/vnd.holoviews_exec.v0+json": {
- "id": "p1002"
- }
- },
- "output_type": "display_data"
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "/home/tomsail/work/gist/WebCritech/.venv/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
- " from .autonotebook import tqdm as notebook_tqdm\n"
- ]
- },
- {
- "data": {
- "text/html": [
- ""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/javascript": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = false;\n const py_version = '3.5.2'.replace('rc', '-rc.').replace('.dev', '-dev.');\n const reloading = true;\n const Bokeh = root.Bokeh;\n\n // Set a timeout for this load but only if we are not already initializing\n if (typeof (root._bokeh_timeout) === \"undefined\" || (force || !root._bokeh_is_initializing)) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) {\n if (callback != null)\n callback();\n });\n } finally {\n delete root._bokeh_onload_callbacks;\n }\n console.debug(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(css_urls, js_urls, js_modules, js_exports, callback) {\n if (css_urls == null) css_urls = [];\n if (js_urls == null) js_urls = [];\n if (js_modules == null) js_modules = [];\n if (js_exports == null) js_exports = {};\n\n root._bokeh_onload_callbacks.push(callback);\n\n if (root._bokeh_is_loading > 0) {\n // Don't load bokeh if it is still initializing\n console.debug(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n } else if (js_urls.length === 0 && js_modules.length === 0 && Object.keys(js_exports).length === 0) {\n // There is nothing to load\n run_callbacks();\n return null;\n }\n\n function on_load() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.debug(\"Bokeh: all BokehJS libraries/stylesheets loaded\");\n run_callbacks()\n }\n }\n window._bokeh_on_load = on_load\n\n function on_error(e) {\n const src_el = e.srcElement\n console.error(\"failed to load \" + (src_el.href || src_el.src));\n }\n\n const skip = [];\n if (window.requirejs) {\n window.requirejs.config({'packages': {}, 'paths': {}, 'shim': {}});\n root._bokeh_is_loading = css_urls.length + 0;\n } else {\n root._bokeh_is_loading = css_urls.length + js_urls.length + js_modules.length + Object.keys(js_exports).length;\n }\n\n const existing_stylesheets = []\n const links = document.getElementsByTagName('link')\n for (let i = 0; i < links.length; i++) {\n const link = links[i]\n if (link.href != null) {\n existing_stylesheets.push(link.href)\n }\n }\n for (let i = 0; i < css_urls.length; i++) {\n const url = css_urls[i];\n const escaped = encodeURI(url)\n if (existing_stylesheets.indexOf(escaped) !== -1) {\n on_load()\n continue;\n }\n const element = document.createElement(\"link\");\n element.onload = on_load;\n element.onerror = on_error;\n element.rel = \"stylesheet\";\n element.type = \"text/css\";\n element.href = url;\n console.debug(\"Bokeh: injecting link tag for BokehJS stylesheet: \", url);\n document.body.appendChild(element);\n } var existing_scripts = []\n const scripts = document.getElementsByTagName('script')\n for (let i = 0; i < scripts.length; i++) {\n var script = scripts[i]\n if (script.src != null) {\n existing_scripts.push(script.src)\n }\n }\n for (let i = 0; i < js_urls.length; i++) {\n const url = js_urls[i];\n const escaped = encodeURI(url)\n if (skip.indexOf(escaped) !== -1 || existing_scripts.indexOf(escaped) !== -1) {\n if (!window.requirejs) {\n on_load();\n }\n continue;\n }\n const element = document.createElement('script');\n element.onload = on_load;\n element.onerror = on_error;\n element.async = false;\n element.src = url;\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n for (let i = 0; i < js_modules.length; i++) {\n const url = js_modules[i];\n const escaped = encodeURI(url)\n if (skip.indexOf(escaped) !== -1 || existing_scripts.indexOf(escaped) !== -1) {\n if (!window.requirejs) {\n on_load();\n }\n continue;\n }\n var element = document.createElement('script');\n element.onload = on_load;\n element.onerror = on_error;\n element.async = false;\n element.src = url;\n element.type = \"module\";\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n for (const name in js_exports) {\n const url = js_exports[name];\n const escaped = encodeURI(url)\n if (skip.indexOf(escaped) >= 0 || root[name] != null) {\n if (!window.requirejs) {\n on_load();\n }\n continue;\n }\n var element = document.createElement('script');\n element.onerror = on_error;\n element.async = false;\n element.type = \"module\";\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n element.textContent = `\n import ${name} from \"${url}\"\n window.${name} = ${name}\n window._bokeh_on_load()\n `\n document.head.appendChild(element);\n }\n if (!js_urls.length && !js_modules.length) {\n on_load()\n }\n };\n\n function inject_raw_css(css) {\n const element = document.createElement(\"style\");\n element.appendChild(document.createTextNode(css));\n document.body.appendChild(element);\n }\n\n const js_urls = [\"https://cdn.holoviz.org/panel/1.5.0/dist/bundled/reactiveesm/es-module-shims@^1.10.0/dist/es-module-shims.min.js\"];\n const js_modules = [];\n const js_exports = {};\n const css_urls = [];\n const inline_js = [ function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\nfunction(Bokeh) {} // ensure no trailing comma for IE\n ];\n\n function run_inline_js() {\n if ((root.Bokeh !== undefined) || (force === true)) {\n for (let i = 0; i < inline_js.length; i++) {\n try {\n inline_js[i].call(root, root.Bokeh);\n } catch(e) {\n if (!reloading) {\n throw e;\n }\n }\n }\n // Cache old bokeh versions\n if (Bokeh != undefined && !reloading) {\n var NewBokeh = root.Bokeh;\n if (Bokeh.versions === undefined) {\n Bokeh.versions = new Map();\n }\n if (NewBokeh.version !== Bokeh.version) {\n Bokeh.versions.set(NewBokeh.version, NewBokeh)\n }\n root.Bokeh = Bokeh;\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n }\n root._bokeh_is_initializing = false\n }\n\n function load_or_wait() {\n // Implement a backoff loop that tries to ensure we do not load multiple\n // versions of Bokeh and its dependencies at the same time.\n // In recent versions we use the root._bokeh_is_initializing flag\n // to determine whether there is an ongoing attempt to initialize\n // bokeh, however for backward compatibility we also try to ensure\n // that we do not start loading a newer (Panel>=1.0 and Bokeh>3) version\n // before older versions are fully initialized.\n if (root._bokeh_is_initializing && Date.now() > root._bokeh_timeout) {\n // If the timeout and bokeh was not successfully loaded we reset\n // everything and try loading again\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_is_initializing = false;\n root._bokeh_onload_callbacks = undefined;\n root._bokeh_is_loading = 0\n console.log(\"Bokeh: BokehJS was loaded multiple times but one version failed to initialize.\");\n load_or_wait();\n } else if (root._bokeh_is_initializing || (typeof root._bokeh_is_initializing === \"undefined\" && root._bokeh_onload_callbacks !== undefined)) {\n setTimeout(load_or_wait, 100);\n } else {\n root._bokeh_is_initializing = true\n root._bokeh_onload_callbacks = []\n const bokeh_loaded = root.Bokeh != null && (root.Bokeh.version === py_version || (root.Bokeh.versions !== undefined && root.Bokeh.versions.has(py_version)));\n if (!reloading && !bokeh_loaded) {\n if (root.Bokeh) {\n root.Bokeh = undefined;\n }\n console.debug(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n }\n load_libs(css_urls, js_urls, js_modules, js_exports, function() {\n console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n }\n // Give older versions of the autoload script a head-start to ensure\n // they initialize before we start loading newer version.\n setTimeout(load_or_wait, 100)\n}(window));",
- "application/vnd.holoviews_load.v0+json": ""
- },
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/javascript": "\nif ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n}\n\n\n function JupyterCommManager() {\n }\n\n JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n comm_manager.register_target(comm_id, function(comm) {\n comm.on_msg(msg_handler);\n });\n } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n comm.onMsg = msg_handler;\n });\n } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n var messages = comm.messages[Symbol.asyncIterator]();\n function processIteratorResult(result) {\n var message = result.value;\n console.log(message)\n var content = {data: message.data, comm_id};\n var buffers = []\n for (var buffer of message.buffers || []) {\n buffers.push(new DataView(buffer))\n }\n var metadata = message.metadata || {};\n var msg = {content, buffers, metadata}\n msg_handler(msg);\n return messages.next().then(processIteratorResult);\n }\n return messages.next().then(processIteratorResult);\n })\n }\n }\n\n JupyterCommManager.prototype.get_client_comm = function(plot_id, comm_id, msg_handler) {\n if (comm_id in window.PyViz.comms) {\n return window.PyViz.comms[comm_id];\n } else if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n var comm = comm_manager.new_comm(comm_id, {}, {}, {}, comm_id);\n if (msg_handler) {\n comm.on_msg(msg_handler);\n }\n } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n var comm = window.PyViz.kernels[plot_id].connectToComm(comm_id);\n comm.open();\n if (msg_handler) {\n comm.onMsg = msg_handler;\n }\n } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n var comm_promise = google.colab.kernel.comms.open(comm_id)\n comm_promise.then((comm) => {\n window.PyViz.comms[comm_id] = comm;\n if (msg_handler) {\n var messages = comm.messages[Symbol.asyncIterator]();\n function processIteratorResult(result) {\n var message = result.value;\n var content = {data: message.data};\n var metadata = message.metadata || {comm_id};\n var msg = {content, metadata}\n msg_handler(msg);\n return messages.next().then(processIteratorResult);\n }\n return messages.next().then(processIteratorResult);\n }\n }) \n var sendClosure = (data, metadata, buffers, disposeOnDone) => {\n return comm_promise.then((comm) => {\n comm.send(data, metadata, buffers, disposeOnDone);\n });\n };\n var comm = {\n send: sendClosure\n };\n }\n window.PyViz.comms[comm_id] = comm;\n return comm;\n }\n window.PyViz.comm_manager = new JupyterCommManager();\n \n\n\nvar JS_MIME_TYPE = 'application/javascript';\nvar HTML_MIME_TYPE = 'text/html';\nvar EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\nvar CLASS_NAME = 'output';\n\n/**\n * Render data to the DOM node\n */\nfunction render(props, node) {\n var div = document.createElement(\"div\");\n var script = document.createElement(\"script\");\n node.appendChild(div);\n node.appendChild(script);\n}\n\n/**\n * Handle when a new output is added\n */\nfunction handle_add_output(event, handle) {\n var output_area = handle.output_area;\n var output = handle.output;\n if ((output.data == undefined) || (!output.data.hasOwnProperty(EXEC_MIME_TYPE))) {\n return\n }\n var id = output.metadata[EXEC_MIME_TYPE][\"id\"];\n var toinsert = output_area.element.find(\".\" + CLASS_NAME.split(' ')[0]);\n if (id !== undefined) {\n var nchildren = toinsert.length;\n var html_node = toinsert[nchildren-1].children[0];\n html_node.innerHTML = output.data[HTML_MIME_TYPE];\n var scripts = [];\n var nodelist = html_node.querySelectorAll(\"script\");\n for (var i in nodelist) {\n if (nodelist.hasOwnProperty(i)) {\n scripts.push(nodelist[i])\n }\n }\n\n scripts.forEach( function (oldScript) {\n var newScript = document.createElement(\"script\");\n var attrs = [];\n var nodemap = oldScript.attributes;\n for (var j in nodemap) {\n if (nodemap.hasOwnProperty(j)) {\n attrs.push(nodemap[j])\n }\n }\n attrs.forEach(function(attr) { newScript.setAttribute(attr.name, attr.value) });\n newScript.appendChild(document.createTextNode(oldScript.innerHTML));\n oldScript.parentNode.replaceChild(newScript, oldScript);\n });\n if (JS_MIME_TYPE in output.data) {\n toinsert[nchildren-1].children[1].textContent = output.data[JS_MIME_TYPE];\n }\n output_area._hv_plot_id = id;\n if ((window.Bokeh !== undefined) && (id in Bokeh.index)) {\n window.PyViz.plot_index[id] = Bokeh.index[id];\n } else {\n window.PyViz.plot_index[id] = null;\n }\n } else if (output.metadata[EXEC_MIME_TYPE][\"server_id\"] !== undefined) {\n var bk_div = document.createElement(\"div\");\n bk_div.innerHTML = output.data[HTML_MIME_TYPE];\n var script_attrs = bk_div.children[0].attributes;\n for (var i = 0; i < script_attrs.length; i++) {\n toinsert[toinsert.length - 1].childNodes[1].setAttribute(script_attrs[i].name, script_attrs[i].value);\n }\n // store reference to server id on output_area\n output_area._bokeh_server_id = output.metadata[EXEC_MIME_TYPE][\"server_id\"];\n }\n}\n\n/**\n * Handle when an output is cleared or removed\n */\nfunction handle_clear_output(event, handle) {\n var id = handle.cell.output_area._hv_plot_id;\n var server_id = handle.cell.output_area._bokeh_server_id;\n if (((id === undefined) || !(id in PyViz.plot_index)) && (server_id !== undefined)) { return; }\n var comm = window.PyViz.comm_manager.get_client_comm(\"hv-extension-comm\", \"hv-extension-comm\", function () {});\n if (server_id !== null) {\n comm.send({event_type: 'server_delete', 'id': server_id});\n return;\n } else if (comm !== null) {\n comm.send({event_type: 'delete', 'id': id});\n }\n delete PyViz.plot_index[id];\n if ((window.Bokeh !== undefined) & (id in window.Bokeh.index)) {\n var doc = window.Bokeh.index[id].model.document\n doc.clear();\n const i = window.Bokeh.documents.indexOf(doc);\n if (i > -1) {\n window.Bokeh.documents.splice(i, 1);\n }\n }\n}\n\n/**\n * Handle kernel restart event\n */\nfunction handle_kernel_cleanup(event, handle) {\n delete PyViz.comms[\"hv-extension-comm\"];\n window.PyViz.plot_index = {}\n}\n\n/**\n * Handle update_display_data messages\n */\nfunction handle_update_output(event, handle) {\n handle_clear_output(event, {cell: {output_area: handle.output_area}})\n handle_add_output(event, handle)\n}\n\nfunction register_renderer(events, OutputArea) {\n function append_mime(data, metadata, element) {\n // create a DOM node to render to\n var toinsert = this.create_output_subarea(\n metadata,\n CLASS_NAME,\n EXEC_MIME_TYPE\n );\n this.keyboard_manager.register_events(toinsert);\n // Render to node\n var props = {data: data, metadata: metadata[EXEC_MIME_TYPE]};\n render(props, toinsert[0]);\n element.append(toinsert);\n return toinsert\n }\n\n events.on('output_added.OutputArea', handle_add_output);\n events.on('output_updated.OutputArea', handle_update_output);\n events.on('clear_output.CodeCell', handle_clear_output);\n events.on('delete.Cell', handle_clear_output);\n events.on('kernel_ready.Kernel', handle_kernel_cleanup);\n\n OutputArea.prototype.register_mime_type(EXEC_MIME_TYPE, append_mime, {\n safe: true,\n index: 0\n });\n}\n\nif (window.Jupyter !== undefined) {\n try {\n var events = require('base/js/events');\n var OutputArea = require('notebook/js/outputarea').OutputArea;\n if (OutputArea.prototype.mime_types().indexOf(EXEC_MIME_TYPE) == -1) {\n register_renderer(events, OutputArea);\n }\n } catch(err) {\n }\n}\n",
- "application/vnd.holoviews_load.v0+json": ""
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"import requests\n",
"import pandas as pd\n",
@@ -184,6 +12,8 @@
"import json\n",
"import io\n",
"import holoviews as hv\n",
+ "import geoviews as gv\n",
+ "import numpy as np\n",
"import geopandas as gp\n",
"import searvey\n",
"from dateutil.relativedelta import *\n",
@@ -195,246 +25,7 @@
"cell_type": "code",
"execution_count": 2,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "[{'Id': 38,\n",
- " 'Name': 'BIG',\n",
- " 'Color': '19, 157, 55',\n",
- " 'DevicesCount': 10,\n",
- " 'Devices': None},\n",
- " {'Id': 3,\n",
- " 'Name': 'BOM',\n",
- " 'Color': '0, 0, 255',\n",
- " 'DevicesCount': 3,\n",
- " 'Devices': None},\n",
- " {'Id': 2,\n",
- " 'Name': 'DART Pacific',\n",
- " 'Color': '255, 0, 0',\n",
- " 'DevicesCount': 72,\n",
- " 'Devices': None},\n",
- " {'Id': 34,\n",
- " 'Name': 'DMI',\n",
- " 'Color': '0, 0, 200',\n",
- " 'DevicesCount': 1,\n",
- " 'Devices': None},\n",
- " {'Id': 31,\n",
- " 'Name': 'FMI',\n",
- " 'Color': '22, 133, 88',\n",
- " 'DevicesCount': 1,\n",
- " 'Devices': None},\n",
- " {'Id': 24,\n",
- " 'Name': 'Greece',\n",
- " 'Color': '0, 0, 128',\n",
- " 'DevicesCount': 12,\n",
- " 'Devices': None},\n",
- " {'Id': 32,\n",
- " 'Name': 'Ign',\n",
- " 'Color': '0, 128, 255',\n",
- " 'DevicesCount': 10,\n",
- " 'Devices': None},\n",
- " {'Id': 20,\n",
- " 'Name': 'ISPRA',\n",
- " 'Color': '0, 255, 120',\n",
- " 'DevicesCount': 40,\n",
- " 'Devices': None},\n",
- " {'Id': 29,\n",
- " 'Name': 'LNEC',\n",
- " 'Color': '128, 29, 49',\n",
- " 'DevicesCount': 10,\n",
- " 'Devices': None},\n",
- " {'Id': 27,\n",
- " 'Name': 'NL',\n",
- " 'Color': '255, 201, 14',\n",
- " 'DevicesCount': 3,\n",
- " 'Devices': None},\n",
- " {'Id': 35,\n",
- " 'Name': 'NOAA',\n",
- " 'Color': '0, 0, 255',\n",
- " 'DevicesCount': 318,\n",
- " 'Devices': None},\n",
- " {'Id': 5,\n",
- " 'Name': 'PT TD',\n",
- " 'Color': '0, 255, 0',\n",
- " 'DevicesCount': 4,\n",
- " 'Devices': None},\n",
- " {'Id': 14,\n",
- " 'Name': 'Setubal',\n",
- " 'Color': '0, 0, 244',\n",
- " 'DevicesCount': 4,\n",
- " 'Devices': None},\n",
- " {'Id': 8,\n",
- " 'Name': 'TAD',\n",
- " 'Color': '0, 0, 128',\n",
- " 'DevicesCount': 12,\n",
- " 'Devices': None},\n",
- " {'Id': 6,\n",
- " 'Name': 'TD UNESCO',\n",
- " 'Color': '255, 128, 0',\n",
- " 'DevicesCount': 667,\n",
- " 'Devices': None},\n",
- " {'Id': 21,\n",
- " 'Name': 'UNIFI',\n",
- " 'Color': '80, 255, 167',\n",
- " 'DevicesCount': 2,\n",
- " 'Devices': None}]"
- ]
- },
- "execution_count": 2,
- "metadata": {},
- "output_type": "execute_result"
- },
- {
- "data": {
- "text/plain": [
- "[{'Id': 13,\n",
- " 'Name': 'CNRS',\n",
- " 'Color': '12, 80, 255',\n",
- " 'DevicesCount': 1,\n",
- " 'Devices': None},\n",
- " {'Id': 7,\n",
- " 'Name': 'FCUL',\n",
- " 'Color': '0, 255, 0',\n",
- " 'DevicesCount': 2,\n",
- " 'Devices': None},\n",
- " {'Id': 11,\n",
- " 'Name': 'IDSL',\n",
- " 'Color': '0, 101, 162',\n",
- " 'DevicesCount': 66,\n",
- " 'Devices': None},\n",
- " {'Id': 17,\n",
- " 'Name': 'IDSL-GPS',\n",
- " 'Color': '255, 255, 100',\n",
- " 'DevicesCount': 5,\n",
- " 'Devices': None},\n",
- " {'Id': 19,\n",
- " 'Name': 'Indonesia',\n",
- " 'Color': '210, 9, 80',\n",
- " 'DevicesCount': 49,\n",
- " 'Devices': None},\n",
- " {'Id': 110,\n",
- " 'Name': 'IOLR',\n",
- " 'Color': '255, 255, 255',\n",
- " 'DevicesCount': 2,\n",
- " 'Devices': None},\n",
- " {'Id': 10,\n",
- " 'Name': 'IPMA_FREE',\n",
- " 'Color': '228, 37, 24',\n",
- " 'DevicesCount': 2,\n",
- " 'Devices': None},\n",
- " {'Id': 4,\n",
- " 'Name': 'ISPRA',\n",
- " 'Color': '0, 96, 29',\n",
- " 'DevicesCount': 35,\n",
- " 'Devices': None},\n",
- " {'Id': 104,\n",
- " 'Name': 'ISPRA_GL',\n",
- " 'Color': '',\n",
- " 'DevicesCount': 17,\n",
- " 'Devices': None},\n",
- " {'Id': 106,\n",
- " 'Name': 'ISPRA_NF',\n",
- " 'Color': '',\n",
- " 'DevicesCount': 35,\n",
- " 'Devices': None},\n",
- " {'Id': 5,\n",
- " 'Name': 'JRC',\n",
- " 'Color': '0, 0, 255',\n",
- " 'DevicesCount': 5,\n",
- " 'Devices': None},\n",
- " {'Id': 1,\n",
- " 'Name': 'JRCTAD',\n",
- " 'Color': '0, 0, 244',\n",
- " 'DevicesCount': 26,\n",
- " 'Devices': None},\n",
- " {'Id': 18,\n",
- " 'Name': 'MALTA',\n",
- " 'Color': '210, 9, 80',\n",
- " 'DevicesCount': 8,\n",
- " 'Devices': None},\n",
- " {'Id': 8,\n",
- " 'Name': 'MAR',\n",
- " 'Color': '0, 12, 25',\n",
- " 'DevicesCount': 2,\n",
- " 'Devices': None},\n",
- " {'Id': 2,\n",
- " 'Name': 'NOA',\n",
- " 'Color': '13, 94, 175',\n",
- " 'DevicesCount': 22,\n",
- " 'Devices': None},\n",
- " {'Id': 16,\n",
- " 'Name': 'RIVER-AIPO',\n",
- " 'Color': '0, 100, 199',\n",
- " 'DevicesCount': 9,\n",
- " 'Devices': None},\n",
- " {'Id': 14,\n",
- " 'Name': 'RIVER-IDSL',\n",
- " 'Color': '0, 200, 150',\n",
- " 'DevicesCount': 1,\n",
- " 'Devices': None},\n",
- " {'Id': 15,\n",
- " 'Name': 'RIVER-MM',\n",
- " 'Color': '0, 200, 8',\n",
- " 'DevicesCount': 4,\n",
- " 'Devices': None},\n",
- " {'Id': 21,\n",
- " 'Name': 'SEISMO',\n",
- " 'Color': '153, 109, 92',\n",
- " 'DevicesCount': 14,\n",
- " 'Devices': None},\n",
- " {'Id': 12,\n",
- " 'Name': 'SENTEZ',\n",
- " 'Color': '80, 13, 25',\n",
- " 'DevicesCount': 1,\n",
- " 'Devices': None},\n",
- " {'Id': 9,\n",
- " 'Name': 'Test',\n",
- " 'Color': '0, 255, 120',\n",
- " 'DevicesCount': 15,\n",
- " 'Devices': None},\n",
- " {'Id': 103,\n",
- " 'Name': 'TR',\n",
- " 'Color': '255, 0, 0',\n",
- " 'DevicesCount': 17,\n",
- " 'Devices': None},\n",
- " {'Id': 6,\n",
- " 'Name': 'UNIFI',\n",
- " 'Color': '80, 255, 167',\n",
- " 'DevicesCount': 2,\n",
- " 'Devices': None},\n",
- " {'Id': 20,\n",
- " 'Name': 'X_BOM',\n",
- " 'Color': '0, 0, 255',\n",
- " 'DevicesCount': 24,\n",
- " 'Devices': None},\n",
- " {'Id': 109,\n",
- " 'Name': 'X_DART',\n",
- " 'Color': '255, 0, 0',\n",
- " 'DevicesCount': 66,\n",
- " 'Devices': None},\n",
- " {'Id': 108,\n",
- " 'Name': 'X_GLOSS',\n",
- " 'Color': '0, 0, 128',\n",
- " 'DevicesCount': 1268,\n",
- " 'Devices': None},\n",
- " {'Id': 101,\n",
- " 'Name': 'X_India',\n",
- " 'Color': '0, 240, 0',\n",
- " 'DevicesCount': 36,\n",
- " 'Devices': None},\n",
- " {'Id': 102,\n",
- " 'Name': 'X_NOAA',\n",
- " 'Color': '0, 0, 240',\n",
- " 'DevicesCount': 239,\n",
- " 'Devices': None}]"
- ]
- },
- "execution_count": 2,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# Define the base URL for the API\n",
"sl_api = \"https://webcritech.jrc.ec.europa.eu/SeaLevelsDb/api/Group/\"\n",
@@ -446,405 +37,28 @@
"sl_response = requests.get(sl_api)\n",
"tad_response = requests.get(tad_api)\n",
"sl_data = json.loads(sl_response.text) # Parse the JSON response\n",
- "tad_data = json.loads(tad_response.text) # Parse the JSON response\n",
- "sl_data;tad_data"
+ "tad_data = json.loads(tad_response.text) # Parse the JSON response"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Data availability"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "SeaLevelDB stations"
+ "### SeaLevelDB stations"
]
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "
\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " Provider | \n",
- " Id | \n",
- " Name | \n",
- " lat | \n",
- " lon | \n",
- " LastAccessStatus | \n",
- " LastDate | \n",
- " State | \n",
- " SyncStatus | \n",
- " FileType | \n",
- " GroupId | \n",
- " MovAvgNp | \n",
- " Notes | \n",
- " Source | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " BIG | \n",
- " 2896 | \n",
- " Indonesia - Tolitoli (Central Sulawesi) | \n",
- " 1.050620 | \n",
- " 120.800049 | \n",
- " ERR: NO DATA TYPE | \n",
- " 2020-01-23T15:10:00Z | \n",
- " active | \n",
- " ready | \n",
- " BIG | \n",
- " 38 | \n",
- " 2 | \n",
- " None | \n",
- " http://tides.big.go.id:8888/kacrut/0051TLTL02/... | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " BIG | \n",
- " 2897 | \n",
- " Indonesia - Mamuju (Western Sulawesi) | \n",
- " -2.666982 | \n",
- " 118.893349 | \n",
- " ERR: NO DATA TYPE | \n",
- " 2020-01-23T15:20:00Z | \n",
- " active | \n",
- " ready | \n",
- " BIG | \n",
- " 38 | \n",
- " 2 | \n",
- " None | \n",
- " http://tides.big.go.id:8888/kacrut/0009MMJU02/... | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " BIG | \n",
- " 2898 | \n",
- " Indonesia - Pantolan (Western Sulawesi) | \n",
- " -0.711140 | \n",
- " 119.856155 | \n",
- " ERR: NO DATA TYPE | \n",
- " 2020-01-23T15:20:00Z | \n",
- " active | \n",
- " ready | \n",
- " BIG | \n",
- " 38 | \n",
- " 2 | \n",
- " None | \n",
- " http://tides.big.go.id:8888/kacrut/0036PTLN02/... | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " BIG | \n",
- " 2899 | \n",
- " Indonesia - Kota Agung (Lampung) | \n",
- " -5.500444 | \n",
- " 104.619362 | \n",
- " ERR: NO DATA TYPE | \n",
- " 2020-01-23T15:20:00Z | \n",
- " active | \n",
- " ready | \n",
- " BIG | \n",
- " 38 | \n",
- " 2 | \n",
- " None | \n",
- " http://tides.big.go.id:8888/kacrut/0080KTAG01/... | \n",
- "
\n",
- " \n",
- " 4 | \n",
- " BIG | \n",
- " 2900 | \n",
- " Indonesia - Krui (Lampung) | \n",
- " -5.183500 | \n",
- " 103.933052 | \n",
- " ERR: NO DATA TYPE | \n",
- " 2020-01-23T15:20:00Z | \n",
- " active | \n",
- " ready | \n",
- " BIG | \n",
- " 38 | \n",
- " 2 | \n",
- " None | \n",
- " http://tides.big.go.id:8888/kacrut/0100KRUI01/... | \n",
- "
\n",
- " \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- "
\n",
- " \n",
- " 1313 | \n",
- " TD UNESCO | \n",
- " 2569 | \n",
- " Ireland - New Ballyglass pier Belmullet | \n",
- " 54.252998 | \n",
- " -9.890000 | \n",
- " OK | \n",
- " 2024-09-17T23:30:00Z | \n",
- " active | \n",
- " ready | \n",
- " GLOSSxml | \n",
- " 6 | \n",
- " 2 | \n",
- " None | \n",
- " http://www.ioc-sealevelmonitoring.org/service.... | \n",
- "
\n",
- " \n",
- " 1314 | \n",
- " TD UNESCO | \n",
- " 2915 | \n",
- " Philippines - Currimao_Prs | \n",
- " 18.017000 | \n",
- " 120.483002 | \n",
- " OK | \n",
- " 2024-09-11T12:43:00Z | \n",
- " active | \n",
- " ready | \n",
- " GLOSSxml | \n",
- " 6 | \n",
- " 2 | \n",
- " None | \n",
- " http://www.ioc-sealevelmonitoring.org/service.... | \n",
- "
\n",
- " \n",
- " 1315 | \n",
- " UNIFI | \n",
- " 1872 | \n",
- " Italy - Stromboli Sciara del Fuoco (1min) | \n",
- " 38.798401 | \n",
- " 15.193100 | \n",
- " OK | \n",
- " 2013-01-14T14:28:47Z | \n",
- " active | \n",
- " None | \n",
- " UNIFI | \n",
- " 21 | \n",
- " -1 | \n",
- " None | \n",
- " http://webcritech.jrc.ec.europa.eu/modelling/S... | \n",
- "
\n",
- " \n",
- " 1316 | \n",
- " UNIFI | \n",
- " 1873 | \n",
- " Italy - Stromboli Sciara del Fuoco (15 sec) | \n",
- " 38.798401 | \n",
- " 15.193100 | \n",
- " OK | \n",
- " 2014-04-26T13:29:45Z | \n",
- " active | \n",
- " None | \n",
- " TAD_T | \n",
- " 21 | \n",
- " -1 | \n",
- " None | \n",
- " http://webcritech.jrc.ec.europa.eu/tad_server/... | \n",
- "
\n",
- " \n",
- " 1317 | \n",
- " UNIFI | \n",
- " 1874 | \n",
- " Italy - Stromboli Sciara del Fuoco (5 sec) | \n",
- " 38.798401 | \n",
- " 15.193100 | \n",
- " OK | \n",
- " 2013-01-14T14:29:36Z | \n",
- " inactive | \n",
- " None | \n",
- " UNIFI | \n",
- " 21 | \n",
- " -1 | \n",
- " None | \n",
- " http://webcritech.jrc.ec.europa.eu/modelling/S... | \n",
- "
\n",
- " \n",
- "
\n",
- "
1318 rows × 14 columns
\n",
- "
"
- ],
- "text/plain": [
- " Provider Id Name lat \\\n",
- "0 BIG 2896 Indonesia - Tolitoli (Central Sulawesi) 1.050620 \n",
- "1 BIG 2897 Indonesia - Mamuju (Western Sulawesi) -2.666982 \n",
- "2 BIG 2898 Indonesia - Pantolan (Western Sulawesi) -0.711140 \n",
- "3 BIG 2899 Indonesia - Kota Agung (Lampung) -5.500444 \n",
- "4 BIG 2900 Indonesia - Krui (Lampung) -5.183500 \n",
- "... ... ... ... ... \n",
- "1313 TD UNESCO 2569 Ireland - New Ballyglass pier Belmullet 54.252998 \n",
- "1314 TD UNESCO 2915 Philippines - Currimao_Prs 18.017000 \n",
- "1315 UNIFI 1872 Italy - Stromboli Sciara del Fuoco (1min) 38.798401 \n",
- "1316 UNIFI 1873 Italy - Stromboli Sciara del Fuoco (15 sec) 38.798401 \n",
- "1317 UNIFI 1874 Italy - Stromboli Sciara del Fuoco (5 sec) 38.798401 \n",
- "\n",
- " lon LastAccessStatus LastDate State \\\n",
- "0 120.800049 ERR: NO DATA TYPE 2020-01-23T15:10:00Z active \n",
- "1 118.893349 ERR: NO DATA TYPE 2020-01-23T15:20:00Z active \n",
- "2 119.856155 ERR: NO DATA TYPE 2020-01-23T15:20:00Z active \n",
- "3 104.619362 ERR: NO DATA TYPE 2020-01-23T15:20:00Z active \n",
- "4 103.933052 ERR: NO DATA TYPE 2020-01-23T15:20:00Z active \n",
- "... ... ... ... ... \n",
- "1313 -9.890000 OK 2024-09-17T23:30:00Z active \n",
- "1314 120.483002 OK 2024-09-11T12:43:00Z active \n",
- "1315 15.193100 OK 2013-01-14T14:28:47Z active \n",
- "1316 15.193100 OK 2014-04-26T13:29:45Z active \n",
- "1317 15.193100 OK 2013-01-14T14:29:36Z inactive \n",
- "\n",
- " SyncStatus FileType GroupId MovAvgNp Notes \\\n",
- "0 ready BIG 38 2 None \n",
- "1 ready BIG 38 2 None \n",
- "2 ready BIG 38 2 None \n",
- "3 ready BIG 38 2 None \n",
- "4 ready BIG 38 2 None \n",
- "... ... ... ... ... ... \n",
- "1313 ready GLOSSxml 6 2 None \n",
- "1314 ready GLOSSxml 6 2 None \n",
- "1315 None UNIFI 21 -1 None \n",
- "1316 None TAD_T 21 -1 None \n",
- "1317 None UNIFI 21 -1 None \n",
- "\n",
- " Source \n",
- "0 http://tides.big.go.id:8888/kacrut/0051TLTL02/... \n",
- "1 http://tides.big.go.id:8888/kacrut/0009MMJU02/... \n",
- "2 http://tides.big.go.id:8888/kacrut/0036PTLN02/... \n",
- "3 http://tides.big.go.id:8888/kacrut/0080KTAG01/... \n",
- "4 http://tides.big.go.id:8888/kacrut/0100KRUI01/... \n",
- "... ... \n",
- "1313 http://www.ioc-sealevelmonitoring.org/service.... \n",
- "1314 http://www.ioc-sealevelmonitoring.org/service.... \n",
- "1315 http://webcritech.jrc.ec.europa.eu/modelling/S... \n",
- "1316 http://webcritech.jrc.ec.europa.eu/tad_server/... \n",
- "1317 http://webcritech.jrc.ec.europa.eu/modelling/S... \n",
- "\n",
- "[1318 rows x 14 columns]"
- ]
- },
- "execution_count": 3,
- "metadata": {},
- "output_type": "execute_result"
- },
- {
- "data": {},
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.holoviews_exec.v0+json": "",
- "text/html": [
- "
\n",
- ""
- ],
- "text/plain": [
- ":Bars [Provider,State] (Id)"
- ]
- },
- "execution_count": 3,
- "metadata": {
- "application/vnd.holoviews_exec.v0+json": {
- "id": "p1004"
- }
- },
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# Initialize a list to hold all station data\n",
"SL_data = []\n",
@@ -865,6 +79,7 @@
" 'lon': device['Lon'],\n",
" 'LastAccessStatus': device['CurrentStatus']['LastAccessStatus'],\n",
" 'LastDate': device['CurrentStatus']['LastDate'],\n",
+ " 'LastDate': device['CurrentStatus']['LastDate'],\n",
" 'State': device['CurrentStatus']['State'],\n",
" 'SyncStatus': device['CurrentStatus']['SyncStatus'],\n",
" 'FileType': device['FileType'],\n",
@@ -899,379 +114,9 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "
\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " Provider | \n",
- " Id | \n",
- " Name | \n",
- " lat | \n",
- " lon | \n",
- " LastAccessStatus | \n",
- " LastDate | \n",
- " SyncStatus | \n",
- " State | \n",
- " FileType | \n",
- " GroupId | \n",
- " MovAvgNp | \n",
- " Notes | \n",
- " Source | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " JRC-ISPRA | \n",
- " 64 | \n",
- " IDSL-01 | \n",
- " 43.878340 | \n",
- " 8.018800 | \n",
- " 30 Jun 2023 13:01:02 | \n",
- " 2023-06-30 13:01:02 | \n",
- " 445 Days | \n",
- " inactive | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " JRC-IGN | \n",
- " 79 | \n",
- " IDSL-06 | \n",
- " 36.542140 | \n",
- " -6.280612 | \n",
- " 17 Sep 2024 22:57:58 | \n",
- " 2024-09-17 22:57:58 | \n",
- " 8 Hours | \n",
- " active | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " JRC-IGN | \n",
- " 80 | \n",
- " IDSL-07 | \n",
- " 37.567146 | \n",
- " -0.978958 | \n",
- " 18 Sep 2024 07:02:09 | \n",
- " 2024-09-18 07:02:09 | \n",
- " 26 Min. | \n",
- " active | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " JRC-NOA | \n",
- " 86 | \n",
- " IDSL-13 | \n",
- " 37.942535 | \n",
- " 22.933611 | \n",
- " 18 Sep 2024 07:28:22 | \n",
- " 2024-09-18 07:28:22 | \n",
- " 7 Sec. | \n",
- " active | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- "
\n",
- " \n",
- " 4 | \n",
- " JRC-KOERI | \n",
- " 87 | \n",
- " IDSL-14 | \n",
- " 39.835741 | \n",
- " 26.075859 | \n",
- " 06 Dec 2023 13:40:02 | \n",
- " 2023-12-06 13:40:02 | \n",
- " 286 Days | \n",
- " inactive | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- "
\n",
- " \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- "
\n",
- " \n",
- " 1084 | \n",
- " NOAA | \n",
- " 313 | \n",
- " NOAA-Wilmington | \n",
- " 34.227500 | \n",
- " -77.953611 | \n",
- " 29 Jan 2024 06:00:00 | \n",
- " 2024-01-29 06:00:00 | \n",
- " 233 Days | \n",
- " inactive | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- "
\n",
- " \n",
- " 1085 | \n",
- " NOAA | \n",
- " 265 | \n",
- " NOAA-Woods_Hole | \n",
- " 41.523613 | \n",
- " -70.671112 | \n",
- " 29 Jan 2024 06:00:00 | \n",
- " 2024-01-29 06:00:00 | \n",
- " 233 Days | \n",
- " inactive | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- "
\n",
- " \n",
- " 1086 | \n",
- " NOAA | \n",
- " 314 | \n",
- " NOAA-Wrightsville_Beach | \n",
- " 34.213333 | \n",
- " -77.786667 | \n",
- " 29 Jan 2024 06:00:00 | \n",
- " 2024-01-29 06:00:00 | \n",
- " 233 Days | \n",
- " inactive | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- "
\n",
- " \n",
- " 1087 | \n",
- " NOAA | \n",
- " 447 | \n",
- " NOAA-Yakutat | \n",
- " 59.548333 | \n",
- " -139.733056 | \n",
- " 29 Jan 2024 06:00:00 | \n",
- " 2024-01-29 06:00:00 | \n",
- " 233 Days | \n",
- " inactive | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- "
\n",
- " \n",
- " 1088 | \n",
- " NOAA | \n",
- " 305 | \n",
- " NOAA-Yorktown_USCG_Training_Center | \n",
- " 37.226500 | \n",
- " -76.478800 | \n",
- " 29 Jan 2024 06:00:00 | \n",
- " 2024-01-29 06:00:00 | \n",
- " 233 Days | \n",
- " inactive | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- " None | \n",
- "
\n",
- " \n",
- "
\n",
- "
1089 rows × 14 columns
\n",
- "
"
- ],
- "text/plain": [
- " Provider Id Name lat \\\n",
- "0 JRC-ISPRA 64 IDSL-01 43.878340 \n",
- "1 JRC-IGN 79 IDSL-06 36.542140 \n",
- "2 JRC-IGN 80 IDSL-07 37.567146 \n",
- "3 JRC-NOA 86 IDSL-13 37.942535 \n",
- "4 JRC-KOERI 87 IDSL-14 39.835741 \n",
- "... ... ... ... ... \n",
- "1084 NOAA 313 NOAA-Wilmington 34.227500 \n",
- "1085 NOAA 265 NOAA-Woods_Hole 41.523613 \n",
- "1086 NOAA 314 NOAA-Wrightsville_Beach 34.213333 \n",
- "1087 NOAA 447 NOAA-Yakutat 59.548333 \n",
- "1088 NOAA 305 NOAA-Yorktown_USCG_Training_Center 37.226500 \n",
- "\n",
- " lon LastAccessStatus LastDate SyncStatus \\\n",
- "0 8.018800 30 Jun 2023 13:01:02 2023-06-30 13:01:02 445 Days \n",
- "1 -6.280612 17 Sep 2024 22:57:58 2024-09-17 22:57:58 8 Hours \n",
- "2 -0.978958 18 Sep 2024 07:02:09 2024-09-18 07:02:09 26 Min. \n",
- "3 22.933611 18 Sep 2024 07:28:22 2024-09-18 07:28:22 7 Sec. \n",
- "4 26.075859 06 Dec 2023 13:40:02 2023-12-06 13:40:02 286 Days \n",
- "... ... ... ... ... \n",
- "1084 -77.953611 29 Jan 2024 06:00:00 2024-01-29 06:00:00 233 Days \n",
- "1085 -70.671112 29 Jan 2024 06:00:00 2024-01-29 06:00:00 233 Days \n",
- "1086 -77.786667 29 Jan 2024 06:00:00 2024-01-29 06:00:00 233 Days \n",
- "1087 -139.733056 29 Jan 2024 06:00:00 2024-01-29 06:00:00 233 Days \n",
- "1088 -76.478800 29 Jan 2024 06:00:00 2024-01-29 06:00:00 233 Days \n",
- "\n",
- " State FileType GroupId MovAvgNp Notes Source \n",
- "0 inactive None None None None None \n",
- "1 active None None None None None \n",
- "2 active None None None None None \n",
- "3 active None None None None None \n",
- "4 inactive None None None None None \n",
- "... ... ... ... ... ... ... \n",
- "1084 inactive None None None None None \n",
- "1085 inactive None None None None None \n",
- "1086 inactive None None None None None \n",
- "1087 inactive None None None None None \n",
- "1088 inactive None None None None None \n",
- "\n",
- "[1089 rows x 14 columns]"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- },
- {
- "data": {},
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.holoviews_exec.v0+json": "",
- "text/html": [
- "
\n",
- ""
- ],
- "text/plain": [
- ":Bars [Provider,State] (Id)"
- ]
- },
- "execution_count": 4,
- "metadata": {
- "application/vnd.holoviews_exec.v0+json": {
- "id": "p1069"
- }
- },
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"TAD_data = []\n",
"# Loop through the list of providers and fetch their stations\n",
@@ -1338,30 +183,7 @@
"cell_type": "code",
"execution_count": 5,
"metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "/tmp/ipykernel_7728/3890792909.py:44: FutureWarning: ChainedAssignmentError: behaviour will change in pandas 3.0!\n",
- "You are setting values through chained assignment. Currently this works in certain cases, but when using Copy-on-Write (which will become the default behaviour in pandas 3.0) this will never work to update the original DataFrame or Series, because the intermediate object on which we are setting values will behave as a copy.\n",
- "A typical example is when you are setting values in a column of a DataFrame, like:\n",
- "\n",
- "df[\"col\"][row_indexer] = value\n",
- "\n",
- "Use `df.loc[row_indexer, \"col\"] = values` instead, to perform the assignment in a single step and ensure this keeps updating the original `df`.\n",
- "\n",
- "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
- "\n",
- " stations['source'][~stations.ioc_code.isna()] = \"ioc\"\n",
- "/tmp/ipykernel_7728/3890792909.py:44: SettingWithCopyWarning: \n",
- "A value is trying to be set on a copy of a slice from a DataFrame\n",
- "\n",
- "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
- " stations['source'][~stations.ioc_code.isna()] = \"ioc\"\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"def get_stofs2d_meta():\n",
" stofs2d = pd.read_csv(\n",
@@ -1396,17 +218,28 @@
" )\n",
" return merged\n",
"\n",
- "def merge_ioc_and_stofs(ioc: pd.DataFrame, stofs2d: pd.DataFrame) -> pd.DataFrame:\n",
+ "def get_coops_meta() -> gp.GeoDataFrame: \n",
+ " coops = searvey.get_coops_stations()\n",
+ " coops['lon'] = coops['geometry'].x\n",
+ " coops['lat'] = coops['geometry'].y\n",
+ " coops = coops.drop(columns='geometry')\n",
+ " return coops\n",
+ "\n",
+ "def merge_ioc_and_stofs(ioc: pd.DataFrame, stofs2d: pd.DataFrame, coops = pd.DataFrame) -> pd.DataFrame:\n",
" stations = pd.concat((ioc, stofs2d), ignore_index=True)\n",
" stations = stations.assign(unique_id=stations.ioc_code.combine_first(stations.stofs2d_name))\n",
+ " stations = pd.concat((stations, coops),ignore_index=True)\n",
+ " stations = stations.assign(unique_id=stations.unique_id.combine_first(stations.nws_id))\n",
" return stations\n",
"\n",
"ioc = get_ioc_meta()\n",
"stofs2d = get_stofs2d_meta()\n",
- "stations = merge_ioc_and_stofs(ioc=ioc, stofs2d=stofs2d)\n",
+ "coops = get_coops_meta()\n",
+ "stations = merge_ioc_and_stofs(ioc=ioc, stofs2d=stofs2d, coops = coops.drop(columns=\"removed\"))\n",
"stations['is_sat'] = stations.unique_id.str.contains('SA')\n",
"stations['source'] = \"stofs\"\n",
- "stations['source'][~stations.ioc_code.isna()] = \"ioc\""
+ "stations.loc[~stations.ioc_code.isna(), 'source'] = \"ioc\"\n",
+ "stations.loc[~stations.nws_id.isna(), 'source'] = \"coops\""
]
},
{
@@ -1418,132 +251,18 @@
},
{
"cell_type": "code",
- "execution_count": 34,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "/tmp/ipykernel_7728/3010135162.py:1: UserWarning: Boolean Series key will be reindexed to match DataFrame index.\n",
- " plot0 = stations.drop(columns='geometry')[~stations['is_sat']][stations.source == 'stofs'].hvplot.points(\n",
- "/tmp/ipykernel_7728/3010135162.py:9: UserWarning: Boolean Series key will be reindexed to match DataFrame index.\n",
- " plot1 = stations.drop(columns='geometry')[~stations['is_sat']][stations.source == 'ioc'].hvplot.points(\n"
- ]
- },
- {
- "data": {},
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.holoviews_exec.v0+json": "",
- "text/html": [
- "
\n",
- ""
- ],
- "text/plain": [
- ":Overlay\n",
- " .Points.I :Points [lon,lat]\n",
- " .Points.II :Points [lon,lat]\n",
- " .WMTS.I :WMTS [Longitude,Latitude]\n",
- " .Points.III :Points [lon,lat] (Provider)"
- ]
- },
- "execution_count": 34,
- "metadata": {
- "application/vnd.holoviews_exec.v0+json": {
- "id": "p3210"
- }
- },
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
- "plot0 = stations.drop(columns='geometry')[~stations['is_sat']][stations.source == 'stofs'].hvplot.points(\n",
+ "plot1 = stations.drop(columns='geometry')[~stations['is_sat']].hvplot.points(\n",
" x = 'lon',\n",
" y='lat',\n",
- " c = 'orange',\n",
- " s=100,\n",
- " line_color = 'white',\n",
- " geo = True,\n",
- ")\n",
- "plot1 = stations.drop(columns='geometry')[~stations['is_sat']][stations.source == 'ioc'].hvplot.points(\n",
- " x = 'lon',\n",
- " y='lat',\n",
- " c = 'r',\n",
- " s=100,\n",
- " line_color = 'white',\n",
+ " c = 'source',\n",
+ " cmap = 'fire',\n",
" geo = True,\n",
+ " s = 20,\n",
+ " legend = False\n",
")\n",
"plot2 = pd.concat([SL_df,TAD_df]).hvplot.points(\n",
" x = 'lon',\n",
@@ -1553,10 +272,11 @@
" line_width = 0.25,\n",
" cmap = 'glasbey',\n",
" geo = True,\n",
+ " s=150,\n",
" tiles=\"OSM\",\n",
")\n",
"\n",
- "(plot0 * plot1 * plot2).opts(\n",
+ "(plot2 * plot1).opts(\n",
" width = 1400,\n",
" height = 1070\n",
")"
@@ -1566,344 +286,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "Compare TD UNESCO with Seareport stations "
+ "Let's compare now with the data availability"
]
},
{
"cell_type": "code",
- "execution_count": 7,
- "metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "/tmp/ipykernel_7728/1822243853.py:1: UserWarning: Boolean Series key will be reindexed to match DataFrame index.\n",
- " plot0 = stations.drop(columns='geometry')[~stations['is_sat']][stations.source == 'stofs'].hvplot.points(\n",
- "/tmp/ipykernel_7728/1822243853.py:9: UserWarning: Boolean Series key will be reindexed to match DataFrame index.\n",
- " plot1 = stations.drop(columns='geometry')[~stations['is_sat']][stations.source == 'ioc'].hvplot.points(\n"
- ]
- },
- {
- "data": {},
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.holoviews_exec.v0+json": "",
- "text/html": [
- "
\n",
- ""
- ],
- "text/plain": [
- ":Overlay\n",
- " .Points.I :Points [lon,lat]\n",
- " .Points.II :Points [lon,lat]\n",
- " .WMTS.I :WMTS [Longitude,Latitude]\n",
- " .Points.III :Points [lon,lat] (Provider)"
- ]
- },
- "execution_count": 7,
- "metadata": {
- "application/vnd.holoviews_exec.v0+json": {
- "id": "p1341"
- }
- },
- "output_type": "execute_result"
- }
- ],
- "source": [
- "plot0 = stations.drop(columns='geometry')[~stations['is_sat']][stations.source == 'stofs'].hvplot.points(\n",
- " x = 'lon',\n",
- " y='lat',\n",
- " c = 'orange',\n",
- " s=100,\n",
- " line_color = 'white',\n",
- " geo = True,\n",
- ")\n",
- "plot1 = stations.drop(columns='geometry')[~stations['is_sat']][stations.source == 'ioc'].hvplot.points(\n",
- " x = 'lon',\n",
- " y='lat',\n",
- " c = 'r',\n",
- " s=100,\n",
- " line_color = 'white',\n",
- " geo = True,\n",
- ")\n",
- "plot2 = SL_df[SL_df.Provider.isin(['TD UNESCO'])].hvplot.points(\n",
- " x = 'lon',\n",
- " y='lat',\n",
- " c = 'Provider',\n",
- " line_color = 'k',\n",
- " cmap = 'glasbey',\n",
- " geo = True,\n",
- " tiles=\"OSM\",\n",
- ")\n",
- "\n",
- "(plot0 * plot1 * plot2).opts(\n",
- " width = 1400,\n",
- " height = 1070\n",
- ")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 79,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {},
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.holoviews_exec.v0+json": "",
- "text/html": [
- "
\n",
- ""
- ],
- "text/plain": [
- ":Histogram [LastDate] (Count)"
- ]
- },
- "execution_count": 79,
- "metadata": {
- "application/vnd.holoviews_exec.v0+json": {
- "id": "p8390"
- }
- },
- "output_type": "execute_result"
- },
- {
- "data": {},
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.holoviews_exec.v0+json": "",
- "text/html": [
- "
\n",
- ""
- ],
- "text/plain": [
- ":Histogram [LastDate] (Count)"
- ]
- },
- "execution_count": 79,
- "metadata": {
- "application/vnd.holoviews_exec.v0+json": {
- "id": "p8470"
- }
- },
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"SL_df['LastDate'] = SL_df.apply(lambda x:pd.Timestamp(x['LastDate']).tz_localize(None), axis = 1)\n",
"TAD_df['LastDate'] = TAD_df.apply(lambda x:pd.Timestamp(x['LastDate']).tz_localize(None), axis = 1)\n",
@@ -1915,102 +305,9 @@
},
{
"cell_type": "code",
- "execution_count": 81,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {},
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.holoviews_exec.v0+json": "",
- "text/html": [
- "
\n",
- ""
- ],
- "text/plain": [
- ":Histogram [period_inactive] (Count)"
- ]
- },
- "execution_count": 81,
- "metadata": {
- "application/vnd.holoviews_exec.v0+json": {
- "id": "p8618"
- }
- },
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"SL_df['period_inactive'] = SL_df.apply(lambda x:(pd.Timestamp.now() - pd.Timestamp(x['LastDate']).tz_localize(None)).total_seconds()/3600/24/365.25, axis = 1)\n",
"TAD_df['period_inactive'] = TAD_df.apply(lambda x:(pd.Timestamp.now() - pd.Timestamp(x['LastDate']).tz_localize(None)).total_seconds()/3600/24/365.25, axis = 1)\n",
@@ -2021,7 +318,7 @@
},
{
"cell_type": "code",
- "execution_count": 57,
+ "execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
@@ -2030,220 +327,39 @@
},
{
"cell_type": "code",
- "execution_count": 82,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {},
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.holoviews_exec.v0+json": "",
- "text/html": [
- "
\n",
- ""
- ],
- "text/plain": [
- ":Overlay\n",
- " .WMTS.I :WMTS [Longitude,Latitude]\n",
- " .Points.I :Points [lon,lat] (period_inactive)"
- ]
- },
- "execution_count": 82,
- "metadata": {
- "application/vnd.holoviews_exec.v0+json": {
- "id": "p8686"
- }
- },
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
- "SL_df.hvplot.points(\n",
+ "plot_3 = SL_df.hvplot.points(\n",
" x = 'lon',\n",
" y='lat',\n",
" c = 'period_inactive',\n",
- " line_color = \"k\",\n",
- " line_width = 0.25,\n",
- " cmap = 'fire_r',\n",
" s = 50,\n",
" geo = True,\n",
+ " cmap = 'fire_r',\n",
" tiles=\"OSM\",\n",
- ").opts(title = \"years inactive\", width = 1400, height=900)"
+ ").opts(height = 550, title = 'years inactive')\n",
+ "\n",
+ "((plot2 * plot1).opts(height=550, title = 'Provider') + plot_3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Finnish (FMI) and Indonesian stations (BIG) seem to be exclusive on WebCritech Server. \n",
+ "\n",
+ "Although they stopped recording data since January 2020. "
]
},
{
"cell_type": "code",
- "execution_count": 83,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {},
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.holoviews_exec.v0+json": "",
- "text/html": [
- "
\n",
- ""
- ],
- "text/plain": [
- ":Overlay\n",
- " .WMTS.I :WMTS [Longitude,Latitude]\n",
- " .Points.I :Points [lon,lat] (period_inactive)"
- ]
- },
- "execution_count": 83,
- "metadata": {
- "application/vnd.holoviews_exec.v0+json": {
- "id": "p8809"
- }
- },
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
- "TAD_df.hvplot.points(\n",
+ "plot_4 = TAD_df.hvplot.points(\n",
" x = 'lon',\n",
" y='lat',\n",
" c = 'period_inactive',\n",
@@ -2253,21 +369,67 @@
" s = 50,\n",
" geo = True,\n",
" tiles=\"OSM\",\n",
- ").opts(title = \"years inactive\", width = 1400, height=900)"
+ ").opts(title = \"years inactive\",height=550)\n",
+ "\n",
+ "((plot2 * plot1).opts(height=550, title = 'Provider') + plot_4)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "Lots of station seem to have stopped in January 2024"
+ "Most of TAD stations seem to have stopped recording in January 2024\n",
+ "\n",
+ "India (INCOIS) station seem to be exclusive on WebCritech server"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "### get data (not finished yet)"
+ "### Get Station detailed metadata (NOT FINISHED)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "we'd need to get the First Date information, which can be retrieve by scrapping the website: at the URL `https://webcritech.jrc.ec.europa.eu/SeaLevelsDb/Device/1014` (the device number is the `Provider` column) \n",
+ "which is contained in `html.hqs-js > body > div > div.container > section.row > div#dev-last-details.col-md-5 > dl.dl-horizontal > dd` of the source HTML. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from bs4 import BeautifulSoup\n",
+ "# A function to scrape the \"First Date\" from the given URL\n",
+ "def get_first_date(device_number):\n",
+ " print('.', end='')\n",
+ " url = f\"https://webcritech.jrc.ec.europa.eu/SeaLevelsDb/Device/{device_number}\"\n",
+ " response = requests.get(url)\n",
+ " if response.status_code == 200:\n",
+ " soup = BeautifulSoup(response.content, 'html.parser')\n",
+ " # Find all dl-horizontal elements, which contain dt and dd pairs\n",
+ " dl_elements = soup.find_all('dl', class_='dl-horizontal')\n",
+ " for dl in dl_elements:\n",
+ " # Find all dt elements within the current dl element\n",
+ " dt_elements = dl.find_all('dt')\n",
+ " # print(dt_elements)\n",
+ " for index, dt in enumerate(dt_elements):\n",
+ " # Check if the dt element's text is 'First date'\n",
+ " if dt.get_text().strip() == 'First date':\n",
+ " # Get the corresponding dd element that follows the dt element\n",
+ " first_date_dd = dl.find_all('dd')[index]\n",
+ " # print(first_date_dd.get_text().strip())\n",
+ " # 1/0\n",
+ " return first_date_dd.get_text().strip()\n",
+ " return None\n",
+ "\n",
+ "# Apply the function to each row and store the results in a new column\n",
+ "SL_df['FirstDate'] = SL_df['Id'].apply(get_first_date)"
]
},
{
@@ -2351,251 +513,9 @@
},
{
"cell_type": "code",
- "execution_count": 28,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "
\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " Time(UTC) | \n",
- " Lev RAD (m) | \n",
- " Panel (V) | \n",
- " Rms (m) | \n",
- " Sensor Temp (C) | \n",
- " Temperature (C) | \n",
- " Alert | \n",
- " Alert Signal (m) | \n",
- " Battery (V) | \n",
- " Forecast 30 (m) | \n",
- " Forecast 300 (m) | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " 21 Aug 2024 04:28:27 | \n",
- " 4.291 | \n",
- " -5.5 | \n",
- " 0.000 | \n",
- " 42.465 | \n",
- " 36.3 | \n",
- " 0.0 | \n",
- " 0.000 | \n",
- " 10.943 | \n",
- " 4.291 | \n",
- " 4.291 | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " 21 Aug 2024 04:28:33 | \n",
- " 4.289 | \n",
- " -5.5 | \n",
- " 0.000 | \n",
- " 42.453 | \n",
- " 36.3 | \n",
- " 0.0 | \n",
- " 0.000 | \n",
- " 10.972 | \n",
- " 4.290 | \n",
- " 4.290 | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " 21 Aug 2024 04:28:39 | \n",
- " 4.296 | \n",
- " -5.5 | \n",
- " 0.000 | \n",
- " 42.747 | \n",
- " 36.3 | \n",
- " 0.0 | \n",
- " 0.000 | \n",
- " 10.967 | \n",
- " 4.296 | \n",
- " 4.296 | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " 21 Aug 2024 04:28:45 | \n",
- " 4.298 | \n",
- " -5.5 | \n",
- " 0.000 | \n",
- " 42.469 | \n",
- " 36.3 | \n",
- " 0.0 | \n",
- " 0.000 | \n",
- " 10.978 | \n",
- " 4.299 | \n",
- " 4.299 | \n",
- "
\n",
- " \n",
- " 4 | \n",
- " 21 Aug 2024 04:28:51 | \n",
- " 4.285 | \n",
- " -5.5 | \n",
- " 0.000 | \n",
- " 42.465 | \n",
- " 36.3 | \n",
- " 0.0 | \n",
- " 0.000 | \n",
- " 10.977 | \n",
- " 4.288 | \n",
- " 4.288 | \n",
- "
\n",
- " \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- " ... | \n",
- "
\n",
- " \n",
- " 79909 | \n",
- " 31 Aug 2024 23:59:35 | \n",
- " 4.300 | \n",
- " -5.5 | \n",
- " 0.014 | \n",
- " 44.464 | \n",
- " 48.7 | \n",
- " 0.0 | \n",
- " 0.025 | \n",
- " 11.431 | \n",
- " 4.274 | \n",
- " 4.249 | \n",
- "
\n",
- " \n",
- " 79910 | \n",
- " 31 Aug 2024 23:59:41 | \n",
- " 4.241 | \n",
- " -5.5 | \n",
- " 0.014 | \n",
- " 44.460 | \n",
- " 48.7 | \n",
- " 0.0 | \n",
- " 0.018 | \n",
- " 11.432 | \n",
- " 4.267 | \n",
- " 4.249 | \n",
- "
\n",
- " \n",
- " 79911 | \n",
- " 31 Aug 2024 23:59:47 | \n",
- " 4.265 | \n",
- " -5.5 | \n",
- " 0.014 | \n",
- " 44.455 | \n",
- " 48.7 | \n",
- " 0.0 | \n",
- " 0.014 | \n",
- " 11.425 | \n",
- " 4.263 | \n",
- " 4.249 | \n",
- "
\n",
- " \n",
- " 79912 | \n",
- " 31 Aug 2024 23:59:53 | \n",
- " 4.257 | \n",
- " -5.5 | \n",
- " 0.014 | \n",
- " 44.455 | \n",
- " 48.7 | \n",
- " 0.0 | \n",
- " 0.012 | \n",
- " 11.435 | \n",
- " 4.262 | \n",
- " 4.249 | \n",
- "
\n",
- " \n",
- " 79913 | \n",
- " 31 Aug 2024 23:59:59 | \n",
- " 4.212 | \n",
- " -5.5 | \n",
- " 0.014 | \n",
- " 44.447 | \n",
- " 48.7 | \n",
- " 0.0 | \n",
- " 0.004 | \n",
- " 11.430 | \n",
- " 4.252 | \n",
- " 4.249 | \n",
- "
\n",
- " \n",
- "
\n",
- "
79914 rows × 11 columns
\n",
- "
"
- ],
- "text/plain": [
- " Time(UTC) Lev RAD (m) Panel (V) Rms (m) Sensor Temp (C) \\\n",
- "0 21 Aug 2024 04:28:27 4.291 -5.5 0.000 42.465 \n",
- "1 21 Aug 2024 04:28:33 4.289 -5.5 0.000 42.453 \n",
- "2 21 Aug 2024 04:28:39 4.296 -5.5 0.000 42.747 \n",
- "3 21 Aug 2024 04:28:45 4.298 -5.5 0.000 42.469 \n",
- "4 21 Aug 2024 04:28:51 4.285 -5.5 0.000 42.465 \n",
- "... ... ... ... ... ... \n",
- "79909 31 Aug 2024 23:59:35 4.300 -5.5 0.014 44.464 \n",
- "79910 31 Aug 2024 23:59:41 4.241 -5.5 0.014 44.460 \n",
- "79911 31 Aug 2024 23:59:47 4.265 -5.5 0.014 44.455 \n",
- "79912 31 Aug 2024 23:59:53 4.257 -5.5 0.014 44.455 \n",
- "79913 31 Aug 2024 23:59:59 4.212 -5.5 0.014 44.447 \n",
- "\n",
- " Temperature (C) Alert Alert Signal (m) Battery (V) Forecast 30 (m) \\\n",
- "0 36.3 0.0 0.000 10.943 4.291 \n",
- "1 36.3 0.0 0.000 10.972 4.290 \n",
- "2 36.3 0.0 0.000 10.967 4.296 \n",
- "3 36.3 0.0 0.000 10.978 4.299 \n",
- "4 36.3 0.0 0.000 10.977 4.288 \n",
- "... ... ... ... ... ... \n",
- "79909 48.7 0.0 0.025 11.431 4.274 \n",
- "79910 48.7 0.0 0.018 11.432 4.267 \n",
- "79911 48.7 0.0 0.014 11.425 4.263 \n",
- "79912 48.7 0.0 0.012 11.435 4.262 \n",
- "79913 48.7 0.0 0.004 11.430 4.252 \n",
- "\n",
- " Forecast 300 (m) \n",
- "0 4.291 \n",
- "1 4.290 \n",
- "2 4.296 \n",
- "3 4.299 \n",
- "4 4.288 \n",
- "... ... \n",
- "79909 4.249 \n",
- "79910 4.249 \n",
- "79911 4.249 \n",
- "79912 4.249 \n",
- "79913 4.249 \n",
- "\n",
- "[79914 rows x 11 columns]"
- ]
- },
- "execution_count": 28,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"stations_response = requests.get(url)\n",
"data = io.StringIO(stations_response.text) # Create a text stream object\n",
@@ -2605,102 +525,9 @@
},
{
"cell_type": "code",
- "execution_count": 33,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {},
- "metadata": {},
- "output_type": "display_data"
- },
- {
- "data": {
- "application/vnd.holoviews_exec.v0+json": "",
- "text/html": [
- "
\n",
- ""
- ],
- "text/plain": [
- ":Curve [index] (Lev RAD (m))"
- ]
- },
- "execution_count": 33,
- "metadata": {
- "application/vnd.holoviews_exec.v0+json": {
- "id": "p3144"
- }
- },
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"df.hvplot.line( y='Lev RAD (m)')"
]