diff --git a/README.md b/README.md index 496d98d..e049292 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ ii unzip 6.0-16+deb8u2 amd64 De-archiver for .zip files ii time 1.7-25 amd64 The GNU time program for measuring cpu resource usage ``` -Success was also reported on Ubuntu, FreeBSD, and OpenBSD. +Success was also reported on Ubuntu, FreeBSD, OpenBSD and Archlinux. ## Configuration @@ -61,7 +61,7 @@ down to: ## Usage ``` -$ ./splat-radio.sh example.cfg +$ ./splat-radio.sh -c example.cfg ``` ``` diff --git a/splat-radio.sh b/splat-radio.sh index 6e099e9..0421859 100755 --- a/splat-radio.sh +++ b/splat-radio.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Generate Splat map and HAAT calculation @@ -16,12 +16,22 @@ TOPOFILEDIR=splat-datafiles/sdf/ # file for state/county borders BORDERFILE=splat-datafiles/borders/co99_d00.dat -# Usage: ./splat-radio.sh example.cfg +#commands: +SPLAT=splat +SPLAT_HD=splat-hd -# load config -. ./$1 +#default options: +USE_HIGHRES=false +USE_BGWHITE=false +SPLAT_CMD=$SPLAT +SPLAT_OPTIONS=("") +OPTIONS_RADIUS="100" #radius to render in [km] +OPTIONS_AGL="2" #above ground level for receiving antenna [m] +OPTIONS_MR="1.333" #Earth radius multiplier +OPTIONS_DB="160" #max attenuation to plot if no ERP given if [ ! -x `which splat` ]; then + #we assume that splat-hd is installed too echo "error: not found in path: splat" exit 1 fi @@ -36,8 +46,78 @@ if [ ! -x `which optipng` ]; then exit 1 fi -# no more variables to edit below here +function helptext { +cat <&2 + helptext + exit 1 + ;; + :) + echo "Option -$OPTARG requires an argument." >&2 + helptext + exit 1 + ;; + esac +done + +#check for configfile, load if given +if [ ! -z "$CONFIGFILE" ] && [ -r $CONFIGFILE ]; then + echo "read in configfile" + source $CONFIGFILE +else + echo "No configfile given, exiting now" + helptext + exit 1 +fi + +# no more variables to edit below here CLEANCALL=`echo $CALL | sed -e 's|/|-|g;'` QTHFILE=$NAME.qth LRPFILE=$NAME.lrp @@ -49,6 +129,7 @@ MAPJPGTHMBFILE=$NAME-map-thumb.jpg REPFILE=$CLEANCALL-site_report.txt HAATFILE=$NAME-haat.txt + # invert the longitude, because splat is backwards REVLON=`echo "$LON * -1" | bc` @@ -146,14 +227,37 @@ EOF # -d = path to elevation data files # -o = output file # -olditm = old ITM analysis, seems more accurate -if [ $ERP -eq 0 ] ; then - time $NICE splat -t $QTHFILE -R 100 -L 6 -m 1.333 -db 160 -erp $ERP \ - -d $TOPOFILEDIR -b $BORDERFILE -olditm -o $MAPPPMFILE +# -ngs = display topograpy as white + +#add all needed options: +#danger may not be compatible with spaces in filenames +SPLAT_OPTIONS+=("-olditm") +SPLAT_OPTIONS+=("-metric") +SPLAT_OPTIONS+=("-t ${QTHFILE}") +SPLAT_OPTIONS+=("-R ${OPTIONS_RADIUS}") +SPLAT_OPTIONS+=("-L ${OPTIONS_AGL}") +SPLAT_OPTIONS+=("-m ${OPTIONS_MR}") +SPLAT_OPTIONS+=("-o ${MAPPPMFILE}") +SPLAT_OPTIONS+=("-erp ${ERP}") +SPLAT_OPTIONS+=("-d ${TOPOFILEDIR}") + +if [ -r $BORDERFILE ];then + SPLAT_OPTIONS+="-b ${BORDERFILE}" else - time $NICE splat -t $QTHFILE -R 100 -L 6 -m 1.333 -erp $ERP \ - -d $TOPOFILEDIR -b $BORDERFILE -olditm -o $MAPPPMFILE + echo "No Borderfile found, skipping" fi +if [ $ERP -eq 0 ] ; then + echo "ERP is null, plot to max attenuation of ${OPTIONS_DB}db" + SPLAT_OPTIONS+="-db ${OPTIONS_DB} " +fi + +echo "Running $SPLAT_CMD to generate images:" +echo "Options: ${SPLAT_OPTIONS[@]}" +#echo $SPLAT_CMD ${SPLAT_OPTIONS[@]} +time $NICE $SPLAT_CMD ${SPLAT_OPTIONS[@]} + + rm -f $MAPPNGFILE $MAPJPGTHMBFILE echo "converting PPM to PNG"