From eae5989845e95f6a5d079192bfe7f48c85110996 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Sat, 7 Apr 2018 09:05:06 -0500 Subject: [PATCH] Replace METAR data with custom class --- app/Support/Metar.php | 15 ++ app/Widgets/Weather.php | 23 +-- composer.json | 3 +- composer.lock | 188 +++++++----------- .../layouts/default/widgets/weather.blade.php | 72 ++++--- tests/MetarTest.php | 13 +- 6 files changed, 151 insertions(+), 163 deletions(-) diff --git a/app/Support/Metar.php b/app/Support/Metar.php index 59419eee..9421ae1d 100644 --- a/app/Support/Metar.php +++ b/app/Support/Metar.php @@ -41,6 +41,7 @@ class Metar 'observed_day' => null, 'observed_time' => null, 'observed_age' => null, + 'category' => null, 'wind_speed' => null, 'wind_gust_speed' => null, 'wind_direction' => null, @@ -63,6 +64,7 @@ class Metar 'clouds_report' => null, 'clouds_report_ft' => null, 'cloud_height' => null, + 'cloud_height_ft' => null, 'cavok' => null, 'temperature' => null, 'temperature_f' => null, @@ -75,6 +77,7 @@ class Metar 'wind_chill_f' => null, 'barometer' => null, 'barometer_in' => null, + 'barometer_mb' => null, 'recent_weather' => null, 'recent_weather_report' => null, 'runways_report' => null, @@ -428,6 +431,16 @@ class Metar } } + // Finally determine if it's VFR or IFR conditions + // https://www.aviationweather.gov/cva/help + if($this->result['cavok'] + || ($this->result['cloud_height_ft'] > 3000 && $this->result['visibility_nm'] > 5)) + { + $this->result['category'] = 'VFR'; + } else { + $this->result['category'] = 'IFR'; + } + return $this->result; } @@ -951,6 +964,7 @@ class Metar // Cloud height if (null === $this->result['cloud_height'] || $observed['height'] < $this->result['cloud_height']) { $this->set_result_value('cloud_height', $observed['height']); + $this->set_result_value('cloud_height_ft', $observed['height_ft']); } if (isset(static::$cloud_codes[$found[4]])) { @@ -1061,6 +1075,7 @@ class Metar } $this->set_result_value('barometer', $pressure); // units are hPa + $this->set_result_value('barometer_mb', $pressure); // units are hPa $this->set_result_value('barometer_in', round(0.02953 * $pressure, 2)); // convert to in Hg $this->method++; diff --git a/app/Widgets/Weather.php b/app/Widgets/Weather.php index 9aa6803d..5adf0bfb 100644 --- a/app/Widgets/Weather.php +++ b/app/Widgets/Weather.php @@ -3,13 +3,7 @@ namespace App\Widgets; use App\Interfaces\Widget; -use App\Support\Http; -use App\Support\MetarWrapper; -use App\Support\Units\Distance; -use App\Support\Units\Temperature; -use Illuminate\Support\Facades\Cache; -use MetarDecoder\MetarDecoder; -use SimpleXMLElement; +use App\Support\Metar; /** * This is a widget for the 3rd party CheckWX service @@ -23,17 +17,6 @@ class Weather extends Widget public const URL = 'https://avwx.rest/api/metar/'; - /** - * Determine the category depending on the rules for visibility/ceiling - * https://www.aviationweather.gov/cva/help - * @param $metar - * @return string - */ - protected function determineCategory($metar): string - { - - } - /** * Attempt to get the data from the CheckWX API */ @@ -50,14 +33,12 @@ class Weather extends Widget $raw_metar = $metar_class->get_metar($this->config['icao']); if ($raw_metar && $raw_metar !== '') { - $metar = new MetarWrapper($raw_metar); - $wind = $metar->getWinds(); + $metar = Metar::parse($raw_metar); } return view('widgets.weather', [ 'config' => $this->config, 'metar' => $metar, - 'wind' => $wind, 'unit_alt' => setting('units.altitude'), 'unit_dist' => setting('units.distance'), 'unit_temp' => setting('units.temperature'), diff --git a/composer.json b/composer.json index c4fb8f6e..f929c0b8 100755 --- a/composer.json +++ b/composer.json @@ -38,8 +38,7 @@ "akaunting/money": "^1.0", "igaster/laravel-theme": "^2.0", "anhskohbo/no-captcha": "^3.0", - "league/csv": "^9.1", - "safran-cassiopee/php-metar-decoder": "^0.7.0" + "league/csv": "^9.1" }, "require-dev": { "phpunit/phpunit": "~7.0", diff --git a/composer.lock b/composer.lock index 11cddd4a..11e440cf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "fd9f4121a32ed91cda47e6f5a5df3bd8", + "content-hash": "60281a4e1830c6c5a9a9338b02936d30", "packages": [ { "name": "akaunting/money", @@ -619,23 +619,23 @@ }, { "name": "dragonmantank/cron-expression", - "version": "v2.0.0", + "version": "v2.1.0", "source": { "type": "git", "url": "https://github.com/dragonmantank/cron-expression.git", - "reference": "8a84aee649c3a3ba03a721c1fb080e08dfbcd68b" + "reference": "3f00985deec8df53d4cc1e5c33619bda1ee309a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/8a84aee649c3a3ba03a721c1fb080e08dfbcd68b", - "reference": "8a84aee649c3a3ba03a721c1fb080e08dfbcd68b", + "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/3f00985deec8df53d4cc1e5c33619bda1ee309a5", + "reference": "3f00985deec8df53d4cc1e5c33619bda1ee309a5", "shasum": "" }, "require": { "php": ">=7.0.0" }, "require-dev": { - "phpunit/phpunit": "~5.7" + "phpunit/phpunit": "~6.4" }, "type": "library", "autoload": { @@ -664,7 +664,7 @@ "cron", "schedule" ], - "time": "2017-10-12T15:59:13+00:00" + "time": "2018-04-06T15:51:55+00:00" }, { "name": "egulias/email-validator", @@ -1651,16 +1651,16 @@ }, { "name": "league/flysystem", - "version": "1.0.43", + "version": "1.0.44", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "1ce7cc142d906ba58dc54c82915d355a9191c8a8" + "reference": "168dbe519737221dc87d17385cde33073881fd02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/1ce7cc142d906ba58dc54c82915d355a9191c8a8", - "reference": "1ce7cc142d906ba58dc54c82915d355a9191c8a8", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/168dbe519737221dc87d17385cde33073881fd02", + "reference": "168dbe519737221dc87d17385cde33073881fd02", "shasum": "" }, "require": { @@ -1731,7 +1731,7 @@ "sftp", "storage" ], - "time": "2018-03-01T10:27:04+00:00" + "time": "2018-04-06T09:58:14+00:00" }, { "name": "league/geotools", @@ -2214,16 +2214,16 @@ }, { "name": "paragonie/random_compat", - "version": "v2.0.11", + "version": "v2.0.12", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" + "reference": "258c89a6b97de7dfaf5b8c7607d0478e236b04fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", - "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/258c89a6b97de7dfaf5b8c7607d0478e236b04fb", + "reference": "258c89a6b97de7dfaf5b8c7607d0478e236b04fb", "shasum": "" }, "require": { @@ -2241,7 +2241,7 @@ "lib/random.php" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -2258,7 +2258,7 @@ "pseudorandom", "random" ], - "time": "2017-09-27T21:40:39+00:00" + "time": "2018-04-04T21:24:14+00:00" }, { "name": "php-http/discovery", @@ -3005,46 +3005,6 @@ ], "time": "2017-03-25T12:08:31+00:00" }, - { - "name": "safran-cassiopee/php-metar-decoder", - "version": "v0.7", - "source": { - "type": "git", - "url": "https://github.com/SafranCassiopee/php-metar-decoder.git", - "reference": "ed920c93a6025af9bf6787af7683246c37b1d648" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/SafranCassiopee/php-metar-decoder/zipball/ed920c93a6025af9bf6787af7683246c37b1d648", - "reference": "ed920c93a6025af9bf6787af7683246c37b1d648", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "4.3.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "MetarDecoder\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-3.0+" - ], - "authors": [ - { - "name": "Edouard de Labareyre", - "email": "edouard@melix.net", - "role": "Developer" - } - ], - "description": "METAR weather observation decoder", - "time": "2016-03-18T21:37:22+00:00" - }, { "name": "santigarcor/laratrust", "version": "5.0.9", @@ -3290,7 +3250,7 @@ }, { "name": "symfony/console", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", @@ -3358,7 +3318,7 @@ }, { "name": "symfony/css-selector", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -3411,7 +3371,7 @@ }, { "name": "symfony/debug", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", @@ -3467,7 +3427,7 @@ }, { "name": "symfony/dom-crawler", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", @@ -3523,16 +3483,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "85eaf6a8ec915487abac52e133efc4a268204428" + "reference": "63353a71073faf08f62caab4e6889b06a787f07b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/85eaf6a8ec915487abac52e133efc4a268204428", - "reference": "85eaf6a8ec915487abac52e133efc4a268204428", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/63353a71073faf08f62caab4e6889b06a787f07b", + "reference": "63353a71073faf08f62caab4e6889b06a787f07b", "shasum": "" }, "require": { @@ -3582,20 +3542,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-02-14T14:11:10+00:00" + "time": "2018-04-06T07:35:43+00:00" }, { "name": "symfony/finder", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "c72995d9f5999b3fcdd8660c0c9690243252e1e1" + "reference": "ca27c02b7a3fef4828c998c2ff9ba7aae1641c49" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/c72995d9f5999b3fcdd8660c0c9690243252e1e1", - "reference": "c72995d9f5999b3fcdd8660c0c9690243252e1e1", + "url": "https://api.github.com/repos/symfony/finder/zipball/ca27c02b7a3fef4828c998c2ff9ba7aae1641c49", + "reference": "ca27c02b7a3fef4828c998c2ff9ba7aae1641c49", "shasum": "" }, "require": { @@ -3631,11 +3591,11 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-04-02T09:52:41+00:00" + "time": "2018-04-04T05:10:37+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", @@ -3688,16 +3648,16 @@ }, { "name": "symfony/http-kernel", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "38337d03a554a2b0e9f553d368723692b7c04a8f" + "reference": "6dd620d96d64456075536ffe3c6c4658dd689021" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/38337d03a554a2b0e9f553d368723692b7c04a8f", - "reference": "38337d03a554a2b0e9f553d368723692b7c04a8f", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/6dd620d96d64456075536ffe3c6c4658dd689021", + "reference": "6dd620d96d64456075536ffe3c6c4658dd689021", "shasum": "" }, "require": { @@ -3770,11 +3730,11 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2018-04-03T06:20:33+00:00" + "time": "2018-04-06T16:25:03+00:00" }, { "name": "symfony/inflector", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/inflector.git", @@ -3945,7 +3905,7 @@ }, { "name": "symfony/process", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -3994,7 +3954,7 @@ }, { "name": "symfony/property-access", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", @@ -4061,16 +4021,16 @@ }, { "name": "symfony/routing", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "ca780c838046bfef4a6fd50284ae71a5d1f1a8b2" + "reference": "0663036dd57dbfd4e9ff29f75bbd5dd3253ebe71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/ca780c838046bfef4a6fd50284ae71a5d1f1a8b2", - "reference": "ca780c838046bfef4a6fd50284ae71a5d1f1a8b2", + "url": "https://api.github.com/repos/symfony/routing/zipball/0663036dd57dbfd4e9ff29f75bbd5dd3253ebe71", + "reference": "0663036dd57dbfd4e9ff29f75bbd5dd3253ebe71", "shasum": "" }, "require": { @@ -4135,11 +4095,11 @@ "uri", "url" ], - "time": "2018-04-02T09:52:41+00:00" + "time": "2018-04-04T13:50:32+00:00" }, { "name": "symfony/serializer", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", @@ -4217,7 +4177,7 @@ }, { "name": "symfony/translation", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", @@ -4285,16 +4245,16 @@ }, { "name": "symfony/var-dumper", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "f9b257f2009c7f09166bcfd3d3d96455741ed371" + "reference": "e1b4d008100f4d203cc38b0d793ad6252d8d8af0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/f9b257f2009c7f09166bcfd3d3d96455741ed371", - "reference": "f9b257f2009c7f09166bcfd3d3d96455741ed371", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/e1b4d008100f4d203cc38b0d793ad6252d8d8af0", + "reference": "e1b4d008100f4d203cc38b0d793ad6252d8d8af0", "shasum": "" }, "require": { @@ -4350,11 +4310,11 @@ "debug", "dump" ], - "time": "2018-04-03T05:24:00+00:00" + "time": "2018-04-04T05:10:37+00:00" }, { "name": "symfony/yaml", - "version": "v4.0.7", + "version": "v4.0.8", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -5892,16 +5852,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "6.0.1", + "version": "6.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f8ca4b604baf23dab89d87773c28cc07405189ba" + "reference": "774a82c0c5da4c1c7701790c262035d235ab7856" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f8ca4b604baf23dab89d87773c28cc07405189ba", - "reference": "f8ca4b604baf23dab89d87773c28cc07405189ba", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/774a82c0c5da4c1c7701790c262035d235ab7856", + "reference": "774a82c0c5da4c1c7701790c262035d235ab7856", "shasum": "" }, "require": { @@ -5912,7 +5872,7 @@ "phpunit/php-text-template": "^1.2.1", "phpunit/php-token-stream": "^3.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.0", + "sebastian/environment": "^3.1", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, @@ -5951,7 +5911,7 @@ "testing", "xunit" ], - "time": "2018-02-02T07:01:41+00:00" + "time": "2018-04-06T15:39:20+00:00" }, { "name": "phpunit/php-file-iterator", @@ -6141,16 +6101,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.0.3", + "version": "7.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "536f4d853c12d8189963435088e8ff7c0daeab2e" + "reference": "f7fe5127889519e421600fe0feeb113a5e210f20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/536f4d853c12d8189963435088e8ff7c0daeab2e", - "reference": "536f4d853c12d8189963435088e8ff7c0daeab2e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f7fe5127889519e421600fe0feeb113a5e210f20", + "reference": "f7fe5127889519e421600fe0feeb113a5e210f20", "shasum": "" }, "require": { @@ -6168,7 +6128,7 @@ "phpunit/php-file-iterator": "^1.4.3", "phpunit/php-text-template": "^1.2.1", "phpunit/php-timer": "^2.0", - "phpunit/phpunit-mock-objects": "^6.0", + "phpunit/phpunit-mock-objects": "^6.1", "sebastian/comparator": "^2.1", "sebastian/diff": "^3.0", "sebastian/environment": "^3.1", @@ -6191,7 +6151,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.0-dev" + "dev-master": "7.1-dev" } }, "autoload": { @@ -6217,20 +6177,20 @@ "testing", "xunit" ], - "time": "2018-03-26T07:36:48+00:00" + "time": "2018-04-06T12:39:30+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "6.0.1", + "version": "6.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "e3249dedc2d99259ccae6affbc2684eac37c2e53" + "reference": "3f5ca97eee66a07951d018f6726017629c85c86d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/e3249dedc2d99259ccae6affbc2684eac37c2e53", - "reference": "e3249dedc2d99259ccae6affbc2684eac37c2e53", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3f5ca97eee66a07951d018f6726017629c85c86d", + "reference": "3f5ca97eee66a07951d018f6726017629c85c86d", "shasum": "" }, "require": { @@ -6248,7 +6208,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.0.x-dev" + "dev-master": "6.1-dev" } }, "autoload": { @@ -6273,7 +6233,7 @@ "mock", "xunit" ], - "time": "2018-02-15T05:27:38+00:00" + "time": "2018-04-06T08:14:40+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -6840,7 +6800,7 @@ }, { "name": "symfony/class-loader", - "version": "v3.4.7", + "version": "v3.4.8", "source": { "type": "git", "url": "https://github.com/symfony/class-loader.git", diff --git a/resources/views/layouts/default/widgets/weather.blade.php b/resources/views/layouts/default/widgets/weather.blade.php index e28de67f..460c122b 100644 --- a/resources/views/layouts/default/widgets/weather.blade.php +++ b/resources/views/layouts/default/widgets/weather.blade.php @@ -11,39 +11,57 @@ https://api.checkwx.com/#metar-decoded Conditions - {{ $metar->getCategory() }} - @if($metar->getTemperature()) -   - {{$metar->getTemperature()}}°{{strtoupper($unit_temp)}} - ,  + {{ $metar['category'] }} +   + @if($unit_temp === 'c') + {{$metar['temperature']}} + @else + {{$metar['temperature_f']}} @endif + °{{strtoupper($unit_temp)}} + @if($metar['visibility']) + ,  visibility - {{$metar->getVisibility()}}{{$unit_dist}} + @if($unit_dist === 'km') + {{$metar['visibility'] / 1000}} + @else + {{$metar['visibility_nm']}} + @endif + @endif + {{$unit_dist}} + + @if($metar['humidity']) + ,  + {{ $metar['humidity'] }}% humidity + @endif Barometer - {{ $metar->getPressure('hg') }} Hg - / {{ $metar->getPressure('mb') }} MB - - - - Clouds - @foreach($metar->getClouds() as $cloud) -

