filename = 'source_model_Australia_Adaptive_K3_merged_inc_b_mmax_uncert_v1.xml' name = filename.rstrip('.xml') # read list of files # pt_source_model_list =[] # for point_source_model in point_source_list: # print 'Reading %s' % point_source_model # pt_model = read_pt_source(point_source_model) ## pt_source_model_list.append(pt_model) ## combine_pt_sources(pt_source_model_list, filename, name , nrml_version='04', ## id_location_flag = 'id') outfile_bestb = 'smoothed_frankel_50_3_mmin_3.0_merged_bestb.xml' outfile_upperb = 'smoothed_frankel_50_3_mmin_3.0_merged_upperb.xml' outfile_lowerb = 'smoothed_frankel_50_3_mmin_3.0_merged_lowerb.xml' point_source_list = [outfile_bestb, outfile_upperb, outfile_lowerb] filename = 'source_model_smoothed_frankel_50_3_mmin_3.0_merged_inc_b_mmax_uncert_v1.xml' name = filename.rstrip('.xml') # read list of files pt_source_model_list = [] for point_source_model in point_source_list: print 'Reading %s' % point_source_model pt_model = read_pt_source(point_source_model) pt_source_model_list.append(pt_model) combine_pt_sources(pt_source_model_list, filename, name, nrml_version='04', id_location_flag='id')
read_simplefault_source, combine_pt_sources from glob import glob source_model_name = 'National_Fault_Source_Model_2018_Collapsed_AUS6' #area_source_model = '../zones/2012_mw_ge_4.0/NSHA13/input/collapsed/NSHA13_collapsed.xml' area_source_model = '../zones/2012_mw_ge_4.0/AUS6/input/collapsed/AUS6_collapsed.xml' geom_pt_sources_filename = area_source_model[:-4] + '_pts_geom_weighted.xml' tmp_pt_source_filenames = glob( geom_pt_sources_filename.rstrip('.xml') + '_*.xml') num_files = len(tmp_pt_source_filenames) / 2 tmp_pt_source_filename_list = [] tmp_pt_source_list = [] # Now combine into one file for j in range(0, num_files, 1): tmp_pt_filename = geom_filtered_pt_sources_sublist = geom_pt_sources_filename.rstrip('.xml') + \ '_%03d.xml' % j tmp_pt_source_filename_list.append(tmp_pt_filename) for tmp_pt_source_file in tmp_pt_source_filename_list: print 'Reading %s' % tmp_pt_source_file tmp_pt_source = read_pt_source(tmp_pt_source_file) tmp_pt_source_list.append(tmp_pt_source) merged_filename = geom_pt_sources_filename.rstrip( '.xml') + '_merged_parallel.xml' model_name = geom_pt_sources_filename.rstrip('.xml') combine_pt_sources(tmp_pt_source_list, merged_filename, model_name, nrml_version='04', id_location_flag=None)
source_model_name + '_additive_zone.xml') fault_sources = read_simplefault_source( fsm, rupture_mesh_spacing=fault_mesh_spacing) write_combined_faults_points(additive_pt_sources, fault_sources, outfile, model_name, nrml_version='04') # Merge pt source rates merged_filename = area_source_model[:-4] + '_pts_geom_add_merged_pts.xml' model_name = area_source_model.split('/')[-1].rstrip( '.xml') + '_add_geom_merged' combined_pt_sources = combine_pt_sources( [additive_pt_sources, geom_filtered_pt_sources], merged_filename, model_name, nrml_version='04', id_location_flag='location') # Combine merged point sources with merged fault source model print 'Writing collapsed logic tree seismotectonic model' fsm = os.path.join(source_model_name, source_model_name + '_all_methods_collapsed.xml') model_name = source_model_name + '_' + area_source_model_name + '_collapsed' outfile = os.path.join(source_model_name, source_model_name + '_' + \ area_source_model_name +'_all_methods_collapsed.xml') fault_sources = read_simplefault_source( fsm, rupture_mesh_spacing=fault_mesh_spacing) write_combined_faults_points(combined_pt_sources, fault_sources, outfile,