def test_read_nlloc_scatter_plain(self): """ Test reading NLLoc scatter file without coordinate conversion. """ # test without coordinate manipulation filename = os.path.join(self.datapath, "nlloc.scat") got = read_nlloc_scatter(filename) filename = os.path.join(self.datapath, "nlloc_scat.npy") expected = np.load(filename) np.testing.assert_array_equal(got, expected)
def test_read_nlloc_scatter_coordinate_conversion(self): """ Test reading NLLoc scatter file including coordinate conversion. """ # test including coordinate manipulation filename = os.path.join(self.datapath, "nlloc.scat") got = read_nlloc_scatter(filename, coordinate_converter=_coordinate_conversion) filename = os.path.join(self.datapath, "nlloc_scat_converted.npy") expected = np.load(filename) for field in expected.dtype.fields: np.testing.assert_allclose(got[field], expected[field], rtol=1e-5)
def test_read_nlloc_scatter_coordinate_conversion(self): """ Test reading NLLoc scatter file including coordinate conversion. """ # test including coordinate manipulation filename = os.path.join(self.datapath, "nlloc.scat") got = read_nlloc_scatter( filename, coordinate_converter=_coordinate_conversion) filename = os.path.join(self.datapath, "nlloc_scat_converted.npy") expected = np.load(filename) for field in expected.dtype.fields: np.testing.assert_allclose(got[field], expected[field], rtol=1e-5)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jun 15 23:58:34 2019 @author: robertocabieces """ #from obspy import read_events from obspy.io.nlloc.util import read_nlloc_scatter import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap #from plotmap1 import plotmap data = read_nlloc_scatter("lecturas.20160115.013604.grid0.loc.scat", coordinate_converter=None) L = len(data) #xy=np.genfromtxt('lecturas.20160115.013604.grid0.loc.scat.lonlat.XY') #zy=np.genfromtxt('lecturas.20160115.013604.grid0.loc.scat.ZY') #x1=xy[:,0] #min(x1) #y1=xy[:,1] #min(y1) #z1=zy[:,0] x = [] y = [] z = [] pdf = [] for i in range(L): x.append(data[i][0]) y.append(data[i][1]) z.append(data[i][2])