Download

There are two schema files available to download that are both needed to consume the API.

Generic

There are a couple of generic types used by many resources. They use the namespace https://opendata.smhi.se/xsd/portal.xsd and are not subject to the API versioning system.

linkType and linksType

A linkType represents a link to another resource. It consist of:

  • rel - the mediatype of the target resource ( application/xml )
  • type - the xsd type of the target resource ( parameter )
  • href - the url to the target resource ( https://opendata-download-metobs.smhi.se/api )

A linksType represents a set of linkType with additional information. This information contains a title to describe the resource, a summary for extra description and updated which represents the last time the target resource, or underlying subresources, was updated. This can be useful to deside if data is stale or not without traversing down to the actual data. The linksType is used to represent the next level. For instance the Category type uses a list of linksType to represent all the Versions available. The linkType in this case refers to the different Versions in different formats.

Besides links to the same resource or the next resource in different formats, linkType are also used to refer to other useful resources. Here are some examples.

  • Parent resources
  • Metadata rel="iso19139"
  • Codes rel="codes". This linkType is available in the Versions listing of all the Parameters and also in the Parameter and Data resource itself.

...

geoBox and geoLinksType

geoBox represents an area of interest devided by minLatitude, maxLatitude, minLongitude and maxLongitude.

The geoLinksType is a regular linksType but with an additional geoBox.

...

category and version

The category and version types are used for versioning. The version element in category links to the different versions of the API that can be used. Versions are incremented when changes are made to the API. There is one special version called latest. This version is virtual and always points to the latest version of the API. It is not recomended to use this in any application as it might be redirected without notice. Instead try to use the version with the highest number as these do not change. Older versions will be deprecated and only maintained for a couple of months.

The version type contains links to all available parameter published.

...

Specific

metObsCodes, metObsValueType and measuringStationsType

One special type is metObsCodes. It only contains the keys and values available for the specific code-listing.

Another special type is metObsValueType. It enumerates the different types of values available.

  • SAMPLING - this indicates that the values are of type metObsSampleValueType
  • INTERVAL - this indicates that the values are of type metObsIntervalValueType

Another special type is measuringStationsType. It enumerates the different types of networks the station can belong to.

  • CORE - this indicates that the station belongs to the CORE network
  • ADDITIONAL - this indicates that the station belongs to the ADDITIONAL network
...

The rest of the types are versioned and uses the namespace https://opendata.smhi.se/xsd/metobs_v1.xsd. Common to these main types are

  • key - resource identifier
  • update - timestamp of last modification time
  • title - the name of the resource
  • summary - description of the resource

They also contains link to other resources such as to themself in other mediatypes and more specific links to the next level.

metObsParameter and metObsStationLinksType

metObsParameter represents a parameter. It contains metObsStationLinksType to all stations that produces data for the specific parameter. Some parameters also contains a link to metObsStationset. This is where you can get values for all stations in a single request. Beside the usual linksType information these links also contains information about height, longitude, latitude and owner of the target station. It also specifies what kind of metObsValueType this parameter produces.

...

metObsStation, metObsStationSet and metObsPosition

metObsStation represents a station. The from and to elements represents the lifespan of the Station. It also contains a list of metObsPosition which represents position and intervals for the station. This might seem strange but is needed as some stations has moved over time.

metObsStationSet is a grouping of several stations. Therefore no from, to or list of metObsPosition can be given.

...

metObsPeriod

metObsPeriod is the final level before the actual data. It contains the information from and to specifying the timespan of the data and links to the actual data. Depending on the parameter, the links may lead to either a metObsSampleDataType or a metObsIntervalDataType. Or in the case of metObsStationSet where the links may lead to either a metObsStationSetSampleDataType or a metObsStationSetIntervalDataType

...

metObsSampleData and metObsIntervalData

metObsDataType is the base type for two different kinds of data. It contains information about the Parameter, the Station and the Period. This is the same information that can be found on levels leading up to the data, but can be convenient when using data urls without traversing the structure.

The two kinds of data, metObsSampleData and metObsIntervalData, are used to represent different kinds of data. The former is used for Parameters that sample their values (SAMPLING) and the later is used for Parameters that contain values that represents a time interval (INTERVAL). The two different data types contains values of type metObsSampleValueType and metObsIntervalValueType respectively.

...

metObsStationSetSampleData and metObsStationSetIntervalData

metObsStationSetDataType is the base type for two different kinds of data. It contains information about the Parameter and the Period. Notice the lack of information about Station since these are only used for Station Set. Instead the Station information is bundled with the values list. This is the same information that can be found on levels leading up to the data, but can be convenient when using data urls without traversing the structure.

The two kinds of data, metObsStationSetSampleData and metObsStationSetIntervalData, are used to represent different kinds of data. The former is used for Parameters that sample their values (SAMPLING) and the later is used for Parameters that contain values that represents a time interval (INTERVAL). The two different data types contains values of type metObsSampleValueType and metObsIntervalValueType respectively.

...

metObsSampleValueType and metObsIntervalValueType

Both metObsSampleValueType and metObsIntervalValueType has a quality code associated with every value. It can be either G (green), Y (yellow) or R (red) depending on the quality of the value. metObsSampleValueType only has a date to represent what date and time the value is sampled. metObsIntervalValueType has from and to to represent the interval and ref to clarify which date the interval represents.

...