{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "c30d4bdb",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "\n",
    "os.environ[\"SCIPY_ARRAY_API\"] = \"1\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cfdeac0c",
   "metadata": {},
   "outputs": [],
   "source": [
    "import cartopy.crs as ccrs\n",
    "import cartopy.feature as cfeature\n",
    "import matplotlib\n",
    "import matplotlib.path as mpath\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "import seaborn.objects as so\n",
    "import xarray as xr\n",
    "import xdggs\n",
    "from rich import pretty, print, traceback\n",
    "from seaborn import axes_style\n",
    "\n",
    "from entropice.spatial import grids\n",
    "from entropice.utils.paths import RESULTS_DIR, get_embeddings_store\n",
    "from entropice.utils.training import Training\n",
    "from entropice.utils.types import GridConfig, grid_configs\n",
    "\n",
    "pretty.install()\n",
    "traceback.install()\n",
    "\n",
    "theme_dict = {**axes_style(\"whitegrid\"), \"grid.linestyle\": \":\"}\n",
    "so.Plot.config.theme.update(theme_dict)\n",
    "\n",
    "sns.set_theme(context=\"paper\", style=\"whitegrid\", palette=\"tab10\", font_scale=1.5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "4c37f048",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Found <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">81</span> runs for <span style=\"color: #808000; text-decoration-color: #808000\">experiment_name</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'feature_importance_era5-shoulder_arcticdem-v2'</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Found \u001b[1;36m81\u001b[0m runs for \u001b[33mexperiment_name\u001b[0m=\u001b[32m'feature_importance_era5-shoulder_arcticdem-v2'\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Found <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">36</span> runs for <span style=\"color: #808000; text-decoration-color: #808000\">experiment_name</span>=<span style=\"color: #008000; text-decoration-color: #008000\">\"feature_importance_era5-shoulder_arcticdem-v2_selection='univariate'\"</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Found \u001b[1;36m36\u001b[0m runs for \u001b[33mexperiment_name\u001b[0m=\u001b[32m\"feature_importance_era5\u001b[0m\u001b[32m-shoulder_arcticdem-\u001b[0m\u001b[32mv2_selection\u001b[0m\u001b[32m='univariate'\"\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n",
      "Warning: Post-merge filters are not checked for validity! Please ensure that they are valid columns in the final merged dataset.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Found <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">36</span> runs for <span style=\"color: #808000; text-decoration-color: #808000\">experiment_name</span>=<span style=\"color: #008000; text-decoration-color: #008000\">\"feature_importance_era5-shoulder_arcticdem-v2_selection='cluster'\"</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Found \u001b[1;36m36\u001b[0m runs for \u001b[33mexperiment_name\u001b[0m=\u001b[32m\"feature_importance_era5\u001b[0m\u001b[32m-shoulder_arcticdem-\u001b[0m\u001b[32mv2_selection\u001b[0m\u001b[32m='cluster'\"\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Found <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">81</span> runs for <span style=\"color: #808000; text-decoration-color: #808000\">experiment_name</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'feature_importance_alphaearth'</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Found \u001b[1;36m81\u001b[0m runs for \u001b[33mexperiment_name\u001b[0m=\u001b[32m'feature_importance_alphaearth'\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Found <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">234</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">130</span> binary, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">104</span> density<span style=\"font-weight: bold\">)</span> runs in total across <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span> experiments.\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Found \u001b[1;36m234\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m130\u001b[0m binary, \u001b[1;36m104\u001b[0m density\u001b[1m)\u001b[0m runs in total across \u001b[1;36m4\u001b[0m experiments.\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>path</th>\n",
       "      <th>dataset</th>\n",
       "      <th>grid</th>\n",
       "      <th>level</th>\n",
       "      <th>members</th>\n",
       "      <th>method</th>\n",
       "      <th>task</th>\n",
       "      <th>target</th>\n",
       "      <th>model_type</th>\n",
       "      <th>run</th>\n",
       "      <th>...</th>\n",
       "      <th>train_pearsonr</th>\n",
       "      <th>train_median_absolute_error</th>\n",
       "      <th>test_root_mean_squared_error</th>\n",
       "      <th>test_pearsonr</th>\n",
       "      <th>test_median_absolute_error</th>\n",
       "      <th>complete_root_mean_squared_error</th>\n",
       "      <th>complete_pearsonr</th>\n",
       "      <th>complete_median_absolute_error</th>\n",
       "      <th>grid_level</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>/raid/scratch/tohoel001/data/entropice/results...</td>\n",
       "      <td>hex-3['ArcticDEM', 'ERA5-shoulder']</td>\n",
       "      <td>H3</td>\n",
       "      <td>3</td>\n",
       "      <td>[ArcticDEM, ERA5-shoulder]</td>\n",
       "      <td>HPOCV</td>\n",
       "      <td>binary</td>\n",
       "      <td>darts_v1</td>\n",
       "      <td>eSPA</td>\n",
       "      <td>Training(path=/raid/scratch/tohoel001/data/ent...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>H3 Level 3</td>\n",
       "      <td>ERA5 + ArcticDEM</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>/raid/scratch/tohoel001/data/entropice/results...</td>\n",
       "      <td>healpix-9['ArcticDEM', 'ERA5-shoulder']</td>\n",
       "      <td>HEALPix</td>\n",
       "      <td>9</td>\n",
       "      <td>[ArcticDEM, ERA5-shoulder]</td>\n",
       "      <td>HPOCV</td>\n",
       "      <td>binary</td>\n",
       "      <td>darts_v1</td>\n",
       "      <td>eSPA</td>\n",
       "      <td>Training(path=/raid/scratch/tohoel001/data/ent...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>HEALPix Level 9</td>\n",
       "      <td>ERA5 + ArcticDEM</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>/raid/scratch/tohoel001/data/entropice/results...</td>\n",
       "      <td>hex-5['ArcticDEM', 'ERA5-shoulder']</td>\n",
       "      <td>H3</td>\n",
       "      <td>5</td>\n",
       "      <td>[ArcticDEM, ERA5-shoulder]</td>\n",
       "      <td>HPOCV</td>\n",
       "      <td>binary</td>\n",
       "      <td>darts_v1</td>\n",
       "      <td>XGBoost</td>\n",
       "      <td>Training(path=/raid/scratch/tohoel001/data/ent...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>H3 Level 5</td>\n",
       "      <td>ERA5 + ArcticDEM</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>/raid/scratch/tohoel001/data/entropice/results...</td>\n",
       "      <td>hex-3['ArcticDEM', 'ERA5-shoulder']</td>\n",
       "      <td>H3</td>\n",
       "      <td>3</td>\n",
       "      <td>[ArcticDEM, ERA5-shoulder]</td>\n",
       "      <td>HPOCV</td>\n",
       "      <td>binary</td>\n",
       "      <td>darts_v1</td>\n",
       "      <td>Random Forest</td>\n",
       "      <td>Training(path=/raid/scratch/tohoel001/data/ent...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>H3 Level 3</td>\n",
       "      <td>ERA5 + ArcticDEM</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>/raid/scratch/tohoel001/data/entropice/results...</td>\n",
       "      <td>hex-6['ArcticDEM', 'ERA5-shoulder']</td>\n",
       "      <td>H3</td>\n",
       "      <td>6</td>\n",
       "      <td>[ArcticDEM, ERA5-shoulder]</td>\n",
       "      <td>HPOCV</td>\n",
       "      <td>density</td>\n",
       "      <td>darts_v1</td>\n",
       "      <td>Random Forest</td>\n",
       "      <td>Training(path=/raid/scratch/tohoel001/data/ent...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>H3 Level 6</td>\n",
       "      <td>ERA5 + ArcticDEM</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>229</th>\n",
       "      <td>/raid/scratch/tohoel001/data/entropice/results...</td>\n",
       "      <td>healpix-6['AlphaEarth']</td>\n",
       "      <td>HEALPix</td>\n",
       "      <td>6</td>\n",
       "      <td>[AlphaEarth]</td>\n",
       "      <td>AutoML</td>\n",
       "      <td>density</td>\n",
       "      <td>darts_v1</td>\n",
       "      <td>AutoGluon</td>\n",
       "      <td>Training(path=/raid/scratch/tohoel001/data/ent...</td>\n",
       "      <td>...</td>\n",
       "      <td>0.690132</td>\n",
       "      <td>0.000008</td>\n",
       "      <td>0.000131</td>\n",
       "      <td>0.587129</td>\n",
       "      <td>0.000009</td>\n",
       "      <td>0.000225</td>\n",
       "      <td>0.668917</td>\n",
       "      <td>0.000008</td>\n",
       "      <td>HEALPix Level 6</td>\n",
       "      <td>AlphaEarth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>230</th>\n",
       "      <td>/raid/scratch/tohoel001/data/entropice/results...</td>\n",
       "      <td>healpix-10['AlphaEarth']</td>\n",
       "      <td>HEALPix</td>\n",
       "      <td>10</td>\n",
       "      <td>[AlphaEarth]</td>\n",
       "      <td>AutoML</td>\n",
       "      <td>binary</td>\n",
       "      <td>darts_v1</td>\n",
       "      <td>AutoGluon</td>\n",
       "      <td>Training(path=/raid/scratch/tohoel001/data/ent...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>HEALPix Level 10</td>\n",
       "      <td>AlphaEarth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>231</th>\n",
       "      <td>/raid/scratch/tohoel001/data/entropice/results...</td>\n",
       "      <td>hex-6['AlphaEarth']</td>\n",
       "      <td>H3</td>\n",
       "      <td>6</td>\n",
       "      <td>[AlphaEarth]</td>\n",
       "      <td>AutoML</td>\n",
       "      <td>binary</td>\n",
       "      <td>darts_v1</td>\n",
       "      <td>AutoGluon</td>\n",
       "      <td>Training(path=/raid/scratch/tohoel001/data/ent...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>H3 Level 6</td>\n",
       "      <td>AlphaEarth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>232</th>\n",
       "      <td>/raid/scratch/tohoel001/data/entropice/results...</td>\n",
       "      <td>hex-5['AlphaEarth']</td>\n",
       "      <td>H3</td>\n",
       "      <td>5</td>\n",
       "      <td>[AlphaEarth]</td>\n",
       "      <td>HPOCV</td>\n",
       "      <td>binary</td>\n",
       "      <td>darts_v1</td>\n",
       "      <td>Random Forest</td>\n",
       "      <td>Training(path=/raid/scratch/tohoel001/data/ent...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>H3 Level 5</td>\n",
       "      <td>AlphaEarth</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>233</th>\n",
       "      <td>/raid/scratch/tohoel001/data/entropice/results...</td>\n",
       "      <td>hex-6['AlphaEarth']</td>\n",
       "      <td>H3</td>\n",
       "      <td>6</td>\n",
       "      <td>[AlphaEarth]</td>\n",
       "      <td>HPOCV</td>\n",
       "      <td>density</td>\n",
       "      <td>darts_v1</td>\n",
       "      <td>kNN</td>\n",
       "      <td>Training(path=/raid/scratch/tohoel001/data/ent...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>H3 Level 6</td>\n",
       "      <td>AlphaEarth</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>234 rows × 102 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "\n",
       "                                                  path  \\\n",
       "\u001b[1;36m0\u001b[0m    \u001b[35m/raid/scratch/tohoel001/data/entropice/\u001b[0m\u001b[95mresults...\u001b[0m   \n",
       "\u001b[1;36m1\u001b[0m    \u001b[35m/raid/scratch/tohoel001/data/entropice/\u001b[0m\u001b[95mresults...\u001b[0m   \n",
       "\u001b[1;36m2\u001b[0m    \u001b[35m/raid/scratch/tohoel001/data/entropice/\u001b[0m\u001b[95mresults...\u001b[0m   \n",
       "\u001b[1;36m3\u001b[0m    \u001b[35m/raid/scratch/tohoel001/data/entropice/\u001b[0m\u001b[95mresults...\u001b[0m   \n",
       "\u001b[1;36m4\u001b[0m    \u001b[35m/raid/scratch/tohoel001/data/entropice/\u001b[0m\u001b[95mresults...\u001b[0m   \n",
       "..                                                 \u001b[33m...\u001b[0m   \n",
       "\u001b[1;36m229\u001b[0m  \u001b[35m/raid/scratch/tohoel001/data/entropice/\u001b[0m\u001b[95mresults...\u001b[0m   \n",
       "\u001b[1;36m230\u001b[0m  \u001b[35m/raid/scratch/tohoel001/data/entropice/\u001b[0m\u001b[95mresults...\u001b[0m   \n",
       "\u001b[1;36m231\u001b[0m  \u001b[35m/raid/scratch/tohoel001/data/entropice/\u001b[0m\u001b[95mresults...\u001b[0m   \n",
       "\u001b[1;36m232\u001b[0m  \u001b[35m/raid/scratch/tohoel001/data/entropice/\u001b[0m\u001b[95mresults...\u001b[0m   \n",
       "\u001b[1;36m233\u001b[0m  \u001b[35m/raid/scratch/tohoel001/data/entropice/\u001b[0m\u001b[95mresults...\u001b[0m   \n",
       "\n",
       "                                     dataset     grid  level  \\\n",
       "\u001b[1;36m0\u001b[0m        hex-\u001b[1;36m3\u001b[0m\u001b[1m[\u001b[0m\u001b[32m'ArcticDEM'\u001b[0m, \u001b[32m'ERA5-shoulder'\u001b[0m\u001b[1m]\u001b[0m       H3      \u001b[1;36m3\u001b[0m   \n",
       "\u001b[1;36m1\u001b[0m    healpix-\u001b[1;36m9\u001b[0m\u001b[1m[\u001b[0m\u001b[32m'ArcticDEM'\u001b[0m, \u001b[32m'ERA5-shoulder'\u001b[0m\u001b[1m]\u001b[0m  HEALPix      \u001b[1;36m9\u001b[0m   \n",
       "\u001b[1;36m2\u001b[0m        hex-\u001b[1;36m5\u001b[0m\u001b[1m[\u001b[0m\u001b[32m'ArcticDEM'\u001b[0m, \u001b[32m'ERA5-shoulder'\u001b[0m\u001b[1m]\u001b[0m       H3      \u001b[1;36m5\u001b[0m   \n",
       "\u001b[1;36m3\u001b[0m        hex-\u001b[1;36m3\u001b[0m\u001b[1m[\u001b[0m\u001b[32m'ArcticDEM'\u001b[0m, \u001b[32m'ERA5-shoulder'\u001b[0m\u001b[1m]\u001b[0m       H3      \u001b[1;36m3\u001b[0m   \n",
       "\u001b[1;36m4\u001b[0m        hex-\u001b[1;36m6\u001b[0m\u001b[1m[\u001b[0m\u001b[32m'ArcticDEM'\u001b[0m, \u001b[32m'ERA5-shoulder'\u001b[0m\u001b[1m]\u001b[0m       H3      \u001b[1;36m6\u001b[0m   \n",
       "..                                       \u001b[33m...\u001b[0m      \u001b[33m...\u001b[0m    \u001b[33m...\u001b[0m   \n",
       "\u001b[1;36m229\u001b[0m                  healpix-\u001b[1;36m6\u001b[0m\u001b[1m[\u001b[0m\u001b[32m'AlphaEarth'\u001b[0m\u001b[1m]\u001b[0m  HEALPix      \u001b[1;36m6\u001b[0m   \n",
       "\u001b[1;36m230\u001b[0m                 healpix-\u001b[1;36m10\u001b[0m\u001b[1m[\u001b[0m\u001b[32m'AlphaEarth'\u001b[0m\u001b[1m]\u001b[0m  HEALPix     \u001b[1;36m10\u001b[0m   \n",
       "\u001b[1;36m231\u001b[0m                      hex-\u001b[1;36m6\u001b[0m\u001b[1m[\u001b[0m\u001b[32m'AlphaEarth'\u001b[0m\u001b[1m]\u001b[0m       H3      \u001b[1;36m6\u001b[0m   \n",
       "\u001b[1;36m232\u001b[0m                      hex-\u001b[1;36m5\u001b[0m\u001b[1m[\u001b[0m\u001b[32m'AlphaEarth'\u001b[0m\u001b[1m]\u001b[0m       H3      \u001b[1;36m5\u001b[0m   \n",
       "\u001b[1;36m233\u001b[0m                      hex-\u001b[1;36m6\u001b[0m\u001b[1m[\u001b[0m\u001b[32m'AlphaEarth'\u001b[0m\u001b[1m]\u001b[0m       H3      \u001b[1;36m6\u001b[0m   \n",
       "\n",
       "                        members  method     task    target     model_type  \\\n",
       "\u001b[1;36m0\u001b[0m    \u001b[1m[\u001b[0mArcticDEM, ERA5-shoulder\u001b[1m]\u001b[0m   HPOCV   binary  darts_v1           eSPA   \n",
       "\u001b[1;36m1\u001b[0m    \u001b[1m[\u001b[0mArcticDEM, ERA5-shoulder\u001b[1m]\u001b[0m   HPOCV   binary  darts_v1           eSPA   \n",
       "\u001b[1;36m2\u001b[0m    \u001b[1m[\u001b[0mArcticDEM, ERA5-shoulder\u001b[1m]\u001b[0m   HPOCV   binary  darts_v1        XGBoost   \n",
       "\u001b[1;36m3\u001b[0m    \u001b[1m[\u001b[0mArcticDEM, ERA5-shoulder\u001b[1m]\u001b[0m   HPOCV   binary  darts_v1  Random Forest   \n",
       "\u001b[1;36m4\u001b[0m    \u001b[1m[\u001b[0mArcticDEM, ERA5-shoulder\u001b[1m]\u001b[0m   HPOCV  density  darts_v1  Random Forest   \n",
       "..                          \u001b[33m...\u001b[0m     \u001b[33m...\u001b[0m      \u001b[33m...\u001b[0m       \u001b[33m...\u001b[0m            \u001b[33m...\u001b[0m   \n",
       "\u001b[1;36m229\u001b[0m                \u001b[1m[\u001b[0mAlphaEarth\u001b[1m]\u001b[0m  AutoML  density  darts_v1      AutoGluon   \n",
       "\u001b[1;36m230\u001b[0m                \u001b[1m[\u001b[0mAlphaEarth\u001b[1m]\u001b[0m  AutoML   binary  darts_v1      AutoGluon   \n",
       "\u001b[1;36m231\u001b[0m                \u001b[1m[\u001b[0mAlphaEarth\u001b[1m]\u001b[0m  AutoML   binary  darts_v1      AutoGluon   \n",
       "\u001b[1;36m232\u001b[0m                \u001b[1m[\u001b[0mAlphaEarth\u001b[1m]\u001b[0m   HPOCV   binary  darts_v1  Random Forest   \n",
       "\u001b[1;36m233\u001b[0m                \u001b[1m[\u001b[0mAlphaEarth\u001b[1m]\u001b[0m   HPOCV  density  darts_v1            kNN   \n",
       "\n",
       "                                                   run  \u001b[33m...\u001b[0m  train_pearsonr  \\\n",
       "\u001b[1;36m0\u001b[0m    \u001b[1;35mTraining\u001b[0m\u001b[1m(\u001b[0m\u001b[33mpath\u001b[0m=\u001b[35m/raid/scratch/tohoel001/data/\u001b[0m\u001b[95ment...\u001b[0m  \u001b[33m...\u001b[0m             NaN   \n",
       "\u001b[1;36m1\u001b[0m    \u001b[1;35mTraining\u001b[0m\u001b[1m(\u001b[0m\u001b[33mpath\u001b[0m=\u001b[35m/raid/scratch/tohoel001/data/\u001b[0m\u001b[95ment...\u001b[0m  \u001b[33m...\u001b[0m             NaN   \n",
       "\u001b[1;36m2\u001b[0m    \u001b[1;35mTraining\u001b[0m\u001b[1m(\u001b[0m\u001b[33mpath\u001b[0m=\u001b[35m/raid/scratch/tohoel001/data/\u001b[0m\u001b[95ment...\u001b[0m  \u001b[33m...\u001b[0m             NaN   \n",
       "\u001b[1;36m3\u001b[0m    \u001b[1;35mTraining\u001b[0m\u001b[1m(\u001b[0m\u001b[33mpath\u001b[0m=\u001b[35m/raid/scratch/tohoel001/data/\u001b[0m\u001b[95ment...\u001b[0m  \u001b[33m...\u001b[0m             NaN   \n",
       "\u001b[1;36m4\u001b[0m    \u001b[1;35mTraining\u001b[0m\u001b[1m(\u001b[0m\u001b[33mpath\u001b[0m=\u001b[35m/raid/scratch/tohoel001/data/\u001b[0m\u001b[95ment...\u001b[0m  \u001b[33m...\u001b[0m             NaN   \n",
       "..                                                 \u001b[33m...\u001b[0m  \u001b[33m...\u001b[0m             \u001b[33m...\u001b[0m   \n",
       "\u001b[1;36m229\u001b[0m  \u001b[1;35mTraining\u001b[0m\u001b[1m(\u001b[0m\u001b[33mpath\u001b[0m=\u001b[35m/raid/scratch/tohoel001/data/\u001b[0m\u001b[95ment...\u001b[0m  \u001b[33m...\u001b[0m        \u001b[1;36m0.690132\u001b[0m   \n",
       "\u001b[1;36m230\u001b[0m  \u001b[1;35mTraining\u001b[0m\u001b[1m(\u001b[0m\u001b[33mpath\u001b[0m=\u001b[35m/raid/scratch/tohoel001/data/\u001b[0m\u001b[95ment...\u001b[0m  \u001b[33m...\u001b[0m             NaN   \n",
       "\u001b[1;36m231\u001b[0m  \u001b[1;35mTraining\u001b[0m\u001b[1m(\u001b[0m\u001b[33mpath\u001b[0m=\u001b[35m/raid/scratch/tohoel001/data/\u001b[0m\u001b[95ment...\u001b[0m  \u001b[33m...\u001b[0m             NaN   \n",
       "\u001b[1;36m232\u001b[0m  \u001b[1;35mTraining\u001b[0m\u001b[1m(\u001b[0m\u001b[33mpath\u001b[0m=\u001b[35m/raid/scratch/tohoel001/data/\u001b[0m\u001b[95ment...\u001b[0m  \u001b[33m...\u001b[0m             NaN   \n",
       "\u001b[1;36m233\u001b[0m  \u001b[1;35mTraining\u001b[0m\u001b[1m(\u001b[0m\u001b[33mpath\u001b[0m=\u001b[35m/raid/scratch/tohoel001/data/\u001b[0m\u001b[95ment...\u001b[0m  \u001b[33m...\u001b[0m             NaN   \n",
       "\n",
       "     train_median_absolute_error  test_root_mean_squared_error  test_pearsonr  \\\n",
       "\u001b[1;36m0\u001b[0m                            NaN                           NaN            NaN   \n",
       "\u001b[1;36m1\u001b[0m                            NaN                           NaN            NaN   \n",
       "\u001b[1;36m2\u001b[0m                            NaN                           NaN            NaN   \n",
       "\u001b[1;36m3\u001b[0m                            NaN                           NaN            NaN   \n",
       "\u001b[1;36m4\u001b[0m                            NaN                           NaN            NaN   \n",
       "..                           \u001b[33m...\u001b[0m                           \u001b[33m...\u001b[0m            \u001b[33m...\u001b[0m   \n",
       "\u001b[1;36m229\u001b[0m                     \u001b[1;36m0.000008\u001b[0m                      \u001b[1;36m0.000131\u001b[0m       \u001b[1;36m0.587129\u001b[0m   \n",
       "\u001b[1;36m230\u001b[0m                          NaN                           NaN            NaN   \n",
       "\u001b[1;36m231\u001b[0m                          NaN                           NaN            NaN   \n",
       "\u001b[1;36m232\u001b[0m                          NaN                           NaN            NaN   \n",
       "\u001b[1;36m233\u001b[0m                          NaN                           NaN            NaN   \n",
       "\n",
       "     test_median_absolute_error  complete_root_mean_squared_error  \\\n",
       "\u001b[1;36m0\u001b[0m                           NaN                               NaN   \n",
       "\u001b[1;36m1\u001b[0m                           NaN                               NaN   \n",
       "\u001b[1;36m2\u001b[0m                           NaN                               NaN   \n",
       "\u001b[1;36m3\u001b[0m                           NaN                               NaN   \n",
       "\u001b[1;36m4\u001b[0m                           NaN                               NaN   \n",
       "..                          \u001b[33m...\u001b[0m                               \u001b[33m...\u001b[0m   \n",
       "\u001b[1;36m229\u001b[0m                    \u001b[1;36m0.000009\u001b[0m                          \u001b[1;36m0.000225\u001b[0m   \n",
       "\u001b[1;36m230\u001b[0m                         NaN                               NaN   \n",
       "\u001b[1;36m231\u001b[0m                         NaN                               NaN   \n",
       "\u001b[1;36m232\u001b[0m                         NaN                               NaN   \n",
       "\u001b[1;36m233\u001b[0m                         NaN                               NaN   \n",
       "\n",
       "     complete_pearsonr  complete_median_absolute_error        grid_level  \\\n",
       "\u001b[1;36m0\u001b[0m                  NaN                             NaN        H3 Level \u001b[1;36m3\u001b[0m   \n",
       "\u001b[1;36m1\u001b[0m                  NaN                             NaN   HEALPix Level \u001b[1;36m9\u001b[0m   \n",
       "\u001b[1;36m2\u001b[0m                  NaN                             NaN        H3 Level \u001b[1;36m5\u001b[0m   \n",
       "\u001b[1;36m3\u001b[0m                  NaN                             NaN        H3 Level \u001b[1;36m3\u001b[0m   \n",
       "\u001b[1;36m4\u001b[0m                  NaN                             NaN        H3 Level \u001b[1;36m6\u001b[0m   \n",
       "..                 \u001b[33m...\u001b[0m                             \u001b[33m...\u001b[0m               \u001b[33m...\u001b[0m   \n",
       "\u001b[1;36m229\u001b[0m           \u001b[1;36m0.668917\u001b[0m                        \u001b[1;36m0.000008\u001b[0m   HEALPix Level \u001b[1;36m6\u001b[0m   \n",
       "\u001b[1;36m230\u001b[0m                NaN                             NaN  HEALPix Level \u001b[1;36m10\u001b[0m   \n",
       "\u001b[1;36m231\u001b[0m                NaN                             NaN        H3 Level \u001b[1;36m6\u001b[0m   \n",
       "\u001b[1;36m232\u001b[0m                NaN                             NaN        H3 Level \u001b[1;36m5\u001b[0m   \n",
       "\u001b[1;36m233\u001b[0m                NaN                             NaN        H3 Level \u001b[1;36m6\u001b[0m   \n",
       "\n",
       "           experiment  \n",
       "\u001b[1;36m0\u001b[0m    ERA5 + ArcticDEM  \n",
       "\u001b[1;36m1\u001b[0m    ERA5 + ArcticDEM  \n",
       "\u001b[1;36m2\u001b[0m    ERA5 + ArcticDEM  \n",
       "\u001b[1;36m3\u001b[0m    ERA5 + ArcticDEM  \n",
       "\u001b[1;36m4\u001b[0m    ERA5 + ArcticDEM  \n",
       "..                \u001b[33m...\u001b[0m  \n",
       "\u001b[1;36m229\u001b[0m        AlphaEarth  \n",
       "\u001b[1;36m230\u001b[0m        AlphaEarth  \n",
       "\u001b[1;36m231\u001b[0m        AlphaEarth  \n",
       "\u001b[1;36m232\u001b[0m        AlphaEarth  \n",
       "\u001b[1;36m233\u001b[0m        AlphaEarth  \n",
       "\n",
       "\u001b[1m[\u001b[0m\u001b[1;36m234\u001b[0m rows x \u001b[1;36m102\u001b[0m columns\u001b[1m]\u001b[0m"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# experiment_name = \"feature_importance_era5-shoulder_arcticdem-v2\"\n",
    "# experiment_name = \"feature_importance_era5-shoulder_arcticdem-v2_selection='univariate'\"\n",
    "# experiment_name = \"feature_importance_era5-shoulder_arcticdem-v2_selection='cluster'\"\n",
    "# experiment_name = \"feature_importance_alphaearth\"\n",
    "experiment_names = [\n",
    "    \"feature_importance_era5-shoulder_arcticdem-v2\",\n",
    "    \"feature_importance_era5-shoulder_arcticdem-v2_selection='univariate'\",\n",
    "    \"feature_importance_era5-shoulder_arcticdem-v2_selection='cluster'\",\n",
    "    \"feature_importance_alphaearth\",\n",
    "]\n",
    "\n",
    "all_experiments = []\n",
    "for experiment_name in experiment_names:\n",
    "    experiment_dir = RESULTS_DIR / experiment_name\n",
    "\n",
    "    all_runs = pd.DataFrame(\n",
    "        [\n",
    "            Training.load(f).to_record()\n",
    "            for f in experiment_dir.iterdir()\n",
    "            if f.is_dir() and f.name.startswith(\"permafrost_\")\n",
    "        ]\n",
    "    )\n",
    "\n",
    "    # Rename the models: \"rf\" to \"Random Forest\", \"xgboost\" to \"XGBoost\", \"knn\" to \"kNN\",\n",
    "    # \"espa\" to \"eSPA\" and \"autogluon\" to \"AutoGluon for better readability\n",
    "    all_runs[\"model_type\"] = (\n",
    "        all_runs[\"model_type\"]\n",
    "        .str.replace(\"rf\", \"Random Forest\", regex=False)\n",
    "        .str.replace(\"xgboost\", \"XGBoost\", regex=False)\n",
    "        .str.replace(\"knn\", \"kNN\", regex=False)\n",
    "        .str.replace(\"espa\", \"eSPA\", regex=False)\n",
    "        .str.replace(\"autogluon\", \"AutoGluon\", regex=False)\n",
    "    )\n",
    "\n",
    "    # Rename hex to H3 and healpix to HEALPix for better readability\n",
    "    all_runs[\"grid\"] = (\n",
    "        all_runs[\"grid\"].str.replace(\"hex\", \"H3\", regex=False).str.replace(\"healpix\", \"HEALPix\", regex=False)\n",
    "    )\n",
    "\n",
    "    # Create a combined \"grid_level\" column for easier plotting\n",
    "    grid_level = all_runs[\"grid\"].str.cat(all_runs[\"level\"].astype(str), sep=\" Level \")\n",
    "    # Make it categorical with a specific order\n",
    "    grid_level_cat = pd.CategoricalDtype(\n",
    "        categories=[\n",
    "            \"H3 Level 3\",\n",
    "            \"HEALPix Level 6\",\n",
    "            \"HEALPix Level 7\",\n",
    "            \"H3 Level 4\",\n",
    "            \"HEALPix Level 8\",\n",
    "            \"H3 Level 5\",\n",
    "            \"HEALPix Level 9\",\n",
    "            \"HEALPix Level 10\",\n",
    "            \"H3 Level 6\",\n",
    "        ],\n",
    "        ordered=True,\n",
    "    )\n",
    "    grid_level = grid_level.astype(grid_level_cat)\n",
    "    all_runs[\"grid_level\"] = grid_level\n",
    "\n",
    "    print(f\"Found {len(all_runs)} runs for {experiment_name=}\")\n",
    "    all_runs[\"experiment\"] = experiment_name\n",
    "    all_experiments.append(all_runs)\n",
    "all_experiments = pd.concat(all_experiments, ignore_index=True)\n",
    "\n",
    "# Rename Experiments\n",
    "experiment_rename_map = {\n",
    "    \"feature_importance_era5-shoulder_arcticdem-v2\": \"ERA5 + ArcticDEM\",\n",
    "    \"feature_importance_era5-shoulder_arcticdem-v2_selection='univariate'\": \"ERA5 + ArcticDEM (Univariate Selection)\",\n",
    "    \"feature_importance_era5-shoulder_arcticdem-v2_selection='cluster'\": \"ERA5 + ArcticDEM (Cluster Selection)\",\n",
    "    \"feature_importance_alphaearth\": \"AlphaEarth\",\n",
    "}\n",
    "all_experiments[\"experiment\"] = all_experiments[\"experiment\"].map(experiment_rename_map)\n",
    "\n",
    "binary_runs = all_experiments[all_experiments[\"task\"] == \"binary\"]\n",
    "density_runs = all_experiments[all_experiments[\"task\"] == \"density\"]\n",
    "# Drop all columns that are all NaN in either binary_runs or density_runs\n",
    "binary_runs = binary_runs.dropna(axis=1, how=\"all\")\n",
    "density_runs = density_runs.dropna(axis=1, how=\"all\")\n",
    "print(\n",
    "    f\"Found {len(all_experiments)} ({len(binary_runs)} binary, {len(density_runs)} density) runs in total\"\n",
    "    f\" across {len(experiment_names)} experiments.\"\n",
    ")\n",
    "\n",
    "all_experiments"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "666f8e97",
   "metadata": {},
   "source": [
    "## Binary Maps"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1eb19ad5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - eSPA - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - eSPA - H3 Level \u001b[1;36m3\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m1\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - XGBoost - H3 Level \u001b[1;36m3\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m2\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level \u001b[1;36m3\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m3\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - eSPA - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - eSPA - H3 Level \u001b[1;36m4\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m4\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - XGBoost - H3 Level \u001b[1;36m4\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m5\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level \u001b[1;36m4\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m6\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - eSPA - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">7</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - eSPA - H3 Level \u001b[1;36m5\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m7\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - XGBoost - H3 Level \u001b[1;36m5\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m8\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">9</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level \u001b[1;36m5\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m9\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - eSPA - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">10</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - eSPA - H3 Level \u001b[1;36m6\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m10\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">11</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - XGBoost - H3 Level \u001b[1;36m6\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m11\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level \u001b[1;36m6\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m12\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "\n",
       "\u001b[1m(\u001b[0m\n",
       "    \u001b[1m<\u001b[0m\u001b[1;95mFigure\u001b[0m\u001b[39m size 250\u001b[0m\u001b[1;36m0x2000\u001b[0m\u001b[39m with \u001b[0m\u001b[1;36m12\u001b[0m\u001b[39m Axes>,\u001b[0m\n",
       "\u001b[39m    \u001b[0m\u001b[1;35marray\u001b[0m\u001b[1;39m(\u001b[0m\u001b[1;39m[\u001b[0m\u001b[1;39m[\u001b[0m\u001b[39m<GeoAxes: >, <GeoAxes: >, <GeoAxes: >, <GeoAxes: >\u001b[0m\u001b[1;39m]\u001b[0m\u001b[39m,\u001b[0m\n",
       "\u001b[39m       \u001b[0m\u001b[1;39m[\u001b[0m\u001b[39m<GeoAxes: >, <GeoAxes: >, <GeoAxes: >, <GeoAxes: >\u001b[0m\u001b[1;39m]\u001b[0m\u001b[39m,\u001b[0m\n",
       "\u001b[39m       \u001b[0m\u001b[1;39m[\u001b[0m\u001b[39m<GeoAxes: >, <GeoAxes: >, <GeoAxes: >, <GeoAxes: \u001b[0m\u001b[1m>\u001b[0m\u001b[1m]\u001b[0m\u001b[1m]\u001b[0m, \u001b[33mdtype\u001b[0m=\u001b[35mobject\u001b[0m\u001b[1m)\u001b[0m\n",
       "\u001b[1m)\u001b[0m"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 5970660 characters]",
      "text/plain": [
       "\u001b[1m<\u001b[0m\u001b[1;95mFigure\u001b[0m\u001b[39m size 250\u001b[0m\u001b[1;36m0x2000\u001b[0m\u001b[39m with \u001b[0m\u001b[1;36m12\u001b[0m\u001b[39m Axes\u001b[0m\u001b[1m>\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Default to light theme\n",
    "figcolor = \"#ffffff\"\n",
    "axcolor = \"#ffffff\"\n",
    "oceancolor = \"#e3f2fd\"\n",
    "landcolor = \"#ecf0f1\"\n",
    "gridcolor = \"#666666\"\n",
    "fgcolor = \"#2c3e50\"\n",
    "coastcolor = \"#34495e\"\n",
    "\n",
    "# Create North Polar Stereographic projection matching EPSG:3413\n",
    "# EPSG:3413: WGS 84 / NSIDC Sea Ice Polar Stereographic North\n",
    "data_crs = ccrs.Stereographic(central_latitude=90, central_longitude=-45, true_scale_latitude=70)\n",
    "\n",
    "\n",
    "def plot_binary_into_axes(ax, experiment, model, grid_level):\n",
    "    run = (\n",
    "        all_experiments[\n",
    "            (all_experiments[\"experiment\"] == experiment)\n",
    "            & (all_experiments[\"model_type\"] == model)\n",
    "            & (all_experiments[\"grid_level\"] == grid_level)\n",
    "            & (all_experiments[\"task\"] == \"binary\")\n",
    "        ]\n",
    "        .iloc[0]\n",
    "        .run\n",
    "    )\n",
    "\n",
    "    # Add cartographic features to DEM\n",
    "    # ax.add_feature(cfeature.OCEAN, facecolor=oceancolor, zorder=0)\n",
    "    # ax.add_feature(cfeature.LAND, facecolor=landcolor, zorder=1)\n",
    "    ax.stock_img()\n",
    "    ax.add_feature(cfeature.COASTLINE, edgecolor=coastcolor, linewidth=0.8, zorder=4)\n",
    "    ax.add_feature(cfeature.BORDERS, edgecolor=coastcolor, linewidth=0.5, linestyle=\":\", zorder=4)\n",
    "\n",
    "    # Add gridlines\n",
    "    # ax.gridlines(draw_labels=[\"x\", \"y\", \"top\", \"bottom\", \"left\", \"right\", \"geo\"], linewidth=0.5, color=gridcolor, alpha=0.3, linestyle=\"-\", zorder=4)\n",
    "    ax.gridlines(draw_labels=False, linewidth=0.5, color=gridcolor, alpha=0.5, linestyle=\"-\", zorder=4)\n",
    "\n",
    "    # Set map extent\n",
    "    ax.set_extent([-180, 180, 57, 90], crs=ccrs.PlateCarree())\n",
    "\n",
    "    # Compute a circle in axes coordinates, which we can use as a boundary\n",
    "    # for the map. We can pan/zoom as much as we like - the boundary will be\n",
    "    # permanently circular.\n",
    "    theta = np.linspace(0, 2 * np.pi, 100)\n",
    "    center, radius = [0.5, 0.5], 0.5\n",
    "    verts = np.vstack([np.sin(theta), np.cos(theta)]).T\n",
    "    circle = mpath.Path(verts * radius + center)\n",
    "    ax.set_boundary(circle, transform=ax.transAxes)\n",
    "\n",
    "    # Draw a black border around the map for better visibility\n",
    "    ax.add_patch(\n",
    "        plt.Circle((0.5, 0.5), 0.5, transform=ax.transAxes, fill=False, edgecolor=\"black\", linewidth=1.5, zorder=4)\n",
    "    )\n",
    "\n",
    "    # Plot predictions\n",
    "    run.predictions.plot(\n",
    "        column=\"predicted\",\n",
    "        ax=ax,\n",
    "        transform=data_crs,\n",
    "        cmap=\"flare\",\n",
    "        edgecolor=\"none\",\n",
    "        linewidth=0,\n",
    "        alpha=0.7,\n",
    "        legend=True,\n",
    "        # Disable transparent legend background and set edge color to gridcolor for better visibility\n",
    "        legend_kwds={\n",
    "            \"loc\": \"lower left\",\n",
    "            \"fontsize\": 14,\n",
    "            \"title\": None,\n",
    "            \"title_fontsize\": 12,\n",
    "            \"frameon\": True,\n",
    "            \"facecolor\": \"white\",\n",
    "            \"edgecolor\": gridcolor,\n",
    "        },\n",
    "    )\n",
    "\n",
    "    ax.text(\n",
    "        0.98,\n",
    "        0.02,\n",
    "        f\"{experiment}\\n{grid_level}\\n{model}\",\n",
    "        transform=ax.transAxes,\n",
    "        fontsize=16,\n",
    "        weight=\"bold\",\n",
    "        color=fgcolor,\n",
    "        verticalalignment=\"top\",\n",
    "        ha=\"right\",\n",
    "        va=\"bottom\",\n",
    "        zorder=5,\n",
    "        bbox={\n",
    "            \"boxstyle\": \"round,pad=0.5\",\n",
    "            \"facecolor\": \"white\",\n",
    "            \"edgecolor\": gridcolor,\n",
    "            \"alpha\": 1.0,\n",
    "            \"linewidth\": 1.5,\n",
    "        },\n",
    "    )\n",
    "\n",
    "\n",
    "def plot_binary_maps(experiment):\n",
    "    models = [\"eSPA\", \"XGBoost\", \"AutoGluon\"]\n",
    "    grid_levels = [\"H3 Level 3\", \"H3 Level 4\", \"H3 Level 5\", \"H3 Level 6\"]\n",
    "    # grid_levels = [\"H3 Level 3\", \"H3 Level 4\", \"H3 Level 5\"]\n",
    "\n",
    "    fig, axs = plt.subplots(\n",
    "        nrows=len(models),\n",
    "        ncols=len(grid_levels),\n",
    "        figsize=(25, 20),\n",
    "        facecolor=figcolor,\n",
    "        subplot_kw={\"projection\": data_crs},\n",
    "    )\n",
    "    total = len(grid_levels) * len(models)\n",
    "    for i, grid_level in enumerate(grid_levels):\n",
    "        for j, model in enumerate(models):\n",
    "            ax = axs[j, i]\n",
    "            plot_binary_into_axes(ax, experiment, model, grid_level)\n",
    "            ij = i * len(models) + j + 1\n",
    "            print(f\"Plotted {experiment} - {model} - {grid_level} ({ij}/{total})\")\n",
    "\n",
    "            # Row and Column Labels\n",
    "            if j == 0:\n",
    "                ax.set_title(grid_level, fontsize=18, weight=\"bold\", color=fgcolor, pad=20)\n",
    "            if i == 0:\n",
    "                ax.text(\n",
    "                    -0.15,\n",
    "                    0.5,\n",
    "                    model,\n",
    "                    transform=ax.transAxes,\n",
    "                    fontsize=18,\n",
    "                    weight=\"bold\",\n",
    "                    color=fgcolor,\n",
    "                    rotation=90,\n",
    "                    verticalalignment=\"center\",\n",
    "                    ha=\"right\",\n",
    "                    va=\"center\",\n",
    "                )\n",
    "\n",
    "    fig.tight_layout()\n",
    "    return fig, axs\n",
    "\n",
    "\n",
    "plot_binary_maps(\"ERA5 + ArcticDEM\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "id": "0596c4b8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - eSPA - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - eSPA - H3 Level \u001b[1;36m3\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m1\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - XGBoost - H3 Level \u001b[1;36m3\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m2\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - AutoGluon - H3 Level \u001b[1;36m3\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m3\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - eSPA - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - eSPA - H3 Level \u001b[1;36m4\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m4\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - XGBoost - H3 Level \u001b[1;36m4\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m5\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - AutoGluon - H3 Level \u001b[1;36m4\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m6\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - eSPA - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">7</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - eSPA - H3 Level \u001b[1;36m5\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m7\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - XGBoost - H3 Level \u001b[1;36m5\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m8\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">9</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - AutoGluon - H3 Level \u001b[1;36m5\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m9\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - eSPA - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">10</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - eSPA - H3 Level \u001b[1;36m6\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m10\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">11</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - XGBoost - H3 Level \u001b[1;36m6\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m11\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - AutoGluon - H3 Level \u001b[1;36m6\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m12\u001b[0m/\u001b[1;36m12\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "\n",
       "\u001b[1m(\u001b[0m\n",
       "    \u001b[1m<\u001b[0m\u001b[1;95mFigure\u001b[0m\u001b[39m size 250\u001b[0m\u001b[1;36m0x2000\u001b[0m\u001b[39m with \u001b[0m\u001b[1;36m12\u001b[0m\u001b[39m Axes>,\u001b[0m\n",
       "\u001b[39m    \u001b[0m\u001b[1;35marray\u001b[0m\u001b[1;39m(\u001b[0m\u001b[1;39m[\u001b[0m\u001b[1;39m[\u001b[0m\u001b[39m<GeoAxes: >, <GeoAxes: >, <GeoAxes: >, <GeoAxes: >\u001b[0m\u001b[1;39m]\u001b[0m\u001b[39m,\u001b[0m\n",
       "\u001b[39m       \u001b[0m\u001b[1;39m[\u001b[0m\u001b[39m<GeoAxes: >, <GeoAxes: >, <GeoAxes: >, <GeoAxes: >\u001b[0m\u001b[1;39m]\u001b[0m\u001b[39m,\u001b[0m\n",
       "\u001b[39m       \u001b[0m\u001b[1;39m[\u001b[0m\u001b[39m<GeoAxes: >, <GeoAxes: >, <GeoAxes: >, <GeoAxes: \u001b[0m\u001b[1m>\u001b[0m\u001b[1m]\u001b[0m\u001b[1m]\u001b[0m, \u001b[33mdtype\u001b[0m=\u001b[35mobject\u001b[0m\u001b[1m)\u001b[0m\n",
       "\u001b[1m)\u001b[0m"
      ]
     },
     "execution_count": 86,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 6271596 characters]",
      "text/plain": [
       "\u001b[1m<\u001b[0m\u001b[1;95mFigure\u001b[0m\u001b[39m size 250\u001b[0m\u001b[1;36m0x2000\u001b[0m\u001b[39m with \u001b[0m\u001b[1;36m12\u001b[0m\u001b[39m Axes\u001b[0m\u001b[1m>\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_binary_maps(\"AlphaEarth\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "322344e7",
   "metadata": {},
   "source": [
    "## Density Maps"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6afec2fe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4.107934728381224e-05</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.00021168901002965868</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m4.107934728381224e-05\u001b[0m \u001b[1;36m0.00021168901002965868\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - XGBoost - H3 Level \u001b[1;36m3\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m1\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1e-06</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.0002489904290996492</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m1e-06\u001b[0m \u001b[1;36m0.0002489904290996492\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level \u001b[1;36m3\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m2\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1.5779416571604088e-05</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.00026123312563868233</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m1.5779416571604088e-05\u001b[0m \u001b[1;36m0.00026123312563868233\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - XGBoost - H3 Level \u001b[1;36m4\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m3\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1e-06</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.00023598280022270042</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m1e-06\u001b[0m \u001b[1;36m0.00023598280022270042\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level \u001b[1;36m4\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m4\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5.251742550171912e-06</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.0003538331249728796</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m5.251742550171912e-06\u001b[0m \u001b[1;36m0.0003538331249728796\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - XGBoost - H3 Level \u001b[1;36m5\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m5\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5.325606616679579e-06</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.00018151280819438383</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m5.325606616679579e-06\u001b[0m \u001b[1;36m0.00018151280819438383\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level \u001b[1;36m5\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m6\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1.2327509466558695e-06</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.0014486043946817513</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m1.2327509466558695e-06\u001b[0m \u001b[1;36m0.0014486043946817513\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">7</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - XGBoost - H3 Level \u001b[1;36m6\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m7\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">9.823517393670046e-06</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.0003713766054715961</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m9.823517393670046e-06\u001b[0m \u001b[1;36m0.0003713766054715961\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted ERA5 + ArcticDEM - AutoGluon - H3 Level \u001b[1;36m6\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m8\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "\n",
       "\u001b[1m(\u001b[0m\n",
       "    \u001b[1m<\u001b[0m\u001b[1;95mFigure\u001b[0m\u001b[39m size 250\u001b[0m\u001b[1;36m0x1500\u001b[0m\u001b[39m with \u001b[0m\u001b[1;36m16\u001b[0m\u001b[39m Axes>,\u001b[0m\n",
       "\u001b[39m    \u001b[0m\u001b[1;35marray\u001b[0m\u001b[1;39m(\u001b[0m\u001b[1;39m[\u001b[0m\u001b[1;39m[\u001b[0m\u001b[39m<GeoAxes: >, <GeoAxes: >, <GeoAxes: >, <GeoAxes: >\u001b[0m\u001b[1;39m]\u001b[0m\u001b[39m,\u001b[0m\n",
       "\u001b[39m       \u001b[0m\u001b[1;39m[\u001b[0m\u001b[39m<GeoAxes: >, <GeoAxes: >, <GeoAxes: >, <GeoAxes: \u001b[0m\u001b[1m>\u001b[0m\u001b[1m]\u001b[0m\u001b[1m]\u001b[0m, \u001b[33mdtype\u001b[0m=\u001b[35mobject\u001b[0m\u001b[1m)\u001b[0m\n",
       "\u001b[1m)\u001b[0m"
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 3836072 characters]",
      "text/plain": [
       "\u001b[1m<\u001b[0m\u001b[1;95mFigure\u001b[0m\u001b[39m size 250\u001b[0m\u001b[1;36m0x1500\u001b[0m\u001b[39m with \u001b[0m\u001b[1;36m16\u001b[0m\u001b[39m Axes\u001b[0m\u001b[1m>\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Default to light theme\n",
    "figcolor = \"#ffffff\"\n",
    "axcolor = \"#ffffff\"\n",
    "oceancolor = \"#e3f2fd\"\n",
    "landcolor = \"#ecf0f1\"\n",
    "gridcolor = \"#666666\"\n",
    "fgcolor = \"#2c3e50\"\n",
    "coastcolor = \"#34495e\"\n",
    "\n",
    "# Create North Polar Stereographic projection matching EPSG:3413\n",
    "# EPSG:3413: WGS 84 / NSIDC Sea Ice Polar Stereographic North\n",
    "data_crs = ccrs.Stereographic(central_latitude=90, central_longitude=-45, true_scale_latitude=70)\n",
    "\n",
    "\n",
    "def plot_density_into_axes(ax, experiment, model, grid_level):\n",
    "    run = (\n",
    "        all_experiments[\n",
    "            (all_experiments[\"experiment\"] == experiment)\n",
    "            & (all_experiments[\"model_type\"] == model)\n",
    "            & (all_experiments[\"grid_level\"] == grid_level)\n",
    "            & (all_experiments[\"task\"] == \"density\")\n",
    "        ]\n",
    "        .iloc[0]\n",
    "        .run\n",
    "    )\n",
    "\n",
    "    preds = run.predictions\n",
    "    vmin = max(1e-6, run.predictions[\"predicted\"].abs().quantile(0.1))\n",
    "    vmax = run.predictions[\"predicted\"].quantile(0.95)\n",
    "    # Clip to smallest number above 0 to avoid issues with logarithmic color scale\n",
    "    preds[\"predicted\"] = preds[\"predicted\"].clip(lower=np.finfo(float).eps)\n",
    "    print(vmin, vmax)\n",
    "\n",
    "    # Add cartographic features to DEM\n",
    "    # ax.add_feature(cfeature.OCEAN, facecolor=oceancolor, zorder=0)\n",
    "    # ax.add_feature(cfeature.LAND, facecolor=landcolor, zorder=1)\n",
    "    ax.stock_img()\n",
    "    ax.add_feature(cfeature.COASTLINE, edgecolor=coastcolor, linewidth=0.8, zorder=4)\n",
    "    ax.add_feature(cfeature.BORDERS, edgecolor=coastcolor, linewidth=0.5, linestyle=\":\", zorder=4)\n",
    "\n",
    "    # Add gridlines\n",
    "    # ax.gridlines(draw_labels=[\"x\", \"y\", \"top\", \"bottom\", \"left\", \"right\", \"geo\"], linewidth=0.5, color=gridcolor, alpha=0.3, linestyle=\"-\", zorder=4)\n",
    "    ax.gridlines(draw_labels=False, linewidth=0.5, color=gridcolor, alpha=0.5, linestyle=\"-\", zorder=4)\n",
    "\n",
    "    # Set map extent\n",
    "    ax.set_extent([-180, 180, 57, 90], crs=ccrs.PlateCarree())\n",
    "\n",
    "    # Compute a circle in axes coordinates, which we can use as a boundary\n",
    "    # for the map. We can pan/zoom as much as we like - the boundary will be\n",
    "    # permanently circular.\n",
    "    theta = np.linspace(0, 2 * np.pi, 100)\n",
    "    center, radius = [0.5, 0.5], 0.5\n",
    "    verts = np.vstack([np.sin(theta), np.cos(theta)]).T\n",
    "    circle = mpath.Path(verts * radius + center)\n",
    "    ax.set_boundary(circle, transform=ax.transAxes)\n",
    "\n",
    "    # Draw a black border around the map for better visibility\n",
    "    ax.add_patch(\n",
    "        plt.Circle((0.5, 0.5), 0.5, transform=ax.transAxes, fill=False, edgecolor=\"black\", linewidth=1.5, zorder=4)\n",
    "    )\n",
    "\n",
    "    # Plot predictions\n",
    "    preds.plot(\n",
    "        column=\"predicted\",\n",
    "        ax=ax,\n",
    "        transform=data_crs,\n",
    "        cmap=\"flare\",\n",
    "        edgecolor=\"none\",\n",
    "        linewidth=0,\n",
    "        alpha=0.7,\n",
    "        # Make the colors logarithmic to better visualize the density distribution\n",
    "        norm=matplotlib.colors.LogNorm(vmin=vmin, vmax=vmax),\n",
    "        legend=True,\n",
    "        # Put the legend (colorbar) to the bottom\n",
    "        legend_kwds={\n",
    "            \"orientation\": \"horizontal\",\n",
    "            \"pad\": 0.05,\n",
    "            \"aspect\": 30,\n",
    "            \"shrink\": 0.8,\n",
    "            \"label\": \"RTS Area-Density\",\n",
    "        },\n",
    "    )\n",
    "\n",
    "    ax.text(\n",
    "        0.98,\n",
    "        0.02,\n",
    "        f\"{experiment}\\n{grid_level}\\n{model}\",\n",
    "        transform=ax.transAxes,\n",
    "        fontsize=16,\n",
    "        weight=\"bold\",\n",
    "        color=fgcolor,\n",
    "        verticalalignment=\"top\",\n",
    "        ha=\"right\",\n",
    "        va=\"bottom\",\n",
    "        zorder=5,\n",
    "        bbox={\n",
    "            \"boxstyle\": \"round,pad=0.5\",\n",
    "            \"facecolor\": \"white\",\n",
    "            \"edgecolor\": gridcolor,\n",
    "            \"alpha\": 1.0,\n",
    "            \"linewidth\": 1.5,\n",
    "        },\n",
    "    )\n",
    "\n",
    "\n",
    "def plot_density_maps(experiment):\n",
    "    models = [\"XGBoost\", \"AutoGluon\"]\n",
    "    grid_levels = [\"H3 Level 3\", \"H3 Level 4\", \"H3 Level 5\", \"H3 Level 6\"]\n",
    "    # grid_levels = [\"H3 Level 3\", \"H3 Level 4\", \"H3 Level 5\"]\n",
    "\n",
    "    fig, axs = plt.subplots(\n",
    "        nrows=len(models),\n",
    "        ncols=len(grid_levels),\n",
    "        figsize=(25, 15),\n",
    "        facecolor=figcolor,\n",
    "        subplot_kw={\"projection\": data_crs},\n",
    "    )\n",
    "    total = len(grid_levels) * len(models)\n",
    "    for i, grid_level in enumerate(grid_levels):\n",
    "        for j, model in enumerate(models):\n",
    "            ax = axs[j, i]\n",
    "            plot_density_into_axes(ax, experiment, model, grid_level)\n",
    "            ij = i * len(models) + j + 1\n",
    "            print(f\"Plotted {experiment} - {model} - {grid_level} ({ij}/{total})\")\n",
    "    fig.tight_layout()\n",
    "    return fig, axs\n",
    "\n",
    "\n",
    "plot_density_maps(\"ERA5 + ArcticDEM\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "09886127",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3.070119419135153e-05</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.00023542443523183465</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m3.070119419135153e-05\u001b[0m \u001b[1;36m0.00023542443523183465\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - XGBoost - H3 Level \u001b[1;36m3\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m1\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8.53530891617993e-06</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.0003571021341485902</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m8.53530891617993e-06\u001b[0m \u001b[1;36m0.0003571021341485902\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - AutoGluon - H3 Level \u001b[1;36m3\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m2\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8.461596735287458e-06</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.00022250271285884082</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m8.461596735287458e-06\u001b[0m \u001b[1;36m0.00022250271285884082\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - XGBoost - H3 Level \u001b[1;36m4\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m3\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8.884212184057105e-06</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.00015265715264831662</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m8.884212184057105e-06\u001b[0m \u001b[1;36m0.00015265715264831662\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - AutoGluon - H3 Level \u001b[1;36m4\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m4\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3.045795892830938e-06</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.0006737609975971273</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m3.045795892830938e-06\u001b[0m \u001b[1;36m0.0006737609975971273\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - XGBoost - H3 Level \u001b[1;36m5\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m5\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4.919203001918504e-06</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.0002873361605452374</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m4.919203001918504e-06\u001b[0m \u001b[1;36m0.0002873361605452374\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - AutoGluon - H3 Level \u001b[1;36m5\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m6\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1e-06</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.0007228013855637979</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m1e-06\u001b[0m \u001b[1;36m0.0007228013855637979\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - XGBoost - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">7</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - XGBoost - H3 Level \u001b[1;36m6\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m7\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1.750091144003818e-06</span> <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.0025025433860719187</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;36m1.750091144003818e-06\u001b[0m \u001b[1;36m0.0025025433860719187\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Plotted AlphaEarth - AutoGluon - H3 Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span> <span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>/<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Plotted AlphaEarth - AutoGluon - H3 Level \u001b[1;36m6\u001b[0m \u001b[1m(\u001b[0m\u001b[1;36m8\u001b[0m/\u001b[1;36m8\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "\n",
       "\u001b[1m(\u001b[0m\n",
       "    \u001b[1m<\u001b[0m\u001b[1;95mFigure\u001b[0m\u001b[39m size 250\u001b[0m\u001b[1;36m0x1500\u001b[0m\u001b[39m with \u001b[0m\u001b[1;36m16\u001b[0m\u001b[39m Axes>,\u001b[0m\n",
       "\u001b[39m    \u001b[0m\u001b[1;35marray\u001b[0m\u001b[1;39m(\u001b[0m\u001b[1;39m[\u001b[0m\u001b[1;39m[\u001b[0m\u001b[39m<GeoAxes: >, <GeoAxes: >, <GeoAxes: >, <GeoAxes: >\u001b[0m\u001b[1;39m]\u001b[0m\u001b[39m,\u001b[0m\n",
       "\u001b[39m       \u001b[0m\u001b[1;39m[\u001b[0m\u001b[39m<GeoAxes: >, <GeoAxes: >, <GeoAxes: >, <GeoAxes: \u001b[0m\u001b[1m>\u001b[0m\u001b[1m]\u001b[0m\u001b[1m]\u001b[0m, \u001b[33mdtype\u001b[0m=\u001b[35mobject\u001b[0m\u001b[1m)\u001b[0m\n",
       "\u001b[1m)\u001b[0m"
      ]
     },
     "execution_count": 87,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 4122480 characters]",
      "text/plain": [
       "\u001b[1m<\u001b[0m\u001b[1;95mFigure\u001b[0m\u001b[39m size 250\u001b[0m\u001b[1;36m0x1500\u001b[0m\u001b[39m with \u001b[0m\u001b[1;36m16\u001b[0m\u001b[39m Axes\u001b[0m\u001b[1m>\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_density_maps(\"AlphaEarth\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "442d7da6",
   "metadata": {},
   "source": [
    "## Area Maps"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6df0b06c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "\u001b[1m(\u001b[0m\u001b[1m<\u001b[0m\u001b[1;95mFigure\u001b[0m\u001b[39m size 150\u001b[0m\u001b[1;36m0x700\u001b[0m\u001b[39m with \u001b[0m\u001b[1;36m3\u001b[0m\u001b[39m Axes>, \u001b[0m\u001b[1;35marray\u001b[0m\u001b[1;39m(\u001b[0m\u001b[1;39m[\u001b[0m\u001b[39m<GeoAxes: >, <GeoAxes: \u001b[0m\u001b[1m>\u001b[0m\u001b[1m]\u001b[0m, \u001b[33mdtype\u001b[0m=\u001b[35mobject\u001b[0m\u001b[1m)\u001b[0m\u001b[1m)\u001b[0m"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 778400 characters]",
      "text/plain": [
       "\u001b[1m<\u001b[0m\u001b[1;95mFigure\u001b[0m\u001b[39m size 150\u001b[0m\u001b[1;36m0x700\u001b[0m\u001b[39m with \u001b[0m\u001b[1;36m3\u001b[0m\u001b[39m Axes\u001b[0m\u001b[1m>\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Default to light theme\n",
    "figcolor = \"#ffffff\"\n",
    "axcolor = \"#ffffff\"\n",
    "oceancolor = \"#e3f2fd\"\n",
    "landcolor = \"#ecf0f1\"\n",
    "gridcolor = \"#666666\"\n",
    "fgcolor = \"#2c3e50\"\n",
    "coastcolor = \"#34495e\"\n",
    "\n",
    "# Create North Polar Stereographic projection matching EPSG:3413\n",
    "# EPSG:3413: WGS 84 / NSIDC Sea Ice Polar Stereographic North\n",
    "data_crs = ccrs.Stereographic(central_latitude=90, central_longitude=-45, true_scale_latitude=70)\n",
    "\n",
    "\n",
    "def plot_area_to_axes(ax, grid_config, cax=None):\n",
    "    grid_gdf = grids.open(grid_config.grid, grid_config.level)\n",
    "\n",
    "    # Calculate the relative difference in cell area compared to the mean\n",
    "    grid_gdf[\"cell_area_var\"] = grid_gdf[\"cell_area\"] / grid_gdf[\"cell_area\"].mean()\n",
    "\n",
    "    # Add cartographic features to DEM\n",
    "    # ax.add_feature(cfeature.OCEAN, facecolor=\"#f3f3f3\", zorder=0)\n",
    "    # ax.add_feature(cfeature.LAND, facecolor=\"#f3f3f3\", zorder=1)\n",
    "    ax.stock_img()\n",
    "    ax.add_feature(cfeature.COASTLINE, edgecolor=coastcolor, linewidth=0.8, zorder=4)\n",
    "    ax.add_feature(cfeature.BORDERS, edgecolor=coastcolor, linewidth=0.5, linestyle=\":\", zorder=4)\n",
    "\n",
    "    # Add gridlines\n",
    "    ax.gridlines(draw_labels=False, linewidth=0.5, color=gridcolor, alpha=0.5, linestyle=\"-\", zorder=4)\n",
    "\n",
    "    # Set map extent\n",
    "    ax.set_extent([-180, 180, 57, 90], crs=ccrs.PlateCarree())\n",
    "\n",
    "    # Compute a circle in axes coordinates, which we can use as a boundary\n",
    "    # for the map. We can pan/zoom as much as we like - the boundary will be\n",
    "    # permanently circular.\n",
    "    theta = np.linspace(0, 2 * np.pi, 100)\n",
    "    center, radius = [0.5, 0.5], 0.5\n",
    "    verts = np.vstack([np.sin(theta), np.cos(theta)]).T\n",
    "    circle = mpath.Path(verts * radius + center)\n",
    "    ax.set_boundary(circle, transform=ax.transAxes)\n",
    "\n",
    "    # Draw a black border around the map for better visibility\n",
    "    ax.add_patch(\n",
    "        plt.Circle((0.5, 0.5), 0.5, transform=ax.transAxes, fill=False, edgecolor=\"black\", linewidth=1.5, zorder=4)\n",
    "    )\n",
    "\n",
    "    # Plot predictions\n",
    "    grid_gdf.plot(\n",
    "        column=\"cell_area_var\",\n",
    "        ax=ax,\n",
    "        cax=cax if cax is not False else None,\n",
    "        transform=data_crs,\n",
    "        # cmap=\"vlag\",\n",
    "        # cmap=sns.diverging_palette(145, 300, s=60, as_cmap=True),\n",
    "        cmap=sns.color_palette(\"icefire\", as_cmap=True),\n",
    "        vmin=0.7,\n",
    "        vmax=1.3,\n",
    "        edgecolor=\"none\",\n",
    "        linewidth=0,\n",
    "        alpha=0.8,\n",
    "        legend=cax is not False,\n",
    "        # Put the legend (colorbar) to the bottom\n",
    "        legend_kwds={\n",
    "            \"orientation\": \"horizontal\",\n",
    "            \"pad\": 0.05,\n",
    "            \"aspect\": 30,\n",
    "            \"shrink\": 0.8,\n",
    "            \"label\": \"Cell Area Variance (relative to mean)\",\n",
    "        },\n",
    "    )\n",
    "    grid_level = f\"{grid_config.grid.replace('hex', 'H3').replace('healpix', 'HEAPix')} Level {grid_config.level}\"\n",
    "    ax.text(\n",
    "        0.98,\n",
    "        0.02,\n",
    "        grid_level,\n",
    "        transform=ax.transAxes,\n",
    "        fontsize=16,\n",
    "        weight=\"bold\",\n",
    "        color=fgcolor,\n",
    "        verticalalignment=\"top\",\n",
    "        ha=\"right\",\n",
    "        va=\"bottom\",\n",
    "        zorder=5,\n",
    "        bbox={\n",
    "            \"boxstyle\": \"round,pad=0.5\",\n",
    "            \"facecolor\": \"white\",\n",
    "            \"edgecolor\": gridcolor,\n",
    "            \"alpha\": 1.0,\n",
    "            \"linewidth\": 1.5,\n",
    "        },\n",
    "    )\n",
    "\n",
    "\n",
    "def plot_area_maps():\n",
    "    hex_grid_configs = [gc for gc in grid_configs if gc.grid.startswith(\"hex\")]\n",
    "    healpix_grid_configs = [gc for gc in grid_configs if gc.grid.startswith(\"healpix\")]\n",
    "    # Insert None at the third element for hex, as healpix has two respective levels\n",
    "    hex_grid_configs.insert(2, None)\n",
    "\n",
    "    fig, axs = plt.subplots(\n",
    "        nrows=2,\n",
    "        ncols=5,\n",
    "        figsize=(30, 15),\n",
    "        facecolor=figcolor,\n",
    "        subplot_kw={\"projection\": data_crs},\n",
    "    )\n",
    "    total = 9\n",
    "    for i, grid_config in enumerate(hex_grid_configs):\n",
    "        if grid_config is None:\n",
    "            continue\n",
    "        ax = axs[0, i]\n",
    "        plot_area_to_axes(ax, grid_config)\n",
    "        ij = i + 1\n",
    "        print(f\"Plotted {grid_config.grid} Level {grid_config.level} ({ij}/{total})\")\n",
    "\n",
    "    for i, grid_config in enumerate(healpix_grid_configs):\n",
    "        ax = axs[1, i]\n",
    "        plot_area_to_axes(ax, grid_config)\n",
    "        ij = i + 1 + len(hex_grid_configs)\n",
    "        print(f\"Plotted {grid_config.grid} Level {grid_config.level} ({ij}/{total})\")\n",
    "\n",
    "    fig.tight_layout()\n",
    "    return fig, axs\n",
    "\n",
    "\n",
    "def plot_area_maps_single():\n",
    "    fig, axs = plt.subplots(\n",
    "        nrows=1,\n",
    "        ncols=2,\n",
    "        figsize=(15, 7),\n",
    "        facecolor=figcolor,\n",
    "        subplot_kw={\"projection\": data_crs},\n",
    "    )\n",
    "\n",
    "    # Create a colorbar axis that spans the entire width of the figure below the two maps\n",
    "    cax = fig.add_axes([0.25, 0.05, 0.52, 0.02])  # [left, bottom, width, height]\n",
    "\n",
    "    hex_grid_config = GridConfig.from_grid_level(\"hex3\")\n",
    "    healpix_grid_config = GridConfig.from_grid_level(\"healpix6\")\n",
    "    plot_area_to_axes(axs[0], hex_grid_config, cax=cax)\n",
    "    plot_area_to_axes(axs[1], healpix_grid_config, cax=False)\n",
    "\n",
    "    return fig, axs\n",
    "\n",
    "\n",
    "plot_area_maps_single()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e5818e85",
   "metadata": {},
   "source": [
    "## Cell sizes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0cd05e01",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">hex Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span>:\n",
       "  Mean Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12511.98</span> km²\n",
       "  Min Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6315.47</span> km²\n",
       "  Max Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">14950.77</span> km²\n",
       "  Cell Area Std Dev: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1522.56</span> km²\n",
       "  Cell Area Coefficient of Variation: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.12</span>\n",
       "  Cell Count: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2760</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "hex Level \u001b[1;36m3\u001b[0m:\n",
       "  Mean Cell Area: \u001b[1;36m12511.98\u001b[0m km²\n",
       "  Min Cell Area: \u001b[1;36m6315.47\u001b[0m km²\n",
       "  Max Cell Area: \u001b[1;36m14950.77\u001b[0m km²\n",
       "  Cell Area Std Dev: \u001b[1;36m1522.56\u001b[0m km²\n",
       "  Cell Area Coefficient of Variation: \u001b[1;36m0.12\u001b[0m\n",
       "  Cell Count: \u001b[1;36m2760\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">hex Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span>:\n",
       "  Mean Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1788.84</span> km²\n",
       "  Min Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1084.01</span> km²\n",
       "  Max Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2135.99</span> km²\n",
       "  Cell Area Std Dev: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">215.01</span> km²\n",
       "  Cell Area Coefficient of Variation: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.12</span>\n",
       "  Cell Count: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">18699</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "hex Level \u001b[1;36m4\u001b[0m:\n",
       "  Mean Cell Area: \u001b[1;36m1788.84\u001b[0m km²\n",
       "  Min Cell Area: \u001b[1;36m1084.01\u001b[0m km²\n",
       "  Max Cell Area: \u001b[1;36m2135.99\u001b[0m km²\n",
       "  Cell Area Std Dev: \u001b[1;36m215.01\u001b[0m km²\n",
       "  Cell Area Coefficient of Variation: \u001b[1;36m0.12\u001b[0m\n",
       "  Cell Count: \u001b[1;36m18699\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">hex Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span>:\n",
       "  Mean Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">255.54</span> km²\n",
       "  Min Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">154.24</span> km²\n",
       "  Max Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">305.14</span> km²\n",
       "  Cell Area Std Dev: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">30.64</span> km²\n",
       "  Cell Area Coefficient of Variation: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.12</span>\n",
       "  Cell Count: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">128174</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "hex Level \u001b[1;36m5\u001b[0m:\n",
       "  Mean Cell Area: \u001b[1;36m255.54\u001b[0m km²\n",
       "  Min Cell Area: \u001b[1;36m154.24\u001b[0m km²\n",
       "  Max Cell Area: \u001b[1;36m305.14\u001b[0m km²\n",
       "  Cell Area Std Dev: \u001b[1;36m30.64\u001b[0m km²\n",
       "  Cell Area Coefficient of Variation: \u001b[1;36m0.12\u001b[0m\n",
       "  Cell Count: \u001b[1;36m128174\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">hex Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span>:\n",
       "  Mean Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">36.52</span> km²\n",
       "  Min Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">22.02</span> km²\n",
       "  Max Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">43.59</span> km²\n",
       "  Cell Area Std Dev: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4.37</span> km²\n",
       "  Cell Area Coefficient of Variation: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.12</span>\n",
       "  Cell Count: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">885181</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "hex Level \u001b[1;36m6\u001b[0m:\n",
       "  Mean Cell Area: \u001b[1;36m36.52\u001b[0m km²\n",
       "  Min Cell Area: \u001b[1;36m22.02\u001b[0m km²\n",
       "  Max Cell Area: \u001b[1;36m43.59\u001b[0m km²\n",
       "  Cell Area Std Dev: \u001b[1;36m4.37\u001b[0m km²\n",
       "  Cell Area Coefficient of Variation: \u001b[1;36m0.12\u001b[0m\n",
       "  Cell Count: \u001b[1;36m885181\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">healpix Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span>:\n",
       "  Mean Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">11158.51</span> km²\n",
       "  Min Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">9900.06</span> km²\n",
       "  Max Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12366.33</span> km²\n",
       "  Cell Area Std Dev: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">666.84</span> km²\n",
       "  Cell Area Coefficient of Variation: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.06</span>\n",
       "  Cell Count: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3328</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "healpix Level \u001b[1;36m6\u001b[0m:\n",
       "  Mean Cell Area: \u001b[1;36m11158.51\u001b[0m km²\n",
       "  Min Cell Area: \u001b[1;36m9900.06\u001b[0m km²\n",
       "  Max Cell Area: \u001b[1;36m12366.33\u001b[0m km²\n",
       "  Cell Area Std Dev: \u001b[1;36m666.84\u001b[0m km²\n",
       "  Cell Area Coefficient of Variation: \u001b[1;36m0.06\u001b[0m\n",
       "  Cell Count: \u001b[1;36m3328\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">healpix Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">7</span>:\n",
       "  Mean Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2802.83</span> km²\n",
       "  Min Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2475.66</span> km²\n",
       "  Max Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3120.65</span> km²\n",
       "  Cell Area Std Dev: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">172.61</span> km²\n",
       "  Cell Area Coefficient of Variation: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.06</span>\n",
       "  Cell Count: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13105</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "healpix Level \u001b[1;36m7\u001b[0m:\n",
       "  Mean Cell Area: \u001b[1;36m2802.83\u001b[0m km²\n",
       "  Min Cell Area: \u001b[1;36m2475.66\u001b[0m km²\n",
       "  Max Cell Area: \u001b[1;36m3120.65\u001b[0m km²\n",
       "  Cell Area Std Dev: \u001b[1;36m172.61\u001b[0m km²\n",
       "  Cell Area Coefficient of Variation: \u001b[1;36m0.06\u001b[0m\n",
       "  Cell Count: \u001b[1;36m13105\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">healpix Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>:\n",
       "  Mean Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">701.80</span> km²\n",
       "  Min Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">619.26</span> km²\n",
       "  Max Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">782.02</span> km²\n",
       "  Cell Area Std Dev: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">43.27</span> km²\n",
       "  Cell Area Coefficient of Variation: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.06</span>\n",
       "  Cell Count: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">51211</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "healpix Level \u001b[1;36m8\u001b[0m:\n",
       "  Mean Cell Area: \u001b[1;36m701.80\u001b[0m km²\n",
       "  Min Cell Area: \u001b[1;36m619.26\u001b[0m km²\n",
       "  Max Cell Area: \u001b[1;36m782.02\u001b[0m km²\n",
       "  Cell Area Std Dev: \u001b[1;36m43.27\u001b[0m km²\n",
       "  Cell Area Coefficient of Variation: \u001b[1;36m0.06\u001b[0m\n",
       "  Cell Count: \u001b[1;36m51211\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">healpix Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">9</span>:\n",
       "  Mean Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">175.60</span> km²\n",
       "  Min Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">154.80</span> km²\n",
       "  Max Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">195.74</span> km²\n",
       "  Cell Area Std Dev: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">10.81</span> km²\n",
       "  Cell Area Coefficient of Variation: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.06</span>\n",
       "  Cell Count: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">201487</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "healpix Level \u001b[1;36m9\u001b[0m:\n",
       "  Mean Cell Area: \u001b[1;36m175.60\u001b[0m km²\n",
       "  Min Cell Area: \u001b[1;36m154.80\u001b[0m km²\n",
       "  Max Cell Area: \u001b[1;36m195.74\u001b[0m km²\n",
       "  Cell Area Std Dev: \u001b[1;36m10.81\u001b[0m km²\n",
       "  Cell Area Coefficient of Variation: \u001b[1;36m0.06\u001b[0m\n",
       "  Cell Count: \u001b[1;36m201487\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">healpix Level <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">10</span>:\n",
       "  Mean Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">43.94</span> km²\n",
       "  Min Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">38.70</span> km²\n",
       "  Max Cell Area: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">48.99</span> km²\n",
       "  Cell Area Std Dev: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2.71</span> km²\n",
       "  Cell Area Coefficient of Variation: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">0.06</span>\n",
       "  Cell Count: <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">799113</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "healpix Level \u001b[1;36m10\u001b[0m:\n",
       "  Mean Cell Area: \u001b[1;36m43.94\u001b[0m km²\n",
       "  Min Cell Area: \u001b[1;36m38.70\u001b[0m km²\n",
       "  Max Cell Area: \u001b[1;36m48.99\u001b[0m km²\n",
       "  Cell Area Std Dev: \u001b[1;36m2.71\u001b[0m km²\n",
       "  Cell Area Coefficient of Variation: \u001b[1;36m0.06\u001b[0m\n",
       "  Cell Count: \u001b[1;36m799113\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">[</span>H3<span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span> <span style=\"font-weight: bold\">(</span>low<span style=\"font-weight: bold\">)]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2760</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">12512.0</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1522.6</span><span style=\"font-weight: bold\">]</span>,\n",
       "<span style=\"font-weight: bold\">[</span>H3<span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span> <span style=\"font-weight: bold\">(</span>low<span style=\"font-weight: bold\">)]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">18699</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1788.8</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">215.0</span><span style=\"font-weight: bold\">]</span>,\n",
       "<span style=\"font-weight: bold\">[</span>H3<span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span> <span style=\"font-weight: bold\">(</span>medium<span style=\"font-weight: bold\">)]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">128174</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">255.5</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">30.6</span><span style=\"font-weight: bold\">]</span>,\n",
       "<span style=\"font-weight: bold\">[</span>H3<span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span> <span style=\"font-weight: bold\">(</span>high<span style=\"font-weight: bold\">)]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">885181</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">36.5</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4.4</span><span style=\"font-weight: bold\">]</span>,\n",
       "<span style=\"font-weight: bold\">[</span>HEALPix<span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">6</span> <span style=\"font-weight: bold\">(</span>low<span style=\"font-weight: bold\">)]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3328</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">11158.5</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">666.8</span><span style=\"font-weight: bold\">]</span>,\n",
       "<span style=\"font-weight: bold\">[</span>HEALPix<span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">7</span> <span style=\"font-weight: bold\">(</span>low<span style=\"font-weight: bold\">)]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13105</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2802.8</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">172.6</span><span style=\"font-weight: bold\">]</span>,\n",
       "<span style=\"font-weight: bold\">[</span>HEALPix<span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span> <span style=\"font-weight: bold\">(</span>medium<span style=\"font-weight: bold\">)]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">51211</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">701.8</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">43.3</span><span style=\"font-weight: bold\">]</span>,\n",
       "<span style=\"font-weight: bold\">[</span>HEALPix<span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">9</span> <span style=\"font-weight: bold\">(</span>medium<span style=\"font-weight: bold\">)]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">201487</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">175.6</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">10.8</span><span style=\"font-weight: bold\">]</span>,\n",
       "<span style=\"font-weight: bold\">[</span>HEALPix<span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">10</span> <span style=\"font-weight: bold\">(</span>high<span style=\"font-weight: bold\">)]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">799113</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">43.9</span><span style=\"font-weight: bold\">]</span>, <span style=\"font-weight: bold\">[</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2.7</span><span style=\"font-weight: bold\">]</span>,\n",
       "\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1m[\u001b[0mH3\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m3\u001b[0m \u001b[1m(\u001b[0mlow\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m2760\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m12512.0\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m1522.6\u001b[0m\u001b[1m]\u001b[0m,\n",
       "\u001b[1m[\u001b[0mH3\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m4\u001b[0m \u001b[1m(\u001b[0mlow\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m18699\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m1788.8\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m215.0\u001b[0m\u001b[1m]\u001b[0m,\n",
       "\u001b[1m[\u001b[0mH3\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m5\u001b[0m \u001b[1m(\u001b[0mmedium\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m128174\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m255.5\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m30.6\u001b[0m\u001b[1m]\u001b[0m,\n",
       "\u001b[1m[\u001b[0mH3\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m6\u001b[0m \u001b[1m(\u001b[0mhigh\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m885181\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m36.5\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m4.4\u001b[0m\u001b[1m]\u001b[0m,\n",
       "\u001b[1m[\u001b[0mHEALPix\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m6\u001b[0m \u001b[1m(\u001b[0mlow\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m3328\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m11158.5\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m666.8\u001b[0m\u001b[1m]\u001b[0m,\n",
       "\u001b[1m[\u001b[0mHEALPix\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m7\u001b[0m \u001b[1m(\u001b[0mlow\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m13105\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m2802.8\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m172.6\u001b[0m\u001b[1m]\u001b[0m,\n",
       "\u001b[1m[\u001b[0mHEALPix\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m8\u001b[0m \u001b[1m(\u001b[0mmedium\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m51211\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m701.8\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m43.3\u001b[0m\u001b[1m]\u001b[0m,\n",
       "\u001b[1m[\u001b[0mHEALPix\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m9\u001b[0m \u001b[1m(\u001b[0mmedium\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m201487\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m175.6\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m10.8\u001b[0m\u001b[1m]\u001b[0m,\n",
       "\u001b[1m[\u001b[0mHEALPix\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m10\u001b[0m \u001b[1m(\u001b[0mhigh\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m799113\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m43.9\u001b[0m\u001b[1m]\u001b[0m, \u001b[1m[\u001b[0m\u001b[1;36m2.7\u001b[0m\u001b[1m]\u001b[0m,\n",
       "\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "typst_table = \"\"\n",
    "\n",
    "\n",
    "def print_grid_cell_area_stats(grid_config, typst_table):\n",
    "    grid_gdf = grids.open(grid_config.grid, grid_config.level)\n",
    "    grid_summary = f\"{grid_config.grid} Level {grid_config.level}:\"\n",
    "    grid_summary += f\"\\n  Mean Cell Area: {grid_gdf['cell_area'].mean():.2f} km²\"\n",
    "    grid_summary += f\"\\n  Min Cell Area: {grid_gdf['cell_area'].min():.2f} km²\"\n",
    "    grid_summary += f\"\\n  Max Cell Area: {grid_gdf['cell_area'].max():.2f} km²\"\n",
    "    grid_summary += f\"\\n  Cell Area Std Dev: {grid_gdf['cell_area'].std():.2f} km²\"\n",
    "    grid_summary += (\n",
    "        f\"\\n  Cell Area Coefficient of Variation: {grid_gdf['cell_area'].std() / grid_gdf['cell_area'].mean():.2f}\"\n",
    "    )\n",
    "    grid_summary += f\"\\n  Cell Count: {len(grid_gdf)}\"\n",
    "    print(grid_summary)\n",
    "\n",
    "    if grid_config.grid == \"hex\":\n",
    "        typst_table += \"[H3], \"\n",
    "    else:\n",
    "        typst_table += \"[HEALPix], \"\n",
    "\n",
    "    resmap = {\n",
    "        \"hex3\": \"low\",\n",
    "        \"hex4\": \"low\",\n",
    "        \"hex5\": \"medium\",\n",
    "        \"hex6\": \"high\",\n",
    "        \"healpix6\": \"low\",\n",
    "        \"healpix7\": \"low\",\n",
    "        \"healpix8\": \"medium\",\n",
    "        \"healpix9\": \"medium\",\n",
    "        \"healpix10\": \"high\",\n",
    "    }\n",
    "    res = resmap[f\"{grid_config.grid}{grid_config.level}\"]\n",
    "    typst_table += f\"[{grid_config.level} ({res})], [{len(grid_gdf)}], [{grid_gdf['cell_area'].mean():.1f}], [{grid_gdf['cell_area'].std():.1f}],\\n\"\n",
    "    return typst_table\n",
    "\n",
    "\n",
    "for grid_config in grid_configs:\n",
    "    typst_table = print_grid_cell_area_stats(grid_config, typst_table)\n",
    "print(typst_table)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fa04fb4e",
   "metadata": {},
   "source": [
    "## AlphaEarth"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1cb1089d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cell_id</th>\n",
       "      <th>cell_area</th>\n",
       "      <th>geometry</th>\n",
       "      <th>water_area</th>\n",
       "      <th>land_area</th>\n",
       "      <th>land_ratio</th>\n",
       "      <th>lon</th>\n",
       "      <th>lat</th>\n",
       "      <th>x</th>\n",
       "      <th>y</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>830018fffffffff</td>\n",
       "      <td>12833.417730</td>\n",
       "      <td>POLYGON ((1038231.032 93001.954, 1007144.142 1...</td>\n",
       "      <td>10600.837914</td>\n",
       "      <td>2232.579815</td>\n",
       "      <td>0.173966</td>\n",
       "      <td>50.507564</td>\n",
       "      <td>81.030544</td>\n",
       "      <td>9.690891e+05</td>\n",
       "      <td>9.355845e+04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>83001afffffffff</td>\n",
       "      <td>13005.383987</td>\n",
       "      <td>POLYGON ((1045152.586 212150.003, 1013846.955 ...</td>\n",
       "      <td>7494.831943</td>\n",
       "      <td>5510.552043</td>\n",
       "      <td>0.423713</td>\n",
       "      <td>57.302441</td>\n",
       "      <td>80.800738</td>\n",
       "      <td>9.756955e+05</td>\n",
       "      <td>2.128796e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>83001cfffffffff</td>\n",
       "      <td>12607.559405</td>\n",
       "      <td>POLYGON ((1137527.559 33377.972, 1106995.284 9...</td>\n",
       "      <td>10141.598070</td>\n",
       "      <td>2465.961335</td>\n",
       "      <td>0.195594</td>\n",
       "      <td>46.807233</td>\n",
       "      <td>80.150965</td>\n",
       "      <td>1.068950e+06</td>\n",
       "      <td>3.385010e+04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>83001efffffffff</td>\n",
       "      <td>12781.831078</td>\n",
       "      <td>POLYGON ((1144981.442 151688.88, 1114226.065 2...</td>\n",
       "      <td>11075.372042</td>\n",
       "      <td>1706.459036</td>\n",
       "      <td>0.133507</td>\n",
       "      <td>53.052142</td>\n",
       "      <td>79.992189</td>\n",
       "      <td>1.076090e+06</td>\n",
       "      <td>1.523424e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>830028fffffffff</td>\n",
       "      <td>11818.417986</td>\n",
       "      <td>POLYGON ((1106470.805 -427995.192, 1076828.817...</td>\n",
       "      <td>2728.182359</td>\n",
       "      <td>9090.235627</td>\n",
       "      <td>0.769158</td>\n",
       "      <td>22.599271</td>\n",
       "      <td>79.651035</td>\n",
       "      <td>1.039234e+06</td>\n",
       "      <td>-4.282015e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6744</th>\n",
       "      <td>8327b5fffffffff</td>\n",
       "      <td>12479.437618</td>\n",
       "      <td>POLYGON ((-3904533.281 -1950151.978, -3978391....</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>12479.437618</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>-107.935560</td>\n",
       "      <td>50.655027</td>\n",
       "      <td>-3.945988e+06</td>\n",
       "      <td>-2.016222e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6745</th>\n",
       "      <td>8327b6fffffffff</td>\n",
       "      <td>12148.179896</td>\n",
       "      <td>POLYGON ((-3999658.053 -1746829.203, -4072462....</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>12148.179896</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>-110.851573</td>\n",
       "      <td>50.673240</td>\n",
       "      <td>-4.041424e+06</td>\n",
       "      <td>-1.811968e+06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6917</th>\n",
       "      <td>8328dbfffffffff</td>\n",
       "      <td>10331.135948</td>\n",
       "      <td>POLYGON ((-4304632.552 -720269.778, -4372252.4...</td>\n",
       "      <td>913.035656</td>\n",
       "      <td>9418.100291</td>\n",
       "      <td>0.911623</td>\n",
       "      <td>-124.832764</td>\n",
       "      <td>50.773308</td>\n",
       "      <td>-4.347485e+06</td>\n",
       "      <td>-7.797406e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7713</th>\n",
       "      <td>832d69fffffffff</td>\n",
       "      <td>12395.223580</td>\n",
       "      <td>POLYGON ((4432070.553 -304743.386, 4485745.557...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>12395.223580</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>41.960963</td>\n",
       "      <td>50.779041</td>\n",
       "      <td>4.409985e+06</td>\n",
       "      <td>-2.341336e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7717</th>\n",
       "      <td>832d6dfffffffff</td>\n",
       "      <td>12148.179896</td>\n",
       "      <td>POLYGON ((4400410.65 -426345.057, 4453901.584 ...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>12148.179896</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>40.344328</td>\n",
       "      <td>50.967269</td>\n",
       "      <td>4.378831e+06</td>\n",
       "      <td>-3.565970e+05</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2760 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "\n",
       "              cell_id     cell_area  \\\n",
       "\u001b[1;36m21\u001b[0m    830018fffffffff  \u001b[1;36m12833.417730\u001b[0m   \n",
       "\u001b[1;36m23\u001b[0m    83001afffffffff  \u001b[1;36m13005.383987\u001b[0m   \n",
       "\u001b[1;36m25\u001b[0m    83001cfffffffff  \u001b[1;36m12607.559405\u001b[0m   \n",
       "\u001b[1;36m27\u001b[0m    83001efffffffff  \u001b[1;36m12781.831078\u001b[0m   \n",
       "\u001b[1;36m35\u001b[0m    830028fffffffff  \u001b[1;36m11818.417986\u001b[0m   \n",
       "\u001b[33m...\u001b[0m               \u001b[33m...\u001b[0m           \u001b[33m...\u001b[0m   \n",
       "\u001b[1;36m6744\u001b[0m  8327b5fffffffff  \u001b[1;36m12479.437618\u001b[0m   \n",
       "\u001b[1;36m6745\u001b[0m  8327b6fffffffff  \u001b[1;36m12148.179896\u001b[0m   \n",
       "\u001b[1;36m6917\u001b[0m  8328dbfffffffff  \u001b[1;36m10331.135948\u001b[0m   \n",
       "\u001b[1;36m7713\u001b[0m  832d69fffffffff  \u001b[1;36m12395.223580\u001b[0m   \n",
       "\u001b[1;36m7717\u001b[0m  832d6dfffffffff  \u001b[1;36m12148.179896\u001b[0m   \n",
       "\n",
       "                                               geometry    water_area  \\\n",
       "\u001b[1;36m21\u001b[0m    POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m1038231.032\u001b[0m \u001b[1;36m93001.954\u001b[0m, \u001b[1;36m1007144.142\u001b[0m \u001b[1;36m1\u001b[0m\u001b[33m...\u001b[0m  \u001b[1;36m10600.837914\u001b[0m   \n",
       "\u001b[1;36m23\u001b[0m    POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m1045152.586\u001b[0m \u001b[1;36m212150.003\u001b[0m, \u001b[1;36m1013846.955\u001b[0m \u001b[33m...\u001b[0m   \u001b[1;36m7494.831943\u001b[0m   \n",
       "\u001b[1;36m25\u001b[0m    POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m1137527.559\u001b[0m \u001b[1;36m33377.972\u001b[0m, \u001b[1;36m1106995.284\u001b[0m \u001b[1;36m9\u001b[0m\u001b[33m...\u001b[0m  \u001b[1;36m10141.598070\u001b[0m   \n",
       "\u001b[1;36m27\u001b[0m    POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m1144981.442\u001b[0m \u001b[1;36m151688.88\u001b[0m, \u001b[1;36m1114226.065\u001b[0m \u001b[1;36m2\u001b[0m\u001b[33m...\u001b[0m  \u001b[1;36m11075.372042\u001b[0m   \n",
       "\u001b[1;36m35\u001b[0m    POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m1106470.805\u001b[0m \u001b[1;36m-427995.192\u001b[0m, \u001b[1;36m1076828.817\u001b[0m\u001b[33m...\u001b[0m   \u001b[1;36m2728.182359\u001b[0m   \n",
       "\u001b[33m...\u001b[0m                                                 \u001b[33m...\u001b[0m           \u001b[33m...\u001b[0m   \n",
       "\u001b[1;36m6744\u001b[0m  POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m-3904533.281\u001b[0m \u001b[1;36m-1950151.978\u001b[0m, \u001b[1;36m-3978391\u001b[0m\u001b[33m...\u001b[0m.      \u001b[1;36m0.000000\u001b[0m   \n",
       "\u001b[1;36m6745\u001b[0m  POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m-3999658.053\u001b[0m \u001b[1;36m-1746829.203\u001b[0m, \u001b[1;36m-4072462\u001b[0m\u001b[33m...\u001b[0m.      \u001b[1;36m0.000000\u001b[0m   \n",
       "\u001b[1;36m6917\u001b[0m  POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m-4304632.552\u001b[0m \u001b[1;36m-720269.778\u001b[0m, \u001b[1;36m-4372252.4\u001b[0m\u001b[33m...\u001b[0m    \u001b[1;36m913.035656\u001b[0m   \n",
       "\u001b[1;36m7713\u001b[0m  POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m4432070.553\u001b[0m \u001b[1;36m-304743.386\u001b[0m, \u001b[1;36m4485745.557\u001b[0m\u001b[33m...\u001b[0m      \u001b[1;36m0.000000\u001b[0m   \n",
       "\u001b[1;36m7717\u001b[0m  POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m4400410.65\u001b[0m \u001b[1;36m-426345.057\u001b[0m, \u001b[1;36m4453901.584\u001b[0m \u001b[33m...\u001b[0m      \u001b[1;36m0.000000\u001b[0m   \n",
       "\n",
       "         land_area  land_ratio         lon        lat             x  \\\n",
       "\u001b[1;36m21\u001b[0m     \u001b[1;36m2232.579815\u001b[0m    \u001b[1;36m0.173966\u001b[0m   \u001b[1;36m50.507564\u001b[0m  \u001b[1;36m81.030544\u001b[0m  \u001b[1;36m9.690891e+05\u001b[0m   \n",
       "\u001b[1;36m23\u001b[0m     \u001b[1;36m5510.552043\u001b[0m    \u001b[1;36m0.423713\u001b[0m   \u001b[1;36m57.302441\u001b[0m  \u001b[1;36m80.800738\u001b[0m  \u001b[1;36m9.756955e+05\u001b[0m   \n",
       "\u001b[1;36m25\u001b[0m     \u001b[1;36m2465.961335\u001b[0m    \u001b[1;36m0.195594\u001b[0m   \u001b[1;36m46.807233\u001b[0m  \u001b[1;36m80.150965\u001b[0m  \u001b[1;36m1.068950e+06\u001b[0m   \n",
       "\u001b[1;36m27\u001b[0m     \u001b[1;36m1706.459036\u001b[0m    \u001b[1;36m0.133507\u001b[0m   \u001b[1;36m53.052142\u001b[0m  \u001b[1;36m79.992189\u001b[0m  \u001b[1;36m1.076090e+06\u001b[0m   \n",
       "\u001b[1;36m35\u001b[0m     \u001b[1;36m9090.235627\u001b[0m    \u001b[1;36m0.769158\u001b[0m   \u001b[1;36m22.599271\u001b[0m  \u001b[1;36m79.651035\u001b[0m  \u001b[1;36m1.039234e+06\u001b[0m   \n",
       "\u001b[33m...\u001b[0m            \u001b[33m...\u001b[0m         \u001b[33m...\u001b[0m         \u001b[33m...\u001b[0m        \u001b[33m...\u001b[0m           \u001b[33m...\u001b[0m   \n",
       "\u001b[1;36m6744\u001b[0m  \u001b[1;36m12479.437618\u001b[0m    \u001b[1;36m1.000000\u001b[0m \u001b[1;36m-107.935560\u001b[0m  \u001b[1;36m50.655027\u001b[0m \u001b[1;36m-3.945988e+06\u001b[0m   \n",
       "\u001b[1;36m6745\u001b[0m  \u001b[1;36m12148.179896\u001b[0m    \u001b[1;36m1.000000\u001b[0m \u001b[1;36m-110.851573\u001b[0m  \u001b[1;36m50.673240\u001b[0m \u001b[1;36m-4.041424e+06\u001b[0m   \n",
       "\u001b[1;36m6917\u001b[0m   \u001b[1;36m9418.100291\u001b[0m    \u001b[1;36m0.911623\u001b[0m \u001b[1;36m-124.832764\u001b[0m  \u001b[1;36m50.773308\u001b[0m \u001b[1;36m-4.347485e+06\u001b[0m   \n",
       "\u001b[1;36m7713\u001b[0m  \u001b[1;36m12395.223580\u001b[0m    \u001b[1;36m1.000000\u001b[0m   \u001b[1;36m41.960963\u001b[0m  \u001b[1;36m50.779041\u001b[0m  \u001b[1;36m4.409985e+06\u001b[0m   \n",
       "\u001b[1;36m7717\u001b[0m  \u001b[1;36m12148.179896\u001b[0m    \u001b[1;36m1.000000\u001b[0m   \u001b[1;36m40.344328\u001b[0m  \u001b[1;36m50.967269\u001b[0m  \u001b[1;36m4.378831e+06\u001b[0m   \n",
       "\n",
       "                 y  \n",
       "\u001b[1;36m21\u001b[0m    \u001b[1;36m9.355845e+04\u001b[0m  \n",
       "\u001b[1;36m23\u001b[0m    \u001b[1;36m2.128796e+05\u001b[0m  \n",
       "\u001b[1;36m25\u001b[0m    \u001b[1;36m3.385010e+04\u001b[0m  \n",
       "\u001b[1;36m27\u001b[0m    \u001b[1;36m1.523424e+05\u001b[0m  \n",
       "\u001b[1;36m35\u001b[0m   \u001b[1;36m-4.282015e+05\u001b[0m  \n",
       "\u001b[33m...\u001b[0m            \u001b[33m...\u001b[0m  \n",
       "\u001b[1;36m6744\u001b[0m \u001b[1;36m-2.016222e+06\u001b[0m  \n",
       "\u001b[1;36m6745\u001b[0m \u001b[1;36m-1.811968e+06\u001b[0m  \n",
       "\u001b[1;36m6917\u001b[0m \u001b[1;36m-7.797406e+05\u001b[0m  \n",
       "\u001b[1;36m7713\u001b[0m \u001b[1;36m-2.341336e+05\u001b[0m  \n",
       "\u001b[1;36m7717\u001b[0m \u001b[1;36m-3.565970e+05\u001b[0m  \n",
       "\n",
       "\u001b[1m[\u001b[0m\u001b[1;36m2760\u001b[0m rows x \u001b[1;36m10\u001b[0m columns\u001b[1m]\u001b[0m"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "grid = \"hex\"\n",
    "level = 3\n",
    "grid_gdf = grids.open(grid, level)\n",
    "grid_gdf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "740a9ca7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
       "<defs>\n",
       "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
       "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
       "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "</symbol>\n",
       "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
       "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
       "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "</symbol>\n",
       "</defs>\n",
       "</svg>\n",
       "<style>/* CSS stylesheet for displaying xarray objects in notebooks */\n",
       "\n",
       ":root {\n",
       "  --xr-font-color0: var(\n",
       "    --jp-content-font-color0,\n",
       "    var(--pst-color-text-base rgba(0, 0, 0, 1))\n",
       "  );\n",
       "  --xr-font-color2: var(\n",
       "    --jp-content-font-color2,\n",
       "    var(--pst-color-text-base, rgba(0, 0, 0, 0.54))\n",
       "  );\n",
       "  --xr-font-color3: var(\n",
       "    --jp-content-font-color3,\n",
       "    var(--pst-color-text-base, rgba(0, 0, 0, 0.38))\n",
       "  );\n",
       "  --xr-border-color: var(\n",
       "    --jp-border-color2,\n",
       "    hsl(from var(--pst-color-on-background, white) h s calc(l - 10))\n",
       "  );\n",
       "  --xr-disabled-color: var(\n",
       "    --jp-layout-color3,\n",
       "    hsl(from var(--pst-color-on-background, white) h s calc(l - 40))\n",
       "  );\n",
       "  --xr-background-color: var(\n",
       "    --jp-layout-color0,\n",
       "    var(--pst-color-on-background, white)\n",
       "  );\n",
       "  --xr-background-color-row-even: var(\n",
       "    --jp-layout-color1,\n",
       "    hsl(from var(--pst-color-on-background, white) h s calc(l - 5))\n",
       "  );\n",
       "  --xr-background-color-row-odd: var(\n",
       "    --jp-layout-color2,\n",
       "    hsl(from var(--pst-color-on-background, white) h s calc(l - 15))\n",
       "  );\n",
       "}\n",
       "\n",
       "html[theme=\"dark\"],\n",
       "html[data-theme=\"dark\"],\n",
       "body[data-theme=\"dark\"],\n",
       "body.vscode-dark {\n",
       "  --xr-font-color0: var(\n",
       "    --jp-content-font-color0,\n",
       "    var(--pst-color-text-base, rgba(255, 255, 255, 1))\n",
       "  );\n",
       "  --xr-font-color2: var(\n",
       "    --jp-content-font-color2,\n",
       "    var(--pst-color-text-base, rgba(255, 255, 255, 0.54))\n",
       "  );\n",
       "  --xr-font-color3: var(\n",
       "    --jp-content-font-color3,\n",
       "    var(--pst-color-text-base, rgba(255, 255, 255, 0.38))\n",
       "  );\n",
       "  --xr-border-color: var(\n",
       "    --jp-border-color2,\n",
       "    hsl(from var(--pst-color-on-background, #111111) h s calc(l + 10))\n",
       "  );\n",
       "  --xr-disabled-color: var(\n",
       "    --jp-layout-color3,\n",
       "    hsl(from var(--pst-color-on-background, #111111) h s calc(l + 40))\n",
       "  );\n",
       "  --xr-background-color: var(\n",
       "    --jp-layout-color0,\n",
       "    var(--pst-color-on-background, #111111)\n",
       "  );\n",
       "  --xr-background-color-row-even: var(\n",
       "    --jp-layout-color1,\n",
       "    hsl(from var(--pst-color-on-background, #111111) h s calc(l + 5))\n",
       "  );\n",
       "  --xr-background-color-row-odd: var(\n",
       "    --jp-layout-color2,\n",
       "    hsl(from var(--pst-color-on-background, #111111) h s calc(l + 15))\n",
       "  );\n",
       "}\n",
       "\n",
       ".xr-wrap {\n",
       "  display: block !important;\n",
       "  min-width: 300px;\n",
       "  max-width: 700px;\n",
       "  line-height: 1.6;\n",
       "}\n",
       "\n",
       ".xr-text-repr-fallback {\n",
       "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-header {\n",
       "  padding-top: 6px;\n",
       "  padding-bottom: 6px;\n",
       "  margin-bottom: 4px;\n",
       "  border-bottom: solid 1px var(--xr-border-color);\n",
       "}\n",
       "\n",
       ".xr-header > div,\n",
       ".xr-header > ul {\n",
       "  display: inline;\n",
       "  margin-top: 0;\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-obj-type,\n",
       ".xr-obj-name,\n",
       ".xr-group-name {\n",
       "  margin-left: 2px;\n",
       "  margin-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-group-name::before {\n",
       "  content: \"📁\";\n",
       "  padding-right: 0.3em;\n",
       "}\n",
       "\n",
       ".xr-group-name,\n",
       ".xr-obj-type {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-sections {\n",
       "  padding-left: 0 !important;\n",
       "  display: grid;\n",
       "  grid-template-columns: 150px auto auto 1fr 0 20px 0 20px;\n",
       "  margin-block-start: 0;\n",
       "  margin-block-end: 0;\n",
       "}\n",
       "\n",
       ".xr-section-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-section-item input {\n",
       "  display: inline-block;\n",
       "  opacity: 0;\n",
       "  height: 0;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-section-item input + label {\n",
       "  color: var(--xr-disabled-color);\n",
       "  border: 2px solid transparent !important;\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label {\n",
       "  cursor: pointer;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-item input:focus + label {\n",
       "  border: 2px solid var(--xr-font-color0) !important;\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label:hover {\n",
       "  color: var(--xr-font-color0);\n",
       "}\n",
       "\n",
       ".xr-section-summary {\n",
       "  grid-column: 1;\n",
       "  color: var(--xr-font-color2);\n",
       "  font-weight: 500;\n",
       "}\n",
       "\n",
       ".xr-section-summary > span {\n",
       "  display: inline-block;\n",
       "  padding-left: 0.5em;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in + label:before {\n",
       "  display: inline-block;\n",
       "  content: \"►\";\n",
       "  font-size: 11px;\n",
       "  width: 15px;\n",
       "  text-align: center;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label:before {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label:before {\n",
       "  content: \"▼\";\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label > span {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-summary,\n",
       ".xr-section-inline-details {\n",
       "  padding-top: 4px;\n",
       "}\n",
       "\n",
       ".xr-section-inline-details {\n",
       "  grid-column: 2 / -1;\n",
       "}\n",
       "\n",
       ".xr-section-details {\n",
       "  display: none;\n",
       "  grid-column: 1 / -1;\n",
       "  margin-top: 4px;\n",
       "  margin-bottom: 5px;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked ~ .xr-section-details {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-group-box {\n",
       "  display: inline-grid;\n",
       "  grid-template-columns: 0px 20px auto;\n",
       "  width: 100%;\n",
       "}\n",
       "\n",
       ".xr-group-box-vline {\n",
       "  grid-column-start: 1;\n",
       "  border-right: 0.2em solid;\n",
       "  border-color: var(--xr-border-color);\n",
       "  width: 0px;\n",
       "}\n",
       "\n",
       ".xr-group-box-hline {\n",
       "  grid-column-start: 2;\n",
       "  grid-row-start: 1;\n",
       "  height: 1em;\n",
       "  width: 20px;\n",
       "  border-bottom: 0.2em solid;\n",
       "  border-color: var(--xr-border-color);\n",
       "}\n",
       "\n",
       ".xr-group-box-contents {\n",
       "  grid-column-start: 3;\n",
       "}\n",
       "\n",
       ".xr-array-wrap {\n",
       "  grid-column: 1 / -1;\n",
       "  display: grid;\n",
       "  grid-template-columns: 20px auto;\n",
       "}\n",
       "\n",
       ".xr-array-wrap > label {\n",
       "  grid-column: 1;\n",
       "  vertical-align: top;\n",
       "}\n",
       "\n",
       ".xr-preview {\n",
       "  color: var(--xr-font-color3);\n",
       "}\n",
       "\n",
       ".xr-array-preview,\n",
       ".xr-array-data {\n",
       "  padding: 0 5px !important;\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-array-data,\n",
       ".xr-array-in:checked ~ .xr-array-preview {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-array-in:checked ~ .xr-array-data,\n",
       ".xr-array-preview {\n",
       "  display: inline-block;\n",
       "}\n",
       "\n",
       ".xr-dim-list {\n",
       "  display: inline-block !important;\n",
       "  list-style: none;\n",
       "  padding: 0 !important;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list li {\n",
       "  display: inline-block;\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list:before {\n",
       "  content: \"(\";\n",
       "}\n",
       "\n",
       ".xr-dim-list:after {\n",
       "  content: \")\";\n",
       "}\n",
       "\n",
       ".xr-dim-list li:not(:last-child):after {\n",
       "  content: \",\";\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-has-index {\n",
       "  font-weight: bold;\n",
       "}\n",
       "\n",
       ".xr-var-list,\n",
       ".xr-var-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-var-item > div,\n",
       ".xr-var-item label,\n",
       ".xr-var-item > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-even);\n",
       "  border-color: var(--xr-background-color-row-odd);\n",
       "  margin-bottom: 0;\n",
       "  padding-top: 2px;\n",
       "}\n",
       "\n",
       ".xr-var-item > .xr-var-name:hover span {\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-var-list > li:nth-child(odd) > div,\n",
       ".xr-var-list > li:nth-child(odd) > label,\n",
       ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-odd);\n",
       "  border-color: var(--xr-background-color-row-even);\n",
       "}\n",
       "\n",
       ".xr-var-name {\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-var-dims {\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-var-dtype {\n",
       "  grid-column: 3;\n",
       "  text-align: right;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-preview {\n",
       "  grid-column: 4;\n",
       "}\n",
       "\n",
       ".xr-index-preview {\n",
       "  grid-column: 2 / 5;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-name,\n",
       ".xr-var-dims,\n",
       ".xr-var-dtype,\n",
       ".xr-preview,\n",
       ".xr-attrs dt {\n",
       "  white-space: nowrap;\n",
       "  overflow: hidden;\n",
       "  text-overflow: ellipsis;\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-var-name:hover,\n",
       ".xr-var-dims:hover,\n",
       ".xr-var-dtype:hover,\n",
       ".xr-attrs dt:hover {\n",
       "  overflow: visible;\n",
       "  width: auto;\n",
       "  z-index: 1;\n",
       "}\n",
       "\n",
       ".xr-var-attrs,\n",
       ".xr-var-data,\n",
       ".xr-index-data {\n",
       "  display: none;\n",
       "  border-top: 2px dotted var(--xr-background-color);\n",
       "  padding-bottom: 20px !important;\n",
       "  padding-top: 10px !important;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in + label,\n",
       ".xr-var-data-in + label,\n",
       ".xr-index-data-in + label {\n",
       "  padding: 0 1px;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
       ".xr-var-data-in:checked ~ .xr-var-data,\n",
       ".xr-index-data-in:checked ~ .xr-index-data {\n",
       "  display: block;\n",
       "}\n",
       "\n",
       ".xr-var-data > table {\n",
       "  float: right;\n",
       "}\n",
       "\n",
       ".xr-var-data > pre,\n",
       ".xr-index-data > pre,\n",
       ".xr-var-data > table > tbody > tr {\n",
       "  background-color: transparent !important;\n",
       "}\n",
       "\n",
       ".xr-var-name span,\n",
       ".xr-var-data,\n",
       ".xr-index-name div,\n",
       ".xr-index-data,\n",
       ".xr-attrs {\n",
       "  padding-left: 25px !important;\n",
       "}\n",
       "\n",
       ".xr-attrs,\n",
       ".xr-var-attrs,\n",
       ".xr-var-data,\n",
       ".xr-index-data {\n",
       "  grid-column: 1 / -1;\n",
       "}\n",
       "\n",
       "dl.xr-attrs {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  display: grid;\n",
       "  grid-template-columns: 125px auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt,\n",
       ".xr-attrs dd {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  float: left;\n",
       "  padding-right: 10px;\n",
       "  width: auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt {\n",
       "  font-weight: normal;\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-attrs dt:hover span {\n",
       "  display: inline-block;\n",
       "  background: var(--xr-background-color);\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-attrs dd {\n",
       "  grid-column: 2;\n",
       "  white-space: pre-wrap;\n",
       "  word-break: break-all;\n",
       "}\n",
       "\n",
       ".xr-icon-database,\n",
       ".xr-icon-file-text2,\n",
       ".xr-no-icon {\n",
       "  display: inline-block;\n",
       "  vertical-align: middle;\n",
       "  width: 1em;\n",
       "  height: 1.5em !important;\n",
       "  stroke-width: 0;\n",
       "  stroke: currentColor;\n",
       "  fill: currentColor;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in:checked + label > .xr-icon-file-text2,\n",
       ".xr-var-data-in:checked + label > .xr-icon-database,\n",
       ".xr-index-data-in:checked + label > .xr-icon-database {\n",
       "  color: var(--xr-font-color0);\n",
       "  filter: drop-shadow(1px 1px 5px var(--xr-font-color2));\n",
       "  stroke-width: 0.8px;\n",
       "}\n",
       "</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt; Size: 17MB\n",
       "Dimensions:           (cell_ids: 2760, band: 64, agg: 12)\n",
       "Coordinates:\n",
       "  * cell_ids          (cell_ids) int64 22kB 589973269172453375 ... 5907707586...\n",
       "  * band              (band) &lt;U3 768B &#x27;A00&#x27; &#x27;A01&#x27; &#x27;A02&#x27; ... &#x27;A61&#x27; &#x27;A62&#x27; &#x27;A63&#x27;\n",
       "  * agg               (agg) &lt;U6 288B &#x27;mean&#x27; &#x27;stdDev&#x27; &#x27;min&#x27; ... &#x27;p75&#x27; &#x27;p95&#x27; &#x27;p99&#x27;\n",
       "Data variables:\n",
       "    embeddings        (cell_ids, band, agg) float32 8MB dask.array&lt;chunksize=(2760, 64, 12), meta=np.ndarray&gt;\n",
       "    embeddings_trend  (cell_ids, band, agg) float32 8MB dask.array&lt;chunksize=(2760, 64, 12), meta=np.ndarray&gt;\n",
       "Indexes:\n",
       "    cell_ids  H3Index(level=3)</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-9e31e224-882c-41ed-bb0a-7bb54970f3c5' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-9e31e224-882c-41ed-bb0a-7bb54970f3c5' class='xr-section-summary'  title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>cell_ids</span>: 2760</li><li><span class='xr-has-index'>band</span>: 64</li><li><span class='xr-has-index'>agg</span>: 12</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-1b606532-95f2-46ef-a6a5-21aaf22bd738' class='xr-section-summary-in' type='checkbox'  checked><label for='section-1b606532-95f2-46ef-a6a5-21aaf22bd738' class='xr-section-summary' >Coordinates: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>cell_ids</span></div><div class='xr-var-dims'>(cell_ids)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>589973269172453375 ... 590770758...</div><input id='attrs-cd183ffb-0399-4044-ac44-087df99fe716' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-cd183ffb-0399-4044-ac44-087df99fe716' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-f60dee63-9bb6-416c-9589-7dc5070ed824' class='xr-var-data-in' type='checkbox'><label for='data-f60dee63-9bb6-416c-9589-7dc5070ed824' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>grid_name :</span></dt><dd>h3</dd><dt><span>level :</span></dt><dd>3</dd></dl></div><div class='xr-var-data'><pre>array([589973269172453375, 589973406611406847, 589973544050360319, ...,\n",
       "       590690356912193535, 590770483822067711, 590770758699974655],\n",
       "      shape=(2760,))</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>band</span></div><div class='xr-var-dims'>(band)</div><div class='xr-var-dtype'>&lt;U3</div><div class='xr-var-preview xr-preview'>&#x27;A00&#x27; &#x27;A01&#x27; &#x27;A02&#x27; ... &#x27;A62&#x27; &#x27;A63&#x27;</div><input id='attrs-45455916-2062-458d-aa6c-cc5c504009fc' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-45455916-2062-458d-aa6c-cc5c504009fc' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-168f64af-c1ee-48f6-a21b-378d59aae310' class='xr-var-data-in' type='checkbox'><label for='data-168f64af-c1ee-48f6-a21b-378d59aae310' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([&#x27;A00&#x27;, &#x27;A01&#x27;, &#x27;A02&#x27;, &#x27;A03&#x27;, &#x27;A04&#x27;, &#x27;A05&#x27;, &#x27;A06&#x27;, &#x27;A07&#x27;, &#x27;A08&#x27;, &#x27;A09&#x27;,\n",
       "       &#x27;A10&#x27;, &#x27;A11&#x27;, &#x27;A12&#x27;, &#x27;A13&#x27;, &#x27;A14&#x27;, &#x27;A15&#x27;, &#x27;A16&#x27;, &#x27;A17&#x27;, &#x27;A18&#x27;, &#x27;A19&#x27;,\n",
       "       &#x27;A20&#x27;, &#x27;A21&#x27;, &#x27;A22&#x27;, &#x27;A23&#x27;, &#x27;A24&#x27;, &#x27;A25&#x27;, &#x27;A26&#x27;, &#x27;A27&#x27;, &#x27;A28&#x27;, &#x27;A29&#x27;,\n",
       "       &#x27;A30&#x27;, &#x27;A31&#x27;, &#x27;A32&#x27;, &#x27;A33&#x27;, &#x27;A34&#x27;, &#x27;A35&#x27;, &#x27;A36&#x27;, &#x27;A37&#x27;, &#x27;A38&#x27;, &#x27;A39&#x27;,\n",
       "       &#x27;A40&#x27;, &#x27;A41&#x27;, &#x27;A42&#x27;, &#x27;A43&#x27;, &#x27;A44&#x27;, &#x27;A45&#x27;, &#x27;A46&#x27;, &#x27;A47&#x27;, &#x27;A48&#x27;, &#x27;A49&#x27;,\n",
       "       &#x27;A50&#x27;, &#x27;A51&#x27;, &#x27;A52&#x27;, &#x27;A53&#x27;, &#x27;A54&#x27;, &#x27;A55&#x27;, &#x27;A56&#x27;, &#x27;A57&#x27;, &#x27;A58&#x27;, &#x27;A59&#x27;,\n",
       "       &#x27;A60&#x27;, &#x27;A61&#x27;, &#x27;A62&#x27;, &#x27;A63&#x27;], dtype=&#x27;&lt;U3&#x27;)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>agg</span></div><div class='xr-var-dims'>(agg)</div><div class='xr-var-dtype'>&lt;U6</div><div class='xr-var-preview xr-preview'>&#x27;mean&#x27; &#x27;stdDev&#x27; ... &#x27;p95&#x27; &#x27;p99&#x27;</div><input id='attrs-538428d8-8b41-491a-a135-eab42552bfaa' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-538428d8-8b41-491a-a135-eab42552bfaa' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-f2809036-992e-451c-a790-1d54b2086718' class='xr-var-data-in' type='checkbox'><label for='data-f2809036-992e-451c-a790-1d54b2086718' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([&#x27;mean&#x27;, &#x27;stdDev&#x27;, &#x27;min&#x27;, &#x27;max&#x27;, &#x27;count&#x27;, &#x27;median&#x27;, &#x27;p1&#x27;, &#x27;p5&#x27;, &#x27;p25&#x27;,\n",
       "       &#x27;p75&#x27;, &#x27;p95&#x27;, &#x27;p99&#x27;], dtype=&#x27;&lt;U6&#x27;)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-30cf6465-a543-4302-aca2-a5f1c0b60e57' class='xr-section-summary-in' type='checkbox'  checked><label for='section-30cf6465-a543-4302-aca2-a5f1c0b60e57' class='xr-section-summary' >Data variables: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>embeddings</span></div><div class='xr-var-dims'>(cell_ids, band, agg)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>dask.array&lt;chunksize=(2760, 64, 12), meta=np.ndarray&gt;</div><input id='attrs-6ed20801-e525-4f60-910b-9567d8c563d3' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-6ed20801-e525-4f60-910b-9567d8c563d3' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-7eec07dc-2358-4273-a713-2a8f1faa815b' class='xr-var-data-in' type='checkbox'><label for='data-7eec07dc-2358-4273-a713-2a8f1faa815b' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><table>\n",
       "    <tr>\n",
       "        <td>\n",
       "            <table style=\"border-collapse: collapse;\">\n",
       "                <thead>\n",
       "                    <tr>\n",
       "                        <td> </td>\n",
       "                        <th> Array </th>\n",
       "                        <th> Chunk </th>\n",
       "                    </tr>\n",
       "                </thead>\n",
       "                <tbody>\n",
       "                    \n",
       "                    <tr>\n",
       "                        <th> Bytes </th>\n",
       "                        <td> 8.09 MiB </td>\n",
       "                        <td> 8.09 MiB </td>\n",
       "                    </tr>\n",
       "                    \n",
       "                    <tr>\n",
       "                        <th> Shape </th>\n",
       "                        <td> (2760, 64, 12) </td>\n",
       "                        <td> (2760, 64, 12) </td>\n",
       "                    </tr>\n",
       "                    <tr>\n",
       "                        <th> Dask graph </th>\n",
       "                        <td colspan=\"2\"> 1 chunks in 2 graph layers </td>\n",
       "                    </tr>\n",
       "                    <tr>\n",
       "                        <th> Data type </th>\n",
       "                        <td colspan=\"2\"> float32 numpy.ndarray </td>\n",
       "                    </tr>\n",
       "                </tbody>\n",
       "            </table>\n",
       "        </td>\n",
       "        <td>\n",
       "        <svg width=\"156\" height=\"150\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n",
       "\n",
       "  <!-- Horizontal lines -->\n",
       "  <line x1=\"10\" y1=\"0\" x2=\"80\" y2=\"70\" style=\"stroke-width:2\" />\n",
       "  <line x1=\"10\" y1=\"29\" x2=\"80\" y2=\"100\" style=\"stroke-width:2\" />\n",
       "\n",
       "  <!-- Vertical lines -->\n",
       "  <line x1=\"10\" y1=\"0\" x2=\"10\" y2=\"29\" style=\"stroke-width:2\" />\n",
       "  <line x1=\"80\" y1=\"70\" x2=\"80\" y2=\"100\" style=\"stroke-width:2\" />\n",
       "\n",
       "  <!-- Colored Rectangle -->\n",
       "  <polygon points=\"10.0,0.0 80.58823529411765,70.58823529411765 80.58823529411765,100.46251409860729 10.0,29.874278804489638\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
       "\n",
       "  <!-- Horizontal lines -->\n",
       "  <line x1=\"10\" y1=\"0\" x2=\"35\" y2=\"0\" style=\"stroke-width:2\" />\n",
       "  <line x1=\"80\" y1=\"70\" x2=\"106\" y2=\"70\" style=\"stroke-width:2\" />\n",
       "\n",
       "  <!-- Vertical lines -->\n",
       "  <line x1=\"10\" y1=\"0\" x2=\"80\" y2=\"70\" style=\"stroke-width:2\" />\n",
       "  <line x1=\"35\" y1=\"0\" x2=\"106\" y2=\"70\" style=\"stroke-width:2\" />\n",
       "\n",
       "  <!-- Colored Rectangle -->\n",
       "  <polygon points=\"10.0,0.0 35.41261651458248,0.0 106.00085180870013,70.58823529411765 80.58823529411765,70.58823529411765\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
       "\n",
       "  <!-- Horizontal lines -->\n",
       "  <line x1=\"80\" y1=\"70\" x2=\"106\" y2=\"70\" style=\"stroke-width:2\" />\n",
       "  <line x1=\"80\" y1=\"100\" x2=\"106\" y2=\"100\" style=\"stroke-width:2\" />\n",
       "\n",
       "  <!-- Vertical lines -->\n",
       "  <line x1=\"80\" y1=\"70\" x2=\"80\" y2=\"100\" style=\"stroke-width:2\" />\n",
       "  <line x1=\"106\" y1=\"70\" x2=\"106\" y2=\"100\" style=\"stroke-width:2\" />\n",
       "\n",
       "  <!-- Colored Rectangle -->\n",
       "  <polygon points=\"80.58823529411765,70.58823529411765 106.00085180870013,70.58823529411765 106.00085180870013,100.46251409860729 80.58823529411765,100.46251409860729\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
       "\n",
       "  <!-- Text -->\n",
       "  <text x=\"93.29454355140889\" y=\"120.46251409860729\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >12</text>\n",
       "  <text x=\"126.00085180870013\" y=\"85.52537469636246\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(0,126.00085180870013,85.52537469636246)\">64</text>\n",
       "  <text x=\"35.294117647058826\" y=\"85.16839645154846\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(45,35.294117647058826,85.16839645154846)\">2760</text>\n",
       "</svg>\n",
       "        </td>\n",
       "    </tr>\n",
       "</table></div></li><li class='xr-var-item'><div class='xr-var-name'><span>embeddings_trend</span></div><div class='xr-var-dims'>(cell_ids, band, agg)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>dask.array&lt;chunksize=(2760, 64, 12), meta=np.ndarray&gt;</div><input id='attrs-d129cdfc-a801-47f7-ab74-d2c9a6a2da67' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-d129cdfc-a801-47f7-ab74-d2c9a6a2da67' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-1d630726-1c4c-420f-a491-457832a2c1bb' class='xr-var-data-in' type='checkbox'><label for='data-1d630726-1c4c-420f-a491-457832a2c1bb' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><table>\n",
       "    <tr>\n",
       "        <td>\n",
       "            <table style=\"border-collapse: collapse;\">\n",
       "                <thead>\n",
       "                    <tr>\n",
       "                        <td> </td>\n",
       "                        <th> Array </th>\n",
       "                        <th> Chunk </th>\n",
       "                    </tr>\n",
       "                </thead>\n",
       "                <tbody>\n",
       "                    \n",
       "                    <tr>\n",
       "                        <th> Bytes </th>\n",
       "                        <td> 8.09 MiB </td>\n",
       "                        <td> 8.09 MiB </td>\n",
       "                    </tr>\n",
       "                    \n",
       "                    <tr>\n",
       "                        <th> Shape </th>\n",
       "                        <td> (2760, 64, 12) </td>\n",
       "                        <td> (2760, 64, 12) </td>\n",
       "                    </tr>\n",
       "                    <tr>\n",
       "                        <th> Dask graph </th>\n",
       "                        <td colspan=\"2\"> 1 chunks in 2 graph layers </td>\n",
       "                    </tr>\n",
       "                    <tr>\n",
       "                        <th> Data type </th>\n",
       "                        <td colspan=\"2\"> float32 numpy.ndarray </td>\n",
       "                    </tr>\n",
       "                </tbody>\n",
       "            </table>\n",
       "        </td>\n",
       "        <td>\n",
       "        <svg width=\"156\" height=\"150\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n",
       "\n",
       "  <!-- Horizontal lines -->\n",
       "  <line x1=\"10\" y1=\"0\" x2=\"80\" y2=\"70\" style=\"stroke-width:2\" />\n",
       "  <line x1=\"10\" y1=\"29\" x2=\"80\" y2=\"100\" style=\"stroke-width:2\" />\n",
       "\n",
       "  <!-- Vertical lines -->\n",
       "  <line x1=\"10\" y1=\"0\" x2=\"10\" y2=\"29\" style=\"stroke-width:2\" />\n",
       "  <line x1=\"80\" y1=\"70\" x2=\"80\" y2=\"100\" style=\"stroke-width:2\" />\n",
       "\n",
       "  <!-- Colored Rectangle -->\n",
       "  <polygon points=\"10.0,0.0 80.58823529411765,70.58823529411765 80.58823529411765,100.46251409860729 10.0,29.874278804489638\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
       "\n",
       "  <!-- Horizontal lines -->\n",
       "  <line x1=\"10\" y1=\"0\" x2=\"35\" y2=\"0\" style=\"stroke-width:2\" />\n",
       "  <line x1=\"80\" y1=\"70\" x2=\"106\" y2=\"70\" style=\"stroke-width:2\" />\n",
       "\n",
       "  <!-- Vertical lines -->\n",
       "  <line x1=\"10\" y1=\"0\" x2=\"80\" y2=\"70\" style=\"stroke-width:2\" />\n",
       "  <line x1=\"35\" y1=\"0\" x2=\"106\" y2=\"70\" style=\"stroke-width:2\" />\n",
       "\n",
       "  <!-- Colored Rectangle -->\n",
       "  <polygon points=\"10.0,0.0 35.41261651458248,0.0 106.00085180870013,70.58823529411765 80.58823529411765,70.58823529411765\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
       "\n",
       "  <!-- Horizontal lines -->\n",
       "  <line x1=\"80\" y1=\"70\" x2=\"106\" y2=\"70\" style=\"stroke-width:2\" />\n",
       "  <line x1=\"80\" y1=\"100\" x2=\"106\" y2=\"100\" style=\"stroke-width:2\" />\n",
       "\n",
       "  <!-- Vertical lines -->\n",
       "  <line x1=\"80\" y1=\"70\" x2=\"80\" y2=\"100\" style=\"stroke-width:2\" />\n",
       "  <line x1=\"106\" y1=\"70\" x2=\"106\" y2=\"100\" style=\"stroke-width:2\" />\n",
       "\n",
       "  <!-- Colored Rectangle -->\n",
       "  <polygon points=\"80.58823529411765,70.58823529411765 106.00085180870013,70.58823529411765 106.00085180870013,100.46251409860729 80.58823529411765,100.46251409860729\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
       "\n",
       "  <!-- Text -->\n",
       "  <text x=\"93.29454355140889\" y=\"120.46251409860729\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >12</text>\n",
       "  <text x=\"126.00085180870013\" y=\"85.52537469636246\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(0,126.00085180870013,85.52537469636246)\">64</text>\n",
       "  <text x=\"35.294117647058826\" y=\"85.16839645154846\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(45,35.294117647058826,85.16839645154846)\">2760</text>\n",
       "</svg>\n",
       "        </td>\n",
       "    </tr>\n",
       "</table></div></li></ul></div></li><li class='xr-section-item'><input id='section-32772199-d143-4544-bddf-b32cc3b13cd5' class='xr-section-summary-in' type='checkbox'  ><label for='section-32772199-d143-4544-bddf-b32cc3b13cd5' class='xr-section-summary' >Indexes: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-index-name'><div>cell_ids</div></div><div class='xr-index-preview'>H3Index(level=3)</div><input type='checkbox' disabled/><label></label><input id='index-7f7150c0-d2f9-4025-acae-5e40062efdd8' class='xr-index-data-in' type='checkbox'/><label for='index-7f7150c0-d2f9-4025-acae-5e40062efdd8' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>&lt;xdggs.h3.H3Index object at 0x7f919b96e120&gt;</pre></div></li></ul></div></li></ul></div></div>"
      ],
      "text/plain": [
       "\n",
       "\u001b[1m<\u001b[0m\u001b[1;95mxarray.Dataset\u001b[0m\u001b[39m> Size: 17MB\u001b[0m\n",
       "\u001b[39mDimensions:           \u001b[0m\u001b[1;39m(\u001b[0m\u001b[39mcell_ids: \u001b[0m\u001b[1;36m2760\u001b[0m\u001b[39m, band: \u001b[0m\u001b[1;36m64\u001b[0m\u001b[39m, agg: \u001b[0m\u001b[1;36m12\u001b[0m\u001b[1;39m)\u001b[0m\n",
       "\u001b[39mCoordinates:\u001b[0m\n",
       "\u001b[39m  * cell_ids          \u001b[0m\u001b[1;39m(\u001b[0m\u001b[39mcell_ids\u001b[0m\u001b[1;39m)\u001b[0m\u001b[39m int64 22kB \u001b[0m\u001b[1;36m589973269172453375\u001b[0m\u001b[39m \u001b[0m\u001b[33m...\u001b[0m\u001b[39m \u001b[0m\u001b[1;36m5907707586\u001b[0m\u001b[33m...\u001b[0m\n",
       "\u001b[39m  * band              \u001b[0m\u001b[1;39m(\u001b[0m\u001b[39mband\u001b[0m\u001b[1;39m)\u001b[0m\u001b[39m <U3 768B \u001b[0m\u001b[32m'A00'\u001b[0m\u001b[39m \u001b[0m\u001b[32m'A01'\u001b[0m\u001b[39m \u001b[0m\u001b[32m'A02'\u001b[0m\u001b[39m \u001b[0m\u001b[33m...\u001b[0m\u001b[39m \u001b[0m\u001b[32m'A61'\u001b[0m\u001b[39m \u001b[0m\u001b[32m'A62'\u001b[0m\u001b[39m \u001b[0m\u001b[32m'A63'\u001b[0m\n",
       "\u001b[39m  * agg               \u001b[0m\u001b[1;39m(\u001b[0m\u001b[39magg\u001b[0m\u001b[1;39m)\u001b[0m\u001b[39m <U6 288B \u001b[0m\u001b[32m'mean'\u001b[0m\u001b[39m \u001b[0m\u001b[32m'stdDev'\u001b[0m\u001b[39m \u001b[0m\u001b[32m'min'\u001b[0m\u001b[39m \u001b[0m\u001b[33m...\u001b[0m\u001b[39m \u001b[0m\u001b[32m'p75'\u001b[0m\u001b[39m \u001b[0m\u001b[32m'p95'\u001b[0m\u001b[39m \u001b[0m\u001b[32m'p99'\u001b[0m\n",
       "\u001b[39mData variables:\u001b[0m\n",
       "\u001b[39m    embeddings        \u001b[0m\u001b[1;39m(\u001b[0m\u001b[39mcell_ids, band, agg\u001b[0m\u001b[1;39m)\u001b[0m\u001b[39m float32 8MB dask.array<\u001b[0m\u001b[33mchunksize\u001b[0m\u001b[39m=\u001b[0m\u001b[1;39m(\u001b[0m\u001b[1;36m2760\u001b[0m\u001b[39m, \u001b[0m\u001b[1;36m64\u001b[0m\u001b[39m, \u001b[0m\u001b[1;36m12\u001b[0m\u001b[1;39m)\u001b[0m\u001b[39m, \u001b[0m\u001b[33mmeta\u001b[0m\u001b[39m=\u001b[0m\u001b[35mnp\u001b[0m\u001b[39m.ndarray>\u001b[0m\n",
       "\u001b[39m    embeddings_trend  \u001b[0m\u001b[1;39m(\u001b[0m\u001b[39mcell_ids, band, agg\u001b[0m\u001b[1;39m)\u001b[0m\u001b[39m float32 8MB dask.array<\u001b[0m\u001b[33mchunksize\u001b[0m\u001b[39m=\u001b[0m\u001b[1;39m(\u001b[0m\u001b[1;36m2760\u001b[0m\u001b[39m, \u001b[0m\u001b[1;36m64\u001b[0m\u001b[39m, \u001b[0m\u001b[1;36m12\u001b[0m\u001b[1;39m)\u001b[0m\u001b[39m, \u001b[0m\u001b[33mmeta\u001b[0m\u001b[39m=\u001b[0m\u001b[35mnp\u001b[0m\u001b[39m.ndarray\u001b[0m\u001b[1m>\u001b[0m\n",
       "Indexes:\n",
       "    cell_ids  \u001b[1;35mH3Index\u001b[0m\u001b[1m(\u001b[0m\u001b[33mlevel\u001b[0m=\u001b[1;36m3\u001b[0m\u001b[1m)\u001b[0m"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f = get_embeddings_store(grid, level, \"synopsis\")\n",
    "ds = xr.open_zarr(f, consolidated=False)\n",
    "ds = xdggs.decode(ds)\n",
    "ds"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "e81cba68",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
       "<defs>\n",
       "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
       "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
       "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "</symbol>\n",
       "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
       "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
       "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "</symbol>\n",
       "</defs>\n",
       "</svg>\n",
       "<style>/* CSS stylesheet for displaying xarray objects in notebooks */\n",
       "\n",
       ":root {\n",
       "  --xr-font-color0: var(\n",
       "    --jp-content-font-color0,\n",
       "    var(--pst-color-text-base rgba(0, 0, 0, 1))\n",
       "  );\n",
       "  --xr-font-color2: var(\n",
       "    --jp-content-font-color2,\n",
       "    var(--pst-color-text-base, rgba(0, 0, 0, 0.54))\n",
       "  );\n",
       "  --xr-font-color3: var(\n",
       "    --jp-content-font-color3,\n",
       "    var(--pst-color-text-base, rgba(0, 0, 0, 0.38))\n",
       "  );\n",
       "  --xr-border-color: var(\n",
       "    --jp-border-color2,\n",
       "    hsl(from var(--pst-color-on-background, white) h s calc(l - 10))\n",
       "  );\n",
       "  --xr-disabled-color: var(\n",
       "    --jp-layout-color3,\n",
       "    hsl(from var(--pst-color-on-background, white) h s calc(l - 40))\n",
       "  );\n",
       "  --xr-background-color: var(\n",
       "    --jp-layout-color0,\n",
       "    var(--pst-color-on-background, white)\n",
       "  );\n",
       "  --xr-background-color-row-even: var(\n",
       "    --jp-layout-color1,\n",
       "    hsl(from var(--pst-color-on-background, white) h s calc(l - 5))\n",
       "  );\n",
       "  --xr-background-color-row-odd: var(\n",
       "    --jp-layout-color2,\n",
       "    hsl(from var(--pst-color-on-background, white) h s calc(l - 15))\n",
       "  );\n",
       "}\n",
       "\n",
       "html[theme=\"dark\"],\n",
       "html[data-theme=\"dark\"],\n",
       "body[data-theme=\"dark\"],\n",
       "body.vscode-dark {\n",
       "  --xr-font-color0: var(\n",
       "    --jp-content-font-color0,\n",
       "    var(--pst-color-text-base, rgba(255, 255, 255, 1))\n",
       "  );\n",
       "  --xr-font-color2: var(\n",
       "    --jp-content-font-color2,\n",
       "    var(--pst-color-text-base, rgba(255, 255, 255, 0.54))\n",
       "  );\n",
       "  --xr-font-color3: var(\n",
       "    --jp-content-font-color3,\n",
       "    var(--pst-color-text-base, rgba(255, 255, 255, 0.38))\n",
       "  );\n",
       "  --xr-border-color: var(\n",
       "    --jp-border-color2,\n",
       "    hsl(from var(--pst-color-on-background, #111111) h s calc(l + 10))\n",
       "  );\n",
       "  --xr-disabled-color: var(\n",
       "    --jp-layout-color3,\n",
       "    hsl(from var(--pst-color-on-background, #111111) h s calc(l + 40))\n",
       "  );\n",
       "  --xr-background-color: var(\n",
       "    --jp-layout-color0,\n",
       "    var(--pst-color-on-background, #111111)\n",
       "  );\n",
       "  --xr-background-color-row-even: var(\n",
       "    --jp-layout-color1,\n",
       "    hsl(from var(--pst-color-on-background, #111111) h s calc(l + 5))\n",
       "  );\n",
       "  --xr-background-color-row-odd: var(\n",
       "    --jp-layout-color2,\n",
       "    hsl(from var(--pst-color-on-background, #111111) h s calc(l + 15))\n",
       "  );\n",
       "}\n",
       "\n",
       ".xr-wrap {\n",
       "  display: block !important;\n",
       "  min-width: 300px;\n",
       "  max-width: 700px;\n",
       "  line-height: 1.6;\n",
       "}\n",
       "\n",
       ".xr-text-repr-fallback {\n",
       "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-header {\n",
       "  padding-top: 6px;\n",
       "  padding-bottom: 6px;\n",
       "  margin-bottom: 4px;\n",
       "  border-bottom: solid 1px var(--xr-border-color);\n",
       "}\n",
       "\n",
       ".xr-header > div,\n",
       ".xr-header > ul {\n",
       "  display: inline;\n",
       "  margin-top: 0;\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-obj-type,\n",
       ".xr-obj-name,\n",
       ".xr-group-name {\n",
       "  margin-left: 2px;\n",
       "  margin-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-group-name::before {\n",
       "  content: \"📁\";\n",
       "  padding-right: 0.3em;\n",
       "}\n",
       "\n",
       ".xr-group-name,\n",
       ".xr-obj-type {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-sections {\n",
       "  padding-left: 0 !important;\n",
       "  display: grid;\n",
       "  grid-template-columns: 150px auto auto 1fr 0 20px 0 20px;\n",
       "  margin-block-start: 0;\n",
       "  margin-block-end: 0;\n",
       "}\n",
       "\n",
       ".xr-section-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-section-item input {\n",
       "  display: inline-block;\n",
       "  opacity: 0;\n",
       "  height: 0;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-section-item input + label {\n",
       "  color: var(--xr-disabled-color);\n",
       "  border: 2px solid transparent !important;\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label {\n",
       "  cursor: pointer;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-item input:focus + label {\n",
       "  border: 2px solid var(--xr-font-color0) !important;\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label:hover {\n",
       "  color: var(--xr-font-color0);\n",
       "}\n",
       "\n",
       ".xr-section-summary {\n",
       "  grid-column: 1;\n",
       "  color: var(--xr-font-color2);\n",
       "  font-weight: 500;\n",
       "}\n",
       "\n",
       ".xr-section-summary > span {\n",
       "  display: inline-block;\n",
       "  padding-left: 0.5em;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in + label:before {\n",
       "  display: inline-block;\n",
       "  content: \"►\";\n",
       "  font-size: 11px;\n",
       "  width: 15px;\n",
       "  text-align: center;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label:before {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label:before {\n",
       "  content: \"▼\";\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label > span {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-summary,\n",
       ".xr-section-inline-details {\n",
       "  padding-top: 4px;\n",
       "}\n",
       "\n",
       ".xr-section-inline-details {\n",
       "  grid-column: 2 / -1;\n",
       "}\n",
       "\n",
       ".xr-section-details {\n",
       "  display: none;\n",
       "  grid-column: 1 / -1;\n",
       "  margin-top: 4px;\n",
       "  margin-bottom: 5px;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked ~ .xr-section-details {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-group-box {\n",
       "  display: inline-grid;\n",
       "  grid-template-columns: 0px 20px auto;\n",
       "  width: 100%;\n",
       "}\n",
       "\n",
       ".xr-group-box-vline {\n",
       "  grid-column-start: 1;\n",
       "  border-right: 0.2em solid;\n",
       "  border-color: var(--xr-border-color);\n",
       "  width: 0px;\n",
       "}\n",
       "\n",
       ".xr-group-box-hline {\n",
       "  grid-column-start: 2;\n",
       "  grid-row-start: 1;\n",
       "  height: 1em;\n",
       "  width: 20px;\n",
       "  border-bottom: 0.2em solid;\n",
       "  border-color: var(--xr-border-color);\n",
       "}\n",
       "\n",
       ".xr-group-box-contents {\n",
       "  grid-column-start: 3;\n",
       "}\n",
       "\n",
       ".xr-array-wrap {\n",
       "  grid-column: 1 / -1;\n",
       "  display: grid;\n",
       "  grid-template-columns: 20px auto;\n",
       "}\n",
       "\n",
       ".xr-array-wrap > label {\n",
       "  grid-column: 1;\n",
       "  vertical-align: top;\n",
       "}\n",
       "\n",
       ".xr-preview {\n",
       "  color: var(--xr-font-color3);\n",
       "}\n",
       "\n",
       ".xr-array-preview,\n",
       ".xr-array-data {\n",
       "  padding: 0 5px !important;\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-array-data,\n",
       ".xr-array-in:checked ~ .xr-array-preview {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-array-in:checked ~ .xr-array-data,\n",
       ".xr-array-preview {\n",
       "  display: inline-block;\n",
       "}\n",
       "\n",
       ".xr-dim-list {\n",
       "  display: inline-block !important;\n",
       "  list-style: none;\n",
       "  padding: 0 !important;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list li {\n",
       "  display: inline-block;\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list:before {\n",
       "  content: \"(\";\n",
       "}\n",
       "\n",
       ".xr-dim-list:after {\n",
       "  content: \")\";\n",
       "}\n",
       "\n",
       ".xr-dim-list li:not(:last-child):after {\n",
       "  content: \",\";\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-has-index {\n",
       "  font-weight: bold;\n",
       "}\n",
       "\n",
       ".xr-var-list,\n",
       ".xr-var-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-var-item > div,\n",
       ".xr-var-item label,\n",
       ".xr-var-item > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-even);\n",
       "  border-color: var(--xr-background-color-row-odd);\n",
       "  margin-bottom: 0;\n",
       "  padding-top: 2px;\n",
       "}\n",
       "\n",
       ".xr-var-item > .xr-var-name:hover span {\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-var-list > li:nth-child(odd) > div,\n",
       ".xr-var-list > li:nth-child(odd) > label,\n",
       ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-odd);\n",
       "  border-color: var(--xr-background-color-row-even);\n",
       "}\n",
       "\n",
       ".xr-var-name {\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-var-dims {\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-var-dtype {\n",
       "  grid-column: 3;\n",
       "  text-align: right;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-preview {\n",
       "  grid-column: 4;\n",
       "}\n",
       "\n",
       ".xr-index-preview {\n",
       "  grid-column: 2 / 5;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-name,\n",
       ".xr-var-dims,\n",
       ".xr-var-dtype,\n",
       ".xr-preview,\n",
       ".xr-attrs dt {\n",
       "  white-space: nowrap;\n",
       "  overflow: hidden;\n",
       "  text-overflow: ellipsis;\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-var-name:hover,\n",
       ".xr-var-dims:hover,\n",
       ".xr-var-dtype:hover,\n",
       ".xr-attrs dt:hover {\n",
       "  overflow: visible;\n",
       "  width: auto;\n",
       "  z-index: 1;\n",
       "}\n",
       "\n",
       ".xr-var-attrs,\n",
       ".xr-var-data,\n",
       ".xr-index-data {\n",
       "  display: none;\n",
       "  border-top: 2px dotted var(--xr-background-color);\n",
       "  padding-bottom: 20px !important;\n",
       "  padding-top: 10px !important;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in + label,\n",
       ".xr-var-data-in + label,\n",
       ".xr-index-data-in + label {\n",
       "  padding: 0 1px;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
       ".xr-var-data-in:checked ~ .xr-var-data,\n",
       ".xr-index-data-in:checked ~ .xr-index-data {\n",
       "  display: block;\n",
       "}\n",
       "\n",
       ".xr-var-data > table {\n",
       "  float: right;\n",
       "}\n",
       "\n",
       ".xr-var-data > pre,\n",
       ".xr-index-data > pre,\n",
       ".xr-var-data > table > tbody > tr {\n",
       "  background-color: transparent !important;\n",
       "}\n",
       "\n",
       ".xr-var-name span,\n",
       ".xr-var-data,\n",
       ".xr-index-name div,\n",
       ".xr-index-data,\n",
       ".xr-attrs {\n",
       "  padding-left: 25px !important;\n",
       "}\n",
       "\n",
       ".xr-attrs,\n",
       ".xr-var-attrs,\n",
       ".xr-var-data,\n",
       ".xr-index-data {\n",
       "  grid-column: 1 / -1;\n",
       "}\n",
       "\n",
       "dl.xr-attrs {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  display: grid;\n",
       "  grid-template-columns: 125px auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt,\n",
       ".xr-attrs dd {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  float: left;\n",
       "  padding-right: 10px;\n",
       "  width: auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt {\n",
       "  font-weight: normal;\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-attrs dt:hover span {\n",
       "  display: inline-block;\n",
       "  background: var(--xr-background-color);\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-attrs dd {\n",
       "  grid-column: 2;\n",
       "  white-space: pre-wrap;\n",
       "  word-break: break-all;\n",
       "}\n",
       "\n",
       ".xr-icon-database,\n",
       ".xr-icon-file-text2,\n",
       ".xr-no-icon {\n",
       "  display: inline-block;\n",
       "  vertical-align: middle;\n",
       "  width: 1em;\n",
       "  height: 1.5em !important;\n",
       "  stroke-width: 0;\n",
       "  stroke: currentColor;\n",
       "  fill: currentColor;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in:checked + label > .xr-icon-file-text2,\n",
       ".xr-var-data-in:checked + label > .xr-icon-database,\n",
       ".xr-index-data-in:checked + label > .xr-icon-database {\n",
       "  color: var(--xr-font-color0);\n",
       "  filter: drop-shadow(1px 1px 5px var(--xr-font-color2));\n",
       "  stroke-width: 0.8px;\n",
       "}\n",
       "</style><pre class='xr-text-repr-fallback'>&lt;xarray.DataArray &#x27;band&#x27; (band: 3)&gt; Size: 36B\n",
       "array([&#x27;A40&#x27;, &#x27;A50&#x27;, &#x27;A48&#x27;], dtype=&#x27;&lt;U3&#x27;)\n",
       "Coordinates:\n",
       "  * band     (band) &lt;U3 36B &#x27;A40&#x27; &#x27;A50&#x27; &#x27;A48&#x27;\n",
       "    agg      &lt;U6 24B &#x27;mean&#x27;</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-obj-name'>&#x27;band&#x27;</div><ul class='xr-dim-list'><li><span class='xr-has-index'>band</span>: 3</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-f1b63836-b2c5-4c58-a2b3-96930a1ccaca' class='xr-array-in' type='checkbox' checked><label for='section-f1b63836-b2c5-4c58-a2b3-96930a1ccaca' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>&#x27;A40&#x27; &#x27;A50&#x27; &#x27;A48&#x27;</span></div><div class='xr-array-data'><pre>array([&#x27;A40&#x27;, &#x27;A50&#x27;, &#x27;A48&#x27;], dtype=&#x27;&lt;U3&#x27;)</pre></div></div></li><li class='xr-section-item'><input id='section-43a96ea5-cf0f-40f3-be7e-dacb44557a77' class='xr-section-summary-in' type='checkbox'  checked><label for='section-43a96ea5-cf0f-40f3-be7e-dacb44557a77' class='xr-section-summary' >Coordinates: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>band</span></div><div class='xr-var-dims'>(band)</div><div class='xr-var-dtype'>&lt;U3</div><div class='xr-var-preview xr-preview'>&#x27;A40&#x27; &#x27;A50&#x27; &#x27;A48&#x27;</div><input id='attrs-2ae67c08-bbf8-45f7-922d-3b72232f025f' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-2ae67c08-bbf8-45f7-922d-3b72232f025f' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b7d55b91-5dc0-4a23-a349-39fccff77645' class='xr-var-data-in' type='checkbox'><label for='data-b7d55b91-5dc0-4a23-a349-39fccff77645' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([&#x27;A40&#x27;, &#x27;A50&#x27;, &#x27;A48&#x27;], dtype=&#x27;&lt;U3&#x27;)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>agg</span></div><div class='xr-var-dims'>()</div><div class='xr-var-dtype'>&lt;U6</div><div class='xr-var-preview xr-preview'>&#x27;mean&#x27;</div><input id='attrs-d2d9b762-1caf-440b-a541-b2faec1f0d0d' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-d2d9b762-1caf-440b-a541-b2faec1f0d0d' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-3d402e48-8643-4566-8767-f32736018bd5' class='xr-var-data-in' type='checkbox'><label for='data-3d402e48-8643-4566-8767-f32736018bd5' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(&#x27;mean&#x27;, dtype=&#x27;&lt;U6&#x27;)</pre></div></li></ul></div></li></ul></div></div>"
      ],
      "text/plain": [
       "\n",
       "\u001b[1m<\u001b[0m\u001b[1;95mxarray.DataArray\u001b[0m\u001b[39m \u001b[0m\u001b[32m'band'\u001b[0m\u001b[39m \u001b[0m\u001b[1;39m(\u001b[0m\u001b[39mband: \u001b[0m\u001b[1;36m3\u001b[0m\u001b[1;39m)\u001b[0m\u001b[1m>\u001b[0m Size: 36B\n",
       "\u001b[1;35marray\u001b[0m\u001b[1m(\u001b[0m\u001b[1m[\u001b[0m\u001b[32m'A40'\u001b[0m, \u001b[32m'A50'\u001b[0m, \u001b[32m'A48'\u001b[0m\u001b[1m]\u001b[0m, \u001b[33mdtype\u001b[0m=\u001b[32m'<U3'\u001b[0m\u001b[1m)\u001b[0m\n",
       "Coordinates:\n",
       "  * band     \u001b[1m(\u001b[0mband\u001b[1m)\u001b[0m <U3 36B \u001b[32m'A40'\u001b[0m \u001b[32m'A50'\u001b[0m \u001b[32m'A48'\u001b[0m\n",
       "    agg      <U6 24B \u001b[32m'mean'\u001b[0m"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Calculate the variance per band and sort by variance\n",
    "emb_vars = ds[\"embeddings\"].sel(agg=\"mean\").var(dim=[\"cell_ids\"]).compute()\n",
    "emb_vars.sortby(emb_vars, ascending=False)[\"band\"][:3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8788390f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/raid/scratch/tohoel001/repositories/entropice/.pixi/envs/default/lib/python3.13/site-packages/matplotlib/colors.py:796: RuntimeWarning: invalid value encountered in cast\n",
      "  lut = (lut * 255).astype(np.uint8)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAGHRFWHRUaXRsZQBmcm9tX2xpc3QgY29sb3JtYXBDL89FAAAAHnRFWHREZXNjcmlwdGlvbgBmcm9tX2xpc3QgY29sb3JtYXABtCnOAAAAMXRFWHRBdXRob3IATWF0cGxvdGxpYiB2My4xMC44LCBodHRwczovL21hdHBsb3RsaWIub3Jnn5xdsQAAADN0RVh0U29mdHdhcmUATWF0cGxvdGxpYiB2My4xMC44LCBodHRwczovL21hdHBsb3RsaWIub3JnOrhORQAAB8lJREFUeJzt1stuXHcBx/HvOXPO3O+e8TV2mjRNnDqXXkQpVaACtRUb1A1dFAkWPABLXoE17MoKCbECKlAXlUrpVQXaUNoqUZzYcVzb8Uziscee8VzO/fAg/9/nKT7WX3//y3T/JORXv/4jf//t6+yvzrC4M+bmsEG24VI8PiA+WyUs5HjGCbGsADt2SC2Xaf8huVFExbWInDzNicdxMcHyLRhFdL+3Qn5/jFUtkPN9pmkRrxoQWBHz4yKeA4k3xs1k8O9NyZ/G4HpEjk08ickvVjk3OGWvn6X7chmvViPyjgmHDq1Hh3TOrFLr3QfHwWq2SUsOJ16OxrTHqNggdlIaDHk0adMc3cfKFjiptnn64JiThTzV05Dd7Czj0KFY2WM6OUOj+zml1UuEvsXhpEbWCZn/8DZxlONHbR8/THk77/KDzpRJpoBjp/TKOW7MTpk4CfUA1ncsRkED6j4HZOhUbK4/jEkSF9uOiOKUO40bhFGEVzrlSuUWLychX3UC2pWINLL4+kyZ0jTLexsv0j2bYI1DLhX2Od26xrYbU53dgodP8iBaxa4e0by1SvrS5xQqQ7LZMdubl6gvbRON67y88B++zSzxcO8sV6L7ZLYvcvfKMeG9c1yu3Cf54YS22+fjk6cpZmIW80NOKHEuv0PPn2VYiLlR7DNnDxiPhthpQjFfpFeqsTAcMy7m6XkJf+m+wNPVA/YmZY7DInV3iItFNeeRTSJ2aPNCYZdGxiPHhI3gDK4NC24fL0rIZQo8irLsxWUWK0MycYZ/7V5gudVlPGhQqPnMpGM2BnO8sfJvXDcmIstx6lANE3zrlKJTIkzz+BmLd28+S3XuiGl/iFVvEQ7K5BohQRSRz4fMzkHmts9S/2OO51+idlojl0tI6x/Rca9yuTrm5IMhp2GVdvUWp60yyaBO0zmE3TdxFxyS0k12dxqs/ewBlhvh+Sn/O1jF6d/BLeVYG29y7C0wPD+D2x9yzh0QLVQI9qBQTqh4A8Jyg+zBLk67Rb/kkp5Y5Cop9sjineg5WpVdSKskcYkMXTqjFYJxk6dWbpGpRWwcXOBMdZv+eB7LiXm1cId3B99hPJil2n5Ar3uR1eZdTkshP/3vZyTnywzGTRqzY7j5iGbL5dtSgyDK0pxJAJck7zO0bepBxGkaU8o4/OaTXzDxXTL1CfPTHL1cRDR1cK2QsBIyf1ijfHmdIMhxfX6f9769yPWVDltHs7zSuksum/D2g6uszkXU8gnjxOVc4YSvNheolD0qTZsv7pdw7BAnn9J+oktw2GSnUyaxIxZnPZZsm8neZ+zffYPpcpdpd5Fsa0jmuE6S6ZFfPqTZ81l78YB8MOYf3WsE0xpn5na5OLvPVidPf7RC6+F5nFJI+4mUo6OE/nqDgxjKDZ/r5SKbN24SWTZ2mGNwus7y9afY3bZ5fv4++0eL4MaEdkLO9Zj6M5QbCe3LB8RTyG702Zosc7Z2wt4HLfZmsizVd7n2/lm+uXKXlu+zvtTiyicXefz8h+zWruMUa7z5/S+4ffgkX30Z83pji0GhzML2kIPFBQI7y1pzAytM6MYV8mmG5dyAdb9E6tsEdpFqcchqGBO6U+xJwsSF92/XCSy4vp5y2Ew4WGpguTFWMKHhDIkmLs2lMv6RR6m1Sqfn0G4ckIsOGHozkLVw3YTGtMsws0w27hEXz1Cd7vCYOZxkTO3sRTp7IbETEwUZLNtlPB1y1brJVu67XEi+YWxFeKUFHk7P46cxS8WIyvHX5OcvkA892oM7fJr5PjU3YKbiMQoKzOQH7J02cMoxx49dKu0QYgv8iOrmY9JijaM0z3KmRHH+NuNOCZopxUJC3e5z4tk4rkUmSPGLK+TdmCSF49OIeBeu/eEnNNeX+ebn/yT7zmt0lrs0Vr+m/Lcf41/q8cyrv+PPC69wv3QOO52w9tZVYjcgueRRPLyHv/ccyUlKIR+QpEWyz3/Kll/Dsi+zeFhjY+WI8/dypHMxvfqXOLtXCEpl5jZH9P70EeeyEzYPW6zN7ZOkAUGhgpN4dMZN5ooeTm6E4znc2V7h5CRLvTlhce0RzuEdwrt9bkfP0rSGVEpdGKRE820iZ4HRyKFZeEgtHLORPIdXdFl5dkTniyajsEQlN+LqK1tM3noNGxERETGOAiAiImIgBUBERMRACoCIiIiBFAAREREDKQAiIiIGUgBEREQMpACIiIgYSAEQERExkAIgIiJiIAVARETEQAqAiIiIgRQAERERAykAIiIiBlIAREREDKQAiIiIGEgBEBERMZACICIiYiAFQERExEAKgIiIiIEUABEREQMpACIiIgZSAERERAykAIiIiBhIARARETGQAiAiImIgBUBERMRACoCIiIiBFAAREREDKQAiIiIGUgBEREQMpACIiIgYSAEQERExkAIgIiJiIAVARETEQAqAiIiIgRQAERERAykAIiIiBlIAREREDKQAiIiIGEgBEBERMZACICIiYiAFQERExEAKgIiIiIEUABEREQMpACIiIgZSAERERAykAIiIiBhIARARETGQAiAiImIgBUBERMRACoCIiIiBFAAREREDKQAiIiIGUgBEREQMpACIiIgYSAEQERExkAIgIiJiIAVARETEQAqAiIiIgRQAERERAykAIiIiBlIAREREDPR/ZBD0TZ1B0C4AAAAASUVORK5CYII=",
      "text/html": [
       "<div style=\"vertical-align: middle;\"><strong>from_list</strong> </div><div class=\"cmap\"><img alt=\"from_list colormap\" title=\"from_list\" style=\"border: 1px solid #555;\" src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAABACAYAAABsv8+/AAAAGHRFWHRUaXRsZQBmcm9tX2xpc3QgY29sb3JtYXBDL89FAAAAHnRFWHREZXNjcmlwdGlvbgBmcm9tX2xpc3QgY29sb3JtYXABtCnOAAAAMXRFWHRBdXRob3IATWF0cGxvdGxpYiB2My4xMC44LCBodHRwczovL21hdHBsb3RsaWIub3Jnn5xdsQAAADN0RVh0U29mdHdhcmUATWF0cGxvdGxpYiB2My4xMC44LCBodHRwczovL21hdHBsb3RsaWIub3JnOrhORQAAB8lJREFUeJzt1stuXHcBx/HvOXPO3O+e8TV2mjRNnDqXXkQpVaACtRUb1A1dFAkWPABLXoE17MoKCbECKlAXlUrpVQXaUNoqUZzYcVzb8Uziscee8VzO/fAg/9/nKT7WX3//y3T/JORXv/4jf//t6+yvzrC4M+bmsEG24VI8PiA+WyUs5HjGCbGsADt2SC2Xaf8huVFExbWInDzNicdxMcHyLRhFdL+3Qn5/jFUtkPN9pmkRrxoQWBHz4yKeA4k3xs1k8O9NyZ/G4HpEjk08ickvVjk3OGWvn6X7chmvViPyjgmHDq1Hh3TOrFLr3QfHwWq2SUsOJ16OxrTHqNggdlIaDHk0adMc3cfKFjiptnn64JiThTzV05Dd7Czj0KFY2WM6OUOj+zml1UuEvsXhpEbWCZn/8DZxlONHbR8/THk77/KDzpRJpoBjp/TKOW7MTpk4CfUA1ncsRkED6j4HZOhUbK4/jEkSF9uOiOKUO40bhFGEVzrlSuUWLychX3UC2pWINLL4+kyZ0jTLexsv0j2bYI1DLhX2Od26xrYbU53dgodP8iBaxa4e0by1SvrS5xQqQ7LZMdubl6gvbRON67y88B++zSzxcO8sV6L7ZLYvcvfKMeG9c1yu3Cf54YS22+fjk6cpZmIW80NOKHEuv0PPn2VYiLlR7DNnDxiPhthpQjFfpFeqsTAcMy7m6XkJf+m+wNPVA/YmZY7DInV3iItFNeeRTSJ2aPNCYZdGxiPHhI3gDK4NC24fL0rIZQo8irLsxWUWK0MycYZ/7V5gudVlPGhQqPnMpGM2BnO8sfJvXDcmIstx6lANE3zrlKJTIkzz+BmLd28+S3XuiGl/iFVvEQ7K5BohQRSRz4fMzkHmts9S/2OO51+idlojl0tI6x/Rca9yuTrm5IMhp2GVdvUWp60yyaBO0zmE3TdxFxyS0k12dxqs/ewBlhvh+Sn/O1jF6d/BLeVYG29y7C0wPD+D2x9yzh0QLVQI9qBQTqh4A8Jyg+zBLk67Rb/kkp5Y5Cop9sjineg5WpVdSKskcYkMXTqjFYJxk6dWbpGpRWwcXOBMdZv+eB7LiXm1cId3B99hPJil2n5Ar3uR1eZdTkshP/3vZyTnywzGTRqzY7j5iGbL5dtSgyDK0pxJAJck7zO0bepBxGkaU8o4/OaTXzDxXTL1CfPTHL1cRDR1cK2QsBIyf1ijfHmdIMhxfX6f9769yPWVDltHs7zSuksum/D2g6uszkXU8gnjxOVc4YSvNheolD0qTZsv7pdw7BAnn9J+oktw2GSnUyaxIxZnPZZsm8neZ+zffYPpcpdpd5Fsa0jmuE6S6ZFfPqTZ81l78YB8MOYf3WsE0xpn5na5OLvPVidPf7RC6+F5nFJI+4mUo6OE/nqDgxjKDZ/r5SKbN24SWTZ2mGNwus7y9afY3bZ5fv4++0eL4MaEdkLO9Zj6M5QbCe3LB8RTyG702Zosc7Z2wt4HLfZmsizVd7n2/lm+uXKXlu+zvtTiyicXefz8h+zWruMUa7z5/S+4ffgkX30Z83pji0GhzML2kIPFBQI7y1pzAytM6MYV8mmG5dyAdb9E6tsEdpFqcchqGBO6U+xJwsSF92/XCSy4vp5y2Ew4WGpguTFWMKHhDIkmLs2lMv6RR6m1Sqfn0G4ckIsOGHozkLVw3YTGtMsws0w27hEXz1Cd7vCYOZxkTO3sRTp7IbETEwUZLNtlPB1y1brJVu67XEi+YWxFeKUFHk7P46cxS8WIyvHX5OcvkA892oM7fJr5PjU3YKbiMQoKzOQH7J02cMoxx49dKu0QYgv8iOrmY9JijaM0z3KmRHH+NuNOCZopxUJC3e5z4tk4rkUmSPGLK+TdmCSF49OIeBeu/eEnNNeX+ebn/yT7zmt0lrs0Vr+m/Lcf41/q8cyrv+PPC69wv3QOO52w9tZVYjcgueRRPLyHv/ccyUlKIR+QpEWyz3/Kll/Dsi+zeFhjY+WI8/dypHMxvfqXOLtXCEpl5jZH9P70EeeyEzYPW6zN7ZOkAUGhgpN4dMZN5ooeTm6E4znc2V7h5CRLvTlhce0RzuEdwrt9bkfP0rSGVEpdGKRE820iZ4HRyKFZeEgtHLORPIdXdFl5dkTniyajsEQlN+LqK1tM3noNGxERETGOAiAiImIgBUBERMRACoCIiIiBFAAREREDKQAiIiIGUgBEREQMpACIiIgYSAEQERExkAIgIiJiIAVARETEQAqAiIiIgRQAERERAykAIiIiBlIAREREDKQAiIiIGEgBEBERMZACICIiYiAFQERExEAKgIiIiIEUABEREQMpACIiIgZSAERERAykAIiIiBhIARARETGQAiAiImIgBUBERMRACoCIiIiBFAAREREDKQAiIiIGUgBEREQMpACIiIgYSAEQERExkAIgIiJiIAVARETEQAqAiIiIgRQAERERAykAIiIiBlIAREREDKQAiIiIGEgBEBERMZACICIiYiAFQERExEAKgIiIiIEUABEREQMpACIiIgZSAERERAykAIiIiBhIARARETGQAiAiImIgBUBERMRACoCIiIiBFAAREREDKQAiIiIGUgBEREQMpACIiIgYSAEQERExkAIgIiJiIAVARETEQAqAiIiIgRQAERERAykAIiIiBlIAREREDPR/ZBD0TZ1B0C4AAAAASUVORK5CYII=\"></div><div style=\"vertical-align: middle; max-width: 514px; display: flex; justify-content: space-between;\"><div style=\"float: left;\"><div title=\"#ae9a63ff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #ae9a63ff;\"></div> under</div><div style=\"margin: 0 auto; display: inline-block;\">bad <div title=\"#00000000\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #00000000;\"></div></div><div style=\"float: right;\">over <div title=\"#6590bcff\" style=\"display: inline-block; width: 1em; height: 1em; margin: 0; vertical-align: middle; border: 1px solid #555; background-color: #6590bcff;\"></div></div></div>"
      ],
      "text/plain": [
       "\u001b[1m<\u001b[0m\u001b[1;95mmatplotlib.colors.ListedColormap\u001b[0m\u001b[39m object at \u001b[0m\u001b[1;36m0x7f8d7b413e90\u001b[0m\u001b[1m>\u001b[0m"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bands = [\"A40\", \"A50\", \"A48\"]\n",
    "# use the values from these bands as rgb values\n",
    "vals = ds[\"embeddings\"].sel(agg=\"mean\", band=bands)\n",
    "rgb = (vals - vals.min()) / (vals.max() - vals.min())\n",
    "rgb = np.clip(rgb, 0, 1)  # Ensure values are between 0 and 1\n",
    "# Make it a list of tuple for easier plotting with geopandas\n",
    "rgb = list(zip(rgb.sel(band=bands[0]).values, rgb.sel(band=bands[1]).values, rgb.sel(band=bands[2]).values))\n",
    "# Turn into a matplotlib colormap\n",
    "rgb_cmap = matplotlib.colors.ListedColormap(rgb)\n",
    "rgb_cmap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "a5b2f944",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cell_id</th>\n",
       "      <th>cell_area</th>\n",
       "      <th>geometry</th>\n",
       "      <th>water_area</th>\n",
       "      <th>land_area</th>\n",
       "      <th>land_ratio</th>\n",
       "      <th>lon</th>\n",
       "      <th>lat</th>\n",
       "      <th>x</th>\n",
       "      <th>y</th>\n",
       "      <th>rgb</th>\n",
       "      <th>embedding_index</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>830018fffffffff</td>\n",
       "      <td>12833.417730</td>\n",
       "      <td>POLYGON ((1038231.032 93001.954, 1007144.142 1...</td>\n",
       "      <td>10600.837914</td>\n",
       "      <td>2232.579815</td>\n",
       "      <td>0.173966</td>\n",
       "      <td>50.507564</td>\n",
       "      <td>81.030544</td>\n",
       "      <td>9.690891e+05</td>\n",
       "      <td>9.355845e+04</td>\n",
       "      <td>(0.68173414, 0.6040671, 0.3866055)</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>83001afffffffff</td>\n",
       "      <td>13005.383987</td>\n",
       "      <td>POLYGON ((1045152.586 212150.003, 1013846.955 ...</td>\n",
       "      <td>7494.831943</td>\n",
       "      <td>5510.552043</td>\n",
       "      <td>0.423713</td>\n",
       "      <td>57.302441</td>\n",
       "      <td>80.800738</td>\n",
       "      <td>9.756955e+05</td>\n",
       "      <td>2.128796e+05</td>\n",
       "      <td>(0.7166109, 0.59239596, 0.35612848)</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>83001cfffffffff</td>\n",
       "      <td>12607.559405</td>\n",
       "      <td>POLYGON ((1137527.559 33377.972, 1106995.284 9...</td>\n",
       "      <td>10141.598070</td>\n",
       "      <td>2465.961335</td>\n",
       "      <td>0.195594</td>\n",
       "      <td>46.807233</td>\n",
       "      <td>80.150965</td>\n",
       "      <td>1.068950e+06</td>\n",
       "      <td>3.385010e+04</td>\n",
       "      <td>(0.68763757, 0.5877886, 0.36973757)</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>83001efffffffff</td>\n",
       "      <td>12781.831078</td>\n",
       "      <td>POLYGON ((1144981.442 151688.88, 1114226.065 2...</td>\n",
       "      <td>11075.372042</td>\n",
       "      <td>1706.459036</td>\n",
       "      <td>0.133507</td>\n",
       "      <td>53.052142</td>\n",
       "      <td>79.992189</td>\n",
       "      <td>1.076090e+06</td>\n",
       "      <td>1.523424e+05</td>\n",
       "      <td>(0.6599664, 0.6199058, 0.36917266)</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>830028fffffffff</td>\n",
       "      <td>11818.417986</td>\n",
       "      <td>POLYGON ((1106470.805 -427995.192, 1076828.817...</td>\n",
       "      <td>2728.182359</td>\n",
       "      <td>9090.235627</td>\n",
       "      <td>0.769158</td>\n",
       "      <td>22.599271</td>\n",
       "      <td>79.651035</td>\n",
       "      <td>1.039234e+06</td>\n",
       "      <td>-4.282015e+05</td>\n",
       "      <td>(0.6372093, 0.51571786, 0.36767402)</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6744</th>\n",
       "      <td>8327b5fffffffff</td>\n",
       "      <td>12479.437618</td>\n",
       "      <td>POLYGON ((-3904533.281 -1950151.978, -3978391....</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>12479.437618</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>-107.935560</td>\n",
       "      <td>50.655027</td>\n",
       "      <td>-3.945988e+06</td>\n",
       "      <td>-2.016222e+06</td>\n",
       "      <td>(0.43102476, 0.96890044, 0.4562602)</td>\n",
       "      <td>2755</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6745</th>\n",
       "      <td>8327b6fffffffff</td>\n",
       "      <td>12148.179896</td>\n",
       "      <td>POLYGON ((-3999658.053 -1746829.203, -4072462....</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>12148.179896</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>-110.851573</td>\n",
       "      <td>50.673240</td>\n",
       "      <td>-4.041424e+06</td>\n",
       "      <td>-1.811968e+06</td>\n",
       "      <td>(0.5216147, 0.87333643, 0.3844854)</td>\n",
       "      <td>2756</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6917</th>\n",
       "      <td>8328dbfffffffff</td>\n",
       "      <td>10331.135948</td>\n",
       "      <td>POLYGON ((-4304632.552 -720269.778, -4372252.4...</td>\n",
       "      <td>913.035656</td>\n",
       "      <td>9418.100291</td>\n",
       "      <td>0.911623</td>\n",
       "      <td>-124.832764</td>\n",
       "      <td>50.773308</td>\n",
       "      <td>-4.347485e+06</td>\n",
       "      <td>-7.797406e+05</td>\n",
       "      <td>(0.36316758, 0.46487296, 0.52321345)</td>\n",
       "      <td>2757</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7713</th>\n",
       "      <td>832d69fffffffff</td>\n",
       "      <td>12395.223580</td>\n",
       "      <td>POLYGON ((4432070.553 -304743.386, 4485745.557...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>12395.223580</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>41.960963</td>\n",
       "      <td>50.779041</td>\n",
       "      <td>4.409985e+06</td>\n",
       "      <td>-2.341336e+05</td>\n",
       "      <td>(0.41399896, 0.60829127, 0.72497356)</td>\n",
       "      <td>2758</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7717</th>\n",
       "      <td>832d6dfffffffff</td>\n",
       "      <td>12148.179896</td>\n",
       "      <td>POLYGON ((4400410.65 -426345.057, 4453901.584 ...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>12148.179896</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>40.344328</td>\n",
       "      <td>50.967269</td>\n",
       "      <td>4.378831e+06</td>\n",
       "      <td>-3.565970e+05</td>\n",
       "      <td>(0.39552975, 0.56525517, 0.7373371)</td>\n",
       "      <td>2759</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2760 rows × 12 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "\n",
       "              cell_id     cell_area  \\\n",
       "\u001b[1;36m21\u001b[0m    830018fffffffff  \u001b[1;36m12833.417730\u001b[0m   \n",
       "\u001b[1;36m23\u001b[0m    83001afffffffff  \u001b[1;36m13005.383987\u001b[0m   \n",
       "\u001b[1;36m25\u001b[0m    83001cfffffffff  \u001b[1;36m12607.559405\u001b[0m   \n",
       "\u001b[1;36m27\u001b[0m    83001efffffffff  \u001b[1;36m12781.831078\u001b[0m   \n",
       "\u001b[1;36m35\u001b[0m    830028fffffffff  \u001b[1;36m11818.417986\u001b[0m   \n",
       "\u001b[33m...\u001b[0m               \u001b[33m...\u001b[0m           \u001b[33m...\u001b[0m   \n",
       "\u001b[1;36m6744\u001b[0m  8327b5fffffffff  \u001b[1;36m12479.437618\u001b[0m   \n",
       "\u001b[1;36m6745\u001b[0m  8327b6fffffffff  \u001b[1;36m12148.179896\u001b[0m   \n",
       "\u001b[1;36m6917\u001b[0m  8328dbfffffffff  \u001b[1;36m10331.135948\u001b[0m   \n",
       "\u001b[1;36m7713\u001b[0m  832d69fffffffff  \u001b[1;36m12395.223580\u001b[0m   \n",
       "\u001b[1;36m7717\u001b[0m  832d6dfffffffff  \u001b[1;36m12148.179896\u001b[0m   \n",
       "\n",
       "                                               geometry    water_area  \\\n",
       "\u001b[1;36m21\u001b[0m    POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m1038231.032\u001b[0m \u001b[1;36m93001.954\u001b[0m, \u001b[1;36m1007144.142\u001b[0m \u001b[1;36m1\u001b[0m\u001b[33m...\u001b[0m  \u001b[1;36m10600.837914\u001b[0m   \n",
       "\u001b[1;36m23\u001b[0m    POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m1045152.586\u001b[0m \u001b[1;36m212150.003\u001b[0m, \u001b[1;36m1013846.955\u001b[0m \u001b[33m...\u001b[0m   \u001b[1;36m7494.831943\u001b[0m   \n",
       "\u001b[1;36m25\u001b[0m    POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m1137527.559\u001b[0m \u001b[1;36m33377.972\u001b[0m, \u001b[1;36m1106995.284\u001b[0m \u001b[1;36m9\u001b[0m\u001b[33m...\u001b[0m  \u001b[1;36m10141.598070\u001b[0m   \n",
       "\u001b[1;36m27\u001b[0m    POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m1144981.442\u001b[0m \u001b[1;36m151688.88\u001b[0m, \u001b[1;36m1114226.065\u001b[0m \u001b[1;36m2\u001b[0m\u001b[33m...\u001b[0m  \u001b[1;36m11075.372042\u001b[0m   \n",
       "\u001b[1;36m35\u001b[0m    POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m1106470.805\u001b[0m \u001b[1;36m-427995.192\u001b[0m, \u001b[1;36m1076828.817\u001b[0m\u001b[33m...\u001b[0m   \u001b[1;36m2728.182359\u001b[0m   \n",
       "\u001b[33m...\u001b[0m                                                 \u001b[33m...\u001b[0m           \u001b[33m...\u001b[0m   \n",
       "\u001b[1;36m6744\u001b[0m  POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m-3904533.281\u001b[0m \u001b[1;36m-1950151.978\u001b[0m, \u001b[1;36m-3978391\u001b[0m\u001b[33m...\u001b[0m.      \u001b[1;36m0.000000\u001b[0m   \n",
       "\u001b[1;36m6745\u001b[0m  POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m-3999658.053\u001b[0m \u001b[1;36m-1746829.203\u001b[0m, \u001b[1;36m-4072462\u001b[0m\u001b[33m...\u001b[0m.      \u001b[1;36m0.000000\u001b[0m   \n",
       "\u001b[1;36m6917\u001b[0m  POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m-4304632.552\u001b[0m \u001b[1;36m-720269.778\u001b[0m, \u001b[1;36m-4372252.4\u001b[0m\u001b[33m...\u001b[0m    \u001b[1;36m913.035656\u001b[0m   \n",
       "\u001b[1;36m7713\u001b[0m  POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m4432070.553\u001b[0m \u001b[1;36m-304743.386\u001b[0m, \u001b[1;36m4485745.557\u001b[0m\u001b[33m...\u001b[0m      \u001b[1;36m0.000000\u001b[0m   \n",
       "\u001b[1;36m7717\u001b[0m  POLYGON \u001b[1m(\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m4400410.65\u001b[0m \u001b[1;36m-426345.057\u001b[0m, \u001b[1;36m4453901.584\u001b[0m \u001b[33m...\u001b[0m      \u001b[1;36m0.000000\u001b[0m   \n",
       "\n",
       "         land_area  land_ratio         lon        lat             x  \\\n",
       "\u001b[1;36m21\u001b[0m     \u001b[1;36m2232.579815\u001b[0m    \u001b[1;36m0.173966\u001b[0m   \u001b[1;36m50.507564\u001b[0m  \u001b[1;36m81.030544\u001b[0m  \u001b[1;36m9.690891e+05\u001b[0m   \n",
       "\u001b[1;36m23\u001b[0m     \u001b[1;36m5510.552043\u001b[0m    \u001b[1;36m0.423713\u001b[0m   \u001b[1;36m57.302441\u001b[0m  \u001b[1;36m80.800738\u001b[0m  \u001b[1;36m9.756955e+05\u001b[0m   \n",
       "\u001b[1;36m25\u001b[0m     \u001b[1;36m2465.961335\u001b[0m    \u001b[1;36m0.195594\u001b[0m   \u001b[1;36m46.807233\u001b[0m  \u001b[1;36m80.150965\u001b[0m  \u001b[1;36m1.068950e+06\u001b[0m   \n",
       "\u001b[1;36m27\u001b[0m     \u001b[1;36m1706.459036\u001b[0m    \u001b[1;36m0.133507\u001b[0m   \u001b[1;36m53.052142\u001b[0m  \u001b[1;36m79.992189\u001b[0m  \u001b[1;36m1.076090e+06\u001b[0m   \n",
       "\u001b[1;36m35\u001b[0m     \u001b[1;36m9090.235627\u001b[0m    \u001b[1;36m0.769158\u001b[0m   \u001b[1;36m22.599271\u001b[0m  \u001b[1;36m79.651035\u001b[0m  \u001b[1;36m1.039234e+06\u001b[0m   \n",
       "\u001b[33m...\u001b[0m            \u001b[33m...\u001b[0m         \u001b[33m...\u001b[0m         \u001b[33m...\u001b[0m        \u001b[33m...\u001b[0m           \u001b[33m...\u001b[0m   \n",
       "\u001b[1;36m6744\u001b[0m  \u001b[1;36m12479.437618\u001b[0m    \u001b[1;36m1.000000\u001b[0m \u001b[1;36m-107.935560\u001b[0m  \u001b[1;36m50.655027\u001b[0m \u001b[1;36m-3.945988e+06\u001b[0m   \n",
       "\u001b[1;36m6745\u001b[0m  \u001b[1;36m12148.179896\u001b[0m    \u001b[1;36m1.000000\u001b[0m \u001b[1;36m-110.851573\u001b[0m  \u001b[1;36m50.673240\u001b[0m \u001b[1;36m-4.041424e+06\u001b[0m   \n",
       "\u001b[1;36m6917\u001b[0m   \u001b[1;36m9418.100291\u001b[0m    \u001b[1;36m0.911623\u001b[0m \u001b[1;36m-124.832764\u001b[0m  \u001b[1;36m50.773308\u001b[0m \u001b[1;36m-4.347485e+06\u001b[0m   \n",
       "\u001b[1;36m7713\u001b[0m  \u001b[1;36m12395.223580\u001b[0m    \u001b[1;36m1.000000\u001b[0m   \u001b[1;36m41.960963\u001b[0m  \u001b[1;36m50.779041\u001b[0m  \u001b[1;36m4.409985e+06\u001b[0m   \n",
       "\u001b[1;36m7717\u001b[0m  \u001b[1;36m12148.179896\u001b[0m    \u001b[1;36m1.000000\u001b[0m   \u001b[1;36m40.344328\u001b[0m  \u001b[1;36m50.967269\u001b[0m  \u001b[1;36m4.378831e+06\u001b[0m   \n",
       "\n",
       "                 y                                   rgb  embedding_index  \n",
       "\u001b[1;36m21\u001b[0m    \u001b[1;36m9.355845e+04\u001b[0m    \u001b[1m(\u001b[0m\u001b[1;36m0.68173414\u001b[0m, \u001b[1;36m0.6040671\u001b[0m, \u001b[1;36m0.3866055\u001b[0m\u001b[1m)\u001b[0m                \u001b[1;36m0\u001b[0m  \n",
       "\u001b[1;36m23\u001b[0m    \u001b[1;36m2.128796e+05\u001b[0m   \u001b[1m(\u001b[0m\u001b[1;36m0.7166109\u001b[0m, \u001b[1;36m0.59239596\u001b[0m, \u001b[1;36m0.35612848\u001b[0m\u001b[1m)\u001b[0m                \u001b[1;36m1\u001b[0m  \n",
       "\u001b[1;36m25\u001b[0m    \u001b[1;36m3.385010e+04\u001b[0m   \u001b[1m(\u001b[0m\u001b[1;36m0.68763757\u001b[0m, \u001b[1;36m0.5877886\u001b[0m, \u001b[1;36m0.36973757\u001b[0m\u001b[1m)\u001b[0m                \u001b[1;36m2\u001b[0m  \n",
       "\u001b[1;36m27\u001b[0m    \u001b[1;36m1.523424e+05\u001b[0m    \u001b[1m(\u001b[0m\u001b[1;36m0.6599664\u001b[0m, \u001b[1;36m0.6199058\u001b[0m, \u001b[1;36m0.36917266\u001b[0m\u001b[1m)\u001b[0m                \u001b[1;36m3\u001b[0m  \n",
       "\u001b[1;36m35\u001b[0m   \u001b[1;36m-4.282015e+05\u001b[0m   \u001b[1m(\u001b[0m\u001b[1;36m0.6372093\u001b[0m, \u001b[1;36m0.51571786\u001b[0m, \u001b[1;36m0.36767402\u001b[0m\u001b[1m)\u001b[0m                \u001b[1;36m4\u001b[0m  \n",
       "\u001b[33m...\u001b[0m            \u001b[33m...\u001b[0m                                   \u001b[33m...\u001b[0m              \u001b[33m...\u001b[0m  \n",
       "\u001b[1;36m6744\u001b[0m \u001b[1;36m-2.016222e+06\u001b[0m   \u001b[1m(\u001b[0m\u001b[1;36m0.43102476\u001b[0m, \u001b[1;36m0.96890044\u001b[0m, \u001b[1;36m0.4562602\u001b[0m\u001b[1m)\u001b[0m             \u001b[1;36m2755\u001b[0m  \n",
       "\u001b[1;36m6745\u001b[0m \u001b[1;36m-1.811968e+06\u001b[0m    \u001b[1m(\u001b[0m\u001b[1;36m0.5216147\u001b[0m, \u001b[1;36m0.87333643\u001b[0m, \u001b[1;36m0.3844854\u001b[0m\u001b[1m)\u001b[0m             \u001b[1;36m2756\u001b[0m  \n",
       "\u001b[1;36m6917\u001b[0m \u001b[1;36m-7.797406e+05\u001b[0m  \u001b[1m(\u001b[0m\u001b[1;36m0.36316758\u001b[0m, \u001b[1;36m0.46487296\u001b[0m, \u001b[1;36m0.52321345\u001b[0m\u001b[1m)\u001b[0m             \u001b[1;36m2757\u001b[0m  \n",
       "\u001b[1;36m7713\u001b[0m \u001b[1;36m-2.341336e+05\u001b[0m  \u001b[1m(\u001b[0m\u001b[1;36m0.41399896\u001b[0m, \u001b[1;36m0.60829127\u001b[0m, \u001b[1;36m0.72497356\u001b[0m\u001b[1m)\u001b[0m             \u001b[1;36m2758\u001b[0m  \n",
       "\u001b[1;36m7717\u001b[0m \u001b[1;36m-3.565970e+05\u001b[0m   \u001b[1m(\u001b[0m\u001b[1;36m0.39552975\u001b[0m, \u001b[1;36m0.56525517\u001b[0m, \u001b[1;36m0.7373371\u001b[0m\u001b[1m)\u001b[0m             \u001b[1;36m2759\u001b[0m  \n",
       "\n",
       "\u001b[1m[\u001b[0m\u001b[1;36m2760\u001b[0m rows x \u001b[1;36m12\u001b[0m columns\u001b[1m]\u001b[0m"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Convert the ds cell ids to hex strings to match the grid_gdf cell ids\n",
    "ds_cell_ids = [str(hex(cell_id))[2:] for cell_id in ds[\"cell_ids\"].values]\n",
    "# Map the cell ids of the grid_gdf to the corresponding index in the ds embeddings\n",
    "cell_id_to_index = {cell_id: idx for idx, cell_id in enumerate(ds_cell_ids)}\n",
    "grid_gdf[\"embedding_index\"] = grid_gdf[\"cell_id\"].map(cell_id_to_index)\n",
    "grid_gdf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "ed0460f1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "\u001b[1m<\u001b[0m\u001b[1;95mAxes:\u001b[0m\u001b[39m \u001b[0m\u001b[1m>\u001b[0m"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 165268 characters]",
      "text/plain": [
       "\u001b[1m<\u001b[0m\u001b[1;95mFigure\u001b[0m\u001b[39m size 64\u001b[0m\u001b[1;36m0x480\u001b[0m\u001b[39m with \u001b[0m\u001b[1;36m1\u001b[0m\u001b[39m Axes\u001b[0m\u001b[1m>\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "grid_gdf.plot(\n",
    "    column=\"embedding_index\",\n",
    "    cmap=rgb_cmap,\n",
    "    edgecolor=\"none\",\n",
    "    linewidth=0,\n",
    "    alpha=0.8,\n",
    "    legend=False,\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "140591d1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "\u001b[1m<\u001b[0m\u001b[1;95mGeoAxes:\u001b[0m\u001b[39m \u001b[0m\u001b[1m>\u001b[0m"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
      ],
      "text/plain": []
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "[encoded data, 599068 characters]",
      "text/plain": [
       "\u001b[1m<\u001b[0m\u001b[1;95mFigure\u001b[0m\u001b[39m size 100\u001b[0m\u001b[1;36m0x1000\u001b[0m\u001b[39m with \u001b[0m\u001b[1;36m1\u001b[0m\u001b[39m Axes\u001b[0m\u001b[1m>\u001b[0m"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Default to light theme\n",
    "figcolor = \"#ffffff\"\n",
    "axcolor = \"#ffffff\"\n",
    "oceancolor = \"#e3f2fd\"\n",
    "landcolor = \"#ecf0f1\"\n",
    "gridcolor = \"#666666\"\n",
    "fgcolor = \"#2c3e50\"\n",
    "coastcolor = \"#34495e\"\n",
    "\n",
    "# Create North Polar Stereographic projection matching EPSG:3413\n",
    "# EPSG:3413: WGS 84 / NSIDC Sea Ice Polar Stereographic North\n",
    "data_crs = ccrs.Stereographic(central_latitude=90, central_longitude=-45, true_scale_latitude=70)\n",
    "\n",
    "\n",
    "fig, ax = plt.subplots(figsize=(10, 10), facecolor=figcolor, subplot_kw={\"projection\": data_crs})\n",
    "\n",
    "# Add cartographic features to DEM\n",
    "# ax.add_feature(cfeature.OCEAN, facecolor=\"#f3f3f3\", zorder=0)\n",
    "# ax.add_feature(cfeature.LAND, facecolor=\"#f3f3f3\", zorder=1)\n",
    "ax.stock_img()\n",
    "ax.add_feature(cfeature.COASTLINE, edgecolor=coastcolor, linewidth=0.8, zorder=4)\n",
    "ax.add_feature(cfeature.BORDERS, edgecolor=coastcolor, linewidth=0.5, linestyle=\":\", zorder=4)\n",
    "\n",
    "# Add gridlines\n",
    "ax.gridlines(draw_labels=True, linewidth=0.5, color=gridcolor, alpha=0.5, linestyle=\"-\", zorder=4)\n",
    "\n",
    "# Set map extent\n",
    "ax.set_extent([-180, 180, 57, 90], crs=ccrs.PlateCarree())\n",
    "\n",
    "# Compute a circle in axes coordinates, which we can use as a boundary\n",
    "# for the map. We can pan/zoom as much as we like - the boundary will be\n",
    "# permanently circular.\n",
    "theta = np.linspace(0, 2 * np.pi, 100)\n",
    "center, radius = [0.5, 0.5], 0.5\n",
    "verts = np.vstack([np.sin(theta), np.cos(theta)]).T\n",
    "circle = mpath.Path(verts * radius + center)\n",
    "ax.set_boundary(circle, transform=ax.transAxes)\n",
    "\n",
    "# Draw a black border around the map for better visibility\n",
    "ax.add_patch(\n",
    "    plt.Circle((0.5, 0.5), 0.5, transform=ax.transAxes, fill=False, edgecolor=\"black\", linewidth=1.5, zorder=4)\n",
    ")\n",
    "\n",
    "# Plot predictions\n",
    "grid_gdf.to_crs(\"epsg:3413\").plot(\n",
    "    column=\"embedding_index\", ax=ax, transform=data_crs, cmap=rgb_cmap, edgecolor=\"none\", linewidth=0, legend=False\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ecb1339b",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "default",
   "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.13.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
