detect stations not reporting critical values close #4
This commit is contained in:
parent
4363f3967f
commit
eeeb7ec3e8
4 changed files with 35 additions and 17 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue