Closed mrtnkhl closed 3 years ago
Two (2) hour window is set here: https://github.com/avwx-rest/AVWX-Engine/blob/854c095a562205f451138f0cd368856e64b1d9b2/avwx/service.py#L140
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?
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 <?xml version="1.0" encoding="UTF-8"?>