コード例 #1
0
ファイル: locProb.py プロジェクト: jasper-chen/LargePelagics
	fin = open("mooringLocDate.txt",'r')
	posout = []
	for l in fin:
		line = l.split(",")
		day = (formatMooring.destring(line[0]),formatMooring.destring(line[1]))
		pos = tuple([int(l.strip("\n")) for l in line[2].split(" ")])
		posout.append([day,pos])
	fin.close()
	return posout

data = posOut();

for day,loc in data:
	date = day[0].date()
	print date
	crise,cset = sunloc.calcRiseSet(loc[0],loc[1],date)
	dif = (day[1]-day[0]).total_seconds()
	difc = (cset-crise).total_seconds()
	plt.plot(date,loc[0],"ro")
	# plt.plot(date,difc/3600.0,"bo")
	# plt.plot(date,cset.minute,"bo")
# plt.axis([-180,180,-90,90])
plt.show()

# mooring = readData.readFile("mooring.txt")
# fin = open("mooringLocations.txt",'r')
# fout = open("mooringLocDate.txt",'w')
# i = 0
# for l in fin:
# 	ml = mooring[i]
# 	day = formatMooring.daystr(ml[0])+","+formatMooring.daystr(ml[1])
コード例 #2
0
# generate days
def dateSpan(startDate, endDate, delta=datetime.timedelta(days=1)):
    '''creates a list of date objects between a start and end date'''
    dates = []
    currentDate = startDate
    while currentDate < endDate:
        currentDate += delta
        dates.append(currentDate)
    return dates

dates = dateSpan(startDate,endDate,datetime.timedelta(days=1)) # increment by 1 week

# get rise/set times
riseSet = []
for day in dates:
    riseSet.append(sunloc.calcRiseSet(lat,lon,day))

# introduce error
sigma = 5 
size = 5 
errorsLat = []
errorsLon = []

for day in riseSet:
    error = introduceError.introduceError(0,sigma,size,day)
    errorsLat.append(error[0]) # add error stuff
    errorsLon.append(error[1])

def allLocations(day):
    '''calculates the location for each (rise,set) datetime in array'''
    loc = []