def get_station_delays(event_map,stations,lats_i,lons_i,**kwargs):
'''
takes an event delay map and interpolates station delays
args--------------------------------------------------------------------------
event_map: delay time map for the specified earthquake
stations: either an array of [lats,lons] or an obspy network. if using an
an obspy network, set the kwarg 'obspy_network' to True
lats_i: the latitudes used in creating the event map
lons_i: the longitudes used in creating the event map
kwargs------------------------------------------------------------------------
obspy_network: True if 'stations' is an obspy network object. (default False)
pass_figure_axis: Set to true if you wish to supply an axis for plotting
figure_axis: the axis to plot on
'''
obspy_network = kwargs.get('obspy_network',False)
pass_figure_axis = kwargs.get('pass_figure_axis',False)
figure_axis = kwargs.get('figure_axis','none')
if obspy_network:
lats = []
lons = []
for station in stations:
lats.append(station.latitude)
lons.append(stations.longitude)
else:
lons = stations[0,:]
lats = stations[1,:]
#delay_interpolator = interpolate.RegularGridInterpolator((lons_i,lats_i),event_map)
#RM 3/31/17: I changed removed the bounds error on the interpolator...
# This is dangerous and I'm not sure how things will be effected.
# This is for preliminary testing of the Pacific array geometry
delay_interpolator = interpolate.RegularGridInterpolator((lons_i,lats_i),event_map,
bounds_error=False,fill_value=0.0)
station_delays = delay_interpolator((lats,lons))
if pass_figure_axis:
lons_bsmp, lats_bsmp = figure_axis(lons,lats)
figure_axis.scatter(lons_bsmp,lats_bsmp,marker='^',s=50,c=station_delays,vmin=-3.0,vmax=0.1)
plt.show()
return station_delays
评论列表
文章目录