alliander-opensource / weather-provider-api

This API is intended to help you fetch weather data from different data sources in an efficient and uniform way. By just supplying a list of locations and a time window you can get data for a specific source immediately. This project is licensed under the MPL-2.0 license.
https://alliander-opensource.github.io/weather-provider-api/
Mozilla Public License 2.0
26 stars 6 forks source link

WPLA 2.x\\ BUG - Precipitation always zero with KNMI "Uurgegevens" #84

Closed rflinnenbank closed 1 year ago

rflinnenbank commented 1 year ago

The Bug: When using any other format than NetCDF (3 or 4), the returned value for "precipitation" (internal name "RH") is always 0, regardless of the actual amount of rain.

To Reproduce

  1. Request the precipitation for a period with heavy precipitation in any text-based format.
  2. Compare with the NetCDF(4) output for the same period.

Expected behavior The value should be indicative of the precipitation.

Additional context From the primary investigation the issue already seems clear:

The precipitation has a default harmonization level of meters per hour.

This was likely still one of the initial settings, as even the hardiest rainy weather in the Netherlands hasn't surpassed 94 mm per hour yet. Because even 94mm is only 0.09m and the average rain in an hour amounts more to about 1 to 2 mm (a.k.a. 0.001m to 0.002m) the cause is clear.

In text based files, values are automatically rounded to 2 decimals, meaning most values end up as 0 or -1.

Screenshots afbeelding

Please note how the value remains 0, even though the graph itself and increases and decreases with the quantity.

rflinnenbank commented 1 year ago

Solution: For version 2.x the solution is clear:

The standard is already set at m / h since (likely) the very first version. Adhering to API consistency it therefor can't be a solution to change the unit to the more logical mm / h. As such the solution needs to be the formatting in the text based files instead. We'll set the rounding to 4 decimals instead, meaning we'd support to 0.0001 depth, which is the level at which precipitation is supplied.

rflinnenbank commented 1 year ago

Fixed as of release 2.35