← Herramienta ← Tool Guía rápida Quick guide Manual de cielo Sky manual Portada Home

Manual de uso

Niebla para fotografía: índice físico y fusión bayesiana multimodelo.

1. Qué es y qué no es

Es una página HTML autónoma que consulta la API pública de Open‑Meteo y estima el riesgo de niebla o bruma en las próximas horas y en la ventana del próximo amanecer, pensada para decidir si merece la pena salir a fotografiar. No es un modelo de capa límite ni sustituye al aviso oficial: es una herramienta de favorabilidad, con una segunda capa bayesiana que aprende de tus observaciones locales.

Tres pestañas. La primera, “Índice de niebla”, usa un único modelo numérico y muestra el índice hora a hora con toda la física visible. La segunda, “Fusión bayesiana”, descarga varios modelos en paralelo, convierte cada uno en una probabilidad y los combina en un posterior, ponderando cada modelo según lo bien que ha acertado en tu registro. La tercera, “Calibración”, compara el histórico de una estación METAR con lo que cada fuente preveía la víspera y da a la fusión un punto de partida medido: sesgo, curva de probabilidad y peso de cada fuente.

2. Instalación

No hay nada que instalar. Tres formas de usarla:

Local. Guarda niebla.html y manual-niebla.html en una carpeta y abre niebla.html con el navegador. Funciona con doble clic (origen file://).

GitHub Pages. Sube los dos archivos a un repositorio, activa Pages en Settings → Pages (rama main, carpeta raíz) y accede a https://usuario.github.io/repositorio/. El archivo se llama niebla.html precisamente para que sea la página de entrada.

Móvil. Abre la URL de Pages en el navegador del teléfono y añádela a la pantalla de inicio. El botón “Usar mi posición” pide permiso de geolocalización; en Pages funciona porque el sitio se sirve por HTTPS.

Requisitos: conexión a Internet (la previsión se descarga en cada cálculo) y un navegador moderno. Se cargan dos fuentes desde Google Fonts; si no hay red, se usan las del sistema.

3. Controles comunes

ControlFunción
Latitud, LongitudPunto para el que se pide la previsión. Se puede escribir a mano (formato decimal, longitud oeste negativa) o rellenar con “Usar mi posición”.
EntornoCostero activa el término de niebla de advección y descarga la temperatura superficial del mar (SST). Interior lo desactiva y ahorra una petición.
Acimut hacia el marSolo aparece en modo Costero. Rumbo en grados desde el punto hacia el mar abierto. No entra en el índice: sirve para que la ficha etiquete cada hora con viento “del mar” o “de tierra”, contando como del mar la dirección que cae a menos de 60° del acimut. Déjalo vacío si no lo sabes.
ES / ENCambia el idioma de la interfaz y del manual. La elección se recuerda.
ManualAbre este documento.

4. Pestaña 1: índice de niebla

Selector de modelo

Automático, la opción por defecto, elige para las coordenadas escritas la fuente de menor escala efectiva: malla fina y punto alejado del borde del dominio (la definición está en “Fuentes en este punto”, en la pestaña 2). En A Coruña es HARMONIE‑AROME de DMI, de 2 km. Si la fuente elegida no responde, el automático pasa a la siguiente y la línea de estado lo indica. AROME HD tiene malla de 1.3 km, pero su borde oeste queda a unos 100 km y a esa distancia la solución todavía es en buena parte la del modelo global que lo alimenta. DMI llega a 60 h y el servidor lo prolonga con IFS de 9 km; AROME llega a 48 h y lo completa la ficha. La línea de estado muestra el modelo efectivo, su paso de malla, la distancia entre el punto y la celda que devuelve la API, la distancia al borde del dominio en los modelos de área limitada y desde qué hora entra el relleno. Las demás opciones fuerzan una fuente concreta y sirven para comparar.

“Selección de Open‑Meteo (best match)” es la mezcla que decide el servidor. Solo usa AROME entre 6.18° O y 8.35° E, y HARMONIE al norte de 44° N, de modo que en Galicia equivale a ICON‑EU, de 7 km: no es el modelo más fino disponible para el punto.

Tarjetas

Próximas 6 horas: máximo del índice en ese intervalo y a qué hora. Amanecer: máximo en la ventana de 2.5 h antes a 1.5 h después de la salida del sol, que es cuando la niebla de radiación alcanza su desarrollo y cuando interesa estar en el sitio. Mínima depresión del punto de rocío: el valor de ΔT = T − Td más bajo previsto esta noche, con T, Td, viento, nubes, SST y presión en ese instante. Es el dato físico más directo: si no baja de 1 °C, difícilmente habrá niebla de radiación.

Ventana fotográfica

Dentro de la tarjeta del amanecer, la línea “Ventana fotográfica” contesta a la pregunta práctica: de qué hora a qué hora hay algo que fotografiar. Busca el máximo del índice entre el amanecer −4 h y +6 h y recorta el tramo continuo que se mantiene por encima de 50 puntos, interpolando entre horas en los dos bordes, así que devuelve un intervalo con minutos y una duración. Si el pico llega a 75 la etiqueta es “niebla plena”; entre 50 y 74, “solo bruma”; si no se pasa de 50 en ninguna hora, no hay niebla que defender. Avisa además cuando el tramo dura menos de una hora y cuando el máximo cae más de media hora después del amanecer. La misma tarjeta da la dirección del viento (y si es del mar o de tierra, cuando has puesto el acimut), enlaza con la ficha de luz natural para la hora dorada y recuerda que el tramo posterior al amanecer descansa sobre el factor heurístico 0.85, la parte menos firme del cálculo.

Comparar con otro sitio (A o B)

El botón “Comparar con otro sitio” abre un segundo juego de latitud, longitud y entorno, y descarga el sitio B con el mismo modelo y la misma tubería que el A. La sección “A o B” pone las dos tarjetas del próximo amanecer una junto a otra, dibuja las dos curvas del índice y da un veredicto: ve a A, ve a B, o empate práctico si la diferencia es menor de 8 puntos, en cuyo caso deciden el acceso, la composición y la hora de salida. La comparación vive solo en esta pestaña: la fusión bayesiana y el registro de observaciones siguen siendo de un único emplazamiento, el de las coordenadas de arriba, porque mezclar dos sitios estropearía el aprendizaje.

Próximas mañanas

Una fila por amanecer, hasta siete días, con el máximo del índice dentro de la ventana −2.5 h/+1.5 h, el veredicto, la mínima depresión del punto de rocío de esa noche y el viento, las nubes medias y altas y la visibilidad de la hora del máximo. La última columna es la confianza según el plazo, y añade “IFS HRES 9 km” en las mañanas que ya no calcula el modelo fino sino el de relleno (con HARMONIE el cambio lo hace el servidor hacia las 54 h y la marca es aproximada): los dos primeros amaneceres son la previsión de verdad, el tercero y el cuarto son orientativos y del quinto en adelante es una tendencia, no una previsión. Debajo, una frase dice cuál es la mejor mañana de la semana o que ninguna pasa de 50. Es la única vista que llega a siete días; la banda, las gráficas y la tabla horaria siguen cubriendo 48 horas.

Banda horaria

Una barra por hora, 48 horas. Altura = índice. Fondo gris = noche. Hora en rojo = amanecer. Color ámbar = bruma posible (50 a 74), rojizo = niebla probable (≥ 75). Al pasar el ratón se ven las señales activas. Las horas que caen dentro de la ventana fotográfica quedan recuadradas en ámbar.

De qué se compone el índice

Una barra apilada por hora con los puntos que aporta cada término, en el mismo orden en que se calculan; la lluvia se dibuja hacia abajo porque resta. La marca negra corta al valor final del índice, ya con el factor diurno aplicado y saturado a 100, y una marca gris en lo alto señala las horas en que la suma bruta se pasaba de 100. Sirve para ver qué término limita cada hora: si la barra se queda corta por el segmento de nubes, el freno es la nubosidad media y alta y no la humedad; si el segmento de ΔT es alto y el total sigue bajo, el freno es el viento. El recuadro ámbar marca la ventana fotográfica.

Gráfica de convergencia

T y Td en °C sobre el eje izquierdo; viento en km/h sobre el derecho. Las franjas rosadas marcan las horas con ΔT < 2 °C (más intensas si < 1 °C). La línea discontinua roja es el amanecer. La imagen que buscas: T y Td acercándose durante la noche, viento por debajo de 10 km/h y fondo gris sin nubes. Al pie, una barra morada marca las horas con visibilidad por debajo de 2 km, más saturada por debajo de 1 km y más tenue cuando la visibilidad es estimada porque el modelo no la publica.

Qué vas a ver: contraste, distancia y focal

Una calculadora de contraste por visibilidad, para saber qué encuadre aguanta la niebla que se espera. Por la ley de Koschmieder, un objeto oscuro sobre el fondo del cielo conserva un contraste C/C₀ = exp(−3.912·d/V), de donde el 20 % de contraste queda a 0.41·V y el 5 % a 0.77·V. Los dos deslizadores recorren la visibilidad de 0.2 a 10 km y la distancia al sujeto de 20 m a 3 km, y el selector cubre de 28 a 135 mm. Las tarjetas dan el contraste residual con su lectura (volumen y textura, plano, apenas insinuado, desaparecido) y el campo horizontal, 36·d/f en formato 24×36: a 200 m un 43 mm abarca 167 m y un 135 mm, 53 m. Debajo, la curva completa y una tabla a 50, 150, 500 y 1000 m. La visibilidad arranca en la que el modelo da para el máximo del amanecer, o en un escenario supuesto a partir del índice si ese modelo no publica visibilidad; “Volver a la previsión” deshace los ajustes a mano.

Tabla horaria

Todas las variables usadas más dirección del viento (con la etiqueta del mar o de tierra si has puesto el acimut), nubes bajas, SST y presión. La columna “Vis km” es la visibilidad que pronostica el propio modelo o, con ~ delante, la estimada cuando el modelo no la publica: es su diagnóstico más directo de niebla, pero también la variable menos fiable de Open‑Meteo, así que léela como un escenario y no como una medida. Por debajo de 3 km apoya al resto de señales; por sí sola no decide, y de ahí que pese como mucho 20 puntos frente a los 40 de ΔT.

Fórmula del índice

TérminoPuntosJustificación
ΔT = T − Td40 si ≤ 0.5 °C; lineal a 0 en 4 °CSaturación. Condición necesaria.
Viento 10 m<2: 14 · 2–8: 20 · 8–15: 8 · 15–20: 3 · >20: 0Niebla de radiación: algo de mezcla turbulenta la profundiza; calma absoluta da rocío; viento fuerte la impide.
Nubosidad sobre la capa (medias y altas)<25 %: 20 · 25–60 %: 8 · >60 %: 0 (mitad de día)Cielo despejado por encima = enfriamiento radiativo del suelo. Se usa máx(medias, 0.6·altas), no el total: la nubosidad baja de un modelo suele ser la propia niebla y no debe penalizar. Solo cuenta como estratos (y penaliza) si hay más de un 70 % de nubes bajas y la visibilidad, prevista o estimada, supera 5 km: nubes bajas sobre una superficie sin saturar. Si la fuente no desglosa capas, como los ensembles, solo se conoce la nubosidad total: por debajo del 25 % puntúa 20 y en otro caso 8, valor neutro, porque una cobertura total alta puede ser la propia niebla.
Visibilidad<1 km: 20 · <3 km: 10 · <6 km: 4; al 60 % si es estimadaDiagnóstico directo del modelo cuando lo publica (ICON‑EU, IFS 9 km, UKMO, GFS, HARMONIE). AROME, ARPEGE y los ensembles ICON no lo publican: se estima entonces con el diagnóstico FSL, V = 6000·(T − Td)/HR^1.75 en millas, se marca con ~ y puntúa al 60 % (12, 6 y 2.4 puntos), porque no confirma nada que ΔT y HR no digan ya. Hasta la versión anterior esas fuentes recibían 5 puntos fijos, lo que las dejaba 15 puntos por debajo en las noches de niebla y les daba 5 de más en las noches secas.
Persistencia+2 por hora nocturna previa consecutiva con ΔT < 1.5 °C y viento < 12 km/h, máximo +8La niebla necesita horas de enfriamiento: una saturación mantenida desde medianoche vale más que un instante a las 06:00.
HR ≥ 97 %+10Redundante con ΔT pero robusto a redondeos.
Lluvia > 0.5 mm−15Precipitación activa suele ir con nubes y viento.
Advección (costero)hasta +30 si Td − SST > 0 y viento 8–30 km/hAire húmedo sobre mar más frío se enfría hasta saturar. No necesita calma ni cielo despejado.
Día× 0.65; × 0.85 en las dos horas siguientes al amanecerLa radiación solar disipa la capa, pero tarda; justo después del amanecer la niebla suele seguir y es el mejor momento fotográfico.

5. Pestaña 2: fusión bayesiana

Selección de modelos

Cada casilla es un modelo. Se descargan en paralelo con un límite de 12 s cada uno; los que no llegan a tiempo se descartan y se indica “timeout”. Tras cada cálculo aparece el tiempo de respuesta de cada modelo. Si alguno es sistemáticamente lento en tu conexión, desmárcalo: la selección se recuerda. Por defecto están activos AROME/ARPEGE, HARMONIE DMI, ICON, ECMWF IFS 9 km, UKMO, GFS y el ensemble ICON EPS.

Fuentes en este punto

Muchos identificadores de Open‑Meteo son mezclas de modelos, y cuál de ellos responde depende de las coordenadas. La tabla “Fuentes en este punto” resuelve esa mezcla con las definiciones de rejilla de Open‑Meteo y con lo que devuelve cada petición. Para 43.36° N, 8.41° O (A Coruña) el resultado es este:

FuenteModelo efectivoMallaObservaciones
AROME/ARPEGEAROME HD1.3 kmHorizonte de 48 h. No publica visibilidad. El borde oeste del dominio nativo queda a unos 100 km (a unos 20 km de Fisterra), lo que deja su escala efectiva en 6.3 km. Es una estimación con ±50 km de incertidumbre.
HARMONIE DMIHARMONIE‑AROME (DINI)2 kmHorizonte de 60 h. Publica visibilidad y nubes por capas. El borde sur del dominio queda a 230 km y el oeste a unos 1500 km.
HARMONIE KNMIHARMONIE‑AROME Europa5.5 kmDesmarcada por defecto. El borde sur queda a 218 km. Su dominio coincide con el de DMI (dominio común UWC‑West): con toda probabilidad es la misma integración remuestreada a 5.5 km, así que no conviene marcar las dos.
ICONICON‑EU7 kmICON‑D2, de 2 km, empieza en 3.94° O y no llega a Galicia.
ECMWF IFS 9 kmIFS HRES9 kmPaso horario, punto de rocío y visibilidad nativos. Sustituye a IFS 0.25°, que a esta latitud son celdas de unos 28 × 20 km con paso de 3 h y sin visibilidad.
UKMOUKMO global10 kmEl modelo UKV de 2 km solo cubre las islas británicas y su entorno.
GFSGFS 0.11°13 kmPublica visibilidad y nubes por capas.
GEMGEM global15 kmDesmarcada por defecto. No publica visibilidad.
ICON EPSICON‑EU‑EPS13 km40 miembros. Solo nubosidad total y sin visibilidad.

Celda a km es la distancia entre tu punto y el centro de la celda que devuelve la API: en costa Open‑Meteo busca una celda de tierra, y en una malla gruesa esa celda puede quedar varios kilómetros tierra adentro. Borde km es la distancia al límite del dominio en los modelos de área limitada: cerca del borde la solución hereda en buena parte la del modelo global que los alimenta, porque el aire que entra no ha recorrido dentro del dominio la distancia necesaria para desarrollar estructura de escala fina. Galicia está en la zona exterior tanto de AROME como de HARMONIE, pero no por igual: con flujo atlántico del oeste o del noroeste, el habitual, el borde de AROME está a barlovento y a menos de 100 km, mientras que el de HARMONIE queda al sur. Δ km es la escala efectiva que resume todo lo anterior: el paso de malla, salvo a menos de 200 km del borde de un dominio limitado, donde se interpola linealmente hacia la escala del modelo que lo alimenta (ARPEGE, 11 km, para AROME; IFS, 9 km, para HARMONIE; ICON‑EU, 7 km, para ICON‑D2); y nunca menor que la distancia a la celda devuelta. Prior es el peso de partida de cada fuente, proporcional a Δ^(−0.5), que se explica en el apartado del registro. Los bordes de DMI, KNMI, ICON y UKV salen de las definiciones de rejilla de Open‑Meteo. El de AROME no: Météo‑France solo publica un recorte en latitud y longitud, y el dominio nativo está reconstruido a partir de él (1440 × 1536 puntos de 1.3 km centrados en 46.45° N, 2° E). Sus bordes norte y sur quedan bien fijados; el este y el oeste dependen del meridiano central y tienen unos ±50 km de incertidumbre. En cualquier punto de ese intervalo AROME queda en A Coruña por detrás de HARMONIE. Fuera de Europa el catálogo es aproximado.

DMI y KNMI se piden como modelo regional puro. La mezcla “seamless” de esos identificadores devuelve IFS fuera de su dominio, y en ese caso ECMWF contaría dos veces en la fusión; con el modelo puro la casilla indica “sin cobertura” y la fuente no entra. La fuente “ECMWF 0.25°” se conserva desmarcada solo para que el registro antiguo siga siendo legible.

El WRF de 1 km de MeteoGalicia no figura entre las fuentes. Su servidor de datos solo autoriza lecturas desde sus propias páginas, y una web estática como esta no puede consultarlo desde el navegador. La fuente de malla más fina en Galicia es HARMONIE‑AROME de DMI, de 2 km.

Cómo se combina: consenso y contracción

Primero se forma un consenso de los modelos como media ponderada en log‑odds: logit p̄ = Σ w_m · logit p_m / Σ w_m. Esta media está garantizadamente dentro de la envolvente: nunca por encima del modelo más alto ni por debajo del más bajo. Después el posterior se obtiene contrayendo ese consenso hacia la climatología local: logit P = logit π + γ · (logit p̄ − logit π). El resultado queda siempre entre tu tasa local π y el consenso p̄.

Parámetro γ

Cuánto te fías de los modelos frente a la climatología, entre 0.1 y 1 (defecto 0.7). Con γ = 1 el posterior es el consenso puro; con valores bajos se pega a la frecuencia histórica de tu registro. Mantener γ por debajo de 1 es razonable mientras la conversión de índice a probabilidad no esté contrastada con tus observaciones; la recalibración automática (ver más abajo) va supliendo este ajuste a mano a medida que acumulas noches.

Fuentes ensemble (EPS/ENS)

Además de los modelos deterministas hay fuentes de conjunto: el mismo modelo ejecutado 30 a 50 veces con perturbaciones. Para ellas la probabilidad no sale de la logística, sino de los propios miembros (media de las probabilidades de los miembros), lo que refleja la incertidumbre real de la atmósfera esa noche. ICON EPS viene activada por defecto; GFS ENS y ECMWF ENS son más pesadas y están desmarcadas.

Recalibración automática

Con 12 o más noches registradas, la aplicación ajusta una corrección de Platt q = σ(a·logit P + b) sobre los pares (posterior congelado, resultado observado), con prior a ≈ 1, b ≈ 0 para que pocas noches no la distorsionen. Corrige el sesgo sistemático del posterior; cuando está activa, la línea de estado muestra "recalibrado (n, a, b)".

Tarjetas

Posterior para las próximas 6 horas y para la ventana del amanecer, con el rango mínimo a máximo entre modelos y la probabilidad individual de cada uno. La tercera tarjeta da la desviación típica entre modelos en el amanecer: acuerdo alto (< 10 pp), moderado o desacuerdo. Un posterior del 40 % con acuerdo alto es una previsión más útil que un 55 % con desacuerdo. La tarjeta del amanecer trae además su propia ventana fotográfica, medida sobre el posterior con umbral del 25 % (“niebla plena” a partir del 50 %), y, para las fuentes de conjunto, la banda p10–p90 y cuántos miembros dan niebla.

Gráfica

Una línea fina por modelo, banda gris con el rango y línea gruesa negra con el posterior. Eje vertical en %.

Tablas

“Estado del amanecer por modelo” muestra, para cada modelo, su probabilidad máxima en la ventana y el estado físico previsto en esa hora. “Pesos bayesianos y prior” muestra w_m, el Brier, el porcentaje de aciertos (con el número de noches congeladas entre paréntesis), la log‑verosimilitud acumulada y el prior Beta actual. La log‑verosimilitud es lo que fija el peso; Brier y aciertos son la misma información en unidades legibles.

6. Entrenamiento: registro de observaciones

El aprendizaje consiste en comparar lo que cada modelo predijo con lo que tú viste. Para que la comparación sea honesta, la predicción tiene que quedar fijada antes de conocer el resultado. La herramienta lo hace sola:

Congelación automática. Cada vez que pulsas “Calcular” en la pestaña 2, las probabilidades de cada modelo para la ventana del próximo amanecer se guardan asociadas a la fecha de esa noche (la noche se identifica por la fecha de la tarde, es decir, el día anterior al amanecer). Si calculas varias veces, se conserva la última, que es la previsión más reciente antes del amanecer. La línea de estado indica “Previsión congelada para la noche del …”.

Por la mañana. El campo “Noche del” aparece ya con la fecha de la noche recién terminada (antes de las 14:00 propone ayer; después, hoy). Elige lo observado (Niebla si la visibilidad fue inferior a 1 km; Bruma o neblina si hubo reducción notable pero superior a 1 km; Nada) y pulsa “Guardar observación”. La observación se empareja con la previsión que se congeló la víspera para esa fecha. No importa que a esa hora ya exista una previsión nueva para mañana: no se usa.

Etiqueta propuesta con el METAR. Al elegir la noche, la página consulta los partes METAR de la estación escrita en “Estación METAR (OACI)”, por defecto LECO (aeropuerto de A Coruña, en Alvedro), en la ventana del amanecer: de 2.5 h antes a 1.5 h después del orto. Propone Niebla si algún parte da FG o visibilidad inferior a 1000 m; Bruma si da BR, niebla en bancos, parcial, baja o en las inmediaciones (BCFG, PRFG, MIFG, VCFG), o menos de 5000 m; y Nada en otro caso. Una visibilidad reducida que el parte atribuye a otro fenómeno, como lluvia o calima, no cuenta. Debajo del formulario se lee la evidencia: número de partes, visibilidad mínima, hora, fenómenos y el parte en bruto. La propuesta solo preselecciona el desplegable y nunca se guarda sola. La estación no es tu emplazamiento (Alvedro queda a unos 7 km de la costa y a 100 m de altitud), así que corrige la etiqueta si viste otra cosa. Al guardar, la fila anota la evidencia en la columna METAR y marca con ≠ las noches en que tu etiqueta difiere de la propuesta. Los partes proceden del archivo ASOS del Iowa Environmental Mesonet.

Si esa noche no calculaste. No hay previsión congelada para esa fecha. La observación se guarda igualmente (aparece como “pendiente” en la columna posterior) y actualiza el prior climatológico, que solo necesita saber si hubo niebla o no; pero no modifica los pesos de los modelos, porque no hay predicción con la que compararla. Si más tarde ese mismo día calculas antes de que el amanecer cambie de fecha, la fila se completa automáticamente.

Rutina mínima: por la tarde o noche, abrir la página y pulsar Calcular en la pestaña 2 (dos segundos). Por la mañana, elegir lo observado y Guardar. Nada más.

Con cada observación ocurren dos cosas. El prior Beta se actualiza (a += y, b += 1 − y, con y = 1, 0.5 o 0), de modo que la tasa base deja de ser el 12 % genérico y pasa a ser tu frecuencia local. Y la log‑verosimilitud de cada modelo acumula log P_m(y): un modelo que daba 80 % y hubo niebla suma log 0.8; uno que daba 10 % suma log 0.1. Los pesos w_m se recalculan como Δ_m^(−0.5) · exp(0.7 · log‑verosimilitud), normalizado.

El factor Δ_m^(−0.5) es un prior estructural. Δ_m es la escala efectiva de la fuente en tu punto, la columna Δ de la tabla de fuentes. Sin observaciones los pesos son ese prior: en A Coruña HARMONIE DMI, con Δ de 2 km, pesa 2.1 veces lo que IFS, de 9 km, y AROME, con Δ de 6.3 km por la cercanía de su borde, 1.2 veces. Con observaciones la verosimilitud lo corrige: una diferencia de 1.6 en log‑verosimilitud ya compensa un factor 3 de prior. Si una noche una fuente no tiene previsión congelada, porque se añadió después, falló o estaba desmarcada, se le imputa la log‑verosimilitud media de las demás en esa noche. Sin esa imputación una fuente con menos noches acumulaba menos penalización y pesaba más solo por tener menos historial.

Debajo de la tabla del registro, “Lecciones de tu registro” resume tus umbrales locales a partir de las noches con rasgos congelados: con qué ΔT y qué viento previstos ha llegado a haber niebla o bruma en tu sitio, con cuánta nubosidad media y con qué visibilidad prevista, y cuál fue la noche sin nada con menor ΔT. Es la parte del registro que más deprisa cambia lo que haces en el campo.

Orientación sobre cantidad: con 10 noches los pesos ya empiezan a separarse; con 40 o 50 tienen significado; con más de 100 merece la pena pasar a una regresión logística sobre las variables crudas.

7. Pestaña 3: calibración con METAR

El registro de observaciones aprende despacio: una noche por día. La pestaña 3 hace de una vez la misma comparación con el pasado. Descarga los partes METAR de una estación durante las últimas 60 a 180 noches y, para cada fuente, la previsión que daba la víspera en las coordenadas de esa estación. De ahí obtiene tres cosas por fuente, que la fusión de la pestaña 2 usa como punto de partida.

ResultadoCómo se mideCómo se usa en la fusión
Sesgo de T − TdMedia de (T − Td previsto) − (T − Td del METAR) en las horas de la ventana del amanecer. Positivo: la fuente seca de más.Se corrige el punto de rocío antes de calcular el índice: Td′ = mín(T, Td + sesgo). La tabla del amanecer muestra el ΔT de la fuente y, tras una flecha, el corregido.
Curva de probabilidadRegresión logística de la etiqueta (1, 0.5, 0) sobre el índice máximo de la ventana: logit p = a·(s − 70)/11 + b, con un prior gaussiano centrado en la curva común (a = 1, b = 0).Sustituye a la curva común σ((s − 70)/11) para esa fuente y se aplica al índice reducido. La tabla da el umbral (índice con p = 50 %) y la escala κ.
Ventaja medidaDiferencia media por noche, Δℓ, entre la log‑verosimilitud de la fuente y la media de las fuentes evaluadas, con validación cruzada en cinco bloques.Se suma a la log‑verosimilitud como diez noches propias: el peso inicial se multiplica por exp(0.7 · 10 · Δℓ).

Además, la frecuencia media de niebla y bruma en la estación, ȳ, sustituye al 12 % inicial del prior climatológico, con el mismo peso de diez noches. Tus observaciones siguen actualizando el prior y los pesos a partir de ese punto.

Uso

Escribe el indicativo OACI de la estación (LECO por defecto), elige el periodo y pulsa “Calibrar”. Tarda unos segundos: Open‑Meteo entrega cada fuente en una petición. Al terminar, la calibración queda guardada en el navegador y aplicada; la casilla “Aplicar en la fusión” la desactiva sin borrarla y “Borrar calibración” la elimina. La línea de estado de la pestaña 2 indica “calibración LECO en N fuentes” cuando está en uso, y la tabla de fuentes anota el sesgo, el umbral y la escala de cada una.

De dónde sale la previsión de la víspera

Para las fuentes de Open‑Meteo, del archivo de pasadas anteriores (variables con sufijo _previous_day1): el valor que daba para cada hora la última pasada emitida con al menos 24 h de antelación, es decir, entre 24 y unas 30 h. Las fuentes se comparan así a igual antelación. La previsión que congelas por la tarde lleva menos, de 6 a 18 h, de modo que la destreza medida es una cota prudente. Los ensembles no se evalúan porque el archivo no conserva sus miembros.

El índice reducido

El archivo guarda temperatura, humedad, viento, nubosidad total y precipitación, pero no la visibilidad ni las capas de nubes. La retrospectiva calcula por eso un índice reducido, s_r: visibilidad estimada, nubes sin desglose y sin advección. La curva se ajusta y se valida sobre s_r, y en la fusión la probabilidad de una fuente calibrada sale de ese mismo s_r: logit p = a·(s_r − 70)/11 + b. La visibilidad que publica el modelo, las capas de nubes y la advección siguen a la vista en la pestaña 1 y en las señales de cada fuente, pero no entran en la probabilidad de una fuente calibrada, porque no hay archivo con el que medir cuánto valen. Los ensembles y las fuentes sin calibrar conservan el índice completo y la curva común.

Límites

La verdad es la estación y no tu emplazamiento. El sesgo y las curvas describen cómo se comporta cada modelo en ese punto, y trasladarlos al tuyo es una hipótesis tanto más débil cuanto más lejos o más distinto sea el sitio; la pestaña avisa cuando el punto queda a más de 30 km. Los METAR dan T y Td en grados enteros, lo que añade ruido pero no sesgo: con unas 90 noches el error típico del sesgo medio ronda 0.1 °C. Una fuente con menos de 20 noches utilizables queda sin calibrar y conserva la curva común. Si la destreza medida es baja, las curvas salen planas, con un techo de probabilidad bajo, y el posterior de la pestaña 2 queda comprimido: es el resultado de la medida, no un fallo. Conviene repetir la calibración cada pocas semanas, porque el sesgo de los modelos cambia con la estación del año y con sus actualizaciones.

La pestaña incluye un registro de peticiones: qué servidor respondió, con cuántos datos y en cuánto tiempo. Si una fuente aparece “sin previsiones archivadas”, ahí está el motivo.

8. Datos y privacidad: dónde se guarda el registro

Todo el registro (observaciones, probabilidades, selección de modelos, idioma) se guarda con localStorage en el navegador desde el que se usa la página. Nada se envía a ningún servidor; GitHub solo sirve el HTML estático y no recibe ni conserva tus datos. Las consultas de datos llevan solo las coordenadas (Open‑Meteo) o el indicativo de la estación (Iowa Environmental Mesonet). Implicaciones concretas:

SituaciónQué pasa con el registro
Misma URL, mismo navegador, mismo dispositivoPersiste indefinidamente, aunque cierres el navegador o hagas push de una nueva versión del HTML.
Otro navegador u otro dispositivoNo está: localStorage es por navegador y por origen. Usa Exportar e Importar JSON.
Abrir el archivo en local (file://) y también desde Pages (https://)Son orígenes distintos; cada uno tiene su propio registro. Exporta de uno e importa en el otro.
Borrar datos de navegación o “datos de sitios”Se pierde. Exporta el JSON de vez en cuando y guárdalo en el propio repositorio, por ejemplo.
Modo incógnitoSe borra al cerrar la ventana.
Calibración de la pestaña 3 y estación METARSe guardan aparte (niebla_cal, niebla_metar) y no viajan en el JSON exportado: en otro navegador basta con pulsar “Calibrar” de nuevo.
Otras páginas en el mismo origen (usuario.github.io)Comparten el espacio de localStorage; las claves de datos usadas aquí empiezan por niebla_ (niebla_bayes, niebla_models, niebla_lang, niebla_metar, niebla_cal) para no colisionar. La única excepción es pn-lang, la preferencia de idioma compartida a propósito con las demás páginas del sitio.
Recomendación: tras cada sesión de anotaciones, pulsa “Exportar JSON” y sube el archivo al repositorio. Así el historial queda versionado y reimportable en cualquier dispositivo.

9. Interpretación y buenas prácticas

Señal fuerte de niebla de radiación: ΔT previsto por debajo de 1 °C a partir de medianoche, viento entre 2 y 8 km/h, nubes por debajo del 25 %, presión alta y en ascenso, y visibilidad modelada menor de 3 km (esta última, la variable menos fiable del lote: apoya, no arbitra). Si además varios modelos coinciden (desacuerdo < 10 pp), la probabilidad es alta.

Señal de niebla de advección (costa): punto de rocío del aire uno o dos grados por encima de la SST, viento moderado del mar, humedad alta. Puede darse con cielo nublado y viento de 15 o 20 km/h; en esos casos la pestaña 1 en modo interior la infravalora.

Cuándo desconfiar: valles estrechos, zonas con suelo muy húmedo tras lluvia reciente o embalses y ríos, donde la niebla local se forma con ΔT previsto de 2 o 3 °C. Los modelos no resuelven esa escala; tu registro sí la captura, de ahí la importancia del prior local.

Calibración: la pestaña 2 dibuja ahora este diagrama de fiabilidad por ti, en la sección «Calibración» junto a la tabla de pesos: agrupa las filas del registro por posterior congelado (0–25 %, 25–50 %, 50–75 %, 75–100 %) y pinta cada grupo como un punto (posterior medio, frecuencia real de niebla) sobre la diagonal de calibración perfecta, con área proporcional al número de noches. La lectura sigue siendo la misma que harías a mano: si las frecuencias reales son sistemáticamente más extremas que el posterior, sube γ; si son menos extremas, bájalo; si los puntos se pegan a la diagonal, deja γ como está. La herramienta orienta a partir de unas 10 noches; la lectura es fiable a partir de 30.

10. Ajustes avanzados (editar el HTML)

Todas las constantes están al principio de la sección de la pestaña 2 en niebla.html:

const PI0=0.12, A0=1.2, B0=8.8  // prior Beta inicial (media 0.12)
const LAMBDA=0.7                // tempering de los pesos
const TH=70, KAP=11             // logística p = σ((s − TH)/KAP)
const RECAL_N=12, RECAL_TAU=6   // noches mínimas y anchura del prior de Platt
const TIMEOUT=12000             // ms por modelo (los ensembles usan +8 s)
const RHO=0.5                   // exponente del prior estructural Δ^(−ρ); 0 da pesos iniciales iguales
const IDX_V=2                   // versión del índice anotada en cada previsión congelada
const VIS_EST=0.6               // crédito de la visibilidad estimada (junto a score())
const EDGE_KM=200               // distancia al borde por debajo de la cual Δ se degrada (junto al catálogo SRC)
const TAIL_H=54                 // horas desde ahora a partir de las que DMI y KNMI se marcan como IFS en la pestaña 1
const CAL_NEQ=10, CAL_MIN=20    // noches propias a las que equivale la ventaja medida; noches mínimas para calibrar una fuente
const CAL_VA=0.5, CAL_VB=4      // varianzas del prior de la curva por fuente (pendiente a y desplazamiento b)

En el archivo las cinco primeras van en una sola línea const; aquí se abren para poder comentarlas.

El parámetro γ se cambia desde la propia interfaz. Los pesos w_m y el consenso se calculan en run2(); la contracción hacia la climatología es la línea logit P = logit π + γ·(logit p̄ − logit π).

Los pesos del índice están en la función score(), común a ambas pestañas. Para añadir un modelo, amplía el array MODELS con el identificador de Open‑Meteo (por ejemplo jma_seamless) y, si quieres que la tabla de fuentes y el prior conozcan su malla, añade su entrada al catálogo SRC; sin ella se le suponen 10 km. Las coordenadas por defecto están en los atributos value de los campos de latitud y longitud, y de latitud B y longitud B para el sitio de comparación. La ventana fotográfica se recorta en winRange() y sus umbrales viajan en las llamadas a winTxt() (50 y 75 en la pestaña 1; 0.25 y 0.5 en la pestaña 2). La tabla de próximas mañanas está en morn(), el desglose en brk1() y la calculadora de contraste en renderK().

11. Problemas frecuentes

SíntomaCausa y solución
“Ningún modelo respondió a tiempo”Open‑Meteo saturado o conexión lenta. Reintenta, reduce la selección o sube TIMEOUT.
Un modelo siempre en “timeout”Desmárcalo; la fusión funciona con los que respondan.
“sin SST, advección desactivada”El punto está tierra adentro para la API marina o la petición falló. En interior es lo esperado; en costa, prueba a mover el punto unos cientos de metros hacia el mar.
“Vis km” con ~ delanteEsa fuente no publica visibilidad (AROME, ARPEGE, ensembles ICON) y el valor es la estimación FSL a partir de T − Td y HR. Puntúa al 60 %.
Una casilla indica “sin cobertura”El dominio de ese modelo regional no cubre las coordenadas: DMI y KNMI terminan hacia 41.5° N en la longitud de Galicia. La fuente no se pide y no cuenta como fallo.
“METAR de LECO no disponible”El archivo del Iowa Environmental Mesonet no responde. Elige lo observado a mano: el registro funciona igual, solo que la fila queda sin evidencia.
La propuesta del METAR no coincide con lo que visteOcurrirá a veces: la estación está en otro sitio. Corrige el desplegable antes de guardar; la fila queda marcada con ≠.
Una fuente “sin previsiones archivadas” o con “menos de 20 noches con datos” en la pestaña 3El archivo de pasadas anteriores no tiene esa fuente para la estación o el periodo. Queda sin calibrar y usa la curva común. El registro de peticiones dice qué respondió el servidor.
“No se pudo calibrar”Falta el METAR de la estación (indicativo sin partes o servidor caído), hay menos de 20 noches evaluables o ninguna fuente devolvió previsiones archivadas. La calibración anterior, si la había, se conserva.
El registro desaparecióCambio de navegador, de dispositivo, de origen (file → https) o borrado de datos. Importa el JSON exportado.
“Usar mi posición” no hace nadaPermiso denegado o página servida sin HTTPS. Escribe las coordenadas a mano.

User manual

Fog for photography: physical index and multi‑model Bayesian fusion.

1. What it is and what it is not

A self‑contained HTML page that queries the public Open‑Meteo API and estimates the risk of fog or mist over the next hours and in the next sunrise window, meant to help decide whether a photo outing is worth it. It is not a boundary‑layer model and does not replace official warnings: it is a favourability tool, with a second Bayesian layer that learns from your local observations.

Three tabs. The first, “Fog index”, uses a single numerical model and shows the hourly index with all the physics visible. The second, “Bayesian fusion”, downloads several models in parallel, turns each one into a probability and combines them into a posterior, weighting each model by how well it has scored in your log. The third, “Calibration”, compares the history of a METAR station with what each source forecast the day before and gives the fusion a measured starting point: bias, probability curve and weight for each source.

2. Setup

Nothing to install. Three ways to use it:

Local. Save niebla.html and manual-niebla.html in a folder and open niebla.html in the browser. Double click works (file:// origin).

GitHub Pages. Push both files to a repository, enable Pages under Settings → Pages (main branch, root folder) and visit https://user.github.io/repo/. The file is named niebla.html so it is the entry page.

Mobile. Open the Pages URL on the phone and add it to the home screen. “Use my location” asks for geolocation permission; it works on Pages because the site is served over HTTPS.

Requirements: an Internet connection (the forecast is downloaded on each compute) and a modern browser. Two fonts are loaded from Google Fonts; without network the system fonts are used.

3. Common controls

ControlFunction
Latitude, LongitudePoint for which the forecast is requested. Type them (decimal, west negative) or fill them with “Use my location”.
SettingCoastal enables the advection fog term and downloads sea surface temperature (SST). Inland disables it and saves one request.
Azimuth towards the seaShown only in Coastal mode. Bearing in degrees from the point towards open sea. It does not enter the index: it lets the tool label each hour as “onshore” or “offshore” wind, counting as onshore any direction within 60° of the azimuth. Leave it empty if you do not know it.
ES / ENSwitches the interface and manual language. The choice is remembered.
ManualOpens this document.

4. Tab 1: fog index

Model selector

Automatic, the default, picks for the coordinates entered the source with the smallest effective scale: a fine mesh and a point far from the domain edge (the definition is under “Sources at this point”, in tab 2). In A Coruña that is DMI HARMONIE‑AROME at 2 km. If the chosen source does not answer, automatic mode moves to the next one and the status line says so. AROME HD has a 1.3 km mesh, but its western edge lies about 100 km away, and at that distance the solution is still largely that of the global model feeding it. DMI reaches 60 h and the server extends it with IFS at 9 km; AROME reaches 48 h and the page completes it. The status line shows the effective model, its grid spacing, the distance between the point and the cell the API returns, the distance to the domain edge for limited‑area models and the hour from which the fill takes over. The other options force a specific source and are useful for comparison.

“Open‑Meteo selection (best match)” is the blend the server decides. It only uses AROME between 6.18° W and 8.35° E, and HARMONIE north of 44° N, so in Galicia it amounts to ICON‑EU at 7 km: it is not the finest model available for the point.

Cards

Next 6 hours: maximum index in that interval and when. Sunrise: maximum in the window from 2.5 h before to 1.5 h after sunrise, when radiation fog is fully developed and when you want to be on site. Minimum dew point depression: the lowest forecast ΔT = T − Td tonight, with T, Td, wind, clouds, SST and pressure at that hour. It is the most direct physical datum: if it does not drop below 1 °C, radiation fog is unlikely.

Photographic window

Inside the sunrise card, the “Photographic window” line answers the practical question: from what time to what time is there anything to photograph. It finds the index peak between sunrise −4 h and +6 h and clips the continuous stretch that stays above 50 points, interpolating between hours at both edges, so it returns an interval with minutes and a duration. If the peak reaches 75 the label is “full fog”; between 50 and 74, “mist only”; if no hour clears 50, there is no fog to chase. It also warns when the stretch lasts under an hour and when the peak falls more than half an hour after sunrise. The same card gives wind direction (and onshore or offshore, once you set the azimuth), links to the natural-light page for the golden hour, and reminds you that the stretch after sunrise rests on the heuristic 0.85 factor, the least firm part of the calculation.

Comparing two sites (A or B)

The “Compare with another site” button opens a second set of latitude, longitude and setting, and downloads site B with the same model and the same pipeline as A. The “A or B” section puts both next-sunrise cards side by side, draws both index curves and gives a verdict: go to A, go to B, or a practical tie when the difference is under 8 points, in which case access, composition and departure time decide. The comparison lives only in this tab: the Bayesian fusion and the observation log still belong to a single site, the coordinates at the top, because mixing two sites would spoil the learning.

Next mornings

One row per sunrise, up to seven days, with the peak index inside the −2.5 h/+1.5 h window, the verdict, the minimum dew point depression of that night, and the wind, mid and high cloud and visibility of the peak hour. The last column is confidence by lead time, and adds “IFS HRES 9 km” on mornings no longer computed by the fine model but by the fill (with HARMONIE the switch is made by the server at about 54 h and the mark is approximate): the first two sunrises are the actual forecast, the third and fourth are indicative and from the fifth on it is a trend, not a forecast. Below it, one sentence names the best morning of the week, or says none clears 50. It is the only view that reaches seven days; the strip, the charts and the hourly table still cover 48 hours.

Hourly strip

One bar per hour, 48 hours. Height = index. Grey background = night. Red hour = sunrise. Amber = mist possible (50 to 74), reddish = fog likely (≥ 75). Hover to see the active signals. The hours falling inside the photographic window are outlined in amber.

What the index is made of

One stacked bar per hour with the points each term contributes, in the order they are computed; rain is drawn downwards because it subtracts. The black tick marks the final index, with the daytime factor already applied and saturated at 100, and a grey mark on top flags the hours whose raw sum exceeded 100. It shows which term limits each hour: if the bar falls short because of the cloud segment, the brake is mid and high cloud, not humidity; if the ΔT segment is tall and the total still low, the brake is the wind. The amber outline marks the photographic window.

Convergence chart

T and Td in °C on the left axis; wind in km/h on the right. Pink bands mark hours with ΔT < 2 °C (stronger below 1 °C). The dashed red line is sunrise. The picture you are looking for: T and Td converging overnight, wind below 10 km/h and a cloud‑free grey background. A purple bar along the bottom marks the hours with visibility under 2 km, more saturated below 1 km and fainter when visibility is estimated because the model does not publish it.

What you will see: contrast, distance and focal length

A contrast-by-visibility calculator, to know which framing survives the fog you expect. By the Koschmieder law a dark object against the sky keeps a contrast C/C₀ = exp(−3.912·d/V), so 20 % contrast sits at 0.41·V and 5 % at 0.77·V. The two sliders sweep visibility from 0.2 to 10 km and subject distance from 20 m to 3 km, and the selector covers 28 to 135 mm. The cards give the residual contrast with its reading (volume and texture, flat, barely hinted, gone) and the horizontal field, 36·d/f on 24×36: at 200 m a 43 mm covers 167 m and a 135 mm covers 53 m. Below them, the full curve and a table at 50, 150, 500 and 1000 m. Visibility starts at whatever the model gives for the sunrise peak, or at a scenario assumed from the index when that model publishes none; “Back to the forecast” undoes any manual tweak.

Hourly table

All variables used plus wind direction (labelled onshore or offshore once you set the azimuth), low clouds, SST and pressure. “Vis km” is the visibility forecast by the model itself: it is its most direct fog diagnostic, but also the least reliable variable in Open‑Meteo, so read it as a scenario rather than a measurement. Below 3 km it backs the other signals; on its own it does not decide, which is why it is worth at most 20 points against the 40 of ΔT.

Index formula

TermPointsRationale
ΔT = T − Td40 if ≤ 0.5 °C; linear to 0 at 4 °CSaturation. Necessary condition.
10 m wind<2: 14 · 2–8: 20 · 8–15: 8 · 15–20: 3 · >20: 0Radiation fog: some turbulent mixing deepens it; dead calm gives dew; strong wind prevents it.
Cloud above the layer (mid and high)<25 %: 20 · 25–60 %: 8 · >60 %: 0 (halved by day)Clear sky above = radiative cooling of the ground. Uses max(mid, 0.6·high), not the total: a model’s low cloud is often the fog itself and must not penalise. It counts as stratus (and penalises) only if low cloud exceeds 70 % and visibility, forecast or estimated, exceeds 5 km: low cloud over an unsaturated surface. If the source does not split cloud by layer, as with ensembles, only total cover is known: below 25 % it scores 20 and otherwise 8, a neutral value, because high total cover may be the fog itself.
Visibility<1 km: 20 · <3 km: 10 · <6 km: 4; at 60 % if estimatedDirect model diagnostic when published (ICON‑EU, IFS 9 km, UKMO, GFS, HARMONIE). AROME, ARPEGE and the ICON ensembles do not publish it: it is then estimated with the FSL diagnostic, V = 6000·(T − Td)/RH^1.75 in miles, flagged with ~ and scored at 60 % (12, 6 and 2.4 points), because it confirms nothing that ΔT and RH do not already say. Up to the previous version those sources received a fixed 5 points, which left them 15 points short on foggy nights and gave them 5 too many on dry ones.
Persistence+2 per preceding consecutive night hour with ΔT < 1.5 °C and wind < 12 km/h, up to +8Fog needs hours of cooling: sustained saturation since midnight is worth more than a single hour at 06:00.
RH ≥ 97 %+10Redundant with ΔT but robust to rounding.
Rain > 0.5 mm−15Active precipitation usually comes with cloud and wind.
Advection (coastal)up to +30 if Td − SST > 0 and wind 8–30 km/hMoist air over colder sea cools to saturation. Needs neither calm nor clear sky.
Daytime× 0.65; × 0.85 in the two hours after sunriseSolar radiation dissipates the layer, but slowly; right after sunrise fog usually lingers and that is the best photographic moment.

5. Tab 2: Bayesian fusion

Model selection

Each checkbox is a model. They are downloaded in parallel with a 12 s limit each; those that do not answer in time are dropped and marked “timeout”. After each compute the response time of each model is shown. If one is consistently slow on your connection, untick it; the selection is remembered. Default: AROME/ARPEGE, HARMONIE DMI, ICON, ECMWF IFS 9 km, UKMO, GFS and the ICON EPS ensemble.

Sources at this point

Many Open‑Meteo identifiers are blends of models, and which one answers depends on the coordinates. The “Sources at this point” table resolves that blend from Open‑Meteo grid definitions and from what each request returns. For 43.36° N, 8.41° W (A Coruña) the result is:

SourceEffective modelMeshNotes
AROME/ARPEGEAROME HD1.3 km48 h horizon. Publishes no visibility. The western edge of the native domain is about 100 km away (about 20 km from Fisterra), which leaves its effective scale at 6.3 km. This is an estimate with ±50 km of uncertainty.
HARMONIE DMIHARMONIE‑AROME (DINI)2 km60 h horizon. Publishes visibility and cloud by layer. The southern edge of the domain is 230 km away and the western one about 1500 km.
HARMONIE KNMIHARMONIE‑AROME Europe5.5 kmUnticked by default. The southern edge is 218 km away. Its domain coincides with the DMI one (common UWC‑West domain): in all likelihood it is the same run resampled to 5.5 km, so ticking both is not advisable.
ICONICON‑EU7 kmICON‑D2, at 2 km, starts at 3.94° W and does not reach Galicia.
ECMWF IFS 9 kmIFS HRES9 kmHourly steps, native dew point and visibility. Replaces IFS 0.25°, which at this latitude means cells of about 28 × 20 km, 3 h steps and no visibility.
UKMOUKMO global10 kmThe 2 km UKV model only covers the British Isles and their surroundings.
GFSGFS 0.11°13 kmPublishes visibility and cloud by layer.
GEMGEM global15 kmUnticked by default. Publishes no visibility.
ICON EPSICON‑EU‑EPS13 km40 members. Total cloud only and no visibility.

Cell at km is the distance between your point and the centre of the cell the API returns: on the coast Open‑Meteo looks for a land cell, and on a coarse mesh that cell may sit several kilometres inland. Edge km is the distance to the domain limit for limited‑area models: near the edge the solution largely inherits that of the global model feeding them, because incoming air has not travelled far enough inside the domain to develop fine‑scale structure. Galicia lies in the outer zone of both AROME and HARMONIE, but not equally: in the usual westerly or north‑westerly Atlantic flow the AROME edge is upwind and less than 100 km away, whereas the HARMONIE edge lies to the south. Δ km is the effective scale that sums this up: the grid spacing, except within 200 km of the edge of a limited domain, where it is interpolated linearly towards the scale of the model feeding it (ARPEGE, 11 km, for AROME; IFS, 9 km, for HARMONIE; ICON‑EU, 7 km, for ICON‑D2); and never smaller than the distance to the returned cell. Prior is the starting weight of each source, proportional to Δ^(−0.5), explained in the log section. The DMI, KNMI, ICON and UKV edges come from Open‑Meteo grid definitions. The AROME one does not: Météo‑France only publishes a latitude‑longitude crop, and the native domain is reconstructed from it (1440 × 1536 points of 1.3 km centred on 46.45° N, 2° E). Its northern and southern edges are well constrained; the eastern and western ones depend on the central meridian and carry about ±50 km of uncertainty. Anywhere within that interval AROME ranks behind HARMONIE in A Coruña. Outside Europe the catalogue is approximate.

DMI and KNMI are requested as pure regional models. The “seamless” blend of those identifiers returns IFS outside their domain, in which case ECMWF would count twice in the fusion; with the pure model the checkbox reads “no coverage” and the source stays out. The “ECMWF 0.25°” source is kept unticked only so the old log remains readable.

The MeteoGalicia 1 km WRF is not among the sources. Its data server only authorises reads from its own pages, and a static site like this one cannot query it from the browser. The finest‑mesh source in Galicia is DMI HARMONIE‑AROME at 2 km.

How it combines: consensus and shrinkage

First a model consensus is formed as a weighted mean in log‑odds: logit p̄ = Σ w_m · logit p_m / Σ w_m. This mean is guaranteed to stay inside the envelope: never above the highest model nor below the lowest. The posterior then shrinks that consensus towards local climatology: logit P = logit π + γ · (logit p̄ − logit π). The result always lies between your local rate π and the consensus p̄.

Parameter γ

How much you trust the models versus climatology, between 0.1 and 1 (default 0.7). With γ = 1 the posterior is the pure consensus; low values pull it towards the historical frequency in your log. Keeping γ below 1 is sensible while the index‑to‑probability mapping is untested against your observations; the automatic recalibration (below) gradually replaces this manual tuning as nights accumulate.

Ensemble sources (EPS/ENS)

Besides deterministic models there are ensemble sources: the same model run 30 to 50 times with perturbations. For these the probability does not come from the logistic but from the members themselves (mean of member probabilities), reflecting the real atmospheric uncertainty that night. ICON EPS is on by default; GFS ENS and ECMWF ENS are heavier and unticked.

Automatic recalibration

With 12 or more logged nights, the app fits a Platt correction q = σ(a·logit P + b) on (frozen posterior, observed outcome) pairs, with prior a ≈ 1, b ≈ 0 so few nights cannot distort it. It corrects systematic posterior bias; when active, the status line shows "recalibrated (n, a, b)".

Cards

Posterior for the next 6 hours and for the sunrise window, with the min to max range across models and each model’s individual probability. The third card gives the standard deviation across models at sunrise: high agreement (< 10 pp), moderate, or disagreement. A 40 % posterior with high agreement is a more useful forecast than 55 % with disagreement. The sunrise card also carries its own photographic window, measured on the posterior with a 25 % threshold (“full fog” from 50 %), and, for ensemble sources, the p10–p90 band and how many members give fog.

Chart

One thin line per model, a grey band for the range and a thick black line for the posterior. Vertical axis in %.

Tables

“Sunrise state per model” shows, for each model, its maximum probability in the window and the forecast physical state at that hour. “Bayesian weights and prior” shows w_m, the Brier score, the hit rate (with the number of frozen nights in brackets), the cumulative log‑likelihood and the current Beta prior. The log‑likelihood is what sets the weight; Brier and hits are the same information in readable units.

6. Training: the observation log

Learning means comparing what each model predicted with what you saw. For the comparison to be honest, the prediction must be fixed before the outcome is known. The tool does that by itself:

Automatic freezing. Every time you press “Compute” in tab 2, each model’s probability for the next sunrise window is stored under the date of that night (a night is identified by the date of its evening, i.e. the day before the sunrise). If you compute several times, the last one is kept, being the most recent forecast before sunrise. The status line reads “Forecast frozen for the night of …”.

In the morning. The “Night of” field already shows the date of the night that has just ended (before 14:00 it proposes yesterday; after, today). Choose what you observed (Fog if visibility was under 1 km; Mist or haze if there was a noticeable reduction above 1 km; Nothing) and press “Save observation”. The observation is paired with the forecast frozen the evening before for that date. It does not matter that a new forecast for tomorrow already exists at that time: it is not used.

Label proposed from the METAR. When you pick the night, the page queries the METAR reports of the station typed in “METAR station (ICAO)”, LECO by default (A Coruña airport, at Alvedro), in the sunrise window: from 2.5 h before to 1.5 h after sunrise. It proposes Fog if any report gives FG or visibility below 1000 m; Mist if it gives BR, fog in patches, partial, shallow or in the vicinity (BCFG, PRFG, MIFG, VCFG), or less than 5000 m; and Nothing otherwise. Reduced visibility that the report attributes to another phenomenon, such as rain or haze, does not count. The evidence is shown under the form: number of reports, minimum visibility, time, phenomena and the raw report. The proposal only preselects the dropdown and is never saved on its own. The station is not your site (Alvedro lies about 7 km from the coast at 100 m altitude), so correct the label if you saw something else. On saving, the row records the evidence in the METAR column and marks with ≠ the nights where your label differs from the proposal. Reports come from the ASOS archive of the Iowa Environmental Mesonet.

If you did not compute that night. There is no frozen forecast for that date. The observation is saved anyway (shown as “pending” in the posterior column) and updates the climatological prior, which only needs to know whether fog occurred; but it does not change the model weights, since there is no prediction to compare against. If later the same day you compute before the sunrise date rolls over, the row is completed automatically.

Minimal routine: in the evening, open the page and press Compute in tab 2 (two seconds). In the morning, choose what you observed and Save. Nothing else.

Each observation does two things. The Beta prior is updated (a += y, b += 1 − y, with y = 1, 0.5 or 0), so the base rate stops being the generic 12 % and becomes your local frequency. And each model’s log‑likelihood accumulates log P_m(y): a model that gave 80 % when fog occurred adds log 0.8; one that gave 10 % adds log 0.1. Weights w_m are recomputed as normalized Δ_m^(−0.5) · exp(0.7 · log‑likelihood).

The factor Δ_m^(−0.5) is a structural prior. Δ_m is the effective scale of the source at your point, the Δ column of the sources table. With no observations the weights are that prior: in A Coruña HARMONIE DMI, with Δ of 2 km, weighs 2.1 times IFS, at 9 km, and AROME, with Δ of 6.3 km because of its nearby edge, 1.2 times. With observations the likelihood corrects it: a difference of 1.6 in log‑likelihood already offsets a factor 3 in the prior. If on a given night a source has no frozen forecast, because it was added later, failed or was unticked, it is assigned the mean log‑likelihood of the others for that night. Without that imputation a source with fewer nights accumulated less penalty and weighed more merely for having less history.

Under the log table, “Lessons from your log” summarises your local thresholds from the nights with frozen features: with what forecast ΔT and wind fog or mist has actually shown up at your site, with how much mid cloud and what forecast visibility, and which fog-free night had the lowest ΔT. It is the part of the log that changes what you do in the field the fastest.

How many: with 10 nights the weights start to separate; with 40 or 50 they mean something; beyond 100 it is worth moving to a logistic regression on raw variables.

7. Tab 3: calibration against METAR

The observation log learns slowly: one night per day. Tab 3 runs the same comparison against the past in one go. It downloads the METAR reports of a station for the last 60 to 180 nights and, for each source, the forecast it gave the day before at the coordinates of that station. From this it derives three things per source, which the fusion of tab 2 uses as its starting point.

ResultHow it is measuredHow the fusion uses it
T − Td biasMean of (forecast T − Td) − (METAR T − Td) over the hours of the sunrise window. Positive: the source is too dry.The dew point is corrected before the index is computed: Td′ = min(T, Td + bias). The sunrise table shows the ΔT of the source and, after an arrow, the corrected one.
Probability curveLogistic regression of the label (1, 0.5, 0) on the maximum index of the window: logit p = a·(s − 70)/11 + b, with a Gaussian prior centred on the common curve (a = 1, b = 0).Replaces the common curve σ((s − 70)/11) for that source and is applied to the reduced index. The table gives the threshold (index with p = 50 %) and the scale κ.
Measured advantageMean difference per night, Δℓ, between the log‑likelihood of the source and the mean of the evaluated sources, cross‑validated in five blocks.Added to the log‑likelihood as ten nights of your own: the starting weight is multiplied by exp(0.7 · 10 · Δℓ).

In addition, the mean frequency of fog and mist at the station, ȳ, replaces the initial 12 % of the climatological prior, with the same weight of ten nights. Your observations keep updating the prior and the weights from there.

Use

Type the ICAO code of the station (LECO by default), choose the period and press “Calibrate”. It takes a few seconds: Open‑Meteo delivers each source in one request. When it ends, the calibration is stored in the browser and applied; the “Apply in the fusion” checkbox disables it without deleting it and “Delete calibration” removes it. The status line of tab 2 reads “LECO calibration on N sources” while in use, and the sources table notes the bias, threshold and scale of each one.

Where the day‑before forecast comes from

For Open‑Meteo sources, from the previous runs archive (variables with the _previous_day1 suffix): the value given for each hour by the latest run issued at least 24 h ahead, that is, between 24 and about 30 h. The sources are thus compared at equal lead. The forecast you freeze in the evening has a shorter lead, 6 to 18 h, so the measured skill is a prudent bound. Ensembles are not evaluated because the archive does not keep their members.

The reduced index

The archive keeps temperature, humidity, wind, total cloud and precipitation, but neither visibility nor cloud layers. The retrospective therefore computes a reduced index, s_r: estimated visibility, cloud without layers and no advection. The curve is fitted and validated on s_r, and in the fusion the probability of a calibrated source comes from that same s_r: logit p = a·(s_r − 70)/11 + b. The visibility published by the model, the cloud layers and advection remain visible in tab 1 and in the signals of each source, but they do not enter the probability of a calibrated source, because there is no archive against which to measure what they are worth. Ensembles and uncalibrated sources keep the full index and the common curve.

Limits

The truth is the station, not your site. The bias and the curves describe how each model behaves at that point, and carrying them over to yours is an assumption that weakens the farther or the more different the place is; the tab warns when the point lies more than 30 km away. METAR gives T and Td in whole degrees, which adds noise but not bias: with about 90 nights the standard error of the mean bias is near 0.1 °C. A source with fewer than 20 usable nights stays uncalibrated and keeps the common curve. If the measured skill is low, the curves come out flat, with a low probability ceiling, and the posterior of tab 2 is compressed: that is the outcome of the measurement, not a fault. Repeat the calibration every few weeks, because model bias changes with the season and with model upgrades.

The tab includes a request log: which server answered, with how much data and how long it took. If a source shows “no archived forecasts”, the reason is there.

8. Data and privacy: where the log is stored

The whole log (observations, probabilities, model selection, language) is stored with localStorage in the browser you use the page from. Nothing is sent to any server; GitHub only serves the static HTML and neither receives nor keeps your data. Data requests carry only the coordinates (Open‑Meteo) or the station code (Iowa Environmental Mesonet). Concrete implications:

SituationWhat happens to the log
Same URL, same browser, same devicePersists indefinitely, even if you close the browser or push a new version of the HTML.
Another browser or deviceNot there: localStorage is per browser and per origin. Use Export and Import JSON.
Opening the file locally (file://) and also from Pages (https://)Different origins; each has its own log. Export from one and import into the other.
Clearing browsing data or “site data”Lost. Export the JSON from time to time and keep it in the repository itself, for instance.
Private / incognito modeErased when the window closes.
Tab 3 calibration and METAR stationStored separately (niebla_cal, niebla_metar) and not included in the exported JSON: in another browser just press “Calibrate” again.
Other pages on the same origin (user.github.io)Share the localStorage space; the data keys used here start with niebla_ (niebla_bayes, niebla_models, niebla_lang, niebla_metar, niebla_cal) to avoid collisions. The one exception is pn-lang, the language preference deliberately shared with the rest of the site.
Recommendation: after each logging session press “Export JSON” and commit the file to the repository. The history stays versioned and can be re‑imported on any device.

9. Interpretation and good practice

Strong radiation‑fog signal: forecast ΔT below 1 °C from midnight on, wind between 2 and 8 km/h, clouds under 25 %, high and rising pressure, model visibility under 3 km (that last one being the least reliable variable of the set: it backs the others, it does not arbitrate). If several models agree (spread < 10 pp), probability is high.

Advection‑fog signal (coast): air dew point one or two degrees above SST, moderate onshore wind, high humidity. It can occur with overcast skies and 15 to 20 km/h wind; in such cases tab 1 in inland mode underestimates it.

When to be sceptical: narrow valleys, very wet soils after recent rain, reservoirs and rivers, where local fog forms with a forecast ΔT of 2 or 3 °C. Models do not resolve that scale; your log does, hence the importance of the local prior.

Calibration: tab 2 now draws this reliability diagram for you, in the “Calibration” section next to the weights table: it groups the log rows by frozen posterior (0–25 %, 25–50 %, 50–75 %, 75–100 %) and plots each group as a point (mean posterior, actual fog frequency) against the perfect-calibration diagonal, with area proportional to the number of nights. The reading is still the one you would do by hand: if actual frequencies are systematically more extreme than the posterior, raise γ; if less extreme, lower it; if the points hug the diagonal, leave γ as it is. The tool gives guidance from about 10 nights; the reading is reliable from 30.

10. Advanced settings (edit the HTML)

All constants sit at the top of the tab‑2 section in niebla.html:

const PI0=0.12, A0=1.2, B0=8.8  // initial Beta prior (mean 0.12)
const LAMBDA=0.7                // weight tempering
const TH=70, KAP=11             // logistic p = σ((s − TH)/KAP)
const RECAL_N=12, RECAL_TAU=6   // minimum nights and width of the Platt prior
const TIMEOUT=12000             // ms per model (ensembles use +8 s)
const RHO=0.5                   // exponent of the structural prior Δ^(−ρ); 0 gives equal starting weights
const IDX_V=2                   // index version stamped on every frozen forecast
const VIS_EST=0.6               // credit given to estimated visibility (next to score())
const EDGE_KM=200               // distance to the edge below which Δ is degraded (next to the SRC catalogue)
const TAIL_H=54                 // hours from now after which DMI and KNMI are marked as IFS in tab 1
const CAL_NEQ=10, CAL_MIN=20    // nights of your own the measured advantage is worth; minimum nights to calibrate a source
const CAL_VA=0.5, CAL_VB=4      // prior variances of the per-source curve (slope a and offset b)

In the file the first five sit on a single const line; they are split here so each can be commented.

γ is changed from the interface itself. Weights w_m and the consensus are computed in run2(); the shrinkage towards climatology is the line logit P = logit π + γ·(logit p̄ − logit π).

Index weights live in score(), shared by both tabs. To add a model, extend the MODELS array with the Open‑Meteo identifier (e.g. jma_seamless) and, if you want the sources table and the prior to know its mesh, add its entry to the SRC catalogue; without one it is assumed to be 10 km. Default coordinates are the value attributes of the latitude and longitude fields, and of latitude B and longitude B for the comparison site. The photographic window is clipped in winRange() and its thresholds travel in the calls to winTxt() (50 and 75 in tab 1; 0.25 and 0.5 in tab 2). The next-mornings table is in morn(), the breakdown in brk1() and the contrast calculator in renderK().

11. Troubleshooting

SymptomCause and fix
“No model answered in time”Open‑Meteo overloaded or slow connection. Retry, reduce the selection or raise TIMEOUT.
A model always shows “timeout”Untick it; fusion works with whatever responds.
“no SST, advection disabled”The point is inland for the marine API or the request failed. Expected inland; on the coast, try moving the point a few hundred metres seaward.
“Vis km” preceded by ~That source does not publish visibility (AROME, ARPEGE, ICON ensembles) and the value is the FSL estimate from T − Td and RH. It scores at 60 %.
A checkbox reads “no coverage”The domain of that regional model does not cover the coordinates: DMI and KNMI end at about 41.5° N at the longitude of Galicia. The source is not requested and does not count as a failure.
“METAR of LECO unavailable”The Iowa Environmental Mesonet archive is not answering. Choose what you observed by hand: the log works the same, only the row carries no evidence.
The METAR proposal does not match what you sawIt will happen at times: the station is somewhere else. Correct the dropdown before saving; the row is marked with ≠.
A source with “no archived forecasts” or “fewer than 20 nights with data” in tab 3The previous runs archive lacks that source for the station or the period. It stays uncalibrated and uses the common curve. The request log says what the server answered.
“Calibration failed”The METAR of the station is missing (code without reports or server down), there are fewer than 20 usable nights, or no source returned archived forecasts. The previous calibration, if any, is kept.
The log disappearedDifferent browser, device, origin (file → https) or cleared data. Import the exported JSON.
“Use my location” does nothingPermission denied or page not served over HTTPS. Type the coordinates.