Git Product home page Git Product logo

metarparser's People

Contributors

actions-user avatar codacy-badger avatar deepsourcebot avatar dependabot-preview[bot] avatar f-loris avatar grogdunn avatar imgbotapp avatar jbujalance avatar mivek avatar paulwalkeruk avatar renovate[bot] avatar tkelley-eg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

metarparser's Issues

Parse Ceiling Height at Second Location in remarks

Ceiling height at second location is encoded: CIG_hhh_[LOC] where

  • CIG is the remark identifier
  • hhh is the height of the ceiling in hundreds of feet
  • [LOC] is the specific location of the ceilometer

Example: CIG 002 RWY11

Parse peak wind in remarks

Peak wind in remarks are encoded as is PK WND_dddff(f)/(hh)mm
PK WND is the remark identifier
ddd is the direction of the wind in degrees
ff(f) is the peak wind speed with the same unit than the wind element
hh is the hour of the occurrence, it is omitted if the hour of the event.
mm is the minutes of the occurrence.

Example: PK WND 28045/15

Deploy to maven central

I'm always frustrated when I would like to use library and there is no easy way to grab it from maven repository.

I would like to suggest that you can deploy lib to maven central.

Or any other public repository you like.

Parse tornadic activity in remark

A tornadic activity in taf is encoded TORNADIC_ACTIVITY B/E(hh)mm LOC/DIR MOV
where

  • TORNADIC_ACTIIVTY represents the activity: TORNADO, FUNNEL CLOUD or WATERSPROUT
  • B/E denotes the beginning or the ending time of the event
  • (hh)mm represents the time of the event hh can be omitted.
  • LOC/DIR represents the location/direction of the event
  • MOV represents the movement (non-required) in the event.

Example: TORNADO B13 6 NE

Parsing TEMPO clause in METAR

In the example in the ReadMe, it gives a METAR of:

LFPG 131830Z 19005KT 170V250 9999 -SHRA FEW040TCU SCT086 16/08 Q1011 TEMPO SCT030TCU

Is the TEMPO clause being parsed? I can't see any reference to it in the data I get back.

Parse Beginning and Ending of Thunderstorms in remarks

Beginning and ending of thunderstorms are encoded TSB(hh)mmE(hh)mm where

  • TS indicates thunderstorm
  • B denotes the beginning
  • E denotes the ending
  • (hh)mm represents the times. hh is not mandatory.

Examples:
TSB0159E30

Unit for cloud height

It looks like the cloud height is being converted approximately into metres (the numbers from the METAR are in hundreds of feet, which the library multiplies by 30, to give an approximation for metres). Since the METAR reports it in feet, I'm wondering if this library should return it in the same unit, and just let the user of the library worry about converting it if they want to?

For example, cloud in the METAR as BKN003 gets the height returned by this library as 90 whereas I originally expected to get 300.

I don't mind if you want to leave it as it is - I can just convert it back again myself

Include the wind shear when parsing wind

Is your feature request related to a problem? Please describe.

If you parse the following TAF event:

TAF KMKE 011530 0116/0218 WS020/24045KT

it will fail with the following exception:

java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 0
	at com.mivek.parser.AbstractParser.parseWind(AbstractParser.java:161)
	at com.mivek.parser.AbstractParser.generalParse(AbstractParser.java:294)
	at com.mivek.parser.TAFParser.processGeneralChanges(TAFParser.java:152)
	at com.mivek.parser.TAFParser.parse(TAFParser.java:114)
	at com.mivek.parser.TAFParser.parse(TAFParser.java:22)
	at com.mivek.facade.TAFFacade.decode(TAFFacade.java:33)
...

Describe the solution you'd like
It would be nice to include the wind shear as part of the project.

