input_file = 'data_input/hmtk_bsb2013.csv' parser = CsvCatalogueParser(input_file) catalogue = parser.read_file() print 'Input complete: %s events in catalogue' % catalogue.get_number_events() print 'Catalogue Covers the Period: %s to %s' % (catalogue.start_year, catalogue.end_year) # Sort catalogue chronologically catalogue.sort_catalogue_chronologically() print 'Catalogue sorted chronologically!' # Plot magnitude time density from hmtk.plotting.seismicity.catalogue_plots import plot_magnitude_time_density magnitude_bin = 0.2 time_bin = 10.0 plot_magnitude_time_density(catalogue, magnitude_bin, time_bin) # In[ ]: mmax_config = {'b-value': 1.0, 'input_mmin': 4.5, 'input_mmax': None, 'input_mmax_uncertainty': 0.5} mmax_ks = KijkoSellevolFixedb() mmax, mmax_sigma = mmax_ks.get_mmax(catalogue, mmax_config) print 'Mmax = %8.3f +/- %8.3f' %(mmax, mmax_sigma)
plot_rate(catalogue, cumulative=True, color='#22475E', new_figure=False, overlay=True, linewidth=1.5, label="Original", alpha=0.8) plt.legend(loc="upper left", fontsize='small') plt.show() # seismic_rate plot #plot_rate(catalogue, color='#5fbdce', filename=output_base+"_rate.png", linewidth=2) # seismic_cumulative rate plot #plot_rate(catalogue, cumulative=True, color='#5fbdce', filename=output_base+"_cum.png", linewidth=2) #catalogue = # completeness catalog if plot_density: # magnitude density plot plot_magnitude_time_density(catalogue, mag_int=0.5, time_int=1.0, filename=output_base+"_time_density.png", figsize=(18,6)) if plot_stepp: # completeness analysis stepp = Stepp1971() completeness_config = {'magnitude_bin': 0.5, 'time_bin': 2.5, 'increment_lock': True} print completeness_config # Run analysis print 'Running Stepp (1971) completeness analysis:' print np.min(catalogue.data['magnitude']) completeness_table = stepp.completeness(catalogue, completeness_config)
'max_lat': 14.0, 'resolution': 'l' } # Create a hmtk basemap basemap1 = HMTKBaseMap(map_config, 'Earthquake Catalogue') # Add a catalogue basemap1.add_catalogue(catalogue) # In[ ]: # Limit the catalogue to the time period 1960 - 2012 valid_time = np.logical_and(catalogue.data['year'] >= 1900, catalogue.data['year'] <= 2014) catalogue.select_catalogue_events(valid_time) plot_magnitude_time_density(catalogue, 0.2, 2.0) print 'Catalogue now contains %s events' % catalogue.get_number_events() # In[ ]: # Show distribution of magnitudes with time plot_magnitude_time_scatter(catalogue, fmt_string='.') # In[ ]: # Plot the magnitude-time density magnitude_bin = 0.2 time_bin = 5.0 # in Decimal Years plot_magnitude_time_density(catalogue, magnitude_bin, time_bin) # In[ ]:
parser = nrmlSourceModelParser(source_model_file) source_model = parser.read_file(2.0) # add source model #basemap1.add_source_model(source_model, area_border, border_width, point_marker, point_size, overlay) #basemap1.add_source_model(source_model, overlay=True) if plot_mag_time_count: filename = "/Users/pirchiner/Desktop/tmp_plot.png" # Limit the catalogue to the time period 1960 - 2012 valid_time = np.logical_and(catalogue.data['year'] >= 1960, catalogue.data['year'] <= 2014) catalogue.select_catalogue_events(valid_time) plot_magnitude_time_density(catalogue, 0.5, 1.0, filename=filename, figsize=(18, 6)) print 'Catalogue now contains %s events' % catalogue.get_number_events() # Show distribution of magnitudes with time #plot_magnitude_time_scatter(catalogue, fmt_string='o', alpha=0.3, linewidth=0.0) # Depth histogram # plot_depth_histogram(catalogue, 10.) filename = "/Users/pirchiner/Desktop/tmp_plot.png" # Time-varying completeness completeness = np.array([[1980., 3.0], [1985., 4.0], [1964., 5.0], [1910., 6.5], [1900., 9.0]])
selector1 = CatalogueSelector(catalogue_depth_clean, create_copy=True) for source in source_model.sources: source.select_catalogue(selector1) llon, ulon, llat, ulat = source.catalogue.get_bounding_box() print llon, ulon, llat, ulat # Map the Source src_basemap = HMTKBaseMap(map_config, "Source: {:s}".format(source.name)) print "Source ID: %s Source Name: %s Number of Events: %g" % ( source.id, source.name, source.catalogue.get_number_events()) # Add on the catalogue src_basemap.add_catalogue(source.catalogue, overlay=False) completeness_table_a = np.array([[1990., 3.0], [1980., 3.5], [1965., 4.0]]) plot_magnitude_time_density(source.catalogue, 0.1, 1.0, completeness=completeness_table_a) grid_lims = [110., 160.0, 0.1, -45.0, -5.0, 0.1, 0., 20., 20.] try: os.remove("Aus1_tmp.hdf5") except OSError: pass config = { "bandwidth": 50, "r_min": 1.0E-7, "bvalue": 1.0, "mmin": 3.0, "learning_start": 1965, "learning_end": 2003,
source_model_file = "/Users/pirchiner/dev/pshab/dourado_reproduction/source_model.xml" # read source model file parser = nrmlSourceModelParser(source_model_file) source_model = parser.read_file(2.0) # add source model # basemap1.add_source_model(source_model, area_border, border_width, point_marker, point_size, overlay) # basemap1.add_source_model(source_model, overlay=True) if plot_mag_time_count: filename = "/Users/pirchiner/Desktop/tmp_plot.png" # Limit the catalogue to the time period 1960 - 2012 valid_time = np.logical_and(catalogue.data["year"] >= 1960, catalogue.data["year"] <= 2014) catalogue.select_catalogue_events(valid_time) plot_magnitude_time_density(catalogue, 0.5, 1.0, filename=filename, figsize=(18, 6)) print "Catalogue now contains %s events" % catalogue.get_number_events() # Show distribution of magnitudes with time # plot_magnitude_time_scatter(catalogue, fmt_string='o', alpha=0.3, linewidth=0.0) # Depth histogram # plot_depth_histogram(catalogue, 10.) filename = "/Users/pirchiner/Desktop/tmp_plot.png" # Time-varying completeness completeness = np.array([[1980.0, 3.0], [1985.0, 4.0], [1964.0, 5.0], [1910.0, 6.5], [1900.0, 9.0]]) plot_observed_recurrence(