Some forecast fields are non-continuous, i.e. do not contain valid data for each forecast time point.
Instead they just contain "-".
Number.parseFloat() will parse that as NaN, causing the interpolation to fail and return NaN as well.
Except for files that are fully in the future, nothing but NaN will be returned, because interpolation will always fail.
With this fix, the node first checks the previous forecast for NaN and only interpolates if it's a valid number.
Resulting behavior:
Both values are numbers: Normal interpolation.
First value is NaN: Take second value without interpolation.
Obviously, if the second the value is NaN, too, the result will still be NaN.
This PR solves https://github.com/c5te1n/node-red-contrib-dwd-local-weather/issues/12
Some forecast fields are non-continuous, i.e. do not contain valid data for each forecast time point. Instead they just contain "-". Number.parseFloat() will parse that as NaN, causing the interpolation to fail and return NaN as well. Except for files that are fully in the future, nothing but NaN will be returned, because interpolation will always fail.
With this fix, the node first checks the previous forecast for NaN and only interpolates if it's a valid number. Resulting behavior: