4431 lines
315 KiB
Plaintext
4431 lines
315 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"id": "912ed572-1658-406b-976c-cd6de2d4e89e",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:10.338079Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:10.337865Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:14.509657Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:14.509184Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<script type=\"esms-options\">{\"shimMode\": true}</script><style>*[data-root-id],\n",
|
|
"*[data-root-id] > * {\n",
|
|
" box-sizing: border-box;\n",
|
|
" font-family: var(--jp-ui-font-family);\n",
|
|
" font-size: var(--jp-ui-font-size1);\n",
|
|
" color: var(--vscode-editor-foreground, var(--jp-ui-font-color1));\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* Override VSCode background color */\n",
|
|
".cell-output-ipywidget-background:has(\n",
|
|
" > .cell-output-ipywidget-background > .lm-Widget > *[data-root-id]\n",
|
|
"),\n",
|
|
".cell-output-ipywidget-background:has(> .lm-Widget > *[data-root-id]) {\n",
|
|
" background-color: transparent !important;\n",
|
|
"}\n",
|
|
"</style>"
|
|
]
|
|
},
|
|
"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.7.3'.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.7.5/dist/bundled/reactiveesm/es-module-shims@^1.10.0/dist/es-module-shims.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-3.7.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.7.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.7.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.7.3.min.js\", \"https://cdn.holoviz.org/panel/1.7.5/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",
|
|
" },\n",
|
|
"function(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": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = true;\n const py_version = '3.7.3'.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.7.5/dist/bundled/reactiveesm/es-module-shims@^1.10.0/dist/es-module-shims.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-3.7.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.7.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.7.3.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.7.3.min.js\", \"https://cdn.holoviz.org/panel/1.7.5/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));"
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"data": {
|
|
"application/javascript": [
|
|
"\n",
|
|
"if ((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",
|
|
" 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",
|
|
" let retries = 0;\n",
|
|
" const open = () => {\n",
|
|
" if (comm.active) {\n",
|
|
" comm.open();\n",
|
|
" } else if (retries > 3) {\n",
|
|
" console.warn('Comm target never activated')\n",
|
|
" } else {\n",
|
|
" retries += 1\n",
|
|
" setTimeout(open, 500)\n",
|
|
" }\n",
|
|
" }\n",
|
|
" if (comm.active) {\n",
|
|
" comm.open();\n",
|
|
" } else {\n",
|
|
" setTimeout(open, 500)\n",
|
|
" }\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",
|
|
"\n",
|
|
"var JS_MIME_TYPE = 'application/javascript';\n",
|
|
"var HTML_MIME_TYPE = 'text/html';\n",
|
|
"var EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\n",
|
|
"var CLASS_NAME = 'output';\n",
|
|
"\n",
|
|
"/**\n",
|
|
" * Render data to the DOM node\n",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function handle_update_output(event, handle) {\n",
|
|
" handle_clear_output(event, {cell: {output_area: handle.output_area}})\n",
|
|
" handle_add_output(event, handle)\n",
|
|
"}\n",
|
|
"\n",
|
|
"function 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",
|
|
"\n",
|
|
"if (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": "\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 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 let retries = 0;\n const open = () => {\n if (comm.active) {\n comm.open();\n } else if (retries > 3) {\n console.warn('Comm target never activated')\n } else {\n retries += 1\n setTimeout(open, 500)\n }\n }\n if (comm.active) {\n comm.open();\n } else {\n setTimeout(open, 500)\n }\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"
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"data": {
|
|
"application/vnd.holoviews_exec.v0+json": "",
|
|
"text/html": [
|
|
"<div id='1d7d18aa-b127-4b24-a8ee-78773ff2f165'>\n",
|
|
" <div id=\"c45e170a-1061-4ae2-b868-76ce62fbac53\" data-root-id=\"1d7d18aa-b127-4b24-a8ee-78773ff2f165\" style=\"display: contents;\"></div>\n",
|
|
"</div>\n",
|
|
"<script type=\"application/javascript\">(function(root) {\n",
|
|
" var docs_json = {\"02ac11a8-620e-414a-89c7-c360aee36a84\":{\"version\":\"3.7.3\",\"title\":\"Bokeh Application\",\"roots\":[{\"type\":\"object\",\"name\":\"panel.models.browser.BrowserInfo\",\"id\":\"1d7d18aa-b127-4b24-a8ee-78773ff2f165\"},{\"type\":\"object\",\"name\":\"panel.models.comm_manager.CommManager\",\"id\":\"7507b4e4-618b-4726-9fe4-6e31d56618df\",\"attributes\":{\"plot_id\":\"1d7d18aa-b127-4b24-a8ee-78773ff2f165\",\"comm_id\":\"738b3f4a9c0e4fa6ae87ddf50555383c\",\"client_comm_id\":\"9c91728374b347d88dc756a7d6168751\"}}],\"defs\":[{\"type\":\"model\",\"name\":\"ReactiveHTML1\"},{\"type\":\"model\",\"name\":\"FlexBox1\",\"properties\":[{\"name\":\"align_content\",\"kind\":\"Any\",\"default\":\"flex-start\"},{\"name\":\"align_items\",\"kind\":\"Any\",\"default\":\"flex-start\"},{\"name\":\"flex_direction\",\"kind\":\"Any\",\"default\":\"row\"},{\"name\":\"flex_wrap\",\"kind\":\"Any\",\"default\":\"wrap\"},{\"name\":\"gap\",\"kind\":\"Any\",\"default\":\"\"},{\"name\":\"justify_content\",\"kind\":\"Any\",\"default\":\"flex-start\"}]},{\"type\":\"model\",\"name\":\"FloatPanel1\",\"properties\":[{\"name\":\"config\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}},{\"name\":\"contained\",\"kind\":\"Any\",\"default\":true},{\"name\":\"position\",\"kind\":\"Any\",\"default\":\"right-top\"},{\"name\":\"offsetx\",\"kind\":\"Any\",\"default\":null},{\"name\":\"offsety\",\"kind\":\"Any\",\"default\":null},{\"name\":\"theme\",\"kind\":\"Any\",\"default\":\"primary\"},{\"name\":\"status\",\"kind\":\"Any\",\"default\":\"normalized\"}]},{\"type\":\"model\",\"name\":\"GridStack1\",\"properties\":[{\"name\":\"ncols\",\"kind\":\"Any\",\"default\":null},{\"name\":\"nrows\",\"kind\":\"Any\",\"default\":null},{\"name\":\"allow_resize\",\"kind\":\"Any\",\"default\":true},{\"name\":\"allow_drag\",\"kind\":\"Any\",\"default\":true},{\"name\":\"state\",\"kind\":\"Any\",\"default\":[]}]},{\"type\":\"model\",\"name\":\"drag1\",\"properties\":[{\"name\":\"slider_width\",\"kind\":\"Any\",\"default\":5},{\"name\":\"slider_color\",\"kind\":\"Any\",\"default\":\"black\"},{\"name\":\"value\",\"kind\":\"Any\",\"default\":50}]},{\"type\":\"model\",\"name\":\"click1\",\"properties\":[{\"name\":\"terminal_output\",\"kind\":\"Any\",\"default\":\"\"},{\"name\":\"debug_name\",\"kind\":\"Any\",\"default\":\"\"},{\"name\":\"clears\",\"kind\":\"Any\",\"default\":0}]},{\"type\":\"model\",\"name\":\"ReactiveESM1\",\"properties\":[{\"name\":\"esm_constants\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}}]},{\"type\":\"model\",\"name\":\"JSComponent1\",\"properties\":[{\"name\":\"esm_constants\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}}]},{\"type\":\"model\",\"name\":\"ReactComponent1\",\"properties\":[{\"name\":\"use_shadow_dom\",\"kind\":\"Any\",\"default\":true},{\"name\":\"esm_constants\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}}]},{\"type\":\"model\",\"name\":\"AnyWidgetComponent1\",\"properties\":[{\"name\":\"use_shadow_dom\",\"kind\":\"Any\",\"default\":true},{\"name\":\"esm_constants\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}}]},{\"type\":\"model\",\"name\":\"FastWrapper1\",\"properties\":[{\"name\":\"object\",\"kind\":\"Any\",\"default\":null},{\"name\":\"style\",\"kind\":\"Any\",\"default\":null}]},{\"type\":\"model\",\"name\":\"NotificationArea1\",\"properties\":[{\"name\":\"js_events\",\"kind\":\"Any\",\"default\":{\"type\":\"map\"}},{\"name\":\"max_notifications\",\"kind\":\"Any\",\"default\":5},{\"name\":\"notifications\",\"kind\":\"Any\",\"default\":[]},{\"name\":\"position\",\"kind\":\"Any\",\"default\":\"bottom-right\"},{\"name\":\"_clear\",\"kind\":\"Any\",\"default\":0},{\"name\":\"types\",\"kind\":\"Any\",\"default\":[{\"type\":\"map\",\"entries\":[[\"type\",\"warning\"],[\"background\",\"#ffc107\"],[\"icon\",{\"type\":\"map\",\"entries\":[[\"className\",\"fas fa-exclamation-triangle\"],[\"tagName\",\"i\"],[\"color\",\"white\"]]}]]},{\"type\":\"map\",\"entries\":[[\"type\",\"info\"],[\"background\",\"#007bff\"],[\"icon\",{\"type\":\"map\",\"entries\":[[\"className\",\"fas fa-info-circle\"],[\"tagName\",\"i\"],[\"color\",\"white\"]]}]]}]}]},{\"type\":\"model\",\"name\":\"Notification\",\"properties\":[{\"name\":\"background\",\"kind\":\"Any\",\"default\":null},{\"name\":\"duration\",\"kind\":\"Any\",\"default\":3000},{\"name\":\"icon\",\"kind\":\"Any\",\"default\":null},{\"name\":\"message\",\"kind\":\"Any\",\"default\":\"\"},{\"name\":\"notification_type\",\"kind\":\"Any\",\"default\":null},{\"name\":\"_rendered\",\"kind\":\"Any\",\"default\":false},{\"name\":\"_destroyed\",\"kind\":\"Any\",\"default\":false}]},{\"type\":\"model\",\"name\":\"TemplateActions1\",\"properties\":[{\"name\":\"open_modal\",\"kind\":\"Any\",\"default\":0},{\"name\":\"close_modal\",\"kind\":\"Any\",\"default\":0}]},{\"type\":\"model\",\"name\":\"BootstrapTemplateActions1\",\"properties\":[{\"name\":\"open_modal\",\"kind\":\"Any\",\"default\":0},{\"name\":\"close_modal\",\"kind\":\"Any\",\"default\":0}]},{\"type\":\"model\",\"name\":\"TemplateEditor1\",\"properties\":[{\"name\":\"layout\",\"kind\":\"Any\",\"default\":[]}]},{\"type\":\"model\",\"name\":\"MaterialTemplateActions1\",\"properties\":[{\"name\":\"open_modal\",\"kind\":\"Any\",\"default\":0},{\"name\":\"close_modal\",\"kind\":\"Any\",\"default\":0}]},{\"type\":\"model\",\"name\":\"request_value1\",\"properties\":[{\"name\":\"fill\",\"kind\":\"Any\",\"default\":\"none\"},{\"name\":\"_synced\",\"kind\":\"Any\",\"default\":null},{\"name\":\"_request_sync\",\"kind\":\"Any\",\"default\":0}]},{\"type\":\"model\",\"name\":\"holoviews.plotting.bokeh.raster.HoverModel\",\"properties\":[{\"name\":\"xy\",\"kind\":\"Any\",\"default\":null},{\"name\":\"data\",\"kind\":\"Any\",\"default\":null}]}]}};\n",
|
|
" var render_items = [{\"docid\":\"02ac11a8-620e-414a-89c7-c360aee36a84\",\"roots\":{\"1d7d18aa-b127-4b24-a8ee-78773ff2f165\":\"c45e170a-1061-4ae2-b868-76ce62fbac53\"},\"root_ids\":[\"1d7d18aa-b127-4b24-a8ee-78773ff2f165\"]}];\n",
|
|
" var docs = Object.values(docs_json)\n",
|
|
" if (!docs) {\n",
|
|
" return\n",
|
|
" }\n",
|
|
" const py_version = docs[0].version.replace('rc', '-rc.').replace('.dev', '-dev.')\n",
|
|
" async function embed_document(root) {\n",
|
|
" var Bokeh = get_bokeh(root)\n",
|
|
" await Bokeh.embed.embed_items_notebook(docs_json, render_items);\n",
|
|
" for (const render_item of render_items) {\n",
|
|
" for (const root_id of render_item.root_ids) {\n",
|
|
"\tconst id_el = document.getElementById(root_id)\n",
|
|
"\tif (id_el.children.length && id_el.children[0].hasAttribute('data-root-id')) {\n",
|
|
"\t const root_el = id_el.children[0]\n",
|
|
"\t root_el.id = root_el.id + '-rendered'\n",
|
|
"\t for (const child of root_el.children) {\n",
|
|
" // Ensure JupyterLab does not capture keyboard shortcuts\n",
|
|
" // see: https://jupyterlab.readthedocs.io/en/4.1.x/extension/notebook.html#keyboard-interaction-model\n",
|
|
"\t child.setAttribute('data-lm-suppress-shortcuts', 'true')\n",
|
|
"\t }\n",
|
|
"\t}\n",
|
|
" }\n",
|
|
" }\n",
|
|
" }\n",
|
|
" function get_bokeh(root) {\n",
|
|
" if (root.Bokeh === undefined) {\n",
|
|
" return null\n",
|
|
" } else if (root.Bokeh.version !== py_version) {\n",
|
|
" if (root.Bokeh.versions === undefined || !root.Bokeh.versions.has(py_version)) {\n",
|
|
"\treturn null\n",
|
|
" }\n",
|
|
" return root.Bokeh.versions.get(py_version);\n",
|
|
" } else if (root.Bokeh.version === py_version) {\n",
|
|
" return root.Bokeh\n",
|
|
" }\n",
|
|
" return null\n",
|
|
" }\n",
|
|
" function is_loaded(root) {\n",
|
|
" var Bokeh = get_bokeh(root)\n",
|
|
" return (Bokeh != null && Bokeh.Panel !== undefined)\n",
|
|
" }\n",
|
|
" if (is_loaded(root)) {\n",
|
|
" embed_document(root);\n",
|
|
" } else {\n",
|
|
" var attempts = 0;\n",
|
|
" var timer = setInterval(function(root) {\n",
|
|
" if (is_loaded(root)) {\n",
|
|
" clearInterval(timer);\n",
|
|
" embed_document(root);\n",
|
|
" } else if (document.readyState == \"complete\") {\n",
|
|
" attempts++;\n",
|
|
" if (attempts > 200) {\n",
|
|
" clearInterval(timer);\n",
|
|
"\t var Bokeh = get_bokeh(root)\n",
|
|
"\t if (Bokeh == null || Bokeh.Panel == null) {\n",
|
|
" console.warn(\"Panel: ERROR: Unable to run Panel code because Bokeh or Panel library is missing\");\n",
|
|
"\t } else {\n",
|
|
"\t console.warn(\"Panel: WARNING: Attempting to render but not all required libraries could be resolved.\")\n",
|
|
"\t embed_document(root)\n",
|
|
"\t }\n",
|
|
" }\n",
|
|
" }\n",
|
|
" }, 25, root)\n",
|
|
" }\n",
|
|
"})(window);</script>"
|
|
]
|
|
},
|
|
"metadata": {
|
|
"application/vnd.holoviews_exec.v0+json": {
|
|
"id": "1d7d18aa-b127-4b24-a8ee-78773ff2f165"
|
|
}
|
|
},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<script type=\"esms-options\">{\"shimMode\": true}</script><style>*[data-root-id],\n",
|
|
"*[data-root-id] > * {\n",
|
|
" box-sizing: border-box;\n",
|
|
" font-family: var(--jp-ui-font-family);\n",
|
|
" font-size: var(--jp-ui-font-size1);\n",
|
|
" color: var(--vscode-editor-foreground, var(--jp-ui-font-color1));\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* Override VSCode background color */\n",
|
|
".cell-output-ipywidget-background:has(\n",
|
|
" > .cell-output-ipywidget-background > .lm-Widget > *[data-root-id]\n",
|
|
"),\n",
|
|
".cell-output-ipywidget-background:has(> .lm-Widget > *[data-root-id]) {\n",
|
|
" background-color: transparent !important;\n",
|
|
"}\n",
|
|
"</style>"
|
|
]
|
|
},
|
|
"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.7.3'.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.7.5/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",
|
|
" },\n",
|
|
"function(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": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = false;\n const py_version = '3.7.3'.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.7.5/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));"
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"data": {
|
|
"application/javascript": [
|
|
"\n",
|
|
"if ((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",
|
|
" 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",
|
|
" let retries = 0;\n",
|
|
" const open = () => {\n",
|
|
" if (comm.active) {\n",
|
|
" comm.open();\n",
|
|
" } else if (retries > 3) {\n",
|
|
" console.warn('Comm target never activated')\n",
|
|
" } else {\n",
|
|
" retries += 1\n",
|
|
" setTimeout(open, 500)\n",
|
|
" }\n",
|
|
" }\n",
|
|
" if (comm.active) {\n",
|
|
" comm.open();\n",
|
|
" } else {\n",
|
|
" setTimeout(open, 500)\n",
|
|
" }\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",
|
|
"\n",
|
|
"var JS_MIME_TYPE = 'application/javascript';\n",
|
|
"var HTML_MIME_TYPE = 'text/html';\n",
|
|
"var EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\n",
|
|
"var CLASS_NAME = 'output';\n",
|
|
"\n",
|
|
"/**\n",
|
|
" * Render data to the DOM node\n",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function handle_update_output(event, handle) {\n",
|
|
" handle_clear_output(event, {cell: {output_area: handle.output_area}})\n",
|
|
" handle_add_output(event, handle)\n",
|
|
"}\n",
|
|
"\n",
|
|
"function 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",
|
|
"\n",
|
|
"if (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": "\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 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 let retries = 0;\n const open = () => {\n if (comm.active) {\n comm.open();\n } else if (retries > 3) {\n console.warn('Comm target never activated')\n } else {\n retries += 1\n setTimeout(open, 500)\n }\n }\n if (comm.active) {\n comm.open();\n } else {\n setTimeout(open, 500)\n }\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"
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<script type=\"esms-options\">{\"shimMode\": true}</script><style>*[data-root-id],\n",
|
|
"*[data-root-id] > * {\n",
|
|
" box-sizing: border-box;\n",
|
|
" font-family: var(--jp-ui-font-family);\n",
|
|
" font-size: var(--jp-ui-font-size1);\n",
|
|
" color: var(--vscode-editor-foreground, var(--jp-ui-font-color1));\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* Override VSCode background color */\n",
|
|
".cell-output-ipywidget-background:has(\n",
|
|
" > .cell-output-ipywidget-background > .lm-Widget > *[data-root-id]\n",
|
|
"),\n",
|
|
".cell-output-ipywidget-background:has(> .lm-Widget > *[data-root-id]) {\n",
|
|
" background-color: transparent !important;\n",
|
|
"}\n",
|
|
"</style>"
|
|
]
|
|
},
|
|
"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.7.3'.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.7.5/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",
|
|
" },\n",
|
|
"function(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": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = false;\n const py_version = '3.7.3'.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.7.5/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));"
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"data": {
|
|
"application/javascript": [
|
|
"\n",
|
|
"if ((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",
|
|
" 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",
|
|
" let retries = 0;\n",
|
|
" const open = () => {\n",
|
|
" if (comm.active) {\n",
|
|
" comm.open();\n",
|
|
" } else if (retries > 3) {\n",
|
|
" console.warn('Comm target never activated')\n",
|
|
" } else {\n",
|
|
" retries += 1\n",
|
|
" setTimeout(open, 500)\n",
|
|
" }\n",
|
|
" }\n",
|
|
" if (comm.active) {\n",
|
|
" comm.open();\n",
|
|
" } else {\n",
|
|
" setTimeout(open, 500)\n",
|
|
" }\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",
|
|
"\n",
|
|
"var JS_MIME_TYPE = 'application/javascript';\n",
|
|
"var HTML_MIME_TYPE = 'text/html';\n",
|
|
"var EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\n",
|
|
"var CLASS_NAME = 'output';\n",
|
|
"\n",
|
|
"/**\n",
|
|
" * Render data to the DOM node\n",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function handle_update_output(event, handle) {\n",
|
|
" handle_clear_output(event, {cell: {output_area: handle.output_area}})\n",
|
|
" handle_add_output(event, handle)\n",
|
|
"}\n",
|
|
"\n",
|
|
"function 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",
|
|
"\n",
|
|
"if (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": "\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 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 let retries = 0;\n const open = () => {\n if (comm.active) {\n comm.open();\n } else if (retries > 3) {\n console.warn('Comm target never activated')\n } else {\n retries += 1\n setTimeout(open, 500)\n }\n }\n if (comm.active) {\n comm.open();\n } else {\n setTimeout(open, 500)\n }\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"
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<script type=\"esms-options\">{\"shimMode\": true}</script><style>*[data-root-id],\n",
|
|
"*[data-root-id] > * {\n",
|
|
" box-sizing: border-box;\n",
|
|
" font-family: var(--jp-ui-font-family);\n",
|
|
" font-size: var(--jp-ui-font-size1);\n",
|
|
" color: var(--vscode-editor-foreground, var(--jp-ui-font-color1));\n",
|
|
"}\n",
|
|
"\n",
|
|
"/* Override VSCode background color */\n",
|
|
".cell-output-ipywidget-background:has(\n",
|
|
" > .cell-output-ipywidget-background > .lm-Widget > *[data-root-id]\n",
|
|
"),\n",
|
|
".cell-output-ipywidget-background:has(> .lm-Widget > *[data-root-id]) {\n",
|
|
" background-color: transparent !important;\n",
|
|
"}\n",
|
|
"</style>"
|
|
]
|
|
},
|
|
"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.7.3'.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.7.5/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",
|
|
" },\n",
|
|
"function(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": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = false;\n const py_version = '3.7.3'.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.7.5/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));"
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"data": {
|
|
"application/javascript": [
|
|
"\n",
|
|
"if ((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",
|
|
" 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",
|
|
" let retries = 0;\n",
|
|
" const open = () => {\n",
|
|
" if (comm.active) {\n",
|
|
" comm.open();\n",
|
|
" } else if (retries > 3) {\n",
|
|
" console.warn('Comm target never activated')\n",
|
|
" } else {\n",
|
|
" retries += 1\n",
|
|
" setTimeout(open, 500)\n",
|
|
" }\n",
|
|
" }\n",
|
|
" if (comm.active) {\n",
|
|
" comm.open();\n",
|
|
" } else {\n",
|
|
" setTimeout(open, 500)\n",
|
|
" }\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",
|
|
"\n",
|
|
"var JS_MIME_TYPE = 'application/javascript';\n",
|
|
"var HTML_MIME_TYPE = 'text/html';\n",
|
|
"var EXEC_MIME_TYPE = 'application/vnd.holoviews_exec.v0+json';\n",
|
|
"var CLASS_NAME = 'output';\n",
|
|
"\n",
|
|
"/**\n",
|
|
" * Render data to the DOM node\n",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function 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",
|
|
" */\n",
|
|
"function handle_update_output(event, handle) {\n",
|
|
" handle_clear_output(event, {cell: {output_area: handle.output_area}})\n",
|
|
" handle_add_output(event, handle)\n",
|
|
"}\n",
|
|
"\n",
|
|
"function 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",
|
|
"\n",
|
|
"if (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": "\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 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 let retries = 0;\n const open = () => {\n if (comm.active) {\n comm.open();\n } else if (retries > 3) {\n console.warn('Comm target never activated')\n } else {\n retries += 1\n setTimeout(open, 500)\n }\n }\n if (comm.active) {\n comm.open();\n } else {\n setTimeout(open, 500)\n }\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"
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"CPU times: user 6 s, sys: 386 ms, total: 6.39 s\n",
|
|
"Wall time: 4.17 s\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"%%time\n",
|
|
"%matplotlib inline\n",
|
|
"\n",
|
|
"import importlib\n",
|
|
"import new_import_ODC \n",
|
|
"\n",
|
|
"importlib.reload(new_import_ODC)\n",
|
|
"\n",
|
|
"from new_import_ODC import *"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"id": "d824dc4f-994b-4d1c-8d24-ce6674da141c",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:14.511284Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:14.510914Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:14.753043Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:14.752403Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"ename": "ValueError",
|
|
"evalue": "No dask-gateway address provided or found in configuration",
|
|
"output_type": "error",
|
|
"traceback": [
|
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
|
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
|
|
"File \u001b[0;32m<timed exec>:2\u001b[0m\n",
|
|
"File \u001b[0;32m~/CSIROBoeingPhase4-Vietnam/easi_tools/notebook_utils.py:123\u001b[0m, in \u001b[0;36minitialize_dask\u001b[0;34m(use_gateway, workers, wait, local_port, **kwargs)\u001b[0m\n\u001b[1;32m 121\u001b[0m \u001b[38;5;66;03m# Dask gateway\u001b[39;00m\n\u001b[1;32m 122\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m use_gateway:\n\u001b[0;32m--> 123\u001b[0m gateway \u001b[38;5;241m=\u001b[39m \u001b[43mGateway\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 124\u001b[0m clusters \u001b[38;5;241m=\u001b[39m gateway\u001b[38;5;241m.\u001b[39mlist_clusters()\n\u001b[1;32m 125\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m clusters:\n",
|
|
"File \u001b[0;32m~/miniconda3/envs/env_01/lib/python3.10/site-packages/dask_gateway/client.py:282\u001b[0m, in \u001b[0;36mGateway.__init__\u001b[0;34m(self, address, proxy_address, public_address, auth, asynchronous, loop)\u001b[0m\n\u001b[1;32m 280\u001b[0m address \u001b[38;5;241m=\u001b[39m format_template(dask\u001b[38;5;241m.\u001b[39mconfig\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mgateway.address\u001b[39m\u001b[38;5;124m\"\u001b[39m))\n\u001b[1;32m 281\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m address \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m--> 282\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 283\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mNo dask-gateway address provided or found in configuration\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 284\u001b[0m )\n\u001b[1;32m 285\u001b[0m address \u001b[38;5;241m=\u001b[39m address\u001b[38;5;241m.\u001b[39mrstrip(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m/\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 287\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m public_address \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n",
|
|
"\u001b[0;31mValueError\u001b[0m: No dask-gateway address provided or found in configuration"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"%%time\n",
|
|
"# Cấu hình Daskgateway\n",
|
|
"cluster, client = notebook_utils.initialize_dask(use_gateway=True, workers=(1, 10))\n",
|
|
"# Khai báo 1 Datacube là dc\n",
|
|
"dc = None\n",
|
|
"\n",
|
|
"# Cấu hình truy cập dịch vụ S3\n",
|
|
"configure_s3_access(aws_unsigned=False, requester_pays=True, client=client)\n",
|
|
"\n",
|
|
"client"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"id": "fbed4c80-bbf8-4ea8-aa45-2460b2ba04c7",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:14.754748Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:14.754581Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:14.757415Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:14.756846Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"## cấu hình thời gian lấy ảnh và tọa độ\n",
|
|
"date_range = (\"2022-09-01\", \"2022-10-01\")\n",
|
|
"longtitude_range = (105.86, 105.94)\n",
|
|
"latitude_range = (9.65, 9.69)\n",
|
|
"\n",
|
|
"coordinates = (longtitude_range, latitude_range)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"id": "6b90c49b-0665-4478-a23b-d111ef88eb79",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:14.758855Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:14.758705Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:17.061908Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:17.061288Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<h4>Dataset size: 0.00 MB</h4>"
|
|
],
|
|
"text/plain": [
|
|
"<IPython.core.display.HTML object>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
|
|
"<defs>\n",
|
|
"<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
|
|
"<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
|
|
"<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
|
|
"<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
|
|
"</symbol>\n",
|
|
"<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
|
|
"<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
|
|
"<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
|
|
"<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
|
|
"<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
|
|
"</symbol>\n",
|
|
"</defs>\n",
|
|
"</svg>\n",
|
|
"<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
|
|
" *\n",
|
|
" */\n",
|
|
"\n",
|
|
":root {\n",
|
|
" --xr-font-color0: var(\n",
|
|
" --jp-content-font-color0,\n",
|
|
" var(--pst-color-text-base rgba(0, 0, 0, 1))\n",
|
|
" );\n",
|
|
" --xr-font-color2: var(\n",
|
|
" --jp-content-font-color2,\n",
|
|
" var(--pst-color-text-base, rgba(0, 0, 0, 0.54))\n",
|
|
" );\n",
|
|
" --xr-font-color3: var(\n",
|
|
" --jp-content-font-color3,\n",
|
|
" var(--pst-color-text-base, rgba(0, 0, 0, 0.38))\n",
|
|
" );\n",
|
|
" --xr-border-color: var(\n",
|
|
" --jp-border-color2,\n",
|
|
" hsl(from var(--pst-color-on-background, white) h s calc(l - 10))\n",
|
|
" );\n",
|
|
" --xr-disabled-color: var(\n",
|
|
" --jp-layout-color3,\n",
|
|
" hsl(from var(--pst-color-on-background, white) h s calc(l - 40))\n",
|
|
" );\n",
|
|
" --xr-background-color: var(\n",
|
|
" --jp-layout-color0,\n",
|
|
" var(--pst-color-on-background, white)\n",
|
|
" );\n",
|
|
" --xr-background-color-row-even: var(\n",
|
|
" --jp-layout-color1,\n",
|
|
" hsl(from var(--pst-color-on-background, white) h s calc(l - 5))\n",
|
|
" );\n",
|
|
" --xr-background-color-row-odd: var(\n",
|
|
" --jp-layout-color2,\n",
|
|
" hsl(from var(--pst-color-on-background, white) h s calc(l - 15))\n",
|
|
" );\n",
|
|
"}\n",
|
|
"\n",
|
|
"html[theme=\"dark\"],\n",
|
|
"html[data-theme=\"dark\"],\n",
|
|
"body[data-theme=\"dark\"],\n",
|
|
"body.vscode-dark {\n",
|
|
" --xr-font-color0: var(\n",
|
|
" --jp-content-font-color0,\n",
|
|
" var(--pst-color-text-base, rgba(255, 255, 255, 1))\n",
|
|
" );\n",
|
|
" --xr-font-color2: var(\n",
|
|
" --jp-content-font-color2,\n",
|
|
" var(--pst-color-text-base, rgba(255, 255, 255, 0.54))\n",
|
|
" );\n",
|
|
" --xr-font-color3: var(\n",
|
|
" --jp-content-font-color3,\n",
|
|
" var(--pst-color-text-base, rgba(255, 255, 255, 0.38))\n",
|
|
" );\n",
|
|
" --xr-border-color: var(\n",
|
|
" --jp-border-color2,\n",
|
|
" hsl(from var(--pst-color-on-background, #111111) h s calc(l + 10))\n",
|
|
" );\n",
|
|
" --xr-disabled-color: var(\n",
|
|
" --jp-layout-color3,\n",
|
|
" hsl(from var(--pst-color-on-background, #111111) h s calc(l + 40))\n",
|
|
" );\n",
|
|
" --xr-background-color: var(\n",
|
|
" --jp-layout-color0,\n",
|
|
" var(--pst-color-on-background, #111111)\n",
|
|
" );\n",
|
|
" --xr-background-color-row-even: var(\n",
|
|
" --jp-layout-color1,\n",
|
|
" hsl(from var(--pst-color-on-background, #111111) h s calc(l + 5))\n",
|
|
" );\n",
|
|
" --xr-background-color-row-odd: var(\n",
|
|
" --jp-layout-color2,\n",
|
|
" hsl(from var(--pst-color-on-background, #111111) h s calc(l + 15))\n",
|
|
" );\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-wrap {\n",
|
|
" display: block !important;\n",
|
|
" min-width: 300px;\n",
|
|
" max-width: 700px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-text-repr-fallback {\n",
|
|
" /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
|
|
" display: none;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-header {\n",
|
|
" padding-top: 6px;\n",
|
|
" padding-bottom: 6px;\n",
|
|
" margin-bottom: 4px;\n",
|
|
" border-bottom: solid 1px var(--xr-border-color);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-header > div,\n",
|
|
".xr-header > ul {\n",
|
|
" display: inline;\n",
|
|
" margin-top: 0;\n",
|
|
" margin-bottom: 0;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-obj-type,\n",
|
|
".xr-array-name {\n",
|
|
" margin-left: 2px;\n",
|
|
" margin-right: 10px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-obj-type {\n",
|
|
" color: var(--xr-font-color2);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-sections {\n",
|
|
" padding-left: 0 !important;\n",
|
|
" display: grid;\n",
|
|
" grid-template-columns: 150px auto auto 1fr 0 20px 0 20px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-item {\n",
|
|
" display: contents;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-item input {\n",
|
|
" display: inline-block;\n",
|
|
" opacity: 0;\n",
|
|
" height: 0;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-item input + label {\n",
|
|
" color: var(--xr-disabled-color);\n",
|
|
" border: 2px solid transparent !important;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-item input:enabled + label {\n",
|
|
" cursor: pointer;\n",
|
|
" color: var(--xr-font-color2);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-item input:focus + label {\n",
|
|
" border: 2px solid var(--xr-font-color0) !important;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-item input:enabled + label:hover {\n",
|
|
" color: var(--xr-font-color0);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary {\n",
|
|
" grid-column: 1;\n",
|
|
" color: var(--xr-font-color2);\n",
|
|
" font-weight: 500;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary > span {\n",
|
|
" display: inline-block;\n",
|
|
" padding-left: 0.5em;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary-in:disabled + label {\n",
|
|
" color: var(--xr-font-color2);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary-in + label:before {\n",
|
|
" display: inline-block;\n",
|
|
" content: \"►\";\n",
|
|
" font-size: 11px;\n",
|
|
" width: 15px;\n",
|
|
" text-align: center;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary-in:disabled + label:before {\n",
|
|
" color: var(--xr-disabled-color);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary-in:checked + label:before {\n",
|
|
" content: \"▼\";\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary-in:checked + label > span {\n",
|
|
" display: none;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary,\n",
|
|
".xr-section-inline-details {\n",
|
|
" padding-top: 4px;\n",
|
|
" padding-bottom: 4px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-inline-details {\n",
|
|
" grid-column: 2 / -1;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-details {\n",
|
|
" display: none;\n",
|
|
" grid-column: 1 / -1;\n",
|
|
" margin-bottom: 5px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary-in:checked ~ .xr-section-details {\n",
|
|
" display: contents;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-array-wrap {\n",
|
|
" grid-column: 1 / -1;\n",
|
|
" display: grid;\n",
|
|
" grid-template-columns: 20px auto;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-array-wrap > label {\n",
|
|
" grid-column: 1;\n",
|
|
" vertical-align: top;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-preview {\n",
|
|
" color: var(--xr-font-color3);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-array-preview,\n",
|
|
".xr-array-data {\n",
|
|
" padding: 0 5px !important;\n",
|
|
" grid-column: 2;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-array-data,\n",
|
|
".xr-array-in:checked ~ .xr-array-preview {\n",
|
|
" display: none;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-array-in:checked ~ .xr-array-data,\n",
|
|
".xr-array-preview {\n",
|
|
" display: inline-block;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-dim-list {\n",
|
|
" display: inline-block !important;\n",
|
|
" list-style: none;\n",
|
|
" padding: 0 !important;\n",
|
|
" margin: 0;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-dim-list li {\n",
|
|
" display: inline-block;\n",
|
|
" padding: 0;\n",
|
|
" margin: 0;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-dim-list:before {\n",
|
|
" content: \"(\";\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-dim-list:after {\n",
|
|
" content: \")\";\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-dim-list li:not(:last-child):after {\n",
|
|
" content: \",\";\n",
|
|
" padding-right: 5px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-has-index {\n",
|
|
" font-weight: bold;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-list,\n",
|
|
".xr-var-item {\n",
|
|
" display: contents;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-item > div,\n",
|
|
".xr-var-item label,\n",
|
|
".xr-var-item > .xr-var-name span {\n",
|
|
" background-color: var(--xr-background-color-row-even);\n",
|
|
" border-color: var(--xr-background-color-row-odd);\n",
|
|
" margin-bottom: 0;\n",
|
|
" padding-top: 2px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-item > .xr-var-name:hover span {\n",
|
|
" padding-right: 5px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-list > li:nth-child(odd) > div,\n",
|
|
".xr-var-list > li:nth-child(odd) > label,\n",
|
|
".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
|
|
" background-color: var(--xr-background-color-row-odd);\n",
|
|
" border-color: var(--xr-background-color-row-even);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-name {\n",
|
|
" grid-column: 1;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-dims {\n",
|
|
" grid-column: 2;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-dtype {\n",
|
|
" grid-column: 3;\n",
|
|
" text-align: right;\n",
|
|
" color: var(--xr-font-color2);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-preview {\n",
|
|
" grid-column: 4;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-index-preview {\n",
|
|
" grid-column: 2 / 5;\n",
|
|
" color: var(--xr-font-color2);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-name,\n",
|
|
".xr-var-dims,\n",
|
|
".xr-var-dtype,\n",
|
|
".xr-preview,\n",
|
|
".xr-attrs dt {\n",
|
|
" white-space: nowrap;\n",
|
|
" overflow: hidden;\n",
|
|
" text-overflow: ellipsis;\n",
|
|
" padding-right: 10px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-name:hover,\n",
|
|
".xr-var-dims:hover,\n",
|
|
".xr-var-dtype:hover,\n",
|
|
".xr-attrs dt:hover {\n",
|
|
" overflow: visible;\n",
|
|
" width: auto;\n",
|
|
" z-index: 1;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-attrs,\n",
|
|
".xr-var-data,\n",
|
|
".xr-index-data {\n",
|
|
" display: none;\n",
|
|
" border-top: 2px dotted var(--xr-background-color);\n",
|
|
" padding-bottom: 20px !important;\n",
|
|
" padding-top: 10px !important;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-attrs-in + label,\n",
|
|
".xr-var-data-in + label,\n",
|
|
".xr-index-data-in + label {\n",
|
|
" padding: 0 1px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
|
|
".xr-var-data-in:checked ~ .xr-var-data,\n",
|
|
".xr-index-data-in:checked ~ .xr-index-data {\n",
|
|
" display: block;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-data > table {\n",
|
|
" float: right;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-data > pre,\n",
|
|
".xr-index-data > pre,\n",
|
|
".xr-var-data > table > tbody > tr {\n",
|
|
" background-color: transparent !important;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-name span,\n",
|
|
".xr-var-data,\n",
|
|
".xr-index-name div,\n",
|
|
".xr-index-data,\n",
|
|
".xr-attrs {\n",
|
|
" padding-left: 25px !important;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-attrs,\n",
|
|
".xr-var-attrs,\n",
|
|
".xr-var-data,\n",
|
|
".xr-index-data {\n",
|
|
" grid-column: 1 / -1;\n",
|
|
"}\n",
|
|
"\n",
|
|
"dl.xr-attrs {\n",
|
|
" padding: 0;\n",
|
|
" margin: 0;\n",
|
|
" display: grid;\n",
|
|
" grid-template-columns: 125px auto;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-attrs dt,\n",
|
|
".xr-attrs dd {\n",
|
|
" padding: 0;\n",
|
|
" margin: 0;\n",
|
|
" float: left;\n",
|
|
" padding-right: 10px;\n",
|
|
" width: auto;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-attrs dt {\n",
|
|
" font-weight: normal;\n",
|
|
" grid-column: 1;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-attrs dt:hover span {\n",
|
|
" display: inline-block;\n",
|
|
" background: var(--xr-background-color);\n",
|
|
" padding-right: 10px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-attrs dd {\n",
|
|
" grid-column: 2;\n",
|
|
" white-space: pre-wrap;\n",
|
|
" word-break: break-all;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-icon-database,\n",
|
|
".xr-icon-file-text2,\n",
|
|
".xr-no-icon {\n",
|
|
" display: inline-block;\n",
|
|
" vertical-align: middle;\n",
|
|
" width: 1em;\n",
|
|
" height: 1.5em !important;\n",
|
|
" stroke-width: 0;\n",
|
|
" stroke: currentColor;\n",
|
|
" fill: currentColor;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-attrs-in:checked + label > .xr-icon-file-text2,\n",
|
|
".xr-var-data-in:checked + label > .xr-icon-database,\n",
|
|
".xr-index-data-in:checked + label > .xr-icon-database {\n",
|
|
" color: var(--xr-font-color0);\n",
|
|
" filter: drop-shadow(1px 1px 5px var(--xr-font-color2));\n",
|
|
" stroke-width: 0.8px;\n",
|
|
"}\n",
|
|
"</style><pre class='xr-text-repr-fallback'><xarray.Dataset> Size: 4kB\n",
|
|
"Dimensions: (y: 6, x: 10, time: 6)\n",
|
|
"Coordinates:\n",
|
|
" * y (y) float64 48B 1.072e+06 1.07e+06 ... 1.068e+06 1.066e+06\n",
|
|
" * x (x) float64 80B 5.945e+05 5.955e+05 ... 6.025e+05 6.035e+05\n",
|
|
" spatial_ref int32 4B 32648\n",
|
|
" * time (time) datetime64[ns] 48B 2022-09-02T03:15:31.024000 ... 202...\n",
|
|
"Data variables:\n",
|
|
" red (time, y, x) float32 1kB dask.array<chunksize=(1, 6, 10), meta=np.ndarray>\n",
|
|
" nir (time, y, x) float32 1kB dask.array<chunksize=(1, 6, 10), meta=np.ndarray>\n",
|
|
" scl (time, y, x) float32 1kB dask.array<chunksize=(1, 6, 10), meta=np.ndarray></pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-5e5940cc-6260-4926-8f60-7930e7a85e2d' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-5e5940cc-6260-4926-8f60-7930e7a85e2d' class='xr-section-summary' title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>y</span>: 6</li><li><span class='xr-has-index'>x</span>: 10</li><li><span class='xr-has-index'>time</span>: 6</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-8c3658ac-ec34-4eb0-b0ce-4b31855457af' class='xr-section-summary-in' type='checkbox' checked><label for='section-8c3658ac-ec34-4eb0-b0ce-4b31855457af' class='xr-section-summary' >Coordinates: <span>(4)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>y</span></div><div class='xr-var-dims'>(y)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>1.072e+06 1.07e+06 ... 1.066e+06</div><input id='attrs-3abce4b8-c912-427a-97fb-0c82851e11aa' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-3abce4b8-c912-427a-97fb-0c82851e11aa' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-64d5a5ff-db48-4197-a5a6-eeac1e5f5ff3' class='xr-var-data-in' type='checkbox'><label for='data-64d5a5ff-db48-4197-a5a6-eeac1e5f5ff3' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>units :</span></dt><dd>metre</dd><dt><span>resolution :</span></dt><dd>-1000.0</dd><dt><span>crs :</span></dt><dd>EPSG:32648</dd></dl></div><div class='xr-var-data'><pre>array([1071500., 1070500., 1069500., 1068500., 1067500., 1066500.])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>x</span></div><div class='xr-var-dims'>(x)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>5.945e+05 5.955e+05 ... 6.035e+05</div><input id='attrs-d6f4d2a0-753f-43ca-a800-0dccd9b0e7f2' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-d6f4d2a0-753f-43ca-a800-0dccd9b0e7f2' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-86e87e8f-3c8d-4d14-84db-c5a483ebb24d' class='xr-var-data-in' type='checkbox'><label for='data-86e87e8f-3c8d-4d14-84db-c5a483ebb24d' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>units :</span></dt><dd>metre</dd><dt><span>resolution :</span></dt><dd>1000.0</dd><dt><span>crs :</span></dt><dd>EPSG:32648</dd></dl></div><div class='xr-var-data'><pre>array([594500., 595500., 596500., 597500., 598500., 599500., 600500., 601500.,\n",
|
|
" 602500., 603500.])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>spatial_ref</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int32</div><div class='xr-var-preview xr-preview'>32648</div><input id='attrs-525f22dd-2fd7-4230-a624-efcc08232398' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-525f22dd-2fd7-4230-a624-efcc08232398' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-dd36df29-ca30-42f1-821f-6412616aa5ec' class='xr-var-data-in' type='checkbox'><label for='data-dd36df29-ca30-42f1-821f-6412616aa5ec' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>spatial_ref :</span></dt><dd>PROJCRS["WGS 84 / UTM zone 48N",BASEGEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]],CONVERSION["UTM zone 48N",METHOD["Transverse Mercator",ID["EPSG",9807]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",105,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Scale factor at natural origin",0.9996,SCALEUNIT["unity",1],ID["EPSG",8805]],PARAMETER["False easting",500000,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Navigation and medium accuracy spatial referencing."],AREA["Between 102°E and 108°E, northern hemisphere between equator and 84°N, onshore and offshore. Cambodia. China. Indonesia. Laos. Malaysia - West Malaysia. Mongolia. Russian Federation. Singapore. Thailand. Vietnam."],BBOX[0,102,84,108]],ID["EPSG",32648]]</dd><dt><span>crs_wkt :</span></dt><dd>PROJCRS["WGS 84 / UTM zone 48N",BASEGEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]],CONVERSION["UTM zone 48N",METHOD["Transverse Mercator",ID["EPSG",9807]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",105,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Scale factor at natural origin",0.9996,SCALEUNIT["unity",1],ID["EPSG",8805]],PARAMETER["False easting",500000,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Navigation and medium accuracy spatial referencing."],AREA["Between 102°E and 108°E, northern hemisphere between equator and 84°N, onshore and offshore. Cambodia. China. Indonesia. Laos. Malaysia - West Malaysia. Mongolia. Russian Federation. Singapore. Thailand. Vietnam."],BBOX[0,102,84,108]],ID["EPSG",32648]]</dd><dt><span>semi_major_axis :</span></dt><dd>6378137.0</dd><dt><span>semi_minor_axis :</span></dt><dd>6356752.314245179</dd><dt><span>inverse_flattening :</span></dt><dd>298.257223563</dd><dt><span>reference_ellipsoid_name :</span></dt><dd>WGS 84</dd><dt><span>longitude_of_prime_meridian :</span></dt><dd>0.0</dd><dt><span>prime_meridian_name :</span></dt><dd>Greenwich</dd><dt><span>geographic_crs_name :</span></dt><dd>WGS 84</dd><dt><span>horizontal_datum_name :</span></dt><dd>World Geodetic System 1984 ensemble</dd><dt><span>projected_crs_name :</span></dt><dd>WGS 84 / UTM zone 48N</dd><dt><span>grid_mapping_name :</span></dt><dd>transverse_mercator</dd><dt><span>latitude_of_projection_origin :</span></dt><dd>0.0</dd><dt><span>longitude_of_central_meridian :</span></dt><dd>105.0</dd><dt><span>false_easting :</span></dt><dd>500000.0</dd><dt><span>false_northing :</span></dt><dd>0.0</dd><dt><span>scale_factor_at_central_meridian :</span></dt><dd>0.9996</dd><dt><span>GeoTransform :</span></dt><dd>594000 1000 0 1072000 0 -1000</dd></dl></div><div class='xr-var-data'><pre>array(32648, dtype=int32)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>time</span></div><div class='xr-var-dims'>(time)</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>2022-09-02T03:15:31.024000 ... 2...</div><input id='attrs-6c1cadb4-12ec-43af-9d7c-27c62cf69d1e' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-6c1cadb4-12ec-43af-9d7c-27c62cf69d1e' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-057968b9-4169-438a-b7e9-92da4efad073' class='xr-var-data-in' type='checkbox'><label for='data-057968b9-4169-438a-b7e9-92da4efad073' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(['2022-09-02T03:15:31.024000000', '2022-09-07T03:15:19.024000000',\n",
|
|
" '2022-09-12T03:15:31.025000000', '2022-09-17T03:15:19.024000000',\n",
|
|
" '2022-09-22T03:15:31.024000000', '2022-09-27T03:15:19.024000000'],\n",
|
|
" dtype='datetime64[ns]')</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-807fa7a4-040d-45ef-83be-8ffad448e91b' class='xr-section-summary-in' type='checkbox' checked><label for='section-807fa7a4-040d-45ef-83be-8ffad448e91b' class='xr-section-summary' >Data variables: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>red</span></div><div class='xr-var-dims'>(time, y, x)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>dask.array<chunksize=(1, 6, 10), meta=np.ndarray></div><input id='attrs-1d8e40d1-ef64-49cc-8dbb-4403d1176c2c' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-1d8e40d1-ef64-49cc-8dbb-4403d1176c2c' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-02d3e747-7387-4127-a3b5-e9c0690abfe5' class='xr-var-data-in' type='checkbox'><label for='data-02d3e747-7387-4127-a3b5-e9c0690abfe5' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><table>\n",
|
|
" <tr>\n",
|
|
" <td>\n",
|
|
" <table style=\"border-collapse: collapse;\">\n",
|
|
" <thead>\n",
|
|
" <tr>\n",
|
|
" <td> </td>\n",
|
|
" <th> Array </th>\n",
|
|
" <th> Chunk </th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" \n",
|
|
" <tr>\n",
|
|
" <th> Bytes </th>\n",
|
|
" <td> 1.41 kiB </td>\n",
|
|
" <td> 240 B </td>\n",
|
|
" </tr>\n",
|
|
" \n",
|
|
" <tr>\n",
|
|
" <th> Shape </th>\n",
|
|
" <td> (6, 6, 10) </td>\n",
|
|
" <td> (1, 6, 10) </td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th> Dask graph </th>\n",
|
|
" <td colspan=\"2\"> 6 chunks in 3 graph layers </td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th> Data type </th>\n",
|
|
" <td colspan=\"2\"> float32 numpy.ndarray </td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
" </table>\n",
|
|
" </td>\n",
|
|
" <td>\n",
|
|
" <svg width=\"222\" height=\"164\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n",
|
|
"\n",
|
|
" <!-- Horizontal lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"52\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"10\" y1=\"72\" x2=\"52\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Vertical lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"10\" y2=\"72\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"17\" y1=\"7\" x2=\"17\" y2=\"79\" />\n",
|
|
" <line x1=\"24\" y1=\"14\" x2=\"24\" y2=\"86\" />\n",
|
|
" <line x1=\"31\" y1=\"21\" x2=\"31\" y2=\"93\" />\n",
|
|
" <line x1=\"38\" y1=\"28\" x2=\"38\" y2=\"100\" />\n",
|
|
" <line x1=\"45\" y1=\"35\" x2=\"45\" y2=\"107\" />\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"52\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Colored Rectangle -->\n",
|
|
" <polygon points=\"10.0,0.0 52.35294117647059,42.35294117647059 52.35294117647059,114.35294117647058 10.0,72.0\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
|
|
"\n",
|
|
" <!-- Horizontal lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"130\" y2=\"0\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"17\" y1=\"7\" x2=\"137\" y2=\"7\" />\n",
|
|
" <line x1=\"24\" y1=\"14\" x2=\"144\" y2=\"14\" />\n",
|
|
" <line x1=\"31\" y1=\"21\" x2=\"151\" y2=\"21\" />\n",
|
|
" <line x1=\"38\" y1=\"28\" x2=\"158\" y2=\"28\" />\n",
|
|
" <line x1=\"45\" y1=\"35\" x2=\"165\" y2=\"35\" />\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"172\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Vertical lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"52\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"130\" y1=\"0\" x2=\"172\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Colored Rectangle -->\n",
|
|
" <polygon points=\"10.0,0.0 130.0,0.0 172.35294117647058,42.35294117647059 52.35294117647059,42.35294117647059\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
|
|
"\n",
|
|
" <!-- Horizontal lines -->\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"172\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"52\" y1=\"114\" x2=\"172\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Vertical lines -->\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"52\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"172\" y1=\"42\" x2=\"172\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Colored Rectangle -->\n",
|
|
" <polygon points=\"52.35294117647059,42.35294117647059 172.35294117647058,42.35294117647059 172.35294117647058,114.35294117647058 52.35294117647059,114.35294117647058\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
|
|
"\n",
|
|
" <!-- Text -->\n",
|
|
" <text x=\"112.352941\" y=\"134.352941\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >10</text>\n",
|
|
" <text x=\"192.352941\" y=\"78.352941\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(0,192.352941,78.352941)\">6</text>\n",
|
|
" <text x=\"21.176471\" y=\"113.176471\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(45,21.176471,113.176471)\">6</text>\n",
|
|
"</svg>\n",
|
|
" </td>\n",
|
|
" </tr>\n",
|
|
"</table></div></li><li class='xr-var-item'><div class='xr-var-name'><span>nir</span></div><div class='xr-var-dims'>(time, y, x)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>dask.array<chunksize=(1, 6, 10), meta=np.ndarray></div><input id='attrs-a2c932d2-3afb-4e73-8ffc-2be2261c28a4' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-a2c932d2-3afb-4e73-8ffc-2be2261c28a4' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-c333f2da-7b96-46fc-b264-be65805e2f2b' class='xr-var-data-in' type='checkbox'><label for='data-c333f2da-7b96-46fc-b264-be65805e2f2b' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><table>\n",
|
|
" <tr>\n",
|
|
" <td>\n",
|
|
" <table style=\"border-collapse: collapse;\">\n",
|
|
" <thead>\n",
|
|
" <tr>\n",
|
|
" <td> </td>\n",
|
|
" <th> Array </th>\n",
|
|
" <th> Chunk </th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" \n",
|
|
" <tr>\n",
|
|
" <th> Bytes </th>\n",
|
|
" <td> 1.41 kiB </td>\n",
|
|
" <td> 240 B </td>\n",
|
|
" </tr>\n",
|
|
" \n",
|
|
" <tr>\n",
|
|
" <th> Shape </th>\n",
|
|
" <td> (6, 6, 10) </td>\n",
|
|
" <td> (1, 6, 10) </td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th> Dask graph </th>\n",
|
|
" <td colspan=\"2\"> 6 chunks in 3 graph layers </td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th> Data type </th>\n",
|
|
" <td colspan=\"2\"> float32 numpy.ndarray </td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
" </table>\n",
|
|
" </td>\n",
|
|
" <td>\n",
|
|
" <svg width=\"222\" height=\"164\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n",
|
|
"\n",
|
|
" <!-- Horizontal lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"52\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"10\" y1=\"72\" x2=\"52\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Vertical lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"10\" y2=\"72\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"17\" y1=\"7\" x2=\"17\" y2=\"79\" />\n",
|
|
" <line x1=\"24\" y1=\"14\" x2=\"24\" y2=\"86\" />\n",
|
|
" <line x1=\"31\" y1=\"21\" x2=\"31\" y2=\"93\" />\n",
|
|
" <line x1=\"38\" y1=\"28\" x2=\"38\" y2=\"100\" />\n",
|
|
" <line x1=\"45\" y1=\"35\" x2=\"45\" y2=\"107\" />\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"52\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Colored Rectangle -->\n",
|
|
" <polygon points=\"10.0,0.0 52.35294117647059,42.35294117647059 52.35294117647059,114.35294117647058 10.0,72.0\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
|
|
"\n",
|
|
" <!-- Horizontal lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"130\" y2=\"0\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"17\" y1=\"7\" x2=\"137\" y2=\"7\" />\n",
|
|
" <line x1=\"24\" y1=\"14\" x2=\"144\" y2=\"14\" />\n",
|
|
" <line x1=\"31\" y1=\"21\" x2=\"151\" y2=\"21\" />\n",
|
|
" <line x1=\"38\" y1=\"28\" x2=\"158\" y2=\"28\" />\n",
|
|
" <line x1=\"45\" y1=\"35\" x2=\"165\" y2=\"35\" />\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"172\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Vertical lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"52\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"130\" y1=\"0\" x2=\"172\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Colored Rectangle -->\n",
|
|
" <polygon points=\"10.0,0.0 130.0,0.0 172.35294117647058,42.35294117647059 52.35294117647059,42.35294117647059\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
|
|
"\n",
|
|
" <!-- Horizontal lines -->\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"172\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"52\" y1=\"114\" x2=\"172\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Vertical lines -->\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"52\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"172\" y1=\"42\" x2=\"172\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Colored Rectangle -->\n",
|
|
" <polygon points=\"52.35294117647059,42.35294117647059 172.35294117647058,42.35294117647059 172.35294117647058,114.35294117647058 52.35294117647059,114.35294117647058\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
|
|
"\n",
|
|
" <!-- Text -->\n",
|
|
" <text x=\"112.352941\" y=\"134.352941\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >10</text>\n",
|
|
" <text x=\"192.352941\" y=\"78.352941\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(0,192.352941,78.352941)\">6</text>\n",
|
|
" <text x=\"21.176471\" y=\"113.176471\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(45,21.176471,113.176471)\">6</text>\n",
|
|
"</svg>\n",
|
|
" </td>\n",
|
|
" </tr>\n",
|
|
"</table></div></li><li class='xr-var-item'><div class='xr-var-name'><span>scl</span></div><div class='xr-var-dims'>(time, y, x)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>dask.array<chunksize=(1, 6, 10), meta=np.ndarray></div><input id='attrs-b151d8e0-aaac-4f48-904f-93895d2ac254' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-b151d8e0-aaac-4f48-904f-93895d2ac254' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-1dc069af-c877-4fbc-9f8a-d4db3783fcd9' class='xr-var-data-in' type='checkbox'><label for='data-1dc069af-c877-4fbc-9f8a-d4db3783fcd9' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><table>\n",
|
|
" <tr>\n",
|
|
" <td>\n",
|
|
" <table style=\"border-collapse: collapse;\">\n",
|
|
" <thead>\n",
|
|
" <tr>\n",
|
|
" <td> </td>\n",
|
|
" <th> Array </th>\n",
|
|
" <th> Chunk </th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" \n",
|
|
" <tr>\n",
|
|
" <th> Bytes </th>\n",
|
|
" <td> 1.41 kiB </td>\n",
|
|
" <td> 240 B </td>\n",
|
|
" </tr>\n",
|
|
" \n",
|
|
" <tr>\n",
|
|
" <th> Shape </th>\n",
|
|
" <td> (6, 6, 10) </td>\n",
|
|
" <td> (1, 6, 10) </td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th> Dask graph </th>\n",
|
|
" <td colspan=\"2\"> 6 chunks in 3 graph layers </td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th> Data type </th>\n",
|
|
" <td colspan=\"2\"> float32 numpy.ndarray </td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
" </table>\n",
|
|
" </td>\n",
|
|
" <td>\n",
|
|
" <svg width=\"222\" height=\"164\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n",
|
|
"\n",
|
|
" <!-- Horizontal lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"52\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"10\" y1=\"72\" x2=\"52\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Vertical lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"10\" y2=\"72\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"17\" y1=\"7\" x2=\"17\" y2=\"79\" />\n",
|
|
" <line x1=\"24\" y1=\"14\" x2=\"24\" y2=\"86\" />\n",
|
|
" <line x1=\"31\" y1=\"21\" x2=\"31\" y2=\"93\" />\n",
|
|
" <line x1=\"38\" y1=\"28\" x2=\"38\" y2=\"100\" />\n",
|
|
" <line x1=\"45\" y1=\"35\" x2=\"45\" y2=\"107\" />\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"52\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Colored Rectangle -->\n",
|
|
" <polygon points=\"10.0,0.0 52.35294117647059,42.35294117647059 52.35294117647059,114.35294117647058 10.0,72.0\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
|
|
"\n",
|
|
" <!-- Horizontal lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"130\" y2=\"0\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"17\" y1=\"7\" x2=\"137\" y2=\"7\" />\n",
|
|
" <line x1=\"24\" y1=\"14\" x2=\"144\" y2=\"14\" />\n",
|
|
" <line x1=\"31\" y1=\"21\" x2=\"151\" y2=\"21\" />\n",
|
|
" <line x1=\"38\" y1=\"28\" x2=\"158\" y2=\"28\" />\n",
|
|
" <line x1=\"45\" y1=\"35\" x2=\"165\" y2=\"35\" />\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"172\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Vertical lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"52\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"130\" y1=\"0\" x2=\"172\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Colored Rectangle -->\n",
|
|
" <polygon points=\"10.0,0.0 130.0,0.0 172.35294117647058,42.35294117647059 52.35294117647059,42.35294117647059\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
|
|
"\n",
|
|
" <!-- Horizontal lines -->\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"172\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"52\" y1=\"114\" x2=\"172\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Vertical lines -->\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"52\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"172\" y1=\"42\" x2=\"172\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Colored Rectangle -->\n",
|
|
" <polygon points=\"52.35294117647059,42.35294117647059 172.35294117647058,42.35294117647059 172.35294117647058,114.35294117647058 52.35294117647059,114.35294117647058\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
|
|
"\n",
|
|
" <!-- Text -->\n",
|
|
" <text x=\"112.352941\" y=\"134.352941\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >10</text>\n",
|
|
" <text x=\"192.352941\" y=\"78.352941\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(0,192.352941,78.352941)\">6</text>\n",
|
|
" <text x=\"21.176471\" y=\"113.176471\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(45,21.176471,113.176471)\">6</text>\n",
|
|
"</svg>\n",
|
|
" </td>\n",
|
|
" </tr>\n",
|
|
"</table></div></li></ul></div></li><li class='xr-section-item'><input id='section-557d3116-878b-4b1c-bbb3-3dd2a64acbaa' class='xr-section-summary-in' type='checkbox' ><label for='section-557d3116-878b-4b1c-bbb3-3dd2a64acbaa' class='xr-section-summary' >Indexes: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-index-name'><div>y</div></div><div class='xr-index-preview'>PandasIndex</div><input type='checkbox' disabled/><label></label><input id='index-c2b8e912-19ed-4f14-bc54-fa143de5e375' class='xr-index-data-in' type='checkbox'/><label for='index-c2b8e912-19ed-4f14-bc54-fa143de5e375' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Index([1071500.0, 1070500.0, 1069500.0, 1068500.0, 1067500.0, 1066500.0], dtype='float64', name='y'))</pre></div></li><li class='xr-var-item'><div class='xr-index-name'><div>x</div></div><div class='xr-index-preview'>PandasIndex</div><input type='checkbox' disabled/><label></label><input id='index-fbb70cbd-4451-42a5-b588-1fbbf323fd70' class='xr-index-data-in' type='checkbox'/><label for='index-fbb70cbd-4451-42a5-b588-1fbbf323fd70' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Index([594500.0, 595500.0, 596500.0, 597500.0, 598500.0, 599500.0, 600500.0,\n",
|
|
" 601500.0, 602500.0, 603500.0],\n",
|
|
" dtype='float64', name='x'))</pre></div></li><li class='xr-var-item'><div class='xr-index-name'><div>time</div></div><div class='xr-index-preview'>PandasIndex</div><input type='checkbox' disabled/><label></label><input id='index-4fa09ba7-619b-4090-bd4a-1839ef31a9ca' class='xr-index-data-in' type='checkbox'/><label for='index-4fa09ba7-619b-4090-bd4a-1839ef31a9ca' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(DatetimeIndex(['2022-09-02 03:15:31.024000', '2022-09-07 03:15:19.024000',\n",
|
|
" '2022-09-12 03:15:31.025000', '2022-09-17 03:15:19.024000',\n",
|
|
" '2022-09-22 03:15:31.024000', '2022-09-27 03:15:19.024000'],\n",
|
|
" dtype='datetime64[ns]', name='time', freq=None))</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-d028cb14-3db7-441b-bd73-02f47d9e4cee' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-d028cb14-3db7-441b-bd73-02f47d9e4cee' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
|
|
],
|
|
"text/plain": [
|
|
"<xarray.Dataset> Size: 4kB\n",
|
|
"Dimensions: (y: 6, x: 10, time: 6)\n",
|
|
"Coordinates:\n",
|
|
" * y (y) float64 48B 1.072e+06 1.07e+06 ... 1.068e+06 1.066e+06\n",
|
|
" * x (x) float64 80B 5.945e+05 5.955e+05 ... 6.025e+05 6.035e+05\n",
|
|
" spatial_ref int32 4B 32648\n",
|
|
" * time (time) datetime64[ns] 48B 2022-09-02T03:15:31.024000 ... 202...\n",
|
|
"Data variables:\n",
|
|
" red (time, y, x) float32 1kB dask.array<chunksize=(1, 6, 10), meta=np.ndarray>\n",
|
|
" nir (time, y, x) float32 1kB dask.array<chunksize=(1, 6, 10), meta=np.ndarray>\n",
|
|
" scl (time, y, x) float32 1kB dask.array<chunksize=(1, 6, 10), meta=np.ndarray>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"## truy vấn ảnh vệ tinh sen2\n",
|
|
"data = load_data(None, date_range, longtitude_range, latitude_range)\n",
|
|
"notebook_utils.heading(notebook_utils.xarray_object_size(data))\n",
|
|
"display(data)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"id": "2f6938b6-82e2-4916-bc1d-719c169e25e4",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:17.063535Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:17.063371Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:29.263398Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:29.262733Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stderr",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"/home/x79/miniconda3/envs/env_01/lib/python3.10/site-packages/rasterio/warp.py:387: NotGeoreferencedWarning: Dataset has no geotransform, gcps, or rpcs. The identity matrix will be returned.\n",
|
|
" dest = _reproject(\n"
|
|
]
|
|
},
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"CPU times: user 2.89 s, sys: 105 ms, total: 2.99 s\n",
|
|
"Wall time: 12.2 s\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"%%time\n",
|
|
"# Tiến hành loại bỏ các vị trí bị mây ảnh hưởng\n",
|
|
"result = mask_clean(data)\n",
|
|
"# progress(result)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"id": "435f9f78-a9a4-4226-86ca-d4bec42d454e",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:29.265197Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:29.265029Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:29.282456Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:29.281314Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
|
|
"<defs>\n",
|
|
"<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
|
|
"<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
|
|
"<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
|
|
"<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
|
|
"</symbol>\n",
|
|
"<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
|
|
"<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
|
|
"<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
|
|
"<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
|
|
"<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
|
|
"</symbol>\n",
|
|
"</defs>\n",
|
|
"</svg>\n",
|
|
"<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
|
|
" *\n",
|
|
" */\n",
|
|
"\n",
|
|
":root {\n",
|
|
" --xr-font-color0: var(\n",
|
|
" --jp-content-font-color0,\n",
|
|
" var(--pst-color-text-base rgba(0, 0, 0, 1))\n",
|
|
" );\n",
|
|
" --xr-font-color2: var(\n",
|
|
" --jp-content-font-color2,\n",
|
|
" var(--pst-color-text-base, rgba(0, 0, 0, 0.54))\n",
|
|
" );\n",
|
|
" --xr-font-color3: var(\n",
|
|
" --jp-content-font-color3,\n",
|
|
" var(--pst-color-text-base, rgba(0, 0, 0, 0.38))\n",
|
|
" );\n",
|
|
" --xr-border-color: var(\n",
|
|
" --jp-border-color2,\n",
|
|
" hsl(from var(--pst-color-on-background, white) h s calc(l - 10))\n",
|
|
" );\n",
|
|
" --xr-disabled-color: var(\n",
|
|
" --jp-layout-color3,\n",
|
|
" hsl(from var(--pst-color-on-background, white) h s calc(l - 40))\n",
|
|
" );\n",
|
|
" --xr-background-color: var(\n",
|
|
" --jp-layout-color0,\n",
|
|
" var(--pst-color-on-background, white)\n",
|
|
" );\n",
|
|
" --xr-background-color-row-even: var(\n",
|
|
" --jp-layout-color1,\n",
|
|
" hsl(from var(--pst-color-on-background, white) h s calc(l - 5))\n",
|
|
" );\n",
|
|
" --xr-background-color-row-odd: var(\n",
|
|
" --jp-layout-color2,\n",
|
|
" hsl(from var(--pst-color-on-background, white) h s calc(l - 15))\n",
|
|
" );\n",
|
|
"}\n",
|
|
"\n",
|
|
"html[theme=\"dark\"],\n",
|
|
"html[data-theme=\"dark\"],\n",
|
|
"body[data-theme=\"dark\"],\n",
|
|
"body.vscode-dark {\n",
|
|
" --xr-font-color0: var(\n",
|
|
" --jp-content-font-color0,\n",
|
|
" var(--pst-color-text-base, rgba(255, 255, 255, 1))\n",
|
|
" );\n",
|
|
" --xr-font-color2: var(\n",
|
|
" --jp-content-font-color2,\n",
|
|
" var(--pst-color-text-base, rgba(255, 255, 255, 0.54))\n",
|
|
" );\n",
|
|
" --xr-font-color3: var(\n",
|
|
" --jp-content-font-color3,\n",
|
|
" var(--pst-color-text-base, rgba(255, 255, 255, 0.38))\n",
|
|
" );\n",
|
|
" --xr-border-color: var(\n",
|
|
" --jp-border-color2,\n",
|
|
" hsl(from var(--pst-color-on-background, #111111) h s calc(l + 10))\n",
|
|
" );\n",
|
|
" --xr-disabled-color: var(\n",
|
|
" --jp-layout-color3,\n",
|
|
" hsl(from var(--pst-color-on-background, #111111) h s calc(l + 40))\n",
|
|
" );\n",
|
|
" --xr-background-color: var(\n",
|
|
" --jp-layout-color0,\n",
|
|
" var(--pst-color-on-background, #111111)\n",
|
|
" );\n",
|
|
" --xr-background-color-row-even: var(\n",
|
|
" --jp-layout-color1,\n",
|
|
" hsl(from var(--pst-color-on-background, #111111) h s calc(l + 5))\n",
|
|
" );\n",
|
|
" --xr-background-color-row-odd: var(\n",
|
|
" --jp-layout-color2,\n",
|
|
" hsl(from var(--pst-color-on-background, #111111) h s calc(l + 15))\n",
|
|
" );\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-wrap {\n",
|
|
" display: block !important;\n",
|
|
" min-width: 300px;\n",
|
|
" max-width: 700px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-text-repr-fallback {\n",
|
|
" /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
|
|
" display: none;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-header {\n",
|
|
" padding-top: 6px;\n",
|
|
" padding-bottom: 6px;\n",
|
|
" margin-bottom: 4px;\n",
|
|
" border-bottom: solid 1px var(--xr-border-color);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-header > div,\n",
|
|
".xr-header > ul {\n",
|
|
" display: inline;\n",
|
|
" margin-top: 0;\n",
|
|
" margin-bottom: 0;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-obj-type,\n",
|
|
".xr-array-name {\n",
|
|
" margin-left: 2px;\n",
|
|
" margin-right: 10px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-obj-type {\n",
|
|
" color: var(--xr-font-color2);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-sections {\n",
|
|
" padding-left: 0 !important;\n",
|
|
" display: grid;\n",
|
|
" grid-template-columns: 150px auto auto 1fr 0 20px 0 20px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-item {\n",
|
|
" display: contents;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-item input {\n",
|
|
" display: inline-block;\n",
|
|
" opacity: 0;\n",
|
|
" height: 0;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-item input + label {\n",
|
|
" color: var(--xr-disabled-color);\n",
|
|
" border: 2px solid transparent !important;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-item input:enabled + label {\n",
|
|
" cursor: pointer;\n",
|
|
" color: var(--xr-font-color2);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-item input:focus + label {\n",
|
|
" border: 2px solid var(--xr-font-color0) !important;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-item input:enabled + label:hover {\n",
|
|
" color: var(--xr-font-color0);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary {\n",
|
|
" grid-column: 1;\n",
|
|
" color: var(--xr-font-color2);\n",
|
|
" font-weight: 500;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary > span {\n",
|
|
" display: inline-block;\n",
|
|
" padding-left: 0.5em;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary-in:disabled + label {\n",
|
|
" color: var(--xr-font-color2);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary-in + label:before {\n",
|
|
" display: inline-block;\n",
|
|
" content: \"►\";\n",
|
|
" font-size: 11px;\n",
|
|
" width: 15px;\n",
|
|
" text-align: center;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary-in:disabled + label:before {\n",
|
|
" color: var(--xr-disabled-color);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary-in:checked + label:before {\n",
|
|
" content: \"▼\";\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary-in:checked + label > span {\n",
|
|
" display: none;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary,\n",
|
|
".xr-section-inline-details {\n",
|
|
" padding-top: 4px;\n",
|
|
" padding-bottom: 4px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-inline-details {\n",
|
|
" grid-column: 2 / -1;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-details {\n",
|
|
" display: none;\n",
|
|
" grid-column: 1 / -1;\n",
|
|
" margin-bottom: 5px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-section-summary-in:checked ~ .xr-section-details {\n",
|
|
" display: contents;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-array-wrap {\n",
|
|
" grid-column: 1 / -1;\n",
|
|
" display: grid;\n",
|
|
" grid-template-columns: 20px auto;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-array-wrap > label {\n",
|
|
" grid-column: 1;\n",
|
|
" vertical-align: top;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-preview {\n",
|
|
" color: var(--xr-font-color3);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-array-preview,\n",
|
|
".xr-array-data {\n",
|
|
" padding: 0 5px !important;\n",
|
|
" grid-column: 2;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-array-data,\n",
|
|
".xr-array-in:checked ~ .xr-array-preview {\n",
|
|
" display: none;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-array-in:checked ~ .xr-array-data,\n",
|
|
".xr-array-preview {\n",
|
|
" display: inline-block;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-dim-list {\n",
|
|
" display: inline-block !important;\n",
|
|
" list-style: none;\n",
|
|
" padding: 0 !important;\n",
|
|
" margin: 0;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-dim-list li {\n",
|
|
" display: inline-block;\n",
|
|
" padding: 0;\n",
|
|
" margin: 0;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-dim-list:before {\n",
|
|
" content: \"(\";\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-dim-list:after {\n",
|
|
" content: \")\";\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-dim-list li:not(:last-child):after {\n",
|
|
" content: \",\";\n",
|
|
" padding-right: 5px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-has-index {\n",
|
|
" font-weight: bold;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-list,\n",
|
|
".xr-var-item {\n",
|
|
" display: contents;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-item > div,\n",
|
|
".xr-var-item label,\n",
|
|
".xr-var-item > .xr-var-name span {\n",
|
|
" background-color: var(--xr-background-color-row-even);\n",
|
|
" border-color: var(--xr-background-color-row-odd);\n",
|
|
" margin-bottom: 0;\n",
|
|
" padding-top: 2px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-item > .xr-var-name:hover span {\n",
|
|
" padding-right: 5px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-list > li:nth-child(odd) > div,\n",
|
|
".xr-var-list > li:nth-child(odd) > label,\n",
|
|
".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
|
|
" background-color: var(--xr-background-color-row-odd);\n",
|
|
" border-color: var(--xr-background-color-row-even);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-name {\n",
|
|
" grid-column: 1;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-dims {\n",
|
|
" grid-column: 2;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-dtype {\n",
|
|
" grid-column: 3;\n",
|
|
" text-align: right;\n",
|
|
" color: var(--xr-font-color2);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-preview {\n",
|
|
" grid-column: 4;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-index-preview {\n",
|
|
" grid-column: 2 / 5;\n",
|
|
" color: var(--xr-font-color2);\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-name,\n",
|
|
".xr-var-dims,\n",
|
|
".xr-var-dtype,\n",
|
|
".xr-preview,\n",
|
|
".xr-attrs dt {\n",
|
|
" white-space: nowrap;\n",
|
|
" overflow: hidden;\n",
|
|
" text-overflow: ellipsis;\n",
|
|
" padding-right: 10px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-name:hover,\n",
|
|
".xr-var-dims:hover,\n",
|
|
".xr-var-dtype:hover,\n",
|
|
".xr-attrs dt:hover {\n",
|
|
" overflow: visible;\n",
|
|
" width: auto;\n",
|
|
" z-index: 1;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-attrs,\n",
|
|
".xr-var-data,\n",
|
|
".xr-index-data {\n",
|
|
" display: none;\n",
|
|
" border-top: 2px dotted var(--xr-background-color);\n",
|
|
" padding-bottom: 20px !important;\n",
|
|
" padding-top: 10px !important;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-attrs-in + label,\n",
|
|
".xr-var-data-in + label,\n",
|
|
".xr-index-data-in + label {\n",
|
|
" padding: 0 1px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
|
|
".xr-var-data-in:checked ~ .xr-var-data,\n",
|
|
".xr-index-data-in:checked ~ .xr-index-data {\n",
|
|
" display: block;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-data > table {\n",
|
|
" float: right;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-data > pre,\n",
|
|
".xr-index-data > pre,\n",
|
|
".xr-var-data > table > tbody > tr {\n",
|
|
" background-color: transparent !important;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-name span,\n",
|
|
".xr-var-data,\n",
|
|
".xr-index-name div,\n",
|
|
".xr-index-data,\n",
|
|
".xr-attrs {\n",
|
|
" padding-left: 25px !important;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-attrs,\n",
|
|
".xr-var-attrs,\n",
|
|
".xr-var-data,\n",
|
|
".xr-index-data {\n",
|
|
" grid-column: 1 / -1;\n",
|
|
"}\n",
|
|
"\n",
|
|
"dl.xr-attrs {\n",
|
|
" padding: 0;\n",
|
|
" margin: 0;\n",
|
|
" display: grid;\n",
|
|
" grid-template-columns: 125px auto;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-attrs dt,\n",
|
|
".xr-attrs dd {\n",
|
|
" padding: 0;\n",
|
|
" margin: 0;\n",
|
|
" float: left;\n",
|
|
" padding-right: 10px;\n",
|
|
" width: auto;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-attrs dt {\n",
|
|
" font-weight: normal;\n",
|
|
" grid-column: 1;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-attrs dt:hover span {\n",
|
|
" display: inline-block;\n",
|
|
" background: var(--xr-background-color);\n",
|
|
" padding-right: 10px;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-attrs dd {\n",
|
|
" grid-column: 2;\n",
|
|
" white-space: pre-wrap;\n",
|
|
" word-break: break-all;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-icon-database,\n",
|
|
".xr-icon-file-text2,\n",
|
|
".xr-no-icon {\n",
|
|
" display: inline-block;\n",
|
|
" vertical-align: middle;\n",
|
|
" width: 1em;\n",
|
|
" height: 1.5em !important;\n",
|
|
" stroke-width: 0;\n",
|
|
" stroke: currentColor;\n",
|
|
" fill: currentColor;\n",
|
|
"}\n",
|
|
"\n",
|
|
".xr-var-attrs-in:checked + label > .xr-icon-file-text2,\n",
|
|
".xr-var-data-in:checked + label > .xr-icon-database,\n",
|
|
".xr-index-data-in:checked + label > .xr-icon-database {\n",
|
|
" color: var(--xr-font-color0);\n",
|
|
" filter: drop-shadow(1px 1px 5px var(--xr-font-color2));\n",
|
|
" stroke-width: 0.8px;\n",
|
|
"}\n",
|
|
"</style><pre class='xr-text-repr-fallback'><xarray.DataArray 'NDVI' (time: 6, y: 6, x: 10)> Size: 1kB\n",
|
|
"dask.array<truediv, shape=(6, 6, 10), dtype=float32, chunksize=(1, 6, 10), chunktype=numpy.ndarray>\n",
|
|
"Coordinates:\n",
|
|
" * y (y) float64 48B 1.072e+06 1.07e+06 ... 1.068e+06 1.066e+06\n",
|
|
" * x (x) float64 80B 5.945e+05 5.955e+05 ... 6.025e+05 6.035e+05\n",
|
|
" spatial_ref int32 4B 32648\n",
|
|
" * time (time) datetime64[ns] 48B 2022-09-02T03:15:31.024000 ... 202...</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'NDVI'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>time</span>: 6</li><li><span class='xr-has-index'>y</span>: 6</li><li><span class='xr-has-index'>x</span>: 10</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-bbfe8130-9160-4047-aafd-1ff9e2f289e7' class='xr-array-in' type='checkbox' checked><label for='section-bbfe8130-9160-4047-aafd-1ff9e2f289e7' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>dask.array<chunksize=(1, 6, 10), meta=np.ndarray></span></div><div class='xr-array-data'><table>\n",
|
|
" <tr>\n",
|
|
" <td>\n",
|
|
" <table style=\"border-collapse: collapse;\">\n",
|
|
" <thead>\n",
|
|
" <tr>\n",
|
|
" <td> </td>\n",
|
|
" <th> Array </th>\n",
|
|
" <th> Chunk </th>\n",
|
|
" </tr>\n",
|
|
" </thead>\n",
|
|
" <tbody>\n",
|
|
" \n",
|
|
" <tr>\n",
|
|
" <th> Bytes </th>\n",
|
|
" <td> 1.41 kiB </td>\n",
|
|
" <td> 240 B </td>\n",
|
|
" </tr>\n",
|
|
" \n",
|
|
" <tr>\n",
|
|
" <th> Shape </th>\n",
|
|
" <td> (6, 6, 10) </td>\n",
|
|
" <td> (1, 6, 10) </td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th> Dask graph </th>\n",
|
|
" <td colspan=\"2\"> 6 chunks in 7 graph layers </td>\n",
|
|
" </tr>\n",
|
|
" <tr>\n",
|
|
" <th> Data type </th>\n",
|
|
" <td colspan=\"2\"> float32 numpy.ndarray </td>\n",
|
|
" </tr>\n",
|
|
" </tbody>\n",
|
|
" </table>\n",
|
|
" </td>\n",
|
|
" <td>\n",
|
|
" <svg width=\"222\" height=\"164\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n",
|
|
"\n",
|
|
" <!-- Horizontal lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"52\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"10\" y1=\"72\" x2=\"52\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Vertical lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"10\" y2=\"72\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"17\" y1=\"7\" x2=\"17\" y2=\"79\" />\n",
|
|
" <line x1=\"24\" y1=\"14\" x2=\"24\" y2=\"86\" />\n",
|
|
" <line x1=\"31\" y1=\"21\" x2=\"31\" y2=\"93\" />\n",
|
|
" <line x1=\"38\" y1=\"28\" x2=\"38\" y2=\"100\" />\n",
|
|
" <line x1=\"45\" y1=\"35\" x2=\"45\" y2=\"107\" />\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"52\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Colored Rectangle -->\n",
|
|
" <polygon points=\"10.0,0.0 52.35294117647059,42.35294117647059 52.35294117647059,114.35294117647058 10.0,72.0\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
|
|
"\n",
|
|
" <!-- Horizontal lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"130\" y2=\"0\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"17\" y1=\"7\" x2=\"137\" y2=\"7\" />\n",
|
|
" <line x1=\"24\" y1=\"14\" x2=\"144\" y2=\"14\" />\n",
|
|
" <line x1=\"31\" y1=\"21\" x2=\"151\" y2=\"21\" />\n",
|
|
" <line x1=\"38\" y1=\"28\" x2=\"158\" y2=\"28\" />\n",
|
|
" <line x1=\"45\" y1=\"35\" x2=\"165\" y2=\"35\" />\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"172\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Vertical lines -->\n",
|
|
" <line x1=\"10\" y1=\"0\" x2=\"52\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"130\" y1=\"0\" x2=\"172\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Colored Rectangle -->\n",
|
|
" <polygon points=\"10.0,0.0 130.0,0.0 172.35294117647058,42.35294117647059 52.35294117647059,42.35294117647059\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
|
|
"\n",
|
|
" <!-- Horizontal lines -->\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"172\" y2=\"42\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"52\" y1=\"114\" x2=\"172\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Vertical lines -->\n",
|
|
" <line x1=\"52\" y1=\"42\" x2=\"52\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
" <line x1=\"172\" y1=\"42\" x2=\"172\" y2=\"114\" style=\"stroke-width:2\" />\n",
|
|
"\n",
|
|
" <!-- Colored Rectangle -->\n",
|
|
" <polygon points=\"52.35294117647059,42.35294117647059 172.35294117647058,42.35294117647059 172.35294117647058,114.35294117647058 52.35294117647059,114.35294117647058\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
|
|
"\n",
|
|
" <!-- Text -->\n",
|
|
" <text x=\"112.352941\" y=\"134.352941\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >10</text>\n",
|
|
" <text x=\"192.352941\" y=\"78.352941\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(0,192.352941,78.352941)\">6</text>\n",
|
|
" <text x=\"21.176471\" y=\"113.176471\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(45,21.176471,113.176471)\">6</text>\n",
|
|
"</svg>\n",
|
|
" </td>\n",
|
|
" </tr>\n",
|
|
"</table></div></div></li><li class='xr-section-item'><input id='section-c71e3e24-f8ba-4b12-9b42-a1f914d14523' class='xr-section-summary-in' type='checkbox' checked><label for='section-c71e3e24-f8ba-4b12-9b42-a1f914d14523' class='xr-section-summary' >Coordinates: <span>(4)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>y</span></div><div class='xr-var-dims'>(y)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>1.072e+06 1.07e+06 ... 1.066e+06</div><input id='attrs-cb4e426a-2918-465d-9082-a21565614ed3' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-cb4e426a-2918-465d-9082-a21565614ed3' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-d0eeabed-e0aa-4f99-adba-ee825b68a56a' class='xr-var-data-in' type='checkbox'><label for='data-d0eeabed-e0aa-4f99-adba-ee825b68a56a' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>units :</span></dt><dd>metre</dd><dt><span>resolution :</span></dt><dd>-1000.0</dd><dt><span>crs :</span></dt><dd>EPSG:32648</dd></dl></div><div class='xr-var-data'><pre>array([1071500., 1070500., 1069500., 1068500., 1067500., 1066500.])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>x</span></div><div class='xr-var-dims'>(x)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>5.945e+05 5.955e+05 ... 6.035e+05</div><input id='attrs-f86a5adc-cb16-484e-9712-a52b5b3f42f7' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-f86a5adc-cb16-484e-9712-a52b5b3f42f7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-678fe178-7ad1-437d-8bc0-6a84839d3161' class='xr-var-data-in' type='checkbox'><label for='data-678fe178-7ad1-437d-8bc0-6a84839d3161' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>units :</span></dt><dd>metre</dd><dt><span>resolution :</span></dt><dd>1000.0</dd><dt><span>crs :</span></dt><dd>EPSG:32648</dd></dl></div><div class='xr-var-data'><pre>array([594500., 595500., 596500., 597500., 598500., 599500., 600500., 601500.,\n",
|
|
" 602500., 603500.])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>spatial_ref</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>int32</div><div class='xr-var-preview xr-preview'>32648</div><input id='attrs-c991a2d4-3bb5-49d6-94ca-62e0ec43f035' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-c991a2d4-3bb5-49d6-94ca-62e0ec43f035' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-e83f7878-40ea-4b7f-9c15-98507aa18318' class='xr-var-data-in' type='checkbox'><label for='data-e83f7878-40ea-4b7f-9c15-98507aa18318' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>spatial_ref :</span></dt><dd>PROJCRS["WGS 84 / UTM zone 48N",BASEGEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]],CONVERSION["UTM zone 48N",METHOD["Transverse Mercator",ID["EPSG",9807]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",105,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Scale factor at natural origin",0.9996,SCALEUNIT["unity",1],ID["EPSG",8805]],PARAMETER["False easting",500000,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Navigation and medium accuracy spatial referencing."],AREA["Between 102°E and 108°E, northern hemisphere between equator and 84°N, onshore and offshore. Cambodia. China. Indonesia. Laos. Malaysia - West Malaysia. Mongolia. Russian Federation. Singapore. Thailand. Vietnam."],BBOX[0,102,84,108]],ID["EPSG",32648]]</dd><dt><span>crs_wkt :</span></dt><dd>PROJCRS["WGS 84 / UTM zone 48N",BASEGEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4326]],CONVERSION["UTM zone 48N",METHOD["Transverse Mercator",ID["EPSG",9807]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",105,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Scale factor at natural origin",0.9996,SCALEUNIT["unity",1],ID["EPSG",8805]],PARAMETER["False easting",500000,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Navigation and medium accuracy spatial referencing."],AREA["Between 102°E and 108°E, northern hemisphere between equator and 84°N, onshore and offshore. Cambodia. China. Indonesia. Laos. Malaysia - West Malaysia. Mongolia. Russian Federation. Singapore. Thailand. Vietnam."],BBOX[0,102,84,108]],ID["EPSG",32648]]</dd><dt><span>semi_major_axis :</span></dt><dd>6378137.0</dd><dt><span>semi_minor_axis :</span></dt><dd>6356752.314245179</dd><dt><span>inverse_flattening :</span></dt><dd>298.257223563</dd><dt><span>reference_ellipsoid_name :</span></dt><dd>WGS 84</dd><dt><span>longitude_of_prime_meridian :</span></dt><dd>0.0</dd><dt><span>prime_meridian_name :</span></dt><dd>Greenwich</dd><dt><span>geographic_crs_name :</span></dt><dd>WGS 84</dd><dt><span>horizontal_datum_name :</span></dt><dd>World Geodetic System 1984 ensemble</dd><dt><span>projected_crs_name :</span></dt><dd>WGS 84 / UTM zone 48N</dd><dt><span>grid_mapping_name :</span></dt><dd>transverse_mercator</dd><dt><span>latitude_of_projection_origin :</span></dt><dd>0.0</dd><dt><span>longitude_of_central_meridian :</span></dt><dd>105.0</dd><dt><span>false_easting :</span></dt><dd>500000.0</dd><dt><span>false_northing :</span></dt><dd>0.0</dd><dt><span>scale_factor_at_central_meridian :</span></dt><dd>0.9996</dd><dt><span>GeoTransform :</span></dt><dd>594000 1000 0 1072000 0 -1000</dd></dl></div><div class='xr-var-data'><pre>array(32648, dtype=int32)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>time</span></div><div class='xr-var-dims'>(time)</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>2022-09-02T03:15:31.024000 ... 2...</div><input id='attrs-11fd052d-bdb3-43ba-87e1-e1d47822df0d' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-11fd052d-bdb3-43ba-87e1-e1d47822df0d' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-fd3631ab-352e-4567-ad0a-ca92fb7c1d2f' class='xr-var-data-in' type='checkbox'><label for='data-fd3631ab-352e-4567-ad0a-ca92fb7c1d2f' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(['2022-09-02T03:15:31.024000000', '2022-09-07T03:15:19.024000000',\n",
|
|
" '2022-09-12T03:15:31.025000000', '2022-09-17T03:15:19.024000000',\n",
|
|
" '2022-09-22T03:15:31.024000000', '2022-09-27T03:15:19.024000000'],\n",
|
|
" dtype='datetime64[ns]')</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-296c5f49-74fb-4622-8c90-e1e84c454b96' class='xr-section-summary-in' type='checkbox' ><label for='section-296c5f49-74fb-4622-8c90-e1e84c454b96' class='xr-section-summary' >Indexes: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-index-name'><div>y</div></div><div class='xr-index-preview'>PandasIndex</div><input type='checkbox' disabled/><label></label><input id='index-3b0fd4ee-0ac2-4eec-a26a-378a88c94df4' class='xr-index-data-in' type='checkbox'/><label for='index-3b0fd4ee-0ac2-4eec-a26a-378a88c94df4' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Index([1071500.0, 1070500.0, 1069500.0, 1068500.0, 1067500.0, 1066500.0], dtype='float64', name='y'))</pre></div></li><li class='xr-var-item'><div class='xr-index-name'><div>x</div></div><div class='xr-index-preview'>PandasIndex</div><input type='checkbox' disabled/><label></label><input id='index-dc3b1e5c-408b-423d-8c8b-e61b3770bd3d' class='xr-index-data-in' type='checkbox'/><label for='index-dc3b1e5c-408b-423d-8c8b-e61b3770bd3d' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Index([594500.0, 595500.0, 596500.0, 597500.0, 598500.0, 599500.0, 600500.0,\n",
|
|
" 601500.0, 602500.0, 603500.0],\n",
|
|
" dtype='float64', name='x'))</pre></div></li><li class='xr-var-item'><div class='xr-index-name'><div>time</div></div><div class='xr-index-preview'>PandasIndex</div><input type='checkbox' disabled/><label></label><input id='index-c4841d89-7dd9-439c-b4a1-a31845f2d0f8' class='xr-index-data-in' type='checkbox'/><label for='index-c4841d89-7dd9-439c-b4a1-a31845f2d0f8' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(DatetimeIndex(['2022-09-02 03:15:31.024000', '2022-09-07 03:15:19.024000',\n",
|
|
" '2022-09-12 03:15:31.025000', '2022-09-17 03:15:19.024000',\n",
|
|
" '2022-09-22 03:15:31.024000', '2022-09-27 03:15:19.024000'],\n",
|
|
" dtype='datetime64[ns]', name='time', freq=None))</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-272d18aa-3f70-4a92-85bd-1b5c7f675b92' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-272d18aa-3f70-4a92-85bd-1b5c7f675b92' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
|
|
],
|
|
"text/plain": [
|
|
"<xarray.DataArray 'NDVI' (time: 6, y: 6, x: 10)> Size: 1kB\n",
|
|
"dask.array<truediv, shape=(6, 6, 10), dtype=float32, chunksize=(1, 6, 10), chunktype=numpy.ndarray>\n",
|
|
"Coordinates:\n",
|
|
" * y (y) float64 48B 1.072e+06 1.07e+06 ... 1.068e+06 1.066e+06\n",
|
|
" * x (x) float64 80B 5.945e+05 5.955e+05 ... 6.025e+05 6.035e+05\n",
|
|
" spatial_ref int32 4B 32648\n",
|
|
" * time (time) datetime64[ns] 48B 2022-09-02T03:15:31.024000 ... 202..."
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Tiến hành tính toán NDVI\n",
|
|
"ds1 = calculate_indices(result, index=\"NDVI\", satellite_mission=\"s2\")\n",
|
|
"ndvi = ds1[\"NDVI\"]\n",
|
|
"display(ndvi)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 7,
|
|
"id": "84992d28-8e3f-468e-be08-ded511f2c662",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:29.284742Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:29.284563Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:29.358766Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:29.358175Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"<matplotlib.image.AxesImage at 0x7090cf0fdcc0>"
|
|
]
|
|
},
|
|
"execution_count": 7,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
},
|
|
{
|
|
"data": {
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhYAAAFVCAYAAACzY6aMAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjUsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvWftoOwAAAAlwSFlzAAAPYQAAD2EBqD+naQAAEv5JREFUeJzt3W2MVGfZwPFrWGSguDMKFSxhINt+gUKxBRqE0vpS3ARrI8a3NhXx5QvJFsGN2lJM1MZ21EZjIoIuNjXaEIipbTHa6qphKTZYoKCkNm1NG1mlSGl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yfPn3Qr1MoFPwnGUbcj+HDvRg+3Ivhw724MP9tpeI1Ht4EAJIRFgBAMiMuLPL5fHzlK1+JfD5f71EI92M4cS+GD/di+HAv0hvyhzcBgJFrxK1YAAD1IywAgGSEBQCQjLAAAJIZcWGxadOmaGlpifHjx8eCBQviiSeeqPdIo065XI5rr702mpubY8qUKbFixYp47rnn6j0W8b/3JpfLxbp16+o9yqj1j3/8Iz7xiU/E5MmT45JLLomrr7469u/fX++xRp0zZ87El7/85WhpaYkJEybE5ZdfHnfffXecPXu23qM1vBEVFtu3b49169bFhg0b4sCBA3H99dfH8uXL4/Dhw/UebVTp6uqKtra22LNnT3R2dsaZM2eitbU1Tp06Ve/RRrW9e/dGR0dHzJs3r96jjFr/+te/4rrrros3velN8dhjj8Vf/vKX+Pa3vx1vectb6j3aqPPNb34zfvCDH8TGjRvj2WefjW9961tx3333xfe+9716j9bwRtSfmy5atCjmz58fmzdv7ts3e/bsWLFiRZTL5TpONrq98sorMWXKlOjq6oobbrih3uOMSidPnoz58+fHpk2b4utf/3pcffXV8d3vfrfeY406d955Z/zhD3+wkjoMfOADH4ipU6fG/fff37fvwx/+cFxyySXx05/+tI6TNb4Rs2Jx+vTp2L9/f7S2tvbb39raGk8++WSdpiIioqenJyIiJk2aVOdJRq+2tra46aabYtmyZfUeZVTbsWNHLFy4MD760Y/GlClT4pprroktW7bUe6xRaenSpfG73/0unn/++YiI+NOf/hS7d++O97///XWerPEN+ZeQDZbjx49Hb29vTJ06td/+qVOnxtGjR+s0FVmWRXt7eyxdujTmzp1b73FGpW3btsXTTz8de/furfcoo96LL74Ymzdvjvb29rjrrrviqaeeis997nORz+fjk5/8ZL3HG1XuuOOO6OnpiVmzZkVTU1P09vbGPffcE7feemu9R2t4IyYsXvP/v4o9y7JB+Xp2Lsztt98ef/7zn2P37t31HmVU6u7ujrVr18ZvfvObGD9+fL3HGfXOnj0bCxcujHvvvTciIq655pp45plnYvPmzcJiiG3fvj0efPDB2Lp1a8yZMycOHjwY69ati2nTpsWqVavqPV5DGzFhcemll0ZTU9PrVieOHTv2ulUMhsaaNWtix44dsWvXrpg+fXq9xxmV9u/fH8eOHYsFCxb07evt7Y1du3bFxo0bo1qtRlNTUx0nHF0uu+yyuPLKK/vtmz17djz00EN1mmj0+uIXvxh33nln3HLLLRERcdVVV8Xf/va3KJfLwuIijZhnLMaNGxcLFiyIzs7Ofvs7OztjyZIldZpqdMqyLG6//fb4+c9/Hr///e+jpaWl3iONWjfeeGMcOnQoDh482LctXLgwbrvttjh48KCoGGLXXXfd6/70+vnnn4+ZM2fWaaLR6z//+U+MGdP/JbCpqcmfmyYwYlYsIiLa29tj5cqVsXDhwli8eHF0dHTE4cOHY/Xq1fUebVRpa2uLrVu3xqOPPhrNzc19q0jFYjEmTJhQ5+lGl+bm5tc92zJx4sSYPHmyZ17q4POf/3wsWbIk7r333vjYxz4WTz31VHR0dERHR0e9Rxt1br755rjnnntixowZMWfOnDhw4EB85zvfic985jP1Hq3xZSPM97///WzmzJnZuHHjsvnz52ddXV31HmnUiYhzbg888EC9RyPLsne9613Z2rVr6z3GqPWLX/wimzt3bpbP57NZs2ZlHR0d9R5pVKpUKtnatWuzGTNmZOPHj88uv/zybMOGDVm1Wq33aA1vRH2OBQBQXyPmGQsAoP6EBQCQjLAAAJIRFgBAMsICAEhGWAAAyQgLACAZYQEAJCMsAIBkhAUAkIywAACSERYAQDL/A8CnlMwofga8AAAAAElFTkSuQmCC",
|
|
"text/plain": [
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"## Hiển thị ảnh NDVI chưa điền các giá trị mây (chưa fill nan)\n",
|
|
"plt.imshow(ndvi.isel(time=0))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 8,
|
|
"id": "72318b60-532a-4f08-a5f7-94762d08a42c",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:29.360559Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:29.360264Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:29.437358Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:29.436679Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"<matplotlib.image.AxesImage at 0x7090cc7da290>"
|
|
]
|
|
},
|
|
"execution_count": 8,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
},
|
|
{
|
|
"data": {
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhYAAAFVCAYAAACzY6aMAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjUsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvWftoOwAAAAlwSFlzAAAPYQAAD2EBqD+naQAAFHpJREFUeJzt3X9s1fXd9/F3W+QUWekEB5ObwlXvJQP5MaU1DsQfm6xJ58hI3KbGMe79SG5mYWAvF6143dvMsPtxzctljG4lxv0wDLJsTpZNtm4LoHNMqDCIGnXRe9QhYxivFnDXcZRz/XHNZh0yPfRTvj3t45GcP87xe/y+zAF55tsvbVmhUCgEAEAC5VkPAACGD2EBACQjLACAZIQFAJCMsAAAkhEWAEAywgIASEZYAADJjDrTJzxx4kQcOHAgqqqqoqys7EyfHgA4DYVCIY4cORKTJ0+O8vJTX5c442Fx4MCBqKmpOdOnBQAS6OrqiilTppzyn5/xsKiqqoqIiJr/d3uUV1ae6dMnc/7n9mY9IYkfHVqf9QQASkBPT0/U1NT0/Tl+Kmc8LF798kd5ZWVJh8WosrOynpDEuHHjsp4AQAl5vdsY3LwJACQjLACAZIQFAJCMsAAAkhEWAEAywgIASEZYAADJCAsAIBlhAQAkIywAgGSEBQCQjLAAAJIRFgBAMsICAEhGWAAAyQgLACAZYQEAJHNaYbFu3bqora2NysrKqKuri4ceeij1LgCgBBUdFps2bYpVq1bF6tWrY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6zoh34sSJqK+vjzvvvDMiIi666KJ4/PHHo62tTVicYZs2bYr77rsvNmzYEDNnzow9e/bEqlWrYvLkybF06dKs55W0YRMW5557blRUVJx0deLQoUMnXcXgzFixYkVs3rw5tm/fHlOmTMl6zojU2dkZhw4dirq6ur7Xent7Y/v27bF27drI5/NRUVGR4cKR5bzzzosLLrig32szZsyIH/zgBxktGrk+/elPx6233hrXXXddRETMnj07/vCHP0Rra6uwGKBhc4/F6NGjo66uLjo6Ovq93tHREfPnz89o1chUKBRi+fLl8cMf/jB+9atfRW1tbdaTRqyrrroq9u3bF3v27Ol71NfXxw033BB79uwRFWfYpZdeetJfvX766adj2rRpGS0auV5++eUoL+//R2BFRYW/bprAsLliERHR3NwcS5Ysifr6+pg3b160t7fH/v37Y9myZVlPG1Gamppiw4YN8cADD0RVVVXfVaTq6uoYM2ZMxutGlqqqqpPubRk7dmxMmDDBPS8ZuOmmm2L+/Plx5513xoc+9KF49NFHo729Pdrb27OeNuIsWrQo1qxZE1OnTo2ZM2fG7t2746677oqPfexjWU8rfYVh5utf/3ph2rRphdGjRxfmzp1b2LZtW9aTRpyIeM3Hvffem/U0CoXCFVdcUVi5cmXWM0asH//4x4VZs2YVcrlcYfr06YX29vasJ41IPT09hZUrVxamTp1aqKysLJx//vmF1atXF/L5fNbTSt6w+j4WAEC2hs09FgBA9oQFAJCMsAAAkhEWAEAywgIASEZYAADJCAsAIBlhAQAkIywAgGSEBQCQjLAAAJIRFgBAMv8N4Wt+dwko4tcAAAAASUVORK5CYII=",
|
|
"text/plain": [
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Thiết lập giá trị trung bình mùa vụ để xử lý các điểm ảnh bị mây dựa vào sự thay đổi theo mùa\n",
|
|
"time_split = [\n",
|
|
" slice(\"2022-09-01\", \"2023-01-01\"),\n",
|
|
" slice(\"2023-01-01\", \"2023-05-01\"),\n",
|
|
" slice(\"2023-05-01\", \"2023-07-01\"),\n",
|
|
" slice(\"2023-07-01\", \"2022-10-01\"),\n",
|
|
"]\n",
|
|
"\n",
|
|
"# Điền mây ở các vị trí mang giá trị nan (fill nan)\n",
|
|
"fill_nan_ndvi = fill_nan(ndvi, time_split)\n",
|
|
"\n",
|
|
"# In kết quả ảnh NDVI đã điền mây (đã fill nan)\n",
|
|
"plt.imshow(fill_nan_ndvi.isel(time=0))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 9,
|
|
"id": "375b1cfb-37f5-49fe-8061-ea32eb47f9f6",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:29.439062Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:29.438890Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:29.461108Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:29.460532Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"CPU times: user 4.42 ms, sys: 15.8 ms, total: 20.2 ms\n",
|
|
"Wall time: 19 ms\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"%%time\n",
|
|
"## tính ndvi theo tháng\n",
|
|
"average_ndvi = fill_nan_ndvi.resample(time=\"1M\").mean().persist()\n",
|
|
"# progress(average_ndvi)\n",
|
|
"\n",
|
|
"# compute average_ndvi\n",
|
|
"average_ndvi = average_ndvi.compute()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 10,
|
|
"id": "187cc640-aef9-476b-91fc-b63f4d3ff2e3",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:29.462918Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:29.462754Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:40.356864Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:40.356112Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"#Load dữ liệu ảnh Sentinel 1\n",
|
|
"dsvh, dsvv = load_data_sen1(None, date_range, coordinates)\n",
|
|
"average_vv = calculate_average(dsvv, time_pattern='1M')\n",
|
|
"average_vh = calculate_average(dsvh, time_pattern='1M')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 11,
|
|
"id": "d2585562-88aa-4c7d-bf70-1f6affcf65d4",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:40.358863Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:40.358679Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:44.099414Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:44.098765Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"## cấu hình bộ dữ liệu điểm huấn luyện mô hình (train file)\n",
|
|
"train_path = \"train/ST_training_data_updated_1130points_new.shp\" # đường dẫn shp file train\n",
|
|
"\n",
|
|
"## load dữ liệu điểm huấn luyện mô hình (train file)\n",
|
|
"train = load_train_data(train_path)\n",
|
|
"train.head()\n",
|
|
"\n",
|
|
"# cấu hình nhãn dữ liệu \n",
|
|
"label_mapping = {\n",
|
|
" \"Lua tom\": \"0\",\n",
|
|
" \"Lua\": \"1\",\n",
|
|
" \"CHN\": \"2\",\n",
|
|
" \"CLN\": \"3\",\n",
|
|
" \"TS\": \"4\",\n",
|
|
" \"Song\": \"5\",\n",
|
|
" \"Dat xay dung\": \"6\",\n",
|
|
" \"Rung\": \"7\",\n",
|
|
"}\n",
|
|
"\n",
|
|
"# xây dựng tập dữ liệu (dataset) chứa dữ liệu VH, VV, NDVI\n",
|
|
"datasets = get_data_sen1_and_sen2(train, average_ndvi, average_vh, average_vv)\n",
|
|
"\n",
|
|
"# chia tập dữ liệu thành các phần theo tỉ lệ 80(80-20)-20 tương ứng với tập train, validate, test\n",
|
|
"X_train, X_val, X_test, y_train, y_val, y_test = split_train_data(\n",
|
|
" train, label_mapping, datasets\n",
|
|
")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 12,
|
|
"id": "e97a74c5",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:44.102075Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:44.101548Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:44.181948Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:44.181298Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"<matplotlib.image.AxesImage at 0x7090cc45f310>"
|
|
]
|
|
},
|
|
"execution_count": 12,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
},
|
|
{
|
|
"data": {
|
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhYAAAFVCAYAAACzY6aMAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjUsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvWftoOwAAAAlwSFlzAAAPYQAAD2EBqD+naQAAEv5JREFUeJzt3W2MVGfZwPFrWGSguDMKFSxhINt+gUKxBRqE0vpS3ARrI8a3NhXx5QvJFsGN2lJM1MZ21EZjIoIuNjXaEIipbTHa6qphKTZYoKCkNm1NG1mlSGl0BzAZwnKeD0+6efYpWGa5d2dn9/dLzoc9nLPnSg7J/HPP2ZlclmVZAAAkMKbeAwAAI4ewAACSERYAQDLCAgBIRlgAAMkICwAgGWEBACQjLACAZMYO9QXPnj0bR44ciebm5sjlckN9eQBgALIsixMnTsS0adNizJjzr0sMeVgcOXIkSqXSUF8WAEigu7s7pk+fft5/H/KwaG5ujoj/HaxQKAz15QGAAahUKlEqlfpex89nyMPitbc/CoWCsACABvNGjzF4eBMASEZYAADJCAsAIBlhAQAkIywAgGSEBQCQjL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tZnDp1KhYvXnze46rValSr1X6DAQAjU80Pbx46dCje/OY3Rz6fj9WrV8fDDz8cV1555XmPL5fLUSwW+7ZSqXRRAwMAw1fNb4WcPn06Dh8+HP/+97/joYceih/96EfR1dV13rg414pFqVTyVggANJALfSvkop+xWLZsWVxxxRXxwx/+MOlgAMDwcaGv3xf9ORZZlvVbkQAARq+aHt686667Yvny5VEqleLEiROxbdu22LlzZzz++OODNR8A0EBqCot//vOfsXLlynj55ZejWCzGvHnz4vHHH4/3ve99gzUfANBAagqL+++/f7DmAABGAN8VAgAkIywAgGSEBQCQjLAAAJIRFgBAMsICAEhGWAAAyQgLACAZYQEAJCMsAIBkhAUAkIywAACSERYAQDLCAgBIRlgAAMkICwAgGWEBACQjLACAZIQFAJCMsAAAkhEWAEAywgIASEZYAADJCAsAIBlhAQAkIywAgGSEBQCQjLAAAJIRFgBAMsICAEhGWAAAyQgLACAZYQEAJCMsAIBkhAUAkIywAACSERYAQDLCAgBIRlgAAMlcVFiUy+XI5XKxbt26ROMAAI1swGGxd+/e6OjoiHnz5qWcBwBoYAMKi5MnT8Ztt90WW7Zsibe+9a2pZwIAGtSAwqKtrS1uuummWLZs2RseW61Wo1Kp9NsAgJFpbK0nbNu2LZ5++unYu3fvBR1fLpfja1/7Ws2DAQCNp6YVi+7u7li7dm08+OCDMX78+As6Z/369dHT09O3dXd3D2hQAGD4y2VZll3owY888kh86EMfiqampr59vb29kcvlYsyYMVGtVvv927lUKpUoFovR09MThUJh4JMDAEPmQl+/a3or5MYbb4xDhw712/fpT386Zs2aFXfccccbRgUAMLLVFBbNzc0xd+7cfvsmTpwYkydPft1+AGD08cmbAEAyNf9VyP+3c+fOBGMAACOBFQsAIBlhAQAkIywAgGSEBQCQjLAAAJIRFgBAMsICAEhGWAAAyQgLACAZYQEAJCMsAIBkhAUAkIywAACSERYAQDLCAgBIRlgAAMkICwAgGWEBACQjLACAZIQFAJCMsAAAkhEWAEAywgIASEZYAADJCAsAIBlhAQAkIywAgGSEB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u23qM1vBEVFtu3b49169bFhg0b4sCBA3H99dfH8uXL4/Dhw/UebVTp6uqKtra22LNnT3R2dsaZM2eitbU1Tp06Ve/RRrW9e/dGR0dHzJs3r96jjFr/+te/4rrrros3velN8dhjj8Vf/vKX+Pa3vx1vectb6j3aqPPNb34zfvCDH8TGjRvj2WefjW9961tx3333xfe+9716j9bwRtSfmy5atCjmz58fmzdv7ts3e/bsWLFiRZTL5TpONrq98sorMWXKlOjq6oobbrih3uOMSidPnoz58+fHpk2b4utf/3pcffXV8d3vfrfeY406d955Z/zhD3+wkjoMfOADH4ipU6fG/fff37fvwx/+cFxyySXx05/+tI6TNb4Rs2Jx+vTp2L9/f7S2tvbb39raGk8++WSdpiIioqenJyIiJk2aVOdJRq+2tra46aabYtmyZfUeZVTbsWNHLFy4MD760Y/GlClT4pprroktW7bUe6xRaenSpfG73/0unn/++YiI+NOf/hS7d++O97///XWerPEN+ZeQDZbjx49Hb29vTJ06td/+qVOnxtGjR+s0FVmWRXt7eyxdujTmzp1b73FGpW3btsXTTz8de/furfcoo96LL74Ymzdvjvb29rjrrrviqaeeis997nORz+fjk5/8ZL3HG1XuuOOO6OnpiVmzZkVTU1P09vbGPffcE7feemu9R2t4IyYsXvP/v4o9y7JB+Xp2Lsztt98ef/7zn2P37t31HmVU6u7ujrVr18ZvfvObGD9+fL3HGfXOnj0bCxcujHvvvTciIq655pp45plnYvPmzcJiiG3fvj0efPDB2Lp1a8yZMycOHjwY69ati2nTpsWqVavqPV5DGzFhcemll0ZTU9PrVieOHTv2ulUMhsaaNWtix44dsWvXrpg+fXq9xxmV9u/fH8eOHYsFCxb07evt7Y1du3bFxo0bo1qtRlNTUx0nHF0uu+yyuPLKK/vtmz17djz00EN1mmj0+uIXvxh33nln3HLLLRERcdVVV8Xf/va3KJfLwuIijZhnLMaNGxcLFiyIzs7Ofvs7OztjyZIldZpqdMqyLG6//fb4+c9/Hr///e+jpaWl3iONWjfeeGMcOnQoDh482LctXLgwbrvttjh48KCoGGLXXXfd6/70+vnnn4+ZM2fWaaLR6z//+U+MGdP/JbCpqcmfmyYwYlYsIiLa29tj5cqVsXDhwli8eHF0dHTE4cOHY/Xq1fUebVRpa2uLrVu3xqOPPhrNzc19q0jFYjEmTJhQ5+lGl+bm5tc92zJx4sSYPHmyZ17q4POf/3wsWbIk7r333vjYxz4WTz31VHR0dERHR0e9Rxt1br755rjnnntixowZMWfOnDhw4EB85zvfic985jP1Hq3xZSPM97///WzmzJnZuHHjsvnz52ddXV31HmnUiYhzbg888EC9RyPLsne9613Z2rVr6z3GqPWLX/wimzt3bpbP57NZs2ZlHR0d9R5pVKpUKtnatWuzGTNmZOPHj88uv/zybMOGDVm1Wq33aA1vRH2OBQBQXyPmGQsAoP6EBQCQjLAAAJIRFgBAMsICAEhGWAAAyQgLACAZYQEAJCMsAIBkhAUAkIywAACSERYAQDL/A8CnlMwofga8AAAAAElFTkSuQmCC",
|
|
"text/plain": [
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"## Hiển thị ảnh NDVI chưa điền các giá trị mây (chưa fill nan)\n",
|
|
"plt.imshow(ndvi.isel(time=0))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 13,
|
|
"id": "db9c9439",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:44.183678Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:44.183477Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:44.265740Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:44.265042Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"<matplotlib.image.AxesImage at 0x7090cc35b3d0>"
|
|
]
|
|
},
|
|
"execution_count": 13,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
},
|
|
{
|
|
"data":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lhAQAkU1RYtLa2xsUXXxxVVVUxceLEWLx4cTz11FODtQ0AKDFFhcW2bduiqakpduzYER0dHXH8+PFoaGiIY8eODdY+AKCEjCrm4C1btvR7fu+998bEiROjs7MzLr/88qTDAIDSU1RY/KPu7u6IiBg/fvwpj8nn85HP5/ue9/T0DOSUAMAQdto3bxYKhWhubo4FCxbErFmzTnlca2trVFdX9z1qampO95QAwBB32mGxfPny2Lt3b3zve9/7p8e1tLREd3d336Orq+t0TwkADHGn9aWQFStWxObNm2P79u0xZcqUf3psLpeLXC53WuMAgNJSVFgUCoVYsWJF3H///bF169aora0drF0AQAkqKiyamppiw4YN8cADD0RVVVUcPHgwIiKqq6tjzJgxgzIQACgdRd1j0dbWFt3d3XHllVfGeeed1/fYtGnTYO0DAEpI0V8KAQA4FT8rBABIRlgAAMkICwAgGWEBACQjLACAZIQFAJCMsAAAkhEWAEAywgIASEZYAADJCAsAIBlhAQAkIywAgGSEBQCQjLAAAJIRFgBAMsICAEhmVFYnrvhLeZQXSrdrJuwty3pCEuf8n66sJyTx0remZj1hwJ5rnZf1BIaZXY13Zj2Bv9l98casJwxYz5ETcc4bOK50/2QHAIYcYQEAJCMsAIBkhAUAkIywAACSERYAQDLCAgBIRlgAAMkICwAgGWEBACQjLACAZIQFAJCMsAAAkhEWAEAywgIASEZYAADJCAsAIBlhAQAkIywAgGSEBQCQTFFh0dbWFnPmzIlx48bFuHHjYt68efHggw8O1jYAoMQUFRZTpkyJL3zhC7Fr167YtWtXvPvd7473v//98fjjjw/WPgCghIwq5uBFixb1e75mzZpoa2uLHTt2xMyZM5MOAwBKT1Fh8fd6e3vj+9//fhw7dizmzZt3yuPy+Xzk8/m+5z09Pad7SgBgiCv65s19+/bFm970psjlcrFs2bK4//7744ILLjjl8a2trVFdXd33qKmpGdBgAGDoKjos3v72t8eePXtix44d8clPfjKWLl0aTzzxxCmPb2lpie7u7r5HV1fXgAYDAENX0V8KGT16dLztbW+LiIj6+vrYuXNnfPWrX41vfvObr3l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qyrrroq9u3bF3v27Ol71NfXxw033BB79uwRFWfYpZdeetJfvX766adj2rRpGS0auV5++eUoL+//R2BFRYW/bprAsLliERHR3NwcS5Ysifr6+pg3b160t7fH/v37Y9myZVlPG1Gamppiw4YN8cADD0RVVVXfVaTq6uoYM2ZMxutGlqqqqpPubRk7dmxMmDDBPS8ZuOmmm2L+/Plx5513xoc+9KF49NFHo729Pdrb27OeNuIsWrQo1qxZE1OnTo2ZM2fG7t2746677oqPfexjWU8rfYVh5utf/3ph2rRphdGjRxfmzp1b2LZtW9aTRpyIeM3Hvffem/U0CoXCFVdcUVi5cmXWM0asH//4x4VZs2YVcrlcYfr06YX29vasJ41IPT09hZUrVxamTp1aqKysLJx//vmF1atXF/L5fNbTSt6w+j4WAEC2hs09FgBA9oQFAJCMsAAAkhEWAEAywgIASEZYAADJCAsAIBlhAQAkIywAgGSEBQCQjLAAAJIRFgBAMv8N4Wt+dwko4tcAAAAASUVORK5CYII=",
|
|
"text/plain": [
|
|
"<Figure size 640x480 with 1 Axes>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Thiết lập giá trị trung bình mùa vụ để xử lý các điểm ảnh bị mây dựa vào sự thay đổi theo mùa\n",
|
|
"time_split = [\n",
|
|
" slice(\"2022-09-01\", \"2023-01-01\"),\n",
|
|
" slice(\"2023-01-01\", \"2023-05-01\"),\n",
|
|
" slice(\"2023-05-01\", \"2023-07-01\"),\n",
|
|
" slice(\"2023-07-01\", \"2022-10-01\"),\n",
|
|
"]\n",
|
|
"\n",
|
|
"# Điền mây ở các vị trí mang giá trị nan (fill nan)\n",
|
|
"fill_nan_ndvi = fill_nan(ndvi, time_split)\n",
|
|
"\n",
|
|
"# In kết quả ảnh NDVI đã điền mây (đã fill nan)\n",
|
|
"plt.imshow(fill_nan_ndvi.isel(time=0))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 14,
|
|
"id": "fc4b7d31",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:44.267642Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:44.267472Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:44.288594Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:44.287719Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"CPU times: user 13.3 ms, sys: 4.44 ms, total: 17.7 ms\n",
|
|
"Wall time: 17.3 ms\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"%%time\n",
|
|
"## tính ndvi theo tháng\n",
|
|
"average_ndvi = fill_nan_ndvi.resample(time=\"1M\").mean().persist()\n",
|
|
"# progress(average_ndvi)\n",
|
|
"\n",
|
|
"# compute average_ndvi\n",
|
|
"average_ndvi = average_ndvi.compute()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 15,
|
|
"id": "a1b2e695",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:44.290043Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:44.289885Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:45.629478Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:45.628928Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"#Load dữ liệu ảnh Sentinel 1\n",
|
|
"dsvh, dsvv = load_data_sen1(None, date_range, coordinates)\n",
|
|
"average_vv = calculate_average(dsvv, time_pattern='1M')\n",
|
|
"average_vh = calculate_average(dsvh, time_pattern='1M')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 16,
|
|
"id": "580f541a",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:45.631272Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:45.631111Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:49.533783Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:49.533150Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"## cấu hình bộ dữ liệu điểm huấn luyện mô hình (train file)\n",
|
|
"train_path = \"train/ST_training_data_updated_1130points_new.shp\" # đường dẫn shp file train\n",
|
|
"\n",
|
|
"## load dữ liệu điểm huấn luyện mô hình (train file)\n",
|
|
"train = load_train_data(train_path)\n",
|
|
"train.head()\n",
|
|
"\n",
|
|
"# cấu hình nhãn dữ liệu \n",
|
|
"label_mapping = {\n",
|
|
" \"Lua tom\": \"0\",\n",
|
|
" \"Lua\": \"1\",\n",
|
|
" \"CHN\": \"2\",\n",
|
|
" \"CLN\": \"3\",\n",
|
|
" \"TS\": \"4\",\n",
|
|
" \"Song\": \"5\",\n",
|
|
" \"Dat xay dung\": \"6\",\n",
|
|
" \"Rung\": \"7\",\n",
|
|
"}\n",
|
|
"\n",
|
|
"# xây dựng tập dữ liệu (dataset) chứa dữ liệu VH, VV, NDVI\n",
|
|
"datasets = get_data_sen1_and_sen2(train, average_ndvi, average_vh, average_vv)\n",
|
|
"\n",
|
|
"# chia tập dữ liệu thành các phần theo tỉ lệ 80(80-20)-20 tương ứng với tập train, validate, test\n",
|
|
"X_train, X_val, X_test, y_train, y_val, y_test = split_train_data(\n",
|
|
" train, label_mapping, datasets\n",
|
|
")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 17,
|
|
"id": "2e955884-d4af-422d-a8e6-d436199540e0",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:49.535786Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:49.535608Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:49.913241Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:49.912566Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"🚀 Training Random Forest model...\n",
|
|
" Train samples: 678\n",
|
|
" Val samples: 226\n",
|
|
" Features: 3\n",
|
|
" Classes: 8\n",
|
|
"\n"
|
|
]
|
|
},
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"✅ Training completed!\n",
|
|
" Validation Accuracy: 0.3717 (37.17%)\n",
|
|
"CPU times: user 270 ms, sys: 160 ms, total: 430 ms\n",
|
|
"Wall time: 373 ms\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"%%time\n",
|
|
"# 🤖 LAND USE CLASSIFICATION MODEL TRAINING (RANDOM FOREST)\n",
|
|
"from sklearn.ensemble import RandomForestClassifier\n",
|
|
"from sklearn.metrics import accuracy_score\n",
|
|
"import numpy as np\n",
|
|
"\n",
|
|
"X_train_np = np.asarray(X_train, dtype=np.float32)\n",
|
|
"X_val_np = np.asarray(X_val, dtype=np.float32)\n",
|
|
"y_train_np = np.asarray(y_train, dtype=np.int32)\n",
|
|
"y_val_np = np.asarray(y_val, dtype=np.int32)\n",
|
|
"\n",
|
|
"print(\"🚀 Training Random Forest model...\")\n",
|
|
"print(f\" Train samples: {len(X_train_np)}\")\n",
|
|
"print(f\" Val samples: {len(X_val_np)}\")\n",
|
|
"print(f\" Features: {X_train_np.shape[1]}\")\n",
|
|
"print(f\" Classes: 8\\n\")\n",
|
|
"\n",
|
|
"model = RandomForestClassifier(n_estimators=200, max_depth=30, random_state=42, n_jobs=-1)\n",
|
|
"model.fit(X_train_np, y_train_np)\n",
|
|
"\n",
|
|
"y_val_pred = model.predict(X_val_np)\n",
|
|
"val_accuracy = accuracy_score(y_val_np, y_val_pred)\n",
|
|
"print(f\"\\n✅ Training completed!\")\n",
|
|
"print(f\" Validation Accuracy: {val_accuracy:.4f} ({val_accuracy*100:.2f}%)\")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 18,
|
|
"id": "f1a14379-ed6e-4897-9ca4-2669743fab40",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:49.914789Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:49.914630Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:50.769923Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:50.769342Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"======================================================================\n",
|
|
"MODEL SAVING\n",
|
|
"======================================================================\n",
|
|
"\n",
|
|
"🔄 Saving trained LAND USE CLASSIFICATION model with metadata...\n"
|
|
]
|
|
},
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"[MODEL MANAGER] Saving model to: model_train/model_land_use_odc.joblib\n",
|
|
"[MODEL MANAGER] Saving metadata to: model_train/model_land_use_odc_info.json\n",
|
|
"[MODEL MANAGER] Model saved successfully!\n",
|
|
"✅ Model saved: model_land_use_odc.joblib\n",
|
|
" - Type: random_forest\n",
|
|
" - Features: 3\n",
|
|
" - Accuracy: 0.37168141592920356\n",
|
|
"✅ Model saved to model_train/model_land_use_odc.joblib\n",
|
|
"======================================================================\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"# 💾 SAVE MODEL WITH METADATA\n",
|
|
"print(\"=\"*70)\n",
|
|
"print(\"MODEL SAVING\")\n",
|
|
"print(\"=\"*70)\n",
|
|
"\n",
|
|
"if model is not None:\n",
|
|
" print(\"\\n🔄 Saving trained LAND USE CLASSIFICATION model with metadata...\")\n",
|
|
" try:\n",
|
|
" from datetime import datetime\n",
|
|
" \n",
|
|
" metadata = {\n",
|
|
" \"timestamp\": datetime.now().isoformat(),\n",
|
|
" \"data_source\": \"Microsoft Planetary Computer STAC\",\n",
|
|
" \"collections\": [\"sentinel-2-l2a\", \"sentinel-1-rtc\"],\n",
|
|
" \"features\": [\"NDVI\", \"VH\", \"VV\"],\n",
|
|
" \"training_samples\": len(X_train),\n",
|
|
" \"testing_samples\": len(X_test),\n",
|
|
" \"test_size\": 0.2,\n",
|
|
" \"train_accuracy\": float(model.score(X_train_np, y_train_np)),\n",
|
|
" \"test_accuracy\": float(val_accuracy),\n",
|
|
" \"model_type\": \"random_forest\",\n",
|
|
" \"device\": \"cpu\",\n",
|
|
" \"n_estimators\": 200,\n",
|
|
" \"max_depth\": 30,\n",
|
|
" \"n_features\": X_train_np.shape[1],\n",
|
|
" \"n_classes\": 8,\n",
|
|
" \"class_names\": list(label_mapping.keys()),\n",
|
|
" \"bbox\": None,\n",
|
|
" \"time_range\": f\"{date_range[0]}/{date_range[1]}\",\n",
|
|
" \"resolution\": RESOLUTION,\n",
|
|
" \"notes\": \"Random Forest model trained using Microsoft Planetary Computer STAC features.\"\n",
|
|
" }\n",
|
|
" \n",
|
|
" save_model(\"model_land_use_odc.joblib\", model, metadata=metadata, label_encoder=None)\n",
|
|
" print(\"✅ Model saved to model_train/model_land_use_odc.joblib\")\n",
|
|
" except Exception as e:\n",
|
|
" print(f\"❌ Error saving model: {e}\")\n",
|
|
" import traceback\n",
|
|
" traceback.print_exc()\n",
|
|
"else:\n",
|
|
" print(\"❌ No model to save\")\n",
|
|
"\n",
|
|
"print(\"=\"*70)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "4a8579f4",
|
|
"metadata": {},
|
|
"source": [
|
|
"# 📖 Hướng dẫn sử dụng Model\n",
|
|
"\n",
|
|
"## Mục đích của Model\n",
|
|
"\n",
|
|
"Model này được train để **DỰ ĐOÁN PHÂN LOẠI SỬ DỤNG ĐẤT** với 8 lớp:\n",
|
|
"\n",
|
|
"1. **Lua tom** (0) - Lúa tôm\n",
|
|
"2. **Lua** (1) - Lúa\n",
|
|
"3. **CHN** (2) - Cây hàng năm\n",
|
|
"4. **CLN** (3) - Cây lâu năm \n",
|
|
"5. **TS** (4) - Thủy sản\n",
|
|
"6. **Song** (5) - Sông\n",
|
|
"7. **Dat xay dung** (6) - Đất xây dựng\n",
|
|
"8. **Rung** (7) - Rừng\n",
|
|
"\n",
|
|
"## Features đầu vào\n",
|
|
"\n",
|
|
"Model sử dụng **nhiều spectral indices** làm features:\n",
|
|
"- NDVI (mean, min, max, std, range)\n",
|
|
"- NDWI (mean)\n",
|
|
"- NDBI (mean)\n",
|
|
"- EVI (mean)\n",
|
|
"\n",
|
|
"## NDVI là gì trong hệ thống này?\n",
|
|
"\n",
|
|
"⚠️ **QUAN TRỌNG**: NDVI **KHÔNG PHẢI** là mục tiêu dự đoán!\n",
|
|
"\n",
|
|
"- **NDVI là INPUT FEATURE**: Một trong các chỉ số dùng để train model\n",
|
|
"- **Mục tiêu dự đoán**: Phân loại sử dụng đất (8 lớp)\n",
|
|
"- **NDVI map**: Có thể hiển thị NDVI map như chỉ số phụ sau khi predict xong\n",
|
|
"\n",
|
|
"## Workflow Prediction\n",
|
|
"\n",
|
|
"```python\n",
|
|
"# 1. Load model\n",
|
|
"model, label_encoder, metadata = model_manager.load_model(\"model_land_use_odc.joblib\")\n",
|
|
"\n",
|
|
"# 2. Extract features từ satellite data\n",
|
|
"features = extract_features(satellite_data) # NDVI, NDWI, NDBI, EVI\n",
|
|
"\n",
|
|
"# 3. Predict land use classification\n",
|
|
"land_use_prediction = model.predict(features)\n",
|
|
"# → Kết quả: Mảng với giá trị 0-7 (8 lớp sử dụng đất)\n",
|
|
"\n",
|
|
"# 4. (Optional) Tính NDVI map riêng để hiển thị\n",
|
|
"ndvi_map = (NIR - Red) / (NIR + Red)\n",
|
|
"# → NDVI map chỉ để visualize, không phải prediction target\n",
|
|
"```\n",
|
|
"\n",
|
|
"## So sánh với approach cũ\n",
|
|
"\n",
|
|
"| Approach | Features | Target | NDVI Role |\n",
|
|
"|----------|----------|--------|-----------|\n",
|
|
"| ❌ Cũ (sai) | Chỉ NDVI | 8 lớp đất | Input duy nhất |\n",
|
|
"| ✅ Mới (đúng) | NDVI + NDWI + NDBI + EVI | 8 lớp đất | Một trong nhiều features |\n",
|
|
"\n",
|
|
"## Test Model\n",
|
|
"\n",
|
|
"```python\n",
|
|
"# Test với website\n",
|
|
"# 1. Upload model_land_use_odc.joblib lên server\n",
|
|
"# 2. Chọn model trong prediction interface\n",
|
|
"# 3. Chọn vùng và thời gian\n",
|
|
"# 4. System sẽ tự động:\n",
|
|
"# - Extract features (NDVI, NDWI, NDBI, EVI)\n",
|
|
"# - Predict land use classification\n",
|
|
"# - (Optional) Generate NDVI visualization map\n",
|
|
"```"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 19,
|
|
"id": "33dd516d-9824-499e-96b9-5cd9224c194c",
|
|
"metadata": {
|
|
"execution": {
|
|
"iopub.execute_input": "2026-07-15T08:35:50.771501Z",
|
|
"iopub.status.busy": "2026-07-15T08:35:50.771349Z",
|
|
"iopub.status.idle": "2026-07-15T08:35:50.774955Z",
|
|
"shell.execute_reply": "2026-07-15T08:35:50.774455Z"
|
|
},
|
|
"tags": []
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"======================================================================\n",
|
|
"CLEANUP\n",
|
|
"======================================================================\n",
|
|
"\n",
|
|
"🔄 Closing Dask client and cluster...\n",
|
|
"⚠️ Error during cleanup: name 'client' is not defined\n",
|
|
"\n",
|
|
"======================================================================\n",
|
|
"✅ PIPELINE COMPLETE\n",
|
|
"======================================================================\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"# 🛑 CLEANUP\n",
|
|
"print(\"=\"*70)\n",
|
|
"print(\"CLEANUP\")\n",
|
|
"print(\"=\"*70)\n",
|
|
"\n",
|
|
"print(\"\\n🔄 Closing Dask client and cluster...\")\n",
|
|
"try:\n",
|
|
" client.close()\n",
|
|
" cluster.close()\n",
|
|
" print(\"✅ Cleanup complete\")\n",
|
|
"except Exception as e:\n",
|
|
" print(f\"⚠️ Error during cleanup: {e}\")\n",
|
|
"\n",
|
|
"print(\"\\n\" + \"=\"*70)\n",
|
|
"print(\"✅ PIPELINE COMPLETE\")\n",
|
|
"print(\"=\"*70)"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "env_01",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.10.18"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|