There is no built-in UV index in the original’s NOAA’s GFS data. However, Open
Meteo provides UV index forecast in GFS’s data API and other weather models.
That’s very interesting because it means that Open Meteo is doing some
additional processing on top of the raw GFS data to derive the UV index.
So I dig into it’s source code to see how they are calculating the UV index:
1
2
3
4
5
6
7
8
9
10
11
| // https://github.com/open-meteo/open-meteo/blob/bf9577492dde460f9428d5d892b43bab9faa93ef/Sources/App/Gfs/GfsVariableDownloadable.swift#L473-L477
func multiplyAdd(domain: GfsDomain) -> (multiply: Float, add: Float)? {
switch self {
// ...
case .uv_index, .uv_index_clear_sky:
// UVB to etyhemally UV factor 18.9 https://link.springer.com/article/10.1039/b312985c
// 0.025 m2/W to get the uv index
// compared to https://www.aemet.es/es/eltiempo/prediccion/radiacionuv
return (18.9 * 0.025, 0)
// ...
|
That make things simple. Just use existing GFS UVB data and apply a simple
linear transformation to get the UV index.