DMI Weather data

DMI has made weather station data as well as interpolated grid data available through an API

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:

  1. LATITUDE and LONGITUDE should be set to the location for which you want data.
  2. TIMERES should be set to either "hour" or "day".
  3. PARS is a list of parameters you want to extract.  The valid parameters are described here
  4. OUTPUT_FILE is the name of the CSV file where the results should be stored.  
  5. META_FILE is the name of the CSV file where the script will put information about which stations the data is found.
  6. 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.