Comments (2)
Alright, I think I have identified the cause. Two things I have noted:
-
00000KT
is technically not correctly parsed. The regex only matches the first 4 digits, which means thatVIDP 270200Z 00000MPS
is incorrectly parsed as 0 knots wind (I assume KT is the default unit)
This is technically not related to the original issue, so I opened #80 to track it separately! -
The same regex also matches visibility stubs if the visibility is less than 100 meters. This match occurs later than the wind match, so it looks like the result overrides the real wind value resulting in the originally mentioned issue. I assume that this also means that the visibility parser never runs for this stub, which explains why there is no visibility reported in the output.
from metar-taf-parser.
Ok, so I dug a bit deeper. The culprit seems to be the double zero-digit matcher in the beginning of the regex.
It seems to be there in order to satisfy this test case, which includes an invalid METAR string according to the specifications I can find. As usual, most are not too explicit on the matter but this is one example:
Wind speeds (ff) are two digits (or three digits if required), in knots.
https://meteocentre.com/doc/metar.html
So I guess this is a case of choosing which case to support? If we change the regex by adding an additional required zero:
(VRB|000|[0-3]\d{2})(\d{2})G?(\d{2,3})?(KT|MPS|KM\/H)?
The result is much better, solving several issues:
- Wind unit is correctly registered
- Wind speed is correctly registered (not that it matters, it's all zeros anyway)
- Visibility is no longer incorrectly matched
The downside is that the test case will start to fail. Is the METAR included in that test case a common occurrence? I mean, is it common for real-world METAR reports to report winds calm with only four digits?
from metar-taf-parser.
Related Issues (20)
- Export IMetarDated Type HOT 1
- SPECI not parsed correctly
- Invalid end date in parsed TAF forecast HOT 9
- Suggestion: include raw text for each parameter HOT 2
- Suggestion: station info HOT 2
- Suggestion: consistent treatment of units HOT 4
- Rounding error in altitude conversion? HOT 2
- Cannot parse where visibility is directional HOT 3
- Runway info not provided for R14R/590335
- Cannot parse TAF with station beginning "FM" HOT 3
- Cannot parse "PART x OF y" in NOAA TAF cycle entries HOT 4
- support node HOT 2
- Cannot parse "R29/CLRD70" or "R12/210160" HOT 1
- TimestampOutOfBoundsError: Provided timestamp is outside the report validity period
- Weather conditions are not showing up in remarks
- "Zero wind" (`00000KT`) scenario not completely handled HOT 2
- CommandExecutionError: 0 not found in /,1,2,5,9 HOT 5
- i18n doesn't work HOT 2
- [Spelling Error] local/en.ts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metar-taf-parser.