[5575] | 1 | from anuga.utilities.numerical_tools import ensure_numeric |
---|
| 2 | from Scientific.IO.NetCDF import NetCDFFile |
---|
| 3 | from Numeric import asarray,transpose,sqrt,argmax,argmin,arange,Float,\ |
---|
| 4 | compress,zeros,fabs,allclose,ones |
---|
| 5 | from anuga.utilities.polygon import inside_polygon,read_polygon |
---|
| 6 | from os import sep |
---|
| 7 | from time import localtime, strftime, gmtime |
---|
| 8 | from anuga.shallow_water.data_manager import urs2sts,create_sts_boundary |
---|
| 9 | import os |
---|
| 10 | import project |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | ###################################### |
---|
| 14 | # Create urs boundary from mux2files # |
---|
| 15 | ###################################### |
---|
| 16 | |
---|
| 17 | #print project.muxhome |
---|
| 18 | dir=os.path.join(project.muxhome,'mux') |
---|
| 19 | #print dir |
---|
| 20 | prefix=os.path.join(dir,'Java-00') |
---|
| 21 | suffix='-z.grd' |
---|
| 22 | |
---|
| 23 | urs_filenames={} |
---|
| 24 | for filename in os.listdir(dir): |
---|
| 25 | basename = filename[:-7] |
---|
| 26 | |
---|
| 27 | urs_filenames[basename] = True |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | # Make list of basenames |
---|
| 31 | urs_filenames = [os.path.join(dir, basename) for basename in urs_filenames.keys()] |
---|
| 32 | |
---|
| 33 | # AS per David Burbidge email on friday 4th July the mag 9.3 event |
---|
| 34 | # has 1m worth of slip on each sub fault therefore mutliple each unit |
---|
| 35 | # soucre by the slip (10.4544) and sum the 44 time series together to |
---|
| 36 | # get the time series for this event at the points on your boundary. |
---|
| 37 | |
---|
| 38 | weights=10.4544*ones(len(urs_filenames),Float) |
---|
| 39 | |
---|
| 40 | scenario_name=project.scenario_name |
---|
| 41 | order_filename=os.path.join(project.boundaries_dir, 'thinned_bounding_order.txt') |
---|
| 42 | |
---|
| 43 | print 'reading', order_filename |
---|
| 44 | # Create ordered sts file |
---|
| 45 | print 'creating sts file' |
---|
| 46 | |
---|
| 47 | urs2sts(urs_filenames, |
---|
| 48 | basename_out=os.path.join(project.boundaries_dir,scenario_name), |
---|
| 49 | ordering_filename=order_filename, |
---|
| 50 | weights=weights, |
---|
| 51 | mean_stage=project.tide, |
---|
| 52 | verbose=True) |
---|
| 53 | |
---|
| 54 | # Read in boundary from ordered sts file |
---|
| 55 | urs_boundary_polygon=create_sts_boundary(scenario_name) |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | |
---|