Changeset 6329
- Timestamp:
- Feb 13, 2009, 10:39:47 AM (16 years ago)
- Location:
- anuga_work/production/busselton/standardised_version
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/busselton/standardised_version/build_urs_boundary.py
r6326 r6329 22 22 #------------------------------------------------------------------------------- 23 23 def get_sts_gauge_data(filename, verbose=False): 24 print 'get_sts_gauge_data: filename=%s' % filename 24 25 fid = NetCDFFile(filename+'.sts', 'r') #Open existing file for read 25 26 permutation = fid.variables['permutation'][:] … … 87 88 ## 88 89 # @brief Build boundary STS files from one or more MUX files. 89 # @param mux_dir Directory containing the MUX files. 90 # @param event_file Path to meta-file containing mux files+weight data. 90 # @param event_file Name of mux meta-file or single mux stem. 91 91 # @param output_dir Directory to write STS data to. 92 92 # @note 'event_file' is produced by EventSelection. 93 def build_urs_boundary( mux_dir,event_file, output_dir):93 def build_urs_boundary(event_file, output_dir): 94 94 '''Build a boundary STS file from a set of MUX files.''' 95 95 96 print 'build_urs_boundary: mux_dir=%s' % mux_dir97 96 print 'build_urs_boundary: event_file=%s' % event_file 98 97 print 'build_urs_boundary: output_dir=%s' % output_dir 99 98 100 99 # if we are using an EventSelection multi-mux file 101 if project.multi_mux: 102 # get the mux+weight data from the event file 103 mux_event_file = os.path.join(mux_dir, event_file) 100 if project.multi_mux: 101 print 'using multi-mux file' 102 # get the mux+weight data from the meta-file (in <boundaries>) 103 mux_event_file = os.path.join(project.boundaries_folder, event_file) 104 104 try: 105 105 fd = open(mux_event_file, 'r') … … 130 130 split_index = muxname.index('.grd') 131 131 muxname = muxname[:split_index+len('.grd')] 132 muxname = os.path.join( mux_dir, muxname)132 muxname = os.path.join(project/mux_data_folder, muxname) 133 133 mux_filenames.append(muxname) 134 134 … … 144 144 verbose=True) 145 145 else: # a single mux stem file, assume 1.0 weight 146 mux_filenames = [os.path.join(mux_dir, event_file)] 146 print 'using single-mux file' 147 mux_filenames = [os.path.join(project.mux_data_folder, event_file)] 147 148 148 149 weight_factor = 1.0 149 150 mux_weights = weight_factor*num.ones(len(mux_filenames), num.Float) 150 151 151 order_filename = project. order_filename_dir152 order_filename = project.urs_order 152 153 153 154 print 'reading', order_filename 154 155 # Create ordered sts file 155 156 print 'creating sts file' 157 print 'mux_filenames=%s' % str(mux_filenames) 158 print 'output_dir=%s' % str(output_dir) 159 print 'mux_weights=%s' % str(mux_weights) 160 print 'project.tide=%s' % str(project.tide) 156 161 urs2sts(mux_filenames, 157 162 basename_out=output_dir, -
anuga_work/production/busselton/standardised_version/file_length.py
r6327 r6329 7 7 Returns: number of lines in file 8 8 """ 9 9 10 def file_length(in_file): 11 '''Function to return the number of lines in a file. 12 13 in_file: Path to the file to get number of lines in. 14 15 Returns: number of lines in file 16 ''' 17 10 18 fid = open(in_file) 11 19 data = fid.readlines() -
anuga_work/production/busselton/standardised_version/project.py
r6324 r6329 27 27 # One or all can be changed each time the run_model script is executed 28 28 tide = 0 # difference between MSL and HAT 29 event_number = 2 6633# the event number29 event_number = 27197 # the event number 30 30 alpha = 0.1 # smoothing parameter for mesh 31 31 friction=0.01 # manning's friction coefficient … … 119 119 # MUX input filename. 120 120 # If a meta-file from EventSelection is used, set 'multi-mux' to True. 121 # If a single MUX stem filename is used, set 'multi-mux' to False.122 mux_input_filename = ' event_026633.list'123 multi_mux = True121 # If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False. 122 mux_input_filename = 'Java-0016-z.grd' 123 multi_mux = False 124 124 125 125 #------------------------------------------------------------------------------- … … 175 175 gtime = strftime('%Y%m%d_%H%M%S', gmtime()) 176 176 build_time = time + '_build' 177 run_time = time + '_run '177 run_time = time + '_run_' 178 178 179 179 # create paths generated from environment variables. … … 193 193 # MUX data files 194 194 # Directory containing the MUX data files to be used with EventSelection. 195 mux_data_folder = '/nas/gemd/georisk_models/tsunami/models/PTHA/Australia/mux'195 mux_data_folder = join(muxhome, 'mux') 196 196 197 197 #------------------------------------------------------------------------------- -
anuga_work/production/busselton/standardised_version/run_model.py
r6328 r6329 62 62 63 63 # Create the STS file 64 bub.build_urs_boundary(project.mux_data_folder, 65 project.mux_input,64 print 'project.mux_data_folder=%s' % project.mux_data_folder 65 bub.build_urs_boundary(project.mux_input_filename, 66 66 os.path.join(project.event_folder, 67 67 project.scenario_name)) … … 78 78 79 79 # Number of boundary segments 80 N= len(event_sts) - 180 num_ocean_segments = len(event_sts) - 1 81 81 # Number of landward_boundary points 82 M= file_length(project.landward_boundary)82 num_land_points = file_length(project.landward_boundary) 83 83 84 84 # Boundary tags refer to project.landward_boundary 85 85 # 4 points equals 5 segments start at N 86 boundary_tags={'back': range(N+1,N+M), 87 'side': [N,N+M], 88 'ocean': range(N)} 86 boundary_tags={'back': range(num_ocean_segments+1, 87 num_ocean_segments+num_land_points), 88 'side': [num_ocean_segments, 89 num_ocean_segments+num_land_points], 90 'ocean': range(num_ocean_segments)} 89 91 90 92 # Build mesh and domain
Note: See TracChangeset
for help on using the changeset viewer.