c5te1n / node-red-contrib-dwd-local-weather

Node Red node to retrieve local weather forecast from DWD (Germany)
Apache License 2.0
13 stars 11 forks source link

Is RR1c really precipitationNext24h? #33

Open rucksman opened 3 years ago

rucksman commented 3 years ago

First of all thanks for this wonderful node.

I just checked which data could be useful for me und stumbled upon RR1c. You describe it as payload.precipitationNext24h. But in the official docs from DWD (mosmix_elementexls.xlsx) it says Total precipitation during the last hour consistent with significant weather. So it is the precipitation for the past hour and not_ for the next 24 hours. Or do I miss something here?

zimbo86 commented 2 years ago

The author summs up all RR1c for the next 24h

`
function sumFutureValue(mosmixStation, attribute, hours, forecastDate) { var idx = getTimeIndex(mosmixStation, forecastDate);

    assertAttributeExists(mosmixStation, attribute);

    var sum = 0;
    // sum x future values (x = hours), but not more than length of array
    for (var i = idx; i < weatherForecast[mosmixStation][attribute].length && i < hours + idx; i++) {
        if (!isNaN(weatherForecast[mosmixStation][attribute][i])) {
            sum = sum + weatherForecast[mosmixStation][attribute][i];
        }
    }
    return sum;
}

`