source: anuga_work/production/perth/build_boundary.py @ 5551

Last change on this file since 5551 was 5551, checked in by ole, 14 years ago

Work towards using the STS boundary with the Perth production script

File size: 1.5 KB
Line 
1from anuga.utilities.numerical_tools import ensure_numeric
2from Scientific.IO.NetCDF import NetCDFFile
3from Numeric import asarray,transpose,sqrt,argmax,argmin,arange,Float,\
4    compress,zeros,fabs,allclose,ones
5from anuga.utilities.polygon import inside_polygon,read_polygon
6from os import sep
7from time import localtime, strftime, gmtime
8from anuga.shallow_water.data_manager import urs2sts,create_sts_boundary
9import os
10import project
11
12
13######################################
14# Create urs boundary from mux2files #
15######################################
16
17#print project.muxhome
18dir=os.path.join(project.muxhome,'mux')
19#print dir
20prefix=os.path.join(dir,'Java-00')
21suffix='-z.grd'
22
23
24
25
26urs_filenames={}
27for filename in os.listdir(dir):
28    basename = filename[:-7]
29
30    urs_filenames[basename] = True
31
32
33# Make list of basenames 
34urs_filenames = [os.path.join(dir, basename) for basename in urs_filenames.keys()]
35
36# Reduce this list slightly
37urs_filenames = urs_filenames[:30]
38for name in urs_filenames:
39    print name
40
41weights=10.4544*ones(len(urs_filenames),Float)
42
43base_name=project.scenario_name
44order_filename=os.path.join(project.boundaries_dir, 'boundary_ordering.txt')
45
46print 'reading', order_filename
47# Create ordered sts file
48print 'creating sts file'
49urs2sts(urs_filenames,basename_out=base_name,
50        ordering_filename=order_filename,
51        weights=weights,
52        mean_stage=project.tide,
53        verbose=True)
54
55# Read in boundary from ordered sts file
56urs_boundary=create_sts_boundary(base_name)
57
Note: See TracBrowser for help on using the repository browser.