<%= if @weather_packet do %>

Weather for {@callsign} <%= if @weather_packet do %> <% {symbol_table_id, symbol_code} = AprsmeWeb.MapLive.PacketUtils.get_symbol_info(@weather_packet) %> <% symbol_table = if symbol_table_id in ["/", "\\", "]"], do: symbol_table_id, else: "/" %> <% symbol_code = symbol_code || ">" %> <% table_id = if symbol_table == "/", do: "0", else: if(symbol_table == "]", do: "2", else: "1") %> <% symbol_code_ord = symbol_code |> String.to_charlist() |> List.first() |> (fn c -> if is_integer(c), do: c, else: 63 end).() %> <% index = symbol_code_ord - 33 %> <% safe_index = max(0, min(index, 93)) %> <% column = rem(safe_index, 16) %> <% row = div(safe_index, 16) %> <% x = -column * 128 %> <% y = -row * 128 %> <% symbol_img = "/aprs-symbols/aprs-symbols-128-#{table_id}@2x.png" %>
<% end %> <.link navigate={~p"/info/#{@callsign}"} class="ml-2 text-blue-600 hover:underline text-base font-normal" > info <.link navigate={~p"/#{@callsign}"} class="ml-2 text-blue-600 hover:underline text-base font-normal" > view on map

{PacketUtils.get_timestamp(@weather_packet)}
Temperature: {PacketUtils.get_weather_field(@weather_packet, :temperature)}°F
Humidity: {PacketUtils.get_weather_field(@weather_packet, :humidity)}%
Wind: {PacketUtils.get_weather_field(@weather_packet, :wind_direction)}° @ {PacketUtils.get_weather_field( @weather_packet, :wind_speed )} mph
Gusts: {PacketUtils.get_weather_field(@weather_packet, :wind_gust)} mph
Pressure: {PacketUtils.get_weather_field(@weather_packet, :pressure)} hPa
Rain (1h): {get_weather_field_zero(@weather_packet, :rain_1h)} in
Rain (24h): {get_weather_field_zero(@weather_packet, :rain_24h)} in
Rain (since midnight): {get_weather_field_zero(@weather_packet, :rain_since_midnight)} in
Raw comment: {@weather_packet.comment || @weather_packet["comment"]}

Weather History Graphs

<%= if Enum.any?(@weather_history, &(not is_nil(Map.get(&1, :temperature, nil)))) do %>
<% end %> <%= if Enum.any?(@weather_history, &(not is_nil(Map.get(&1, :humidity, nil)))) do %>
<% end %> <%= if Enum.any?(@weather_history, &(not is_nil(Map.get(&1, :pressure, nil)))) do %>
<% end %> <%= if Enum.any?(@weather_history, &(not is_nil(Map.get(&1, :wind_direction, nil)))) do %>
<% end %> <%= if Enum.any?(@weather_history, &(not is_nil(Map.get(&1, :wind_speed, nil)))) do %>
<% end %> <%= if Enum.any?(@weather_history, &(not is_nil(Map.get(&1, :rain_1h, nil)))) or Enum.any?(@weather_history, &(not is_nil(Map.get(&1, :rain_24h, nil)))) or Enum.any?(@weather_history, &(not is_nil(Map.get(&1, :rain_since_midnight, nil)))) do %>
<% end %> <%= if Enum.any?(@weather_history, &(not is_nil(Map.get(&1, :luminosity, nil)))) do %>
<% end %>
<% else %>

Weather for {@callsign}

No recent weather data available for this callsign.
<% end %>