Openly accessible - and still no walkover

For Sweden the start looked simple at first: SMHI provides the observations without registration and without an API key. Official monthly values exist only for mean temperature and precipitation - everything else still has to be calculated. It later became demanding through separate observing networks, different CSV formats and an import that hit the memory limit.

Flag of Sweden
04.09.2026

My start

Open data without a key - and only a few true monthly values

For Sweden I first thought the integration would be very straightforward. SMHI provides the observations openly, without registration or an API key. That is genuinely pleasant: through the MetObs catalogue I can move transparently from parameters to stations, periods and individual files.

Official monthly values exist only for mean temperature and precipitation. That helps, but it is only two values. For maximum, minimum, sunshine, temperature-day counts and thunderstorm days I still have to calculate from daily or hourly data myself - exactly what has already created a lot of extra logic for other countries.

Separate observing networks

One station, several identifiers

Not every weather station measures the same things. In the station list each station therefore has several identifiers, depending on whether temperature, precipitation or sunshine hours are measured there, for example. I first have to keep these identifiers apart and assign them to the matching data.

For the different measured quantities, data from different stations then have to be combined. That matters, because otherwise it is easy to get the impression that the data are equally well distributed everywhere. In fact the number of stations differs by measured quantity.

Sunshine hours in particular are measured at only a few places. Coverage therefore differs by metric and must not be read as one uniform station network.

Parameters and quality

Official monthly values, complete days and no silent zeros

The mapper implementation deliberately separates these data by their technical origin. Parameter 22 supplies mean temperature and parameter 23 precipitation directly as official monthly values. From the daily extremes of parameters 20 and 19, temperature maximum, temperature minimum and summer, tropical, frost and ice days are calculated only when every day of a month is present.

The hourly sunshine values from parameter 10 are first summed into complete days and then into months. For thunderstorm days I use parameter 13; I describe the exact rule in the next section.

I like SMHI's quality information. Green values are checked, but yellow values must not be discarded across the board: for monthly values and daily extremes they can mean official aggregated values. The mapper therefore accepts G and Y, but does not treat missing or discarded values as null.

I do not integrate new snow. SMHI provides snow depth, but snow depth is not new snow. A difference between two snow depths would be misleading because of melting or drifting. I prefer an open metric here to an apparently complete but wrong number.

This distinction matters because a zero can be a real measurement and a missing value is simply no statement.

SMHI parameters 1 to 40

The IDs come from the official MetObs parameter catalogue. Highlighted are the values I use for Climate Chronicle.

IDMeaning
1Air temperature, hourly value
2Air temperature, daily mean
3Wind direction
4Wind speed
5Precipitation, daily sum at 06 UTC
6Relative humidity
7Precipitation, hourly sum
8Snow depth, daily value
9Air pressure reduced to mean sea level
10Sunshine duration, hourly sum
11Global radiation
12Visibility
13Present weather / weather phenomenon
14Precipitation, 15-minute sum
15maximum precipitation intensity within 15 minutes
16Total cloud cover
17Precipitation / precipitation type, 12-hour value
18Precipitation / precipitation type, 24-hour value
19Daily minimum temperature
20Daily maximum temperature
21maximum wind gust
22Monthly mean temperature
23Monthly precipitation sum
24longwave radiation
25maximum 10-minute wind mean within 3 hours
26Minimum temperature, 12 hours
27Maximum temperature, 12 hours
28Height of the lowest cloud layer
29Cloud amount of the lowest cloud layer
30Height of the second cloud layer
31Cloud amount of the second cloud layer
32Height of the third cloud layer
33Cloud amount of the third cloud layer
34Height of the fourth cloud layer
35Cloud amount of the fourth cloud layer
36lowest cloud base
37minimum lowest cloud base within 15 minutes
38maximum mean precipitation intensity within 15 minutes
39Dew-point temperature
40State of the ground surface

Note on thunderstorm days

Special case: thunderstorm days

