Index: /anuga_work/production/shark_bay_2007/build_shark_bay.py
===================================================================
--- /anuga_work/production/shark_bay_2007/build_shark_bay.py	(revision 4551)
+++ /anuga_work/production/shark_bay_2007/build_shark_bay.py	(revision 4552)
@@ -3,5 +3,5 @@
 Source data such as elevation and boundary data is assumed to be available in
 directories specified by project_urs.py
-The output sww file is stored in project_urs.output_time_dir 
+The output sww file is stored in project.output_time_dir 
 
 The scenario is defined by a triangular mesh created from project_urs.polygon,
@@ -31,9 +31,12 @@
 from anuga.pmesh.mesh_interface import create_mesh_from_regions
 from anuga.geospatial_data.geospatial_data import Geospatial_data
-from anuga.abstract_2d_finite_volumes.util import start_screen_catcher, copy_code_files
+from anuga.shallow_water.data_manager import start_screen_catcher
+from anuga.shallow_water.data_manager import copy_code_files
+
 from anuga_parallel.parallel_abstraction import get_processor_name
 
 # Application specific imports
-import project_urs   # Definition of file names and polygons
+import project   # Definition of file names and polygons
+
 
 #------------------------------------------------------------------------------
@@ -42,11 +45,12 @@
 #------------------------------------------------------------------------------
 
-copy_code_files(project_urs.output_build_time_dir,__file__, 
-               dirname(project_urs.__file__)+sep+ project_urs.__name__+'.py' )
+copy_code_files(project.output_build_time_dir,__file__, 
+               dirname(project.__file__)+sep+ project.__name__+'.py' )
 
-start_screen_catcher(project_urs.output_build_time_dir)
+start_screen_catcher(project.output_build_time_dir)
 
-print "Processor Name:",get_processor_name()
-print 'USER: ', project_urs.user
+print 'Processor Name:', get_processor_name()
+print 'User: ', project.user
+
 
 #-------------------------------------------------------------------------------
@@ -57,83 +61,62 @@
 # Fine pts file to be clipped to area of interest
 #-------------------------------------------------------------------------------
-print"project_urs.combined_dir_name",project_urs.combined_dir_name
-'''
-# topography directory filenames
-onshore_in_dir_name = project_urs.onshore_in_dir_name
-coast_in_dir_name = project_urs.coast_in_dir_name
-offshore_in_dir_name = project_urs.offshore_in_dir_name
-offshore1_in_dir_name = project_urs.offshore1_in_dir_name
-offshore2_in_dir_name = project_urs.offshore2_in_dir_name
 
-onshore_dir_name = project_urs.onshore_dir_name
-coast_dir_name = project_urs.coast_dir_name
-offshore_dir_name = project_urs.offshore_dir_name
-offshore1_dir_name = project_urs.offshore1_dir_name
-offshore2_dir_name = project_urs.offshore2_dir_name
+print 'project.combined_dir_name', project.combined_dir_name
 
-# creates DEM from asc data
-print "creates DEMs from asc data"
-convert_dem_from_ascii2netcdf(onshore_in_dir_name,
-                              basename_out=onshore_dir_name,
-                              use_cache=True, verbose=True)
-#creates pts file for onshore DEM
-print "creates pts file for onshore DEM"
-dem2pts(onshore_dir_name, use_cache=True, verbose=True)
 
-print'create Geospatial onshore objects from topographies'
-G = Geospatial_data(file_name = onshore_dir_name + '.pts') +\
-    Geospatial_data(file_name = coast_in_dir_name + '.txt') +\
-    Geospatial_data(file_name = offshore_in_dir_name + '.txt') 
-#    +\
-#    Geospatial_data(file_name = offshore1_dir_name + '.pts') +\
-#    Geospatial_data(file_name = offshore2_dir_name + '.pts')
-     
+geospatial_data = None
+# create DEMs from asc data
+print 'creating geospatial data objects from asc data (via dem and pts formats)'
+for filename in project.ascii_grid_filenames:
+    convert_dem_from_ascii2netcdf(filename,
+                                  basename_out=filename,
+                                  use_cache=True, verbose=True)
+    dem2pts(filename, use_cache=True, verbose=True)
 
-print'clip combined geospatial object by bounding polygon'
-G_clipped = G.clip(project_urs.poly_all)
+    geospatial_data += Geospatial_data(file_name = filename + '.pts', verbose=True)
 
-print'export combined DEM file'
-if access(project_urs.topographies_dir,F_OK) == 0:
-    mkdir (project_urs.topographies_dir)
-G.export_points_file(project_urs.combined_dir_name + '.txt')
 
-print'split combined data set'
-G_small, G_other = G_clipped.split(0.1, True)
+print 'creating geospatial data objects from txt data'
+for filename in project.point_filenames:
+    geospatial_data += Geospatial_data(file_name = filename + '.txt', verbose=True)
 
-print'export split DEM file'
-G_small.export_points_file(project_urs.combined_dir_name + '_small' + '.txt')
-#G_other.export_points_file(project_urs.combined_dir_name + '_other' + '.pts')
 
-'''
-print 'start reading:',project_urs.combined_dir_name + '.txt'
-G = Geospatial_data(file_name = (project_urs.combined_dir_name + '.txt'))
-G_clipped = G.clip(project_urs.poly_topo_clip)
+print 'clip combined geospatial object by bounding polygon'
+G = geospatial_data.clip(project.poly_all)
 
