This page exists as a landing page to support the Metar WordPress plugin. You may find additional information on our blog by searching the metar Tag: metar tag.

If you’re after specific code you can use in PHP applications, of you’re after a standalone WordPress shortcode function, you’ll want to search our website Tag: metar. This page is intended only to demonstrate usage of the plugin.

Note: All the results on this page are cached for up to a few hours so the data returned is likely invalid.

METAR will accomplish the following:

  • Include a METAR or TAF (sourced from the NOAA) website into your page.
  • Display temperature or pressure information only.
  • Source an Australian TAF and/or METAR from Airsevices Australia.
  • Source a list of reports applicable to an Australian ARFOR.

Display a TAF or METAR

If a request is made for an Australian location, the information is sourced from Airservices Australia. Otherwise we’ll request the report from the NOAA (and return it only if the requested station exists ).

A Sydney (YSSY) metar is requested as follows: [metar loc="yssy"]. The result:

TTF SPECI YSSY 132030Z 20006KT 9999 SCT007 BKN009 21/20 Q1001 RMK RF00.0////./ HZ FM2100 17005KT 9999 SCT010 SCT020 INTER 2100/2330 5000 SHRA BKN010

To display a TAF for JFK, we’ll use the shortcode of [taf loc="kjfk"] with a result as follows:

TAF KJFK 131729Z 1318/1424 07008KT P6SM -SHRA BKN027 OVC040 FM131900 10009KT P6SM OVC030 FM140000 09009KT P6SM OVC015 FM140500 08006KT P6SM OVC010 FM141300 11008KT P6SM SCT010 BKN020 FM141600 13006KT 5SM BR SCT010 BKN020

To display a report with the line breaks it was originally published with, use [taf loc="yssy" tidy="0"]. The result:

TAF AMD YSSY 131639Z 1318/1424
17006KT 9999 -SHRA FEW010 SCT020
FM132300 07010KT 9999 -SHRA SCT025
FM140500 04015KT 9999 -SHRA SCT030
FM140900 01010KT 9999 -SHRA SCT010 BKN020
FM142300 05015KT 9999 -SHRA SCT010 BKN020
INTER 1318/1323 5000 SHRA BKN010
TEMPO 1412/1414 5000 SHRA BKN008
PROB30 TEMPO 1404/1412 VRB25G35KT 3000 TSRA SCT010 FEW025CB
RMK
T 21 24 26 27 Q 999 1001 1002 1001

By default the report is wrapped in paragraph tags. To disable, use p="0".

Airport Temperature

The temperature (and dew point temperature) on a Metar report is almost always reported in Celsius. The following temperature results are based on data from KJFK. Again, the option to cache your report for longer or shorter than the default hour applies. To cache your report for two hours, use [temperature loc="kjfk" temp="1" cache="7200"], or to cache it for just 30 minutes, use [temperature loc="kjfk" temp="1" cache="1800"].

The bold text in the below results is my own to illustrate the differences between the returned temperatures.

  • Temperature (normalised integer °C) is 4 [temperature loc="kjfk" temp="1"]
  • Dew Point Temp (normalised integer °C) is 3 [temperature loc="kjfk" temp="2"]
  • Raw Temp (from Metar °C) is 04 [temperature loc="kjfk" temp="3"]
  • Raw Dew Point Temp (from Metar °C) is 03 [temperature loc="kjfk" temp="4"]
  • Temperature (°F) (normalised integer) is 39 [temperature loc="kjfk" temp="5"]
  • Dew Point Temp (°F) (normalised integer) is 37 [temperature loc="kjfk" temp="6"]
  • Raw report data is 04/03 [temperature loc="kjfk" temp="7"]

In the examples above, the ‘raw’ temperature will return whatever is provided in the report. Negative temperatures will be prefixed with an ‘M’ and single digit temperatures will include a leading ‘0’.

Airport Pressure

