def gcmt_to_simple_array(self, centroid_location=True):
        """
        Converts the GCMT catalogue to a simple array of
        [ID, year, month, day, hour, minute, second, long., lat., depth, Mw,
        strike1, dip1, rake1, strike2, dip2, rake2, b-plunge, b-azimuth,
        b-eigenvalue, p-plunge, p-azimuth, p-eigenvalue, t-plunge, t-azimuth,
        t-eigenvalue, moment, f_clvd, erel]
        """
        catalogue = np.zeros([self.get_number_tensors(), 29], dtype=float)
        for iloc, tensor in enumerate(self.gcmts):
            catalogue[iloc, 0] = iloc
            if centroid_location:
                catalogue[iloc, 1] = float(tensor.centroid.date.year)
                catalogue[iloc, 2] = float(tensor.centroid.date.month)
                catalogue[iloc, 3] = float(tensor.centroid.date.day)
                catalogue[iloc, 4] = float(tensor.centroid.time.hour)
                catalogue[iloc, 5] = float(tensor.centroid.time.minute)
                catalogue[iloc, 6] = np.round(
                    np.float(tensor.centroid.time.second) +
                    np.float(tensor.centroid.time.microsecond) / 1000000., 2)
                catalogue[iloc, 7] = tensor.centroid.longitude
                catalogue[iloc, 8] = tensor.centroid.latitude
                catalogue[iloc, 9] = tensor.centroid.depth
            else:
                catalogue[iloc, 1] = float(tensor.hypocentre.date.year)
                catalogue[iloc, 2] = float(tensor.hypocentre.date.month)
                catalogue[iloc, 3] = float(tensor.hypocentre.date.day)
                catalogue[iloc, 4] = float(tensor.hypocentre.time.hour)
                catalogue[iloc, 5] = float(tensor.hypocentre.time.minute)
                catalogue[iloc, 6] = np.round(
                    np.float(tensor.centroid.time.second) +
                    np.float(tensor.centroid.time.microsecond) / 1000000., 2)
                catalogue[iloc, 7] = tensor.hypocentre.longitude
                catalogue[iloc, 8] = tensor.hypocentre.latitude
                catalogue[iloc, 9] = tensor.hypocentre.depth
            catalogue[iloc, 10] = tensor.magnitude
            catalogue[iloc, 11] = tensor.moment
            catalogue[iloc, 12] = tensor.f_clvd
            catalogue[iloc, 13] = tensor.e_rel
            # Nodal planes
            catalogue[iloc, 14] = tensor.nodal_planes.nodal_plane_1['strike']
            catalogue[iloc, 15] = tensor.nodal_planes.nodal_plane_1['dip']
            catalogue[iloc, 16] = tensor.nodal_planes.nodal_plane_1['rake']
            catalogue[iloc, 17] = tensor.nodal_planes.nodal_plane_2['strike']
            catalogue[iloc, 18] = tensor.nodal_planes.nodal_plane_2['dip']
            catalogue[iloc, 19] = tensor.nodal_planes.nodal_plane_2['rake']
            # Principal axes
            catalogue[iloc, 20] = tensor.principal_axes.b_axis['eigenvalue']
            catalogue[iloc, 21] = tensor.principal_axes.b_axis['azimuth']
            catalogue[iloc, 22] = tensor.principal_axes.b_axis['plunge']
            catalogue[iloc, 23] = tensor.principal_axes.p_axis['eigenvalue']
            catalogue[iloc, 24] = tensor.principal_axes.p_axis['azimuth']
            catalogue[iloc, 25] = tensor.principal_axes.p_axis['plunge']
            catalogue[iloc, 26] = tensor.principal_axes.t_axis['eigenvalue']
            catalogue[iloc, 27] = tensor.principal_axes.t_axis['azimuth']
            catalogue[iloc, 28] = tensor.principal_axes.t_axis['plunge']
        return catalogue
