About
The final level of the API is the Data level.
This is where you get the actual Data.
Notice that data is only available in CSV
format for the Period
corrected-archive
, but also available in XML
and JSON
for the rest of
the Periods.
There is no ATOM
format for any Data.
All dates in the JSON
answers are in Unix time stamp.
NB: For station-set
, if a station is missing data you get "value": null
in the
JSON
answer. In the XML
answer the value
element is missing. In the
CSV
answer the value is just an empty string.
GET /api/version/{version}/parameter/{parameter}/station/{station}/period/{period}/data.{ext}
GET /api/version/{version}/parameter/{parameter}/station-set/{stationSet}/period/{period}/data.{ext}?measuringStations={measuringStations}
Parameters
{period} | One of four Periods. Valid values are latest-hour ,
latest-day , latest-months or corrected-archive . Notice that all
Stations do not have all four Periods so make sure
to check which ones are available in the Period level.
|
{station} | Numeric value. Available Stations are listed in the Parameter level. |
{stationSet} | Lexical value. Available Station Sets are listed in the Parameter level.
Valid value is all which is the set of station that has data for the latest hour. |
{parameter} | Numeric value. Available Parameters are listed in the Version level. |
{version} | Numeric value or latest . Try to use the Version with the
highest number instead of the Version titled latest . |
{ext} | The suffix specifying which mediatype to use. See mediatypes for more information. |
Query parameters
{measuringStations} | Query parameter specifying which measuring stations to get data for. Can be core or
additional . See stations attributes.
If not used, all stations are returned. Only valid for station-set .
|
Reference System
The used reference system (coordinate system) is WGS84, World Geodetic System 1984 (EPSG:4326). This means that the coordinates for the stations are expressed as latitude and longitude. The unit is decimal degress.
Examples
Example request and response for the Data level. This response in not complete for the sake of readability.
GET /api/version/1.0/parameter/1/station/159880/period/latest-day/data.csv
Stationsnamn;Stationsnummer;Stationsnät;Mäthöjd (meter över marken) Arvidsjaur A;159880;SMHIs grundnät;2.0 Parameternamn;Beskrivning;Enhet Lufttemperatur;momentanvärde, 1 gång/tim;degree celsius Tidsperiod (fr.o.m);Tidsperiod (t.o.m);Höjd (meter över havet);Latitud (decimalgrader);Longitud (decimalgrader) 1996-02-01 00:00:00;2022-04-27 05:00:00;382.45;65.5941;19.2642 Datum;Tid (UTC);Lufttemperatur;Kvalitet;;Tidsutsnitt: 2022-04-26;05:00:00;-3.2;G;;Data från senaste dygnet 2022-04-26;06:00:00;-2.3;G;;Tidsperiod (fr.o.m.) = 2022-04-26 04:00:01 (UTC) 2022-04-26;07:00:00;-1.7;G;;Tidsperiod (t.o.m.) = 2022-04-27 05:00:00 (UTC) 2022-04-26;08:00:00;-1.6;G;;Samplingstid = Ej angivet 2022-04-26;09:00:00;-1.4;G;; 2022-04-26;10:00:00;-0.8;G;;Kvalitetskoderna: 2022-04-26;11:00:00;-0.8;G;; Grön (G) = Kontrollerade och godkända värden. 2022-04-26;12:00:00;-0.4;G;; Gul (Y) = Misstänkta eller aggregerade värden. Grovt kontrollerade arkivdata och okontrollerade realtidsdata (senaste 2 tim). 2022-04-26;13:00:00;-0.8;G;; 2022-04-26;14:00:00;-0.9;G;;Nätinformation: 2022-04-26;15:00:00;-0.9;G;; Grundnät: Data samlas in och lagras i SMHIs databaser. Data kvalitetskontrolleras vilket innebär att felaktiga data korrigeras och att databortfall kompletteras utifrån expertbedömning där det är möjligt. Stationerna övervakas, inspekteras och underhålls löpande av SMHI. 2022-04-26;16:00:00;-1.6;G;; Övriga stationer: Data samlas in och lagras i SMHIs databaser. Datakvaliteten är för SMHI okänd då SMHI varken utför kvalitetskontroll på data eller inspektioner på stationerna. 2022-04-26;17:00:00;-1.7;G;; 2022-04-26;18:00:00;-2.6;G;;Möjliga orsaker till saknade data: 2022-04-26;19:00:00;-3.3;G;; - stationen eller givaren har varit ur funktion. 2022-04-26;20:00:00;-4.2;G;; - stationen har endast levererat värden med kvalitetskod Röd (R). Dessa levereras ej. 2022-04-26;21:00:00;-5.2;G 2022-04-26;22:00:00;-6.0;G 2022-04-26;23:00:00;-6.4;G 2022-04-27;00:00:00;-7.0;G 2022-04-27;01:00:00;-7.8;G 2022-04-27;02:00:00;-7.7;G 2022-04-27;03:00:00;-7.9;G 2022-04-27;04:00:00;-6.9;G 2022-04-27;05:00:00;-5.4;GSource
GET /api/version/1.0/parameter/1/station/159880/period/latest-day/data.xml
This XML file does not appear to have any style information associated with it. The document tree is shown below. <metObsSampleData xmlns="https://opendata.smhi.se/xsd/metobs_v1.xsd"> <link type="text/css" rel="stylesheet" id="dark-mode-custom-link"/> <link type="text/css" rel="stylesheet" id="dark-mode-general-link"/> <style lang="en" type="text/css" id="dark-mode-custom-style"/> <style lang="en" type="text/css" id="dark-mode-native-style"/> <updated>2022-04-27T05:00:00.000Z</updated> <parameter> <key>1</key> <name>Lufttemperatur</name> <summary>momentanvärde, 1 gång/tim</summary> <unit>degree celsius</unit> </parameter> <station> <key>159880</key> <name>Arvidsjaur A</name> <owner>SMHI</owner> <ownerCategory>CLIMATE</ownerCategory> <measuringStations>CORE</measuringStations> <height>2.0</height> </station> <period> <key>latest-day</key> <from>2022-04-26T04:00:01.000Z</from> <to>2022-04-27T05:00:00.000Z</to> <summary>Data från senaste dygnet</summary> <sampling>Ej angivet</sampling> </period> <position> <from>1996-02-01T00:00:00.000Z</from> <to>2022-04-27T05:00:00.000Z</to> <height>382.45</height> <latitude>65.5941</latitude> <longitude>19.2642</longitude> </position> <link rel="data" type="application/json" href="https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station/159880/period/latest-day/data.json"/> <link rel="data" type="application/xml" href="https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station/159880/period/latest-day/data.xml"/> <link rel="data" type="text/plain" href="https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station/159880/period/latest-day/data.csv"/> <link rel="period" type="application/atom+xml" href="https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station/159880/period/latest-day.atom"/> <link rel="iso19139" type="application/vnd.iso.19139+xml" href="https://opendata-catalog.smhi.se/md/25080190-38ba-4279-a65d-d9ef8d0bf949"/> <link rel="iso19139" type="application/vnd.iso.19139+xml" href="https://opendata-catalog.smhi.se/md/c6ae10b6-6a18-4e15-9444-fbd746f4609d"/> <value> <date>2022-04-26T05:00:00.000Z</date> <value>-3.2</value> <quality>G</quality> </value> <value> <date>2022-04-26T06:00:00.000Z</date> <value>-2.3</value> <quality>G</quality> </value> <value> <date>2022-04-26T07:00:00.000Z</date> <value>-1.7</value> <quality>G</quality> </value> ... </metObsSampleData>Source
GET /api/version/1.0/parameter/1/station/159880/period/latest-day/data.json
{ "value": [{ "date": 1650949200000, "value": "-3.2", "quality": "G" }, { "date": 1650952800000, "value": "-2.3", "quality": "G" }, { "date": 1650956400000, "value": "-1.7", "quality": "G" }, ... ], "updated": 1651035600000, "parameter": { "key": "1", "name": "Lufttemperatur", "summary": "momentanvärde, 1 gång/tim", "unit": "degree celsius" }, "station": { "key": "159880", "name": "Arvidsjaur A", "owner": "SMHI", "ownerCategory": "CLIMATE", "measuringStations": "CORE", "height": 2 }, "period": { "key": "latest-day", "from": 1650945601000, "to": 1651035600000, "summary": "Data från senaste dygnet", "sampling": "Ej angivet" }, "position": [{ "from": 823132800000, "to": 1651035600000, "height": 382.45, "latitude": 65.5941, "longitude": 19.2642 }], "link": [{ "rel": "data", "type": "application/json", "href": "https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station/159880/period/latest-day/data.json" }, { "rel": "data", "type": "application/xml", "href": "https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station/159880/period/latest-day/data.xml" }, { "rel": "data", "type": "text/plain", "href": "https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station/159880/period/latest-day/data.csv" }, { "rel": "period", "type": "application/atom+xml", "href": "https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station/159880/period/latest-day.atom" }, { "rel": "iso19139", "type": "application/vnd.iso.19139+xml", "href": "https://opendata-catalog.smhi.se/md/25080190-38ba-4279-a65d-d9ef8d0bf949" }, { "rel": "iso19139", "type": "application/vnd.iso.19139+xml", "href": "https://opendata-catalog.smhi.se/md/c6ae10b6-6a18-4e15-9444-fbd746f4609d" } ] }Source
GET /api/version/1.0/parameter/1/station-set/all/period/latest-hour/data.csv
Parameternamn;Beskrivning;Enhet Lufttemperatur;momentanvärde, 1 gång/tim;degree celsius StationsId;Stationsnamn;Latitude;Longitude;Height;2015-11-04 15:00:00;Kvalitet;;Data från senaste timmen 97280;Adelsö A;59.3582;17.5244;6.0;7.8;G;;Tidsperiod (fr.o.m.) = 2015-11-04 14:00:01 (UTC) 167710;Arjeplog A;66.0526;17.8434;431.0;1.4;G;;Tidsperiod (t.o.m.) = 2015-11-04 15:00:00 (UTC) 159880;Arvidsjaur A;65.5953;19.2682;382.0;3.6;G;;Samplingstid = Ej angivet 92410;Arvika A;59.6747;12.6381;66.0;5.6;G;; 106070;Avesta;60.1419;16.1747;100.0;;;;Kvalitetskoderna: 84340;Axstål Mo;58.5719;14.5722;91.0;9.5;G;;Grön (G) = Kontrollerade och godkända värden. 62180;Barkåkra;56.2979;12.8441;18.0;8.1;G;;Gul (Y) = Misstänkta eller aggregerade värden. Grovt kontrollerade arkivdata och okontrollerade realtidsdata (senaste 2 tim). 98040;Berga Mo;59.0688;18.1184;4.0;8.4;G;; 151280;Bjuröklubb A;64.4812;21.5791;40.0;6.5;G;;Orsaker till saknade data: 92130;Blomskog A;59.2217;12.078;170.0;4.9;G;; stationen eller givaren har varit ur funktion. 132110;Blåhammaren A;63.1864;12.1761;1090.0;-0.5;G;; kvalitetskontrollerna har felmarkerat data (röd kvalitetskod). Efterföljande manuell granskning godkänner, rättar eller underkänner data. 161940;Boden Mo;65.8151;21.6396;25.0;7.1;G 105260;Borlänge Flygplats;60.4294;15.5079;152.0;8.1;G 72450;Borås;57.7611;12.9493;135.0;; 102390;Brattmon V;60.75686;12.77226;199.0;5.1;Y 65160;Bredåkra;56.2619;15.2742;58.0;7.0;G 106040;Brovallen;60.0991;16.3062;100.0;; 127130;Brämön A;62.2207;17.7426;17.0;8.8;G 157870;Buresjön A;65.5592;17.86;393.0;3.5;G 123460;Börtnan A;62.7557;13.8456;467.0;3.8;G 94390;Daglösen A;59.6616;14.1831;133.0;6.6;G 116490;Delsbo A;61.8271;16.5418;70.0;6.0;G 123060;Dravagen A;62.0943;13.6115;566.0;3.8;GSource
GET /api/version/1.0/parameter/1/station-set/all/period/latest-hour/data.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <metObsStationSetSampleData xmlns="https://opendata.smhi.se/xsd/metobs_v1.xsd"> <parameter> <key>1</key> <name>Lufttemperatur</name> <summary>momentanvärde, 1 gång/tim</summary> <unit>degree celsius</unit> </parameter> <period> <key>latest-hour</key> <from>2015-11-04T14:00:01.000Z</from> <to>2015-11-04T15:00:00.000Z</to> <summary>Data från senaste timmen</summary> <sampling>Ej angivet</sampling> </period> <link rel="data" type="application/json" href="https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station-set/all/period/latest-hour/data.json" /> <link rel="data" type="application/xml" href="https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station-set/all/period/latest-hour/data.xml" /> <link rel="data" type="text/plain" href="https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station-set/all/period/latest-hour/data.csv" /> <link rel="period" type="application/atom+xml" href="https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station-set/all/period/latest-hour.atom" /> <link rel="iso19139" type="application/vnd.iso.19139+xml" href="https://opendata-catalog.smhi.se/catalog/srv/en/csw?request=GetRecordById&service=CSW&version=2.0.2&elementSetName=full&outputSchema=csw:IsoRecord&id=25080190-38ba-4279-a65d-d9ef8d0bf949" /> <link rel="iso19139" type="application/vnd.iso.19139+xml" href="https://opendata-catalog.smhi.se/catalog/srv/en/csw?request=GetRecordById&service=CSW&version=2.0.2&elementSetName=full&outputSchema=csw:IsoRecord&id=c6ae10b6-6a18-4e15-9444-fbd746f4609d" /> <station> <key>188790</key> <name>Abisko Aut</name> <owner>SMHI</owner> <ownerCategory>CLIMATE</ownerCategory> <measuringStations>CORE</measuringStations> <from>2018-10-16T08:00:50.000Z</from> <to>2022-04-26T14:00:00.000Z</to> <height>392.303</height> <latitude>68.3538</latitude> <longitude>18.8164</longitude> <value> <date>2022-04-26T14:00:00.000Z</date> <value>-4.7</value> <quality>G</quality> </value> </station> <station> <key>97280</key> <name>Adelsö A</name> <owner>SMHI</owner> <ownerCategory>CLIMATE</ownerCategory> <measuringStations>CORE</measuringStations> <from>1995-12-15T00:00:00.000Z</from> <to>2022-04-26T14:00:00.000Z</to> <height>5.612</height> <latitude>59.3579</latitude> <longitude>17.5213</longitude> <value> <date>2022-04-26T14:00:00.000Z</date> <value>9.6</value> <quality>G</quality> </value> </station> ... </metObsStationSetSampleData> Source
GET /api/version/1.0/parameter/1/station-set/all/period/latest-hour/data.json
{ "station": [{ "key": "188790", "name": "Abisko Aut", "owner": "SMHI", "ownerCategory": "CLIMATE", "measuringStations": "CORE", "from": 1539676850000, "to": 1650981600000, "height": 392.303, "latitude": 68.3538, "longitude": 18.8164, "value": [{ "date": 1650981600000, "value": "-4.7", "quality": "G" }] }, { "key": "97280", "name": "Adelsö A", "owner": "SMHI", "ownerCategory": "CLIMATE", "measuringStations": "CORE", "from": 818985600000, "to": 1650981600000, "height": 5.612, "latitude": 59.3579, "longitude": 17.5213, "value": [{ "date": 1650981600000, "value": "9.6", "quality": "G" }] } ], "parameter": { "key": "1", "name": "Lufttemperatur", "summary": "momentanvärde, 1 gång/tim", "unit": "degree celsius" }, "period": { "key": "latest-hour", "from": 1446645601000, "to": 1446649200000, "summary": "Data från senaste timmen", "sampling": "Ej angivet" }, "link": [{ "rel": "data", "type": "application/json", "href": "https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station-set/all/period/latest-hour/data.json" }, { "rel": "data", "type": "application/xml", "href": "https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station-set/all/period/latest-hour/data.xml" }, { "rel": "data", "type": "text/plain", "href": "https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station-set/all/period/latest-hour/data.csv" }, { "rel": "period", "type": "application/atom+xml", "href": "https://opendata-download-metobs.smhi.se/api/version/latest/parameter/1/station-set/all/period/latest-hour.atom" }, { "rel": "iso19139", "type": "application/vnd.iso.19139+xml", "href": "https://opendata-catalog.smhi.se/catalog/srv/en/csw?request=GetRecordById&service=CSW&version=2.0.2&elementSetName=full&outputSchema=csw:IsoRecord&id=25080190-38ba-4279-a65d-d9ef8d0bf949" }, { "rel": "iso19139", "type": "application/vnd.iso.19139+xml", "href": "https://opendata-catalog.smhi.se/catalog/srv/en/csw?request=GetRecordById&service=CSW&version=2.0.2&elementSetName=full&outputSchema=csw:IsoRecord&id=c6ae10b6-6a18-4e15-9444-fbd746f4609d" } ] }Source