Skip to content

Commit

Permalink
Merge pull request #305 from dom-robinson/animations
Browse files Browse the repository at this point in the history
Animation and display of NOAA, Full length NOAA, Interpolated (High Quality) NOAA
  • Loading branch information
jekhokie committed Mar 31, 2021
2 parents 3220027 + 7bf995d commit 3bc0148
Show file tree
Hide file tree
Showing 24 changed files with 215 additions and 24 deletions.
6 changes: 5 additions & 1 deletion ansible/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ db_file: "{{ noaa_home }}/db/panel.db"
# website content directory
web_home: "/var/www/wx-new"

# output root directories for images and audio
# output root directories for images, audio, and video
output_root: /srv
images_output: "{{ output_root }}/images"
audio_output: "{{ output_root }}/audio"
videos_output: "{{ output_root }}/videos"

# file used for NOAA animations
noaa_animation_output: "{{ videos_output }}/RollingAnimation.mp4"

# ramfs location
ramfs_path: "/var/ramfs"
Expand Down
12 changes: 10 additions & 2 deletions ansible/roles/common/tasks/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
- name: create images directory
become: yes
file:
path: images_output
path: "{{ images_output }}"
state: directory
owner: pi
mode: 0775
Expand All @@ -122,7 +122,7 @@
- name: create audio root directory
become: yes
file:
path: audio_output
path: "{{ audio_output }}"
state: directory
owner: pi
group: pi
Expand All @@ -145,4 +145,12 @@
owner: pi
group: pi
mode: 0775

- name: create videos directory
become: yes
file:
path: "{{ videos_output }}"
state: directory
owner: pi
mode: 0775
...
3 changes: 3 additions & 0 deletions ansible/roles/common/templates/noaa-v2.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ WEB_HOME={{ web_home }}
IMAGE_OUTPUT={{ images_output }}
NOAA_AUDIO_OUTPUT={{ audio_output }}/noaa
METEOR_AUDIO_OUTPUT={{ audio_output }}/meteor
NOAA_ANIMATION_OUTPUT={{ noaa_animation_output }}
RAMFS_AUDIO={{ ramfs_path }}
NOAA_LOG={{ log_file }}
LAT={{ latitude }}
Expand Down Expand Up @@ -44,6 +45,8 @@ DELETE_AUDIO={{ delete_audio|lower }}
FLIP_METEOR_IMG={{ flip_meteor_image|lower }}
TZ_OFFSET={{ timezone_offset }}
LOG_LEVEL={{ log_level }}
NOAA_CROP_TOPTOBOTTOM={{ noaa_crop_toptobottom|lower }}
NOAA_INTERPOLATE={{ noaa_interpolate|lower }}
NOAA_MAP_CROSSHAIR_ENABLE={{ noaa_map_crosshair_enable|lower }}
NOAA_MAP_CROSSHAIR_COLOR={{ noaa_map_crosshair_color }}
NOAA_MAP_GRID_DEGREES={{ noaa_map_grid_degrees }}
Expand Down
7 changes: 7 additions & 0 deletions ansible/roles/webserver/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@
state: directory
group: www-data

- name: update videos directory group
become: yes
file:
path: "{{ videos_output }}"
state: directory
group: www-data

