diff --git a/phasepapy/associator/plot3D.py b/phasepapy/associator/plot3D.py index 4a24a61..8630bdc 100644 --- a/phasepapy/associator/plot3D.py +++ b/phasepapy/associator/plot3D.py @@ -1,5 +1,6 @@ from obspy.core.stream import read, Stream -from obspy.core.util import gps2DistAzimuth +#from obspy.core.util import gps2DistAzimuth +from obspy.geodetics import gps2dist_azimuth from obspy.core import UTCDateTime from mpl_toolkits.basemap import Basemap from matplotlib.collections import LineCollection @@ -140,7 +141,8 @@ def event_plot(self, assoc_id, west = -104.5, east= -94, south = 33.5, north = 3 lon,lat=self.tt_stations_db_3D.query(Station3D.longitude,Station3D.latitude).filter(Station3D.sta==match.sta).first() s_p_rainbow.append((match.ts-match.tp).total_seconds()) radius_rainbow.append(match.d_km) - Color=plot_colors.next() +# Color=plot_colors.next() + Color = next(plot_colors) rainbow.append(Color) sta_rainbow.append(match.sta) LocPair,=equi(m, lon, lat, match.d_km, lw=2., color=Color) @@ -151,7 +153,8 @@ def event_plot(self, assoc_id, west = -104.5, east= -94, south = 33.5, north = 3 lon,lat=self.tt_stations_db_3D.query(Station3D.longitude,Station3D.latitude).filter(Station3D.sta==mismatch.sta).first() s_p_rainbow.append((mismatch.ts-mismatch.tp).total_seconds()) radius_rainbow.append(mismatch.d_km) - Color=plot_colors.next() +# Color=plot_colors.next() + Color = next(plot_colors) rainbow.append(Color) sta_rainbow.append(mismatch.sta) UnlocPair,=equi(m, lon, lat, mismatch.d_km, ls='--', lw=1., color=Color) @@ -322,7 +325,8 @@ def section_plot(self, assoc_id, files, seconds_ahead = 5, record_length = 100, t=np.arange(0,round(tr.stats.npts/tr.stats.sampling_rate/tr.stats.delta))*tr.stats.delta # due to the float point arithmetic issue, can not use "t=np.arange(0,tr.stats.npts/tr.stats.sampling_rate,tr.stats.delta)" segs.append(np.hstack((data[:,np.newaxis],t[:,np.newaxis]))) lon,lat = self.tt_stations_db_3D.query(Station3D.longitude,Station3D.latitude).filter(Station3D.sta==tr.stats.station).first() - distance = int(gps2DistAzimuth(lat,lon,eq_lat,eq_lon)[0]/1000.) #gps2DistAzimuth return in meters, convert to km by /1000 +# distance = int(gps2DistAzimuth(lat,lon,eq_lat,eq_lon)[0]/1000.) #gps2DistAzimuth return in meters, convert to km by /1000 + distance = int(gps2dist_azimuth(lat,lon,eq_lat,eq_lon)[0]/1000.) #gps2DistAzimuth return in meters, convert to km by /1000 # distance=self.assoc_db.query(Candidate.d_km).filter(Candidate.assoc_id==assoc_id).filter(Candidate.sta==tr.stats.station).first()[0]#;print distance,tr.stats.station ticklocs.append(distance) sta.append(tr.stats.station) @@ -473,4 +477,4 @@ def equi(m, centerlon, centerlat, radius, *args, **kwargs): X,Y = m(X,Y) plt.plot(X,Y,**kwargs) return plt.plot(X,Y,**kwargs) # just return for legend - \ No newline at end of file +