In-situ data#

WatObs currently only supports in-situ data from Danish Meteorological Institute.

DMI ocean observations#

Danish Meteorological Institute Oceanographic Observation

class watobs.DMIOceanObsRepository(api_key: str)#

Get Ocean observations from DMI

Notes

Get a API key here: https://confluence.govcloud.dk/pages/viewpage.action?pageId=26476690

Examples

>>> dmi = DMIOceanObsRepository(api_key="e11...")
>>> dmi.stations[dmi.stations.name.str.startswith('Køg')]
   station_id      lon      lat          name
43      30478  12.1965  55.4555   Køge Havn I
54      30479  12.1965  55.4555  Køge Havn II
>>> df = dmi.get_observed_data(station_id="30478", start_time=datetime(2018, 3, 4))
get_observed_data(*, station_id: str, parameter_id='sealev_dvr', start_time: datetime | None = None, end_time: datetime | None = None, limit=100000, records_per_request=10000) DataFrame#

Get ocean observations from DMI

For historical data, always specify both a start_time and an end_time.

Parameters:
  • station_id (str) – Id of station, e.g. “30336” # Kbh. havn

  • parameter_id (str, optional) – Select one of “sea_reg”, “sealev_dvr”, “sealev_ln”, “tw”, default is “sealev_dvr”

  • start_time (datetime, optional) – Start time of interval.

  • end_time (datetime, optional) – End time of interval.

  • limit (int, optional) – Max number of observations to return default 10000

  • records_per_request (int, optional) – Tunable parameter for optimal performance, default value is 100000

Return type:

pd.DataFrame

Examples

>>> from watobs import DMIOceanObsRepository
>>> dmi = DMIOceanObsRepository(api_key="e11...")
>>> df = dmi.get_observed_data(station_id="30336", start_time="2018-03-04", end_time="2018-03-06")
>>> df.head()
                    sealev_dvr
time
2018-03-04 00:00:00       -0.22
2018-03-04 00:10:00       -0.23
2018-03-04 00:20:00       -0.26
2018-03-04 00:30:00       -0.27
2018-03-04 00:40:00       -0.28
>>> df = dmi.get_observed_data(station_id="30336", parameter_id = "tw", start_time="2018-07-01", end_time="2018-07-06")
>>> df.head()
                    tw
time
2018-07-01 00:00:00  18.2
2018-07-01 00:10:00  18.2
2018-07-01 00:20:00  18.2
2018-07-01 00:30:00  18.2
2018-07-01 00:40:00  18.2
get_stations_in_interval(start_time=None, end_time=None) DataFrame#

Get DMI stations with data in time interval.

Parameters:
  • start_time ((str, datetime), optional) – Start time of interval. Keep only stations with end after this time.

  • end_time ((str, datetime), optional) – End time of interval. Keep only stations with start before this time.

Returns:

all stations with data in time interval

Return type:

pd.DataFrame

Examples

>>> df = dmi.get_stations_in_interval(end_time="1990-1-1")
>>> df.head(5)
station_id      lon      lat              name      start end
0    9007102   8.5739  55.2764          Mandø II 2000-11-02 NaT
1      31572  11.3474  54.6551   Rødbyhavns Havn 1990-09-21 NaT
2    9005110   8.1259  56.3716  Thorsminde Fjord 1990-12-03 NaT
3      29392  11.1390  55.3355       Korsør Havn 1991-09-02 NaT
4    9005201   8.1290  56.0005  Hvide Sande Havn 1990-10-05 NaT
property stations: DataFrame#

Get DMI stations as a dataframe.

Returns:

all stations in API

Return type:

pd.DataFrame

Examples

>>> dmi.stations.head(5)
  station_id      lon      lat              name      start end
0    9007102   8.5739  55.2764          Mandø II 2000-11-02 NaT
1      31572  11.3474  54.6551   Rødbyhavns Havn 1990-09-21 NaT
2    9005110   8.1259  56.3716  Thorsminde Fjord 1990-12-03 NaT
3      29392  11.1390  55.3355       Korsør Havn 1991-09-02 NaT
4    9005201   8.1290  56.0005  Hvide Sande Havn 1990-10-05 NaT