Index: /anuga_core/source/anuga/shallow_water/data_manager.py
===================================================================
--- /anuga_core/source/anuga/shallow_water/data_manager.py	(revision 3819)
+++ /anuga_core/source/anuga/shallow_water/data_manager.py	(revision 3820)
@@ -64,5 +64,5 @@
 
 from Numeric import concatenate, array, Float, Int, Int32, resize, sometrue, \
-     searchsorted, zeros, allclose, around, reshape
+     searchsorted, zeros, allclose, around, reshape, transpose
 from Scientific.IO.NetCDF import NetCDFFile
 
@@ -4200,5 +4200,5 @@
                                            files_out,
                                            quantities):
-        lonlatdep, lon, lat = _binary_c2nc(file_in,
+        lonlatdep, lon, lat, depth = _binary_c2nc(file_in,
                                          file_out,
                                          quantity)
@@ -4210,5 +4210,5 @@
                                 lon,
                                 lat,
-                                lonlatdep[:,2])
+                                depth)
             hashed_elevation = myhash(lonlatdep)
         else:
@@ -4251,5 +4251,7 @@
     lonlatdep = reshape(lonlatdep, ( points_num, columns))
     
-    lon, lat = lon_lat2grid(lonlatdep)
+    #print "lonlatdep", lonlatdep
+    
+    lon, lat, depth = lon_lat2grid(lonlatdep)
     lon_sorted = lon[:]
     lon_sorted.sort()
@@ -4275,5 +4277,6 @@
         hz_p_array.read(f, points_num)
         hz_p = array(hz_p_array, typecode=Float)
-        hz_p = reshape(hz_p, ( len(lat), len(lon)))
+        hz_p = reshape(hz_p, (len(lon), len(lat)))
+        hz_p = transpose(hz_p) #mux has lat varying fastest, nc has long v.f. 
         
         nc_file.store_timestep(hz_p)
@@ -4281,5 +4284,5 @@
     nc_file.close()
 
-    return lonlatdep, lon, lat
+    return lonlatdep, lon, lat, depth
     
 
@@ -4336,12 +4339,15 @@
     The first column is longitudes.
     The second column is latitudes.
+
+    The latitude is the fastest varying dimension - in mux files
     """
     LONG = 0
     LAT = 1
+    QUANTITY = 2
     points_num = len(long_lat_dep)
     lat = [long_lat_dep[0][LAT]]
     this_rows_long = long_lat_dep[0][LONG]
-    i = 1 # Index of long_lat_dep 
-
+    i = 1 # Index of long_lat_dep
+    
     #Working out the lat's
     while long_lat_dep[i][LONG] == this_rows_long and i < points_num:
@@ -4362,6 +4368,19 @@
     for l in lat:assert -90 < l < 90 , msg
     for l in long:assert -180 < l < 180 , msg
-        
-    return long, lat
+
+    #changing quantity from lat being the fastest varying dimension to
+    # long being the fastest varying dimension
+    # FIXME - make this faster/do this a better way
+    # use numeric transpose, after reshaping the quantity vector
+    quantity = zeros(len(long_lat_dep), Float)
+    lenlong = len(long)
+    lenlat = len(lat)
+    for lat_i, _ in enumerate(lat):
+        for long_i, _ in enumerate(long):
+            q_index = lat_i*lenlong+long_i
+            lld_index = long_i*lenlat+lat_i
+            quantity[q_index] = long_lat_dep[lld_index][QUANTITY]
+            
+    return long, lat, quantity
 
     ####  END URS 2 SWW  ###     
Index: /anuga_core/source/anuga/shallow_water/test_data_manager.py
===================================================================
--- /anuga_core/source/anuga/shallow_water/test_data_manager.py	(revision 3819)
+++ /anuga_core/source/anuga/shallow_water/test_data_manager.py	(revision 3820)
@@ -4703,5 +4703,6 @@
         base_name = 'o-e-mux'
         file_name = base_name + '.nc'
-        lonlatdep_numeric, lon, lat = _binary_c2nc(base_name, file_name, 'HA')
+        lonlatdep_numeric, lon, lat, depth = \
+                           _binary_c2nc(base_name, file_name, 'HA')
         
         #os.remove(file_name)
@@ -4709,10 +4710,10 @@
     def test_lon_lat2grid(self):
         lonlatdep = [
-            [ 113.06700134  ,  -26.06669998 ,   0.        ] ,
-            [ 113.06700134  ,  -26.33329964 ,   0.        ] ,
-            [ 113.19999695  ,  -26.06669998 ,   0.        ] ,
-            [ 113.19999695  ,  -26.33329964 ,   0.        ] ]
+            [ 113.06700134  ,  -26.06669998 ,   1.        ] ,
+            [ 113.06700134  ,  -26.33329964 ,   3.        ] ,
+            [ 113.19999695  ,  -26.06669998 ,   2.        ] ,
+            [ 113.19999695  ,  -26.33329964 ,   4.        ] ]
             
-        long, lat = lon_lat2grid(lonlatdep)
+        long, lat, quantity = lon_lat2grid(lonlatdep)
 
         for i, result in enumerate(lat):
@@ -4724,4 +4725,7 @@
         assert len(long) == 2
 
+        for i,q in enumerate(quantity):
+            assert q == i+1
+            
     def test_lon_lat2grid_bad(self):
         lonlatdep  = [
@@ -4743,5 +4747,5 @@
             [ -26.43330002 , 113.43299866,    16.        ]]
         try:
-            long, lat = lon_lat2grid(lonlatdep)
+            long, lat, quantity = lon_lat2grid(lonlatdep)
         except AssertionError:
             pass
@@ -4752,10 +4756,10 @@
     def test_lon_lat2gridII(self):
         lonlatdep = [
-            [ 113.06700134  ,  -26.06669998 ,   0.        ] ,
-            [ 113.06700134  ,  -26.33329964 ,   0.        ] ,
-            [ 113.19999695  ,  -26.06669998 ,   0.        ] ,
-            [ 113.19999695  ,  -26.344329964 ,   0.        ] ]
+            [ 113.06700134  ,  -26.06669998 ,   1.        ] ,
+            [ 113.06700134  ,  -26.33329964 ,   2.        ] ,
+            [ 113.19999695  ,  -26.06669998 ,   3.        ] ,
+            [ 113.19999695  ,  -26.344329964 ,   4.        ] ]
         try:
-            long, lat = lon_lat2grid(lonlatdep)
+            long, lat, quantity = lon_lat2grid(lonlatdep)
         except AssertionError:
             pass
@@ -4767,5 +4771,6 @@
         basename_in = 'karratha'
         basename_out = basename_in
-        urs2sww(basename_in, basename_out)
+        urs2sww(basename_in, basename_out, remove_nc_files=True,
+                zscale=10000000)
     #### END TESTS FOR URS 2 SWW  ###
 
@@ -4773,6 +4778,6 @@
 #-------------------------------------------------------------
 if __name__ == "__main__":
-    #suite = unittest.makeSuite(Test_Data_Manager,'test_urs2sww_test_fail')
-    #suite = unittest.makeSuite(Test_Data_Manager,'test_urs2sww')
+    #suite = unittest.makeSuite(Test_Data_Manager,'test_lon')
+    #suite = unittest.makeSuite(Test_Data_Manager,'trial')
     suite = unittest.makeSuite(Test_Data_Manager,'test')
     runner = unittest.TextTestRunner()