At first I derived thunderstorm days from parameter 13 in the normal way: only clearly documented thunderstorm codes count as a thunderstorm day. If a valid weather observation is missing, the value stays open. If a month's daily series was complete and no thunderstorm code appeared, I stored 0 - meaning "observed, but no thunderstorm".

Later I noticed in the chart that from about 1995/96 almost only zeros remained at almost all stations. According to the numbers that would mean that for years there was no single thunderstorm left across almost all of Sweden, which would of course be completely illogical. In time, though, this illogic matched the switch to the automatic station network OBS 2000.

In the SMHI blog on the automatic station network OBS 2000, SMHI describes that official distribution of the new automatic stations began on 1 August 1995 and that the network was upgraded accordingly in 1995/96. Weather observation from parameter 13 continued to be recorded after that, but thunderstorm codes are often no longer reliably detectable in it. Many stations still deliver valid weather codes without any thunderstorm evidence - and that is exactly how masses of apparent 0 values arose = apparently no thunderstorm.


That is why Sweden now has its own rule:
If a station has no single positive thunderstorm day in a year, I leave all thunderstorm monthly values of that station-year open (null), instead of treating them as thunderstorm-free (0). Only if at least one thunderstorm day occurs in the same station-year do real zero months also remain.
The rule therefore continues relatively consistently with the years before: as long as thunderstorms were still captured reasonably reliably, stations with real thunderstorm evidence - and with them their zero months - stay unchanged. Only from 1995 onwards did suddenly fewer and fewer stations report any thunderstorm day at all, even though the weather observation itself continued. That is exactly the break the rule is meant to catch, instead of pulling the country curve wrongly downwards after the network change.

Language and file formats

Swedish terms and CSV files that do not look the same

The language was again an extra research step for me. SMHI field names, parameter descriptions and quality notes are in Swedish. Terms such as present weather, representative month or quality first had to be placed securely before I could assign them correctly.

Downloading also brought technical pitfalls. The CSV files start with different header blocks depending on the measured quantity: first come details about the station and the period, and only then the actual values. The time columns are not uniform either. Monthly and daily data use time intervals, while sunshine hours and weather observations use separate date and time columns.

In addition, SMHI reports some CSV files technically as text/plain instead of CSV. The downloader still has to recognise these variants as data files, otherwise existing measurements would wrongly be skipped. That is not a fault at SMHI, but it makes a general import more work.

Download and mapper

Quick to fetch - but too large for one pass

The two periods corrected-archive and latest-months bring another compromise. The archive holds the quality-controlled history, but ends before the newest months. latest-months closes that gap, but is only provisional. I merge both and always let corrected-archive win on overlaps. New data stay visible without provisional values overwriting final archive values.

The historical bulk download should also only run sequentially. Especially the many hourly sunshine values make the first import slow. That is understandable and fair to the source, but less convenient for processing. In practice I still find Sweden pleasantly fast despite the large volume. For this retrieval SMHI does not impose tight request limits or API-key hurdles. I can therefore load the files without artificial waiting times.

In the climate-data mapper, however, I hit a hard memory limit.
The SE holding comprises several thousand SMHI CSV files; taken together that is on the order of about 50 to 80 million data rows. The hourly and weather archives weigh especially heavily, with individual files already holding hundreds of thousands of rows. As long as the mapper first reads all raw rows completely and only then aggregates them, tens of millions of observations are held in memory at once - and even with 128 GB of RAM that repeatedly caused crashes, so I never finished the full series in one pass.

The solution was a special case for Sweden: a streaming import. Each file is aggregated immediately and then discarded, instead of holding the entire holding at once. The principle may help me later with other countries as well, because hourly values in particular can be huge, and it was first needed for Sweden.

My conclusion is mixed: the open, well documented SMHI source and the official monthly values are a very good foundation. At the same time the separate observing networks, the different formats, partly different headers per metric and the limited thunderstorm observation require careful handling of coverage. Sweden was basically integrable, but smaller hurdles kept appearing that I found unnecessary, so despite those smaller hurdles I still had to adapt my mapper and downloader quite strongly to Sweden.

Sources and working material

SMHI MetObs and station data

Status:04.09.2026