More info on wind shear:
Optional Data (Wind Shear)
Wind shear is the forecast of non-convective low level winds (up to 2000 feet) and is entered after the sky conditions when wind shear is expected. The forecast includes the height of the wind shear followed by the wind direction and wind speed at the indicated height. Height is given in hundreds of feet AGL up to and including 2,000 feet. Wind shear is encoded with the contraction WS followed by a three-digit height, slant character, and winds at the height indicated in the same format as surface winds. The wind shear element is omitted if not expected to occur.

Example:

  • WS010/18040KT - Low level wind shear at one thousand, wind one eight zero at four zero.

AMD TAF are not parsed

Describe the bug
When parsing a TAF containing AMD (amended forecast), an exception is thrown.

To Reproduce
Try to parse the following TAF with TAFParser.getInstance().parse().

      TAF AMD LFPO 100742Z 1007/1112 21018G35KT 9999 BKN025 
      TEMPO 1007/1009 4000 RA BKN014 SCT020CB PROB40 
      TEMPO 1007/1009 22020G45KT 
      TEMPO 1010/1017 24022G45KT SHRA SCT030CB PROB30 
      TEMPO 1012/1016 -TSRA 
      BECMG 1020/1023 24013KT SCT023 
      TEMPO 1104/1112 4000 -SHRA BKN012 BKN020TCU

Expected behavior
The result should be a valid TAF object not an IndexOutOfBoundException

Additional context
Cause is that AMD is not recognized by the parser.

NPE when getting Vertical Visibility

The value for fVerticalVisibility in the AbstractWeatherContainer is stored as an Integer, but the return type of the getVerticalVisibility is an int.

This causes a NullPointerException if we call the getVerticalVisibility function when the fVerticalVisibility has never been set.

Exception in thread "main" java.lang.NullPointerException
	at com.mivek.model.AbstractWeatherContainer.getVerticalVisibility(AbstractWeatherContainer.java:107)
        ...

I think the return type of the getVerticalVisibility should be changed to Integer, to allow the user to handle null values for the fVerticalVisibility.

Parse obscurations in remarks

Obscurations in remarks are encoded wwNNNhhh where

  • ww is the weather causing the obscuration
  • NNN is the application sky cover amount of the obscuration (FEW, SCT, BKN, OVC) or at the surface (FEW, SCT, BKN)
  • hhh is the applicable height in hundreds of feet.

Examples
FG SCT000
FU BKN020

Parsing Wind Direction

When parsing a METAR where the wind is 30005, the only thing I get back in the Metar object about the direction is "North West". I'd like to be able to get back 300.

What do you think about adding this? I don't mind having a go at it if you're in agreement

Parse sea level pressure in remarks

In remarks sea level pressure are encoded SLPppp where SLP is the remark identifier and ppp is the pressure

If ppp starts with 1, add 10 before ppp and put a comma before last number
If ppp starts with 9, add 9 before ppp and put a comma before last number.
Eg:

  • SLP134 => 1013,4
  • SLP998 => 999,8

SLPNO means sea-level pressure is not available

Visibility is not parsed if its in nautical miles

Describe the bug
A visibility in a TAF event is not parsed if it is in nautical miles

To Reproduce
Parse the following TAF event:

TAF CZBF 300939Z 3010/3022 VRB03KT 6SM -SN OVC015 
TEMPO 3010/3012 11/2SM -SN OVC009 FM301200 10008KT 2SM -SN OVC010 
TEMPO 3012/3022 3/4SM -SN VV007 RMK FCST BASED ON AUTO OBS. NXT FCST BY 301400Z

Expected behavior
The visibility for the main event should be 6SM, not null
The visibility for the first TEMPO event should be 11/2SM, not null
The visibility for the second TEMPO event should be 3/4SM, not null

Parse RMK in TAF event

Describe the bug
The remarks in a TAF event are parsed as weather conditions

To Reproduce
Parse the following TAF event:

TAF CZBF 300939Z 3010/3022 VRB03KT 6SM -SN OVC015 
TEMPO 3010/3012 11/2SM -SN OVC009 FM301200 10008KT 2SM -SN OVC010 
TEMPO 3012/3022 3/4SM -SN VV007 RMK FCST BASED ON AUTO OBS. NXT FCST BY 301400Z

