source: anuga_work/production/exmouth_2006/build_exmouth.py @ 4465

Last change on this file since 4465 was 4465, checked in by nick, 18 years ago

updates to exmouth

File size: 5.4 KB
Line 
1"""Script for running tsunami inundation scenario for Dampier, WA, Australia.
2
3Source data such as elevation and boundary data is assumed to be available in
4directories specified by project.py
5The output sww file is stored in project.output_time_dir
6
7The scenario is defined by a triangular mesh created from project.polygon,
8the elevation data and a simulated submarine landslide.
9
10Ole Nielsen and Duncan Gray, GA - 2005 and Jane Sexton, Nick Bartzis, GA - 2006
11"""
12
13#------------------------------------------------------------------------------
14# Import necessary modules
15#------------------------------------------------------------------------------
16
17# Standard modules
18from os import sep
19from os.path import dirname, basename
20from os import mkdir, access, F_OK
21from shutil import copy
22import time
23import sys
24
25# Related major packages
26from anuga.shallow_water import Domain
27from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
28from anuga.geospatial_data.geospatial_data import *
29from anuga.abstract_2d_finite_volumes.util import start_screen_catcher, copy_code_files
30
31# Application specific imports
32import project   # Definition of file names and polygons
33
34#------------------------------------------------------------------------------
35# Copy scripts to time stamped output directory and capture screen
36# output to file
37#------------------------------------------------------------------------------
38
39copy_code_files(project.output_build_time_dir,__file__, 
40               dirname(project.__file__)+sep+ project.__name__+'.py' )
41
42start_screen_catcher(project.output_build_time_dir)
43
44print 'USER:    ', project.user
45
46#-------------------------------------------------------------------------------
47# Preparation of topographic data
48#
49# Convert ASC 2 DEM 2 PTS using source data and store result in source data
50# Do for coarse and fine data
51# Fine pts file to be clipped to area of interest
52#-------------------------------------------------------------------------------
53print"project.combined_dir_name",project.combined_dir_name
54
55# topography directory filenames
56onshore_in_dir_name = project.onshore_in_dir_name
57onshore1_in_dir_name = project.onshore1_in_dir_name
58coast_in_dir_name = project.coast_in_dir_name
59#island_in_dir_name = project.island_in_dir_name
60offshore_in_dir_name = project.offshore_in_dir_name
61#offshore_in_dir_name1 = project.offshore_in_dir_name1
62#offshore_in_dir_name2 = project.offshore_in_dir_name2
63
64onshore_dir_name = project.onshore_dir_name
65onshore1_dir_name = project.onshore1_dir_name
66coast_dir_name = project.coast_dir_name
67#island_dir_name = project.island_dir_name
68offshore_dir_name = project.offshore_dir_name
69#offshore_dir_name1 = project.offshore_dir_name1
70#offshore_dir_name2 = project.offshore_dir_name2
71
72# creates DEM from asc data
73print "creates DEMs from asc data"
74convert_dem_from_ascii2netcdf(onshore_in_dir_name, basename_out=onshore_dir_name, use_cache=True, verbose=True)
75convert_dem_from_ascii2netcdf(onshore1_in_dir_name, basename_out=onshore1_dir_name, use_cache=True, verbose=True)
76
77#creates pts file for onshore DEM
78print "creates pts file for onshore DEM"
79dem2pts(onshore_dir_name, use_cache=True, verbose=True)
80dem2pts(onshore1_dir_name, use_cache=True, verbose=True)
81
82print'create Geospatial data1 objects from topographies',onshore_dir_name + '.pts'
83G1 = Geospatial_data(file_name = onshore_dir_name + '.pts')
84print'create Geospatial data2 objects from topographies',onshore1_dir_name + '.pts'
85G2 = Geospatial_data(file_name = onshore1_dir_name + '.pts')
86print'create Geospatial data3 objects from coast', coast_in_dir_name + '.txt'
87G3 = Geospatial_data(file_name = coast_in_dir_name + '.txt')
88print'create Geospatial data3 objects from offshore',offshore_in_dir_name + '.txt'
89G_off = Geospatial_data(file_name = offshore_in_dir_name + '.txt')
90
91print'add all geospatial objects'
92G = G1 + G2 + G3 + G_off
93
94print'export combined DEM file'
95if access(project.topographies_dir,F_OK) == 0:
96    mkdir (project.topographies_dir)
97print'export',project.combined_dir_name+'_unclipped' + '.txt'
98G.export_points_file(project.combined_dir_name+ '.txt')
99
100print'split'
101G_small, G_other = G_clipped.split(.10,verbose=True)
102
103print 'export', project.combined_small_dir_name + '.txt'
104G_small.export_points_file(project.combined_small_dir_name + '.txt')
105#G_clipped.export_points_file(project.combined_dir_name + '.xya')
106
107
108'''
109print'project.combined_dir_name + 1.xya',project.combined_dir_name + '1.xya'
110G_all=Geospatial_data(file_name = project.combined_dir_name + '1.xya')
111print'split'
112G_all_1, G_all_2 = G_all.split(.10)
113print'export 1'
114G_all_1.export_points_file(project.combined_dir_name+'_small1' + '.xya')
115print'export 2'
116G_all_2.export_points_file(project.combined_dir_name+'_other1' + '.xya')
117'''
118
119#-------------------------------------------------------------------------
120# Convert URS to SWW file for boundary conditions
121#-------------------------------------------------------------------------
122print 'starting to create boundary conditions'
123boundaries_in_dir_name = project.boundaries_in_dir_name
124
125from anuga.shallow_water.data_manager import urs2sww, urs_ungridded2sww
126
127print 'boundaries_in_dir_name',boundaries_in_dir_name
128print 'project.boundaries_dir_name',project.boundaries_dir_name
129
130urs_ungridded2sww(boundaries_in_dir_name, project.boundaries_dir_name,
131                  verbose=True, mint=4000, maxt=35000, zscale=1)
132
133
134
135
136
137
Note: See TracBrowser for help on using the repository browser.