From dec2e3f176b28bba4b11a35b19ad3072e6b8626a Mon Sep 17 00:00:00 2001
From: Adam Paquette <acp263@nau.edu>
Date: Thu, 19 Apr 2018 20:25:30 -0700
Subject: [PATCH] Added warning to notebook

---
 notebooks/Socet2ISIS.ipynb | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/notebooks/Socet2ISIS.ipynb b/notebooks/Socet2ISIS.ipynb
index c6bb514..fe3a81a 100644
--- a/notebooks/Socet2ISIS.ipynb
+++ b/notebooks/Socet2ISIS.ipynb
@@ -2,13 +2,14 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 1,
+   "execution_count": 12,
    "metadata": {},
    "outputs": [],
    "source": [
     "import os\n",
     "import sys\n",
     "from functools import singledispatch\n",
+    "import warnings\n",
     "\n",
     "import pandas as pd\n",
     "import numpy as np\n",
@@ -145,9 +146,21 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 3,
+   "execution_count": 22,
    "metadata": {},
    "outputs": [
+    {
+     "name": "stderr",
+     "output_type": "stream",
+     "text": [
+      "/Users/adampaquette/anaconda/envs/pysat/lib/python3.6/site-packages/ipykernel_launcher.py:12: UserWarning: The following points found in ipf files missing from gpf file: \n",
+      "\n",
+      "['P03_002226_1895_XI_09N203W_15', 'P03_002226_1895_XI_09N203W_16', 'P03_002226_1895_XI_09N203W_17', 'P03_002226_1895_XI_09N203W_18', 'P03_002226_1895_XI_09N203W_19', 'P03_002226_1895_XI_09N203W_20', 'P03_002226_1895_XI_09N203W_21', 'P03_002226_1895_XI_09N203W_22', 'P03_002226_1895_XI_09N203W_24', 'P03_002226_1895_XI_09N203W_26', 'P03_002226_1895_XI_09N203W_30', 'P03_002226_1895_XI_09N203W_31', 'P03_002226_1895_XI_09N203W_32', 'P03_002226_1895_XI_09N203W_34', 'P03_002226_1895_XI_09N203W_36', 'P03_002226_1895_XI_09N203W_37', 'P03_002226_1895_XI_09N203W_44', 'P03_002226_1895_XI_09N203W_48', 'P03_002226_1895_XI_09N203W_49', 'P03_002226_1895_XI_09N203W_56', 'P03_002226_1895_XI_09N203W_57', 'P03_002226_1895_XI_09N203W_61', 'P03_002226_1895_XI_09N203W_62', 'P03_002226_1895_XI_09N203W_63', 'P03_002226_1895_XI_09N203W_65', 'P19_008344_1894_XN_09N203W_4', 'P20_008845_1894_XN_09N203W_15'].                   \n",
+      "\n",
+      "Continuing, but these points will be missing from the control network\n",
+      "  if sys.path[0] == '':\n"
+     ]
+    },
     {
      "data": {
       "text/html": [
@@ -1981,7 +1994,7 @@
        "[919 rows x 23 columns]"
       ]
      },
-     "execution_count": 3,
+     "execution_count": 22,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -1995,6 +2008,12 @@
     "gpf_df = read_gpf(gpf_file).set_index('point_id')\n",
     "ipf_df = read_ipf(ipf_list).set_index('pt_id')\n",
     "\n",
+    "point_diff = ipf_df.index.difference(gpf_df.index)\n",
+    "\n",
+    "if len(point_diff) != 0:\n",
+    "    warnings.warn(\"The following points found in ipf files missing from gpf file: \\n\\n{}. \\\n",
+    "                  \\n\\nContinuing, but these points will be missing from the control network\".format(list(point_diff)))\n",
+    "\n",
     "new_df = ipf_df.merge(gpf_df, left_index=True, right_index=True)\n",
     "new_df"
    ]
-- 
GitLab