forked from rbergerpa/balloon_data
-
Notifications
You must be signed in to change notification settings - Fork 0
/
temp_vs_hgt.py
38 lines (26 loc) · 813 Bytes
/
temp_vs_hgt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pandas import Series, DataFrame
from json_util import load_json
import datetime as dt
import sys
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
def select_time(dict):
return dict['time']
def load_data(path):
json_data = list(load_json(path))
for d in json_data:
d['time'] = dt.datetime.strptime(d['time'], DATE_FORMAT)
return DataFrame(data=json_data, index=map(select_time, json_data))
gps_data = load_data('c1_gps.txt')
logger_data = load_data('c1_data.txt')
temp = logger_data['temp3']
height = []
for i in range(0, temp.size):
height.append(gps_data['hgt'].asof(temp.index[i]))
plt.plot(height, temp)
axes = plt.axes()
axes.set_ylabel("Temperature (Celcius)")
axes.set_xlabel("Altitude (feet)")
plt.show()