Skip to content

Commit

Permalink
Merge pull request #435 from projecthorus/testing
Browse files Browse the repository at this point in the history
auto_rx v1.5.1 release
  • Loading branch information
darksidelemm authored Apr 5, 2021
2 parents be59bcd + 6e9acb7 commit d3b2d06
Show file tree
Hide file tree
Showing 43 changed files with 3,265 additions and 1,338 deletions.
49 changes: 41 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
.gitignore
auto_rx/log/*
# Python
__pycache__/
*.py[cod]
*$py.class
venv

# IDE
.vscode
.idea

# Log
*.log

# Vim
*.swap

# Git

# Other
~*
.~*
*.autosave
.scannerwork


# Custom config file
auto_rx/config/station.cfg
auto_rx/log/

auto_rx/log_power.csv
auto_rx/log_power_0.csv

*.o

auto_rx/reset_usb
auto_rx/rs41ecc
auto_rx/rs41mod
Expand All @@ -14,7 +45,11 @@ auto_rx/imet1rs_dft
auto_rx/lms6Xmod
auto_rx/lms6mod
auto_rx/m10mod
auto_rx/log_power_0.csv
auto_rx/rs_detect
auto_rx/imet54mod
auto_rx/mXXmod
auto_rx/mp3h1mod

m10
meisei100mod
mk2a_lms1680
Expand All @@ -26,19 +61,17 @@ demod/mod/meisei100mod
demod/mod/rs41mod
demod/mod/rs92mod
demod/mod/m10mod
demod/mod/imet54mod
demod/mod/mXXmod
demod/mod/mp3h1mod
imet/imet1rs_dft
m10/m10
mk2a/mk2a_lms1680
scan/dft_detect
utils/fsk_demod
auto_rx/rs_detect
auto_rx/station.cfg
rs41/rs41ecc
rs92/rs92ecc
rs_module/rs41mod
rs_module/rs92mod
scan/reset_usb
scan/rs_detect
*.pyc
*.o
.vscode
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,23 @@ RUN /bin/sh build.sh
# The application container
# -------------------------
FROM python:3.7-slim-buster

EXPOSE 5000/tcp

# Upgrade base packages and install application dependencies.
RUN apt-get update && \
RUN case $(uname -m) in \
"armv6l") extra_packages="libatlas3-base libgfortran5" ;; \
"armv7l") extra_packages="libatlas3-base libgfortran5" ;; \
esac && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
rng-tools \
rtl-sdr \
sox \
tini \
usbutils && \
usbutils \
${extra_packages} && \
rm -rf /var/lib/apt/lists/*

# Copy any additional Python packages from the build container.
Expand Down
77 changes: 0 additions & 77 deletions auto_rx/README.md

This file was deleted.

18 changes: 18 additions & 0 deletions auto_rx/auto_rx.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
import time
import traceback
import os
from dateutil.parser import parse

if sys.version_info < (3, 6):
print("CRITICAL - radiosonde_auto_rx requires Python 3.6 or newer!")
sys.exit(1)

import autorx
from autorx.scan import SondeScanner
Expand Down Expand Up @@ -464,6 +469,7 @@ def telemetry_filter(telemetry):
- Invalid Altitude
- Abnormal range from receiver.
- Invalid serial number.
- Abnormal date (more than 6 hours from utcnow)
This function is defined within this script to avoid passing around large amounts of configuration data.
Expand Down Expand Up @@ -538,6 +544,17 @@ def telemetry_filter(telemetry):
)
return "TempBlock"

# DateTime Check
_delta_time = (datetime.datetime.now(datetime.timezone.utc) - parse(telemetry['datetime'])).total_seconds()
logging.debug("Delta time: %d" % _delta_time)

if abs(_delta_time) > (3600*config["sonde_time_threshold"]):
logging.warning(
"Sonde reported time too far from current UTC time. Either sonde time or system time is invalid. (Threshold: %d hours)" % config["sonde_time_threshold"]
)
return False


# Payload Serial Number Checks
_serial = telemetry["id"]
# Run a Regex to match known Vaisala RS92/RS41 serial numbers (YWWDxxxx)
Expand Down Expand Up @@ -922,6 +939,7 @@ def main():
user_callsign=config["habitat_uploader_callsign"],
user_position=_sondehub_station_position,
user_antenna=config["habitat_uploader_antenna"],
contact_email=config["sondehub_contact_email"],
upload_rate=config["sondehub_upload_rate"],
)

Expand Down
2 changes: 1 addition & 1 deletion auto_rx/autorx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# MINOR - New sonde type support, other fairly big changes that may result in telemetry or config file incompatability issus.
# PATCH - Small changes, or minor feature additions.

__version__ = "1.5.0"
__version__ = "1.5.1"


# Global Variables
Expand Down
24 changes: 24 additions & 0 deletions auto_rx/autorx/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def read_auto_rx_config(filename, no_sdr_test=False):
"max_radius_km": 1000,
"min_radius_km": 0,
"radius_temporary_block": False,
#"sonde_time_threshold": 3, # Commented out to ensure warning message is shown.
# Habitat Settings
"habitat_enabled": False,
"habitat_upload_rate": 30,
Expand Down Expand Up @@ -164,6 +165,7 @@ def read_auto_rx_config(filename, no_sdr_test=False):
# New Sondehub DB Settings
"sondehub_enabled": True,
"sondehub_upload_rate": 30,
#"sondehub_contact_email": "none@none.com" # Commented out to ensure a warning message is shown on startup
}

try:
Expand Down Expand Up @@ -532,6 +534,28 @@ def read_auto_rx_config(filename, no_sdr_test=False):
)
auto_rx_config["experimental_decoders"]["IMET5"] = True

# Sondehub Contact email (1.5.1)
try:
auto_rx_config["sondehub_contact_email"] = config.get(
"sondehub", "sondehub_contact_email"
)
except:
logging.warning(
"Config - Did not find Sondehub contact e-mail setting, using default (none)."
)
auto_rx_config["sondehub_contact_email"] = "none@none.com"

# Sonde time threshold (1.5.1)
try:
auto_rx_config["sonde_time_threshold"] = config.getfloat(
"filtering", "sonde_time_threshold"
)
except:
logging.warning(
"Config - Did not find Sonde Time Threshold, using default (3 hrs)."
)
auto_rx_config["sonde_time_threshold"] = 3

# If we are being called as part of a unit test, just return the config now.
if no_sdr_test:
return auto_rx_config
Expand Down
4 changes: 4 additions & 0 deletions auto_rx/autorx/decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,10 @@ def handle_decoder_line(self, data):
if self.sonde_type == "IMET5":
# Fix up the time.
_telemetry["datetime_dt"] = fix_datetime(_telemetry["datetime"])
# Re-generate the datetime string.
_telemetry["datetime"] = _telemetry["datetime_dt"].strftime(
"%Y-%m-%dT%H:%M:%SZ"
)

# LMS Specific Actions (LMS6, MK2LMS)
if "LMS" in self.sonde_type:
Expand Down
Loading

0 comments on commit d3b2d06

Please sign in to comment.