GithubHelp home page GithubHelp logo

metar-php's Introduction

metar-php

Lightweight library for parsing METAR message

METAR is a format for reporting weather information. A METAR weather report is predominantly used by pilots in fulfillment of a part of a pre-flight weather briefing, and by meteorologists, who use aggregated METAR information to assist in weather forecasting.

From Wikipedia, the free encyclopedia

Installation

$ composer require "jzawadzki/metar-php"

Usage

$metar = new \METAR\Message("EPKK 160030Z 06010KT 8000 BKN060 04/M03 Q1034");

echo $metar->getLocation(); //EPKK
echo $metar->getVisibility(); //8000
echo $metar->getQNH()->toHPa(); //1034
echo $metar->getQNH()->toInHg(); //30.53
echo $metar->getTemperature()->toUnit('C'); //4
echo $metar->getDewPoint()->toUnit('F'); //26.6

$view = new \METAR\View\Text($metar);
echo $view->render();
/*
METAR: EPKK 160030Z 06010KT 8000 BKN060 04/M03 Q1034

Location: EPKK
Day of month: 16 Time: 0030Z

Temperature: 4.0C Dew point: -3.0C
QNH: 1034 hPa (30.53 inHg)
*/

License

MIT

Author

Jerzy Zawadzki https://github.com/jzawadzki

metar-php's People

Contributors

jzawadzki avatar k3a avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

metar-php's Issues

PHP fatal error in PHP 8

The code uses curly brackets to access byte offsets of a string. PHP does not support curly brackets for this any more and instead requires square brackets. So for the code to work in PHP 8 and in older versions of PHP, just use square brackets.

PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /metar-php-0.1.1/src/Message.php on line 88

Offset errors

Notice: Undefined offset: 3 on line 104

Sample used:
KMIA 251453Z 04004KT 10SM FEW035 BKN250 32/22 A3014 RMK AO2 SLP205 TCU DSNT SE T03170222 50006

PHP5.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.