Skip to content

Commit

Permalink
feat: Integrate UKMO global 10km and 2km uk models (open-meteo#295)
Browse files Browse the repository at this point in the history
* add ukmo models to APIs

* add ukmo api

* use underscore spelling for wind_speed and direction for pressure variables

* cleanup

* note about 4 hour delay

* use london coords for ukmo api
  • Loading branch information
patrick-zippenfenig authored Aug 12, 2024
1 parent ad5f373 commit a82167c
Show file tree
Hide file tree
Showing 18 changed files with 949 additions and 20 deletions.
15 changes: 15 additions & 0 deletions src/lib/meteo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ export function countPressureVariables(variables: { name: string; label: string
};
}

export function countHeightVariables(variables: { name: string; label: string }[], levels: number[], params: string[]) {
return {
total: variables.length * levels.length,
active: variables.reduce(
(i, variable) =>
i +
levels.reduce(
(i, level) => i + (params.includes(`${variable.name}_${level}m`) ? 1 : 0),
0
),
0
)
};
}

// Sequence generator function (commonly referred to as "range", e.g. Clojure, PHP, etc.)
export const range = (start: number, stop: number, step: number) =>
Array.from({ length: (stop - start) / step }, (_, i) => start + i * step);
Expand Down
1 change: 1 addition & 0 deletions src/routes/en/docs/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
{ title: 'NOAA U.S.', url: '/en/docs/gfs-api' },
{ title: 'Météo-France', url: '/en/docs/meteofrance-api' },
{ title: 'ECMWF', url: '/en/docs/ecmwf-api' },
{ title: 'UK Met Office', url: '/en/docs/ukmo-api' },
{ title: 'JMA Japan', url: '/en/docs/jma-api' },
{ title: 'MET Norway', url: '/en/docs/metno-api' },
{ title: 'GEM Canada', url: '/en/docs/gem-api' },
Expand Down
16 changes: 14 additions & 2 deletions src/routes/en/docs/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
{ name: 'temperature', label: 'Temperature' },
{ name: 'relative_humidity', label: 'Relative Humidity' },
{ name: 'cloud_cover', label: 'Cloud cover' },
{ name: 'windspeed', label: 'Wind Speed' },
{ name: 'winddirection', label: 'Wind Direction' },
{ name: 'wind_speed', label: 'Wind Speed' },
{ name: 'wind_direction', label: 'Wind Direction' },
{ name: 'geopotential_height', label: 'Geopotential Height' }
];
const levels = [
Expand Down Expand Up @@ -283,6 +283,10 @@
{ name: 'knmi_harmonie_arome_netherlands', label: 'KNMI Harmonie Arome Netherlands' },
{ name: 'dmi_seamless', label: 'DMI Seamless (with ECMWF)' },
{ name: 'dmi_harmonie_arome_europe', label: 'DMI Harmonie Arome Europe' },
],[
{ name: 'ukmo_seamless', label: 'UK Met Office Seamless' },
{ name: 'ukmo_global_deterministic_10km', label: 'UK Met Office Global 10km' },
{ name: 'ukmo_uk_deterministic_2km', label: 'UK Met Office UK 2km' }
]
];
</script>
Expand Down Expand Up @@ -957,6 +961,14 @@
<td>7 days</td>
<td>Every 6 hours</td>
</tr>
<tr>
<th scope="row"><a href="/en/docs/ukmo-api">UKMO</a></th>
<td>UK Met Office</td>
<td>United Kingdom</td>
<td>2 - 10 km</td>
<td>7 days</td>
<td>Every hour</td>
</tr>
<tr>
<th scope="row"><a href="/en/docs/jma-api">MSM & GSM</a></th>
<td>JMA</td>
Expand Down
4 changes: 2 additions & 2 deletions src/routes/en/docs/PressureLevels.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
{name: "temperature", label: "Temperature"},
{name: "relative_humidity", label: "Relative Humidity"},
{name: "cloud_cover", label: "Cloud cover"},
{name: "windspeed", label: "Wind Speed"},
{name: "winddirection", label: "Wind Direction"},
{name: "wind_speed", label: "Wind Speed"},
{name: "wind_direction", label: "Wind Direction"},
{name: "geopotential_height", label: "Geopotential Height"}
]
export let levels = [30, 50, 70, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 850, 900, 925, 950, 975, 1000].reverse()
Expand Down
4 changes: 2 additions & 2 deletions src/routes/en/docs/cma-api/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
{ name: 'dew_point', label: 'Dewpoint' },
{ name: 'relative_humidity', label: 'Relative Humidity' },
{ name: 'cloud_cover', label: 'Cloud cover' },
{ name: 'windspeed', label: 'Wind Speed' },
{ name: 'winddirection', label: 'Wind Direction' },
{ name: 'wind_speed', label: 'Wind Speed' },
{ name: 'wind_direction', label: 'Wind Direction' },
{ name: 'vertical_velocity', label: 'Vertical Velocity' },
{ name: 'geopotential_height', label: 'Geopotential Height' }
];
Expand Down
4 changes: 2 additions & 2 deletions src/routes/en/docs/dwd-api/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
{ name: 'temperature', label: 'Temperature' },
{ name: 'relative_humidity', label: 'Relative Humidity' },
{ name: 'cloud_cover', label: 'Cloud cover' },
{ name: 'windspeed', label: 'Wind Speed' },
{ name: 'winddirection', label: 'Wind Direction' },
{ name: 'wind_speed', label: 'Wind Speed' },
{ name: 'wind_direction', label: 'Wind Direction' },
{ name: 'geopotential_height', label: 'Geopotential Height' }
];
const levels = [
Expand Down
4 changes: 2 additions & 2 deletions src/routes/en/docs/ecmwf-api/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
{ name: 'relative_humidity', label: 'Relative Humidity' },
//{ name: 'specific_humidity', label: 'Specific Humidity' },
{ name: 'cloud_cover', label: 'Cloud cover' },
{ name: 'windspeed', label: 'Wind Speed' },
{ name: 'winddirection', label: 'Wind Direction' },
{ name: 'wind_speed', label: 'Wind Speed' },
{ name: 'wind_direction', label: 'Wind Direction' },
{ name: 'geopotential_height', label: 'Geopotential Height' },
//{ name: 'atmosphere_relative_vorticity', label: 'Relative Vorticity' },
//{ name: 'divergence_of_wind', label: 'Divergence of Wind' }
Expand Down
4 changes: 2 additions & 2 deletions src/routes/en/docs/gem-api/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
{ name: 'dew_point', label: 'Dewpoint' },
{ name: 'relative_humidity', label: 'Relative Humidity' },
{ name: 'cloud_cover', label: 'Cloud cover' },
{ name: 'windspeed', label: 'Wind Speed' },
{ name: 'winddirection', label: 'Wind Direction' },
{ name: 'wind_speed', label: 'Wind Speed' },
{ name: 'wind_direction', label: 'Wind Direction' },
{ name: 'geopotential_height', label: 'Geopotential Height' }
];
const levels = [
Expand Down
4 changes: 2 additions & 2 deletions src/routes/en/docs/gfs-api/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
{ name: 'dew_point', label: 'Dewpoint' },
{ name: 'relative_humidity', label: 'Relative Humidity' },
{ name: 'cloud_cover', label: 'Cloud cover' },
{ name: 'windspeed', label: 'Wind Speed' },
{ name: 'winddirection', label: 'Wind Direction' },
{ name: 'wind_speed', label: 'Wind Speed' },
{ name: 'wind_direction', label: 'Wind Direction' },
{ name: 'vertical_velocity', label: 'Vertical Velocity' },
{ name: 'geopotential_height', label: 'Geopotential Height' }
];
Expand Down
25 changes: 23 additions & 2 deletions src/routes/en/docs/historical-forecast-api/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
{ name: 'temperature', label: 'Temperature' },
{ name: 'relative_humidity', label: 'Relative Humidity' },
{ name: 'cloud_cover', label: 'Cloud cover' },
{ name: 'windspeed', label: 'Wind Speed' },
{ name: 'winddirection', label: 'Wind Direction' },
{ name: 'wind_speed', label: 'Wind Speed' },
{ name: 'wind_direction', label: 'Wind Direction' },
{ name: 'geopotential_height', label: 'Geopotential Height' }
];
const levels = [
Expand Down Expand Up @@ -270,6 +270,10 @@
{ name: 'knmi_harmonie_arome_netherlands', label: 'KNMI Harmonie Arome Netherlands' },
{ name: 'dmi_seamless', label: 'DMI Seamless (with ECMWF)' },
{ name: 'dmi_harmonie_arome_europe', label: 'DMI Harmonie Arome Europe' },
],[
{ name: 'ukmo_seamless', label: 'UK Met Office Seamless' },
{ name: 'ukmo_global_deterministic_10km', label: 'UK Met Office Global 10km' },
{ name: 'ukmo_uk_deterministic_2km', label: 'UK Met Office UK 2km' }
]
];
</script>
Expand Down Expand Up @@ -857,6 +861,23 @@
<td>Every 6 hours</td>
<td>2024-03-13</td>
</tr>
<tr>
<th scope="row" rowspan="2">UK Met Office</th>
<td>UKMO Global</td>
<td>Global</td>
<td>0.09° (~10 km)</td>
<td>Hourly</td>
<td>Every 6 hours</td>
<td>2022-03-01</td>
</tr>
<tr>
<td>UKMO UKV</td>
<td>UK and Ireland</td>
<td>2 km</td>
<td>Hourly</td>
<td>Every hour</td>
<td>2022-03-01</td>
</tr>
<tr>
<th scope="row" rowspan="2">JMA</th>
<td>GSM</td>
Expand Down
4 changes: 2 additions & 2 deletions src/routes/en/docs/jma-api/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
{ name: 'dew_point', label: 'Dewpoint' },
{ name: 'relative_humidity', label: 'Relative Humidity' },
{ name: 'cloud_cover', label: 'Cloud cover' },
{ name: 'windspeed', label: 'Wind Speed' },
{ name: 'winddirection', label: 'Wind Direction' },
{ name: 'wind_speed', label: 'Wind Speed' },
{ name: 'wind_direction', label: 'Wind Direction' },
{ name: 'geopotential_height', label: 'Geopotential Height' }
];
const levels = [1000, 925, 850, 700, 500, 400, 300, 250, 200, 150, 100];
Expand Down
4 changes: 2 additions & 2 deletions src/routes/en/docs/meteofrance-api/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
{ name: 'dew_point', label: 'Dewpoint' },
{ name: 'relative_humidity', label: 'Relative Humidity' },
{ name: 'cloud_cover', label: 'Cloud cover' },
{ name: 'windspeed', label: 'Wind Speed' },
{ name: 'winddirection', label: 'Wind Direction' },
{ name: 'wind_speed', label: 'Wind Speed' },
{ name: 'wind_direction', label: 'Wind Direction' },
{ name: 'geopotential_height', label: 'Geopotential Height' }
];
const levels = [
Expand Down
4 changes: 4 additions & 0 deletions src/routes/en/docs/previous-runs-api/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@
{ name: 'knmi_harmonie_arome_netherlands', label: 'KNMI Harmonie Arome Netherlands' },
{ name: 'dmi_seamless', label: 'DMI Seamless (with ECMWF)' },
{ name: 'dmi_harmonie_arome_europe', label: 'DMI Harmonie Arome Europe' },
],[
{ name: 'ukmo_seamless', label: 'UK Met Office Seamless' },
{ name: 'ukmo_global_deterministic_10km', label: 'UK Met Office Global 10km' },
{ name: 'ukmo_uk_deterministic_2km', label: 'UK Met Office UK 2km' }
]
];
Expand Down
Loading

0 comments on commit a82167c

Please sign in to comment.