mivek / metarparser Goto Github PK
View Code? Open in Web Editor NEWA java program decoding metar and taf
Home Page: https://www.metar-taf-decoder.com/
License: MIT License
A java program decoding metar and taf
Home Page: https://www.metar-taf-decoder.com/
License: MIT License
Refactor the common parts of the method parse
Ceiling height at second location is encoded: CIG_hhh_[LOC]
where
CIG
is the remark identifierhhh
is the height of the ceiling in hundreds of feetExample: CIG 002 RWY11
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
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.
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 WATERSPROUTB/E
denotes the beginning or the ending time of the event(hh)mm
represents the time of the event hh
can be omitted.Example: TORNADO B13 6 NE
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.
Pressure rising rapidly is encoded PRESRR
Pressure falling rapidly is encoded PRESFR
Just add keys in messages.properties
Beginning and ending of thunderstorms are encoded TSB(hh)mmE(hh)mm
where
TS
indicates thunderstormB
denotes the beginningE
denotes the endingExamples:
TSB0159E30
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
Use try-with-resources or close this "BufferedReader" in a "finally" clause.
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:
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.
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.
Obscurations in remarks are encoded wwNNNhhh
where
ww
is the weather causing the obscurationNNN
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
Surface visibility in remarks is encoded SFC VIS vvvvv
where vvvvv
is the visibility in statute miles.
For example see #80 .
Following the development of remark parsing, many translations are missing for the german locale
Translations can be filled using this link https://poeditor.com/join/project/kWbkKRuHlr.
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
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:
SLPNO
means sea-level pressure is not available
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
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.
Variable ceiling height are encoded CIG hhhVddd
where
CIG
is the remark identifierhhh
is the lowest ceiling value in feetddd
is the highest ceiling value in feetExample: CIG 005V010
Beginning and ending of precipitation are encoded: wwB(hh)mmE(hh)mm
where
ww
represents the type of precipitationB
denotes the beginning, E the endingThe descriptive can also be encoded, multiple precipitations can be encoded in one block.
Examples:
RAB05E30SNB20E55
SHRAB05E30SHSNB20E55
Following the development of remark parsing, many translations are missing for the polish locale
Translations can be filled using this link https://poeditor.com/join/project/kWbkKRuHlr.
Virga in remark are encoded VIRGA_(DIR)
where
Example:
VIRGA
VIRGA SW
Do you have any examples of how to use this library please?
Thunderstorm Location is encoded TS_LOC_(MOV_DIR)
where
TS
identifies the thunderstorm activityLOC
is the location of the thunderstorm from the stationMOV DIR
is the movement of the thunderstorm if knownExample: TS SE MOV NE
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.
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 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
Tower visibility in remarks is encoded TWR VIS vvvvv
where vvvvv
is the visibility in statute miles
Examples:
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
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.
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
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)
Variable prevailing visibility is encoded VIS dddddVvvvvv
where ddddd
is the lowest visibility and vvvvv
is the highest visibility.
Example: VIS 1/2V2
Variable sky conditions are encoded NNNhhhVMMM
where
NNN
is the sky conditionhhh
is the layer height if there are several layers with the same sky conditions amount (not mandatory)MMM
is the sky conditionExamples:
BKN014 V OVC
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.
Hail size is encoded GR [size]
where
GR
is the remark identifierExamples:
GR 1 3/4
GR LESS THAN 1/4
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
This epics is about completing the cloud management by
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
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.
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)?
Snow pellet intensity are encoded GS [intensity]
where
GS
is the remark identifierAdd the following types:
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 timeEg: SNINCR 2/10
Can you please add my german translation to your project.
https://poeditor.com/join/project/kWbkKRuHlr
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
đ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. đđđ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google â¤ď¸ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.