2019-04-15 13:44:45 +00:00
|
|
|
# Copyright 2005-2019 ECMWF.
|
2014-07-04 13:52:04 +00:00
|
|
|
#
|
|
|
|
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
|
|
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
|
|
#
|
|
|
|
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
|
|
|
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
|
|
|
#
|
|
|
|
|
|
|
|
constant normal="NORMAL";
|
|
|
|
constant correction="CORRECTION";
|
|
|
|
#meta out sprintf("metar_%s.xml",count);
|
|
|
|
|
|
|
|
alias temperatureAndDewpointPresent=zero;
|
|
|
|
alias qnhPresent=zero;
|
|
|
|
alias qnhAPresent=zero;
|
|
|
|
alias qfePresent=zero;
|
|
|
|
alias status=normal;
|
|
|
|
alias isCorrection=zero;
|
|
|
|
alias presentTrend1=zero;
|
|
|
|
alias presentTrend2=zero;
|
|
|
|
alias presentTrend3=zero;
|
|
|
|
alias isAuto=false;
|
|
|
|
alias windPresent=zero;
|
|
|
|
alias nosigPresent=zero;
|
|
|
|
|
|
|
|
position startOfMessage;
|
|
|
|
message_copy theMessage :dump ;
|
|
|
|
|
|
|
|
group identifier; non_alpha na;
|
|
|
|
|
|
|
|
group g : dump; non_alpha na;
|
|
|
|
|
|
|
|
if ( g is "COR" ) {
|
2016-04-04 13:05:00 +00:00
|
|
|
rename(g,cor);
|
|
|
|
alias isCorrection=one;
|
|
|
|
alias status=correction;
|
|
|
|
group g : dump; non_alpha na;
|
2015-07-28 09:50:26 +00:00
|
|
|
}
|
2014-07-04 13:52:04 +00:00
|
|
|
if (length(g) == 4) {
|
2016-04-04 13:05:00 +00:00
|
|
|
include "metar/cccc.def";
|
2014-07-04 13:52:04 +00:00
|
|
|
} else {
|
2016-04-04 13:05:00 +00:00
|
|
|
if (g is "METAR") {
|
|
|
|
rename(g,metarTwice);
|
|
|
|
group g : dump; non_alpha na;
|
|
|
|
if (length(g) == 4) { include "metar/cccc.def"; }
|
|
|
|
else {
|
|
|
|
constant CCCC = "unknown";
|
|
|
|
constant coordinatesPresent = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
constant CCCC = "unknown";
|
|
|
|
constant coordinatesPresent = 0;
|
|
|
|
}
|
2014-07-04 13:52:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (substr(g,6,1) is "Z" && is_integer(g,0,6) ) {
|
2016-04-04 13:05:00 +00:00
|
|
|
rename(g,YYGGgg);
|
|
|
|
modify YYGGgg : hidden;
|
|
|
|
group g : dump ; non_alpha na;
|
|
|
|
year=getenv("METAR_YEAR") : dump;
|
|
|
|
month=getenv("METAR_MONTH") : dump;
|
|
|
|
day = to_string(YYGGgg,0,2) : dump;
|
|
|
|
hour = to_string(YYGGgg,2,2) : dump;
|
|
|
|
minute = to_string(YYGGgg,4,2) : dump;
|
2014-07-04 13:52:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! isCorrection && g is "COR" ) {
|
2016-04-04 13:05:00 +00:00
|
|
|
rename(g,cor);
|
|
|
|
alias status=correction;
|
|
|
|
alias isCorrection=one;
|
|
|
|
group g : dump; non_alpha na;
|
2015-07-28 09:50:26 +00:00
|
|
|
}
|
2014-07-04 13:52:04 +00:00
|
|
|
|
2015-07-28 09:50:26 +00:00
|
|
|
include "metar/wrong_delayed.def";
|
2014-07-04 13:52:04 +00:00
|
|
|
|
2015-07-28 09:50:26 +00:00
|
|
|
if ( g is "NIL" ) {
|
2016-04-04 13:05:00 +00:00
|
|
|
rename(g,nil); group g : dump;
|
2014-07-04 13:52:04 +00:00
|
|
|
} else {
|
2016-04-04 13:05:00 +00:00
|
|
|
if (g is "AUTO") {
|
|
|
|
rename(g,auto);
|
|
|
|
alias isAuto=true;
|
|
|
|
group g : dump; non_alpha na;
|
|
|
|
}
|
|
|
|
|
|
|
|
include "metar/wind.def";
|
|
|
|
include "metar/horizontalVisibility.def";
|
|
|
|
|
|
|
|
if ( ! isCavok ) {
|
|
|
|
include "metar/present_weather.def";
|
|
|
|
include "metar/clouds.def";
|
|
|
|
}
|
|
|
|
|
|
|
|
include "metar/missing_field.def";
|
|
|
|
include "metar/temperature.def";
|
|
|
|
include "metar/qnh.def";
|
|
|
|
include "metar/colour.def";
|
|
|
|
include "metar/recent_weather.def";
|
|
|
|
include "metar/wind_shear.def";
|
|
|
|
include "metar/sea_state.def";
|
|
|
|
template runwayState "metar/runwayState.def";
|
|
|
|
include "metar/trend1.def";
|
|
|
|
include "metar/trend2.def";
|
|
|
|
include "metar/trend3.def";
|
|
|
|
include "metar/trend4.def";
|
2014-07-04 13:52:04 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-07-28 09:50:26 +00:00
|
|
|
include "metar/remark.def";
|
2014-07-04 13:52:04 +00:00
|
|
|
|
2015-07-28 09:50:26 +00:00
|
|
|
if (length(g) == 0) {
|
2016-04-04 13:05:00 +00:00
|
|
|
modify g : hidden;
|
2014-07-04 13:52:04 +00:00
|
|
|
} else {
|
2016-04-04 13:05:00 +00:00
|
|
|
if ( ! remarkPresent) {
|
|
|
|
rename(g,skippedGroup);
|
|
|
|
group g : dump; non_alpha na;
|
|
|
|
include "metar/colour.def";
|
|
|
|
include "metar/recent_weather.def";
|
|
|
|
include "metar/wind_shear.def";
|
|
|
|
include "metar/sea_state.def";
|
|
|
|
template runwayState "metar/runwayState.def";
|
|
|
|
include "metar/temperature.def";
|
|
|
|
include "metar/qnh.def";
|
|
|
|
if (!presentTrend1) {
|
|
|
|
include "metar/trend1.def";
|
|
|
|
include "metar/trend2.def";
|
|
|
|
include "metar/trend3.def";
|
|
|
|
include "metar/trend4.def";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
include "metar/remark.def";
|
|
|
|
if ( ! remarkPresent) {
|
|
|
|
if ( length(g) == 0) {
|
|
|
|
modify g : hidden;
|
|
|
|
} else {
|
|
|
|
rename(g,unknownGroup) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
group notDecoded("=") : dump;
|
|
|
|
if (remarkPresent) {
|
|
|
|
rename(notDecoded,remark);
|
|
|
|
}
|
2014-07-04 13:52:04 +00:00
|
|
|
}
|
|
|
|
ascii[1] endMark :read_only ;
|
|
|
|
|
2015-07-28 09:50:26 +00:00
|
|
|
position totalLength;
|
2014-07-04 13:52:04 +00:00
|
|
|
position endOfMessage;
|
|
|
|
|
|
|
|
meta lengthOfMessage evaluate( endOfMessage-startOfMessage);
|
|
|
|
meta md5Headers md5(startOfMessage,lengthOfMessage);
|
|
|
|
|
|
|
|
alias ls.totalLength=totalLength;
|