コード例 #1
0
ファイル: test.py プロジェクト: jasper-chen/LargePelagics
import datetime
import parsedata
import thinkplot

x = [1,2,3]
y = [4,5,6]

thinkplot.Scatter(x,y)
thinkplot.Show()

rawData = parsedata.parseFile('drifter.tab')

timeData = [point[0] for point in rawData]ge

print timeData
コード例 #2
0
	light = smoother(light)
	lightdif = []
	index = range(len(light)-1)
	for i in index:
		lightdif.append(light[i+1]-light[i])

	# pull out sunrise/sunset
	changes = (smoother(lightdif),date[0:-1])
	combo = zip(*changes)
	return (min(combo)[1],max(combo)[1])

def allRiseSet(fulldata):
	# takes a continuous data set
	# returns a list of (risetime, settime) as datetime.datetime objects
	days = getDays(fulldata)
	times = []
	for day in days:
		rise,sset = getRiseSet(day,fulldata)
		times.append((rise,sset))
	return times

if __name__=="__main__":
	lightData = parsedata.parseFile("mooring.tab")
	times = allRiseSet(lightData)
	rise,sset=zip(*times)
	timing = [dt.time() for dt in rise]
	d = datetime.datetime.today()
	dtiming = [datetime.datetime.combine(d,t) for t in timing]

	thinkplot.Scatter(range(len(timing)),dtiming)
	thinkplot.Show()