avwx-rest / avwx-engine

Aviation Weather parsing engine. METAR & TAF
MIT License
90 stars 31 forks source link

Support for Australian METARs #21

Closed rvdm closed 5 years ago

rvdm commented 5 years ago

On http://www.bom.gov.au/aviation/forecasts/taf/#20 I can get Australian METARs/TAFs, but unfortunately they're not available trough NOAA. I couldn't find a clear documented API (they have 'data feeds', and most probably have an API to retrieve METAR/TAF via the page above).

I couldn't quickly figure out what the internal structure for AVWX-Engine is like, so after I get to solving that puzzle for myself, I might be able to send a PR. In the mean time, there's this issue ;)

eagleDiego commented 5 years ago

Do you have any particular station for which this is happening? I tried YSSY and AvWX has the same report as BOM. Is it maybe for smaller airports?

rvdm commented 5 years ago

Sure: YWOL and YSBK .

eagleDiego commented 5 years ago

Great, thanks!

Just looking at how the website works, it would be possible to use the PHP backend to retrieve the raw data and then feed it to the AVWX-Engine to decode:

curl --request POST \
  --url http://www.bom.gov.au/aviation/php/process.php \
  --header 'content-type: multipart/form-data' \
  --form keyword=YWOL \
  --form type=search \
  --form page=TAF

Which gives:

<h3>WOLLONGONG YWOL</h3><p class="product">TAF YWOL 031217Z 0314/0402<br />30005KT CAVOK<br />FM040100 25012KT CAVOK<br />RMK<br />T 09 09 09 19 Q 1015 1014 1014 1014</p><p class="product">METAR YWOL 031230Z AUTO 00000KT 9999 // NCD 08/06 Q1016 RMK<br />RF00.0/000.0</p>

I had a look at their data products catalogue, but there seem to be nothing for aviation.

@flyinactor91 what do you think?

devdupont commented 5 years ago

Looks serviceable :)

I was able to pull this data as well, so I can start building the Service object. Interesting that it returns both. Will just have to hardcode the TAF form element and split the result after the call returns.

As for the filtering, AVWX uses the first two characters to determine non-NOAA services to use. Here is the full list of Australian airports that send reports:

['YABA', 'YAMB', 'YARG', 'YAYE', 'YBAS', 'YBBN', 'YBCG', 'YBCS', 'YBCV', 'YBDV', 'YBHI', 'YBHM', 'YBMA', 'YBMK', 'YBNA', 'YBOK', 'YBPN', 'YBRK', 'YBRM', 'YBTL', 'YBUD', 'YBWP', 'YBWX', 'YCAR', 'YCAS', 'YCBA', 'YCBB', 'YCBP', 'YCCY', 'YCDU', 'YCFS', 'YCIN', 'YCNM', 'YCOM', 'YDBY', 'YEML', 'YESP', 'YFRT', 'YGEL', 'YGFN', 'YGLA', 'YGTE', 'YGTH', 'YHID', 'YHUG', 'YKRY', 'YLEC', 'YLHI', 'YLIS', 'YLRE', 'YMAV', 'YMAY', 'YMDG', 'YMEK', 'YMEN', 'YMER', 'YMHB', 'YMIA', 'YMLT', 'YMML', 'YMOR', 'YMTG', 'YNAR', 'YNBR', 'YNTN', 'YNWN', 'YOLD', 'YPAD', 'YPBO', 'YPDN', 'YPEA', 'YPGV', 'YPJT', 'YPKG', 'YPKU', 'YPLM', 'YPMQ', 'YPPD', 'YPPH', 'YPTN', 'YPWR', 'YRMD', 'YSCB', 'YSDU', 'YSNW', 'YSRI', 'YSSY', 'YSTW', 'YSWG', 'YTEF', 'YTNK', 'YTRE', 'YWGT', 'YWHA', 'YWLM']

While there's not a way to add this to the current setup, I could change the check to look at leading characters then station country.

devdupont commented 5 years ago

Added the new service under avwx.service.AUBOM which can fetch METAR and TAF strings. Had to add a country code param to avwx.service.get_service to make it work, but this should make it easier to add country-specific services in the future.

Updated to 1.3.x due to the param change.