Data processing and plotting for 'Personal Flash' artworks.
https://www.nicolaellisandritherdon.com
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.5 KiB
40 lines
1.5 KiB
#!/bin/bash |
|
|
|
getDailyReadingTotals () { |
|
mtr=$1; |
|
echo "date,reading" > "data/light-meter-$mtr-daily-totals.csv"; |
|
for month in {6..8} ; do |
|
for day in {1..31} ; do |
|
if [[ $day -lt 10 ]]; then d="0$day"; else d="$day"; fi |
|
if [[ $month -lt 10 ]]; then m="0$month"; else m=$month; fi |
|
echo "2021-$m-$d, $(awk 'END{print NR-1}' "data/light-meter-$mtr/2021-$m-$d.csv")" \ |
|
>> "data/light-meter-$mtr-daily-totals.csv"; |
|
done |
|
done |
|
} |
|
|
|
getHourlyReadingTotals () { |
|
mtr=$1; |
|
mkdir -p "data/light-meter-$mtr-hourly-totals"; |
|
for month in {6..8} ; do |
|
if [[ $month -lt 10 ]]; then m="0$month"; else m=$month; fi |
|
mkdir -p "data/light-meter-$mtr-hourly-totals/2021-$m" |
|
for day in {1..31} ; do |
|
if [[ $day -lt 10 ]]; then d="0$day"; else d="$day"; fi |
|
echo "hour,reading" > "data/light-meter-$mtr-hourly-totals/2021-$m/2021-$m-$d.csv"; |
|
for hour in {0..24} ; do |
|
if [[ $hour -lt 10 ]]; then h="0$hour"; else h=$hour; fi |
|
echo "$h, $(awk 'END{print NR-1}' "data/light-meter-$mtr/2021-$m-$d/2021-$m-$d--$h.csv")" \ |
|
>> "data/light-meter-$mtr-hourly-totals/2021-$m/2021-$m-$d.csv"; |
|
done |
|
done |
|
done |
|
} |
|
|
|
# Process Light Meter 1 first... |
|
getDailyReadingTotals "1"; |
|
getHourlyReadingTotals "1"; |
|
|
|
# Process Light Meter 2 second... |
|
getDailyReadingTotals "2"; |
|
getHourlyReadingTotals "2";
|
|
|