-print 'start split'
-#G_smallest, G_other = G.split(0.1,True)
 
-print 'start export',project_urs.combined_smallest_dir_name + '.txt'
-#G.export_points_file(project_urs.combined_smaller_dir_name + '.txt')
-G_clipped.export_points_file(project_urs.combined_smallest_dir_name + '.txt')
+print 'export combined geospatial data'
+if access(project.topographies_dir, F_OK) == 0:
+    mkdir (project.topographies_dir)
+G.export_points_file(project.combined_dir_name + '.txt')
 
+
+#print 'split combined data set'
+#G_small, _ = G.split(0.1, True)
+#
+#print 'export sub sampled DEM file'
+#G_small.export_points_file(project.combined_dir_name + '_small' + '.txt')
+
+
+ 
 #-------------------------------------------------------------------------
 # Convert URS to SWW file for boundary conditions 
 #-------------------------------------------------------------------------
-print 'starting to create boundary conditions'
-#boundaries_in_dir_name = project_urs.boundaries_in_dir_name
+print 'converting boundary conditions to sww format'
+#boundaries_in_dir_name = project.boundaries_in_dir_name
 
-#print 'minlat=project_urs.north_boundary, maxlat=project_urs.south_boundary',project_urs.north_boundary, project_urs.south_boundary
-#print 'minlon= project_urs.west_boundary, maxlon=project_urs.east_boundary',project_urs.west_boundary, project_urs.east_boundary
-'''       
+#print 'minlat=project.north_boundary, maxlat=project.south_boundary',project.north_boundary, project.south_boundary
+#print 'minlon= project.west_boundary, maxlon=project.east_boundary',project.west_boundary, project.east_boundary
+       
 from anuga.shallow_water.data_manager import urs_ungridded2sww
 
-print 'boundaries_in_dir_name',project_urs.boundaries_in_dir_name
-print 'project.boundaries_dir_name',project_urs.boundaries_dir_name
+print 'boundaries_dir', project.boundaries_dir
+print 'project.boundaries_name', project.boundaries_name
 
-urs_ungridded2sww(project_urs.boundaries_in_dir_name, project_urs.boundaries_dir_name,
+urs_ungridded2sww(project.boundaries_name,
                   verbose=True, mint=5000, maxt=35000, zscale=1)
-'''
 
 
+print 'Finished building the %s scenario' %project.scenario_name
 
 
Index: /anuga_work/production/shark_bay_2007/project.py
===================================================================
--- /anuga_work/production/shark_bay_2007/project.py	(revision 4551)
+++ /anuga_work/production/shark_bay_2007/project.py	(revision 4552)
@@ -1,8 +1,10 @@
 """Common filenames and locations for topographic data, meshes and outputs.
 Also includes origin for slump scenario.
+
+All filenames are given without extension
 """
 
-from os import sep, environ, getenv, getcwd,umask
-from os.path import expanduser, basename
+from os import sep, environ, getenv, getcwd, umask
+from os.path import expanduser, basename, join
 from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon, number_mesh_triangles
 import sys
@@ -11,7 +13,7 @@
 from anuga.utilities.system_tools import get_user_name, get_host_name
 
-codename = 'project.py'
+codename = 'project.py' # FIXME can be obtained automatically as __file__
 
-home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent dir   
+home = join(getenv('INUNDATIONHOME'), 'data') # Location of Data   
 user = get_user_name()
 host = get_host_name()
@@ -22,5 +24,5 @@
 state = 'western_australia'
 scenario_name = 'shark_bay'
-scenario = 'shark_bay_tsunami_scenario_2006'
+scenario = 'shark_bay_tsunami_scenario'
 
 #time stuff