def gcmt_to_simple_array ( self , centroid_location = True ) : catalogue = np . zeros ( [ self . get_number_tensors ( ) , 29 ] , dtype = float ) for iloc , tensor in enumerate ( self . gcmts ) : catalogue [ iloc , 0 ] = iloc if centroid_location : catalogue [ iloc , 1 ] = float ( tensor . centroid . date . year ) catalogue [ iloc , 2 ] = float ( tensor . centroid . date . month ) catalogue [ iloc , 3 ] = float ( tensor . centroid . date . day ) catalogue [ iloc , 4 ] = float ( tensor . centroid . time . hour ) catalogue [ iloc , 5 ] = float ( tensor . centroid . time . minute ) catalogue [ iloc , 6 ] = np . round ( np . float ( tensor . centroid . time . second ) + np . float ( tensor . centroid . time . microsecond ) / 1000000. , 2 ) catalogue [ iloc , 7 ] = tensor . centroid . longitude catalogue [ iloc , 8 ] = tensor . centroid . latitude catalogue [ iloc , 9 ] = tensor . centroid . depth else : catalogue [ iloc , 1 ] = float ( tensor . hypocentre . date . year ) catalogue [ iloc , 2 ] = float ( tensor . hypocentre . date . month ) catalogue [ iloc , 3 ] = float ( tensor . hypocentre . date . day ) catalogue [ iloc , 4 ] = float ( tensor . hypocentre . time . hour ) catalogue [ iloc , 5 ] = float ( tensor . hypocentre . time . minute ) catalogue [ iloc , 6 ] = np . round ( np . float ( tensor . centroid . time . second ) + np . float ( tensor . centroid . time . microsecond ) / 1000000. , 2 ) catalogue [ iloc , 7 ] = tensor . hypocentre . longitude catalogue [ iloc , 8 ] = tensor . hypocentre . latitude catalogue [ iloc , 9 ] = tensor . hypocentre . depth catalogue [ iloc , 10 ] = tensor . magnitude catalogue [ iloc , 11 ] = tensor . moment catalogue [ iloc , 12 ] = tensor . f_clvd catalogue [ iloc , 13 ] = tensor . e_rel catalogue [ iloc , 14 ] = tensor . nodal_planes . nodal_plane_1 [ 'strike' ] catalogue [ iloc , 15 ] = tensor . nodal_planes . nodal_plane_1 [ 'dip' ] catalogue [ iloc , 16 ] = tensor . nodal_planes . nodal_plane_1 [ 'rake' ] catalogue [ iloc , 17 ] = tensor . nodal_planes . nodal_plane_2 [ 'strike' ] catalogue [ iloc , 18 ] = tensor . nodal_planes . nodal_plane_2 [ 'dip' ] catalogue [ iloc , 19 ] = tensor . nodal_planes . nodal_plane_2 [ 'rake' ] catalogue [ iloc , 20 ] = tensor . principal_axes . b_axis [ 'eigenvalue' ] catalogue [ iloc , 21 ] = tensor . principal_axes . b_axis [ 'azimuth' ] catalogue [ iloc , 22 ] = tensor . principal_axes . b_axis [ 'plunge' ] catalogue [ iloc , 23 ] = tensor . principal_axes . p_axis [ 'eigenvalue' ] catalogue [ iloc , 24 ] = tensor . principal_axes . p_axis [ 'azimuth' ] catalogue [ iloc , 25 ] = tensor . principal_axes . p_axis [ 'plunge' ] catalogue [ iloc , 26 ] = tensor . principal_axes . t_axis [ 'eigenvalue' ] catalogue [ iloc , 27 ] = tensor . principal_axes . t_axis [ 'azimuth' ] catalogue [ iloc , 28 ] = tensor . principal_axes . t_axis [ 'plunge' ] return catalogue
Converts the GCMT catalogue to a simple array of
        [ID, year, month, day, hour, minute, second, long., lat., depth, Mw,
        strike1, dip1, rake1, strike2, dip2, rake2, b-plunge, b-azimuth,
        b-eigenvalue, p-plunge, p-azimuth, p-eigenvalue, t-plunge, t-azimuth,
        t-eigenvalue, moment, f_clvd, erel]