{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Comparing a USGSCSM and ISIS Camera Model"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Prerequisites\n",
    "\n",
    "This comparison notebook requires the installation of ISIS, kalasiris, and plotly.\n",
    "\n",
    "### 1. Install ISIS\n",
    "Follow the instructions in the [ISIS Installation With Conda guide](https://astrogeology.usgs.gov/docs/how-to-guides/environment-setup-and-maintenance/installing-isis-via-anaconda/).\n",
    "\n",
    "### 2. Install Kalasiris\n",
    "To install kalasiris in your knoten environment, run the following command:\n",
    "\n",
    "`conda install conda-forge::kalasiris`\n",
    "\n",
    "### 3. Install Plotly\n",
    "To install plotly in your knoten environment, run the following command:\n",
    "\n",
    "`conda install conda-forge::plotly`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "        <script type=\"text/javascript\">\n",
       "        window.PlotlyConfig = {MathJaxConfig: 'local'};\n",
       "        if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}\n",
       "        if (typeof require !== 'undefined') {\n",
       "        require.undef(\"plotly\");\n",
       "        requirejs.config({\n",
       "            paths: {\n",
       "                'plotly': ['https://cdn.plot.ly/plotly-2.32.0.min']\n",
       "            }\n",
       "        });\n",
       "        require(['plotly'], function(Plotly) {\n",
       "            window._Plotly = Plotly;\n",
       "        });\n",
       "        }\n",
       "        </script>\n",
       "        "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import os \n",
    "\n",
    "# kalasiris requires ISISROOT and ISISDATA environment variables to be set.\n",
    "os.environ['ISISROOT'] = os.path.join(os.environ['HOME'],'opt','anaconda3','envs','isis-prod')\n",
    "os.environ['ISISDATA'] = \"/Volumes/isis_data1/isis_data\"\n",
    "\n",
    "import kalasiris.pysis as isis\n",
    "\n",
    "from knoten import vis\n",
    "\n",
    "import json\n",
    "import ale\n",
    "\n",
    "from IPython.display import Image\n",
    "\n",
    "import plotly\n",
    "plotly.offline.init_notebook_mode(connected=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Download PDS Image"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "--2024-05-22 08:02:58--  https://pds-imaging.jpl.nasa.gov/data/mro/mars_reconnaissance_orbiter/ctx/mrox_3365/data/K11_057871_1602_XN_19S163W.IMG\n",
      "Resolving pds-imaging.jpl.nasa.gov (pds-imaging.jpl.nasa.gov)... 52.34.231.99, 52.38.23.64\n",
      "Connecting to pds-imaging.jpl.nasa.gov (pds-imaging.jpl.nasa.gov)|52.34.231.99|:443... connected.\n",
      "WARNING: cannot verify pds-imaging.jpl.nasa.gov's certificate, issued by ‘CN=Entrust Certification Authority - L1K,OU=(c) 2012 Entrust\\\\, Inc. - for authorized use only,OU=See www.entrust.net/legal-terms,O=Entrust\\\\, Inc.,C=US’:\n",
      "  Unable to locally verify the issuer's authority.\n",
      "HTTP request sent, awaiting response... 302 Found\n",
      "Location: https://planetarydata.jpl.nasa.gov/img/data/mro/mars_reconnaissance_orbiter/ctx/mrox_3365/data/K11_057871_1602_XN_19S163W.IMG [following]\n",
      "--2024-05-22 08:02:59--  https://planetarydata.jpl.nasa.gov/img/data/mro/mars_reconnaissance_orbiter/ctx/mrox_3365/data/K11_057871_1602_XN_19S163W.IMG\n",
      "Resolving planetarydata.jpl.nasa.gov (planetarydata.jpl.nasa.gov)... 207.151.104.173\n",
      "Connecting to planetarydata.jpl.nasa.gov (planetarydata.jpl.nasa.gov)|207.151.104.173|:443... connected.\n",
      "HTTP request sent, awaiting response... 200 OK\n",
      "Length: 243340224 (232M)\n",
      "Saving to: ‘data/K11_057871_1602_XN_19S163W.IMG’\n",
      "\n",
      "K11_057871_1602_XN_ 100%[===================>] 232.07M  17.1MB/s    in 18s     \n",
      "\n",
      "2024-05-22 08:03:17 (12.9 MB/s) - ‘data/K11_057871_1602_XN_19S163W.IMG’ saved [243340224/243340224]\n",
      "\n"
     ]
    }
   ],
   "source": [
    "url = 'https://pds-imaging.jpl.nasa.gov/data/mro/mars_reconnaissance_orbiter/ctx/mrox_3365/data/K11_057871_1602_XN_19S163W.IMG'\n",
    "\n",
    "!wget -N -P data/ {url} --no-check-certificate\n",
    "fileName = 'data/' + os.path.split(url)[1]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ingest the image into ISIS and attach SPICE via spiceinit"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "cub_loc = os.path.splitext(fileName)[0] + '.cub'\n",
    "\n",
    "try: \n",
    "    isis.mroctx2isis(from_=fileName, to=cub_loc)\n",
    "except isis.ProcessError as e:\n",
    "    print(e.stderr)\n",
    "\n",
    "try:\n",
    "    isis.spiceinit(from_=cub_loc, shape='ellipsoid')\n",
    "except isis.ProcessError as e:\n",
    "    print(e.stderr)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Create an ISD from the PDS3 .IMG using ISIS cube kernels and store it next to the cube"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/astamile/opt/anaconda3/envs/knoten/lib/python3.12/site-packages/osgeo/gdal.py:312: FutureWarning:\n",
      "\n",
      "Neither gdal.UseExceptions() nor gdal.DontUseExceptions() has been explicitly called. In GDAL 4.0, exceptions will be enabled by default.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "kernels = ale.util.generate_kernels_from_cube(cub_loc, expand=True)\n",
    "usgscsm_str = ale.loads(fileName, props={'kernels': kernels})\n",
    "\n",
    "csm_isd = os.path.splitext(cub_loc)[0] + '.json'\n",
    "with open(csm_isd, 'w') as isd_file:\n",
    "    isd_file.write(usgscsm_str)\n",
    "    \n",
    "usgscsm_json = json.loads(usgscsm_str)\n",
    "n_lines = usgscsm_json['image_lines']\n",
    "n_samples = usgscsm_json['image_samples']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "csmisis_diff_lv_plot, csmisis_diff_ephem_plot, external_orientation_data = vis.external_orientation_diff(csm_isd, cub_loc, n_lines, n_samples, nx=10, ny=50, width=600, height=600)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 106120 characters]",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Image(csmisis_diff_lv_plot.to_image())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 25292 characters]",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Image(csmisis_diff_ephem_plot.to_image())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "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>diffx</th>\n",
       "      <th>diffy</th>\n",
       "      <th>diffz</th>\n",
       "      <th>diffu</th>\n",
       "      <th>diffv</th>\n",
       "      <th>diffw</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>500.000000</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>5.000000e+02</td>\n",
       "      <td>5.000000e+02</td>\n",
       "      <td>5.000000e+02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>0.000077</td>\n",
       "      <td>0.000199</td>\n",
       "      <td>-0.000011</td>\n",
       "      <td>1.154782e-08</td>\n",
       "      <td>-8.894654e-08</td>\n",
       "      <td>3.882977e-08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>0.000400</td>\n",
       "      <td>0.000937</td>\n",
       "      <td>0.000149</td>\n",
       "      <td>9.456094e-08</td>\n",
       "      <td>3.383175e-07</td>\n",
       "      <td>2.598414e-07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>-0.000793</td>\n",
       "      <td>-0.001727</td>\n",
       "      <td>-0.000340</td>\n",
       "      <td>-2.586859e-07</td>\n",
       "      <td>-1.258628e-06</td>\n",
       "      <td>-4.987500e-07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>-0.000263</td>\n",
       "      <td>-0.000527</td>\n",
       "      <td>-0.000126</td>\n",
       "      <td>-4.523316e-08</td>\n",
       "      <td>-2.640964e-07</td>\n",
       "      <td>-1.078950e-07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>0.000080</td>\n",
       "      <td>0.000161</td>\n",
       "      <td>0.000001</td>\n",
       "      <td>2.748548e-09</td>\n",
       "      <td>-2.273913e-09</td>\n",
       "      <td>1.208859e-08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>0.000440</td>\n",
       "      <td>0.000950</td>\n",
       "      <td>0.000081</td>\n",
       "      <td>4.468993e-08</td>\n",
       "      <td>1.343876e-07</td>\n",
       "      <td>1.812972e-07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>0.000811</td>\n",
       "      <td>0.002111</td>\n",
       "      <td>0.000316</td>\n",
       "      <td>3.097324e-07</td>\n",
       "      <td>5.573508e-07</td>\n",
       "      <td>7.271875e-07</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            diffx       diffy       diffz         diffu         diffv  \\\n",
       "count  500.000000  500.000000  500.000000  5.000000e+02  5.000000e+02   \n",
       "mean     0.000077    0.000199   -0.000011  1.154782e-08 -8.894654e-08   \n",
       "std      0.000400    0.000937    0.000149  9.456094e-08  3.383175e-07   \n",
       "min     -0.000793   -0.001727   -0.000340 -2.586859e-07 -1.258628e-06   \n",
       "25%     -0.000263   -0.000527   -0.000126 -4.523316e-08 -2.640964e-07   \n",
       "50%      0.000080    0.000161    0.000001  2.748548e-09 -2.273913e-09   \n",
       "75%      0.000440    0.000950    0.000081  4.468993e-08  1.343876e-07   \n",
       "max      0.000811    0.002111    0.000316  3.097324e-07  5.573508e-07   \n",
       "\n",
       "              diffw  \n",
       "count  5.000000e+02  \n",
       "mean   3.882977e-08  \n",
       "std    2.598414e-07  \n",
       "min   -4.987500e-07  \n",
       "25%   -1.078950e-07  \n",
       "50%    1.208859e-08  \n",
       "75%    1.812972e-07  \n",
       "max    7.271875e-07  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "external_orientation_data[['diffx', 'diffy', 'diffz', 'diffu', 'diffv', 'diffw']].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/astamile/opt/anaconda3/envs/knoten/lib/python3.12/site-packages/knoten-0.4.0-py3.12.egg/knoten/vis.py:61: FutureWarning:\n",
      "\n",
      "This function is deprecated. See: https://pyproj4.github.io/pyproj/stable/gotchas.html#upgrading-to-pyproj-2-from-pyproj-1\n",
      "\n"
     ]
    }
   ],
   "source": [
    "isis2csm_plot, csm2isis_plot, isiscsm_plotlatlon, isiscsm_plotbf, isis2csm_data, csm2isis_data, isiscsm_latlondata, isiscsm_bfdata = vis.reprojection_diff(csm_isd, cub_loc, n_lines, n_samples, nx=10, ny=50, width=600, height=600, edge_pad=0.01)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 135672 characters]",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Image(isis2csm_plot.to_image())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "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>diff line</th>\n",
       "      <th>diff sample</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>500.000000</td>\n",
       "      <td>500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>0.001298</td>\n",
       "      <td>0.004654</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>0.010907</td>\n",
       "      <td>0.018035</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>-0.022728</td>\n",
       "      <td>-0.030098</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>-0.005129</td>\n",
       "      <td>-0.007006</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>0.000238</td>\n",
       "      <td>-0.000235</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>0.007018</td>\n",
       "      <td>0.014009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>0.028891</td>\n",
       "      <td>0.068042</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        diff line  diff sample\n",
       "count  500.000000   500.000000\n",
       "mean     0.001298     0.004654\n",
       "std      0.010907     0.018035\n",
       "min     -0.022728    -0.030098\n",
       "25%     -0.005129    -0.007006\n",
       "50%      0.000238    -0.000235\n",
       "75%      0.007018     0.014009\n",
       "max      0.028891     0.068042"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "isis2csm_data[['diff line', 'diff sample']].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 103460 characters]",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Image(csm2isis_plot.to_image())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "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>diff line</th>\n",
       "      <th>diff sample</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>500.000000</td>\n",
       "      <td>500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>-897.106921</td>\n",
       "      <td>4.096432</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>6362.131063</td>\n",
       "      <td>130.814763</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>-47165.463281</td>\n",
       "      <td>-2499.490000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>-0.007136</td>\n",
       "      <td>-0.013755</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>-0.000778</td>\n",
       "      <td>0.000471</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>0.004779</td>\n",
       "      <td>0.008466</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>0.023008</td>\n",
       "      <td>505.534352</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          diff line  diff sample\n",
       "count    500.000000   500.000000\n",
       "mean    -897.106921     4.096432\n",
       "std     6362.131063   130.814763\n",
       "min   -47165.463281 -2499.490000\n",
       "25%       -0.007136    -0.013755\n",
       "50%       -0.000778     0.000471\n",
       "75%        0.004779     0.008466\n",
       "max        0.023008   505.534352"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "csm2isis_data[['diff line', 'diff sample']].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 148584 characters]",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Image(isiscsm_plotlatlon.to_image())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "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>diff lon</th>\n",
       "      <th>diff lat</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>5.000000e+02</td>\n",
       "      <td>5.000000e+02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>4.054152e-07</td>\n",
       "      <td>1.786892e-07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>1.571631e-06</td>\n",
       "      <td>1.196634e-06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>-2.647452e-06</td>\n",
       "      <td>-2.292322e-06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>-5.690899e-07</td>\n",
       "      <td>-5.002277e-07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>3.618256e-08</td>\n",
       "      <td>4.712217e-08</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>1.188245e-06</td>\n",
       "      <td>8.394656e-07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>5.674273e-06</td>\n",
       "      <td>3.343632e-06</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           diff lon      diff lat\n",
       "count  5.000000e+02  5.000000e+02\n",
       "mean   4.054152e-07  1.786892e-07\n",
       "std    1.571631e-06  1.196634e-06\n",
       "min   -2.647452e-06 -2.292322e-06\n",
       "25%   -5.690899e-07 -5.002277e-07\n",
       "50%    3.618256e-08  4.712217e-08\n",
       "75%    1.188245e-06  8.394656e-07\n",
       "max    5.674273e-06  3.343632e-06"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "isiscsm_latlondata[['diff lon', 'diff lat']].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 205336 characters]",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Image(isiscsm_plotbf.to_image())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "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>diffx</th>\n",
       "      <th>diffy</th>\n",
       "      <th>diffz</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>500.000000</td>\n",
       "      <td>500.000000</td>\n",
       "      <td>500.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>0.117837</td>\n",
       "      <td>0.022819</td>\n",
       "      <td>-0.009910</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>1.708421</td>\n",
       "      <td>0.087658</td>\n",
       "      <td>0.066955</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>-3.141190</td>\n",
       "      <td>-0.143720</td>\n",
       "      <td>-0.186873</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>-0.862259</td>\n",
       "      <td>-0.033847</td>\n",
       "      <td>-0.046929</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>-0.173627</td>\n",
       "      <td>0.000487</td>\n",
       "      <td>-0.002619</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>1.865580</td>\n",
       "      <td>0.068426</td>\n",
       "      <td>0.028154</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>3.140255</td>\n",
       "      <td>0.323277</td>\n",
       "      <td>0.128875</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            diffx       diffy       diffz\n",
       "count  500.000000  500.000000  500.000000\n",
       "mean     0.117837    0.022819   -0.009910\n",
       "std      1.708421    0.087658    0.066955\n",
       "min     -3.141190   -0.143720   -0.186873\n",
       "25%     -0.862259   -0.033847   -0.046929\n",
       "50%     -0.173627    0.000487   -0.002619\n",
       "75%      1.865580    0.068426    0.028154\n",
       "max      3.140255    0.323277    0.128875"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "isiscsm_bfdata[['diffx', 'diffy', 'diffz']].describe()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.12.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
