source: anuga_work/production/galle_2007/build_gal5.py @ 6842

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

add Sri Lanka scenario Galle, this was used by Saman

File size: 4.7 KB
Line 
1"""
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
42#start_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#-------------------------------------------------------------------------------
53# Create DEM from asc data
54'''
55convert_dem_from_ascii2netcdf(galle_dem_name, use_cache=True, verbose=True)
56convert_dem_from_ascii2netcdf(hikka_dem_name, use_cache=True, verbose=True)
57convert_dem_from_ascii2netcdf(topo_dem_name, use_cache=True, verbose=True)
58convert_dem_from_ascii2netcdf(bathycoa_dem_name, use_cache=True, verbose=True)
59#convert_dem_from_ascii2netcdf(bathyfine_dem_name, use_cache=True, verbose=True)
60
61# Create pts file for onshore DEM
62dem2pts(galle_dem_name, use_cache=True, verbose=True)
63dem2pts(hikka_dem_name, use_cache=True, verbose=True)
64dem2pts(topo_dem_name, use_cache=True, verbose=True)
65dem2pts(bathycoa_dem_name, use_cache=True, verbose=True)
66#dem2pts(bathyfine_dem_name, use_cache=True, verbose=True)
67
68# DEM
69G1 = Geospatial_data(file_name = project.galle_dem_name + '.pts')
70print 'loading fine bathy data'
71G2 = Geospatial_data(file_name = project.hikka_dem_name + '.pts')
72print 'loading fine bathy data'
73G3 = Geospatial_data(file_name = project.topo_dem_name + '.pts')
74G6 = Geospatial_data(file_name = project.coast_name + '.txt')
75print 'loading fine bathy data'
76G4 = Geospatial_data(file_name = project.bathyfine_dem_name + '.pts')
77G5 = Geospatial_data(file_name = project.bathycoa_dem_name + '.pts')
78G7 = Geospatial_data(file_name = project.canal_dem_name + '.txt')
79G8 = Geospatial_data(file_name = project.fort_dem_name+'.txt')
80
81# coastline
82#G4.export_points_file(project.bathyfine_dem_name + '.txt')
83
84print 'clip G5'
85G5_clip = G5.clip_outside(Geospatial_data(project.poly_clip))
86print 'adding data files together'
87#G = G1 + G2 + G3 + G4 + G6 + G5_clip
88G = G1 + G2 + G3 + G4 + G6 + G5 + G7 + G8
89#G = G1 + G2 + G3 + G4 + G6 + G5 + G7
90#G = G1 + G2 + G3 + G5 + G6
91print 'exporting elevation file'
92G.export_points_file(project.combined_canal_fort_dem_name + '.txt')
93
94
95print'load data'
96G = Geospatial_data(file_name = project.coast_name + '.txt')
97#G = Geospatial_data(file_name = project.combined_canal_dem_name + '.txt')
98print'split combined data set'
99G_small, G_other = G.split(0.1, True)
100G_small.export_points_file(project.combined_small_dem_name+ '1.txt')
101'''
102# if you would like to look at your points file in GIS environment
103# use this line and then change extension to txt for import into ArcGIS
104#G.export_points_file(combined_dem_name + '.xya')
105
106
107print 'start ferret2sww'
108from anuga.shallow_water.data_manager import ferret2sww
109
110#note only need to do when an SWW file for the MOST boundary doesn't exist
111
112ferret2sww(project.boundaries_in_dir_name,
113       project.boundaries_dir_name,
114       verbose = True,
115#       minlat = project.south_source,
116#       maxlat = project.north_source,
117#       minlon = project.west_source,
118#       maxlon = project.east_source,
119       mint = None, maxt = None,
120       zscale = 1,
121       fail_on_NaN = False,
122       )
123
124
Note: See TracBrowser for help on using the repository browser.