Expected behavior
The weather conditions should just include light snow, however the 'FC' is being parsed from the RMK string and being interpreted as a funnel cloud.

{
    ...
		"weatherConditions": [{
			"valid": true,
			"intensity": "LIGHT",
			"phenomenons": ["SNOW"]
		}, {
			"valid": true,
			"phenomenons": ["FUNNEL_CLOUD"]
		}, {
			"valid": true,
			"phenomenons": ["FUNNEL_CLOUD"]
		}],
		"verticalVisibility": 700
	}],
    ...
}

I'm not sure if TAF events should include RMK sections, so maybe it's an operator error by the creator of the TAF event.

Parse variable ceiling height in remark

Variable ceiling height are encoded CIG hhhVddd where

  • CIG is the remark identifier
  • hhh is the lowest ceiling value in feet
  • ddd is the highest ceiling value in feet

Example: CIG 005V010

Parse beginning and ending of precipitation in remark

Beginning and ending of precipitation are encoded: wwB(hh)mmE(hh)mm
where

  • ww represents the type of precipitation
  • B denotes the beginning, E the ending
  • (hh)mm represents the time. hh is not mandatory.

The descriptive can also be encoded, multiple precipitations can be encoded in one block.
Examples:
RAB05E30SNB20E55
SHRAB05E30SHSNB20E55

Parse VIRGA in remark

Virga in remark are encoded VIRGA_(DIR) where

  • VIRGA is the remark identifier
  • DIR is the direction (optional)

Example:
VIRGA
VIRGA SW

Usage Examples?

Do you have any examples of how to use this library please?

Parse Thunderstorm Location in remarks

Thunderstorm Location is encoded TS_LOC_(MOV_DIR) where

  • TS identifies the thunderstorm activity
  • LOC is the location of the thunderstorm from the station
  • MOV DIR is the movement of the thunderstorm if known

Example: TS SE MOV NE

Parse Wind Shift in remark

Wind shift are encoded as WSHFT_(hh)mm FROPA
WSHFT is the remark identifier
hh is the hour of the event, omitted if the hour is the same than the event.
mm is the minute of the event.
FROPA is optional and is present if the wind shift is the result of a frontal passage.

Better error management

Create a sub-exception class in order to better handle error.
Create error codes corresponding to different types of error.
Use error codes and the new exception instead of returning null when parsing.

Visibility at second location

Visibility at second location is encoded VIS vvvvv [LOC] where VIS is the remark identifier, vvvvv is the visibility value and [LOC] is the location of the visibility sensor.

Example: VIS 2 1/2 RWY11

Parse tower visibility in remark

Tower visibility in remarks is encoded TWR VIS vvvvv where vvvvv is the visibility in statute miles
Examples:

  • TWR VIS 1 1/2
  • TWR VIS 16 1/2
  • TWR VIS 2

Handle NSC token

Currently when a code contains the token NSC (No Significant Cloud), it is not parsed.
Improve the current parse method so that this token is recognized

Parse AO1 and AO2 tokens in RMK

When parsing remarks tokens AO1 and AO2 tokens are not parsed

These tokens are encoded in automated stations.
AO1 means automated stations without a precipitation discriminator.
AO2 means automated stations with a precipitation discriminator.

Parse sector visibility in remarks

Sector visibility is encoded VIS [DIR] vvvvv where VIS is the remark identifier, [DIR] is the sector to 8 points of the compass, vvvvv is the sector visibility in statute miles.

Example: VIS NE 2 1/2

Parsing variable (VRB) wind direction

I seem to be encountering errors when trying to parse a METAR that has the wind direction as VRB.

As a quick test, I confirmed the JUnit tests pass by running via Maven. I then added this to AbstractParserTest.java:

@Test
public void testParseWindVariable() {
    String windPart = "VRB08KT";

    Wind res = getSut().parseWind(windPart);

    assertNotNull(res);

}

