source: anuga_work/production/tonga/build_fangauta.py @ 5409

Last change on this file since 5409 was 5194, checked in by herve, 17 years ago

run scripts for tonga

File size: 6.6 KB
Line 
1"""Script for running tsunami inundation scenario for Perth, 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
27#from anuga.shallow_water import Dirichlet_boundary
28#from anuga.shallow_water import File_boundary
29#from anuga.shallow_water import Reflective_boundary
30from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
31#from anuga.pmesh.mesh_interface import create_mesh_from_regions
32from anuga.geospatial_data.geospatial_data import *
33from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
34
35# Application specific imports
36import project_fangauta   # Definition of file names and polygons
37
38#------------------------------------------------------------------------------
39# Copy scripts to time stamped output directory and capture screen
40# output to file
41#------------------------------------------------------------------------------
42
43copy_code_files(project_fangauta.output_build_time_dir,__file__, 
44               dirname(project_fangauta.__file__)+sep+ project_fangauta.__name__+'.py' )
45
46start_screen_catcher(project_fangauta.output_build_time_dir)
47
48print 'USER:    ', project_fangauta.user
49
50#-------------------------------------------------------------------------------
51# Preparation of topographic data
52#
53# Convert ASC 2 DEM 2 PTS using source data and store result in source data
54# Do for coarse and fine data
55# Fine pts file to be clipped to area of interest
56#-------------------------------------------------------------------------------
57print"project.combined_dir_name",project_fangauta.combined_dir_name
58
59# topography directory filenames
60onshore_dir_name = project_fangauta.onshore_dir_name
61onshore_dir_name1 = project_fangauta.onshore_dir_name1
62#island_in_dir_name = project_urs.island_in_dir_name
63#Multibeam_dir_name = project.Multibeam_dir_name
64Singlebeam_dir_name = project_fangauta.Singlebeam_dir_name
65addedpoint_dir_name = project_fangauta.addedpoint_dir_name
66#Chart_dir_name = project.Chart_dir_name
67#Derived_bath_dir_name = project.Derived_bath_dir_name
68#added_data_dir_name =project.added_data_dir_name
69
70
71print'create Geospatial data1 objects from topographies',onshore_dir_name + '.txt'
72G1 = Geospatial_data(file_name = onshore_dir_name + '.txt')
73#print'create Geospatial data2 objects from multibeam', Multibeam_dir_name + '.txt'
74#G_off = Geospatial_data(file_name = Multibeam_dir_name + '.txt')
75#print'create Geospatial data3 objects from island'
76#G3 = Geospatial_data(file_name = island_dir_name + '.pts')
77print'create Geospatial data3 objects from singlebeam',Singlebeam_dir_name + '.txt'
78G_off1 = Geospatial_data(file_name = Singlebeam_dir_name + '.txt')
79
80print'create Geospatial data1 objects from topographies',addedpoint_dir_name + '.txt'
81G2 = Geospatial_data(file_name = addedpoint_dir_name + '.txt')
82
83print'create Geospatial data1 objects from topographies',onshore_dir_name1 + '.txt'
84Goff2=Geospatial_data(file_name = onshore_dir_name1 + '.txt')
85#print'create Geospatial data4 objects from chart',Chart_dir_name + '.txt'
86#G_off2 = Geospatial_data(file_name = Chart_dir_name + '.txt')
87#print'create Geospatial data4 objects from derived bathymetry',Derived_bath_dir_name + '.txt'
88#G_off3 = Geospatial_data(file_name = Derived_bath_dir_name + '.txt')
89#print'create Geospatial data objects from added data',added_data_dir_name + '.txt'
90#G_off4 = Geospatial_data(file_name = added_data_dir_name + '.txt')
91Gislands=Goff2.clip(Geospatial_data(project_fangauta.poly_island_Pea))+Goff2.clip(Geospatial_data(project_fangauta.poly_island_Mua))
92print'add all geospatial objects'
93G = G1 + G_off1+G2+Gislands
94
95#print'clip combined geospatial object by bounding polygon'
96#G_clipped = G.clip(project_urs.poly_all)
97#FIXME: add a clip function to pts
98#print'shape of clipped data', G_clipped.get_data_points().shape
99
100print'export combined DEM file'
101if access(project_fangauta.topographies_dir,F_OK) == 0:
102    mkdir (project_fangauta.topographies_dir)
103print'export',project_fangauta.combined_dir_name+ '.txt'
104G.export_points_file(project_fangauta.combined_dir_name+ '.txt')
105
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
126
127print 'minlat=project.north_boundary, maxlat=project.south_boundary',project.north_boundary, project.south_boundary
128print 'minlon= project.west_boundary, maxlon=project.east_boundary',project.west_boundary, project.east_boundary
129
130#import sys; sys.exit()
131
132#if access(project.boundaries_dir,F_OK) == 0:
133#    mkdir (project.boundaries_dir)
134
135from caching import cache
136cache(urs2sww,
137      (boundaries_in_dir_name,
138       project.boundaries_dir_name1),
139      {'verbose': True,
140       'minlat': project.south_boundary,
141       'maxlat': project.north_boundary,
142       'minlon': project.west_boundary,
143       'maxlon': project.east_boundary,
144#       'minlat': project.south,
145#       'maxlat': project.north,
146#       'minlon': project.west,
147#       'maxlon': project.east,
148       'mint': 0, 'maxt': 40000,
149#       'origin': domain.geo_reference.get_origin(),
150       'mean_stage': project.tide,
151#       'zscale': 1,                 #Enhance tsunami
152       'fail_on_NaN': False},
153       verbose = True,
154       )
155#       dependencies = source_dir + project.boundary_basename + '.sww')
156
157'''
158
159
160
161
162
163
164
Note: See TracBrowser for help on using the repository browser.