initial commit
This commit is contained in:
commit
55c12eb048
|
@ -0,0 +1,16 @@
|
||||||
|
Dew Point Comfort Index
|
||||||
|
|
||||||
|
╔═════════╦═══════════════╗
|
||||||
|
║ < 55°F ║ Pleasant ║▒
|
||||||
|
╠═════════╬═══════════════╣▒
|
||||||
|
║ 56-60°F ║ Comfortable ║▒
|
||||||
|
╠═════════╬═══════════════╣▒
|
||||||
|
║ 61-65°F ║ Sticky ║▒
|
||||||
|
╠═════════╬═══════════════╣▒
|
||||||
|
║ 66-70°F ║ Uncomfortable ║▒
|
||||||
|
╠═════════╬═══════════════╣▒
|
||||||
|
║ 71-75°F ║ Oppressive ║▒
|
||||||
|
╠═════════╬═══════════════╣▒
|
||||||
|
║ 76°F+ ║ Miserable ║▒
|
||||||
|
╚═════════╩═══════════════╝▒
|
||||||
|
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
|
|
@ -0,0 +1,56 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import bme280
|
||||||
|
import smbus2
|
||||||
|
from time import sleep
|
||||||
|
import math
|
||||||
|
|
||||||
|
port = 1
|
||||||
|
address = 0x76 # Adafruit BME280 address. Other BME280s may be different
|
||||||
|
bus = smbus2.SMBus(port)
|
||||||
|
|
||||||
|
def truncate(n, decimals=0):
|
||||||
|
multiplier = 10 ** decimals
|
||||||
|
return int(n * multiplier) / multiplier
|
||||||
|
|
||||||
|
def get_frost_point_c(t_air_c, dew_point_c):
|
||||||
|
dew_point_k = 273.15 + dew_point_c
|
||||||
|
t_air_k = 273.15 + t_air_c
|
||||||
|
frost_point_k = dew_point_k - t_air_k + 2671.02 / ((2954.61 / t_air_k) + 2.193665 * math.log(t_air_k) - 13.3448)
|
||||||
|
return frost_point_k - 273.15
|
||||||
|
|
||||||
|
def get_dew_point_c(t_air_c, rel_humidity):
|
||||||
|
A = 17.27
|
||||||
|
B = 237.7
|
||||||
|
alpha = ((A * t_air_c) / (B + t_air_c)) + math.log(rel_humidity/100.0)
|
||||||
|
return (B * alpha) / (A - alpha)
|
||||||
|
|
||||||
|
bme280.load_calibration_params(bus,address)
|
||||||
|
wxdata = bme280.sample(bus,address)
|
||||||
|
humidity = wxdata.humidity
|
||||||
|
pressure = wxdata.pressure
|
||||||
|
pressure_i = wxdata.pressure / 33.863886666667
|
||||||
|
temperature = wxdata.temperature
|
||||||
|
temperature_f = (wxdata.temperature * 1.8) + 32
|
||||||
|
dew_point = get_dew_point_c(wxdata.temperature, wxdata.humidity)
|
||||||
|
dew_point_f = (dew_point *1.8) + 32
|
||||||
|
h = round(humidity)
|
||||||
|
pm = truncate(pressure, 2)
|
||||||
|
pi = truncate(pressure_i, 2)
|
||||||
|
tc = truncate(temperature, 2)
|
||||||
|
tf = truncate(temperature_f, 2)
|
||||||
|
dp = truncate(dew_point, 2)
|
||||||
|
df = truncate(dew_point_f, 2)
|
||||||
|
|
||||||
|
print('║ Temperature ║▒ ║ Humidity ║▒ ║ Pressure ║▒ ║ Dew Point ║▒')
|
||||||
|
print('║ ║▒ ║ ║▒ ║ ║▒ ║ ║▒')
|
||||||
|
if h == 100:
|
||||||
|
print('║ {0:.2f}°F ║▒ ║ {1}% ║▒ ║ {2:.2f} mbar ║▒ ║ {3:.2f}°F ║▒'.format(tf, h, pm, df))
|
||||||
|
else:
|
||||||
|
print('║ {0:.2f}°F ║▒ ║ {1}% ║▒ ║ {2:.2f} mbar ║▒ ║ {3:.2f}°F ║▒'.format(tf, h, pm, df))
|
||||||
|
if int(tc) < 10 and int(dp) < 10:
|
||||||
|
print('║ {0:.2f}°C ║▒ ║ ║▒ ║ {1:.2f} inHg ║▒ ║ {2:.2f}°C ║▒'.format(tc, pi, dp))
|
||||||
|
elif int(tc) > 10 and int(dp) < 10:
|
||||||
|
print('║ {0:.2f}°C ║▒ ║ ║▒ ║ {1:.2f} inHg ║▒ ║ {2:.2f}°C ║▒'.format(tc, pi, dp))
|
||||||
|
else:
|
||||||
|
print('║ {0:.2f}°C ║▒ ║ ║▒ ║ {1:.2f} inHg ║▒ ║ {2:.2f}°C ║▒'.format(tc, pi, dp))
|
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
today=$(date "+/wxlog/%Y/%m/%Y-%m-%d.txt")
|
||||||
|
|
||||||
|
echo "Welcome to the perilo.us weather station."
|
||||||
|
echo ""
|
||||||
|
echo "This mini weather station is a Raspberry Pi connected to a BME280 sensor"
|
||||||
|
echo "dangling from the eaves of my house in Hernando, MS, USA."
|
||||||
|
echo ""
|
||||||
|
echo "╔════════════════════════════════════════════════════════════════════╗"
|
||||||
|
echo "║ *** Current Weather *** ║▒"
|
||||||
|
echo "╚════════════════════════════════════════════════════════════════════╝▒"
|
||||||
|
echo " ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"
|
||||||
|
echo ""
|
||||||
|
echo "╔══════════════╗ ╔══════════════╗ ╔══════════════╗ ╔══════════════╗"
|
||||||
|
sudo python3 /var/gopher/gw.py
|
||||||
|
#cat /var/gopher/gw.txt
|
||||||
|
echo "╚══════════════╝▒ ╚══════════════╝▒ ╚══════════════╝▒ ╚══════════════╝▒"
|
||||||
|
echo " ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"
|
||||||
|
echo ""
|
||||||
|
echo " *** Daily Temperature Plot ***"
|
||||||
|
/var/gopher/plot/plot.py /var/gopher$today
|
||||||
|
gnuplot -e "set terminal dumb; set xdata time; set timefmt '"%H:%M"'; plot '/tmp/temp.tsv' using 1:2 w l title ''" >> /tmp/plot.txt
|
||||||
|
sed -i '1d' /tmp/plot.txt
|
||||||
|
sed -i 's/\(.\{2\}\)//' /tmp/plot.txt
|
||||||
|
cat /tmp/plot.txt
|
||||||
|
rm /tmp/plot.txt
|
||||||
|
rm /tmp/temp.tsv
|
||||||
|
echo "----------------------------------------------------------------------------"
|
||||||
|
echo ""
|
||||||
|
echo "[0|Today's Log|$today|server|port]"
|
||||||
|
echo ""
|
||||||
|
echo "[1|Weather Logs|/wxlog|server|port]"
|
||||||
|
echo ""
|
||||||
|
echo "[1|Dew Point Comfort Index|/dpindex.gph|server|port]"
|
||||||
|
echo ""
|
||||||
|
echo "----------------------------------------------------------------------------"
|
||||||
|
echo ""
|
||||||
|
echo "Powered by Geomyidae"
|
||||||
|
echo "[1|Geomyidae Git|/scm/geomyidae/log.gph|bitreich.org|70]"
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def time_process(s):
|
||||||
|
sa = s.split()
|
||||||
|
st = sa[0]
|
||||||
|
stime = st[:5] + "\t"
|
||||||
|
return stime
|
||||||
|
|
||||||
|
def dp_process(s):
|
||||||
|
sa = s.split()
|
||||||
|
st = sa[6]
|
||||||
|
sdp = st.replace('°F', '') + "\n"
|
||||||
|
return sdp
|
||||||
|
|
||||||
|
log_file = sys.argv[-1]
|
||||||
|
f = open(log_file, 'r')
|
||||||
|
|
||||||
|
for i in f:
|
||||||
|
if i[0].isdigit():
|
||||||
|
w = open('/tmp/temp.tsv', 'a')
|
||||||
|
data = time_process(i) + dp_process(i)
|
||||||
|
w.write(data)
|
||||||
|
else:
|
||||||
|
pass
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
|
def time_process(s):
|
||||||
|
sa = s.split()
|
||||||
|
st = sa[0]
|
||||||
|
stime = st[:5] + "\t"
|
||||||
|
return stime
|
||||||
|
|
||||||
|
def hum_process(s):
|
||||||
|
sa = s.split()
|
||||||
|
st = sa[3]
|
||||||
|
shum = re.sub('[%]', '', st) + "\n"
|
||||||
|
return shum
|
||||||
|
|
||||||
|
log_file = sys.argv[-1]
|
||||||
|
f = open(log_file, 'r')
|
||||||
|
|
||||||
|
for i in f:
|
||||||
|
if i[0].isdigit():
|
||||||
|
w = open('/tmp/temp.tsv', 'a')
|
||||||
|
data = time_process(i) + hum_process(i)
|
||||||
|
w.write(data)
|
||||||
|
else:
|
||||||
|
pass
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/sh
|
||||||
|
filename=$2
|
||||||
|
|
||||||
|
/var/gopher/plot.py $filename
|
||||||
|
gnuplot -e "set terminal dumb; set xdata time; set timefmt '"%H:%M"'; plot '/tmp/temp.tsv' using 1:2 w l title 'temp'"
|
||||||
|
rm /tmp/temp.tsv
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def time_process(s):
|
||||||
|
sa = s.split()
|
||||||
|
st = sa[0]
|
||||||
|
stime = st[:5] + "\t"
|
||||||
|
return stime
|
||||||
|
|
||||||
|
def temp_process(s):
|
||||||
|
sa = s.split()
|
||||||
|
st = sa[1]
|
||||||
|
# stemp = st[:5] + "\n"
|
||||||
|
stemp = st.replace('°F', '') + "\n"
|
||||||
|
return stemp
|
||||||
|
|
||||||
|
log_file = sys.argv[-1]
|
||||||
|
f = open(log_file, 'r')
|
||||||
|
|
||||||
|
for i in f:
|
||||||
|
if i[0].isdigit():
|
||||||
|
w = open('/tmp/temp.tsv', 'a')
|
||||||
|
data = time_process(i) + temp_process(i)
|
||||||
|
w.write(data)
|
||||||
|
else:
|
||||||
|
pass
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
|
def time_process(s):
|
||||||
|
sa = s.split()
|
||||||
|
st = sa[0]
|
||||||
|
stime = st[:5] + "\t"
|
||||||
|
return stime
|
||||||
|
|
||||||
|
def pres_process(s):
|
||||||
|
sa = s.split()
|
||||||
|
st = sa[4]
|
||||||
|
spres = st.replace('mbar', '') + "\n"
|
||||||
|
return spres
|
||||||
|
|
||||||
|
log_file = sys.argv[-1]
|
||||||
|
f = open(log_file, 'r')
|
||||||
|
|
||||||
|
for i in f:
|
||||||
|
if i[0].isdigit():
|
||||||
|
w = open('/tmp/temp.tsv', 'a')
|
||||||
|
data = time_process(i) + pres_process(i)
|
||||||
|
w.write(data)
|
||||||
|
else:
|
||||||
|
pass
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
local_dir=$(pwd)
|
||||||
|
gopher_dir=$(pwd | cut -c 12-)
|
||||||
|
|
||||||
|
for file in $local_dir/*txt; do
|
||||||
|
long_name=$(basename "$file")
|
||||||
|
display_name=$(echo "$long_name" | cut -c -10)
|
||||||
|
echo "[1|$display_name|$gopher_dir/plot-d.dcgi?$(basename "$file")|server|port]"
|
||||||
|
done
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
local_dir=$(pwd)
|
||||||
|
gopher_dir=$(pwd | cut -c 12-)
|
||||||
|
|
||||||
|
for file in $local_dir/*txt; do
|
||||||
|
long_name=$(basename "$file")
|
||||||
|
display_name=$(echo "$long_name" | cut -c -10)
|
||||||
|
echo "[1|$display_name|$gopher_dir/plot-h.dcgi?$(basename "$file")|server|port]"
|
||||||
|
done
|
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
year=$(pwd | cut -c 19- | cut -c -4)
|
||||||
|
month=$(pwd | cut -c 24-)
|
||||||
|
local_dir=$(pwd)
|
||||||
|
gopher_dir=$(pwd | cut -c 12-)
|
||||||
|
|
||||||
|
if test "$month" = "01"
|
||||||
|
then
|
||||||
|
wmonth="January"
|
||||||
|
elif test "$month" = "02"
|
||||||
|
then
|
||||||
|
wmonth="February"
|
||||||
|
elif test "$month" = "04"
|
||||||
|
then
|
||||||
|
wmonth="March"
|
||||||
|
elif test "$month" = "04"
|
||||||
|
then
|
||||||
|
wmonth="April"
|
||||||
|
elif test "$month" = "05"
|
||||||
|
then
|
||||||
|
wmonth="May"
|
||||||
|
elif test "$month" = "06"
|
||||||
|
then
|
||||||
|
wmonth="June"
|
||||||
|
elif test "$month" = "07"
|
||||||
|
then
|
||||||
|
wmonth="July"
|
||||||
|
elif test "$month" = "08"
|
||||||
|
then
|
||||||
|
wmonth="August"
|
||||||
|
elif test "$month" = "09"
|
||||||
|
then
|
||||||
|
wmonth="September"
|
||||||
|
elif test "$month" = "10"
|
||||||
|
then
|
||||||
|
wmonth="October"
|
||||||
|
elif test "$month" = "11"
|
||||||
|
then
|
||||||
|
wmonth="November"
|
||||||
|
elif test "$month" = "12"
|
||||||
|
then
|
||||||
|
wmonth="December"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Weather Logs for $wmonth $year"
|
||||||
|
echo "----------------------------------"
|
||||||
|
echo "Plotted Graphs"
|
||||||
|
echo "[1|Temperature|$gopher_dir/temp.dcgi|server|port]"
|
||||||
|
echo "[1|Humidity|$gopher_dir/hum.dcgi|server|port]"
|
||||||
|
echo "[1|Pressure|$gopher_dir/pres.dcgi|server|port]"
|
||||||
|
echo "[1|Dew Point|$gopher_dir/dp.dcgi|server|port]"
|
||||||
|
echo "----------------------------------"
|
||||||
|
echo "Raw Log Files"
|
||||||
|
echo ""
|
||||||
|
for file in $local_dir/*txt; do
|
||||||
|
echo "[0|$(basename "$file")|$gopher_dir/$(basename "$file")|server|port]"
|
||||||
|
done
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
filename=$2
|
||||||
|
|
||||||
|
/var/gopher/plot/dplot.py $filename
|
||||||
|
gnuplot -e "set terminal dumb; set xdata time; set timefmt '"%H:%M"'; plot '/tmp/temp.tsv' using 1:2 w l title ''" >> /tmp/plot.txt
|
||||||
|
sed -i '1d' /tmp/plot.txt
|
||||||
|
sed -i 's/\(.\{2\}\)//' /tmp/plot.txt
|
||||||
|
cat /tmp/plot.txt
|
||||||
|
rm /tmp/plot.txt
|
||||||
|
rm /tmp/temp.tsv
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
filename=$2
|
||||||
|
|
||||||
|
/var/gopher/plot/hplot.py $filename
|
||||||
|
gnuplot -e "set terminal dumb; set xdata time; set timefmt '"%H"'; plot '/tmp/temp.tsv' using 1:2 w l title ''" >> /tmp/plot.txt
|
||||||
|
sed -i '1d' /tmp/plot.txt
|
||||||
|
sed -i 's/\(.\{2\}\)//' /tmp/plot.txt
|
||||||
|
cat /tmp/plot.txt
|
||||||
|
rm /tmp/plot.txt
|
||||||
|
rm /tmp/temp.tsv
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
filename=$2
|
||||||
|
|
||||||
|
/var/gopher/plot/pplot.py $filename
|
||||||
|
gnuplot -e "set terminal dumb; set xdata time; set timefmt '"%H:%M"'; plot '/tmp/temp.tsv' using 1:2 w l title ''" >> /tmp/plot.txt
|
||||||
|
sed -i '1d' /tmp/plot.txt
|
||||||
|
sed -i 's/\(.\{2\}\)//' /tmp/plot.txt
|
||||||
|
cat /tmp/plot.txt
|
||||||
|
rm /tmp/plot.txt
|
||||||
|
rm /tmp/temp.tsv
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
filename=$2
|
||||||
|
|
||||||
|
/var/gopher/plot/plot.py $filename
|
||||||
|
gnuplot -e "set terminal dumb; set xdata time; set timefmt '"%H:%M"'; plot '/tmp/temp.tsv' using 1:2 w l title ''" >> /tmp/plot.txt
|
||||||
|
sed -i '1d' /tmp/plot.txt
|
||||||
|
sed -i 's/\(.\{2\}\)//' /tmp/plot.txt
|
||||||
|
cat /tmp/plot.txt
|
||||||
|
rm /tmp/plot.txt
|
||||||
|
rm /tmp/temp.tsv
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
local_dir=$(pwd)
|
||||||
|
gopher_dir=$(pwd | cut -c 12-)
|
||||||
|
|
||||||
|
for file in $local_dir/*txt; do
|
||||||
|
long_name=$(basename "$file")
|
||||||
|
display_name=$(echo "$long_name" | cut -c -10)
|
||||||
|
echo "[1|$display_name|$gopher_dir/plot-p.dcgi?$(basename "$file")|server|port]"
|
||||||
|
done
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
local_dir=$(pwd)
|
||||||
|
gopher_dir=$(pwd | cut -c 12-)
|
||||||
|
|
||||||
|
for file in $local_dir/*txt; do
|
||||||
|
long_name=$(basename "$file")
|
||||||
|
display_name=$(echo "$long_name" | cut -c -10)
|
||||||
|
echo "[1|$display_name|$gopher_dir/plot-t.dcgi?$(basename "$file")|server|port]"
|
||||||
|
done
|
|
@ -0,0 +1,94 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import bme280
|
||||||
|
import smbus2
|
||||||
|
import datetime
|
||||||
|
import os.path
|
||||||
|
from pathlib import Path
|
||||||
|
import math
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
port = 1
|
||||||
|
address = 0x76 # Adafruit BME280 address. Other BME280s may be different
|
||||||
|
bus = smbus2.SMBus(port)
|
||||||
|
year = datetime.datetime.now().year
|
||||||
|
month = datetime.datetime.now().month
|
||||||
|
time = datetime.datetime.now().time()
|
||||||
|
|
||||||
|
def truncate(n, decimals=0):
|
||||||
|
multiplier = 10 ** decimals
|
||||||
|
return int(n * multiplier) / multiplier
|
||||||
|
|
||||||
|
def get_dew_point_c(t_air_c, rel_humidity):
|
||||||
|
"""Compute the dew point in degrees Celsius
|
||||||
|
|
||||||
|
:param t_air_c: current ambient temperature in degrees Celsius
|
||||||
|
:type t_air_c: float
|
||||||
|
:param rel_humidity: relative humidity in %
|
||||||
|
:type rel_humidity: float
|
||||||
|
:return: the dew point in degrees Celsius
|
||||||
|
:rtype: float
|
||||||
|
"""
|
||||||
|
A = 17.27
|
||||||
|
B = 237.7
|
||||||
|
alpha = ((A * t_air_c) / (B + t_air_c)) + math.log(rel_humidity/100.0)
|
||||||
|
return (B * alpha) / (A - alpha)
|
||||||
|
|
||||||
|
def entry():
|
||||||
|
port = 1
|
||||||
|
address = 0x76 # Adafruit BME280 address. Other BME280s may be different
|
||||||
|
bus = smbus2.SMBus(port)
|
||||||
|
bme280.load_calibration_params(bus,address)
|
||||||
|
wxdata = bme280.sample(bus,address)
|
||||||
|
humidity = wxdata.humidity
|
||||||
|
pressure = wxdata.pressure
|
||||||
|
pressure_i = wxdata.pressure / 33.863886666667
|
||||||
|
temperature = wxdata.temperature
|
||||||
|
temperature_f = (wxdata.temperature * 1.8) + 32
|
||||||
|
dew_point = get_dew_point_c(wxdata.temperature, wxdata.humidity)
|
||||||
|
dew_point_f = (dew_point * 1.8) +32
|
||||||
|
h = round(humidity)
|
||||||
|
pm = truncate(pressure, 2)
|
||||||
|
pi = truncate(pressure_i, 2)
|
||||||
|
tc = truncate(temperature, 2)
|
||||||
|
tf = truncate(temperature_f, 2)
|
||||||
|
dt_now = datetime.datetime.now()
|
||||||
|
dt = dt_now.strftime("%H:%M:%S")
|
||||||
|
dp = truncate(dew_point, 2)
|
||||||
|
df = truncate(dew_point_f, 2)
|
||||||
|
entry = '{0} {1:.2f}°F {2:.2f}°C {3}% {4:.2f}mbar {5:.2f}inHg {6:.2f}°F {7:.2f}°C\n'.format(dt, tf, tc, h, pm, pi, df, dp)
|
||||||
|
return entry
|
||||||
|
|
||||||
|
|
||||||
|
def wx_log(y, m):
|
||||||
|
if m in range(1,9):
|
||||||
|
month = "0" + str(m)
|
||||||
|
else:
|
||||||
|
month = str(m)
|
||||||
|
dir_path = "/var/gopher/wxlog/" + str(y) + "/" + month
|
||||||
|
if not os.path.exists(dir_path):
|
||||||
|
os.makedirs(dir_path)
|
||||||
|
shutil.copy2('/var/gopher/skel/index.dcgi', dir_path)
|
||||||
|
shutil.copy2('/var/gopher/skel/dp.dcgi', dir_path)
|
||||||
|
shutil.copy2('/var/gopher/skel/hum.dcgi', dir_path)
|
||||||
|
shutil.copy2('/var/gopher/skel/plot-d.dcgi', dir_path)
|
||||||
|
shutil.copy2('/var/gopher/pi/skel/plot-h.dcgi', dir_path)
|
||||||
|
shutil.copy2('/var/gopher/pi/skel/plot-p.dcgi', dir_path)
|
||||||
|
shutil.copy2('/var/gopher/skel/plot-t.dcgi', dir_path)
|
||||||
|
shutil.copy2('/var/gopher/skel/pres.dcgi', dir_path)
|
||||||
|
shutil.copy2('/var/gopher/skel/temp.dcgi', dir_path)
|
||||||
|
file_name = str(datetime.datetime.now().date()) + ".txt"
|
||||||
|
check_file = Path(dir_path + "/" + file_name)
|
||||||
|
whole_path = dir_path + "/" + file_name
|
||||||
|
if check_file.is_file():
|
||||||
|
f = open(whole_path, 'a')
|
||||||
|
f.write(entry())
|
||||||
|
else:
|
||||||
|
f = open(whole_path, 'a')
|
||||||
|
f.write("WX Station perilo.us # Hernando, MS # " + str(datetime.datetime.now().date()) + "\n")
|
||||||
|
f.write("------------------------------------------------------------------\n")
|
||||||
|
f.write(" Time | Temperature | Humidity | Air Pressure | Dew Point\n")
|
||||||
|
f.write("------------------------------------------------------------------\n")
|
||||||
|
f.write(entry())
|
||||||
|
|
||||||
|
wx_log(year, month)
|
Loading…
Reference in New Issue