2023-04-10 12:01:58 -06:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Copyright (C) 2023, Cees Bassa
|
|
|
|
# Copyright (C) 2023, Jeff Moe
|
|
|
|
# GPLv3+
|
|
|
|
#
|
|
|
|
# Script to process stvid data for submission to sat-obs seesat mailing list.
|
|
|
|
#
|
|
|
|
# Custom paths set for Spacecruft
|
|
|
|
|
2023-04-10 12:47:20 -06:00
|
|
|
set -x
|
|
|
|
|
2023-04-10 12:01:58 -06:00
|
|
|
# Base directory where stvid observations are written by all cameras.
|
|
|
|
STVIDDIR="/srv/obs"
|
|
|
|
# Base directory where data reports for the seesat mailing list are prepared.
|
|
|
|
SEESATDIR="/srv/seesat"
|
|
|
|
# Cameras / systems in use to be processed.
|
2023-06-21 18:03:58 -06:00
|
|
|
#CAMERAS="cruftpi7 odroid-01 odroid-03 odroid-04 odroid-06 panda-06 panda-08 quartz-02"
|
|
|
|
#CAMERAS="cruftpi7 odroid-01 odroid-03 odroid-04 panda-06 panda-08 quartz-02"
|
|
|
|
CAMERAS="cruftpi7 odroid-03 odroid-04 panda-06 panda-08 quartz-02"
|
|
|
|
#CAMERAS="cruftpi7 odroid-03 odroid-04 panda-08 quartz-02"
|
2023-04-10 12:01:58 -06:00
|
|
|
# Date to process
|
2023-06-21 18:03:58 -06:00
|
|
|
OBSDATE="20230621"
|
2023-04-10 12:01:58 -06:00
|
|
|
|
|
|
|
# Set up main seesat directories
|
|
|
|
cd "${SEESATDIR}"
|
|
|
|
# Output dir for daily report
|
|
|
|
mkdir -p "reports/${OBSDATE}"
|
|
|
|
# Output dir for cameras
|
|
|
|
mkdir -p "cameras/${OBSDATE}"
|
|
|
|
# Remove temporary data
|
|
|
|
rm -f ${SEESATDIR}/cameras/${OBSDATE}/classfd.dat
|
|
|
|
rm -f ${SEESATDIR}/cameras/${OBSDATE}/unid.dat
|
|
|
|
rm -f ${SEESATDIR}/cameras/${OBSDATE}/catalog.dat
|
|
|
|
rm -f ${SEESATDIR}/cameras/${OBSDATE}/starlink.dat
|
|
|
|
rm -f ${SEESATDIR}/cameras/${OBSDATE}/oneweb.dat
|
|
|
|
|
|
|
|
# Set up daily directories and purge temp data
|
|
|
|
for camera in $CAMERAS
|
|
|
|
do echo $camera
|
|
|
|
cd "${SEESATDIR}/cameras/${OBSDATE}"
|
2023-04-10 12:47:20 -06:00
|
|
|
|
2023-04-10 12:01:58 -06:00
|
|
|
# Make subdirectories for class of satellite
|
|
|
|
mkdir -p "${camera}/classfd" "${camera}/unid" "${camera}/catalog"
|
2023-04-12 10:11:45 -06:00
|
|
|
mkdir -p "${camera}/starlink" "${camera}/oneweb"
|
2023-04-10 12:47:20 -06:00
|
|
|
|
2023-04-10 12:01:58 -06:00
|
|
|
# Remove temporary data
|
|
|
|
rm -f "${camera}/classfd/classfd.dat"
|
|
|
|
rm -f "${camera}/unid/unid.dat"
|
|
|
|
rm -f "${camera}/catalog/catalog.dat"
|
2023-04-12 10:11:45 -06:00
|
|
|
rm -f "${camera}/starlink/starlink.dat"
|
|
|
|
rm -f "${camera}/oneweb/oneweb.dat"
|
2023-04-10 12:01:58 -06:00
|
|
|
done
|
|
|
|
|
|
|
|
# Process data from cameras
|
|
|
|
for camera in $CAMERAS
|
|
|
|
do echo $camera
|
|
|
|
# Not sure if cam 0 or 1, will break if there is both XXX
|
|
|
|
cd "${STVIDDIR}/${camera}/obs/${OBSDATE}_0" 2>/dev/null
|
|
|
|
cd "${STVIDDIR}/${camera}/obs/${OBSDATE}_1" 2>/dev/null
|
|
|
|
|
|
|
|
# Process each directory for that camera's session
|
|
|
|
# Copy relevant files over to seesat directory
|
|
|
|
for dir in [0-9]?????; do
|
2023-04-19 21:01:54 -06:00
|
|
|
cp -pu $dir/*classfd* "${SEESATDIR}/cameras/${OBSDATE}/${camera}/classfd/"
|
|
|
|
cp -pu $dir/*unid* "${SEESATDIR}/cameras/${OBSDATE}/${camera}/unid/"
|
|
|
|
cp -pu $dir/*catalog* "${SEESATDIR}/cameras/${OBSDATE}/${camera}/catalog/"
|
|
|
|
cp -pu $dir/*starlink* "${SEESATDIR}/cameras/${OBSDATE}/${camera}/starlink/"
|
|
|
|
cp -pu $dir/*oneweb* "${SEESATDIR}/cameras/${OBSDATE}/${camera}/oneweb/"
|
2023-04-10 12:01:58 -06:00
|
|
|
|
|
|
|
# Combine .dat files from camera
|
2023-04-10 12:47:20 -06:00
|
|
|
cat ${SEESATDIR}/cameras/${OBSDATE}/${camera}/classfd/2*classfd.dat >${SEESATDIR}/cameras/${OBSDATE}/${camera}/classfd/classfd.dat
|
2023-04-10 12:01:58 -06:00
|
|
|
|
|
|
|
cat ${SEESATDIR}/cameras/${OBSDATE}/${camera}/unid/2*unid.dat >${SEESATDIR}/cameras/${OBSDATE}/${camera}/unid/unid.dat
|
|
|
|
|
|
|
|
cat ${SEESATDIR}/cameras/${OBSDATE}/${camera}/catalog/2*catalog.dat >${SEESATDIR}/cameras/${OBSDATE}/${camera}/catalog/catalog.dat
|
|
|
|
|
2023-04-12 10:11:45 -06:00
|
|
|
cat ${SEESATDIR}/cameras/${OBSDATE}/${camera}/starlink/2*starlink.dat >${SEESATDIR}/cameras/${OBSDATE}/${camera}/starlink/starlink.dat
|
|
|
|
cat ${SEESATDIR}/cameras/${OBSDATE}/${camera}/oneweb/2*oneweb.dat >${SEESATDIR}/cameras/${OBSDATE}/${camera}/oneweb/oneweb.dat
|
2023-04-10 12:01:58 -06:00
|
|
|
done
|
|
|
|
# Combine all camera .dat files into one file.
|
2023-04-10 12:47:20 -06:00
|
|
|
cat ${SEESATDIR}/cameras/${OBSDATE}/${camera}/classfd/classfd.dat >> ${SEESATDIR}/cameras/${OBSDATE}/classfd.dat
|
|
|
|
cat ${SEESATDIR}/cameras/${OBSDATE}/${camera}/unid/unid.dat >> ${SEESATDIR}/cameras/${OBSDATE}/unid.dat
|
|
|
|
cat ${SEESATDIR}/cameras/${OBSDATE}/${camera}/catalog/catalog.dat >> ${SEESATDIR}/cameras/${OBSDATE}/catalog.dat
|
2023-04-12 10:11:45 -06:00
|
|
|
cat ${SEESATDIR}/cameras/${OBSDATE}/${camera}/starlink/starlink.dat >> ${SEESATDIR}/cameras/${OBSDATE}/starlink.dat
|
|
|
|
cat ${SEESATDIR}/cameras/${OBSDATE}/${camera}/oneweb/oneweb.dat >> ${SEESATDIR}/cameras/${OBSDATE}/oneweb.dat
|
2023-04-10 12:01:58 -06:00
|
|
|
done
|
|
|
|
|