bug in as_id_array
There's an issue with as_id_array. The function is followed (`core.utils` lns 182-197) by an unindented code block which is running as a meaningless script. I assume this is supposed to be inside the function?? Don't feel confident correcting this myself as I don't know the full intended functionality of the script - sorry to assign you Katy! (Also, it's untested?) Hopefully a very quick fix.
diff --git a/landlab/core/utils.py b/landlab/core/utils.py
index e89317b37..3fdf3a2d6 100644
--- a/landlab/core/utils.py
+++ b/landlab/core/utils.py
@@ -169,6 +169,13 @@ def as_id_array(array):
     array([0, 1, 2, 3, 4])
     >>> y.dtype == np.int
     True
+
+    >>> x = np.arange(5, dtype=np.intp)
+    >>> y = np.where(x < 3)[0]
+    >>> y.dtype == np.intp
+    True
+    >>> as_id_array(y).dtype == np.int
+    True
     """
     try:
         if array.dtype == np.int:
@@ -179,24 +186,6 @@ def as_id_array(array):
         return np.asarray(array, dtype=np.int)
 
 
-if np.dtype(np.intp) == np.int:
-
-    def _as_id_array(array):
-        if array.dtype == np.intp or array.dtype == np.int:
-            return array.view(np.int)
-        else:
-            return array.astype(np.int)
-
-
-else:
-
-    def _as_id_array(array):
-        if array.dtype == np.int:
-            return array.view(np.int)
-        else:
-            return array.astype(np.int)
-
-
 def make_optional_arg_into_id_array(number_of_elements, *args):
     """Transform an optional argument into an array of element ids.
 
['landlab/core/utils.py']