csep.core.catalogs.AbstractBaseCatalog
- class csep.core.catalogs.AbstractBaseCatalog(filename=None, data=None, catalog_id=None, format=None, name=None, region=None, compute_stats=True, filters=None, metadata=None, date_accessed=None)[source]
Abstract catalog base class for PyCSEP catalogs. This class should not and cannot be used on its own. This just provides the interface for implementing custom catalog classes.
- __init__(filename=None, data=None, catalog_id=None, format=None, name=None, region=None, compute_stats=True, filters=None, metadata=None, date_accessed=None)[source]
- Standard catalog format for CSEP catalogs. Primary event data are stored in structured numpy array. Additional
metadata are available by the event_id in the catalog metadata information.
- Parameters:
filename – location of catalog
catalog (numpy.ndarray or eventlist) – catalog data
catalog_id – catalog id number (used for stochastic event set forecasts)
format – identification used for serialization
name – human readable name of catalog
region – spatial and magnitude region
compute_stats – whether statistics should be computed for the catalog
filters (str or list) – filtering operations to apply to the catalog
metadata (dict) – additional information for events
date_accessed (str) – time string when catalog was accessed
Methods
__init__([filename, data, catalog_id, ...])Standard catalog format for CSEP catalogs. Primary event data are stored in structured numpy array. Additional
apply_mct(m_main, event_epoch[, mc])Applies time-dependent magnitude of completeness following a mainshock.
b_positive()Implements the b-positive indicator from Nicholas van der Elst
filter([statements, in_place])Filters the catalog based on statements.
filter_spatial([region, update_stats, in_place])Removes events outside of the region.
from_dataframe(df, **kwargs)Creates catalog from dataframe.
from_dict(adict, **kwargs)Creates a class from the dictionary representation of the class state.
get_bbox()Returns bounding box of all events in the catalog
get_bvalue([mag_bins, return_error])Estimates the b-value of a catalog from Marzocchi and Sandri (2003).
get_csep_format()This method should be overwritten for catalog formats that do not adhere to the CSEP ZMAP catalog format.
get_cumulative_number_of_events()Returns the cumulative number of events in the catalog.
get_datetimes()Returns datetime object from timestamp representation in catalog
get_depths()Returns depths of all events in catalog
get_epoch_times()Returns the datetime of the event as the UTC epoch time (aka unix timestamp)
get_event_ids()get_latitudes()Returns latitudes of all events in catalog
get_longitudes()Returns longitudes of all events in catalog
get_mag_idx()Return magnitude index from region magnitudes
get_magnitudes()Returns magnitudes of all events in catalog
get_number_of_events()Computes the number of events from a catalog by checking its length.
get_spatial_idx()Return spatial index of region for a longitudes and latitudes in catalog.
length_in_seconds()Returns catalog length in seconds assuming that the catalog is sorted by time.
load_catalog(filename[, loader])load_json(filename, **kwargs)Loads catalog from JSON file
magnitude_counts([mag_bins, tol, retbins])Computes the count of events within magnitude bins
plot([ax, show, extent, set_global, plot_args])Plot catalog according to plate-carree projection
spatial_counts()Returns counts of events within discrete spatial region
spatial_event_probability()spatial_magnitude_counts([mag_bins, tol])Return counts of events in space-magnitude bins.
to_dataframe([with_datetime])Returns pandas Dataframe describing the catalog.
to_dict()Serializes class to json dictionary.
update_catalog_stats()Compute summary statistics of events in catalog
write_ascii(filename[, write_header, ...])Write catalog in csep2 ascii format.
write_json(filename)Writes catalog to json file
Attributes
catalogdatadtypeevent_countNumber of events in catalog
log