February 10, 2024

DMI forecast API for atmosphere, ocean and sea ice, free !

Updated 2024-02-10

DMI is the Danish Meteorological Institute and the
 Open Data API provides free and open access to DMI’s data.They are covering a pretty big area not just Denmark.

I'm maintaining the weather station for Domstens yacht club and have become really interested in weather "issues".

The actual use case for me is that I have to change the mooring, of our boat, if the water level exceeds 60 cm from normal. For several years I have been searching for a free forecast API so I can get an early warning when the water level rises.

Node-Red is used.

Intro
I started to use DMI:s forecast data in GRIB1 format and wrote this post on how to unpack them in a Linux(Raspberry Pi) environment.

It's a pretty awkward way if you just want the forecast for your selected spot. Getting a forecast for 5 days I had to download 130 files and unpack them !

Therefore its very nice that DMI, 2023-03, have released a forecast API which is very easy to handle. One http request will get the forecast for 5 days.

How to
User
You have to create a user and get an API key. Create the account and then click on "API Gallery => forescastedr" and get the API key.

To check the granted API:s and keys go to "User => Applications => Default application => Subscriptions"

Getting the data
Here you can check out some request examples.
Getting the forecast for wind speed and direction, at Domstens harbour, is done with this URL

https://dmigw.govcloud.dk/v1/forecastedr/collections/wam_dw/position?coords=POINT(12.6026 56.1159)&crs=crs84&parameter-name=wind-speed,wind-dir&f=GeoJSON&api-key=503a2d22.....

I'm using the "wam_dw" collection and the output is formated as "GeoJSON"

And then the URL for the water level

https://dmigw.govcloud.dk/v1/forecastedr/collections/dkss_idw/position?coords=POINT(12.6026 56.1159)&crs=crs84&parameter-name=sea-mean-deviation&f=GeoJSON&api-key=503a2d22.....

where I used the "dkss_idw" collection.

Node-Red flow
The flow below is used to get the charts shown above.


and here is the link to the application.

Send an "Early warning"
When the forecast includes a water level greater than 60 cm a push message is sent to my phone. For this I'm using the nice SIGNL4 app.

Old flow
To get the same result, using the mentioned GRIB files, the flow below illustrates the complexity.



No comments:

Post a Comment

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !