示例#1
0
    def _get_principal_axes_from_ndk_string(self, ndk_string, exponent):
        """
        Gets the principal axes from the ndk string and returns an instance
        of the GCMTPrincipalAxes class
        """
        axes = GCMTPrincipalAxes()
        # The principal axes is defined in characters 3:48 of the 5th line
        exponent = 10.**exponent
        axes.t_axis = {
            'eigenvalue': exponent * float(ndk_string[0:8]),
            'plunge': float(ndk_string[8:11]),
            'azimuth': float(ndk_string[11:15])
        }

        axes.b_axis = {
            'eigenvalue': exponent * float(ndk_string[15:23]),
            'plunge': float(ndk_string[23:26]),
            'azimuth': float(ndk_string[26:30])
        }

        axes.p_axis = {
            'eigenvalue': exponent * float(ndk_string[30:38]),
            'plunge': float(ndk_string[38:41]),
            'azimuth': float(ndk_string[41:])
        }
        return axes
    def _get_principal_axes_from_ndk_string(self, ndk_string, exponent):
        """
        Gets the principal axes from the ndk string and returns an instance
        of the GCMTPrincipalAxes class
        """
        axes = GCMTPrincipalAxes()
        # The principal axes is defined in characters 3:48 of the 5th line
        exponent = 10. ** exponent
        axes.t_axis = {'eigenvalue': exponent * float(ndk_string[0:8]),
                       'plunge': float(ndk_string[8:11]),
                       'azimuth': float(ndk_string[11:15])}

        axes.b_axis = {'eigenvalue': exponent * float(ndk_string[15:23]),
                       'plunge': float(ndk_string[23:26]),
                       'azimuth': float(ndk_string[26:30])}

        axes.p_axis = {'eigenvalue': exponent * float(ndk_string[30:38]),
                       'plunge': float(ndk_string[38:41]),
                       'azimuth': float(ndk_string[41:])}
        return axes