{ "cells": [ { "cell_type": "markdown", "id": "5708d23d", "metadata": {}, "source": [ "# Dynamic World data\n", "\n", "Combine the label metadata, check the raw data, split train/val/test, and copy labels.\n", "Imagery downloads run separately in `scripts/ingest_scenes.py`.\n", "\n", "[Paper](https://pmc.ncbi.nlm.nih.gov/articles/PMC9184477/) · [Raw README](raw/README.txt) ·\n", "[PANGAEA labels](https://doi.pangaea.de/10.1594/PANGAEA.933475) · [Zenodo test data](https://zenodo.org/records/4766508)\n", "\n", "## 1. Load metadata\n", "\n", "The general workbook contains expert and non-expert labels. The other two contain\n", "individual expert labels and voting composites for the same 409 test scenes.\n", "The raw folders overlap; they are not separate train/val/test splits." ] }, { "cell_type": "code", "execution_count": 1, "id": "3b98df91", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:49.322398Z", "iopub.status.busy": "2026-11-16T13:28:49.322268Z", "iopub.status.idle": "2026-11-16T13:28:52.133705Z", "shell.execute_reply": "2026-11-16T13:28:52.133063Z" } }, "outputs": [ { "data": { "text/html": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = true;\n const version = '3.10.1'.replace('rc', '-rc.').replace('.dev', '-dev.');\n const reloading = false;\n const Bokeh = root.Bokeh;\n const BK_RE = /^https:\\/\\/cdn\\.bokeh\\.org\\/bokeh\\/(release|dev)\\/bokeh-/;\n const PN_RE = /^https:\\/\\/cdn\\.holoviz\\.org\\/panel\\/[^/]+\\/dist\\/panel/i;\n const JUPYTER_ENDPOINT = \"/panel-preview/\";\n const JUPYTER_EXTENSION_PATH = JUPYTER_ENDPOINT + \"static/extensions/panel/\";\n const CDN_DIST = \"https://cdn.holoviz.org/panel/1.10.0/dist/\";\n // Endpoint paths and the CDN urls serving the same files: Panel's dist,\n // each extension with a CDN and each BokehJS file.\n const CDN_MAP = [];\n // Executed notebooks retain this bootstrap when published as static pages.\n const live_notebook = root.Jupyter?.notebook != null || document.querySelector('.jp-LabShell') != null;\n root.__panel_live_notebook__ = live_notebook;\n // The lazy-resource registry needs the same export routing and CDN fallback.\n root.__panel_cdn_dist__ = CDN_DIST;\n root.__panel_cdn_map__ = CDN_MAP;\n\n function cdn_url(url) {\n const index = url.indexOf(JUPYTER_ENDPOINT);\n if (index === -1) {\n return null;\n }\n const path = url.slice(index + JUPYTER_ENDPOINT.length);\n for (const [prefix, cdn] of CDN_MAP) {\n if (path.startsWith(prefix)) {\n return cdn + path.slice(prefix.length);\n }\n }\n return null;\n }\n\n function resource_url(url) {\n return !live_notebook || root.__panel_endpoint_failed__ === true ? (cdn_url(url) ?? url) : url;\n }\n\n // Pending until this bootstrap has loaded everything (or given up), so\n // that output rendered meanwhile can wait for Panel's models.\n let bootstrap_resolve;\n const bootstrap = new Promise((resolve) => { bootstrap_resolve = resolve });\n root.__panel_bootstrap__ = bootstrap;\n function bootstrap_done() {\n if (root.__panel_bootstrap__ === bootstrap) {\n root.__panel_bootstrap__ = null;\n }\n bootstrap_resolve();\n }\n setTimeout(bootstrap_done, Math.max(5000, 15000));\n\n // jupyter_bokeh, which renders Panel output for comms='ipywidgets' and in\n // VS Code, builds a view as soon as its output arrives, so a notebook run\n // top to bottom can render before BokehJS has loaded or before panel.js\n // has registered the models the view needs. Both the classic notebook and\n // VS Code load jupyter_bokeh through RequireJS, so its fetch is held until\n // the bootstrap is done, and should it already be loaded, ipywidgets\n // awaits render(), which is held instead.\n function hold_bokeh_views(module) {\n const View = module?.BokehView;\n if (View == null || View.prototype.__panel_hold__ === true) {\n return;\n }\n const render = View.prototype.render;\n View.prototype.render = function(...args) {\n const pending = root.__panel_bootstrap__;\n return pending == null ? render.apply(this, args) : pending.then(() => render.apply(this, args));\n };\n View.prototype.__panel_hold__ = true;\n }\n if (root.requirejs != null) {\n for (const name of [\"@bokeh/jupyter_bokeh\", \"nbextensions/jupyter_bokeh/index\"]) {\n if (root.requirejs.defined(name)) {\n hold_bokeh_views(root.requirejs(name));\n }\n }\n const load = root.requirejs.load;\n if (load?.__panel_hold__ !== true) {\n root.requirejs.load = function(context, name, url) {\n const pending = root.__panel_bootstrap__;\n if (pending != null && name.includes(\"jupyter_bokeh\")) {\n pending.then(() => load.call(this, context, name, url));\n return;\n }\n return load.call(this, context, name, url);\n };\n root.requirejs.load.__panel_hold__ = true;\n }\n const on_resource_load = root.requirejs.onResourceLoad;\n if (on_resource_load?.__panel_hold__ !== true) {\n // Called once a module is defined but before it is handed to the\n // widget manager that asked for it.\n root.requirejs.onResourceLoad = function(context, map, deps) {\n if (map.id.includes(\"jupyter_bokeh\")) {\n hold_bokeh_views(context.defined[map.id]);\n }\n return on_resource_load?.apply(this, arguments);\n };\n root.requirejs.onResourceLoad.__panel_hold__ = true;\n }\n }\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 show_jupyter_extension_error() {\n if (!live_notebook) {\n return;\n }\n const element = document.getElementById(\"5a8c36d6-0c89-4bfc-aee8-ca637d1928b8\");\n if (element == null || !element.hidden) {\n return;\n }\n element.style.cssText = \"color: #b91c1c; font-family: sans-serif; padding: 0.5em;\";\n element.textContent = (\n \"Panel could not load resources from its Jupyter server extension. \" +\n \"Install Panel in the environment running the Jupyter server and restart it.\"\n );\n element.hidden = false;\n }\n root.__panel_jupyter_extension_error__ = show_jupyter_extension_error;\n\n\n function load_libs(css_urls, js_urls, js_modules, Bokeh, callback) {\n if (css_urls == null) css_urls = [];\n if (js_urls == null) js_urls = [];\n if (js_modules == null) js_modules = [];\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) {\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(url) {\n console.error(\"failed to load \" + url);\n if (url.includes(JUPYTER_ENDPOINT + \"static/\")) {\n show_jupyter_extension_error();\n }\n }\n\n function fallback_to_cdn(element, url, attribute, parent) {\n const fallback = cdn_url(url);\n if (fallback == null || element.dataset.panelCdnFallback != null) {\n return false;\n }\n element.dataset.panelCdnFallback = \"\";\n element.remove();\n element[attribute] = fallback;\n parent.appendChild(element);\n return true;\n }\n\n // Mirrors the AMD guard in panel/models/resources.ts: a UMD library that\n // is not loaded by RequireJS must take its browser-global branch, so\n // define.amd reads as undefined while one of these scripts executes. A\n // module script has no currentScript, so it is told apart by the\n // directory its code was loaded from.\n function install_amd_guard() {\n const define = root.define;\n if (typeof define !== \"function\" || define.amd == null || define.__panel_no_amd__ === true) {\n return;\n }\n const dirs = root.__panel_no_amd_dirs__ = root.__panel_no_amd_dirs__ || [];\n const hidden = () => {\n const script = document.currentScript;\n if (script != null) {\n return script.hasAttribute(\"data-panel-no-amd\");\n }\n const stack = new Error().stack || \"\";\n return dirs.some((dir) => stack.includes(dir));\n };\n let amd = define.amd;\n try {\n Object.defineProperty(define, \"amd\", {\n configurable: true,\n enumerable: true,\n get: () => hidden() ? undefined : amd,\n set: (value) => { amd = value },\n });\n Object.defineProperty(define, \"__panel_no_amd__\", {value: true});\n } catch (e) {\n console.warn(`Panel: could not hide RequireJS from component libraries: ${e}`);\n }\n }\n\n function hide_amd(element) {\n element.setAttribute(\"data-panel-no-amd\", \"\");\n install_amd_guard();\n }\n\n function hide_amd_module(url) {\n const dirs = root.__panel_no_amd_dirs__ = root.__panel_no_amd_dirs__ || [];\n const dir = new URL(url, document.baseURI).href.split(\"?\")[0].replace(/[^/]*$/, \"\");\n // panel.js itself lives in a dist root, and must never match.\n if (!/\\/(dist|static\\/extensions\\/panel)\\/$/.test(dir) && !dirs.includes(dir)) {\n dirs.push(dir);\n }\n install_amd_guard();\n }\n\n function inject_script_tag(url) {\n const element = document.createElement('script');\n hide_amd(element);\n element.onload = on_load;\n element.onerror = () => {\n if (!fallback_to_cdn(element, url, \"src\", document.head)) {\n on_error(url);\n }\n };\n element.async = false;\n element.src = resource_url(url);\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n\n const skip = [];\n // Held open until every resource below has been queued, then released\n // by on_load() at the end of this function.\n root._bokeh_is_loading = 1;\n if (window.requirejs) {\n const require_config = {'packages': {}, 'paths': {}, 'shim': {}};\n // RequireJS tries each path in turn, so a bundled copy the Jupyter\n // extension cannot serve falls back to the CDN, then to the original.\n const require_urls = (url) => {\n url = resource_url(url);\n const fallback = cdn_url(url);\n return fallback == null || fallback === url ? [url] : [url, fallback];\n };\n for (const [name, path] of Object.entries(require_config.paths || {})) {\n require_config.paths[name] = (Array.isArray(path) ? path : [path]).flatMap(require_urls);\n }\n window.requirejs.config(require_config);\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 continue;\n }\n const element = document.createElement(\"link\");\n root._bokeh_is_loading++;\n element.onload = on_load;\n element.onerror = () => {\n if (!fallback_to_cdn(element, url, \"href\", document.body)) {\n on_error(url);\n }\n };\n element.rel = \"stylesheet\";\n element.type = \"text/css\";\n element.href = resource_url(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 const shouldSkip = skip.includes(escaped) || existing_scripts.includes(escaped)\n const isBokehOrPanel = BK_RE.test(escaped) || PN_RE.test(escaped)\n const missingOrBroken = Bokeh == null || Bokeh.Panel == null || (Bokeh.version != version && !Bokeh.versions?.has(version)) || Bokeh.versions?.get(version)?.Panel == null;\n if (shouldSkip && !(isBokehOrPanel && missingOrBroken)) {\n continue;\n }\n root._bokeh_is_loading++;\n inject_script_tag(url);\n }\n for (let i = 0; i < js_modules.length; i++) {\n const [url, name] = js_modules[i];\n const escaped = encodeURI(url)\n const loaded = name == null ? existing_scripts.indexOf(escaped) !== -1 : root[name] != null\n if (skip.indexOf(escaped) !== -1 || loaded) {\n continue;\n }\n var element = document.createElement('script');\n hide_amd_module(resource_url(url));\n root._bokeh_is_loading++;\n element.onerror = () => {\n if (!fallback_to_cdn(element, url, \"src\", document.head)) {\n on_error(url);\n }\n };\n element.async = false;\n element.type = \"module\";\n if (name == null) {\n element.onload = on_load;\n element.src = resource_url(url);\n } else {\n // Namespace import rather than a default import, matching what the\n // resource registry's module wrapper assigns, so a library that only\n // has named exports resolves to its namespace instead of to undefined.\n // The import loads the module, so it gets no bare tag as well. The url\n // is absolutized because an import specifier resolves through the\n // import map unless it starts with a scheme, / or ./, whereas a src\n // resolves against the document.\n element.textContent = `\n import * as ns from \"${new URL(resource_url(url), document.baseURI).href}\"\n window.${name} = ns.default ?? ns\n window._bokeh_on_load()\n `\n }\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n // Releases the reservation taken above, running the callbacks now if\n // nothing else is outstanding.\n on_load()\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.10.0/dist/bundled/reactiveesm/es-module-shims@^1.10.0/dist/es-module-shims.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-3.10.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.10.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.10.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.10.1.min.js\", \"https://cdn.holoviz.org/panel/1.10.0/dist/panel.min.js\"];\n const js_modules = [];\n const css_urls = [];\n const inline_js = [ function(Bokeh, define, module, exports) {\nBokeh.set_log_level(\"info\");\n },\nfunction(Bokeh, define, module, exports) {} // ensure no trailing comma for IE\n ];\n\n // Resolved once RequireJS has loaded its libraries and assigned their\n // globals, so the resource registry can wait for them instead of racing.\n let require_ready_resolve;\n const require_ready = new Promise((resolve) => { require_ready_resolve = resolve }); require_ready_resolve();\n // Module exports are only assigned once their libraries have loaded. A\n // library that fails to load never finishes the load, so the wait is bounded\n // and the registry loads whatever is still missing itself.\n let libs_ready_resolve;\n const libs_ready = new Promise((resolve) => { libs_ready_resolve = resolve });\n setTimeout(() => libs_ready_resolve(), 5000 || 5000);\n\n function declare_resources() {\n // Tells the panel.js resource registry which component libraries this\n // bundle has already satisfied, so nothing is fetched a second time.\n // In inline mode the libraries have no URLs at all, which makes this\n // the only way the registry can know about them.\n const declared = {\"libs\": [{\"name\": \"reactiveesm:extra\", \"js\": [\"https://cdn.holoviz.org/panel/1.10.0/dist/bundled/reactiveesm/es-module-shims@^1.10.0/dist/es-module-shims.min.js\"]}]};\n if (!declared || !(declared.libs || declared.css)) {\n return;\n }\n // Libraries RequireJS is loading are claimed against require_ready\n // instead of being declared, since they are not ready yet.\n const require_urls = window.requirejs ? [] : [];\n const satisfied = [], pending = [], exporting = [];\n for (const lib of declared.libs || []) {\n const urls = lib.js || [];\n const by_require = urls.length > 0 && urls.every((url) => require_urls.includes(url));\n const exports = (lib.modules || []).some((module) => module.export != null);\n (by_require ? pending : exports ? exporting : satisfied).push(lib);\n }\n const declarations = [{libs: satisfied, css: declared.css}];\n if (pending.length > 0) {\n declarations.push({libs: pending, ready: require_ready});\n }\n if (exporting.length > 0) {\n declarations.push({libs: exporting, ready: libs_ready});\n }\n for (const declaration of declarations) {\n if (root.__panel_resources__ != null) {\n if (declaration.ready != null) {\n root.__panel_resources__.claim(declaration, declaration.ready);\n } else {\n root.__panel_resources__.declare(declaration);\n }\n } else {\n (root.__panel_resources_declared__ = root.__panel_resources_declared__ || []).push(declaration);\n }\n }\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 // Views waiting on this run once the current task is done, by which\n // point the load callback has also restored root.Bokeh.\n bootstrap_done();\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 bootstrap_done();\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 = Bokeh != null && ((Bokeh.version === version && Bokeh.Panel) || (Bokeh.versions?.has(version) && Bokeh.versions.get(version)?.Panel));\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, Bokeh, function() {\n console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n libs_ready_resolve();\n run_inline_js();\n if (Bokeh != undefined && !reloading) {\n const NewBokeh = root.Bokeh;\n if (Bokeh.versions === undefined) {\n Bokeh.versions = new Map();\n }\n if (NewBokeh.version !== Bokeh.version) {\n Bokeh[NewBokeh.version] = NewBokeh;\n Bokeh.versions.set(NewBokeh.version, NewBokeh);\n }\n root.Bokeh = Bokeh;\n }\n });\n }\n }\n // Declared synchronously, before anything is scheduled, so a cell whose\n // output embeds while libraries are still loading finds this in place\n // instead of fetching its own second copy of each.\n declare_resources();\n // Give older versions of the autoload script a head-start to ensure\n // they initialize before we start loading newer version.\n setTimeout(load_or_wait, 100)\n}(window));", "application/vnd.holoviews_load.v0+json": "" }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": "\nif ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n}\n\n\n function JupyterCommManager() {\n }\n\n JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n comm_manager.register_target(comm_id, function(comm) {\n comm.on_msg(msg_handler);\n });\n } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n comm.onMsg = msg_handler;\n });\n } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n var messages = comm.messages[Symbol.asyncIterator]();\n function processIteratorResult(result) {\n var message = result.value;\n 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", "application/vnd.holoviews_load.v0+json": "" }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.holoviews_exec.v0+json": "", "text/html": [ "
\n", "
\n", "
\n", "" ] }, "metadata": { "application/vnd.holoviews_exec.v0+json": { "id": "a20fade1-c28e-40c1-9007-8a4d89c3d84a" } }, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "\n", "\n", "\n", "
\n", "\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "ⓘ\n", "
\n", "\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from pathlib import Path\n", "import shutil\n", "\n", "import geopandas as gpd\n", "import holoviews as hv\n", "import pandas as pd\n", "import yaml\n", "\n", "import geosave as gs\n", "\n", "hv.extension(\"matplotlib\")\n", "RAW = Path(\"raw\")\n", "PROCESSED = Path(\"processed\")" ] }, { "cell_type": "code", "execution_count": 2, "id": "398ddb54", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:52.135174Z", "iopub.status.busy": "2026-11-16T13:28:52.135002Z", "iopub.status.idle": "2026-11-16T13:28:57.338040Z", "shell.execute_reply": "2026-11-16T13:28:57.337229Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dw_idlabelerlonlatutmcrshemispherebiomebiome_namedate...ScrubSnow_IceTreesWaterS2_DATASTRIP_IDS2_GEE_IDS2_GRIDS2_PRODUCT_IDS2_SENSING_ORBIT_DIRECTIONgeometry
0dw_-155.6160479818_19.2068319501-20190116Non-expert-155.6160519.206835Nepsg:32605WH1Tropical & Subtropical Moist Broadleaf Forests2019-01-16...0.0652700.00.8976180.000000S2A_OPER_MSI_L2A_DS_MPS__20190116T223213_S2019...20190116T210921_20190116T210920_T05QKB04QHGS2A_MSIL2A_20190116T210921_N0211_R057_T05QKB_2...DESCENDINGPOLYGON ((222380 2123230, 227480 2123230, 2274...
1dw_-98.0871096142_21.4083687600-20190417Non-expert-98.0871121.4083714Nepsg:32614WH1Tropical & Subtropical Moist Broadleaf Forests2019-04-17...0.8295580.00.1109670.002723S2A_OPER_MSI_L2A_DS_SGS__20190417T212405_S2019...20190417T165901_20190417T170814_T14QNJ14QNJS2A_MSIL2A_20190417T165901_N0211_R069_T14QNJ_2...DESCENDINGPOLYGON ((592070 2365060, 597170 2365060, 5971...
2dw_-98.0880868118_22.5550025151-20190221Non-expert-98.0880922.5550014Nepsg:32614WH1Tropical & Subtropical Moist Broadleaf Forests2019-02-21...0.1924360.00.0367630.028544S2B_OPER_MSI_L2A_DS_EPAE_20190221T224412_S2019...20190221T170329_20190221T170828_T14QNK14QNKS2B_MSIL2A_20190221T170329_N0211_R069_T14QNK_2...DESCENDINGPOLYGON ((591220 2491990, 596320 2491990, 5963...
3dw_-98.2037004534_20.7662538571-20190417Non-expert-98.2037020.7662514Nepsg:32614WH1Tropical & Subtropical Moist Broadleaf Forests2019-04-17...0.3477300.00.6096250.014381S2A_OPER_MSI_L2A_DS_SGS__20190417T212405_S2019...20190417T165901_20190417T170814_T14QNJ14QNHS2A_MSIL2A_20190417T165901_N0211_R069_T14QNJ_2...DESCENDINGPOLYGON ((580340 2293930, 585440 2293930, 5854...
4dw_-98.7387565145_23.9768283715-20190122Non-expert-98.7387623.9768314Nepsg:32614WH1Tropical & Subtropical Moist Broadleaf Forests2019-01-22...0.0011960.00.0000000.998804S2B_OPER_MSI_L2A_DS_MTI__20190122T213001_S2019...20190122T170619_20190122T170648_T14QNM14QNMS2B_MSIL2A_20190122T170619_N0211_R069_T14QNM_2...DESCENDINGPOLYGON ((524030 2649130, 529130 2649130, 5291...
\n", "

5 rows × 28 columns

\n", "
" ], "text/plain": [ " dw_id labeler lon lat \\\n", "0 dw_-155.6160479818_19.2068319501-20190116 Non-expert -155.61605 19.20683 \n", "1 dw_-98.0871096142_21.4083687600-20190417 Non-expert -98.08711 21.40837 \n", "2 dw_-98.0880868118_22.5550025151-20190221 Non-expert -98.08809 22.55500 \n", "3 dw_-98.2037004534_20.7662538571-20190417 Non-expert -98.20370 20.76625 \n", "4 dw_-98.7387565145_23.9768283715-20190122 Non-expert -98.73876 23.97683 \n", "\n", " utm crs hemisphere biome \\\n", "0 5N epsg:32605 WH 1 \n", "1 14N epsg:32614 WH 1 \n", "2 14N epsg:32614 WH 1 \n", "3 14N epsg:32614 WH 1 \n", "4 14N epsg:32614 WH 1 \n", "\n", " biome_name date ... Scrub \\\n", "0 Tropical & Subtropical Moist Broadleaf Forests 2019-01-16 ... 0.065270 \n", "1 Tropical & Subtropical Moist Broadleaf Forests 2019-04-17 ... 0.829558 \n", "2 Tropical & Subtropical Moist Broadleaf Forests 2019-02-21 ... 0.192436 \n", "3 Tropical & Subtropical Moist Broadleaf Forests 2019-04-17 ... 0.347730 \n", "4 Tropical & Subtropical Moist Broadleaf Forests 2019-01-22 ... 0.001196 \n", "\n", " Snow_Ice Trees Water \\\n", "0 0.0 0.897618 0.000000 \n", "1 0.0 0.110967 0.002723 \n", "2 0.0 0.036763 0.028544 \n", "3 0.0 0.609625 0.014381 \n", "4 0.0 0.000000 0.998804 \n", "\n", " S2_DATASTRIP_ID \\\n", "0 S2A_OPER_MSI_L2A_DS_MPS__20190116T223213_S2019... \n", "1 S2A_OPER_MSI_L2A_DS_SGS__20190417T212405_S2019... \n", "2 S2B_OPER_MSI_L2A_DS_EPAE_20190221T224412_S2019... \n", "3 S2A_OPER_MSI_L2A_DS_SGS__20190417T212405_S2019... \n", "4 S2B_OPER_MSI_L2A_DS_MTI__20190122T213001_S2019... \n", "\n", " S2_GEE_ID S2_GRID \\\n", "0 20190116T210921_20190116T210920_T05QKB 04QHG \n", "1 20190417T165901_20190417T170814_T14QNJ 14QNJ \n", "2 20190221T170329_20190221T170828_T14QNK 14QNK \n", "3 20190417T165901_20190417T170814_T14QNJ 14QNH \n", "4 20190122T170619_20190122T170648_T14QNM 14QNM \n", "\n", " S2_PRODUCT_ID \\\n", "0 S2A_MSIL2A_20190116T210921_N0211_R057_T05QKB_2... \n", "1 S2A_MSIL2A_20190417T165901_N0211_R069_T14QNJ_2... \n", "2 S2B_MSIL2A_20190221T170329_N0211_R069_T14QNK_2... \n", "3 S2A_MSIL2A_20190417T165901_N0211_R069_T14QNJ_2... \n", "4 S2B_MSIL2A_20190122T170619_N0211_R069_T14QNM_2... \n", "\n", " S2_SENSING_ORBIT_DIRECTION \\\n", "0 DESCENDING \n", "1 DESCENDING \n", "2 DESCENDING \n", "3 DESCENDING \n", "4 DESCENDING \n", "\n", " geometry \n", "0 POLYGON ((222380 2123230, 227480 2123230, 2274... \n", "1 POLYGON ((592070 2365060, 597170 2365060, 5971... \n", "2 POLYGON ((591220 2491990, 596320 2491990, 5963... \n", "3 POLYGON ((580340 2293930, 585440 2293930, 5854... \n", "4 POLYGON ((524030 2649130, 529130 2649130, 5291... \n", "\n", "[5 rows x 28 columns]" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "general_df = pd.read_excel(RAW / \"v1_dw_tile_metadata_for_public_release.xlsx\")\n", "\n", "general_df.head()" ] }, { "cell_type": "code", "execution_count": 3, "id": "6aee74b1", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:57.339990Z", "iopub.status.busy": "2026-11-16T13:28:57.339733Z", "iopub.status.idle": "2026-11-16T13:28:57.602749Z", "shell.execute_reply": "2026-11-16T13:28:57.601745Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dw_idlonlatutmcrshemispherebiomebiome_namedatetimestamp...ScrubSnow_IceTreesWaterS2_DATASTRIP_IDS2_GEE_IDS2_GRIDS2_PRODUCT_IDS2_SENSING_ORBIT_DIRECTIONgeometry
0dw_125.0556501349_46.4967153222-20191006_07125.05565046.49671551Nepsg:32651EH9Flooded Grasslands & Savannas2019-10-061570320000000...0.3706920.00.0000000.045335S2A_OPER_MSI_L2A_DS_EPAE_20191006T061732_S2019...20191006T023551_20191006T023945_T51TXM51TXMS2A_MSIL2A_20191006T023551_N0213_R089_T51TXM_2...DESCENDINGPOLYGON ((655200 5148740, 660300 5148740, 6603...
1dw_125.0556501349_46.4967153222-20191006_01125.05565046.49671551Nepsg:32651EH9Flooded Grasslands & Savannas2019-10-061570320000000...0.0000000.00.0120940.113552S2A_OPER_MSI_L2A_DS_EPAE_20191006T061732_S2019...20191006T023551_20191006T023945_T51TXM51TXMS2A_MSIL2A_20191006T023551_N0213_R089_T51TXM_2...DESCENDINGPOLYGON ((655200 5148740, 660300 5148740, 6603...
2dw_125.0556501349_46.4967153222-20191006_11-1125.05565046.49671551Nepsg:32651EH9Flooded Grasslands & Savannas2019-10-061570320000000...0.0000000.00.0000000.020620S2A_OPER_MSI_L2A_DS_EPAE_20191006T061732_S2019...20191006T023551_20191006T023945_T51TXM51TXMS2A_MSIL2A_20191006T023551_N0213_R089_T51TXM_2...DESCENDINGPOLYGON ((655200 5148740, 660300 5148740, 6603...
3dw_22.2210659928_-18.6779473193-20190809_05-122.221066-18.67794734Sepsg:32734EH9Flooded Grasslands & Savannas2019-08-091565310000000...0.0004660.00.0000000.016862S2A_OPER_MSI_L2A_DS_SGS__20190809T110812_S2019...20190809T081611_20190809T083630_T34KFE34KFES2A_MSIL2A_20190809T081611_N0213_R121_T34KFE_2...DESCENDINGPOLYGON ((626230 7931810, 631330 7931810, 6313...
4dw_22.2210659928_-18.6779473193-20190809_0922.221066-18.67794734Sepsg:32734EH9Flooded Grasslands & Savannas2019-08-091565310000000...0.0000000.00.2998450.015060S2A_OPER_MSI_L2A_DS_SGS__20190809T110812_S2019...20190809T081611_20190809T083630_T34KFE34KFES2A_MSIL2A_20190809T081611_N0213_R121_T34KFE_2...DESCENDINGPOLYGON ((626230 7931810, 631330 7931810, 6313...
\n", "

5 rows × 27 columns

\n", "
" ], "text/plain": [ " dw_id lon lat utm \\\n", "0 dw_125.0556501349_46.4967153222-20191006_07 125.055650 46.496715 51N \n", "1 dw_125.0556501349_46.4967153222-20191006_01 125.055650 46.496715 51N \n", "2 dw_125.0556501349_46.4967153222-20191006_11-1 125.055650 46.496715 51N \n", "3 dw_22.2210659928_-18.6779473193-20190809_05-1 22.221066 -18.677947 34S \n", "4 dw_22.2210659928_-18.6779473193-20190809_09 22.221066 -18.677947 34S \n", "\n", " crs hemisphere biome biome_name date \\\n", "0 epsg:32651 EH 9 Flooded Grasslands & Savannas 2019-10-06 \n", "1 epsg:32651 EH 9 Flooded Grasslands & Savannas 2019-10-06 \n", "2 epsg:32651 EH 9 Flooded Grasslands & Savannas 2019-10-06 \n", "3 epsg:32734 EH 9 Flooded Grasslands & Savannas 2019-08-09 \n", "4 epsg:32734 EH 9 Flooded Grasslands & Savannas 2019-08-09 \n", "\n", " timestamp ... Scrub Snow_Ice Trees Water \\\n", "0 1570320000000 ... 0.370692 0.0 0.000000 0.045335 \n", "1 1570320000000 ... 0.000000 0.0 0.012094 0.113552 \n", "2 1570320000000 ... 0.000000 0.0 0.000000 0.020620 \n", "3 1565310000000 ... 0.000466 0.0 0.000000 0.016862 \n", "4 1565310000000 ... 0.000000 0.0 0.299845 0.015060 \n", "\n", " S2_DATASTRIP_ID \\\n", "0 S2A_OPER_MSI_L2A_DS_EPAE_20191006T061732_S2019... \n", "1 S2A_OPER_MSI_L2A_DS_EPAE_20191006T061732_S2019... \n", "2 S2A_OPER_MSI_L2A_DS_EPAE_20191006T061732_S2019... \n", "3 S2A_OPER_MSI_L2A_DS_SGS__20190809T110812_S2019... \n", "4 S2A_OPER_MSI_L2A_DS_SGS__20190809T110812_S2019... \n", "\n", " S2_GEE_ID S2_GRID \\\n", "0 20191006T023551_20191006T023945_T51TXM 51TXM \n", "1 20191006T023551_20191006T023945_T51TXM 51TXM \n", "2 20191006T023551_20191006T023945_T51TXM 51TXM \n", "3 20190809T081611_20190809T083630_T34KFE 34KFE \n", "4 20190809T081611_20190809T083630_T34KFE 34KFE \n", "\n", " S2_PRODUCT_ID \\\n", "0 S2A_MSIL2A_20191006T023551_N0213_R089_T51TXM_2... \n", "1 S2A_MSIL2A_20191006T023551_N0213_R089_T51TXM_2... \n", "2 S2A_MSIL2A_20191006T023551_N0213_R089_T51TXM_2... \n", "3 S2A_MSIL2A_20190809T081611_N0213_R121_T34KFE_2... \n", "4 S2A_MSIL2A_20190809T081611_N0213_R121_T34KFE_2... \n", "\n", " S2_SENSING_ORBIT_DIRECTION \\\n", "0 DESCENDING \n", "1 DESCENDING \n", "2 DESCENDING \n", "3 DESCENDING \n", "4 DESCENDING \n", "\n", " geometry \n", "0 POLYGON ((655200 5148740, 660300 5148740, 6603... \n", "1 POLYGON ((655200 5148740, 660300 5148740, 6603... \n", "2 POLYGON ((655200 5148740, 660300 5148740, 6603... \n", "3 POLYGON ((626230 7931810, 631330 7931810, 6313... \n", "4 POLYGON ((626230 7931810, 631330 7931810, 6313... \n", "\n", "[5 rows x 27 columns]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "individuals_df = pd.read_excel(\n", " RAW / \"validation/validation_set/v1_dw_validation_set_metadata_individual_experts.xlsx\"\n", ")\n", "\n", "individuals_df.head()" ] }, { "cell_type": "code", "execution_count": 4, "id": "07ca1141", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:57.604664Z", "iopub.status.busy": "2026-11-16T13:28:57.604496Z", "iopub.status.idle": "2026-11-16T13:28:57.925740Z", "shell.execute_reply": "2026-11-16T13:28:57.924794Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dw_idlonlatutmcrshemispherebiomebiome_namedatetimestamp...ScrubSnow_IceTreesWaterS2_DATASTRIP_IDS2_GEE_IDS2_GRIDS2_PRODUCT_IDS2_SENSING_ORBIT_DIRECTIONgeometry
0dw_22.2210659928_-18.6779473193-20190809_simpl...22.221066-18.67794734Sepsg:32734EH9Flooded Grasslands & Savannas2019-08-091565310000000...0.0000000.00.0000000.016633S2A_OPER_MSI_L2A_DS_SGS__20190809T110812_S2019...20190809T081611_20190809T083630_T34KFE34KFES2A_MSIL2A_20190809T081611_N0213_R121_T34KFE_2...DESCENDINGPOLYGON ((626230 7931810, 631330 7931810, 6313...
1dw_22.2210659928_-18.6779473193-20190809_strict22.221066-18.67794734Sepsg:32734EH9Flooded Grasslands & Savannas2019-08-091565310000000...0.0000000.00.0000000.031963S2A_OPER_MSI_L2A_DS_SGS__20190809T110812_S2019...20190809T081611_20190809T083630_T34KFE34KFES2A_MSIL2A_20190809T081611_N0213_R121_T34KFE_2...DESCENDINGPOLYGON ((626230 7931810, 631330 7931810, 6313...
2dw_22.2210659928_-18.6779473193-20190809_majority22.221066-18.67794734Sepsg:32734EH9Flooded Grasslands & Savannas2019-08-091565310000000...0.0004050.00.0188600.018284S2A_OPER_MSI_L2A_DS_SGS__20190809T110812_S2019...20190809T081611_20190809T083630_T34KFE34KFES2A_MSIL2A_20190809T081611_N0213_R121_T34KFE_2...DESCENDINGPOLYGON ((626230 7931810, 631330 7931810, 6313...
3dw_22.2210659928_-18.6779473193-20190809_conse...22.221066-18.67794734Sepsg:32734EH9Flooded Grasslands & Savannas2019-08-091565310000000...0.0004650.00.0216460.020985S2A_OPER_MSI_L2A_DS_SGS__20190809T110812_S2019...20190809T081611_20190809T083630_T34KFE34KFES2A_MSIL2A_20190809T081611_N0213_R121_T34KFE_2...DESCENDINGPOLYGON ((626230 7931810, 631330 7931810, 6313...
4dw_134.5874674093_47.4598876765-20191002_strict134.58746747.45988853Nepsg:32653EH9Flooded Grasslands & Savannas2019-10-021569970000000...0.0000000.00.2033110.081428S2B_OPER_MSI_L2A_DS_EPAE_20191002T042909_S2019...20191002T020659_20191002T020653_T53TMN53TMNS2B_MSIL2A_20191002T020659_N0213_R103_T53TMN_2...DESCENDINGPOLYGON ((466360 5253800, 471460 5253800, 4714...
\n", "

5 rows × 27 columns

\n", "
" ], "text/plain": [ " dw_id lon lat \\\n", "0 dw_22.2210659928_-18.6779473193-20190809_simpl... 22.221066 -18.677947 \n", "1 dw_22.2210659928_-18.6779473193-20190809_strict 22.221066 -18.677947 \n", "2 dw_22.2210659928_-18.6779473193-20190809_majority 22.221066 -18.677947 \n", "3 dw_22.2210659928_-18.6779473193-20190809_conse... 22.221066 -18.677947 \n", "4 dw_134.5874674093_47.4598876765-20191002_strict 134.587467 47.459888 \n", "\n", " utm crs hemisphere biome biome_name \\\n", "0 34S epsg:32734 EH 9 Flooded Grasslands & Savannas \n", "1 34S epsg:32734 EH 9 Flooded Grasslands & Savannas \n", "2 34S epsg:32734 EH 9 Flooded Grasslands & Savannas \n", "3 34S epsg:32734 EH 9 Flooded Grasslands & Savannas \n", "4 53N epsg:32653 EH 9 Flooded Grasslands & Savannas \n", "\n", " date timestamp ... Scrub Snow_Ice Trees Water \\\n", "0 2019-08-09 1565310000000 ... 0.000000 0.0 0.000000 0.016633 \n", "1 2019-08-09 1565310000000 ... 0.000000 0.0 0.000000 0.031963 \n", "2 2019-08-09 1565310000000 ... 0.000405 0.0 0.018860 0.018284 \n", "3 2019-08-09 1565310000000 ... 0.000465 0.0 0.021646 0.020985 \n", "4 2019-10-02 1569970000000 ... 0.000000 0.0 0.203311 0.081428 \n", "\n", " S2_DATASTRIP_ID \\\n", "0 S2A_OPER_MSI_L2A_DS_SGS__20190809T110812_S2019... \n", "1 S2A_OPER_MSI_L2A_DS_SGS__20190809T110812_S2019... \n", "2 S2A_OPER_MSI_L2A_DS_SGS__20190809T110812_S2019... \n", "3 S2A_OPER_MSI_L2A_DS_SGS__20190809T110812_S2019... \n", "4 S2B_OPER_MSI_L2A_DS_EPAE_20191002T042909_S2019... \n", "\n", " S2_GEE_ID S2_GRID \\\n", "0 20190809T081611_20190809T083630_T34KFE 34KFE \n", "1 20190809T081611_20190809T083630_T34KFE 34KFE \n", "2 20190809T081611_20190809T083630_T34KFE 34KFE \n", "3 20190809T081611_20190809T083630_T34KFE 34KFE \n", "4 20191002T020659_20191002T020653_T53TMN 53TMN \n", "\n", " S2_PRODUCT_ID \\\n", "0 S2A_MSIL2A_20190809T081611_N0213_R121_T34KFE_2... \n", "1 S2A_MSIL2A_20190809T081611_N0213_R121_T34KFE_2... \n", "2 S2A_MSIL2A_20190809T081611_N0213_R121_T34KFE_2... \n", "3 S2A_MSIL2A_20190809T081611_N0213_R121_T34KFE_2... \n", "4 S2B_MSIL2A_20191002T020659_N0213_R103_T53TMN_2... \n", "\n", " S2_SENSING_ORBIT_DIRECTION \\\n", "0 DESCENDING \n", "1 DESCENDING \n", "2 DESCENDING \n", "3 DESCENDING \n", "4 DESCENDING \n", "\n", " geometry \n", "0 POLYGON ((626230 7931810, 631330 7931810, 6313... \n", "1 POLYGON ((626230 7931810, 631330 7931810, 6313... \n", "2 POLYGON ((626230 7931810, 631330 7931810, 6313... \n", "3 POLYGON ((626230 7931810, 631330 7931810, 6313... \n", "4 POLYGON ((466360 5253800, 471460 5253800, 4714... \n", "\n", "[5 rows x 27 columns]" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "composites_df = pd.read_excel(\n", " RAW / \"validation/validation_set/v1_dw_validation_set_metadata_composites.xlsx\"\n", ")\n", "\n", "composites_df.head()" ] }, { "cell_type": "markdown", "id": "6db174ad", "metadata": {}, "source": [ "Keep the original IDs and workbook columns. Add who annotated the label,\n", "whether it is individual or composite, and its voting rule.\n", "`source_group` records the original folder, not the split." ] }, { "cell_type": "code", "execution_count": 5, "id": "03eb40e2", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:57.927407Z", "iopub.status.busy": "2026-11-16T13:28:57.927152Z", "iopub.status.idle": "2026-11-16T13:28:57.939837Z", "shell.execute_reply": "2026-11-16T13:28:57.939053Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dw_idlabelerannotation_sourceannotation_type
0dw_-155.6160479818_19.2068319501-20190116Non-expertnon_expertindividual
1dw_-98.0871096142_21.4083687600-20190417Non-expertnon_expertindividual
2dw_-98.0880868118_22.5550025151-20190221Non-expertnon_expertindividual
3dw_-98.2037004534_20.7662538571-20190417Non-expertnon_expertindividual
4dw_-98.7387565145_23.9768283715-20190122Non-expertnon_expertindividual
\n", "
" ], "text/plain": [ " dw_id labeler annotation_source \\\n", "0 dw_-155.6160479818_19.2068319501-20190116 Non-expert non_expert \n", "1 dw_-98.0871096142_21.4083687600-20190417 Non-expert non_expert \n", "2 dw_-98.0880868118_22.5550025151-20190221 Non-expert non_expert \n", "3 dw_-98.2037004534_20.7662538571-20190417 Non-expert non_expert \n", "4 dw_-98.7387565145_23.9768283715-20190122 Non-expert non_expert \n", "\n", " annotation_type \n", "0 individual \n", "1 individual \n", "2 individual \n", "3 individual \n", "4 individual " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "general_df[\"annotation_source\"] = general_df[\"labeler\"].map({\n", " \"Experts\": \"expert\",\n", " \"Non-expert\": \"non_expert\",\n", "})\n", "general_df[\"source_group\"] = general_df[\"labeler\"].map({\n", " \"Experts\": \"experts\",\n", " \"Non-expert\": \"non_expert\",\n", "})\n", "general_df[\"annotation_type\"] = \"individual\"\n", "general_df[\"voting_rule\"] = None\n", "\n", "general_df[[\"dw_id\", \"labeler\", \"annotation_source\", \"annotation_type\"]].head()" ] }, { "cell_type": "code", "execution_count": 6, "id": "516f41a9", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:57.941805Z", "iopub.status.busy": "2026-11-16T13:28:57.941646Z", "iopub.status.idle": "2026-11-16T13:28:57.949935Z", "shell.execute_reply": "2026-11-16T13:28:57.948978Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dw_idannotation_sourceannotation_type
0dw_125.0556501349_46.4967153222-20191006_07expertindividual
1dw_125.0556501349_46.4967153222-20191006_01expertindividual
2dw_125.0556501349_46.4967153222-20191006_11-1expertindividual
3dw_22.2210659928_-18.6779473193-20190809_05-1expertindividual
4dw_22.2210659928_-18.6779473193-20190809_09expertindividual
\n", "
" ], "text/plain": [ " dw_id annotation_source \\\n", "0 dw_125.0556501349_46.4967153222-20191006_07 expert \n", "1 dw_125.0556501349_46.4967153222-20191006_01 expert \n", "2 dw_125.0556501349_46.4967153222-20191006_11-1 expert \n", "3 dw_22.2210659928_-18.6779473193-20190809_05-1 expert \n", "4 dw_22.2210659928_-18.6779473193-20190809_09 expert \n", "\n", " annotation_type \n", "0 individual \n", "1 individual \n", "2 individual \n", "3 individual \n", "4 individual " ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "individuals_df[\"annotation_source\"] = \"expert\"\n", "individuals_df[\"source_group\"] = \"individual_experts\"\n", "individuals_df[\"annotation_type\"] = \"individual\"\n", "individuals_df[\"voting_rule\"] = None\n", "\n", "individuals_df[[\"dw_id\", \"annotation_source\", \"annotation_type\"]].head()" ] }, { "cell_type": "code", "execution_count": 7, "id": "afccf234", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:57.951760Z", "iopub.status.busy": "2026-11-16T13:28:57.951603Z", "iopub.status.idle": "2026-11-16T13:28:57.961194Z", "shell.execute_reply": "2026-11-16T13:28:57.960715Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dw_idannotation_typevoting_rule
0dw_22.2210659928_-18.6779473193-20190809_simpl...compositesimple_majority
1dw_22.2210659928_-18.6779473193-20190809_strictcompositestrict
2dw_22.2210659928_-18.6779473193-20190809_majoritycompositemajority
3dw_22.2210659928_-18.6779473193-20190809_conse...compositeconsensus
4dw_134.5874674093_47.4598876765-20191002_strictcompositestrict
\n", "
" ], "text/plain": [ " dw_id annotation_type \\\n", "0 dw_22.2210659928_-18.6779473193-20190809_simpl... composite \n", "1 dw_22.2210659928_-18.6779473193-20190809_strict composite \n", "2 dw_22.2210659928_-18.6779473193-20190809_majority composite \n", "3 dw_22.2210659928_-18.6779473193-20190809_conse... composite \n", "4 dw_134.5874674093_47.4598876765-20191002_strict composite \n", "\n", " voting_rule \n", "0 simple_majority \n", "1 strict \n", "2 majority \n", "3 consensus \n", "4 strict " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "composites_df[\"annotation_source\"] = \"expert\"\n", "composites_df[\"source_group\"] = \"expert_composites\"\n", "composites_df[\"annotation_type\"] = \"composite\"\n", "composites_df[\"voting_rule\"] = composites_df[\"dw_id\"].str.split(\"_\", n=3).str[3]\n", "\n", "composites_df[[\"dw_id\", \"annotation_type\", \"voting_rule\"]].head()" ] }, { "cell_type": "code", "execution_count": 8, "id": "cdead303", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:57.964055Z", "iopub.status.busy": "2026-11-16T13:28:57.963781Z", "iopub.status.idle": "2026-11-16T13:28:57.995947Z", "shell.execute_reply": "2026-11-16T13:28:57.995165Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dw_idlabelerlonlatutmcrshemispherebiomebiome_namedate...S2_DATASTRIP_IDS2_GEE_IDS2_GRIDS2_PRODUCT_IDS2_SENSING_ORBIT_DIRECTIONgeometryannotation_sourcesource_groupannotation_typevoting_rule
0dw_-155.6160479818_19.2068319501-20190116Non-expert-155.6160519.206835Nepsg:32605WH1Tropical & Subtropical Moist Broadleaf Forests2019-01-16...S2A_OPER_MSI_L2A_DS_MPS__20190116T223213_S2019...20190116T210921_20190116T210920_T05QKB04QHGS2A_MSIL2A_20190116T210921_N0211_R057_T05QKB_2...DESCENDINGPOLYGON ((222380 2123230, 227480 2123230, 2274...non_expertnon_expertindividualNone
1dw_-98.0871096142_21.4083687600-20190417Non-expert-98.0871121.4083714Nepsg:32614WH1Tropical & Subtropical Moist Broadleaf Forests2019-04-17...S2A_OPER_MSI_L2A_DS_SGS__20190417T212405_S2019...20190417T165901_20190417T170814_T14QNJ14QNJS2A_MSIL2A_20190417T165901_N0211_R069_T14QNJ_2...DESCENDINGPOLYGON ((592070 2365060, 597170 2365060, 5971...non_expertnon_expertindividualNone
2dw_-98.0880868118_22.5550025151-20190221Non-expert-98.0880922.5550014Nepsg:32614WH1Tropical & Subtropical Moist Broadleaf Forests2019-02-21...S2B_OPER_MSI_L2A_DS_EPAE_20190221T224412_S2019...20190221T170329_20190221T170828_T14QNK14QNKS2B_MSIL2A_20190221T170329_N0211_R069_T14QNK_2...DESCENDINGPOLYGON ((591220 2491990, 596320 2491990, 5963...non_expertnon_expertindividualNone
3dw_-98.2037004534_20.7662538571-20190417Non-expert-98.2037020.7662514Nepsg:32614WH1Tropical & Subtropical Moist Broadleaf Forests2019-04-17...S2A_OPER_MSI_L2A_DS_SGS__20190417T212405_S2019...20190417T165901_20190417T170814_T14QNJ14QNHS2A_MSIL2A_20190417T165901_N0211_R069_T14QNJ_2...DESCENDINGPOLYGON ((580340 2293930, 585440 2293930, 5854...non_expertnon_expertindividualNone
4dw_-98.7387565145_23.9768283715-20190122Non-expert-98.7387623.9768314Nepsg:32614WH1Tropical & Subtropical Moist Broadleaf Forests2019-01-22...S2B_OPER_MSI_L2A_DS_MTI__20190122T213001_S2019...20190122T170619_20190122T170648_T14QNM14QNMS2B_MSIL2A_20190122T170619_N0211_R069_T14QNM_2...DESCENDINGPOLYGON ((524030 2649130, 529130 2649130, 5291...non_expertnon_expertindividualNone
\n", "

5 rows × 32 columns

\n", "
" ], "text/plain": [ " dw_id labeler lon lat \\\n", "0 dw_-155.6160479818_19.2068319501-20190116 Non-expert -155.61605 19.20683 \n", "1 dw_-98.0871096142_21.4083687600-20190417 Non-expert -98.08711 21.40837 \n", "2 dw_-98.0880868118_22.5550025151-20190221 Non-expert -98.08809 22.55500 \n", "3 dw_-98.2037004534_20.7662538571-20190417 Non-expert -98.20370 20.76625 \n", "4 dw_-98.7387565145_23.9768283715-20190122 Non-expert -98.73876 23.97683 \n", "\n", " utm crs hemisphere biome \\\n", "0 5N epsg:32605 WH 1 \n", "1 14N epsg:32614 WH 1 \n", "2 14N epsg:32614 WH 1 \n", "3 14N epsg:32614 WH 1 \n", "4 14N epsg:32614 WH 1 \n", "\n", " biome_name date ... \\\n", "0 Tropical & Subtropical Moist Broadleaf Forests 2019-01-16 ... \n", "1 Tropical & Subtropical Moist Broadleaf Forests 2019-04-17 ... \n", "2 Tropical & Subtropical Moist Broadleaf Forests 2019-02-21 ... \n", "3 Tropical & Subtropical Moist Broadleaf Forests 2019-04-17 ... \n", "4 Tropical & Subtropical Moist Broadleaf Forests 2019-01-22 ... \n", "\n", " S2_DATASTRIP_ID \\\n", "0 S2A_OPER_MSI_L2A_DS_MPS__20190116T223213_S2019... \n", "1 S2A_OPER_MSI_L2A_DS_SGS__20190417T212405_S2019... \n", "2 S2B_OPER_MSI_L2A_DS_EPAE_20190221T224412_S2019... \n", "3 S2A_OPER_MSI_L2A_DS_SGS__20190417T212405_S2019... \n", "4 S2B_OPER_MSI_L2A_DS_MTI__20190122T213001_S2019... \n", "\n", " S2_GEE_ID S2_GRID \\\n", "0 20190116T210921_20190116T210920_T05QKB 04QHG \n", "1 20190417T165901_20190417T170814_T14QNJ 14QNJ \n", "2 20190221T170329_20190221T170828_T14QNK 14QNK \n", "3 20190417T165901_20190417T170814_T14QNJ 14QNH \n", "4 20190122T170619_20190122T170648_T14QNM 14QNM \n", "\n", " S2_PRODUCT_ID \\\n", "0 S2A_MSIL2A_20190116T210921_N0211_R057_T05QKB_2... \n", "1 S2A_MSIL2A_20190417T165901_N0211_R069_T14QNJ_2... \n", "2 S2B_MSIL2A_20190221T170329_N0211_R069_T14QNK_2... \n", "3 S2A_MSIL2A_20190417T165901_N0211_R069_T14QNJ_2... \n", "4 S2B_MSIL2A_20190122T170619_N0211_R069_T14QNM_2... \n", "\n", " S2_SENSING_ORBIT_DIRECTION \\\n", "0 DESCENDING \n", "1 DESCENDING \n", "2 DESCENDING \n", "3 DESCENDING \n", "4 DESCENDING \n", "\n", " geometry annotation_source \\\n", "0 POLYGON ((222380 2123230, 227480 2123230, 2274... non_expert \n", "1 POLYGON ((592070 2365060, 597170 2365060, 5971... non_expert \n", "2 POLYGON ((591220 2491990, 596320 2491990, 5963... non_expert \n", "3 POLYGON ((580340 2293930, 585440 2293930, 5854... non_expert \n", "4 POLYGON ((524030 2649130, 529130 2649130, 5291... non_expert \n", "\n", " source_group annotation_type voting_rule \n", "0 non_expert individual None \n", "1 non_expert individual None \n", "2 non_expert individual None \n", "3 non_expert individual None \n", "4 non_expert individual None \n", "\n", "[5 rows x 32 columns]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "labels_df = pd.concat([general_df, individuals_df, composites_df], ignore_index=True)\n", "\n", "labels_df.head()" ] }, { "cell_type": "markdown", "id": "cfbc1623", "metadata": {}, "source": [ "## 2. Inspect labels\n", "\n", "```text\n", "raw/\n", "├── experts/Experts/{EH,WH}/{biome}/dw_....tif\n", "├── non_expert/Non_expert/WorkForce/{EH,WH}/{biome}/dw_....tif\n", "├── validation/validation_set/\n", "│ ├── individual_experts/{EH,WH}/{biome}/dw_..._{annotator}.tif\n", "│ └── expert_composites/{EH,WH}/{biome}/dw_..._{voting_rule}.tif\n", "└── test/dw_test_zenodo/label_dw_....tif\n", "```\n", "\n", "`EH`/`WH` are hemispheres; folders 1–14 are biomes. `dw_id` contains the location,\n", "date and any annotation suffix. Use the existing workbook fields for dates and\n", "geometry; keep filenames unchanged." ] }, { "cell_type": "code", "execution_count": 9, "id": "693ccc41", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:57.998212Z", "iopub.status.busy": "2026-11-16T13:28:57.998050Z", "iopub.status.idle": "2026-11-16T13:28:58.028129Z", "shell.execute_reply": "2026-11-16T13:28:58.027494Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dw_idsource_groupsource_path
0dw_-155.6160479818_19.2068319501-20190116non_expertraw/non_expert/Non_expert/WorkForce/WH/1/dw_-1...
1dw_-98.0871096142_21.4083687600-20190417non_expertraw/non_expert/Non_expert/WorkForce/WH/1/dw_-9...
2dw_-98.0880868118_22.5550025151-20190221non_expertraw/non_expert/Non_expert/WorkForce/WH/1/dw_-9...
3dw_-98.2037004534_20.7662538571-20190417non_expertraw/non_expert/Non_expert/WorkForce/WH/1/dw_-9...
4dw_-98.7387565145_23.9768283715-20190122non_expertraw/non_expert/Non_expert/WorkForce/WH/1/dw_-9...
\n", "
" ], "text/plain": [ " dw_id source_group \\\n", "0 dw_-155.6160479818_19.2068319501-20190116 non_expert \n", "1 dw_-98.0871096142_21.4083687600-20190417 non_expert \n", "2 dw_-98.0880868118_22.5550025151-20190221 non_expert \n", "3 dw_-98.2037004534_20.7662538571-20190417 non_expert \n", "4 dw_-98.7387565145_23.9768283715-20190122 non_expert \n", "\n", " source_path \n", "0 raw/non_expert/Non_expert/WorkForce/WH/1/dw_-1... \n", "1 raw/non_expert/Non_expert/WorkForce/WH/1/dw_-9... \n", "2 raw/non_expert/Non_expert/WorkForce/WH/1/dw_-9... \n", "3 raw/non_expert/Non_expert/WorkForce/WH/1/dw_-9... \n", "4 raw/non_expert/Non_expert/WorkForce/WH/1/dw_-9... " ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "source_folders = {\n", " \"experts\": \"raw/experts/Experts\",\n", " \"non_expert\": \"raw/non_expert/Non_expert/WorkForce\",\n", " \"individual_experts\": \"raw/validation/validation_set/individual_experts\",\n", " \"expert_composites\": \"raw/validation/validation_set/expert_composites\",\n", "}\n", "\n", "labels_df[\"source_path\"] = (\n", " labels_df[\"source_group\"].map(source_folders)\n", " + \"/\" + labels_df[\"hemisphere\"]\n", " + \"/\" + labels_df[\"biome\"].astype(str)\n", " + \"/\" + labels_df[\"dw_id\"] + \".tif\"\n", ")\n", "\n", "labels_df[[\"dw_id\", \"source_group\", \"source_path\"]].head()" ] }, { "cell_type": "code", "execution_count": 10, "id": "830b494b", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:58.029846Z", "iopub.status.busy": "2026-11-16T13:28:58.029691Z", "iopub.status.idle": "2026-11-16T13:28:58.298126Z", "shell.execute_reply": "2026-11-16T13:28:58.296562Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dw_idsource_path
\n", "
" ], "text/plain": [ "Empty DataFrame\n", "Columns: [dw_id, source_path]\n", "Index: []" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "missing_df = labels_df.loc[\n", " ~labels_df[\"source_path\"].map(lambda path: Path(path).is_file()),\n", " [\"dw_id\", \"source_path\"],\n", "]\n", "\n", "missing_df" ] }, { "cell_type": "code", "execution_count": 11, "id": "3830ca2a", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:58.301274Z", "iopub.status.busy": "2026-11-16T13:28:58.301103Z", "iopub.status.idle": "2026-11-16T13:28:58.319025Z", "shell.execute_reply": "2026-11-16T13:28:58.317321Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
annotation_typecompositeindividual
annotation_source
expert16365420
non_expert020336
\n", "
" ], "text/plain": [ "annotation_type composite individual\n", "annotation_source \n", "expert 1636 5420\n", "non_expert 0 20336" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "assert missing_df.empty\n", "\n", "pd.crosstab(labels_df[\"annotation_source\"], labels_df[\"annotation_type\"])" ] }, { "cell_type": "code", "execution_count": 12, "id": "15f17d1e", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:58.321138Z", "iopub.status.busy": "2026-11-16T13:28:58.321018Z", "iopub.status.idle": "2026-11-16T13:28:58.335441Z", "shell.execute_reply": "2026-11-16T13:28:58.334931Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
source_groupexpert_compositesexpertsindividual_expertsnon_expert
biome_name
Boreal Forests/Taiga120271891498
Deserts & Xeric Shrublands120345901473
Flooded Grasslands & Savannas128260961494
Mangroves120286901492
Mediterranean Forests, Woodlands & Scrub120358901493
Montane Grasslands & Shrublands120326901498
Temperate Broadleaf & Mixed Forests120310901436
Temperate Conifer Forests120365901492
Temperate Grasslands, Savannas & Shrublands120337901491
Tropical & Subtropical Coniferous Forests80215601000
Tropical & Subtropical Dry Broadleaf Forests120305901495
Tropical & Subtropical Grasslands, Savannas & Shrublands112319841496
Tropical & Subtropical Moist Broadleaf Forests120298901500
Tundra116199871463
\n", "
" ], "text/plain": [ "source_group expert_composites \\\n", "biome_name \n", "Boreal Forests/Taiga 120 \n", "Deserts & Xeric Shrublands 120 \n", "Flooded Grasslands & Savannas 128 \n", "Mangroves 120 \n", "Mediterranean Forests, Woodlands & Scrub 120 \n", "Montane Grasslands & Shrublands 120 \n", "Temperate Broadleaf & Mixed Forests 120 \n", "Temperate Conifer Forests 120 \n", "Temperate Grasslands, Savannas & Shrublands 120 \n", "Tropical & Subtropical Coniferous Forests 80 \n", "Tropical & Subtropical Dry Broadleaf Forests 120 \n", "Tropical & Subtropical Grasslands, Savannas & S... 112 \n", "Tropical & Subtropical Moist Broadleaf Forests 120 \n", "Tundra 116 \n", "\n", "source_group experts \\\n", "biome_name \n", "Boreal Forests/Taiga 271 \n", "Deserts & Xeric Shrublands 345 \n", "Flooded Grasslands & Savannas 260 \n", "Mangroves 286 \n", "Mediterranean Forests, Woodlands & Scrub 358 \n", "Montane Grasslands & Shrublands 326 \n", "Temperate Broadleaf & Mixed Forests 310 \n", "Temperate Conifer Forests 365 \n", "Temperate Grasslands, Savannas & Shrublands 337 \n", "Tropical & Subtropical Coniferous Forests 215 \n", "Tropical & Subtropical Dry Broadleaf Forests 305 \n", "Tropical & Subtropical Grasslands, Savannas & S... 319 \n", "Tropical & Subtropical Moist Broadleaf Forests 298 \n", "Tundra 199 \n", "\n", "source_group individual_experts \\\n", "biome_name \n", "Boreal Forests/Taiga 89 \n", "Deserts & Xeric Shrublands 90 \n", "Flooded Grasslands & Savannas 96 \n", "Mangroves 90 \n", "Mediterranean Forests, Woodlands & Scrub 90 \n", "Montane Grasslands & Shrublands 90 \n", "Temperate Broadleaf & Mixed Forests 90 \n", "Temperate Conifer Forests 90 \n", "Temperate Grasslands, Savannas & Shrublands 90 \n", "Tropical & Subtropical Coniferous Forests 60 \n", "Tropical & Subtropical Dry Broadleaf Forests 90 \n", "Tropical & Subtropical Grasslands, Savannas & S... 84 \n", "Tropical & Subtropical Moist Broadleaf Forests 90 \n", "Tundra 87 \n", "\n", "source_group non_expert \n", "biome_name \n", "Boreal Forests/Taiga 1498 \n", "Deserts & Xeric Shrublands 1473 \n", "Flooded Grasslands & Savannas 1494 \n", "Mangroves 1492 \n", "Mediterranean Forests, Woodlands & Scrub 1493 \n", "Montane Grasslands & Shrublands 1498 \n", "Temperate Broadleaf & Mixed Forests 1436 \n", "Temperate Conifer Forests 1492 \n", "Temperate Grasslands, Savannas & Shrublands 1491 \n", "Tropical & Subtropical Coniferous Forests 1000 \n", "Tropical & Subtropical Dry Broadleaf Forests 1495 \n", "Tropical & Subtropical Grasslands, Savannas & S... 1496 \n", "Tropical & Subtropical Moist Broadleaf Forests 1500 \n", "Tundra 1463 " ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pd.crosstab(labels_df[\"biome_name\"], labels_df[\"source_group\"])" ] }, { "cell_type": "markdown", "id": "3961ad61", "metadata": {}, "source": [ "Each voting rule combines the individual expert labels **pixel by pixel**.\n", "Every rule has 409 rasters because it covers the same 409 scenes. Pixel values can differ.\n", "\n", "| Expert votes | strict | consensus | majority | simple_majority |\n", "|---|---|---|---|---|\n", "| Trees, Trees, Trees | Trees | Trees | Trees | Trees |\n", "| Trees, Trees, unlabelled | unlabelled | Trees | Trees | Trees |\n", "| Trees, Trees, Grass | unlabelled | unlabelled | Trees | Trees |\n", "| Trees, unlabelled, unlabelled | unlabelled | Trees | Trees | unlabelled |\n", "\n", "These are the paper's text definitions. Some captions and supplied pixels differ;\n", "use the released masks without recomputing votes." ] }, { "cell_type": "code", "execution_count": 13, "id": "f441e232", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:58.338269Z", "iopub.status.busy": "2026-11-16T13:28:58.338164Z", "iopub.status.idle": "2026-11-16T13:28:58.343206Z", "shell.execute_reply": "2026-11-16T13:28:58.342464Z" } }, "outputs": [ { "data": { "text/plain": [ "voting_rule\n", "None 25756\n", "simple_majority 409\n", "strict 409\n", "majority 409\n", "consensus 409\n", "Name: count, dtype: int64" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "labels_df[\"voting_rule\"].value_counts(dropna=False)" ] }, { "cell_type": "markdown", "id": "83070c4d", "metadata": {}, "source": [ "Original codes: 0 unlabelled, 1–9 land cover, 10 cloud. Copy labels unchanged;\n", "class remapping happens when training reads them." ] }, { "cell_type": "code", "execution_count": 14, "id": "7c390399", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:58.345291Z", "iopub.status.busy": "2026-11-16T13:28:58.345183Z", "iopub.status.idle": "2026-11-16T13:28:58.356417Z", "shell.execute_reply": "2026-11-16T13:28:58.355592Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
codemeaning
00unlabelled
11water
22trees
33grass
44flooded_vegetation
55crops
66shrub_and_scrub
77built
88bare
99snow_and_ice
1010cloud
\n", "
" ], "text/plain": [ " code meaning\n", "0 0 unlabelled\n", "1 1 water\n", "2 2 trees\n", "3 3 grass\n", "4 4 flooded_vegetation\n", "5 5 crops\n", "6 6 shrub_and_scrub\n", "7 7 built\n", "8 8 bare\n", "9 9 snow_and_ice\n", "10 10 cloud" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "schemes = yaml.safe_load(Path(\"labels.yaml\").read_text())\n", "original = schemes[\"original\"]\n", "\n", "pd.DataFrame({\"code\": range(11), \"meaning\": original[\"classes\"]})" ] }, { "cell_type": "code", "execution_count": 15, "id": "9e5cc072", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:58.358581Z", "iopub.status.busy": "2026-11-16T13:28:58.358358Z", "iopub.status.idle": "2026-11-16T13:28:58.425374Z", "shell.execute_reply": "2026-11-16T13:28:58.424356Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.Dataset> Size: 268kB\n",
       "Dimensions:      (y: 510, x: 510)\n",
       "Coordinates:\n",
       "  * y            (y) float64 4kB 2.128e+06 2.128e+06 ... 2.123e+06 2.123e+06\n",
       "  * x            (x) float64 4kB 2.224e+05 2.224e+05 ... 2.275e+05 2.275e+05\n",
       "    spatial_ref  int32 4B 32605\n",
       "    time         datetime64[us] 8B 2019-01-16\n",
       "Data variables:\n",
       "    band_1       (y, x) uint8 260kB dask.array<chunksize=(510, 510), meta=np.ndarray>\n",
       "Attributes:\n",
       "    AREA_OR_POINT:  Area
" ], "text/plain": [ " Size: 268kB\n", "Dimensions: (y: 510, x: 510)\n", "Coordinates:\n", " * y (y) float64 4kB 2.128e+06 2.128e+06 ... 2.123e+06 2.123e+06\n", " * x (x) float64 4kB 2.224e+05 2.224e+05 ... 2.275e+05 2.275e+05\n", " spatial_ref int32 4B 32605\n", " time datetime64[us] 8B 2019-01-16\n", "Data variables:\n", " band_1 (y, x) uint8 260kB dask.array\n", "Attributes:\n", " AREA_OR_POINT: Area" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "example_path = labels_df.iloc[0][\"source_path\"]\n", "label = gs.open_raster(example_path)\n", "\n", "label" ] }, { "cell_type": "code", "execution_count": 16, "id": "a59f2e77", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:58.427172Z", "iopub.status.busy": "2026-11-16T13:28:58.426822Z", "iopub.status.idle": "2026-11-16T13:28:59.738186Z", "shell.execute_reply": "2026-11-16T13:28:59.737421Z" } }, "outputs": [ { "data": { "text/html": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = true;\n const version = '3.10.1'.replace('rc', '-rc.').replace('.dev', '-dev.');\n const reloading = false;\n const Bokeh = root.Bokeh;\n const BK_RE = /^https:\\/\\/cdn\\.bokeh\\.org\\/bokeh\\/(release|dev)\\/bokeh-/;\n const PN_RE = /^https:\\/\\/cdn\\.holoviz\\.org\\/panel\\/[^/]+\\/dist\\/panel/i;\n const JUPYTER_ENDPOINT = \"/panel-preview/\";\n const JUPYTER_EXTENSION_PATH = JUPYTER_ENDPOINT + \"static/extensions/panel/\";\n const CDN_DIST = \"https://cdn.holoviz.org/panel/1.10.0/dist/\";\n // Endpoint paths and the CDN urls serving the same files: Panel's dist,\n // each extension with a CDN and each BokehJS file.\n const CDN_MAP = [];\n // Executed notebooks retain this bootstrap when published as static pages.\n const live_notebook = root.Jupyter?.notebook != null || document.querySelector('.jp-LabShell') != null;\n root.__panel_live_notebook__ = live_notebook;\n // The lazy-resource registry needs the same export routing and CDN fallback.\n root.__panel_cdn_dist__ = CDN_DIST;\n root.__panel_cdn_map__ = CDN_MAP;\n\n function cdn_url(url) {\n const index = url.indexOf(JUPYTER_ENDPOINT);\n if (index === -1) {\n return null;\n }\n const path = url.slice(index + JUPYTER_ENDPOINT.length);\n for (const [prefix, cdn] of CDN_MAP) {\n if (path.startsWith(prefix)) {\n return cdn + path.slice(prefix.length);\n }\n }\n return null;\n }\n\n function resource_url(url) {\n return !live_notebook || root.__panel_endpoint_failed__ === true ? (cdn_url(url) ?? url) : url;\n }\n\n // Pending until this bootstrap has loaded everything (or given up), so\n // that output rendered meanwhile can wait for Panel's models.\n let bootstrap_resolve;\n const bootstrap = new Promise((resolve) => { bootstrap_resolve = resolve });\n root.__panel_bootstrap__ = bootstrap;\n function bootstrap_done() {\n if (root.__panel_bootstrap__ === bootstrap) {\n root.__panel_bootstrap__ = null;\n }\n bootstrap_resolve();\n }\n setTimeout(bootstrap_done, Math.max(5000, 15000));\n\n // jupyter_bokeh, which renders Panel output for comms='ipywidgets' and in\n // VS Code, builds a view as soon as its output arrives, so a notebook run\n // top to bottom can render before BokehJS has loaded or before panel.js\n // has registered the models the view needs. Both the classic notebook and\n // VS Code load jupyter_bokeh through RequireJS, so its fetch is held until\n // the bootstrap is done, and should it already be loaded, ipywidgets\n // awaits render(), which is held instead.\n function hold_bokeh_views(module) {\n const View = module?.BokehView;\n if (View == null || View.prototype.__panel_hold__ === true) {\n return;\n }\n const render = View.prototype.render;\n View.prototype.render = function(...args) {\n const pending = root.__panel_bootstrap__;\n return pending == null ? render.apply(this, args) : pending.then(() => render.apply(this, args));\n };\n View.prototype.__panel_hold__ = true;\n }\n if (root.requirejs != null) {\n for (const name of [\"@bokeh/jupyter_bokeh\", \"nbextensions/jupyter_bokeh/index\"]) {\n if (root.requirejs.defined(name)) {\n hold_bokeh_views(root.requirejs(name));\n }\n }\n const load = root.requirejs.load;\n if (load?.__panel_hold__ !== true) {\n root.requirejs.load = function(context, name, url) {\n const pending = root.__panel_bootstrap__;\n if (pending != null && name.includes(\"jupyter_bokeh\")) {\n pending.then(() => load.call(this, context, name, url));\n return;\n }\n return load.call(this, context, name, url);\n };\n root.requirejs.load.__panel_hold__ = true;\n }\n const on_resource_load = root.requirejs.onResourceLoad;\n if (on_resource_load?.__panel_hold__ !== true) {\n // Called once a module is defined but before it is handed to the\n // widget manager that asked for it.\n root.requirejs.onResourceLoad = function(context, map, deps) {\n if (map.id.includes(\"jupyter_bokeh\")) {\n hold_bokeh_views(context.defined[map.id]);\n }\n return on_resource_load?.apply(this, arguments);\n };\n root.requirejs.onResourceLoad.__panel_hold__ = true;\n }\n }\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 show_jupyter_extension_error() {\n if (!live_notebook) {\n return;\n }\n const element = document.getElementById(\"e0474718-33df-4ba0-9186-5c606320a3e1\");\n if (element == null || !element.hidden) {\n return;\n }\n element.style.cssText = \"color: #b91c1c; font-family: sans-serif; padding: 0.5em;\";\n element.textContent = (\n \"Panel could not load resources from its Jupyter server extension. \" +\n \"Install Panel in the environment running the Jupyter server and restart it.\"\n );\n element.hidden = false;\n }\n root.__panel_jupyter_extension_error__ = show_jupyter_extension_error;\n\n\n function load_libs(css_urls, js_urls, js_modules, Bokeh, callback) {\n if (css_urls == null) css_urls = [];\n if (js_urls == null) js_urls = [];\n if (js_modules == null) js_modules = [];\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) {\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(url) {\n console.error(\"failed to load \" + url);\n if (url.includes(JUPYTER_ENDPOINT + \"static/\")) {\n show_jupyter_extension_error();\n }\n }\n\n function fallback_to_cdn(element, url, attribute, parent) {\n const fallback = cdn_url(url);\n if (fallback == null || element.dataset.panelCdnFallback != null) {\n return false;\n }\n element.dataset.panelCdnFallback = \"\";\n element.remove();\n element[attribute] = fallback;\n parent.appendChild(element);\n return true;\n }\n\n // Mirrors the AMD guard in panel/models/resources.ts: a UMD library that\n // is not loaded by RequireJS must take its browser-global branch, so\n // define.amd reads as undefined while one of these scripts executes. A\n // module script has no currentScript, so it is told apart by the\n // directory its code was loaded from.\n function install_amd_guard() {\n const define = root.define;\n if (typeof define !== \"function\" || define.amd == null || define.__panel_no_amd__ === true) {\n return;\n }\n const dirs = root.__panel_no_amd_dirs__ = root.__panel_no_amd_dirs__ || [];\n const hidden = () => {\n const script = document.currentScript;\n if (script != null) {\n return script.hasAttribute(\"data-panel-no-amd\");\n }\n const stack = new Error().stack || \"\";\n return dirs.some((dir) => stack.includes(dir));\n };\n let amd = define.amd;\n try {\n Object.defineProperty(define, \"amd\", {\n configurable: true,\n enumerable: true,\n get: () => hidden() ? undefined : amd,\n set: (value) => { amd = value },\n });\n Object.defineProperty(define, \"__panel_no_amd__\", {value: true});\n } catch (e) {\n console.warn(`Panel: could not hide RequireJS from component libraries: ${e}`);\n }\n }\n\n function hide_amd(element) {\n element.setAttribute(\"data-panel-no-amd\", \"\");\n install_amd_guard();\n }\n\n function hide_amd_module(url) {\n const dirs = root.__panel_no_amd_dirs__ = root.__panel_no_amd_dirs__ || [];\n const dir = new URL(url, document.baseURI).href.split(\"?\")[0].replace(/[^/]*$/, \"\");\n // panel.js itself lives in a dist root, and must never match.\n if (!/\\/(dist|static\\/extensions\\/panel)\\/$/.test(dir) && !dirs.includes(dir)) {\n dirs.push(dir);\n }\n install_amd_guard();\n }\n\n function inject_script_tag(url) {\n const element = document.createElement('script');\n hide_amd(element);\n element.onload = on_load;\n element.onerror = () => {\n if (!fallback_to_cdn(element, url, \"src\", document.head)) {\n on_error(url);\n }\n };\n element.async = false;\n element.src = resource_url(url);\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n\n const skip = [];\n // Held open until every resource below has been queued, then released\n // by on_load() at the end of this function.\n root._bokeh_is_loading = 1;\n if (window.requirejs) {\n const require_config = {'packages': {}, 'paths': {}, 'shim': {}};\n // RequireJS tries each path in turn, so a bundled copy the Jupyter\n // extension cannot serve falls back to the CDN, then to the original.\n const require_urls = (url) => {\n url = resource_url(url);\n const fallback = cdn_url(url);\n return fallback == null || fallback === url ? [url] : [url, fallback];\n };\n for (const [name, path] of Object.entries(require_config.paths || {})) {\n require_config.paths[name] = (Array.isArray(path) ? path : [path]).flatMap(require_urls);\n }\n window.requirejs.config(require_config);\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 continue;\n }\n const element = document.createElement(\"link\");\n root._bokeh_is_loading++;\n element.onload = on_load;\n element.onerror = () => {\n if (!fallback_to_cdn(element, url, \"href\", document.body)) {\n on_error(url);\n }\n };\n element.rel = \"stylesheet\";\n element.type = \"text/css\";\n element.href = resource_url(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 const shouldSkip = skip.includes(escaped) || existing_scripts.includes(escaped)\n const isBokehOrPanel = BK_RE.test(escaped) || PN_RE.test(escaped)\n const missingOrBroken = Bokeh == null || Bokeh.Panel == null || (Bokeh.version != version && !Bokeh.versions?.has(version)) || Bokeh.versions?.get(version)?.Panel == null;\n if (shouldSkip && !(isBokehOrPanel && missingOrBroken)) {\n continue;\n }\n root._bokeh_is_loading++;\n inject_script_tag(url);\n }\n for (let i = 0; i < js_modules.length; i++) {\n const [url, name] = js_modules[i];\n const escaped = encodeURI(url)\n const loaded = name == null ? existing_scripts.indexOf(escaped) !== -1 : root[name] != null\n if (skip.indexOf(escaped) !== -1 || loaded) {\n continue;\n }\n var element = document.createElement('script');\n hide_amd_module(resource_url(url));\n root._bokeh_is_loading++;\n element.onerror = () => {\n if (!fallback_to_cdn(element, url, \"src\", document.head)) {\n on_error(url);\n }\n };\n element.async = false;\n element.type = \"module\";\n if (name == null) {\n element.onload = on_load;\n element.src = resource_url(url);\n } else {\n // Namespace import rather than a default import, matching what the\n // resource registry's module wrapper assigns, so a library that only\n // has named exports resolves to its namespace instead of to undefined.\n // The import loads the module, so it gets no bare tag as well. The url\n // is absolutized because an import specifier resolves through the\n // import map unless it starts with a scheme, / or ./, whereas a src\n // resolves against the document.\n element.textContent = `\n import * as ns from \"${new URL(resource_url(url), document.baseURI).href}\"\n window.${name} = ns.default ?? ns\n window._bokeh_on_load()\n `\n }\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n // Releases the reservation taken above, running the callbacks now if\n // nothing else is outstanding.\n on_load()\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.10.0/dist/bundled/reactiveesm/es-module-shims@^1.10.0/dist/es-module-shims.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-3.10.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-gl-3.10.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-widgets-3.10.1.min.js\", \"https://cdn.bokeh.org/bokeh/release/bokeh-tables-3.10.1.min.js\", \"https://cdn.holoviz.org/panel/1.10.0/dist/panel.min.js\"];\n const js_modules = [];\n const css_urls = [];\n const inline_js = [ function(Bokeh, define, module, exports) {\nBokeh.set_log_level(\"info\");\n },\nfunction(Bokeh, define, module, exports) {} // ensure no trailing comma for IE\n ];\n\n // Resolved once RequireJS has loaded its libraries and assigned their\n // globals, so the resource registry can wait for them instead of racing.\n let require_ready_resolve;\n const require_ready = new Promise((resolve) => { require_ready_resolve = resolve }); require_ready_resolve();\n // Module exports are only assigned once their libraries have loaded. A\n // library that fails to load never finishes the load, so the wait is bounded\n // and the registry loads whatever is still missing itself.\n let libs_ready_resolve;\n const libs_ready = new Promise((resolve) => { libs_ready_resolve = resolve });\n setTimeout(() => libs_ready_resolve(), 5000 || 5000);\n\n function declare_resources() {\n // Tells the panel.js resource registry which component libraries this\n // bundle has already satisfied, so nothing is fetched a second time.\n // In inline mode the libraries have no URLs at all, which makes this\n // the only way the registry can know about them.\n const declared = {\"libs\": [{\"name\": \"reactiveesm:extra\", \"js\": [\"https://cdn.holoviz.org/panel/1.10.0/dist/bundled/reactiveesm/es-module-shims@^1.10.0/dist/es-module-shims.min.js\"]}]};\n if (!declared || !(declared.libs || declared.css)) {\n return;\n }\n // Libraries RequireJS is loading are claimed against require_ready\n // instead of being declared, since they are not ready yet.\n const require_urls = window.requirejs ? [] : [];\n const satisfied = [], pending = [], exporting = [];\n for (const lib of declared.libs || []) {\n const urls = lib.js || [];\n const by_require = urls.length > 0 && urls.every((url) => require_urls.includes(url));\n const exports = (lib.modules || []).some((module) => module.export != null);\n (by_require ? pending : exports ? exporting : satisfied).push(lib);\n }\n const declarations = [{libs: satisfied, css: declared.css}];\n if (pending.length > 0) {\n declarations.push({libs: pending, ready: require_ready});\n }\n if (exporting.length > 0) {\n declarations.push({libs: exporting, ready: libs_ready});\n }\n for (const declaration of declarations) {\n if (root.__panel_resources__ != null) {\n if (declaration.ready != null) {\n root.__panel_resources__.claim(declaration, declaration.ready);\n } else {\n root.__panel_resources__.declare(declaration);\n }\n } else {\n (root.__panel_resources_declared__ = root.__panel_resources_declared__ || []).push(declaration);\n }\n }\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 // Views waiting on this run once the current task is done, by which\n // point the load callback has also restored root.Bokeh.\n bootstrap_done();\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 bootstrap_done();\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 = Bokeh != null && ((Bokeh.version === version && Bokeh.Panel) || (Bokeh.versions?.has(version) && Bokeh.versions.get(version)?.Panel));\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, Bokeh, function() {\n console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n libs_ready_resolve();\n run_inline_js();\n if (Bokeh != undefined && !reloading) {\n const NewBokeh = root.Bokeh;\n if (Bokeh.versions === undefined) {\n Bokeh.versions = new Map();\n }\n if (NewBokeh.version !== Bokeh.version) {\n Bokeh[NewBokeh.version] = NewBokeh;\n Bokeh.versions.set(NewBokeh.version, NewBokeh);\n }\n root.Bokeh = Bokeh;\n }\n });\n }\n }\n // Declared synchronously, before anything is scheduled, so a cell whose\n // output embeds while libraries are still loading finds this in place\n // instead of fetching its own second copy of each.\n declare_resources();\n // Give older versions of the autoload script a head-start to ensure\n // they initialize before we start loading newer version.\n setTimeout(load_or_wait, 100)\n}(window));", "application/vnd.holoviews_load.v0+json": "" }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": "\nif ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n}\n\n\n function JupyterCommManager() {\n }\n\n JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n comm_manager.register_target(comm_id, function(comm) {\n comm.on_msg(msg_handler);\n });\n } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n comm.onMsg = msg_handler;\n });\n } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n var messages = comm.messages[Symbol.asyncIterator]();\n function processIteratorResult(result) {\n var message = result.value;\n 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", "application/vnd.holoviews_load.v0+json": "" }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.holoviews_exec.v0+json": "", "text/html": [ "
\n", "
\n", "
\n", "" ] }, "metadata": { "application/vnd.holoviews_exec.v0+json": { "id": "d618dc03-c431-4cda-910d-4b487aa079c9" } }, "output_type": "display_data" }, { "data": { "text/html": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": "(function(root) {\n function now() {\n return new Date();\n }\n\n const force = false;\n const version = '3.10.1'.replace('rc', '-rc.').replace('.dev', '-dev.');\n const reloading = true;\n const Bokeh = root.Bokeh;\n const BK_RE = /^https:\\/\\/cdn\\.bokeh\\.org\\/bokeh\\/(release|dev)\\/bokeh-/;\n const PN_RE = /^https:\\/\\/cdn\\.holoviz\\.org\\/panel\\/[^/]+\\/dist\\/panel/i;\n const JUPYTER_ENDPOINT = \"/panel-preview/\";\n const JUPYTER_EXTENSION_PATH = JUPYTER_ENDPOINT + \"static/extensions/panel/\";\n const CDN_DIST = \"https://cdn.holoviz.org/panel/1.10.0/dist/\";\n // Endpoint paths and the CDN urls serving the same files: Panel's dist,\n // each extension with a CDN and each BokehJS file.\n const CDN_MAP = [];\n // Executed notebooks retain this bootstrap when published as static pages.\n const live_notebook = root.Jupyter?.notebook != null || document.querySelector('.jp-LabShell') != null;\n root.__panel_live_notebook__ = live_notebook;\n // The lazy-resource registry needs the same export routing and CDN fallback.\n root.__panel_cdn_dist__ = CDN_DIST;\n root.__panel_cdn_map__ = CDN_MAP;\n\n function cdn_url(url) {\n const index = url.indexOf(JUPYTER_ENDPOINT);\n if (index === -1) {\n return null;\n }\n const path = url.slice(index + JUPYTER_ENDPOINT.length);\n for (const [prefix, cdn] of CDN_MAP) {\n if (path.startsWith(prefix)) {\n return cdn + path.slice(prefix.length);\n }\n }\n return null;\n }\n\n function resource_url(url) {\n return !live_notebook || root.__panel_endpoint_failed__ === true ? (cdn_url(url) ?? url) : url;\n }\n\n // Pending until this bootstrap has loaded everything (or given up), so\n // that output rendered meanwhile can wait for Panel's models.\n let bootstrap_resolve;\n const bootstrap = new Promise((resolve) => { bootstrap_resolve = resolve });\n root.__panel_bootstrap__ = bootstrap;\n function bootstrap_done() {\n if (root.__panel_bootstrap__ === bootstrap) {\n root.__panel_bootstrap__ = null;\n }\n bootstrap_resolve();\n }\n setTimeout(bootstrap_done, Math.max(5000, 15000));\n\n // jupyter_bokeh, which renders Panel output for comms='ipywidgets' and in\n // VS Code, builds a view as soon as its output arrives, so a notebook run\n // top to bottom can render before BokehJS has loaded or before panel.js\n // has registered the models the view needs. Both the classic notebook and\n // VS Code load jupyter_bokeh through RequireJS, so its fetch is held until\n // the bootstrap is done, and should it already be loaded, ipywidgets\n // awaits render(), which is held instead.\n function hold_bokeh_views(module) {\n const View = module?.BokehView;\n if (View == null || View.prototype.__panel_hold__ === true) {\n return;\n }\n const render = View.prototype.render;\n View.prototype.render = function(...args) {\n const pending = root.__panel_bootstrap__;\n return pending == null ? render.apply(this, args) : pending.then(() => render.apply(this, args));\n };\n View.prototype.__panel_hold__ = true;\n }\n if (root.requirejs != null) {\n for (const name of [\"@bokeh/jupyter_bokeh\", \"nbextensions/jupyter_bokeh/index\"]) {\n if (root.requirejs.defined(name)) {\n hold_bokeh_views(root.requirejs(name));\n }\n }\n const load = root.requirejs.load;\n if (load?.__panel_hold__ !== true) {\n root.requirejs.load = function(context, name, url) {\n const pending = root.__panel_bootstrap__;\n if (pending != null && name.includes(\"jupyter_bokeh\")) {\n pending.then(() => load.call(this, context, name, url));\n return;\n }\n return load.call(this, context, name, url);\n };\n root.requirejs.load.__panel_hold__ = true;\n }\n const on_resource_load = root.requirejs.onResourceLoad;\n if (on_resource_load?.__panel_hold__ !== true) {\n // Called once a module is defined but before it is handed to the\n // widget manager that asked for it.\n root.requirejs.onResourceLoad = function(context, map, deps) {\n if (map.id.includes(\"jupyter_bokeh\")) {\n hold_bokeh_views(context.defined[map.id]);\n }\n return on_resource_load?.apply(this, arguments);\n };\n root.requirejs.onResourceLoad.__panel_hold__ = true;\n }\n }\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 show_jupyter_extension_error() {\n if (!live_notebook) {\n return;\n }\n const element = document.getElementById(\"7fc0d78f-55fb-416d-9b6a-e0caa0fb3fe2\");\n if (element == null || !element.hidden) {\n return;\n }\n element.style.cssText = \"color: #b91c1c; font-family: sans-serif; padding: 0.5em;\";\n element.textContent = (\n \"Panel could not load resources from its Jupyter server extension. \" +\n \"Install Panel in the environment running the Jupyter server and restart it.\"\n );\n element.hidden = false;\n }\n root.__panel_jupyter_extension_error__ = show_jupyter_extension_error;\n\n\n function load_libs(css_urls, js_urls, js_modules, Bokeh, callback) {\n if (css_urls == null) css_urls = [];\n if (js_urls == null) js_urls = [];\n if (js_modules == null) js_modules = [];\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) {\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(url) {\n console.error(\"failed to load \" + url);\n if (url.includes(JUPYTER_ENDPOINT + \"static/\")) {\n show_jupyter_extension_error();\n }\n }\n\n function fallback_to_cdn(element, url, attribute, parent) {\n const fallback = cdn_url(url);\n if (fallback == null || element.dataset.panelCdnFallback != null) {\n return false;\n }\n element.dataset.panelCdnFallback = \"\";\n element.remove();\n element[attribute] = fallback;\n parent.appendChild(element);\n return true;\n }\n\n // Mirrors the AMD guard in panel/models/resources.ts: a UMD library that\n // is not loaded by RequireJS must take its browser-global branch, so\n // define.amd reads as undefined while one of these scripts executes. A\n // module script has no currentScript, so it is told apart by the\n // directory its code was loaded from.\n function install_amd_guard() {\n const define = root.define;\n if (typeof define !== \"function\" || define.amd == null || define.__panel_no_amd__ === true) {\n return;\n }\n const dirs = root.__panel_no_amd_dirs__ = root.__panel_no_amd_dirs__ || [];\n const hidden = () => {\n const script = document.currentScript;\n if (script != null) {\n return script.hasAttribute(\"data-panel-no-amd\");\n }\n const stack = new Error().stack || \"\";\n return dirs.some((dir) => stack.includes(dir));\n };\n let amd = define.amd;\n try {\n Object.defineProperty(define, \"amd\", {\n configurable: true,\n enumerable: true,\n get: () => hidden() ? undefined : amd,\n set: (value) => { amd = value },\n });\n Object.defineProperty(define, \"__panel_no_amd__\", {value: true});\n } catch (e) {\n console.warn(`Panel: could not hide RequireJS from component libraries: ${e}`);\n }\n }\n\n function hide_amd(element) {\n element.setAttribute(\"data-panel-no-amd\", \"\");\n install_amd_guard();\n }\n\n function hide_amd_module(url) {\n const dirs = root.__panel_no_amd_dirs__ = root.__panel_no_amd_dirs__ || [];\n const dir = new URL(url, document.baseURI).href.split(\"?\")[0].replace(/[^/]*$/, \"\");\n // panel.js itself lives in a dist root, and must never match.\n if (!/\\/(dist|static\\/extensions\\/panel)\\/$/.test(dir) && !dirs.includes(dir)) {\n dirs.push(dir);\n }\n install_amd_guard();\n }\n\n function inject_script_tag(url) {\n const element = document.createElement('script');\n hide_amd(element);\n element.onload = on_load;\n element.onerror = () => {\n if (!fallback_to_cdn(element, url, \"src\", document.head)) {\n on_error(url);\n }\n };\n element.async = false;\n element.src = resource_url(url);\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n\n const skip = [];\n // Held open until every resource below has been queued, then released\n // by on_load() at the end of this function.\n root._bokeh_is_loading = 1;\n if (window.requirejs) {\n const require_config = {'packages': {}, 'paths': {}, 'shim': {}};\n // RequireJS tries each path in turn, so a bundled copy the Jupyter\n // extension cannot serve falls back to the CDN, then to the original.\n const require_urls = (url) => {\n url = resource_url(url);\n const fallback = cdn_url(url);\n return fallback == null || fallback === url ? [url] : [url, fallback];\n };\n for (const [name, path] of Object.entries(require_config.paths || {})) {\n require_config.paths[name] = (Array.isArray(path) ? path : [path]).flatMap(require_urls);\n }\n window.requirejs.config(require_config);\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 continue;\n }\n const element = document.createElement(\"link\");\n root._bokeh_is_loading++;\n element.onload = on_load;\n element.onerror = () => {\n if (!fallback_to_cdn(element, url, \"href\", document.body)) {\n on_error(url);\n }\n };\n element.rel = \"stylesheet\";\n element.type = \"text/css\";\n element.href = resource_url(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 const shouldSkip = skip.includes(escaped) || existing_scripts.includes(escaped)\n const isBokehOrPanel = BK_RE.test(escaped) || PN_RE.test(escaped)\n const missingOrBroken = Bokeh == null || Bokeh.Panel == null || (Bokeh.version != version && !Bokeh.versions?.has(version)) || Bokeh.versions?.get(version)?.Panel == null;\n if (shouldSkip && !(isBokehOrPanel && missingOrBroken)) {\n continue;\n }\n root._bokeh_is_loading++;\n inject_script_tag(url);\n }\n for (let i = 0; i < js_modules.length; i++) {\n const [url, name] = js_modules[i];\n const escaped = encodeURI(url)\n const loaded = name == null ? existing_scripts.indexOf(escaped) !== -1 : root[name] != null\n if (skip.indexOf(escaped) !== -1 || loaded) {\n continue;\n }\n var element = document.createElement('script');\n hide_amd_module(resource_url(url));\n root._bokeh_is_loading++;\n element.onerror = () => {\n if (!fallback_to_cdn(element, url, \"src\", document.head)) {\n on_error(url);\n }\n };\n element.async = false;\n element.type = \"module\";\n if (name == null) {\n element.onload = on_load;\n element.src = resource_url(url);\n } else {\n // Namespace import rather than a default import, matching what the\n // resource registry's module wrapper assigns, so a library that only\n // has named exports resolves to its namespace instead of to undefined.\n // The import loads the module, so it gets no bare tag as well. The url\n // is absolutized because an import specifier resolves through the\n // import map unless it starts with a scheme, / or ./, whereas a src\n // resolves against the document.\n element.textContent = `\n import * as ns from \"${new URL(resource_url(url), document.baseURI).href}\"\n window.${name} = ns.default ?? ns\n window._bokeh_on_load()\n `\n }\n console.debug(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.head.appendChild(element);\n }\n // Releases the reservation taken above, running the callbacks now if\n // nothing else is outstanding.\n on_load()\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.10.0/dist/bundled/reactiveesm/es-module-shims@^1.10.0/dist/es-module-shims.min.js\"];\n const js_modules = [];\n const css_urls = [];\n const inline_js = [ function(Bokeh, define, module, exports) {\nBokeh.set_log_level(\"info\");\n },\nfunction(Bokeh, define, module, exports) {} // ensure no trailing comma for IE\n ];\n\n // Resolved once RequireJS has loaded its libraries and assigned their\n // globals, so the resource registry can wait for them instead of racing.\n let require_ready_resolve;\n const require_ready = new Promise((resolve) => { require_ready_resolve = resolve }); require_ready_resolve();\n // Module exports are only assigned once their libraries have loaded. A\n // library that fails to load never finishes the load, so the wait is bounded\n // and the registry loads whatever is still missing itself.\n let libs_ready_resolve;\n const libs_ready = new Promise((resolve) => { libs_ready_resolve = resolve });\n setTimeout(() => libs_ready_resolve(), 5000 || 5000);\n\n function declare_resources() {\n // Tells the panel.js resource registry which component libraries this\n // bundle has already satisfied, so nothing is fetched a second time.\n // In inline mode the libraries have no URLs at all, which makes this\n // the only way the registry can know about them.\n const declared = {\"libs\": [{\"name\": \"reactiveesm:extra\", \"js\": [\"https://cdn.holoviz.org/panel/1.10.0/dist/bundled/reactiveesm/es-module-shims@^1.10.0/dist/es-module-shims.min.js\"]}]};\n if (!declared || !(declared.libs || declared.css)) {\n return;\n }\n // Libraries RequireJS is loading are claimed against require_ready\n // instead of being declared, since they are not ready yet.\n const require_urls = window.requirejs ? [] : [];\n const satisfied = [], pending = [], exporting = [];\n for (const lib of declared.libs || []) {\n const urls = lib.js || [];\n const by_require = urls.length > 0 && urls.every((url) => require_urls.includes(url));\n const exports = (lib.modules || []).some((module) => module.export != null);\n (by_require ? pending : exports ? exporting : satisfied).push(lib);\n }\n const declarations = [{libs: satisfied, css: declared.css}];\n if (pending.length > 0) {\n declarations.push({libs: pending, ready: require_ready});\n }\n if (exporting.length > 0) {\n declarations.push({libs: exporting, ready: libs_ready});\n }\n for (const declaration of declarations) {\n if (root.__panel_resources__ != null) {\n if (declaration.ready != null) {\n root.__panel_resources__.claim(declaration, declaration.ready);\n } else {\n root.__panel_resources__.declare(declaration);\n }\n } else {\n (root.__panel_resources_declared__ = root.__panel_resources_declared__ || []).push(declaration);\n }\n }\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 // Views waiting on this run once the current task is done, by which\n // point the load callback has also restored root.Bokeh.\n bootstrap_done();\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 bootstrap_done();\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 = Bokeh != null && ((Bokeh.version === version && Bokeh.Panel) || (Bokeh.versions?.has(version) && Bokeh.versions.get(version)?.Panel));\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, Bokeh, function() {\n console.debug(\"Bokeh: BokehJS plotting callback run at\", now());\n libs_ready_resolve();\n run_inline_js();\n if (Bokeh != undefined && !reloading) {\n const NewBokeh = root.Bokeh;\n if (Bokeh.versions === undefined) {\n Bokeh.versions = new Map();\n }\n if (NewBokeh.version !== Bokeh.version) {\n Bokeh[NewBokeh.version] = NewBokeh;\n Bokeh.versions.set(NewBokeh.version, NewBokeh);\n }\n root.Bokeh = Bokeh;\n }\n });\n }\n }\n // Declared synchronously, before anything is scheduled, so a cell whose\n // output embeds while libraries are still loading finds this in place\n // instead of fetching its own second copy of each.\n declare_resources();\n // Give older versions of the autoload script a head-start to ensure\n // they initialize before we start loading newer version.\n setTimeout(load_or_wait, 100)\n}(window));", "application/vnd.holoviews_load.v0+json": "" }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": "\nif ((window.PyViz === undefined) || (window.PyViz instanceof HTMLElement)) {\n window.PyViz = {comms: {}, comm_status:{}, kernels:{}, receivers: {}, plot_index: []}\n}\n\n\n function JupyterCommManager() {\n }\n\n JupyterCommManager.prototype.register_target = function(plot_id, comm_id, msg_handler) {\n if (window.comm_manager || ((window.Jupyter !== undefined) && (Jupyter.notebook.kernel != null))) {\n var comm_manager = window.comm_manager || Jupyter.notebook.kernel.comm_manager;\n comm_manager.register_target(comm_id, function(comm) {\n comm.on_msg(msg_handler);\n });\n } else if ((plot_id in window.PyViz.kernels) && (window.PyViz.kernels[plot_id])) {\n window.PyViz.kernels[plot_id].registerCommTarget(comm_id, function(comm) {\n comm.onMsg = msg_handler;\n });\n } else if (typeof google != 'undefined' && google.colab.kernel != null) {\n google.colab.kernel.comms.registerTarget(comm_id, (comm) => {\n var messages = comm.messages[Symbol.asyncIterator]();\n function processIteratorResult(result) {\n var message = result.value;\n 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", "application/vnd.holoviews_load.v0+json": "" }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ ":Overlay\n", " .RGB.I :RGB [x,y] (R,G,B)\n", " .Points.Unlabelled :Points [x,y]\n", " .Points.Water :Points [x,y]\n", " .Points.Trees :Points [x,y]\n", " .Points.Grass :Points [x,y]\n", " .Points.Flooded_vegetation :Points [x,y]\n", " .Points.Crops :Points [x,y]\n", " .Points.Shrub_and_scrub :Points [x,y]\n", " .Points.Built :Points [x,y]\n", " .Points.Bare :Points [x,y]\n", " .Points.Snow_and_ice :Points [x,y]\n", " .Points.Cloud :Points [x,y]" ] }, "execution_count": 16, "metadata": { "application/vnd.holoviews_exec.v0+json": {} }, "output_type": "execute_result" } ], "source": [ "class_names = dict(enumerate(original[\"classes\"]))\n", "class_colors = dict(enumerate(original[\"colors\"]))\n", "\n", "label = label.gs.write_flags(class_names, class_colors)\n", "label.gs.plot(title=\"Original annotation\", xlabel=\"\")" ] }, { "cell_type": "markdown", "id": "93577ce5", "metadata": {}, "source": [ "## 3. Group annotations by scene\n", "\n", "Convert workbook footprints to EPSG:4326 for maps and overlap checks.\n", "Keep the original WKT and CRS. Three `S2_GRID` cells were stored as Excel dates;\n", "keep them as text rather than guessing corrections." ] }, { "cell_type": "code", "execution_count": 17, "id": "9095c91d", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:59.739457Z", "iopub.status.busy": "2026-11-16T13:28:59.739316Z", "iopub.status.idle": "2026-11-16T13:28:59.767909Z", "shell.execute_reply": "2026-11-16T13:28:59.767336Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dw_iddatesource_crssource_geometry
0dw_-155.6160479818_19.2068319501-201901162019-01-16epsg:32605POLYGON ((222380 2123230, 227480 2123230, 2274...
1dw_-98.0871096142_21.4083687600-201904172019-04-17epsg:32614POLYGON ((592070 2365060, 597170 2365060, 5971...
2dw_-98.0880868118_22.5550025151-201902212019-02-21epsg:32614POLYGON ((591220 2491990, 596320 2491990, 5963...
3dw_-98.2037004534_20.7662538571-201904172019-04-17epsg:32614POLYGON ((580340 2293930, 585440 2293930, 5854...
4dw_-98.7387565145_23.9768283715-201901222019-01-22epsg:32614POLYGON ((524030 2649130, 529130 2649130, 5291...
\n", "
" ], "text/plain": [ " dw_id date source_crs \\\n", "0 dw_-155.6160479818_19.2068319501-20190116 2019-01-16 epsg:32605 \n", "1 dw_-98.0871096142_21.4083687600-20190417 2019-04-17 epsg:32614 \n", "2 dw_-98.0880868118_22.5550025151-20190221 2019-02-21 epsg:32614 \n", "3 dw_-98.2037004534_20.7662538571-20190417 2019-04-17 epsg:32614 \n", "4 dw_-98.7387565145_23.9768283715-20190122 2019-01-22 epsg:32614 \n", "\n", " source_geometry \n", "0 POLYGON ((222380 2123230, 227480 2123230, 2274... \n", "1 POLYGON ((592070 2365060, 597170 2365060, 5971... \n", "2 POLYGON ((591220 2491990, 596320 2491990, 5963... \n", "3 POLYGON ((580340 2293930, 585440 2293930, 5854... \n", "4 POLYGON ((524030 2649130, 529130 2649130, 5291... " ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "labels_df = labels_df.rename(columns={\"geometry\": \"source_geometry\", \"crs\": \"source_crs\"})\n", "labels_df[\"S2_GRID\"] = labels_df[\"S2_GRID\"].astype(\"string\")\n", "\n", "labels_df[[\"dw_id\", \"date\", \"source_crs\", \"source_geometry\"]].head()" ] }, { "cell_type": "code", "execution_count": 18, "id": "025e14a5", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:28:59.769414Z", "iopub.status.busy": "2026-11-16T13:28:59.769132Z", "iopub.status.idle": "2026-11-16T13:29:00.198469Z", "shell.execute_reply": "2026-11-16T13:29:00.197291Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dw_idsource_crsgeometry
0dw_-155.6160479818_19.2068319501-20190116epsg:32605POLYGON ((-155.63989 19.18346, -155.59143 19.1...
1dw_-98.0871096142_21.4083687600-20190417epsg:32614POLYGON ((-98.11183 21.38538, -98.06264 21.385...
2dw_-98.0880868118_22.5550025151-20190221epsg:32614POLYGON ((-98.11294 22.53205, -98.06335 22.531...
3dw_-98.2037004534_20.7662538571-20190417epsg:32614POLYGON ((-98.2283 20.7433, -98.17932 20.74307...
4dw_-98.7387565145_23.9768283715-20190122epsg:32614POLYGON ((-98.76383 23.95378, -98.7137 23.9537...
\n", "
" ], "text/plain": [ " dw_id source_crs \\\n", "0 dw_-155.6160479818_19.2068319501-20190116 epsg:32605 \n", "1 dw_-98.0871096142_21.4083687600-20190417 epsg:32614 \n", "2 dw_-98.0880868118_22.5550025151-20190221 epsg:32614 \n", "3 dw_-98.2037004534_20.7662538571-20190417 epsg:32614 \n", "4 dw_-98.7387565145_23.9768283715-20190122 epsg:32614 \n", "\n", " geometry \n", "0 POLYGON ((-155.63989 19.18346, -155.59143 19.1... \n", "1 POLYGON ((-98.11183 21.38538, -98.06264 21.385... \n", "2 POLYGON ((-98.11294 22.53205, -98.06335 22.531... \n", "3 POLYGON ((-98.2283 20.7433, -98.17932 20.74307... \n", "4 POLYGON ((-98.76383 23.95378, -98.7137 23.9537... " ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "frames = []\n", "for crs, group_df in labels_df.groupby(\"source_crs\"):\n", " geometry = gpd.GeoSeries.from_wkt(group_df[\"source_geometry\"], crs=crs)\n", " group_geo_df = gpd.GeoDataFrame(group_df, geometry=geometry)\n", " frames.append(group_geo_df.to_crs(\"EPSG:4326\"))\n", "\n", "labels_df = pd.concat(frames).sort_index()\n", "labels_df[[\"dw_id\", \"source_crs\", \"geometry\"]].head()" ] }, { "cell_type": "markdown", "id": "d00d01c2", "metadata": {}, "source": [ "Labels with the same footprint and date share an image (`scene_id`).\n", "Labels at the same footprint share a location (`location_id`). Use an original\n", "`dw_id` for each group; keep the per-annotation ID unchanged." ] }, { "cell_type": "code", "execution_count": 19, "id": "e3b054af", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.200683Z", "iopub.status.busy": "2026-11-16T13:29:00.200553Z", "iopub.status.idle": "2026-11-16T13:29:00.247002Z", "shell.execute_reply": "2026-11-16T13:29:00.245867Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dw_idscene_idlocation_id
0dw_-155.6160479818_19.2068319501-20190116dw_-155.6160479818_19.2068319501-20190116dw_-155.6160479818_19.2068319501-20190116
1dw_-98.0871096142_21.4083687600-20190417dw_-98.0871096142_21.4083687600-20190417dw_-98.0871096142_21.4083687600-20190417
2dw_-98.0880868118_22.5550025151-20190221dw_-98.0880868118_22.5550025151-20190221dw_-98.0880868118_22.5550025151-20190221
3dw_-98.2037004534_20.7662538571-20190417dw_-98.2037004534_20.7662538571-20190417dw_-98.2037004534_20.7662538571-20190417
4dw_-98.7387565145_23.9768283715-20190122dw_-98.7387565145_23.9768283715-20190122dw_-98.7387565145_23.9768283715-20190122
\n", "
" ], "text/plain": [ " dw_id \\\n", "0 dw_-155.6160479818_19.2068319501-20190116 \n", "1 dw_-98.0871096142_21.4083687600-20190417 \n", "2 dw_-98.0880868118_22.5550025151-20190221 \n", "3 dw_-98.2037004534_20.7662538571-20190417 \n", "4 dw_-98.7387565145_23.9768283715-20190122 \n", "\n", " scene_id \\\n", "0 dw_-155.6160479818_19.2068319501-20190116 \n", "1 dw_-98.0871096142_21.4083687600-20190417 \n", "2 dw_-98.0880868118_22.5550025151-20190221 \n", "3 dw_-98.2037004534_20.7662538571-20190417 \n", "4 dw_-98.7387565145_23.9768283715-20190122 \n", "\n", " location_id \n", "0 dw_-155.6160479818_19.2068319501-20190116 \n", "1 dw_-98.0871096142_21.4083687600-20190417 \n", "2 dw_-98.0880868118_22.5550025151-20190221 \n", "3 dw_-98.2037004534_20.7662538571-20190417 \n", "4 dw_-98.7387565145_23.9768283715-20190122 " ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "labels_df[\"scene_id\"] = labels_df.groupby(\n", " [\"source_crs\", \"source_geometry\", \"date\"], sort=False\n", ")[\"dw_id\"].transform(\"first\")\n", "\n", "labels_df[\"location_id\"] = labels_df.groupby(\n", " [\"source_crs\", \"source_geometry\"], sort=False\n", ")[\"dw_id\"].transform(\"first\")\n", "\n", "labels_df[[\"dw_id\", \"scene_id\", \"location_id\"]].head()" ] }, { "cell_type": "code", "execution_count": 20, "id": "0bb4a9f6", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.248948Z", "iopub.status.busy": "2026-11-16T13:29:00.248797Z", "iopub.status.idle": "2026-11-16T13:29:00.264548Z", "shell.execute_reply": "2026-11-16T13:29:00.263553Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
labelsscenes
source_group
expert_composites1636409
experts41944194
individual_experts1226409
non_expert2033620336
\n", "
" ], "text/plain": [ " labels scenes\n", "source_group \n", "expert_composites 1636 409\n", "experts 4194 4194\n", "individual_experts 1226 409\n", "non_expert 20336 20336" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "labels_df.groupby(\"source_group\").agg(\n", " labels=(\"dw_id\", \"size\"),\n", " scenes=(\"scene_id\", \"nunique\"),\n", ")" ] }, { "cell_type": "markdown", "id": "5d0a7a2f", "metadata": {}, "source": [ "The 5,420 individual expert labels are 4,194 general labels plus 1,226 test\n", "annotations. They are not 5,420 training scenes. One test scene has two released\n", "expert annotations; the other 408 have three." ] }, { "cell_type": "code", "execution_count": 21, "id": "83034ca6", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.266305Z", "iopub.status.busy": "2026-11-16T13:29:00.266161Z", "iopub.status.idle": "2026-11-16T13:29:00.274060Z", "shell.execute_reply": "2026-11-16T13:29:00.273465Z" } }, "outputs": [ { "data": { "text/plain": [ "3 408\n", "2 1\n", "Name: count, dtype: int64" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "individual_counts = labels_df.loc[\n", " labels_df[\"source_group\"] == \"individual_experts\"\n", "].groupby(\"scene_id\").size()\n", "\n", "individual_counts.value_counts()" ] }, { "cell_type": "markdown", "id": "8069ff84", "metadata": {}, "source": [ "## 4. Reserve test data\n", "\n", "Raw `validation/` and Zenodo `test/` cover the same 409 scenes. Use **consensus**\n", "for test, following the paper. The other votes and individual labels belong to\n", "those same scenes, so they cannot be used for development val.\n", "\n", "Zenodo's `lulc` band matches the consensus mask after removing its one-pixel zero\n", "border (512×512 → 510×510). Its `label` and `probs_*` bands are model predictions." ] }, { "cell_type": "code", "execution_count": 22, "id": "fdda940f", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.275246Z", "iopub.status.busy": "2026-11-16T13:29:00.275108Z", "iopub.status.idle": "2026-11-16T13:29:00.283373Z", "shell.execute_reply": "2026-11-16T13:29:00.282890Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
scene_idlocation_idsource_pathbiome_name
25759dw_22.2210659928_-18.6779473193-20190809dw_22.2210659928_-18.6779473193-20190809raw/validation/validation_set/expert_composite...Flooded Grasslands & Savannas
25763dw_134.5874674093_47.4598876765-20191002dw_134.5874674093_47.4598876765-20191002raw/validation/validation_set/expert_composite...Flooded Grasslands & Savannas
25766dw_22.9018027652_-11.1101645354-20190509dw_22.9018027652_-11.1101645354-20190509raw/validation/validation_set/expert_composite...Flooded Grasslands & Savannas
25768dw_-3.9589394764_15.8586613852-20191114dw_-3.9589394764_15.8586613852-20191114raw/validation/validation_set/expert_composite...Flooded Grasslands & Savannas
25773dw_49.4130270225_30.9483616027-20190727dw_49.4130270225_30.9483616027-20190727raw/validation/validation_set/expert_composite...Flooded Grasslands & Savannas
\n", "
" ], "text/plain": [ " scene_id \\\n", "25759 dw_22.2210659928_-18.6779473193-20190809 \n", "25763 dw_134.5874674093_47.4598876765-20191002 \n", "25766 dw_22.9018027652_-11.1101645354-20190509 \n", "25768 dw_-3.9589394764_15.8586613852-20191114 \n", "25773 dw_49.4130270225_30.9483616027-20190727 \n", "\n", " location_id \\\n", "25759 dw_22.2210659928_-18.6779473193-20190809 \n", "25763 dw_134.5874674093_47.4598876765-20191002 \n", "25766 dw_22.9018027652_-11.1101645354-20190509 \n", "25768 dw_-3.9589394764_15.8586613852-20191114 \n", "25773 dw_49.4130270225_30.9483616027-20190727 \n", "\n", " source_path \\\n", "25759 raw/validation/validation_set/expert_composite... \n", "25763 raw/validation/validation_set/expert_composite... \n", "25766 raw/validation/validation_set/expert_composite... \n", "25768 raw/validation/validation_set/expert_composite... \n", "25773 raw/validation/validation_set/expert_composite... \n", "\n", " biome_name \n", "25759 Flooded Grasslands & Savannas \n", "25763 Flooded Grasslands & Savannas \n", "25766 Flooded Grasslands & Savannas \n", "25768 Flooded Grasslands & Savannas \n", "25773 Flooded Grasslands & Savannas " ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "test_labels_df = labels_df.loc[labels_df[\"voting_rule\"] == \"consensus\"].copy()\n", "\n", "test_labels_df[[\"scene_id\", \"location_id\", \"source_path\", \"biome_name\"]].head()" ] }, { "cell_type": "code", "execution_count": 23, "id": "bfa670ae", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.284785Z", "iopub.status.busy": "2026-11-16T13:29:00.284644Z", "iopub.status.idle": "2026-11-16T13:29:00.297390Z", "shell.execute_reply": "2026-11-16T13:29:00.296415Z" } }, "outputs": [ { "data": { "text/plain": [ "biome_name\n", "Flooded Grasslands & Savannas 32\n", "Boreal Forests/Taiga 30\n", "Montane Grasslands & Shrublands 30\n", "Tropical & Subtropical Moist Broadleaf Forests 30\n", "Temperate Broadleaf & Mixed Forests 30\n", "Temperate Grasslands, Savannas & Shrublands 30\n", "Temperate Conifer Forests 30\n", "Deserts & Xeric Shrublands 30\n", "Mediterranean Forests, Woodlands & Scrub 30\n", "Tropical & Subtropical Dry Broadleaf Forests 30\n", "Mangroves 30\n", "Tundra 29\n", "Tropical & Subtropical Grasslands, Savannas & Shrublands 28\n", "Tropical & Subtropical Coniferous Forests 20\n", "Name: count, dtype: int64" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "assert len(test_labels_df) == 409\n", "\n", "test_location_ids = test_labels_df[\"location_id\"]\n", "locations_df = labels_df[[\"location_id\", \"geometry\"]].drop_duplicates(\"location_id\")\n", "test_locations_df = locations_df.loc[locations_df[\"location_id\"].isin(test_location_ids)]\n", "\n", "test_labels_df[\"biome_name\"].value_counts()" ] }, { "cell_type": "code", "execution_count": 24, "id": "9f0a6bbd", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.299138Z", "iopub.status.busy": "2026-11-16T13:29:00.298993Z", "iopub.status.idle": "2026-11-16T13:29:00.309803Z", "shell.execute_reply": "2026-11-16T13:29:00.308862Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
dw_idsource_groupscene_iddatesource_path
226dw_7.0867379523_4.8051119857-20181226non_expertdw_7.0867379523_4.8051119857-201812262018-12-26raw/non_expert/Non_expert/WorkForce/EH/1/dw_7....
242dw_7.3294590557_5.8600150404-20181226non_expertdw_7.3294590557_5.8600150404-201812262018-12-26raw/non_expert/Non_expert/WorkForce/EH/1/dw_7....
322dw_34.5390725317_0.8606918681-20181218non_expertdw_34.5390725317_0.8606918681-201812182018-12-18raw/non_expert/Non_expert/WorkForce/EH/1/dw_34...
371dw_72.8314397499_19.1609665999-20190329non_expertdw_72.8314397499_19.1609665999-201903292019-03-29raw/non_expert/Non_expert/WorkForce/EH/1/dw_72...
468dw_85.0142951733_21.0414459584-20190309non_expertdw_85.0142951733_21.0414459584-201903092019-03-09raw/non_expert/Non_expert/WorkForce/EH/1/dw_85...
\n", "
" ], "text/plain": [ " dw_id source_group \\\n", "226 dw_7.0867379523_4.8051119857-20181226 non_expert \n", "242 dw_7.3294590557_5.8600150404-20181226 non_expert \n", "322 dw_34.5390725317_0.8606918681-20181218 non_expert \n", "371 dw_72.8314397499_19.1609665999-20190329 non_expert \n", "468 dw_85.0142951733_21.0414459584-20190309 non_expert \n", "\n", " scene_id date \\\n", "226 dw_7.0867379523_4.8051119857-20181226 2018-12-26 \n", "242 dw_7.3294590557_5.8600150404-20181226 2018-12-26 \n", "322 dw_34.5390725317_0.8606918681-20181218 2018-12-18 \n", "371 dw_72.8314397499_19.1609665999-20190329 2019-03-29 \n", "468 dw_85.0142951733_21.0414459584-20190309 2019-03-09 \n", "\n", " source_path \n", "226 raw/non_expert/Non_expert/WorkForce/EH/1/dw_7.... \n", "242 raw/non_expert/Non_expert/WorkForce/EH/1/dw_7.... \n", "322 raw/non_expert/Non_expert/WorkForce/EH/1/dw_34... \n", "371 raw/non_expert/Non_expert/WorkForce/EH/1/dw_72... \n", "468 raw/non_expert/Non_expert/WorkForce/EH/1/dw_85... " ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "raw_overlap_df = labels_df.loc[\n", " labels_df[\"source_group\"].isin([\"experts\", \"non_expert\"])\n", " & labels_df[\"scene_id\"].isin(test_labels_df[\"scene_id\"])\n", "]\n", "\n", "raw_overlap_df[[\"dw_id\", \"source_group\", \"scene_id\", \"date\", \"source_path\"]].head()" ] }, { "cell_type": "code", "execution_count": 25, "id": "7a574616", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.311007Z", "iopub.status.busy": "2026-11-16T13:29:00.310867Z", "iopub.status.idle": "2026-11-16T13:29:00.319397Z", "shell.execute_reply": "2026-11-16T13:29:00.318994Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
annotation_filesunique_scenes
source_group
experts111111
non_expert342342
\n", "
" ], "text/plain": [ " annotation_files unique_scenes\n", "source_group \n", "experts 111 111\n", "non_expert 342 342" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "raw_overlap_df.groupby(\"source_group\").agg(\n", " annotation_files=(\"dw_id\", \"size\"),\n", " unique_scenes=(\"scene_id\", \"nunique\"),\n", ")" ] }, { "cell_type": "markdown", "id": "bcd39f80", "metadata": {}, "source": [ "The general workbook includes 111 expert and 342 non-expert annotations of test\n", "scenes. Remove these from training. The paper also says these scenes were excluded\n", "from training and online validation; raw duplication alone does not show leakage." ] }, { "cell_type": "code", "execution_count": 26, "id": "27018c25", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.320848Z", "iopub.status.busy": "2026-11-16T13:29:00.320710Z", "iopub.status.idle": "2026-11-16T13:29:00.343903Z", "shell.execute_reply": "2026-11-16T13:29:00.342911Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
splitexcludedtesttrain
source_group
expert_composites016360
experts211114062
individual_experts012260
non_expert5534219939
\n", "
" ], "text/plain": [ "split excluded test train\n", "source_group \n", "expert_composites 0 1636 0\n", "experts 21 111 4062\n", "individual_experts 0 1226 0\n", "non_expert 55 342 19939" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "near_test_df = gpd.sjoin(\n", " locations_df, test_locations_df[[\"geometry\"]], predicate=\"intersects\"\n", ")\n", "\n", "labels_df[\"split\"] = \"train\"\n", "labels_df.loc[labels_df[\"location_id\"].isin(near_test_df[\"location_id\"]), \"split\"] = \"excluded\"\n", "labels_df.loc[labels_df[\"location_id\"].isin(test_location_ids), \"split\"] = \"test\"\n", "\n", "pd.crosstab(labels_df[\"source_group\"], labels_df[\"split\"])" ] }, { "cell_type": "markdown", "id": "55b2ebcf", "metadata": {}, "source": [ "## 5. Split train and val\n", "\n", "Sample 20% of the remaining expert training locations for val with seed 0.\n", "**Sampling is global, not by biome.** All labels at a location get the same split.\n", "Remove training areas that overlap val. This can change the final ratio slightly.\n", "\n", "Train uses expert and non-expert labels. Val uses expert labels only. This split\n", "is our choice; the original paper's development split is not provided." ] }, { "cell_type": "code", "execution_count": 27, "id": "fd82ea72", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.345325Z", "iopub.status.busy": "2026-11-16T13:29:00.345184Z", "iopub.status.idle": "2026-11-16T13:29:00.357606Z", "shell.execute_reply": "2026-11-16T13:29:00.356899Z" } }, "outputs": [ { "data": { "text/plain": [ "20422 dw_112.3820809713_2.9704979775-20190507\n", "23444 dw_42.5112017851_9.4680892566-20190322\n", "17633 dw_115.7968846922_-31.7037067775-20190201\n", "22860 dw_3.2607485872_6.6487191998-20190106\n", "15193 dw_-137.5329042761_58.6510331266-20190331\n", "Name: location_id, dtype: object" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "development_experts_df = labels_df.loc[\n", " (labels_df[\"source_group\"] == \"experts\") & (labels_df[\"split\"] == \"train\")\n", "]\n", "\n", "validation_location_ids = (\n", " development_experts_df[\"location_id\"]\n", " .drop_duplicates()\n", " .sort_values()\n", " .sample(frac=0.2, random_state=0)\n", ")\n", "\n", "validation_location_ids.head()" ] }, { "cell_type": "code", "execution_count": 28, "id": "d87fe8e0", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.359493Z", "iopub.status.busy": "2026-11-16T13:29:00.359252Z", "iopub.status.idle": "2026-11-16T13:29:00.377983Z", "shell.execute_reply": "2026-11-16T13:29:00.377235Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
location_idindex_right
11dw_-96.1250494159_18.1060635452-2019031022073
185dw_3.3225461450_6.5479952935-2019010622861
186dw_3.3228525297_6.5938606437-2019010622861
189dw_3.4620099743_6.6855913441-2019010622862
190dw_3.5078613163_6.6397259939-2019010622862
\n", "
" ], "text/plain": [ " location_id index_right\n", "11 dw_-96.1250494159_18.1060635452-20190310 22073\n", "185 dw_3.3225461450_6.5479952935-20190106 22861\n", "186 dw_3.3228525297_6.5938606437-20190106 22861\n", "189 dw_3.4620099743_6.6855913441-20190106 22862\n", "190 dw_3.5078613163_6.6397259939-20190106 22862" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "labels_df.loc[labels_df[\"location_id\"].isin(validation_location_ids), \"split\"] = \"val\"\n", "validation_locations_df = locations_df.loc[\n", " locations_df[\"location_id\"].isin(validation_location_ids)\n", "]\n", "\n", "near_validation_df = gpd.sjoin(\n", " locations_df, validation_locations_df[[\"geometry\"]], predicate=\"intersects\"\n", ")\n", "\n", "near_validation_df[[\"location_id\", \"index_right\"]].head()" ] }, { "cell_type": "code", "execution_count": 29, "id": "a3ab0ed5", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.379264Z", "iopub.status.busy": "2026-11-16T13:29:00.379122Z", "iopub.status.idle": "2026-11-16T13:29:00.397280Z", "shell.execute_reply": "2026-11-16T13:29:00.395598Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
splitexcludedtesttrainval
source_group
expert_composites0163600
experts1011113170812
individual_experts0122600
non_expert16534219703126
\n", "
" ], "text/plain": [ "split excluded test train val\n", "source_group \n", "expert_composites 0 1636 0 0\n", "experts 101 111 3170 812\n", "individual_experts 0 1226 0 0\n", "non_expert 165 342 19703 126" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "overlaps_validation = labels_df[\"location_id\"].isin(near_validation_df[\"location_id\"])\n", "remaining_training = labels_df[\"split\"] == \"train\"\n", "labels_df.loc[remaining_training & overlaps_validation, \"split\"] = \"excluded\"\n", "\n", "pd.crosstab(labels_df[\"source_group\"], labels_df[\"split\"])" ] }, { "cell_type": "markdown", "id": "fd4dcbe6", "metadata": {}, "source": [ "## 6. Arrange files\n", "\n", "Copy the labels used for training and evaluation. Keep other annotations in the\n", "table with an empty `label_path`. Paths are relative to `processed/`.\n", "\n", "```text\n", "processed/\n", "├── label/train/{expert,non-expert}/\n", "├── label/val/\n", "└── label/test/\n", "```\n" ] }, { "cell_type": "code", "execution_count": 30, "id": "prepare-paths-0", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.399773Z", "iopub.status.busy": "2026-11-16T13:29:00.399627Z", "iopub.status.idle": "2026-11-16T13:29:00.421592Z", "shell.execute_reply": "2026-11-16T13:29:00.420712Z" } }, "outputs": [], "source": [ "labels_df[\"annotation_id\"] = labels_df[\"source_group\"] + \"/\" + labels_df[\"dw_id\"]\n", "labels_df[\"label_path\"] = pd.Series(index=labels_df.index, dtype=\"string\")\n", "\n", "train_expert = labels_df[\"split\"].eq(\"train\") & labels_df[\"source_group\"].eq(\"experts\")\n", "train_non_expert = labels_df[\"split\"].eq(\"train\") & labels_df[\"source_group\"].eq(\"non_expert\")\n", "val_expert = labels_df[\"split\"].eq(\"val\") & labels_df[\"source_group\"].eq(\"experts\")\n", "test_consensus = labels_df[\"split\"].eq(\"test\") & labels_df[\"voting_rule\"].eq(\"consensus\")\n" ] }, { "cell_type": "code", "execution_count": 31, "id": "ac7bcaa2", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.423372Z", "iopub.status.busy": "2026-11-16T13:29:00.423125Z", "iopub.status.idle": "2026-11-16T13:29:00.437004Z", "shell.execute_reply": "2026-11-16T13:29:00.436288Z" } }, "outputs": [], "source": [ "filenames = labels_df[\"dw_id\"] + \".tif\"\n", "\n", "labels_df.loc[train_expert, \"label_path\"] = \"label/train/expert/\" + filenames[train_expert]\n", "labels_df.loc[train_non_expert, \"label_path\"] = \"label/train/non-expert/\" + filenames[train_non_expert]\n", "labels_df.loc[val_expert, \"label_path\"] = \"label/val/\" + filenames[val_expert]\n", "labels_df.loc[test_consensus, \"label_path\"] = \"label/test/\" + filenames[test_consensus]" ] }, { "cell_type": "code", "execution_count": null, "id": "prepare-paths-2", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.440358Z", "iopub.status.busy": "2026-11-16T13:29:00.440210Z", "iopub.status.idle": "2026-11-16T13:29:00.475955Z", "shell.execute_reply": "2026-11-16T13:29:00.475007Z" } }, "outputs": [], "source": [ "prepared_df = labels_df.loc[labels_df[\"label_path\"].notna()]\n", "\n", "prepared_df[[\"dw_id\", \"split\", \"annotation_source\", \"label_path\"]].head()\n" ] }, { "cell_type": "code", "execution_count": 33, "id": "fd6b0fef", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.478606Z", "iopub.status.busy": "2026-11-16T13:29:00.478461Z", "iopub.status.idle": "2026-11-16T13:29:00.492015Z", "shell.execute_reply": "2026-11-16T13:29:00.490675Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
splittesttrainval
annotation_source
expert4093170812
non_expert0197030
\n", "
" ], "text/plain": [ "split test train val\n", "annotation_source \n", "expert 409 3170 812\n", "non_expert 0 19703 0" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pd.crosstab(prepared_df[\"annotation_source\"], prepared_df[\"split\"])" ] }, { "cell_type": "code", "execution_count": 34, "id": "ed3a960c", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.494376Z", "iopub.status.busy": "2026-11-16T13:29:00.494229Z", "iopub.status.idle": "2026-11-16T13:29:00.508149Z", "shell.execute_reply": "2026-11-16T13:29:00.507046Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
splittesttrainval
biome_name
Boreal Forests/Taiga30168048
Deserts & Xeric Shrublands30168860
Flooded Grasslands & Savannas32162457
Mangroves30164657
Mediterranean Forests, Woodlands & Scrub30170879
Montane Grasslands & Shrublands30172156
Temperate Broadleaf & Mixed Forests30162066
Temperate Conifer Forests30168472
Temperate Grasslands, Savannas & Shrublands30171167
Tropical & Subtropical Coniferous Forests20111644
Tropical & Subtropical Dry Broadleaf Forests30167057
Tropical & Subtropical Grasslands, Savannas & Shrublands28171261
Tropical & Subtropical Moist Broadleaf Forests30171445
Tundra29156443
\n", "
" ], "text/plain": [ "split test train val\n", "biome_name \n", "Boreal Forests/Taiga 30 1680 48\n", "Deserts & Xeric Shrublands 30 1688 60\n", "Flooded Grasslands & Savannas 32 1624 57\n", "Mangroves 30 1646 57\n", "Mediterranean Forests, Woodlands & Scrub 30 1708 79\n", "Montane Grasslands & Shrublands 30 1721 56\n", "Temperate Broadleaf & Mixed Forests 30 1620 66\n", "Temperate Conifer Forests 30 1684 72\n", "Temperate Grasslands, Savannas & Shrublands 30 1711 67\n", "Tropical & Subtropical Coniferous Forests 20 1116 44\n", "Tropical & Subtropical Dry Broadleaf Forests 30 1670 57\n", "Tropical & Subtropical Grasslands, Savannas & S... 28 1712 61\n", "Tropical & Subtropical Moist Broadleaf Forests 30 1714 45\n", "Tundra 29 1564 43" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pd.crosstab(prepared_df[\"biome_name\"], prepared_df[\"split\"])" ] }, { "cell_type": "code", "execution_count": 35, "id": "83343b15", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:00.510374Z", "iopub.status.busy": "2026-11-16T13:29:00.510227Z", "iopub.status.idle": "2026-11-16T13:29:01.294184Z", "shell.execute_reply": "2026-11-16T13:29:01.292905Z" } }, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "scene_points_df = prepared_df.drop_duplicates(\"scene_id\").copy()\n", "scene_points_df[\"geometry\"] = gpd.points_from_xy(scene_points_df[\"lon\"], scene_points_df[\"lat\"])\n", "\n", "scene_points_df.plot(column=\"split\", categorical=True, legend=True, markersize=5, figsize=(12, 5))" ] }, { "cell_type": "markdown", "id": "ffc8fe35", "metadata": {}, "source": [ "Check paths and splits, then copy the original labels. Raw files are unchanged." ] }, { "cell_type": "code", "execution_count": null, "id": "524b6984", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:01.295634Z", "iopub.status.busy": "2026-11-16T13:29:01.295494Z", "iopub.status.idle": "2026-11-16T13:29:01.345341Z", "shell.execute_reply": "2026-11-16T13:29:01.344032Z" } }, "outputs": [], "source": [ "assert prepared_df[\"label_path\"].is_unique\n", "assert labels_df.groupby(\"location_id\")[\"split\"].nunique().eq(1).all()\n" ] }, { "cell_type": "code", "execution_count": null, "id": "099259a3", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:01.347086Z", "iopub.status.busy": "2026-11-16T13:29:01.346908Z", "iopub.status.idle": "2026-11-16T13:29:04.230266Z", "shell.execute_reply": "2026-11-16T13:29:04.229278Z" } }, "outputs": [], "source": [ "for row in prepared_df.itertuples():\n", " destination = PROCESSED / row.label_path\n", " destination.parent.mkdir(parents=True, exist_ok=True)\n", " shutil.copy2(row.source_path, destination)\n" ] }, { "cell_type": "code", "execution_count": null, "id": "da74b684", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T13:29:04.232243Z", "iopub.status.busy": "2026-11-16T13:29:04.232093Z", "iopub.status.idle": "2026-11-16T13:29:04.431712Z", "shell.execute_reply": "2026-11-16T13:29:04.430827Z" } }, "outputs": [], "source": [ "labels_df.to_parquet(PROCESSED / \"label.parquet\", index=False)\n", "\n", "labels_df[[\n", " \"annotation_id\", \"scene_id\", \"split\", \"annotation_source\",\n", " \"annotation_type\", \"voting_rule\", \"label_path\", \"geometry\",\n", "]].head()" ] }, { "cell_type": "markdown", "id": "4e75cd99", "metadata": {}, "source": [ "## 7. Ingest imagery\n", "\n", "Run in a terminal; rerun to retry failed scenes.\n", "\n", "```bash\n", "python scripts/ingest_scenes.py processed --threads 8\n", "```\n", "\n", "It writes one image and one SCL per prepared label, mirroring the label's\n", "path under `image/` and `scl/`, and `ingest_log.parquet`: one ingest log entry per label, with its paths or\n", "error. Merge the log with `label.parquet` on `label_path` for the full dataset.\n" ] }, { "cell_type": "code", "execution_count": null, "id": "e64a52c0", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T11:53:47.339520Z", "iopub.status.busy": "2026-11-16T11:53:47.339371Z", "iopub.status.idle": "2026-11-16T11:53:47.520533Z", "shell.execute_reply": "2026-11-16T11:53:47.519672Z" } }, "outputs": [], "source": [ "log_df = pd.read_parquet(PROCESSED / \"ingest_log.parquet\")\n", "\n", "log_df[\"error\"].isna().value_counts()\n" ] }, { "cell_type": "code", "execution_count": null, "id": "5530223d", "metadata": { "execution": { "iopub.execute_input": "2026-11-16T11:53:47.522081Z", "iopub.status.busy": "2026-11-16T11:53:47.521859Z", "iopub.status.idle": "2026-11-16T11:53:47.544321Z", "shell.execute_reply": "2026-11-16T11:53:47.543589Z" } }, "outputs": [], "source": [ "log_df.loc[log_df[\"error\"].notna(), [\"label_path\", \"error\"]].head()\n" ] }, { "cell_type": "markdown", "id": "851ddd1f", "metadata": {}, "source": [ "Inspect a completed image and its label with GeoSave." ] }, { "cell_type": "code", "execution_count": null, "id": "dfc3d595", "metadata": {}, "outputs": [], "source": [ "completed_df = prepared_df.merge(log_df.dropna(subset=\"image_path\"), on=\"label_path\")\n", "\n", "completed_df[[\"scene_id\", \"image_path\", \"label_path\"]].head()\n" ] }, { "cell_type": "code", "execution_count": null, "id": "de589ecd", "metadata": {}, "outputs": [], "source": [ "example = completed_df.iloc[0]\n", "image = gs.open_raster(PROCESSED / example[\"image_path\"])\n", "\n", "image.gs.mask_and_scale().gs.plot(\n", " rgb=(\"B04\", \"B03\", \"B02\"), clim=(0, 0.3), title=\"Sentinel-2 L2A\", xlabel=\"\"\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "fba8e824", "metadata": {}, "outputs": [], "source": [ "label = gs.open_raster(PROCESSED / example[\"label_path\"])\n", "label = label.gs.write_flags(class_names, class_colors)\n", "\n", "label.gs.plot(title=\"Original label\", xlabel=\"\")" ] }, { "cell_type": "markdown", "id": "a6381f67", "metadata": {}, "source": [ "Train the global baseline on all completed expert and non-expert training labels.\n", "Keep expert val and consensus test separate. Regional fine-tuning can follow later." ] } ], "metadata": { "kernelspec": { "display_name": "geosave (3.14.10)", "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.14.10" } }, "nbformat": 4, "nbformat_minor": 5 }