mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-23 12:09:30 -07:00
better missing data handling for current conditions #87
This commit is contained in:
@@ -50,6 +50,8 @@ class CurrentWeather extends WeatherDisplay {
|
|||||||
stillWaiting: () => this.stillWaiting(),
|
stillWaiting: () => this.stillWaiting(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (observations.features.length === 0) throw new Error(`No features returned for station: ${station.properties.stationIdentifier}, trying next station`);
|
||||||
|
|
||||||
// test data quality
|
// test data quality
|
||||||
if (observations.features[0].properties.temperature.value === null
|
if (observations.features[0].properties.temperature.value === null
|
||||||
|| observations.features[0].properties.windSpeed.value === null
|
|| observations.features[0].properties.windSpeed.value === null
|
||||||
@@ -59,10 +61,11 @@ class CurrentWeather extends WeatherDisplay {
|
|||||||
|| observations.features[0].properties.dewpoint.value === null
|
|| observations.features[0].properties.dewpoint.value === null
|
||||||
|| observations.features[0].properties.barometricPressure.value === null) {
|
|| observations.features[0].properties.barometricPressure.value === null) {
|
||||||
observations = undefined;
|
observations = undefined;
|
||||||
throw new Error(`Unable to get observations: ${station.properties.stationIdentifier}, trying next station`);
|
throw new Error(`Incomplete data set for: ${station.properties.stationIdentifier}, trying next station`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
observations = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// test for data received
|
// test for data received
|
||||||
|
|||||||
Reference in New Issue
Block a user