avwx-rest/avwx-engine

Metars for airports without constant observation

mrtnkhl opened this issue · 2 comments

When a smaller airport like KSQL is closed for the night, the METARs are aging beyond the query window avwx-engine uses (2 hours I believe). E.g. at this point KSQL's last METAR is 149 minutes old and is not returned because it is outside the query window.

Suggested behavior would be to get the last available METAR, even if older than 2 hours.

File "/home/user/metar/venv/lib/python3.6/site-packages/avwx/init.py", line 89, in update
report = self.service.fetch(self.station)
File "/home/user/metar/venv/lib/python3.6/site-packages/avwx/service.py", line 56, in fetch
report = self._extract(resp.read().decode('utf-8'), station)
File "/home/user/metar/venv/lib/python3.6/site-packages/avwx/service.py", line 101, in _extract
raise self.make_err(raw)
avwx.exceptions.InvalidRequest: Could not find report path in NOAA response

74332561 6

On the one hand, returning an old report is a good thing. It lets you know how old the last report is. On the other hand, since surface observations aren't valid after one hour, you're not allowed to use its contents for any decision making.

Two hours was chosen in case the reporting station was delayed in updating. I don't want to remove the query param to NOAA, so would three hours be preferred?