Index: /anuga_core/source/anuga/shallow_water/data_manager.py
===================================================================
--- /anuga_core/source/anuga/shallow_water/data_manager.py	(revision 5540)
+++ /anuga_core/source/anuga/shallow_water/data_manager.py	(revision 5541)
@@ -4876,5 +4876,5 @@
     if permutation is None:
         permutation = ensure_numeric([], Float)    
-        
+
     # Call underlying C implementation urs2sts_ext.c    
     data=read_mux2(numSrc,filenames,weights,file_params,permutation,verbose)
@@ -5061,5 +5061,6 @@
         permutation = None
 
-                
+
+    #print 'permutation', permutation
     # Read MUX2 files
     if (verbose): print 'reading mux2 file'
Index: /anuga_core/source/anuga/shallow_water/test_data_manager.py
===================================================================
--- /anuga_core/source/anuga/shallow_water/test_data_manager.py	(revision 5540)
+++ /anuga_core/source/anuga/shallow_water/test_data_manager.py	(revision 5541)
@@ -6626,4 +6626,7 @@
         y = points[:,1]
 
+        #print
+        #print x
+        #print y
         for i, index in enumerate(permutation):
             # Check that STS points are stored in the correct order
@@ -6632,5 +6635,6 @@
             zone, e, n = redfearn(lat_long_points[index][0], 
                                   lat_long_points[index][1])             
-            
+
+            #print i, [x[i],y[i]], [e,n]
             assert allclose([x[i],y[i]], [e,n])
             
@@ -8940,7 +8944,7 @@
 if __name__ == "__main__":
 
+    #suite = unittest.makeSuite(Test_Data_Manager,'test')
+    #suite = unittest.makeSuite(Test_Data_Manager,'test_urs2sts_read_mux2_pyI')
     suite = unittest.makeSuite(Test_Data_Manager,'test')
-    #suite = unittest.makeSuite(Test_Data_Manager,'test_urs2sts_read_mux2_pyI')
-    #suite = unittest.makeSuite(Test_Data_Manager,'test_urs2sts')
     #suite = unittest.makeSuite(Test_Data_Manager,'test_get_flow_through_cross_section_with_geo')
     #suite = unittest.makeSuite(Test_Data_Manager,'covered_')
Index: /anuga_core/source/anuga/shallow_water/urs_ext.c
===================================================================
--- /anuga_core/source/anuga/shallow_water/urs_ext.c	(revision 5540)
+++ /anuga_core/source/anuga/shallow_water/urs_ext.c	(revision 5541)
@@ -33,5 +33,5 @@
 		   double *params, 
 		   int *number_of_stations,
-		   int *permutation,
+		   long *permutation,
 		   int verbose);
 
@@ -74,5 +74,6 @@
     // Convert Python arguments to C
     if (!PyArg_ParseTuple(args, "iOOOOi",
-			  &numSrc, &filenames, &pyweights, &file_params, &permutation, &verbose)) 
+			  &numSrc, &filenames, &pyweights, &file_params, 
+			  &permutation, &verbose)) 
     {
             PyErr_SetString(PyExc_RuntimeError, 
@@ -155,5 +156,5 @@
                        (double*)file_params->data,
 		       &number_of_selected_stations, // Desired number of stations
-		       (int*) permutation->data, // Ordering of selected stations
+		       (long*) permutation->data, // Ordering of selected stations
                        verbose);
 
@@ -207,4 +208,5 @@
     dimensions[0] = number_of_selected_stations;
     dimensions[1] = num_ts + POFFSET;
+    
     pydata = (PyArrayObject*)PyArray_FromDims(2, dimensions, PyArray_DOUBLE);
     if(pydata == NULL)
@@ -264,5 +266,5 @@
                    double *params, 
 		   int *number_of_stations,
-		   int *permutation,
+		   long *permutation,
                    int verbose)
 {
@@ -404,12 +406,19 @@
       
         // Create the Identity permutation vector
-        permutation = (int *) malloc(number_of_selected_stations*sizeof(int));
+        permutation = (long *) malloc(number_of_selected_stations*sizeof(long));
         for (i = 0; i < number_of_selected_stations; i++)
         {
-	  permutation[i] = i;  
-        }
-    }
-    
-    
+	  permutation[i] = (long) i;  
+        }
+    }
+    
+    /*
+    printf("number_of_selected_stations = %d\n", number_of_selected_stations);
+    for (i = 0; i < number_of_selected_stations; i++) {
+      printf("permutation[%d] = %d\n", i, (int) permutation[i]);
+    }    
+    */
+    
+        
     
     /* Make array(s) to hold demuxed data for stations given in the permutation file */
@@ -433,5 +442,5 @@
         }
 
-	ista = permutation[i]; // Get global index into mux data
+	ista = (int) permutation[i]; // Get global index into mux data
 	
         sts_data[i][mytgs0[0].nt] = (float)mytgs0[ista].geolat;
@@ -477,5 +486,5 @@
         {               
 	
-	    ista = permutation[i]; // Get global index into mux data	
+	    ista = (int) permutation[i]; // Get global index into mux data	
 	    
             /* fill the data0 array from the mux file, and weight it */