- {{$cloud['amount']}} @ {{$cloud['base_height']}} {{ $unit_alt }} -

- @endforeach + {{ $metar['barometer'] }} Hg + / {{ $metar['barometer_in'] * 1000 }} MB + @if($metar['clouds']) + + Clouds + + @if($unit_alt === 'ft') + {{$metar['clouds_report_ft']}} + @else + {{ $metar['clouds_report'] }} + @endif + + + @endif Wind - {{$wind['speed']}} kts - @ {{$wind['direction']}}° - @if($wind['gusts']) - gusts to {{$wind['gusts']}} + {{$metar['wind_speed']}} kts from {{$metar['wind_direction_label']}} + ({{$metar['wind_direction']}}°) + @if($metar['wind_gust_speed']) + gusts to {{ $metar['wind_gust_speed'] }} @endif @@ -51,13 +69,21 @@ https://api.checkwx.com/#metar-decoded METAR
- {{ $metar->getRawMetar() }} + {{ $metar['raw'] }}
+ @if($metar['remarks']) + + Remarks + + {{ $metar['remarks'] }} + + + @endif Updated - {{$metar->getLastUpdate()}} + {{$metar['observed_time']}} ({{$metar['observed_age']}}) @endif diff --git a/tests/MetarTest.php b/tests/MetarTest.php index b065fe68..1bbf70f8 100644 --- a/tests/MetarTest.php +++ b/tests/MetarTest.php @@ -75,8 +75,15 @@ class MetarTest extends TestCase public function testMetar2() { $metar = - 'CYWG 172000Z 30015G25KT 3/4SM R36/4000FT/D -SN ' - .'BLSN BKN008 OVC040 M05/M08 A2992 REFZRA WS RWY36 ' - .'RMK SF5NS3 SLP134'; + 'KJFK 070151Z 20005KT 10SM BKN100 08/07 A2970 RMK AO2 SLP056 T00780067'; + + /** + * John F.Kennedy International, New York, NY (KJFK). Apr 7, 0151Z. Wind from 200° at 5 knots, + * 10 statute miles visibility, Ceiling is Broken at 10,000 feet, Temperature 8°C, Dewpoint 7°C, + * Altimeter is 29.70. Remarks: automated station with precipitation discriminator sea level + * pressure 1005.6 hectopascals hourly temp 7.8°C dewpoint 6.7°C + */ + + $parsed = Metar::parse($metar); } }