When I ran the JUnit tests again from Maven, I got:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.mivek.facade.MetarFacadeTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.154 sec
Running com.mivek.model.AirportTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
Running com.mivek.parser.MetarParserTest
Tests run: 15, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.184 sec <<< FAILURE!
testParseWindVariable(com.mivek.parser.MetarParserTest)  Time elapsed: 0.017 sec  <<< ERROR!
java.lang.ArrayIndexOutOfBoundsException: 1
	at com.mivek.parser.AbstractParser.parseWind(AbstractParser.java:142)
	at com.mivek.parser.AbstractParserTest.testParseWindVariable(AbstractParserTest.java:121)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Parse Variable Sky Condition in remarks

Variable sky conditions are encoded NNNhhhVMMM where

  • NNN is the sky condition
  • hhh is the layer height if there are several layers with the same sky conditions amount (not mandatory)
  • MMM is the sky condition

Examples:
BKN014 V OVC

Visibility not parsed

Describe the bug
I try to parse this Metar String:

METAR LSZL 300320Z AUTO 00000KT 9999NDV BKN060 OVC074 00/M04 Q1001
RMK=

But the visibility 9999 is not parsed?

To Reproduce
Parse above Metar String

Expected behavior
I would think that the the visibilty in the metar object is set to 9999.

Parse hail size in remark

Hail size is encoded GR [size] where

  • GR is the remark identifier
  • [size] is the diameter of the largest hailstone

Examples:
GR 1 3/4
GR LESS THAN 1/4

Update the airports database

Is your feature request related to a problem? Please describe.
The current airports.dat file does not contain some airport codes such as GQNO. This causes the parser to fail when processing any events from this airport.

Describe the solution you'd like
Update the airports.dat file with the latest openflights data

Clouds enhancement

This epics is about completing the cloud management by

  • Adding new types of cloud
  • Adding new quantity of cloud (NSC)
  • Parsing incomplete clouds and inform the user

Parse CAVOK

Is your feature request related to a problem? Please describe.
A taf event can contain a CAVOK (Cloud and visibility are ok) signal, this means that the visibility is greater the 10km and there are no significant clouds.
Currently the parser does not make this information accessible to the user.

Describe the solution you'd like
Have a boolean possibly, showing that the event contained a CAVOK signal.

Describe alternatives you've considered
Alternatively it could be fixed so that the visibility is set to >10km

Error when using retrieveFromAirport in MetarFacade and TAFFacade

Describe the bug
When using the retrieveFromAirport method from class MetarFacade or TAFFacade, an error index out of bound is thrown.

To Reproduce
Call MetarFacade.getInstance().retrieveFromAirport

Expected behavior
The parsed metar object should be returned

Additional context
The problem comes from the URL that is now using https instead of http.

License?

I'm interested in using this library as part of a piece of software I'm writing. I haven't decided yet whether I'll keep it private for personal use or make it public via GitHub. However, I'm conscious that there isn't a license included with your library.

My understanding is that without a license granting permission, I can't technically use it (see for example https://choosealicense.com/no-permission/). Please could you consider adding a license to the project (https://choosealicense.com/ is pretty good at summarising the options)?

Parse snow pellet intensity

Snow pellet intensity are encoded GS [intensity] where

  • GS is the remark identifier
  • [intensity] is the intensity: LGT, MOD, HVY

Add new Cloud types

Add the following types:

  • Cirrus (CI)
  • Cirrocumulus (CC)
  • Cirrostratus (CS)
  • Altocumulus (AC)
  • Stratus (ST)
  • Cumulus (CU)
  • Altostratus (AS)
  • Nimbostratus (NS)
  • Stratocumulus (SC)
    And their translation.

Parse snow increasing rapidly

Snow increasing rapidly is encoded SNINCR_[inches-hour/inches on ground]
where

  • SNINCR is the remark identifier
  • [inches-hour] is the depth increase in the past hour
  • [inches on ground] is the total depth of snow at the report time

Eg: SNINCR 2/10

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.