mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Fix scrubs to live on long tracks, fire ages in a past window, and gaps between hourly cloud frames
- World timeline: a scrub counts as at now within a share of the track (0.5%), now held to at most two minutes. A layer whose source covers years made the window weeks wide, so most of the last month snapped to live. Short tracks keep their window. - Fires: card and detail ages count back from the end of the 24 hours the layer shows when its snapshot ends at a set time, and from now only when it runs to now. A window that ended months ago read "new 105d" on fires three hours old at the time shown. - Weather: a product's max gap and the delay after which its latest frame reads late are at least one and a half of its feed's median frame spacing (over its latest frames). A regional cloud feed with frames an hour apart drew nothing for the second half of every hour while scrubbing and read late after twenty minutes; feeds with frames minutes apart keep their gaps.
This commit is contained in:
1 parent
7451c9b372
commit
5d733eb07b
12 files changed
+327
-15
No files matched your search
@@ -8,6 +8,7 @@ import {
|
||||
REGIONAL_INFRARED_MAX_GAP_MS,
|
||||
GLOBAL_INFRARED_MAX_GAP_MS,
|
||||
LIGHTNING_MAX_GAP_MS,
|
||||
atLeastFrameSpacing,
|
||||
} from './clock.js';
|
||||
import { formatUtcDayMonth, t, msg } from '../../i18n/index.js';
|
||||
import { formatScaleLabel } from '../../ui/unitLabels.js';
|
||||
@@ -96,7 +97,10 @@ export function createWeatherLayer({
|
||||
let unregisterClock = null;
|
||||
let frameRequest = null;
|
||||
let noFrame = false;
|
||||
const maxGap = () =>
|
||||
// A product's own gap, and the delay after which its latest frame reads
|
||||
// late. A feed whose frames come further apart holds each frame, and waits
|
||||
// for the next, as long as its frames are apart (see atLeastFrameSpacing).
|
||||
const productGap = () =>
|
||||
radar
|
||||
? RADAR_MAX_GAP_MS
|
||||
: lightning
|
||||
@@ -104,6 +108,23 @@ export function createWeatherLayer({
|
||||
: product === 'clouds'
|
||||
? GLOBAL_INFRARED_MAX_GAP_MS
|
||||
: REGIONAL_INFRARED_MAX_GAP_MS;
|
||||
const productDelay = () =>
|
||||
(product === 'clouds' ? 240 : lightning ? 45 : 20) * 60_000;
|
||||
// Read for every frame a selection weighs, so worked out once per product
|
||||
// and frame list.
|
||||
let spaced = null;
|
||||
const spacedTimes = () => {
|
||||
const times = manifest?.times ?? [];
|
||||
if (spaced?.times !== times || spaced?.product !== product)
|
||||
spaced = {
|
||||
times,
|
||||
product,
|
||||
gap: atLeastFrameSpacing(productGap(), times),
|
||||
delay: atLeastFrameSpacing(productDelay(), times),
|
||||
};
|
||||
return spaced;
|
||||
};
|
||||
const maxGap = () => spacedTimes().gap;
|
||||
const isLatest = () =>
|
||||
clock ? clock.getState().mode === 'latest' : followLatest;
|
||||
const getHost = () =>
|
||||
@@ -117,8 +138,7 @@ export function createWeatherLayer({
|
||||
});
|
||||
const observationDelayed = () =>
|
||||
manifest?.latest &&
|
||||
Date.now() - Date.parse(manifest.latest) >
|
||||
(product === 'clouds' ? 240 : lightning ? 45 : 20) * 60_000;
|
||||
Date.now() - Date.parse(manifest.latest) > spacedTimes().delay;
|
||||
const stop = () => {
|
||||
if (clock) return;
|
||||
playing = false;
|
||||
@@ -544,11 +564,11 @@ export function createWeatherLayer({
|
||||
shared.products.find((entry) => entry.id === id)?.selected === null
|
||||
? maxGap() / 60_000 < 60
|
||||
? t('No frame within {gap} min of {time}', {
|
||||
gap: maxGap() / 60_000,
|
||||
gap: Math.round(maxGap() / 60_000),
|
||||
time: utc(shared.target),
|
||||
})
|
||||
: t('No frame within {gap} h of {time}', {
|
||||
gap: maxGap() / 3600_000,
|
||||
gap: Math.round(maxGap() / 360_000) / 10,
|
||||
time: utc(shared.target),
|
||||
})
|
||||
: null;
|
||||
@@ -688,7 +708,7 @@ export function createWeatherLayer({
|
||||
? t('Global · 60°S–60°N')
|
||||
: t('North America')),
|
||||
shownTime: time,
|
||||
maxGapMinutes: maxGap() / 60_000,
|
||||
maxGapMinutes: Math.round(maxGap() / 60_000),
|
||||
detail,
|
||||
status:
|
||||
missing ||
|
||||
|
||||
Reference in new issue
Block a user