This commit is contained in:
Cyberes 2024-09-03 15:19:54 -06:00
parent dc425d337a
commit 5dc2f23dc0
7 changed files with 13 additions and 12 deletions

View File

@ -4,6 +4,7 @@ from datetime import datetime
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1 import make_axes_locatable
"""
https://github.com/daniestevez/jupyter_notebooks/blob/master/IONEX.ipynb
@ -52,17 +53,17 @@ def plot_tec_map(tecmap, lon_range: list, lat_range: list):
h = plt.imshow(tecmap_ranged, cmap='viridis', vmin=0, vmax=100, extent=(lon_range[0], lon_range[1], lat_range[0], lat_range[1]), transform=proj)
# Make graph pretty
# ax.coastlines()
# plt.title('VTEC map')
# divider = make_axes_locatable(ax)
# ax_cb = divider.new_horizontal(size='5%', pad=0.1, axes_class=plt.Axes)
# f.add_axes(ax_cb)
# cb = plt.colorbar(h, cax=ax_cb)
# plt.rc('text', usetex=True)
# cb.set_label('TECU ($10^{16} \\mathrm{el}/\\mathrm{m}^2$)')
# plt.show()
ax.coastlines()
plt.title('VTEC map')
divider = make_axes_locatable(ax)
ax_cb = divider.new_horizontal(size='5%', pad=0.1, axes_class=plt.Axes)
f.add_axes(ax_cb)
cb = plt.colorbar(h, cax=ax_cb)
plt.rc('text', usetex=True)
cb.set_label('TECU ($10^{16} \\mathrm{el}/\\mathrm{m}^2$)')
plt.show()
# Deallocate
plt.close()
return tecmap_ranged
return tecmap_ranged, plt

View File

@ -84,7 +84,7 @@ def update_cache():
for tecmap, epoch in get_tecmaps(ionex_data):
parsed_dt = parse_ionex_datetime(epoch)
if parsed_dt.hour == utc_hr:
avg_tec = np.mean(plot_tec_map(tecmap, [float(LON_RANGE_MIN), float(LON_RANGE_MAX)], [float(LAT_RANGE_MIN), float(LAT_RANGE_MAX)]))
avg_tec = np.mean(plot_tec_map(tecmap, [float(LON_RANGE_MIN), float(LON_RANGE_MAX)], [float(LAT_RANGE_MIN), float(LAT_RANGE_MAX)])[0])
logging.info(f'Data timestamp: {parsed_dt.isoformat()}')
break
latest = round(avg_tec, 1)

View File

@ -6,7 +6,7 @@ After=network.target
Type=simple
User=homeassistant
EnvironmentFile=/etc/secrets/space-weather
ExecStart=/srv/space-weather/ha-noaa-space-weather/venv/bin/python /srv/space-weather/ha-noaa-space-weather/feeder-mqtt/main.py
ExecStart=/srv/space-weather/ha-noaa-space-weather/venv/bin/python /srv/space-weather/ha-noaa-space-weather/feeder/main.py
Restart=on-failure
RestartSec=5s