Index: /anuga_core/source/anuga/shallow_water/urs_ext.c
===================================================================
--- /anuga_core/source/anuga/shallow_water/urs_ext.c	(revision 5541)
+++ /anuga_core/source/anuga/shallow_water/urs_ext.c	(revision 5542)
@@ -25,5 +25,6 @@
 #define POFFSET 5 //Number of site_params
 
-void fillDataArray(int, int, int, int, int *, int *, float *, int *, int *, float *);
+void fillDataArray(int, int, int, int, int *, int *, float *, 
+		   int *, int *, float *);
 long getNumData(const int *fros, const int *lros, const int nsta);
 char isdata(float);
@@ -43,5 +44,7 @@
 
     NOTE:
-    A Python int is equivalent to a C long (this becomes really important on 64 bit architectures)
+    A Python int is equivalent to a C long 
+    (this becomes really important on 64 bit architectures)
+    
     A Python double corresponds to a C double
     */
@@ -50,5 +53,5 @@
     PyArrayObject *pyweights;
     PyArrayObject *file_params;
-    PyArrayObject *permutation;    
+    PyArrayObject *permutation;  // Ordering of selected stations    
     PyArrayObject *pydata;
     PyObject *fname;
@@ -103,5 +106,6 @@
     if(PyList_Size(filenames) != pyweights->dimensions[0])
     {
-        PyErr_SetString(PyExc_ValueError, "Must specify one weight for each filename");
+        PyErr_SetString(PyExc_ValueError, 
+			"Must specify one weight for each filename");
         return NULL;
     }
@@ -110,5 +114,6 @@
     if (muxFileNameArray == NULL) 
     {
-        PyErr_SetString(PyExc_ValueError, "ERROR: Memory for muxFileNameArray could not be allocated.");
+        PyErr_SetString(PyExc_ValueError, 
+	  "ERROR: Memory for muxFileNameArray could not be allocated.");
         return NULL;
     }
@@ -128,5 +133,5 @@
         {
             PyErr_SetString(PyExc_ValueError, 
-			    "ERROR: Memory for muxFileNameArray could not be allocated.\n");
+	      "ERROR: Memory for muxFileNameArray could not be allocated.\n");
             return NULL;
         }
@@ -136,5 +141,5 @@
     {
         PyErr_SetString(PyExc_ValueError,
-			"file_params must be one-dimensional and of type double");
+	      "file_params must be one-dimensional and of type double");
         return NULL; 
     }
@@ -145,7 +150,9 @@
     for (i = 0; i < numSrc; i++)
     {
-        weights[i] = (float)(*(double*)(pyweights->data + i*pyweights->strides[0]));
-    }
-    
+        weights[i] = (float)(*(double*)
+	             (pyweights->data + i*pyweights->strides[0]));
+    }
+    
+    // Desired number of stations
     number_of_selected_stations = (int) permutation->dimensions[0];
 
@@ -155,6 +162,6 @@
                        weights, 
                        (double*)file_params->data,
-		       &number_of_selected_stations, // Desired number of stations
-		       (long*) permutation->data, // Ordering of selected stations
+		       &number_of_selected_stations, 
+		       (long*) permutation->data,
                        verbose);
 