- name: update database folder permissions
become: yes
file:
Expand Down
4 changes: 4 additions & 0 deletions ansible/roles/webserver/templates/Config.php.j2
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ class Config {
# whether to enable satvis visualization
const ENABLE_SATVIS = '{{ enable_satvis|lower }}';

# whether to enable image video
const ENABLE_ANIMATION = '{{ enable_animation|lower }}';
const ANIMATION_VIDEO_FILE = '{{ noaa_animation_output }}';

# lat and lon coordinates of base station
const BASE_STATION_LAT = '{{ latitude }}';
const BASE_STATION_LON = '{{ longitude }}';
Expand Down
4 changes: 4 additions & 0 deletions ansible/roles/webserver/templates/nginx_default.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ server {
alias /srv/images/$1;
}

location ~ /videos/(.*) {
alias /srv/videos/$1;
}

location / {
try_files $uri $uri/ /index.php;
}
Expand Down
4 changes: 4 additions & 0 deletions ansible/roles/webserver/templates/nginx_tls_default.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ server {
alias /srv/images/$1;
}

location ~ /videos/(.*) {
alias /srv/videos/$1;
}

location / {
try_files $uri $uri/ /index.php;
}
Expand Down
13 changes: 11 additions & 2 deletions config/settings.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ delete_audio: false
# (note: default value is total list of supported image processors)
# noaa_nighttime_enhancements - list of enhancements to create images using during nighttime captures
# (note: default value is total list of supported image processors)
# noaa_crop_toptobottom - whether to crop the top and bottom noise out of the noaa capture
# noaa_interpolate - whether to interpolate and oversample the images (larger images produced)
flip_meteor_image: true
produce_spectrogram: true
noaa_crop_telemetry: false
Expand All @@ -109,8 +111,10 @@ produce_polar_direction_graph: true
ground_station_location: ''
show_sun_elevation: true
show_pass_direction: true
noaa_daytime_enhancements: 'ZA MCIR MCIR-precip MSA MSA-precip HVC-precip HVCT-precip HVC HVCT therm'
noaa_nighttime_enhancements: 'ZA MCIR MCIR-precip therm'
noaa_daytime_enhancements: 'ZA MCIR MCIR-precip MSA MSA-precip HVC-precip HVCT-precip HVC HVCT therm avi'
noaa_nighttime_enhancements: 'ZA MCIR HVCT MCIR-precip therm avi'
noaa_crop_toptobottom: true
noaa_interpolate: false

# noaa map configurations
# http://usradioguy.com/wp-content/uploads/2020/05/wxtoimgcommand-line.pdf
Expand Down Expand Up @@ -198,6 +202,11 @@ log_level: DEBUG
# the processing and space requirements
enable_satvis: true

# whether to enable the image video in the passes view - note that this
# is by default disabled on "extra-small" devices such as phones due
# to the processing and space requirements
enable_animation: false

# pruning capabilities - must be configured in cron (see documentation)
# delete_oldest_n - how many oldest captures to delete on each run
# delete_older_than_n - delete all images older than this many days
Expand Down
4 changes: 4 additions & 0 deletions config/settings_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
"show_pass_direction": { "type": "boolean" },
"noaa_daytime_enhancements": { "type": "string" },
"noaa_nighttime_enhancements": { "type": "string" },
"noaa_crop_toptobottom": { "type": "boolean" },
"noaa_interpolate": { "type": "boolean" },
"noaa_map_crosshair_enable": { "type": "boolean" },
"noaa_map_crosshair_color": { "type": "string" },
"noaa_map_grid_degrees": { "type": "number" },
Expand Down Expand Up @@ -195,6 +197,8 @@
"show_pass_direction",
"noaa_daytime_enhancements",
"noaa_nighttime_enhancements",
"noaa_crop_toptobottom",
"noaa_interpolate",
"noaa_map_crosshair_enable",
"noaa_map_crosshair_color",
"noaa_map_grid_degrees",
Expand Down
1 change: 1 addition & 0 deletions scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ fi

# binary helpers
CONVERT="/usr/bin/convert"
FFMPEG="/usr/bin/ffmpeg"
GMIC="/usr/bin/gmic"
IDENTIFY="/usr/bin/identify"
MEDET_ARM="/usr/bin/medet_arm"
Expand Down
42 changes: 42 additions & 0 deletions scripts/image_processors/noaa_avi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
#
# Purpose: Generate a slide show mp4 video of NOAA images.
#
# Input parameters:
# 1. Map overlap file
# 2. Input .wav file
#
# Example:
# ./noaa_avi.sh /path/to/map_overlay.png /path/to/input.wav

# import common lib and settings
. "$HOME/.noaa-v2.conf"
. "$NOAA_HOME/scripts/common.sh"

# input params
MAP_OVERLAY=$1
INPUT_WAV=$2

# note that this is replaced in place to overwrite fixed file
OUTPUT_IMAGE="${NOAA_HOME}/tmp/RollingAnimation.avi"

# calculate any extra args for the processor
extra_args=""
if [ "${NOAA_CROP_TELEMETRY}" == "true" ]; then
extra_args=${extra_args}" -c"
fi

if [ "${NOAA_CROP_TOPTOBOTTOM}" == "false" ]; then
extra_args=${extra_args}" -A"
fi

if [ "${NOAA_INTERPOLATE}" == "true" ]; then
extra_args=${extra_args}" -I"
fi

# produce the output image
$WXTOIMG -o -M 49 -m "${MAP_OVERLAY}" ${extra_args} -e "MCIR" "${INPUT_WAV}" "${OUTPUT_IMAGE}"

# convert updated AVI to web-display ready mp4
# ffmpeg -i ${OUTPUT_IMAGE} -c:v libx264 -c:a copy -y /srv/images/RollingAnimation.mp4
$FFMPEG -an -i ${OUTPUT_IMAGE} -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -y ${NOAA_ANIMATION_OUTPUT}
10 changes: 9 additions & 1 deletion scripts/image_processors/noaa_hvc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ OUTPUT_IMAGE=$3
# calculate any extra args for the processor
extra_args=""
if [ "${NOAA_CROP_TELEMETRY}" == "true" ]; then
extra_args="-c"
extra_args=${extra_args}" -c"
fi

if [ "${NOAA_CROP_TOPTOBOTTOM}" == "false" ]; then
extra_args=${extra_args}" -A"
fi

if [ "${NOAA_INTERPOLATE}" == "true" ]; then
extra_args=${extra_args}" -I"
fi

# produce the output image
Expand Down
11 changes: 10 additions & 1 deletion scripts/image_processors/noaa_hvc_precip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,17 @@ OUTPUT_IMAGE=$3
# calculate any extra args for the processor
extra_args=""
if [ "${NOAA_CROP_TELEMETRY}" == "true" ]; then
extra_args="-c"
extra_args=${extra_args}" -c"
fi

if [ "${NOAA_CROP_TOPTOBOTTOM}" == "false" ]; then
extra_args=${extra_args}" -A"
fi

if [ "${NOAA_INTERPOLATE}" == "true" ]; then
extra_args=${extra_args}" -I"
fi


# produce the output image
$WXTOIMG -o -m "${MAP_OVERLAY}" ${extra_args} -e "HVC-precip" "${INPUT_WAV}" "${OUTPUT_IMAGE}"
10 changes: 9 additions & 1 deletion scripts/image_processors/noaa_hvct.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ OUTPUT_IMAGE=$3
# calculate any extra args for the processor
extra_args=""
if [ "${NOAA_CROP_TELEMETRY}" == "true" ]; then
extra_args="-c"
extra_args=${extra_args}" -c"
fi

if [ "${NOAA_CROP_TOPTOBOTTOM}" == "false" ]; then
extra_args=${extra_args}" -A"
fi

if [ "${NOAA_INTERPOLATE}" == "true" ]; then
extra_args=${extra_args}" -I"
fi

# produce the output image
Expand Down
10 changes: 9 additions & 1 deletion scripts/image_processors/noaa_hvct_precip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ OUTPUT_IMAGE=$3
# calculate any extra args for the processor
extra_args=""
if [ "${NOAA_CROP_TELEMETRY}" == "true" ]; then
extra_args="-c"
extra_args=${extra_args}" -c"
fi

if [ "${NOAA_CROP_TOPTOBOTTOM}" == "false" ]; then
extra_args=${extra_args}" -A"
fi

if [ "${NOAA_INTERPOLATE}" == "true" ]; then
extra_args=${extra_args}" -I"
fi

# produce the output image
Expand Down
10 changes: 9 additions & 1 deletion scripts/image_processors/noaa_mcir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ OUTPUT_IMAGE=$3
# calculate any extra args for the processor
extra_args=""
if [ "${NOAA_CROP_TELEMETRY}" == "true" ]; then
extra_args="-c"
extra_args=${extra_args}" -c"
fi

if [ "${NOAA_CROP_TOPTOBOTTOM}" == "false" ]; then
extra_args=${extra_args}" -A"
fi

if [ "${NOAA_INTERPOLATE}" == "true" ]; then
extra_args=${extra_args}" -I"
fi

# produce the output image
Expand Down
10 changes: 9 additions & 1 deletion scripts/image_processors/noaa_mcir_precip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ OUTPUT_IMAGE=$3
# calculate any extra args for the processor
extra_args=""
if [ "${NOAA_CROP_TELEMETRY}" == "true" ]; then
extra_args="-c"
extra_args=${extra_args}" -c"
fi

if [ "${NOAA_CROP_TOPTOBOTTOM}" == "false" ]; then
extra_args=${extra_args}" -A"
fi

if [ "${NOAA_INTERPOLATE}" == "true" ]; then
extra_args=${extra_args}" -I"
fi

# produce the output image
Expand Down
10 changes: 9 additions & 1 deletion scripts/image_processors/noaa_msa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ OUTPUT_IMAGE=$3
# calculate any extra args for the processor
extra_args=""
if [ "${NOAA_CROP_TELEMETRY}" == "true" ]; then
extra_args="-c"
extra_args=${extra_args}" -c"
fi

if [ "${NOAA_CROP_TOPTOBOTTOM}" == "false" ]; then
extra_args=${extra_args}" -A"
fi

if [ "${NOAA_INTERPOLATE}" == "true" ]; then
extra_args=${extra_args}" -I"
fi

# produce the output image
Expand Down
10 changes: 9 additions & 1 deletion scripts/image_processors/noaa_msa_precip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ OUTPUT_IMAGE=$3
# calculate any extra args for the processor
extra_args=""
if [ "${NOAA_CROP_TELEMETRY}" == "true" ]; then
extra_args="-c"
extra_args=${extra_args}" -c"
fi

if [ "${NOAA_CROP_TOPTOBOTTOM}" == "false" ]; then
extra_args=${extra_args}" -A"
fi

if [ "${NOAA_INTERPOLATE}" == "true" ]; then
extra_args=${extra_args}" -I"
fi

# produce the output image
Expand Down
10 changes: 9 additions & 1 deletion scripts/image_processors/noaa_therm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ OUTPUT_IMAGE=$3
# calculate any extra args for the processor
extra_args=""
if [ "${NOAA_CROP_TELEMETRY}" == "true" ]; then
extra_args="-c"
extra_args=${extra_args}" -c"
fi

if [ "${NOAA_CROP_TOPTOBOTTOM}" == "false" ]; then
extra_args=${extra_args}" -A"
fi

if [ "${NOAA_INTERPOLATE}" == "true" ]; then
extra_args=${extra_args}" -I"
fi

# produce the output image
Expand Down
10 changes: 9 additions & 1 deletion scripts/image_processors/noaa_za.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ OUTPUT_IMAGE=$3
# calculate any extra args for the processor
extra_args=""
if [ "${NOAA_CROP_TELEMETRY}" == "true" ]; then
extra_args="-c"
extra_args=${extra_args}" -c"
fi

if [ "${NOAA_CROP_TOPTOBOTTOM}" == "false" ]; then
extra_args=${extra_args}" -A"
fi

if [ "${NOAA_INTERPOLATE}" == "true" ]; then
extra_args=${extra_args}" -I"
fi

# produce the output image
Expand Down
Loading

0 comments on commit 3bc0148

Please sign in to comment.