SafranCassiopee / csharp-metar-display

GNU General Public License v3.0
1 stars 2 forks source link

C# METAR display

Build status Coverage Status Latest Stable Version NuGet

A .NET library to display METARs in human-readable strings, fully unit tested (100% code coverage)

They use csharp-metar-display in production:

Introduction

This piece of software is a library package that translates METAR to human-readable strings.

METAR is a format made for weather information reporting. METAR weather reports are predominantly used by pilots and by meteorologists, who use it to assist in weather forecasting. Raw METAR format is highly standardized through the International Civil Aviation Organization (ICAO).

Requirements

This library package only requires .NET >= 4.5

It is currently tested automatically for .NET >= 4.5 using nUnit 3.10.1.

Although this is provided as a library project, a command line version (csharp-metar-display.cmd) is also included that can be used as both an example and a starting point. csharp-metar-display.cmd requires CommandLineParser.

Usage:

csharp-metar-display.cmd.exe --Metar "CYFB 271515Z 32017KT 3SM DRSN BKN040 M29/M34 A2957 RMK SC7 SLP019"

Observation Date: 27 day of the month at 15:15 UTC
Wind: from 320 degrees (northeast) at 17 knots
Visibility: 4828.02 meters
Temperatures: temperature -29°C (-20.2°F), dew point: -34°C (-29.2°F)
Pressure: 1001 hPa (30 inHg)
Clouds: broken at 4000 feet (1219 meters)
csharp-metar-display.cmd.exe --Metar "CYFB 271515Z 32017KT 3SM DRSN BKN040 M29/M34 A2957 RMK SC7 SLP019" --Culture "fr-FR"

Date d'observation: Jour 27 du mois à 15:15 UTC
Vent: de 320 degrés (nord-est) à 17 nouds
Visibilité: 4828.02 mètres
Températures: température -29°C (-20.2°F), point de rosée: -34°C (-29.2°F)
Pression: 1001 hectopascal (30 millimètres de mercure)
Nuages: fragmenté à 1219 mètres (4000 pieds)

If you want to integrate the library easily in your project, you should consider using the official nuget package available from https://www.nuget.org/.

nuget install csharp-metar-display

It is not mandatory though.

Setup

From the Package Manager Console in Visual Studio

nuget install csharp-metar-display

Add a reference to the library, then add the following using directives:

using csharp-metar-display;

Download the latest release from github

Extract it wherever you want in your project. The library itself is in the csharp-metar-display/ directory, the other directories are not mandatory for the library to work.

Add the csharp-metar-display project to your solution, then add a reference to it in your own project. Finally, add the same using directives than above.

Usage

Call the MetarDisplay.GetWeatherMessage with your METAR as the first parameter (other parameters are optional and should be self-explanatory anyway). The returned string is your METAR in a human-readable form.

Contribute

If you find a valid METAR that is badly parsed by this library, please open a github issue with all possible details:

If you want to improve or enrich the test suite, fork the repository and submit your changes with a pull request.

If you have any other idea to improve the library, please use github issues or directly pull requests depending on what you're more comfortable with.

In order to contribute to the codebase, you must fork the repository on github, than clone it locally with:

git clone https://github.com/<username>/csharp-metar-display

Install all the dependencies using nuget :

nuget restore csharp-metar-display\

You're ready to launch the test suite with:

nunit-console.exe /xml:results.xml csharp-metar-display.tests\bin\debug\csharp-metar-display.tests.dll

This library is fully unit tested, and uses nUnit to launch the tests.

Appveyor is used for continuous integration, which triggers tests for .NET 4.5 for each push to the repo.