-
Notifications
You must be signed in to change notification settings - Fork 4
Extended splat radio #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should check if the user is going to use splat-hd. |
||
| 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 <<EOF | ||
|
|
||
| Usage: $0 -c CONFIGFILE [-b] | ||
|
|
||
| -c CONFIGFILE | ||
| The file with your configuration, see README.md | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why should we have these particular options on the command line and not the config file? I'm not sure of the use case.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the -b option is used to render images with white background instead of topography hillshading. -r is used to quickly change between a large scale image (splat) and a detailed image (splat-hd). So you can render images with either tool without changing the configfile. -R is just a convenience so i can adjust rendering radius (and therefore time) for debugging -h and -c are to make it easier with getopts and get consistency |
||
| -R RADIUS | ||
| Render only up to a radius from QTH-File in [km] | ||
|
|
||
| -b Render Topograpy Background in white, used to generate | ||
| transparent overlays | ||
|
|
||
| -r Use splat-hd to render high-res images, implies | ||
| sdf-hd datafiles. | ||
|
|
||
| -h Display this help message | ||
|
|
||
| EOF | ||
| } | ||
|
|
||
| #Extract commandline options, see helptext for explanation | ||
| while getopts ":c:brhR:" opt; do | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bashism |
||
| case $opt in | ||
| b) | ||
| USE_BGWHITE=true | ||
| SPLAT_OPTIONS+=("-ngs") | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bashism? |
||
| echo "Rendering Background in white, -b option set" | ||
| ;; | ||
| r) | ||
| USE_HIGHRES=true | ||
| SPLAT_CMD=$SPLAT_HD | ||
| echo "Rendering high-res with splat-hd, -r option set" | ||
| ;; | ||
| R) | ||
| OPTIONS_RADIUS=$OPTARG | ||
| echo "Setting rendering radius to ${OPTARG}km" | ||
| ;; | ||
| c) | ||
| echo "Using configuration file: ${OPTARG}" | ||
| CONFIGFILE=$OPTARG | ||
| ;; | ||
| h) | ||
| helptext | ||
| exit 1 | ||
| ;; | ||
| \?) | ||
| echo "Invalid option: -$OPTARG" >&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") | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bashism? |
||
| SPLAT_OPTIONS+=("-metric") | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the practical effect of this? Just HAAT output changes or something else?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm, this way splat treats all input/output in metric format. |
||
| 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} " | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bashism? |
||
| fi | ||
|
|
||
| echo "Running $SPLAT_CMD to generate images:" | ||
| echo "Options: ${SPLAT_OPTIONS[@]}" | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bashism |
||
| #echo $SPLAT_CMD ${SPLAT_OPTIONS[@]} | ||
| time $NICE $SPLAT_CMD ${SPLAT_OPTIONS[@]} | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bashism |
||
|
|
||
|
|
||
| rm -f $MAPPNGFILE $MAPJPGTHMBFILE | ||
|
|
||
| echo "converting PPM to PNG" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been targeting bourne shell for portability to BSD and OSX.