- Julia 97.7%
- Makefile 2.3%
Add `plot_muf_day` and `plot_and_save_muf_day` to plot the observed MUF over one full UTC day together with the rolling 30-minute predictions, for historical verification of the model. The figure is styled with the SatelliteAnalysis.jl Makie theme (light and dark variants) and shows only the data that is meaningful for a past day: no forward-looking forecast, future connector, or latest-observation marker. The left panel shows the number of soundings and the MAE / RMSE of the predictions against the observations. - Add the `until` keyword to `update_muf_data` so a historical day can be backfilled without scanning every day up to the present. - Factor the plot-window queries, the rolling-prediction loop, and the logo header into private helpers shared by both plot functions. - Add SatelliteAnalysis.jl as a dependency tracked from the `main` branch via `[sources]`, since the Makie theme is not registered yet. - Add the `plot-day` Makefile target and the interactive date prompt, and update the README, module docs, and the precompile workload. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| assets | ||
| models | ||
| src | ||
| .gitattributes | ||
| Makefile | ||
| Project.toml | ||
| README.md | ||
MufPrediction30min.jl
Julia application for real-time 30-minute-ahead Maximum Usable Frequency (MUF) prediction using pre-trained neural networks. MUF data is sourced from the EMBRACE ionosonde network and space-weather indices are computed via SpaceIndices.jl.
Overview
The application maintains a rolling 24-hour SQLite database populated with ionosonde MUF observations and space-weather indices (Dst, Kp, F10.7). A Flux.jl neural network, trained separately, takes these inputs and predicts the MUF 30 minutes into the future. Results can be displayed as an interactive prediction table or exported as a publication-quality PNG figure.
The workflow has four stages:
- Setup — initialize the local database (once, idempotent).
- Data — download recent MUF observations from EMBRACE and compute space-weather indices.
- Prediction — run the neural network for a given station and timestamp.
- Maintenance — prune database rows older than 24 hours.
Supported Stations
| Station ID | Location | Latitude | Longitude |
|---|---|---|---|
| BVJ03 | Boa Vista, RR | +2.87° | −60.71° |
| CAJ2M | Cachoeira Paulista, SP | −22.70° | −45.01° |
Requirements
- Julia ≥ 1.11
- Dependencies listed in
Project.toml(installed automatically by Julia's package manager)
Setup
Clone the repository, then run:
make install # Instantiate the Julia environment
make initialize-database # Create the database (only needed once)
Usage
All entry points are available through make or directly from a Julia session.
Via Makefile
make update-all # Download MUF data + compute space indices for all stations
make predict # Run the neural network — interactive station menu
make plot # Generate and save the prediction figure — interactive station menu
make plot-day # Generate and save the daily observed vs. predicted figure — interactive menus
make cleanup-database # Remove rows older than 24 hours
Run make (or make help) to list all available targets.
Via Julia REPL
using MufPrediction
# First-time setup.
initialize_database()
# Populate the database with recent data.
update_all()
# Predict the MUF 30 minutes ahead (interactive station menu).
predict_muf_30min()
# Or supply a specific model and timestamp.
predict_muf_30min("models/nn-BVJ03-2026-06-15T13:17:55.342.jld2", DateTime("2026-06-15T12:00:00"))
# Plot the 12-hour history and 30-minute forecast (interactive station menu).
plot_and_save_muf_prediction()
# Plot the observed vs. predicted MUF for one full UTC day (interactive menus, or pass the
# model and the date directly).
plot_and_save_muf_day()
plot_and_save_muf_day("models/nn-BVJ03-2026-06-15T13:17:55.342.jld2", Date(2026, 8, 11))
# Periodic maintenance.
cleanup_database()
Neural Network Models
Pre-trained model archives (.jld2) are stored in the models/ directory. Each archive
encodes the station identifier in its filename:
models/nn-BVJ03-<timestamp>.jld2
models/nn-CAJ2M-<timestamp>.jld2
The station is read directly from the archive, so no station argument is needed at inference
time. Models are trained by the companion train_neural_network_for_single_station package.
Input Features
The network receives a 14-dimensional feature vector:
| Feature | Description |
|---|---|
doy_sin, doy_cos |
Day-of-year (cyclically encoded) |
hour_sin, hour_cos |
Hour of day (cyclically encoded) |
cos_sza |
Cosine of the solar zenith angle |
Dst, Dst_lag_60min |
Geomagnetic Dst index (current and 60 min prior) |
Kp |
Geomagnetic Kp index |
F10obs, F10avg |
Observed F10.7 and 81-day average F10.7 solar flux |
MUF |
Current MUF observation |
MUF_trend_20min, MUF_trend_40min, MUF_trend_60min |
MUF trends over the past 20, 40, and 60 minutes |
Output
plot_and_save_muf_prediction saves a PNG to the current directory with the filename:
MUF_+30min_prediction-<Station_Name>-<yyyy-mm-dd_HHMM>UTC.png
The figure shows the observed MUF (solid line), the rolling 30-minute-ahead predictions over the past 12 hours (dashed line), and the operational forecast point for the next 30 minutes (star marker).
plot_and_save_muf_day saves a PNG with the filename:
MUF_daily_+30min-<Station_Name>-<yyyy-mm-dd>.png
The daily figure covers one full UTC day for historical verification: the observed MUF
(solid line) and the rolling 30-minute-ahead predictions (dashed line), plus the MAE / RMSE
of the predictions in the information panel. Since the day is in the past, no operational
forecast is drawn. The figure is styled with the
SatelliteAnalysis.jl Makie theme
(light by default; pass theme = :dark for the dark variant).
Data Source
MUF observations are downloaded from the EMBRACE ionosonde data archive operated by INPE:
https://embracedata.inpe.br/ionosonde/{STATION}/
The database follows a "DB primary, EMBRACE fills gaps" strategy: only files absent from the local database are downloaded, making frequent calls fast once the database is warm.