def getIntervals(data,sat_num,maxgap=3,maxjump=1.2):
"""
scans through the phase tec of a satellite and determines where "good"
intervals begin and end
inputs:
data - Panel4D with dimensions (parameter,satellite number,time,data/lli/ssi)
sat_num - the number of the satellite to get good intervals for
maxgap - maximum number of nans before starting new interval
maxjump - maximum jump in phase TEC before starting new interval
output:
intervals - list of 2-tuples, beginning and end of each "good" interval
as a Pandas/numpy datetime64
"""
if c2p2(data,sat_num):
finite_values = np.where(np.logical_and.reduce((
np.isfinite(data[['L1','L2','C1','C2'],sat_num,:,'data']).T)))[0]
else:
finite_values = np.where(np.logical_and.reduce((
np.isfinite(data[['L1','L2','C1','P2'],sat_num,:,'data']).T)))[0]
intervals=[]
if len(finite_values)==0:
return intervals
phase_tec=2.85E9*(data['L1',sat_num,:,'data']/f1-data['L2',sat_num,:,'data']/f2)
beginning=finite_values[0]
last=finite_values[0]
for i in finite_values[1:]:
if i-last>maxgap or abs(phase_tec[i]-phase_tec[last])>maxjump:
intervals.append((beginning,last))
beginning=i
last=i
if i==finite_values[-1]:
intervals.append((beginning,last))
intervals=[(data.major_axis[time[0]],data.major_axis[time[1]]) for time in intervals]
return intervals
评论列表
文章目录