DMI Weather data
DMI has made weather station data as well as interpolated grid data available through an API.
DMI Station data
The 'dmi-station.py' is a Python script to extract data from the nearest station given a specific location.
To use, download it and edit the following values in the beginning of the file:
- LATITUDE and LONGITUDE should be set to the location for which you want data.
- TIMERES should be set to either "hour" or "day".
- PARS is a list of parameters you want to extract. The valid parameters are described here.
- OUTPUT_FILE is the name of the CSV file where the results should be stored.
- META_FILE is the name of the CSV file where the script will put information about which stations the data is found.
- DMI_API_KEY is where you put your API key. You get a free API key from here. You must get a "climateData" key, not a "metObs" key.
Caveats
The wind you get with "mean_wind_speed" is measured in 10 meters height. For calculating reference evapotranspiration (ET0), or generating input to Daisy, you will need wind from 2 meters height. One way to convert the wind is to use equation 47, page 56 in "FAO Irrigation and Drainage Paper No. 56". If you do not compensate for height, ET0 will be significantly overestimated.
The DMI data has a validity flag, which is ignored by the script. Data marked by the API as invalid is included.
No attempt is made to fill gaps in the data.
Only the "climateData" API is supported. This means you need a key for that API, and not for the alternative "metObs" API.
No support for grid data is available at this point.
The default value of PARS extracts the data needed for a Daisy weather file, but you must remember to convert wind as specified by the first point under caveats. Otherwise, you will get too much water stress, and too little percolation.
Acknowledgements
The script is based on code copied from Lasse Regin's DMI Open Data API project on GitHub.
DMI Grid data
You can fetch grid data on a 10km or 20km grid with dmi-grid.py
Edit size, time, lat, and lon, and pars as suits you, and insert your ClimateData API.
Caveats
Note that these are raw data from DMI, so wind is for 10 m (Daisy needs 2 m) and precipitation data is not corrected for wind and temperature (which Daisy needs).
Acknowledgements
This script is based on Adam R. Jensen's DMI API Tutorial.