예제 #1
0
            # and taking advantage of the %g format
            if row[4] == 0:
                continue
            row_dict = {
                'Longitude': '%g' % row[0],
                'Latitude': '%g' % row[1],
                'Depth': '%g' % row[2],
                'Observed Count': '%d' % row[3],
                'Smoothed Rate': '%.6g' % row[4],
                'b-value': '%g' % self.bval
            }
            writer.writerow(row_dict)
        fid.close()


SMOOTHED_SEISMICITY_METHODS = CatalogueFunctionRegistry()


@SMOOTHED_SEISMICITY_METHODS.add("run",
                                 completeness=True,
                                 b_value=float,
                                 use_3d=bool,
                                 grid_limits=Grid,
                                 Length_Limit=float,
                                 BandWidth=float,
                                 increment=bool)
class IsotropicGaussianMethod(object):
    def run(self, catalogue, config, completeness=None):
        ss = SmoothedSeismicity(config['grid_limits'], config['use_3d'],
                                config['b_value'])
        return ss.run_analysis(catalogue,
예제 #2
0
파일: base.py 프로젝트: vhmar/oq-engine
# The GEM Foundation, and the authors of the software, assume no
# liability for use of the software.
"""
Module :mod:'openquake.hmtk.seismicity.completeness.base' defines an abstract base class
for :class:'CataloguCompleteness <BaseCatalogueCompleteness>
"""
import abc
from openquake.hmtk.registry import CatalogueFunctionRegistry


class BaseCatalogueCompleteness(object):
    '''
    Abstract base class for implementation of the completeness algorithms
    '''
    __metaclass__ = abc.ABCMeta

    @abc.abstractmethod
    def completeness(self, catalogue, config):
        '''
        :param catalogue:
            Earthquake catalogue as instance of
            :class: openquake.hmtk.seismicity.catalogue.Catalogue

        :param dict config:
            Configuration parameters of the algorithm
        '''
        return


COMPLETENESS_METHODS = CatalogueFunctionRegistry()
예제 #3
0
파일: base.py 프로젝트: vhmar/oq-engine
"""
"""

import abc
from openquake.hmtk.registry import CatalogueFunctionRegistry


class SeismicityOccurrence(object):
    '''Implements recurrence calculations for instrumental seismicity'''
    __metaclass__ = abc.ABCMeta

    @abc.abstractmethod
    def calculate(self, catalogue, config, completeness=None):
        """Implements recurrence calculation

        :param catalogue:
            An instance of :class:`openquake.hmtk.seismicity.catalogue`

        :param dict config:
            The config contains the necessary information to run a specific
            algorithm.

        :param numpy.ndarray completeness:
            The completeness matrix
        """
        return


OCCURRENCE_METHODS = CatalogueFunctionRegistry()
예제 #4
0
    return neq, mmin


class BaseMaximumMagnitude(object):
    '''
    Abstract base class for implementation of the maximum magnitude estimation
    based on instrumental/historical seismicity
    '''
    __metaclass__ = abc.ABCMeta

    @abc.abstractmethod
    def get_mmax(self, catalogue, config):
        '''
        Analyses the catalogue to infer the maximum magnitude from a
        statistical process

        :param catalogue:
            Earthquake catalogue as instance of the :class:
            'openquake.hmtk.seismicity.catalogue.Catalogue'

        :param dict config:
            Configuration parameters of the algorithm

        :returns:
            * Maximum magnitude (float)
            * Maximum magnitude uncertainty (float)
        '''


MAX_MAGNITUDE_METHODS = CatalogueFunctionRegistry()
예제 #5
0
for :class:`CatalogueParser <BaseCatalogueDecluster>`.
"""
import abc
from openquake.hmtk.registry import CatalogueFunctionRegistry


class BaseCatalogueDecluster(object):
    """
    Abstract base class for implementation of declustering algorithms
    """
    __metaclass__ = abc.ABCMeta

    @abc.abstractmethod
    def decluster(self, catalogue, config):
        """
        Implements declustering algorithms

        :param catalogue:
            Catalogue of earthquakes
        :type catalogue:
        :param config:
            Declustering configuration dictionary
        :type config: Dictionary

        Returns two vectors
        """
        return


DECLUSTERER_METHODS = CatalogueFunctionRegistry()