WXforum.net

Web Weather => Weather Website PHP/AJAX scripting => Topic started by: Mearns on February 07, 2019, 05:37:15 AM

Title: METAR display problem
Post by: Mearns on February 07, 2019, 05:37:15 AM
As my Metar display stopped working I applied get-metar-conditions-inc.php Version 1.17.  After years of the cloud level being reported in feet it now shows in metres and I can't work out how to change it back.

In Settings.php I have the temperature set to C.  This is overriding the F setting in wxmetar.php which would give me cloud display in feet and temperature in F and C in the Metar display.

Any ideas appreciated as to how I can get the cloud level back to feet?
Title: Re: METAR display problem
Post by: saratogaWX on February 07, 2019, 11:34:43 AM
You can force it to display Feet for cloud height by changing get-metar-conditions-inc
Code: [Select]
function mtr_get_cloud_cover($part)
{
  global $lang, $Debug, $mtrInfo, $metarPtr, $group, $UOMS;

  // Decodes cloud cover information. This function maybe called several times
  // to decode all cloud layer observations. Only the last layer is saved.
  // Format is SKC or CLR for clear skies, or cccnnn where ccc = 3-letter code and
  // nnn = altitude of cloud layer in hundreds of feet. 'VV' seems to be used for
  // very low cloud layers. (Other conversion factor: 1 m = 3.28084 ft)

  $doMetric = preg_match('|C|', $UOMS['TEMP']);
to
Code: [Select]
function mtr_get_cloud_cover($part)
{
  global $lang, $Debug, $mtrInfo, $metarPtr, $group, $UOMS;

  // Decodes cloud cover information. This function maybe called several times
  // to decode all cloud layer observations. Only the last layer is saved.
  // Format is SKC or CLR for clear skies, or cccnnn where ccc = 3-letter code and
  // nnn = altitude of cloud layer in hundreds of feet. 'VV' seems to be used for
  // very low cloud layers. (Other conversion factor: 1 m = 3.28084 ft)

  $doMetric = preg_match('|C|', $UOMS['TEMP']);
  $doMetric = false;
Title: Re: METAR display problem
Post by: Mearns on February 07, 2019, 11:48:45 AM
Brilliant, Ken - thank you so much!