@@ -39,10 +41,5 @@
 starttime=3600
 setup='final'
-
-#dir_comment='_trial_'+str(tide)+'_'+str(user)
-#dir_comment='_final_'+str(tide)+'_'+str(user)
-#time_thinning=4
-#yieldstep=60
-#res_factor = 1
+source='shark_bay'
 
 if setup =='trial':
@@ -63,58 +60,48 @@
 
 
-dir_comment='_'+setup+'_'+str(tide)+'_'+str(user)
+dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+str(user)
 
-# onshore data from 30m DTED level 2
-onshore_name = 'dli_dem' # get from Neil/Ingo (DEM or topo data)
-offshore_name = 'pt_hedland_bathy_edit'
-offshore1_name = '1'
-offshore2_name = '2'
-coast_name = 'Coastline'
+# elevation data filenames
+ascii_grid_filenames = ['10m_dem_without_survey', '50m_dem_without_10m_dem']
+point_filenames = ['field_survey_north', 'field_survey_south',
+                   'clipped_bathymetry_final', 'coast_points_final']
 
 #final topo name
-combined_name ='pt_hedland_combined_elevation'
-combined_small_name = 'pt_hedland_combined_elevation_small'
-combined_smallest_name = 'pt_hedland_export'
+combined_name ='shark_bay_combined_elevation'
+combined_small_name = 'shark_bay_combined_elevation_small'
 
-anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
 
-topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'20070416'+sep+'points'+sep
-topographies_dir = anuga_dir+'topographies'+sep
+anuga_dir = join(home, state, scenario, 'anuga')
 
-# input topo file location
-onshore_in_dir_name = topographies_in_dir + onshore_name
-coast_in_dir_name = topographies_in_dir + coast_name
-offshore_in_dir_name = topographies_in_dir + offshore_name
-offshore1_in_dir_name = topographies_in_dir + offshore1_name
-offshore2_in_dir_name = topographies_in_dir + offshore2_name
+topographies_in_dir = join(home, state, scenario, 'elevation_final', 'test_area')
+topographies_dir = join(anuga_dir, 'topographies') # Output dir for ANUGA
 
-onshore_dir_name = topographies_dir + onshore_name
-coast_dir_name = topographies_dir + coast_name
-offshore_dir_name = topographies_dir + offshore_name
-offshore1_dir_name = topographies_dir + offshore1_name
-offshore2_dir_name = topographies_dir + offshore2_name
+# Convert topo file locations into absolute pathnames
+for filename_list in [ascii_grid_filenames, point_filenames]:
+    for i, filename in enumerate(filename_list):
+        filename_list[i] = join(topographies_in_dir, filename)
 
 #final topo files
-combined_dir_name = topographies_dir + combined_name
-#combined_time_dir_name = topographies_time_dir + combined_name
-combined_small_dir_name = topographies_dir + combined_small_name
-combined_smallest_dir_name = topographies_dir + combined_smallest_name
+combined_dir_name = join(topographies_dir, combined_name)
+combined_small_dir_name = join(topographies_dir, combined_small_name)
 
-meshes_dir = anuga_dir+'meshes'+sep
-meshes_dir_name = meshes_dir + scenario_name
 
-polygons_dir = anuga_dir+'polygons'+sep
-tide_dir = anuga_dir+'tide_data'+sep
+meshes_dir = join(anuga_dir, 'meshes')
+meshes_dir_name = join(meshes_dir, scenario_name)
 
-#boundaries locations
-boundaries_name = 'shark_bay'
 
-boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'1_10000'+sep
-boundaries_in_dir_name = boundaries_in_dir + boundaries_name
-boundaries_dir = anuga_dir+'boundaries'+sep
-boundaries_dir_name = boundaries_dir + boundaries_name
+polygons_dir = join(anuga_dir, 'polygons') # Created with ArcGIS (csv files)
+tide_dir = join(anuga_dir, 'tide_data')
+
+
+# locations for boundary conditions
+if source=='shark_bay':
+    boundaries_file_name = 'shark_bay_3867_18052007'
+    boundaries_dir = join(anuga_dir, 'boundaries', 'shark_bay', '1_10000')
+
+boundaries_name = join(boundaries_dir, boundaries_file_name)
 
 #output locations
-output_dir = anuga_dir+'outputs'+sep
+output_dir = join(anuga_dir, 'outputs')
 output_build_time_dir = output_dir+build_time+sep
 output_run_time_dir = output_dir +run_time+dir_comment+sep