To extract the aerodrome pressure from the report, the shortcode of [qnh loc="yssy"] should be used (where yssy is your location of choice). By default, we’ll always return the QNH – not inches of mercury.

The shortcode of [qnh loc="yssy"] will output a QNH of 1001.

A USA METAR report will normally prefix their pressure with an A for altimeter, while it’s Q in most other parts of the world. Since QNH is the ICAO standard, it defaults to true, regardless of what pressure the report provides.

  • QNH JFK is 1030 [qnh loc="kjfk"]
  • Altimeter JFK is 30.43 [qnh loc="kjfk" unit="0"]

Australian ARFOR Reports

To include all the METAR and TAFs within a specific Australian area, use the shortcode of [arfor loc="21"] (replacing 21 with whatever Australian area you’re querying). The result can be viewed on this page.

Styling the Result

We didn’t want to provide °C or °F extension as a default option because it limits the way in which you can present data. For example, the temperature in Sydney is currently 21°C (70°F) … but I could also just write that it’s currently 21 degrees.

SYD 21°C

In this example we have a string with the location, temperature, dew-point, and QNH:

YSBK T21 DP19 Q1002

The degrees symbol can be created with the string of °. To add it with your shortcode, use [temperature loc="yssy" temp="1" degrees="1"].

Showing Metar Reports in Widgets

There’s are a couple of plugins that don’t do anything other than provide a widget for various reports. We’ve avoided this in the first instance because shortcodes give you more freedom in how you format data and seriously flexibility in where you place it.

Since WordPress doesn’t enable shortcodes in Widget areas by default, we’ve provided an option to enable the functionality. Navigate your way to  Settings  Metar Shortcode  (once the plugin is activated) and you’ll see the following option.

Metar

If your shortcodes are showing up in Widgets as plain text, and only if they’re showing as text (and not rendering a result), select the option to ‘Yes’ and click  Update » .

You then only have to drag a normal text widget into a sidebar, or another location that supports them, and include your shortcode.

Shortcode Attributes

[taf] and [metar]

loc

The four letter ICAO airport code. Must exist in the NOAA database. For Australian locations, most locations are returned.

tidy

Using tidy="1" will remove line breaks and return the report in a single string. Using tidy="0" will retain line breaks. Tidy by default.

p

By default the report will be returned in paragraph tags. If you’re using any data in an inline sentence, use p="0" to remove them. p="1" (true) by default.

cache

The report will cache locally in your WP database for one hour by default (3600 seconds). To alter the cache period, use cache="1800" – where 1800 is the number of seconds; in this case, 30 minutes.

[temperature]

loc

The four letter ICAO airport code. Must exist in the NOAA database. For Australian locations, most locations are returned.

temp

As detailed above, the temp attribute determines what temperature is returned. Returns &degC by default.

degrees

To include the degrees symbol (°) after the returned temperature, use degrees="1". False by default.

cache

The report will cache locally in your WP database for one hour by default (3600 seconds). To alter the cache period, use cache="1800" – where 1800 is the number of seconds; in this case, 30 minutes.

[qnh]

loc

The four letter ICAO airport code. Must exist in the NOAA database. For Australian locations, most locations are returned.

unit

By default all pressures are returned in hectopascals (or as a QNH). To return in inches of mercury, use unit="0"

cache

The report will cache locally in your WP database for one hour by default (3600 seconds). To alter the cache period, use cache="1800" – where 1800 is the number of seconds; in this case, 30 minutes.

[arfor]

loc

The four letter ICAO airport code. Must exist in the NOAA database. For Australian locations, most locations are returned.

cache

The report will cache locally in your WP database for one hour by default (3600 seconds). To alter the cache period, use cache="1800" – where 1800 is the number of seconds; in this case, 30 minutes.

The plugin will invariably be developed over time. Follow us on Facebook for updates.

Plugin Title: Metar
Description: Display formatted METAR and TAF reports in your WordPress website.
Download (downloaded 2377 times) | Plugin Page