detect stations not reporting critical values close #4

This commit is contained in:
Matt Walsh
2020-10-16 15:16:46 -05:00
parent 4363f3967f
commit eeeb7ec3e8
4 changed files with 35 additions and 17 deletions

View File

@@ -32,6 +32,10 @@ class LatestObservations extends WeatherDisplay {
const allConditions = await Promise.all(regionalStations.map(async station => {
try {
const data = await utils.fetch.json(`https://api.weather.gov/stations/${station.id}/observations/latest`);
// test for temperature, weather and wind values present
if (data.properties.temperature.value === null ||
data.properties.textDescription === '' ||
data.properties.windSpeed.value === null) return;
// format the return values
return Object.assign({}, data.properties, {
StationId: station.id,