TNR PROTOGRAPHY
  • Home
  • Aurora
  • Bookings
  • Services
  • Contact
  • About
  • Products
  • Bucket Shots
  • What is Aurora?
  • Licensing
  • Aurora Forecast Updates
  • Product
  • Wedding Help!
  • TNR Protography - Around the Place

Aurora Forecast West Coast Nz - Changelog

V1.11 - bUG fIX TO THE POTENTIAL AURORA OVER THE PAST 3 HOURS GRAPH

15/5/2025

0 Comments

 
There was an issue when the first value above 0 was received, the graph would make the entire plot except for the new data points, the same as the first point after 0.

What was wrong:
The original code for rendering the chart iterated through the data points received from the APIs and plotted points directly at the timestamps when the data arrived. This meant:
  • The chart points were not guaranteed to be exactly every 5 minutes.
  • When data was sparse, there would be gaps or irregularly spaced points on the chart.
  • The "Real Aurora Score" (red line) didn't explicitly "carry forward" the last known value if no new data arrived for a particular time interval. It relied on finding the "closest" point, which isn't the same as maintaining the previous value.

What was done to fix it (Bullet points):
  • Sorted Data: The data received from both APIs was sorted by timestamp in ascending order. This makes it efficient to find the latest value at any given time.
  • Fixed Time Intervals: Instead of iterating through the incoming data points, the code now iterates through every 5-minute interval for the last 3 hours. The start time for this iteration is rounded down to the nearest 5-minute mark (e.g., if 3 hours ago was 6:53, the chart starts at 6:50).
  • Find Latest Value: For each 5-minute interval in the loop, the code checks the sorted data to find the latest data point (for both datasets) that occurred at or before that specific 5-minute time.
  • Carry Forward Value: The identified latest value for each dataset is stored in a variable (lastValue1, lastValue2). For each 5-minute interval, this lastValue is added to the chart's data array. This ensures that if no new data arrived since the last 5-minute mark, the previous value is used, effectively "carrying it forward" as requested. If the last known value was 0, it remains 0 until a new, non-zero value is received.
  • Consistent Labels: The time of each 5-minute interval is added to the chart's labels array, ensuring the x-axis has points exactly every 5 minutes regardless of data arrival times.
In essence, the fix changed the approach from "plot the data you got" to "plot a point every 5 minutes using the latest data available up to that time".
0 Comments



Leave a Reply.

    Archives

    June 2025
    May 2025
    April 2025

    Categories

    All
    New Version

    RSS Feed

© COPYRIGHT 2024. ALL RIGHTS RESERVED.
  • Home
  • Aurora
  • Bookings
  • Services
  • Contact
  • About
  • Products
  • Bucket Shots
  • What is Aurora?
  • Licensing
  • Aurora Forecast Updates
  • Product
  • Wedding Help!
  • TNR Protography - Around the Place