{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f5a936e0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Looking in indexes: https://test.pypi.org/simple/\n",
      "Collecting dggal==0.0.7rc1\n",
      "  Using cached https://test-files.pythonhosted.org/packages/41/3c/a5dea86b4bd5b9fc0a3b1f2ca009201064ffdf2ffbec473f2591219bb8a1/dggal-0.0.7rc1-cp313-cp313-win_amd64.whl.metadata (34 kB)\n",
      "Collecting ecrt>=0.0.7rc1 (from dggal==0.0.7rc1)\n",
      "  Using cached https://test-files.pythonhosted.org/packages/87/29/4c6fac8af80a3d5c0a4ace6e5710c145417170e3dee38475c740f69d02fe/ecrt-0.0.7rc1-cp313-cp313-win_amd64.whl.metadata (4.0 kB)\n",
      "Requirement already satisfied: cffi>=1.0.0 in d:\\github\\vgrid\\.venv\\lib\\site-packages (from dggal==0.0.7rc1) (2.0.0)\n",
      "Requirement already satisfied: pycparser in d:\\github\\vgrid\\.venv\\lib\\site-packages (from cffi>=1.0.0->dggal==0.0.7rc1) (2.23)\n",
      "Using cached https://test-files.pythonhosted.org/packages/41/3c/a5dea86b4bd5b9fc0a3b1f2ca009201064ffdf2ffbec473f2591219bb8a1/dggal-0.0.7rc1-cp313-cp313-win_amd64.whl (260 kB)\n",
      "Using cached https://test-files.pythonhosted.org/packages/87/29/4c6fac8af80a3d5c0a4ace6e5710c145417170e3dee38475c740f69d02fe/ecrt-0.0.7rc1-cp313-cp313-win_amd64.whl (541 kB)\n",
      "Installing collected packages: ecrt, dggal\n",
      "\n",
      "  Attempting uninstall: ecrt\n",
      "\n",
      "    Found existing installation: ecrt 0.0.6\n",
      "\n",
      "    Uninstalling ecrt-0.0.6:\n",
      "\n",
      "   ---------------------------------------- 0/2 [ecrt]\n",
      "   ---------------------------------------- 0/2 [ecrt]\n",
      "      Successfully uninstalled ecrt-0.0.6\n",
      "   ---------------------------------------- 0/2 [ecrt]\n",
      "   ---------------------------------------- 0/2 [ecrt]\n",
      "  Attempting uninstall: dggal\n",
      "   ---------------------------------------- 0/2 [ecrt]\n",
      "    Found existing installation: dggal 0.0.6\n",
      "   ---------------------------------------- 0/2 [ecrt]\n",
      "    Uninstalling dggal-0.0.6:\n",
      "   ---------------------------------------- 0/2 [ecrt]\n",
      "   -------------------- ------------------- 1/2 [dggal]\n",
      "      Successfully uninstalled dggal-0.0.6\n",
      "   -------------------- ------------------- 1/2 [dggal]\n",
      "   -------------------- ------------------- 1/2 [dggal]\n",
      "   -------------------- ------------------- 1/2 [dggal]\n",
      "   -------------------- ------------------- 1/2 [dggal]\n",
      "   ---------------------------------------- 2/2 [dggal]\n",
      "\n",
      "Successfully installed dggal-0.0.7rc1 ecrt-0.0.7rc1\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "% pip install --index-url https://pypi.org/simple --extra-index-url https://test.pypi.org/simple/ dgg-vibes\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "33b2f69a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[IMPORT] has_overviews=False aggregate=True\n",
      "[IMPORT] computed data level from raster: 14\n",
      "[IMPORT] using default depth (get64KDepth) = 8\n",
      "['Elevation']\n",
      "[IMPORT] Wrote collection config to data\\gebco\\collection.json\n",
      "[IMPORT] Computed levels: data_level=14 depth=8 finest_root_level=6 max_base_level=2 batch_size=32\n",
      "[DIAG] using groupSize=5 (recommended default is 5)\n",
      "[LEVEL 6] #1: base_zone=C0-F\n",
      "[LEVEL 6] #1 BATCH 1: handling 32 roots\n",
      "[BATCH] processing batch base_zone=C0-F roots=32 aggregate=False\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\u001b[1;35mconcurrent.futures.process._RemoteTraceback\u001b[0m: \u001b[35m\n",
      "\"\"\"\n",
      "Traceback (most recent call last):\n",
      "  File \"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\concurrent\\futures\\process.py\", line 254, in _process_worker\n",
      "    r = call_item.fn(*call_item.args, **call_item.kwargs)\n",
      "  File \"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\dgg_vibes\\dggsImport\\rasterImport.py\", line 34, in _sample_package_worker\n",
      "    store = DGGSDataStore(data_root, collection, config=collection_config)\n",
      "  File \"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\dggsStore\\store.py\", line 276, in __init__\n",
      "    self.dggrs = get_or_create_dggrs(dggrsID)\n",
      "                 ~~~~~~~~~~~~~~~~~~~^^^^^^^^^\n",
      "  File \"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\dggsStore\\store.py\", line 188, in get_or_create_dggrs\n",
      "    dggrs = cls()\n",
      "  File \"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\dggal\\dggal.py\", line 1787, in __init__\n",
      "    self.init_args(list(args), kwArgs)\n",
      "    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\dggal\\dggal.py\", line 1785, in init_args\n",
      "    def init_args(self, args, kwArgs): init_args(IVEA4R, self, args, kwArgs)\n",
      "                                       ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\ecrt\\ecrt.py\", line 111, in init_args\n",
      "    super(c, self).init_args([] if hasattr(c, 'private_inheritance') else args, kwArgs)\n",
      "    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\dggal\\dggal.py\", line 1140, in init_args\n",
      "    def init_args(self, args, kwArgs): init_args(RhombicIcosahedral4R, self, args, kwArgs)\n",
      "                                       ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\ecrt\\ecrt.py\", line 111, in init_args\n",
      "    super(c, self).init_args([] if hasattr(c, 'private_inheritance') else args, kwArgs)\n",
      "    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\dggal\\dggal.py\", line 382, in init_args\n",
      "    def init_args(self, args, kwArgs): init_args(DGGRS, self, args, kwArgs)\n",
      "                                       ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\ecrt\\ecrt.py\", line 111, in init_args\n",
      "    super(c, self).init_args([] if hasattr(c, 'private_inheritance') else args, kwArgs)\n",
      "    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\ecrt\\ecrt.py\", line 372, in init_args\n",
      "    c = c.__bases__[0]\n",
      "        ~~~~~~~~~~~^^^\n",
      "IndexError: tuple index out of range\n",
      "\"\"\"\u001b[0m\n",
      "\n",
      "The above exception was the direct cause of the following exception:\n",
      "\n",
      "Traceback (most recent call last):\n",
      "  File \u001b[35m\"\\\\?\\C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Scripts\\dgg-import-script.py\"\u001b[0m, line \u001b[35m33\u001b[0m, in \u001b[35m<module>\u001b[0m\n",
      "    sys.exit(\u001b[31mload_entry_point('dgg_vibes==0.0.1rc7', 'console_scripts', 'dgg-import')\u001b[0m\u001b[1;31m()\u001b[0m)\n",
      "             \u001b[31m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\u001b[0m\u001b[1;31m^^\u001b[0m\n",
      "  File \u001b[35m\"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\dgg_vibes\\dgg_import.py\"\u001b[0m, line \u001b[35m118\u001b[0m, in \u001b[35mmain\u001b[0m\n",
      "    rc = import_raster(\n",
      "       ds=ds,\n",
      "    ...<9 lines>...\n",
      "       max_workers=args.max_workers\n",
      "    )\n",
      "  File \u001b[35m\"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\dgg_vibes\\dggsImport\\rasterImport.py\"\u001b[0m, line \u001b[35m279\u001b[0m, in \u001b[35mimport_raster\u001b[0m\n",
      "    written = _process_batch(\n",
      "       store, ds, raster_crs, dggrs, dggrs_uri, base_zone, batch_zones,\n",
      "    ...<2 lines>...\n",
      "       max_workers = max_workers\n",
      "    )\n",
      "  File \u001b[35m\"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\dgg_vibes\\dggsImport\\rasterImport.py\"\u001b[0m, line \u001b[35m134\u001b[0m, in \u001b[35m_process_batch\u001b[0m\n",
      "    entries = _build_blobs_processes(\n",
      "       store_worker_config=worker_config,\n",
      "    ...<11 lines>...\n",
      "       max_workers=max_workers\n",
      "    )\n",
      "  File \u001b[35m\"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\dgg_vibes\\dggsImport\\rasterImport.py\"\u001b[0m, line \u001b[35m96\u001b[0m, in \u001b[35m_build_blobs_processes\u001b[0m\n",
      "    fields_map = fut.result()\n",
      "  File \u001b[35m\"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\concurrent\\futures\\_base.py\"\u001b[0m, line \u001b[35m449\u001b[0m, in \u001b[35mresult\u001b[0m\n",
      "    return \u001b[31mself.__get_result\u001b[0m\u001b[1;31m()\u001b[0m\n",
      "           \u001b[31m~~~~~~~~~~~~~~~~~\u001b[0m\u001b[1;31m^^\u001b[0m\n",
      "  File \u001b[35m\"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\concurrent\\futures\\_base.py\"\u001b[0m, line \u001b[35m401\u001b[0m, in \u001b[35m__get_result\u001b[0m\n",
      "    raise self._exception\n",
      "\u001b[1;35mIndexError\u001b[0m: \u001b[35mtuple index out of range\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "python -m app = Application(appGlobals=globals())\n",
    "\n",
    "!dgg-import gebco.tif --dggrs IVEA4R --fields Elevation"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "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
}