@@ -122,24 +109,24 @@
 
 #gauges
-gauge_name = 'gauge_location_port_hedland.csv' 
-gauge_name_test = 'gauge_checking_test.csv' 
-gauges_dir = anuga_dir+'gauges'+sep
-gauges_dir_name = gauges_dir + gauge_name
-gauges_dir_name_test = gauges_dir + gauge_name_test
+#gauge_name = 'gauge_location_port_hedland.csv' 
+#gauge_name_test = 'gauge_checking_test.csv' 
+#gauges_dir = anuga_dir+'gauges'+sep
+#gauges_dir_name = gauges_dir + gauge_name
+#gauges_dir_name_test = gauges_dir + gauge_name_test
 
-tide_dir = anuga_dir+'tide_data'+sep
+#tide_dir = anuga_dir+'tide_data'+sep
 
-buildings_filename = gauges_dir + 'pt_hedland_res.csv'
-buildings_filename_out = 'pt_hedland_res_modified.csv'
-buildings_filename_damage_out = 'pt_hedland_res_modified_damage.csv'
-tidal_filename = tide_dir + 'pt_hedland_tide.txt'
-community_filename = gauges_dir + 'CHINS_v2.csv'
-community_scenario = gauges_dir + 'community_pt_hedland.csv'
+#buildings_filename = gauges_dir + 'pt_hedland_res.csv'
+#buildings_filename_out = 'pt_hedland_res_modified.csv'
+#buildings_filename_damage_out = 'pt_hedland_res_modified_damage.csv'
+#tidal_filename = tide_dir + 'pt_hedland_tide.txt'
+#community_filename = gauges_dir + 'CHINS_v2.csv'
+#community_scenario = gauges_dir + 'community_pt_hedland.csv'
 
 # clipping region to make DEM (pts file) from onshore data
-eastingmin = 594000
-eastingmax = 715000
-northingmin = 7720000
-northingmax = 7880000
+#eastingmin = 594000
+#eastingmax = 715000
+#northingmin = 7720000
+#northingmax = 7880000
 
 # for ferret2sww
@@ -150,45 +137,25 @@
 
 # region to export (used from export_results.py)
-e_min_area = 648000
-e_max_area = 675000
-n_min_area = 7745000
-n_max_area = 7761000
+#e_min_area = 648000   # Eastings min
+#e_max_area = 675000
+#n_min_area = 7745000
+#n_max_area = 7761000
 
-export_region = [[e_min_area,n_min_area],[e_min_area,n_max_area],
-                 [e_max_area,n_max_area],[e_max_area,n_min_area]]
+#export_region = [[e_min_area,n_min_area],[e_min_area,n_max_area],
+#                 [e_max_area,n_max_area],[e_max_area,n_min_area]]
                  
-refzone = 50 
 
 #from anuga.coordinate_transforms.redfearn import redfearn
-poly_all = read_polygon(polygons_dir+'boundary_extent.csv')
+poly_all = read_polygon(join(polygons_dir, 'boundary_extent.csv'))
 res_poly_all = 250000*res_factor
 
-#Interior region - Pt Hedland town
-i0 = [668000, 7757000]
-i1 = [659000, 7755000]
-i2 = [660000, 7749000]
-i3 = [667000, 7746000]
-i4 = [678000, 7751000]
+#Interior regions
+poly_inundated_area = read_polygon(join(polygons_dir, 'inundated_area.csv'))
+res_inundated_area = 50000*res_factor
 
-poly_pt_hedland = [i0, i1, i2, i3, i4]
-res_pt_hedland=500*res_factor
+poly_bay_area = read_polygon(join(polygons_dir, 'bay_area.csv'))                                   
+res_bay_area = 100000*res_factor                                   
 
-#Are there other significant features?
-j0 = [670000, 7760000]
-j1 = [633000, 7745000]
-j2 = [665000, 7743000]
-j3 = [690000, 7755000]
-
-poly_region = [j0, j1, j2, j3]
-res_region = 50000*res_factor
-
-#poly_mainland = read_polygon(polygons_dir+'Initial_Condition.csv')
-
-poly_topo_clip = [[664000,7752000],[664000,7754000],
-                  [666000,7754000],[666000,7752000]]
-
-interior_regions = [[poly_pt_hedland,res_pt_hedland],[poly_region,res_region]
-#                    ,[poly_region,res_region]
-                    ]
+interior_regions = [[poly_bay_area, res_bay_area], [poly_inundated_area, res_inundated_area]]
 
 trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
