Changeset 3851
- Timestamp:
- Oct 25, 2006, 3:19:29 PM (19 years ago)
- Location:
- anuga_work/production/dampier_2006
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/dampier_2006/build_dampier.py
r3841 r3851 30 30 from anuga.shallow_water import Reflective_boundary 31 31 from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts 32 33 32 from anuga.pmesh.mesh_interface import create_mesh_from_regions 34 35 33 from anuga.geospatial_data.geospatial_data import * 36 34 … … 38 36 import project # Definition of file names and polygons 39 37 40 41 42 38 #------------------------------------------------------------------------------ 43 39 # Copy scripts to time stamped output directory and capture screen 44 40 # output to file 45 41 #------------------------------------------------------------------------------ 42 #print 'project.build_time', project.build_time 43 #print 'project.output_build_time_dir',project.output_build_time_dir 44 #print '__file__, project.output_time_dir + basename(__file__)', __file__, project.output_build_time_dir + basename(__file__) 45 #print 'dirname(project.__file__) +sep+ project.__name__', dirname(project.__file__) +sep+ project.__name__+'.py' 46 #print'project.topographies_time_dir',project.topographies_time_dir, project.combined_time_dir_name + '.pts' 47 #print project.boundaries_time_dir, project.boundaries_time_dir_name 48 #import sys; sys.exit() 49 if access(project.output_build_time_dir,F_OK) == 0: 50 mkdir (project.output_build_time_dir) 51 copy (dirname(project.__file__) +sep+ project.__name__+'.py', 52 project.output_build_time_dir + project.__name__+'.py') #copies project.py 53 copy (__file__, project.output_build_time_dir + basename(__file__)) 54 print 'files '+ project.__name__+'.py and '+ basename(__file__)+' copied to '+ project.output_build_time_dir #copies this file 55 #import sys; sys.exit() 46 56 47 48 49 # creates copy of code in output dir if dir doesn't exist50 if access(project.output_time_dir,F_OK) == 0:51 mkdir (project.output_time_dir)52 copy (dirname(project.__file__) +sep+ project.__name__+'.py',53 project.output_time_dir + project.__name__+'.py') #copies project.py54 copy (__file__, project.output_time_dir + basename(__file__))55 print 'project.output_time_dir',project.output_time_dir #copies this file56 57 58 59 60 boundary_dir_name = project.boundary_dir_name61 62 63 from anuga.shallow_water.data_manager import urs2sww64 65 print 'minlat=project.north_boundary, maxlat=project.south_boundary',project.north_boundary, project.south_boundary66 print 'minlon= project.west_boundary, maxlon=project.east_boundary',project.west_boundary, project.east_boundary67 68 #import sys; sys.exit()69 urs2sww(boundary_dir_name,70 # minlat=project.south, maxlat=project.north,71 # minlon= project.west, maxlon=project.east,72 # mint=0, maxt= 35000,73 verbose='true')74 75 import sys; sys.exit()76 57 #------------------------------------------------------------------------------- 77 58 # Preparation of topographic data … … 102 83 offshore_dir_name14 = project.offshore_dir_name14 103 84 104 105 106 # files to be used107 #file_used = []108 109 85 # creates DEM from asc data 110 86 convert_dem_from_ascii2netcdf(onshore_dir_name, use_cache=True, verbose=True) … … 120 96 verbose=True) 121 97 122 123 98 #creates pts file for islands DEM 124 99 dem2pts(islands_dir_name, use_cache=True, verbose=True) 125 100 126 127 print'create G1' 101 print'create Geospatial data objects from topographies' 128 102 G1 = Geospatial_data(file_name = project.onshore_dir_name + '.pts') 129 103 G2 = Geospatial_data(file_name = project.coast_dir_name + '.xya') … … 145 119 G_off14 = Geospatial_data(file_name = project.offshore_dir_name14 + '.xya') 146 120 147 print'add G1+G2+G3+all offshore data'121 print'add all geospatial objects' 148 122 G = G1 + G2 + G3 + G_off + G_off1 + G_off2 + G_off3 + G_off4 + G_off5 \ 149 123 + G_off6 + G_off7 + G_off8 + G_off9 + G_off10 + G_off11 + G_off12 \ 150 124 + G_off13 + G_off14 151 125 126 print'clip combined geospatial object by bounding polygon' 152 127 G.clip(project.bounding_polygon) 153 128 #FIXME: add a clip function to pts 154 129 155 print'export G' 156 G.export_points_file(project.combined_dir_name + '.pts') 157 import sys; sys.exit() 158 159 130 print'export combined DEM file' 131 if access(project.topographies_time_dir,F_OK) == 0: 132 mkdir (project.topographies_time_dir) 133 G.export_points_file(project.combined_time_dir_name + '.pts') 160 134 161 135 #------------------------------------------------------------------------- 162 136 # Convert URS to SWW file for boundary conditions 163 137 #------------------------------------------------------------------------- 164 165 # filenames 166 meshname = project.mesh_name+'.msh' 167 source_dir = project.boundarydir 168 boundary_file = project.boundaryname 169 170 print 'Available boundary tags', domain.get_boundary_tags() 138 print 'starting to create boundary conditions' 139 boundaries_dir_name = project.boundaries_dir_name 171 140 172 141 from anuga.shallow_water.data_manager import urs2sww 173 142 174 urs2sww(boundary_file, 175 minlat=project.north_boundary, maxlat=project.south_boundary, 143 print 'minlat=project.north_boundary, maxlat=project.south_boundary',project.north_boundary, project.south_boundary 144 print 'minlon= project.west_boundary, maxlon=project.east_boundary',project.west_boundary, project.east_boundary 145 146 if access(project.boundaries_time_dir,F_OK) == 0: 147 mkdir (project.boundaries_time_dir) 148 urs2sww(boundaries_dir_name,basename_out= project.boundaries_time_dir_name, 149 minlat=project.south_boundary, maxlat=project.north_boundary, 176 150 minlon= project.west_boundary, maxlon=project.east_boundary, 151 mint=0, maxt= 35000, 177 152 verbose='true') 153 178 154 179 155 … … 182 158 183 159 160 161 -
anuga_work/production/dampier_2006/project.py
r3841 r3851 35 35 36 36 #mesh_name = 'elevation50m' 37 boundar y_name = 'dampier'38 boundar y_source = 'test'37 boundaries_name = 'dampier' 38 boundaries_source = 'mag_9_corrected' 39 39 40 40 # topography file names … … 68 68 gauges_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'gauges'+sep 69 69 polygons_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'polygons'+sep 70 boundaries_ dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundary_source+sep70 boundaries_in_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundaries_source+sep 71 71 #outputdir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'output'+sep 72 72 tide_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'tide_data'+sep 73 73 74 74 time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir 75 76 output_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'outputs'+sep+time+sep 77 topographies_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'topographies'+sep+time+sep 78 boundaries_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep+time+sep 79 75 build_time = time+'_build' 76 run_time = time+'_run' 77 78 output_build_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'outputs'+sep+build_time+sep 79 output_run_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'outputs'+sep+run_time+sep 80 topographies_time_dir = topographies_dir+build_time+sep 81 boundaries_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep 82 boundaries_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep+build_time+sep 83 84 #ideas 85 #boundaries_time_dir = boundaries_in_dir+'urs'+sep+boundaries_source+sep 80 86 81 87 … … 101 107 offshore_dir_name14 = topographies_dir + offshore_name14 102 108 109 #output dir 103 110 combined_dir_name = topographies_dir + combined_name 104 105 mesh_dir_name = meshes_dir + scenario_name 106 output_dir_name = output_time_dir + scenario_name #Used by post processing 107 boundary_dir_name = boundaries_dir + boundary_name #Used by post processing 111 combined_time_dir_name = topographies_time_dir + combined_name 112 113 meshes_dir_name = meshes_dir + scenario_name 114 115 #output_build_time_dir_name = output_build_time_dir + scenario_name #Used by post processing 116 output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing 117 boundaries_in_dir_name = boundaries_in_dir + boundaries_name 118 boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing 119 120 108 121 109 122 … … 113 126 south = degminsec2decimal_degrees(-20,55,0) 114 127 north = degminsec2decimal_degrees(-20,15,0) 128 #north = degminsec2decimal_degrees(-19,15,0) 115 129 west = degminsec2decimal_degrees(116,17,0) 116 130 east = degminsec2decimal_degrees(117,10,0) 117 131 118 132 #only used to clip boundary condition 119 north_boundary = north + 0.0 5120 south_boundary = south - 0.0 5121 west_boundary = west - 0.0 5122 east_boundary = east + 0.0 5133 north_boundary = north + 0.04 134 south_boundary = south - 0.04 135 west_boundary = west - 0.04 136 east_boundary = east + 0.04 123 137 124 138 -
anuga_work/production/dampier_2006/run_dampier.py
r3828 r3851 3 3 Source data such as elevation and boundary data is assumed to be available in 4 4 directories specified by project.py 5 The output sww file is stored in project.output timedir5 The output sww file is stored in project.output_run_time_dir 6 6 7 7 The scenario is defined by a triangular mesh created from project.polygon, … … 45 45 46 46 # filenames 47 meshname = project.meshname+'.msh'48 source_dir = project.boundarydir49 boundary_file = project.boundaryname50 47 51 from anuga.shallow_water.data_manager import urs2sww 48 build_time = '20061025_113524_build' 49 boundaries_name = project.boundaries_name 50 meshes_dir_name = project.meshes_dir_name+'.msh' 51 #source_dir = project.boundarydir 52 boundaries_time_dir_name = project.boundaries_dir + build_time + sep + boundaries_name 52 53 53 54 #from anuga.shallow_water.data_manager import urs2sww 54 55 55 56 # creates copy of code in output dir if dir doesn't exist 56 if access(project.output timedir,F_OK) == 0:57 print 'project.output timedir',dirname(project.outputtimedir)58 mkdir (project.output timedir,0777)57 if access(project.output_run_time_dir,F_OK) == 0: 58 print 'project.output_run_time_dir',dirname(project.output_run_time_dir) 59 mkdir (project.output_run_time_dir,0777) 59 60 copy (dirname(project.__file__) +sep+ project.__name__+'.py', 60 project.outputtimedir + project.__name__+'.py') 61 copy (__file__, project.outputtimedir + basename(__file__)) 62 print 'project.outputtimedir',project.outputtimedir 63 64 61 project.output_run_time_dir + project.__name__+'.py') 62 copy (__file__, project.output_run_time_dir + basename(__file__)) 63 print 'project.output_run_time_dir',project.output_run_time_dir 65 64 66 65 #-------------------------------------------------------------------------- … … 71 70 #-------------------------------------------------------------------------- 72 71 73 74 72 interior_regions = [#[project.karratha_polygon, 25000], 75 73 #[project.dampier_polygon, 2000], … … 77 75 #[project.point_polygon, 2000]] 78 76 #[project.cipma_polygon, 20000]] 79 [project.cipma_polygon, 40000]] # Caused memory error?77 [project.cipma_polygon, 50000]] # Caused memory error? 80 78 81 79 #--------------------------- … … 103 101 104 102 print 'start create mesh from regions' 105 mesh name = project.meshname + '.msh'103 meshes_dir_name = project.meshes_dir_name + '.msh' 106 104 create_mesh_from_regions(project.bounding_polygon, 107 105 boundary_tags={'back': [7, 8], 'side': [0, 6], 108 106 'ocean': [1, 2, 3, 4, 5]}, 109 maximum_triangle_area= 200000,107 maximum_triangle_area=300000, 110 108 interior_regions=interior_regions, 111 filename=mesh name,109 filename=meshes_dir_name, 112 110 use_cache=True, 113 111 verbose=True) 114 115 112 116 113 #------------------------------------------------------------------------- 117 114 # Setup computational domain 118 115 #------------------------------------------------------------------------- 119 domain = Domain(meshname, use_cache=True, verbose=True) 116 print 'Setup computational domain' 117 domain = Domain(meshes_dir_name, use_cache=True, verbose=True) 120 118 print domain.statistics() 121 domain.set_name(project. basename)122 domain.set_datadir(project.output timedir)119 domain.set_name(project.scenario_name) 120 domain.set_datadir(project.output_run_time_dir) 123 121 domain.set_default_order(2) 124 122 domain.set_minimum_storable_height(0.01) # Don't store anything less than 1cm … … 129 127 # Setup initial conditions 130 128 #------------------------------------------------------------------------- 131 tide = 0.129 tide = 2.4 132 130 domain.set_quantity('stage', tide) 133 131 domain.set_quantity('friction', 0.0) 132 #combined_time_dir_name = project.topographies_dir+build_time+project.combined_name 134 133 domain.set_quantity('elevation', 135 filename = project. datadir + project.basename + '.pts',136 use_cache = False,134 filename = project.topographies_dir + build_time + sep + project.combined_name + '.pts', 135 use_cache = True, 137 136 verbose = True, 138 137 alpha = 0.1) … … 146 145 print 'Available boundary tags', domain.get_boundary_tags() 147 146 148 from anuga.shallow_water.data_manager import urs2sww149 147 150 urs2sww(boundary_file, verbose='true') 151 152 Bf = File_boundary(source_dir + project.boundary_basename + '.sww', 148 Bf = File_boundary(boundaries_time_dir_name + '.sww', 153 149 domain, verbose = True) 150 #Bf = File_boundary(source_dir + project.boundary_scenario_name + '.sww', 151 # domain, verbose = True) 154 152 Br = Reflective_boundary(domain) 155 153 Bd = Dirichlet_boundary([tide,0,0])
Note: See TracChangeset
for help on using the changeset viewer.