Giter Site home page Giter Site logo

metarparser's Introduction

Master: Build Status Develop: Build Status Maintainability Test Coverage

MetarParser

This java lib provides a Metar and TAF decoder.

Use the MetarFacade class and its method decode to decode a metar. Use the MetarFacade class and its method retrieveFromAirport to get the metar of an airport. This metod take the icao code as parameter. The trends of the metar are not parsed.

Table of content

  1. Adding dependency
  2. Model
    1. Enumerations
    2. Classes
  3. Examples
    1. Parse a metar
    2. Retrieve a metar
    3. Parse a taf
    4. Retrieve a taf
  4. Internationalization

Adding the dependency

<dependency>
  <groupId>io.github.mivek</groupId>
  <artifactId>metarParser</artifactId>
  <version>1.4</version>
</dependency>

Or check here if you are not using maven.

Model

The model is generated by using the Eclipse visualization tool ObjectAid. When updating classes in packages io.github.mivek.enums or io.github.mivek.model, the class diagram is also updated. When added a new class/enumeration in one of those package, drag and drop the new class to model.ucls and generate a new jpeg of the class diagram. class diagram

Enumerations

The application contains numerous enumarations to represent datas.

  • CloudType: to represent the type of cloud.
  • CloudQuantity: to represent the amount of clouds.
  • Intensity: to represent the intensity of a meteorological phenomenon.
  • Descriptive: to represent the descriptive of a meteorological phenomenon.
  • Phenomenon: to represent a phenomenon.
  • WeatherChangeTime: to represent a trend.
  • TimeIndicator: to represent the time of the trend.

Classes

Airport

The airport class is composed of

  • Name
  • City
  • Country
  • IATA code
  • ICAO code
  • latitude
  • longitude
  • altitude
  • timezone

Cloud

In this application a cloud is composed of

  • CloudQuantity
  • CloudType (optional)
  • height (optional)

Country

A country is represented by its name.

Runway information

The runway information is composed of

  • The name of the runway
  • The minimal visibility on the runway
  • The maximal visibility on the runway (optional)
  • The trend of the visibility (optional)

Visibility

The visibility class is composed of

  • The main visibility
  • The minimal visibility (optional)
  • The direction of the minimal visibility (optional)

WeatherCondition

The weather condition is class to represent a meteorological phenomenon. A weather condition is composed of

  • an intensity (optional)
  • a descriptive (optional)
  • a list of phenomenon

Wind

The wind class is composed of

  • the speed
  • the direction
  • the speed of the gust
  • the minimal wind variation in degrees
  • the maximal wind variation in degrees
  • the unit of the wind's speed

WindShear

This class is a subclass of Wind. It is composed of

  • the height of the wind shear.

Trends

trends diagram Numerous classes represents the trends. Trends are stored inside a list of the metar object Metar.getTrends(). Trends are composed of

  • a Type (BECMG or TEMPO)
  • a wind
  • a visibility and vertical visibility
  • a list of clouds
  • a list of weather conditions
  • a list of AbstractMetarTrendTime to represent the time with its type (AT, FM, TL)

Examples

Parse a metar

Instantiate the metarFacade and use its method parse.

String code = "LFPG 131830Z 19005KT 170V250 9999 -SHRA FEW040TCU SCT086 16/08 Q1011";
MetarFacade facade = MetarFacade.getInstance();
Metar metar = facade.decode(code);

Retrieve the metar of an airport

Instantiate the metarFacade. Use the its method retrieveFromAirport with the ICAO code of the airport.

String icao = "LFPG";
MetarFacade facade = MetarFacade.getInstance();
Metar metar = facade.retrieveFromAirport(icao);

Parse a taf

Use the TAFFacade to decode the taf.

String message = "TAF LFPG 150500Z 1506/1612 17005KT 6000 SCT012 \n" 
                  +"TEMPO 1506/1509 3000 BR BKN006 PROB40 \n"
                  +"TEMPO 1506/1508 0400 BCFG BKN002 PROB40 \n"
                  +"TEMPO 1512/1516 4000 -SHRA FEW030TCU BKN040 \n" 
                  +"BECMG 1520/1522 CAVOK \n"
                  +"TEMPO 1603/1608 3000 BR BKN006 PROB40 \n"
                  +"TEMPO 1604/1607 0400 BCFG BKN002 TX17/1512Z TN07/1605Z";
TAFFacade facade = TAFFacade.getInstance();
TAF taf = facade.decode(message);

Lines of the message have to be separated by a "\n" character.

Retrieve a taf

Use the TAFFacade and the method retrieveFromAirport with the ICAO code of the airport.

String icao = "LFPG";
TAFFacade facade = TAFFacade.getInstance();
TAF taf = facade.retrieveFromAirport(icao);

Internationalization

English and french locales are supported by the library. The library uses the user's locale. The default locale is english.

Change the locale

To change the locale use the method setLocale(Locale) of the class Messages.java

Messages.getInstance().setLocale(Locale.FRENCH); // Changes the locale to french.

If you are willing to add a new locale please see Contributing.md file.

metarparser's People

Contributors

codacy-badger avatar efueger avatar jbujalance avatar mivek avatar paulwalkeruk avatar

Watchers

 avatar

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.