solarpy.iotools.get_dmi_metobs#
- solarpy.iotools.get_dmi_metobs(station, start, end, parameters=None, map_variables=True, url='https://opendataapi.dmi.dk/v2/metObs/', **kwargs)#
Retrieve meteorological observations from DMI’s metObs API.
The Danish Meteorological Institute (DMI) operates automatic weather stations in Denmark and Greenland.
Unlike
get_dmi_climate_station_data(), the data returned here is neither quality-controlled nor aggregated. Observations are typically available at 10-minute or hourly resolution depending on the parameter. Data is available from 1953 onwards, though not all parameters are available for all stations throughout this period.- Parameters:
station (str) – DMI station identifier, e.g.
'06180'for Copenhagen Airport.start (datetime-like) – First timestamp of the requested period (inclusive). Timezone-naive values are assumed to be UTC.
end (datetime-like) – Last timestamp of the requested period (inclusive). Timezone-naive values are assumed to be UTC.
parameters (str or list of str, optional) – DMI parameter identifiers to retrieve, e.g.
'temp_dry'or['temp_dry', 'wind_speed']. If no value is passed, all available parameters for the station are returned. Note, that the parameter naming convention differs from DMI’s climate data API.map_variables (bool, default True) – Whether to rename column names from DMI parameter IDs to standard pvlib variable names. Parameters without a mapping are not renamed.
url (str, optional) – Base URL for the DMI metObs API.
**kwargs – Additional keyword arguments forwarded to
requests.get(), e.g.timeout=30.
- Returns:
data (pd.DataFrame) – Time series with a
DatetimeIndex. For hourly data the timezone is set to UTC.meta (dict) – Station metadata with keys
'station_id','name','latitude','longitude','altitude', and'country'.
- Return type:
Notes
The DMI metObs API is documented at https://www.dmi.dk/friedata/dokumentation/meteorological-observation-api. Data availability and available parameters vary by station.
A list of stations can be found here: https://www.dmi.dk/friedata/dokumentation/data/climate-data-stations.
Examples
Retrieve ambient temperature and irradiance for the Sjælsmark station north of Copenhagen:
>>> import solarpy >>> data, meta = solarpy.iotools.get_dmi_metobs( ... station='06188', # Sjælsmark station id ... start='2023-06-01', ... end='2023-06-30', ... parameters=['temp_dry', 'radia_glob'], ... timeout=30, ... )