@@ -193,6 +200,9 @@
     {
         printf("ERROR: Gauge data has incorrect start and finish times:\n");
-	printf("   start_tstep = %d, max_number_of_steps = %d\n", start_tstep, nt);
-	printf("   finish_tstep = %d, min_number_of_steps = %d\n", finish_tstep, 0);	
+	printf("   start_tstep = %d, max_number_of_steps = %d\n", 
+	           start_tstep, nt);
+	printf("   finish_tstep = %d, min_number_of_steps = %d\n", 
+	           finish_tstep, 0);	
+		   
         PyErr_SetString(PyExc_ValueError, "Incorrect start and finish times");	
         return NULL;
@@ -201,5 +211,6 @@
     if (start_tstep >= finish_tstep)
     {
-        PyErr_SetString(PyExc_ValueError, "ERROR: Gauge data has non-postive_length");
+        PyErr_SetString(PyExc_ValueError,
+	                "ERROR: Gauge data has non-postive_length");
         return NULL;
     }
@@ -212,5 +223,6 @@
     if(pydata == NULL)
     {
-        PyErr_SetString(PyExc_ValueError, "ERROR: Memory for pydata array could not be allocated.");
+        PyErr_SetString(PyExc_ValueError, 
+	      "ERROR: Memory for pydata array could not be allocated.");
         return NULL;
     }
@@ -218,6 +230,6 @@
     
     // Each gauge begins and ends recording at different times. When a gauge is
-    // not recording but at least one other gauge is. Pad the non-recording gauge
-    // array with zeros.
+    // not recording but at least one other gauge is. 
+    // Pad the non-recording gauge array with zeros.
     for (i = 0; i < number_of_selected_stations; i++)
     {
@@ -229,10 +241,15 @@
                 if (it + 1 > (int)cdata[i][nt + 4])
                 {
-                    // This gauge has stopped recording but others are still recording
-                    *(double*)(pydata->data + i*pydata->strides[0] + time*pydata->strides[1]) = 0.0;
+                    // This gauge has stopped recording but others are 
+		    // still recording
+                    *(double*)(pydata->data + i*pydata->strides[0] 
+		                            + time*pydata->strides[1]) = 
+					    0.0;
                 }
                 else
                 {
-                    *(double*)(pydata->data + i*pydata->strides[0] + time*pydata->strides[1]) = cdata[i][it];
+                    *(double*)(pydata->data + i*pydata->strides[0] 
+		                            + time*pydata->strides[1]) = 
+					    cdata[i][it];
                 }
                 time++;
@@ -242,5 +259,7 @@
         for (j = 0; j < POFFSET; j++)
         {
-            *(double*)(pydata->data + i*pydata->strides[0] + (num_ts + j)*pydata->strides[1]) = cdata[i][nt + j];
+            *(double*)(pydata->data + i*pydata->strides[0] 
+	                            + (num_ts + j)*pydata->strides[1]) = 
+				    cdata[i][nt + j];
         }
     }
@@ -277,5 +296,5 @@
     int number_of_selected_stations;
     char susMuxFileName;
-    float *muxData;
+    float *muxData=NULL; // Suppress warning
     long numData;
 
@@ -286,5 +305,5 @@
     long int offset;
 
-    /* Allocate space for the names and the weights and pointers to the data*/    
+    /* Allocate space for the names and the weights and pointers to the data*/
 
     /* Check that the input files have mux2 extension*/
@@ -293,5 +312,6 @@
     { 
         muxFileName = muxFileNameArray[isrc];
-        if(!susMuxFileName && strcmp(muxFileName + strlen(muxFileName) - 4, "mux2") != 0)
+        if(!susMuxFileName && strcmp(muxFileName + strlen(muxFileName) - 4, 
+				     "mux2") != 0)
         {
             susMuxFileName = 1;
@@ -396,12 +416,13 @@
 
     // Apply rule that an empty permutation file means 'take all stations'
-    // We can change this later by passing in None instead of the empty permutation.
-
-        
+    // We could change this later by passing in None instead of the empty 
+    // permutation.
     number_of_selected_stations = *number_of_stations;	
     if (number_of_selected_stations == 0)
     {
         number_of_selected_stations = nsta0;  
-	*number_of_stations = nsta0;     // Return possibly updated number of stations
+	
+	// Return possibly updated number of stations
+	*number_of_stations = nsta0;     
       
         // Create the Identity permutation vector
@@ -422,5 +443,6 @@
         
     
-    /* Make array(s) to hold demuxed data for stations given in the permutation file */
+    // Make array(s) to hold demuxed data for stations given in the 
+    // permutation file 
     sts_data = (float**)malloc(number_of_selected_stations*sizeof(float*));
     if (sts_data == NULL)
@@ -431,5 +453,5 @@
 
     // For each selected station, allocate space for its data
-    len_sts_data = mytgs0[0].nt + POFFSET; // Max length of each timeseries (I think)
+    len_sts_data = mytgs0[0].nt + POFFSET; // Max length of each timeseries?
     for (i = 0; i < number_of_selected_stations; i++)
     {
@@ -527,5 +549,7 @@
 
 /* thomas */
-void fillDataArray(int ista, int nsta, int nt, int ig, int *nst, int *nft, float *data, int *istart_p, int *istop_p, float *muxData)
+void fillDataArray(int ista, int nsta, int nt, int ig, int *nst, 
+                   int *nft, float *data, int *istart_p, 
+		   int *istop_p, float *muxData)
 {
     int it, last_it, jsta;
@@ -562,5 +586,6 @@
     if (ig == -1 || nst[ista] == -1) /* currently ig==-1 => nst[ista]==-1 */
     {
-        /* gauge never started recording, or was outside of all grids, fill array with 0 */
+        /* gauge never started recording, or was outside of all grids, 
+	fill array with 0 */
         for(it = 0; it < nt; it++)
         {
@@ -593,5 +618,5 @@
             }   
             else
-                /* gauge has finished recording */                                            
+                /* gauge has finished recording */
             {
                 data[it] = NODATA;
@@ -606,5 +631,6 @@
 
         if(last_it < nt - 1)
-            /* the loop was exited early because the gauge had finished recording */
+            /* the loop was exited early because the gauge had 
+	    finished recording */
             for(it = last_it+1; it < nt; it++)
                 data[it] = NODATA;
@@ -638,5 +664,6 @@
         {
             numData += *(lros + ista) - *(fros + ista) + 1;
-            last_output_step = (last_output_step < *(lros+ista) ? *(lros+ista):last_output_step);
+            last_output_step = (last_output_step < *(lros+ista) ? 
+	                        *(lros+ista):last_output_step);
         }   
         numData += last_output_step*nsta; /* these are the t records */
