forked from dannyjacobs/obs_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_all_temps.py
More file actions
executable file
·42 lines (36 loc) · 1.07 KB
/
Copy pathplot_all_temps.py
File metadata and controls
executable file
·42 lines (36 loc) · 1.07 KB
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
39
40
41
42
#! /usr/bin/env python
import numpy as np
import sys,os,optparse
from time import time
import matplotlib
matplotlib.use('Agg')
from pylab import *
o = optparse.OptionParser()
o.add_option('-n','--ndays',type=int,default=5,help='Number of days to plot')
o.add_option('-o','--outfile',default='temps.png',help='Destination of figure')
opts,args = o.parse_args(sys.argv[1:])
args = args[:-1] # Don't plot the file currently being written -- it breaks!
jd = (time() / 86400.) + 2440587.5
Files2Read = []
for File in args:
jdF = float('.'.join(File.split('.')[-3:-2]))
if jd - jdF <= opts.ndays: Files2Read.append(File)
JD,Tin,Tout = [],[],[]
for File in Files2Read:
print 'Reading',File
d = np.loadtxt(File)
for i in range(d.shape[0]):
JD.append(d[i,0])
Tin.append(d[i,1])
Tout.append(d[i,2])
JD = np.array(JD)
JD0 = np.floor(JD[0])
JD -= JD0
figure()
title('Temperatures for the last %d Days'%opts.ndays)
plot(JD,Tin,label='LabJack')
plot(JD,Tout,label='Balun')
ylabel('Temperature [K]')
xlabel('Days since JD %d'%int(JD0))
legend(loc='lower left')
savefig(opts.outfile,fmt='png')