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

Last change on this file since 4483 was 4483, checked in by nick, 17 years ago
File size: 5.8 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
30from anuga_parallel.parallel_abstraction import get_processor_name
31
32# Application specific imports
33import project   # Definition of file names and polygons
34
35#------------------------------------------------------------------------------
36# Copy scripts to time stamped output directory and capture screen
37# output to file
38#------------------------------------------------------------------------------
39
40copy_code_files(project.output_build_time_dir,__file__, 
41               dirname(project.__file__)+sep+ project.__name__+'.py' )
42
43start_screen_catcher(project.output_build_time_dir)
44
45print "Processor Name:",get_processor_name()
46print 'USER:    ', project.user
47
48#-------------------------------------------------------------------------------
49# Preparation of topographic data
50#
51# Convert ASC 2 DEM 2 PTS using source data and store result in source data
52# Do for coarse and fine data
53# Fine pts file to be clipped to area of interest
54#-------------------------------------------------------------------------------
55print"project.combined_dir_name",project.combined_dir_name
56
57# topography directory filenames
58onshore_in_dir_name = project.onshore_in_dir_name
59onshore1_in_dir_name = project.onshore1_in_dir_name
60coast_in_dir_name = project.coast_in_dir_name
61#island_in_dir_name = project.island_in_dir_name
62offshore_in_dir_name = project.offshore_in_dir_name
63#offshore_in_dir_name1 = project.offshore_in_dir_name1
64#offshore_in_dir_name2 = project.offshore_in_dir_name2
65
66onshore_dir_name = project.onshore_dir_name
67onshore1_dir_name = project.onshore1_dir_name
68coast_dir_name = project.coast_dir_name
69#island_dir_name = project.island_dir_name
70offshore_dir_name = project.offshore_dir_name
71#offshore_dir_name1 = project.offshore_dir_name1
72#offshore_dir_name2 = project.offshore_dir_name2
73'''
74# creates DEM from asc data
75print "creates DEMs from asc data"
76convert_dem_from_ascii2netcdf(onshore_in_dir_name, basename_out=onshore_dir_name, use_cache=True, verbose=True)
77convert_dem_from_ascii2netcdf(onshore1_in_dir_name, basename_out=onshore1_dir_name, use_cache=True, verbose=True)
78
79#creates pts file for onshore DEM
80print "creates pts file for onshore DEM"
81dem2pts(onshore_dir_name, use_cache=True, verbose=True)
82dem2pts(onshore1_dir_name, use_cache=True, verbose=True)
83'''
84print'create Geospatial data1 objects from topographies',onshore_dir_name + '.pts'
85G1 = Geospatial_data(file_name = onshore_dir_name + '.pts',verbose=True)
86print'create Geospatial data2 objects from topographies',onshore1_dir_name + '.pts'
87G2 = Geospatial_data(file_name = onshore1_dir_name + '.pts',verbose=True)
88print'create Geospatial data3 objects from coast', coast_in_dir_name + '.txt'
89G3 = Geospatial_data(file_name = coast_in_dir_name + '.txt',verbose=True)
90print'create Geospatial data3 objects from offshore',offshore_in_dir_name + '.txt'
91G_off = Geospatial_data(file_name = offshore_in_dir_name + '.txt',verbose=True)
92
93print'add all geospatial objects'
94G = G2 + G3 + G_off
95
96print'add DLI data'
97G = G + G1
98
99print'export combined DEM file'
100if access(project.topographies_dir,F_OK) == 0:
101    mkdir (project.topographies_dir)
102print'export',project.combined_dir_name+'_unclipped' + '.txt'
103#G.export_points_file(project.combined_dir_name+ '.txt')
104
105print'create Geospatial data1 objects from topographies',onshore_dir_name + '.pts'
106#G = Geospatial_data(file_name = project.combined_dir_name+ '.txt',verbose=True)
107
108print'split'
109G_small, G_other = G.split(.10,verbose=True)
110
111print 'export', project.combined_small_dir_name + '.txt'
112G_small.export_points_file(project.combined_small_dir_name + '.txt')
113#G_clipped.export_points_file(project.combined_dir_name + '.xya')
114'''
115
116
117print'project.combined_dir_name + 1.xya',project.combined_dir_name + '1.xya'
118G_all=Geospatial_data(file_name = project.combined_dir_name + '1.xya')
119print'split'
120G_all_1, G_all_2 = G_all.split(.10)
121print'export 1'
122G_all_1.export_points_file(project.combined_dir_name+'_small1' + '.xya')
123print'export 2'
124G_all_2.export_points_file(project.combined_dir_name+'_other1' + '.xya')
125
126
127#-------------------------------------------------------------------------
128# Convert URS to SWW file for boundary conditions
129#-------------------------------------------------------------------------
130print 'starting to create boundary conditions'
131boundaries_in_dir_name = project.boundaries_in_dir_name
132
133from anuga.shallow_water.data_manager import urs2sww, urs_ungridded2sww
134
135print 'boundaries_in_dir_name',boundaries_in_dir_name
136print 'project.boundaries_dir_name',project.boundaries_dir_name
137
138urs_ungridded2sww(boundaries_in_dir_name, project.boundaries_in_dir_name,
139                  verbose=True, mint=4000, maxt=35000, zscale=1)
140
141'''
142
143
144
145
Note: See TracBrowser for help on using the repository browser.