Merge "Issue #947 remove milliseconds from obs, change avnfps to use dbqueryrequest to get Dates instead of CatalogQuery to get Strings." into development_on_ss_builds

Former-commit-id: 70f2bcb38c03eee2d389774f92a4676b0d4cae43
This commit is contained in:
Nate Jensen 2012-08-09 17:18:38 -05:00 committed by Gerrit Code Review
commit eeaa2c798f
3 changed files with 226 additions and 222 deletions

View file

@ -41,8 +41,7 @@ class HoursRefTimePointDataRetrieve(RefTimePointDataRetrieve.RefTimePointDataRet
super(HoursRefTimePointDataRetrieve, self).__init__(pluginName, site, parameters, keyId, refTime, constraint, maxSize) super(HoursRefTimePointDataRetrieve, self).__init__(pluginName, site, parameters, keyId, refTime, constraint, maxSize)
def _createJarray(self, availableTimes, numHours): def _createJarray(self, availableTimes, numHours):
from java.util import Date, TimeZone from java.util import Date
from java.sql import Timestamp
from com.raytheon.uf.common.time import DataTime from com.raytheon.uf.common.time import DataTime
import jep, time import jep, time
#Get a DataTime numHours from current time #Get a DataTime numHours from current time
@ -52,15 +51,7 @@ class HoursRefTimePointDataRetrieve(RefTimePointDataRetrieve.RefTimePointDataRet
length = len(availableTimes) length = len(availableTimes)
xdts = [] xdts = []
for i in range(length) : for i in range(length) :
# Timestamp must be used to parse the time because it correctly handles d = DataTime(availableTimes[length-1-i])
# the fractional part of seconds instead of interpreting them as
# milliseconds directly. for example 11.62 is
# interpreted as 11 seconds and 620 milliseconds instead of
# 11 seconds and 62 milliseconds.
milliTime = Timestamp.valueOf(availableTimes[length-1-i]).getTime()
# Timestamp parses into the default timezone so we must offset it to get GMT.
milliTime += TimeZone.getDefault().getOffset(milliTime)
d = DataTime(Date(milliTime))
if d.greaterThan(stDateTime) : if d.greaterThan(stDateTime) :
xdts.append(d) xdts.append(d)
else : else :

View file

@ -49,9 +49,19 @@ class RefTimePointDataRetrieve(PointDataRetrieve.PointDataRetrieve):
self.pdc = PointDataContainer.PointDataContainer(pdvDict, self.__javaPdc, self.refTime) self.pdc = PointDataContainer.PointDataContainer(pdvDict, self.__javaPdc, self.refTime)
def __queryRefTimes(self): def __queryRefTimes(self):
from com.raytheon.uf.viz.core.catalog import CatalogQuery from com.raytheon.uf.common.dataquery.requests import DbQueryRequest
return CatalogQuery.performQuery('dataTime.refTime', self._buildConstraints(None)) from com.raytheon.uf.viz.core.requests import ThriftClient
request = DbQueryRequest()
request.setConstraints(self._buildConstraints(None))
request.addRequestField('dataTime.refTime')
request.setOrderByField('dataTime.refTime')
request.setDistinct(True)
response = ThriftClient.sendRequest(request).getResults()
timeList = []
for i in range(0,response.size()):
timeList.append(response.get(i).get('dataTime.refTime'))
return timeList
def __requestData(self, availableTimes, parameters, maxSize): def __requestData(self, availableTimes, parameters, maxSize):
from com.raytheon.viz.pointdata import PointDataRequest from com.raytheon.viz.pointdata import PointDataRequest
from java.lang import String from java.lang import String

View file

@ -31,7 +31,6 @@ import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.exception.DecoderException; import com.raytheon.edex.exception.DecoderException;
import com.raytheon.edex.plugin.AbstractDecoder; import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.edex.plugin.obs.metar.util.VisibilityParser; import com.raytheon.edex.plugin.obs.metar.util.VisibilityParser;
import com.raytheon.edex.util.Util;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.obs.metar.MetarRecord; import com.raytheon.uf.common.dataplugin.obs.metar.MetarRecord;
import com.raytheon.uf.common.dataplugin.obs.metar.util.SkyCover; import com.raytheon.uf.common.dataplugin.obs.metar.util.SkyCover;
@ -174,14 +173,18 @@ public class MetarDecoder extends AbstractDecoder {
public static final Pattern PK_WIND_EXP = Pattern public static final Pattern PK_WIND_EXP = Pattern
.compile("\\b(PK WND|PKWND) (\\d{3})(\\d{2,3})/(\\d{2}|\\d{4})\\b"); .compile("\\b(PK WND|PKWND) (\\d{3})(\\d{2,3})/(\\d{2}|\\d{4})\\b");
public static final Pattern SNOW_FALL_6HR = Pattern.compile("(\\b)931(\\d{3}|///)"); public static final Pattern SNOW_FALL_6HR = Pattern
.compile("(\\b)931(\\d{3}|///)");
public static final Pattern SNOW_WATER = Pattern.compile("(\\b)933(\\d{3}|///)");
public static final Pattern SNOW_WATER = Pattern
public static final Pattern SNOW_DEPTH = Pattern.compile("(\\b)4/(\\d{3}|///)"); .compile("(\\b)933(\\d{3}|///)");
public static final Pattern SNOW_DEPTH = Pattern
.compile("(\\b)4/(\\d{3}|///)");
public static final Pattern SUNSHINE = Pattern
.compile("(\\b)98(\\d{3}|///)");
public static final Pattern SUNSHINE = Pattern.compile("(\\b)98(\\d{3}|///)");
private final String PLUGIN_NAME; private final String PLUGIN_NAME;
private boolean useMockInfo = false; private boolean useMockInfo = false;
@ -211,19 +214,20 @@ public class MetarDecoder extends AbstractDecoder {
throws DecoderException { throws DecoderException {
MetarSeparator sep = MetarSeparator.separate(inputData, headers); MetarSeparator sep = MetarSeparator.separate(inputData, headers);
List<PluginDataObject> retVal = new ArrayList<PluginDataObject>(); List<PluginDataObject> retVal = new ArrayList<PluginDataObject>();
Calendar baseTime = TimeTools.getSystemCalendar(); Calendar baseTime = TimeTools.getSystemCalendar();
WMOHeader wmoHdr = sep.getWMOHeader(); WMOHeader wmoHdr = sep.getWMOHeader();
if(TimeTools.allowArchive()) { if (TimeTools.allowArchive()) {
if((wmoHdr != null)&&(wmoHdr.isValid())) { if ((wmoHdr != null) && (wmoHdr.isValid())) {
baseTime = TimeTools.findDataTime(wmoHdr.getYYGGgg(), headers); baseTime = TimeTools.findDataTime(wmoHdr.getYYGGgg(), headers);
} else { } else {
logger.error("ARCHIVE MODE-No WMO Header found in file" + headers.get(WMOHeader.INGEST_FILE_NAME)); logger.error("ARCHIVE MODE-No WMO Header found in file"
+ headers.get(WMOHeader.INGEST_FILE_NAME));
} }
} }
while (sep.hasNext()) { while (sep.hasNext()) {
byte[] messageData = sep.next(); byte[] messageData = sep.next();
Pattern thePattern; Pattern thePattern;
@ -290,8 +294,7 @@ public class MetarDecoder extends AbstractDecoder {
traceId, icao)); traceId, icao));
continue; continue;
} }
Calendar obsTime = null; Calendar obsTime = null;
Integer da = DecoderTools.getInt(timeGroup, 0, 2); Integer da = DecoderTools.getInt(timeGroup, 0, 2);
Integer hr = DecoderTools.getInt(timeGroup, 2, 4); Integer hr = DecoderTools.getInt(timeGroup, 2, 4);
@ -301,12 +304,14 @@ public class MetarDecoder extends AbstractDecoder {
obsTime.set(Calendar.DAY_OF_MONTH, da); obsTime.set(Calendar.DAY_OF_MONTH, da);
obsTime.set(Calendar.HOUR_OF_DAY, hr); obsTime.set(Calendar.HOUR_OF_DAY, hr);
obsTime.set(Calendar.MINUTE, mi); obsTime.set(Calendar.MINUTE, mi);
} obsTime.set(Calendar.SECOND, 0);
obsTime.set(Calendar.MILLISECOND, 0);
}
if (obsTime != null) { if (obsTime != null) {
record.setTimeObs(obsTime); record.setTimeObs(obsTime);
record.setDataTime(new DataTime(obsTime)); record.setDataTime(new DataTime(obsTime));
Calendar refHour = TimeTools.copyToNearestHour(obsTime); Calendar refHour = TimeTools.copyToNearestHour(obsTime);
if(mi >= 45) { if (mi >= 45) {
refHour.add(Calendar.HOUR_OF_DAY, 1); refHour.add(Calendar.HOUR_OF_DAY, 1);
} }
record.setRefHour(refHour); record.setRefHour(refHour);
@ -324,12 +329,14 @@ public class MetarDecoder extends AbstractDecoder {
if (obsTime != null) { if (obsTime != null) {
Calendar currTime = TimeTools.copy(baseTime); Calendar currTime = TimeTools.copy(baseTime);
// Do this only for archive mode!!! Otherwise valid data will not pass if the WMO header // Do this only for archive mode!!! Otherwise valid data
// will not pass if the WMO header
// date/time is much less than the obstime. For instance // date/time is much less than the obstime. For instance
// WMO Header time = dd1200 // WMO Header time = dd1200
// Observed time = dd1235 // Observed time = dd1235
// To solve this will require greater precision in the file timestamp. // To solve this will require greater precision in the file
if(TimeTools.allowArchive()) { // timestamp.
if (TimeTools.allowArchive()) {
currTime.add(Calendar.HOUR, 1); currTime.add(Calendar.HOUR, 1);
} }
currTime.add(Calendar.MINUTE, METAR_FUTURE_LIMIT); currTime.add(Calendar.MINUTE, METAR_FUTURE_LIMIT);
@ -646,13 +653,13 @@ public class MetarDecoder extends AbstractDecoder {
if (matcher.find()) { if (matcher.find()) {
String s = matcher.group().trim(); String s = matcher.group().trim();
if(s.startsWith("AO1")) { if (s.startsWith("AO1")) {
s = "AO1"; s = "AO1";
} else if(s.startsWith("AO2")) { } else if (s.startsWith("AO2")) {
s = "AO2"; s = "AO2";
} else if(s.startsWith("A01")) { } else if (s.startsWith("A01")) {
s = "AO1"; s = "AO1";
} else if(s.startsWith("A02")) { } else if (s.startsWith("A02")) {
s = "AO2"; s = "AO2";
} }
record.setAutoStationType(s); record.setAutoStationType(s);
@ -673,16 +680,16 @@ public class MetarDecoder extends AbstractDecoder {
// ever result is closest to 1000 is used // ever result is closest to 1000 is used
try { try {
slp = Float.parseFloat(matcher.group(1)) / 10.0f; slp = Float.parseFloat(matcher.group(1)) / 10.0f;
if(slp > 50.0f) { if (slp > 50.0f) {
slp = 900.0f + slp; slp = 900.0f + slp;
} else { } else {
slp = 1000.0f + slp; slp = 1000.0f + slp;
} }
} catch(NumberFormatException nfe) { } catch (NumberFormatException nfe) {
// nothing // nothing
} }
if(slp != null) { if (slp != null) {
record.setSeaLevelPress(slp); record.setSeaLevelPress(slp);
} }
} }
@ -797,13 +804,12 @@ public class MetarDecoder extends AbstractDecoder {
if ((obsHr % 3) == 0) { if ((obsHr % 3) == 0) {
Float precip = null; Float precip = null;
try { try {
precip = Float.parseFloat(matcher precip = Float.parseFloat(matcher.group(1));
.group(1));
precip /= 100.0f; precip /= 100.0f;
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
precip = null; precip = null;
} }
if(precip != null) { if (precip != null) {
if ((obsHr % 6) == 0) { if ((obsHr % 6) == 0) {
record.setPrecip6Hour(precip); record.setPrecip6Hour(precip);
} else { } else {
@ -819,11 +825,10 @@ public class MetarDecoder extends AbstractDecoder {
} }
} }
matcher = PRECIP_24HR_EXP.matcher(trailingData); matcher = PRECIP_24HR_EXP.matcher(trailingData);
if (matcher.find()) { if (matcher.find()) {
String s = matcher.group(1).trim(); String s = matcher.group(1).trim();
if(!"////".equals(s)) { if (!"////".equals(s)) {
try { try {
float precip = Integer.parseInt(s) / 100.0f; float precip = Integer.parseInt(s) / 100.0f;
record.setPrecip24Hour(precip); record.setPrecip24Hour(precip);
@ -833,7 +838,6 @@ public class MetarDecoder extends AbstractDecoder {
} }
} }
matcher = MAXMIN_TEMP_6_HR_EXP.matcher(trailingData); matcher = MAXMIN_TEMP_6_HR_EXP.matcher(trailingData);
while (matcher.find()) { while (matcher.find()) {
String op = matcher.group(1); String op = matcher.group(1);
@ -858,7 +862,6 @@ public class MetarDecoder extends AbstractDecoder {
} }
} }
// Gets the pressure change over the last 3 hours // Gets the pressure change over the last 3 hours
matcher = PRESS_CHANGE_EXP.matcher(trailingData); matcher = PRESS_CHANGE_EXP.matcher(trailingData);
@ -867,26 +870,26 @@ public class MetarDecoder extends AbstractDecoder {
record.setPressChange3Hour(Float.parseFloat(matcher record.setPressChange3Hour(Float.parseFloat(matcher
.group(2))); .group(2)));
} }
matcher = SNOW_FALL_6HR.matcher(trailingData); matcher = SNOW_FALL_6HR.matcher(trailingData);
if (matcher.find()) { if (matcher.find()) {
String s = matcher.group(2); String s = matcher.group(2);
Float value = null; Float value = null;
if("///".equals(s)) { if ("///".equals(s)) {
value = -9999f; value = -9999f;
} else { } else {
s = removeLeadingZeros(s); s = removeLeadingZeros(s);
value = (getInt(s,-99990) / 10.0f); value = (getInt(s, -99990) / 10.0f);
} }
record.setSnowFall_6Hours(value); record.setSnowFall_6Hours(value);
} }
matcher = SNOW_WATER.matcher(trailingData); matcher = SNOW_WATER.matcher(trailingData);
if (matcher.find()) { if (matcher.find()) {
String s = matcher.group(2); String s = matcher.group(2);
Float value = null; Float value = null;
if("///".equals(s)) { if ("///".equals(s)) {
value = -9999f; value = -9999f;
} else { } else {
s = removeLeadingZeros(s); s = removeLeadingZeros(s);
@ -894,12 +897,12 @@ public class MetarDecoder extends AbstractDecoder {
} }
record.setSnowWater(value); record.setSnowWater(value);
} }
matcher = SNOW_DEPTH.matcher(trailingData); matcher = SNOW_DEPTH.matcher(trailingData);
if (matcher.find()) { if (matcher.find()) {
String s = matcher.group(2); String s = matcher.group(2);
Integer value = null; Integer value = null;
if("///".equals(s)) { if ("///".equals(s)) {
value = -9999; value = -9999;
} else { } else {
s = removeLeadingZeros(s); s = removeLeadingZeros(s);
@ -912,7 +915,7 @@ public class MetarDecoder extends AbstractDecoder {
if (matcher.find()) { if (matcher.find()) {
String s = matcher.group(2); String s = matcher.group(2);
Integer value = null; Integer value = null;
if("///".equals(s)) { if ("///".equals(s)) {
value = -9999; value = -9999;
} else { } else {
s = removeLeadingZeros(s); s = removeLeadingZeros(s);
@ -920,14 +923,14 @@ public class MetarDecoder extends AbstractDecoder {
} }
record.setSunshine(value); record.setSunshine(value);
} }
record.setPluginName(PLUGIN_NAME); record.setPluginName(PLUGIN_NAME);
record.constructDataURI(); record.constructDataURI();
record.setWmoHeader(sep.getWMOHeader().getWmoHeader()); record.setWmoHeader(sep.getWMOHeader().getWmoHeader());
retVal.add(record); retVal.add(record);
} catch (Exception e) { } catch (Exception e) {
logger.error(traceId + " - Unable to decode METAR/SPECI", e); logger.error(traceId + " - Unable to decode METAR/SPECI", e);
} }
@ -1003,18 +1006,17 @@ public class MetarDecoder extends AbstractDecoder {
public static final String removeLeadingZeros(String data) { public static final String removeLeadingZeros(String data) {
StringBuilder sb = null; StringBuilder sb = null;
if(data != null) { if (data != null) {
sb = new StringBuilder(data); sb = new StringBuilder(data);
for(int i = 0;i < sb.length()-1;i++) { for (int i = 0; i < sb.length() - 1; i++) {
if(sb.charAt(i) == '0') { if (sb.charAt(i) == '0') {
sb.setCharAt(i, ' '); sb.setCharAt(i, ' ');
} }
} }
} }
return (sb != null) ? sb.toString().trim() : ""; return (sb != null) ? sb.toString().trim() : "";
} }
public static final int getInt(String val, int defaultVal) { public static final int getInt(String val, int defaultVal) {
int retVal = defaultVal; int retVal = defaultVal;
try { try {
@ -1107,168 +1109,169 @@ public class MetarDecoder extends AbstractDecoder {
public static final void main(String[] args) { public static final void main(String[] args) {
// boolean perform = false; // boolean perform = false;
// //
// if (perform) { // if (perform) {
// Pattern VISIBILITY_EXP_1 = Pattern.compile("(M| )\\d{1,2}SM"); // Pattern VISIBILITY_EXP_1 = Pattern.compile("(M| )\\d{1,2}SM");
// //
// Pattern VISIBILITY_EXP_2 = Pattern // Pattern VISIBILITY_EXP_2 = Pattern
// .compile("((M| \\d)? ?((\\d)/(\\d{1,2})()))SM"); // .compile("((M| \\d)? ?((\\d)/(\\d{1,2})()))SM");
// //
// String[] data = { " 0SM +SN OVC015 ", " 1SM +SN OVC015 ", // String[] data = { " 0SM +SN OVC015 ", " 1SM +SN OVC015 ",
// " 9SM +SN OVC015 ", " 10SM +SN OVC015 ", // " 9SM +SN OVC015 ", " 10SM +SN OVC015 ",
// " 1/16SM +SN OVC015 ", " 1/8SM +SN OVC015 ", // " 1/16SM +SN OVC015 ", " 1/8SM +SN OVC015 ",
// " 3/16SM +SN OVC015 ", " 1/4SM +SN OVC015 ", // " 3/16SM +SN OVC015 ", " 1/4SM +SN OVC015 ",
// " 5/32SM +SN OVC015 ", " 5/16SM +SN OVC015 ", // " 5/32SM +SN OVC015 ", " 5/16SM +SN OVC015 ",
// " 3/8SM +SN OVC015 ", " 1/2SM +SN OVC015 ", // " 3/8SM +SN OVC015 ", " 1/2SM +SN OVC015 ",
// " 5/8SM +SN OVC015 ", " 3/4SM +SN OVC015 ", // " 5/8SM +SN OVC015 ", " 3/4SM +SN OVC015 ",
// " 7/8SM +SN OVC015 ", " 1 1/4SM +SN OVC015 ", // " 7/8SM +SN OVC015 ", " 1 1/4SM +SN OVC015 ",
// " 1 1/16SM +SN OVC015 ", " 1 1/2SM +SN OVC015 ", // " 1 1/16SM +SN OVC015 ", " 1 1/2SM +SN OVC015 ",
// " 1 3/4SM +SN OVC015 ", " 2SM +SN OVC015 ", }; // " 1 3/4SM +SN OVC015 ", " 2SM +SN OVC015 ", };
// //
// for (String s : data) { // for (String s : data) {
// System.out.print(String.format("%32s", s)); // System.out.print(String.format("%32s", s));
// Matcher m = VISIBILITY_EXP_1.matcher(s); // Matcher m = VISIBILITY_EXP_1.matcher(s);
// if (m.find()) { // if (m.find()) {
// System.out.println(" 1 [" // System.out.println(" 1 ["
// + s.substring(m.start(), m.end()).trim()); // + s.substring(m.start(), m.end()).trim());
// for (int i = 0; i < m.groupCount(); i++) { // for (int i = 0; i < m.groupCount(); i++) {
// System.out.println(" ---- " + m.group(i)); // System.out.println(" ---- " + m.group(i));
// } // }
// } else { // } else {
// m = VISIBILITY_EXP_2.matcher(s); // m = VISIBILITY_EXP_2.matcher(s);
// if (m.find()) { // if (m.find()) {
// System.out.println(" 2 [" // System.out.println(" 2 ["
// + s.substring(m.start(), m.end()).trim()); // + s.substring(m.start(), m.end()).trim());
// //
// for (int i = 0; i < m.groupCount(); i++) { // for (int i = 0; i < m.groupCount(); i++) {
// System.out.println(" ---- " + m.group(i)); // System.out.println(" ---- " + m.group(i));
// } // }
// } else { // } else {
// System.out.println(" Fail"); // System.out.println(" Fail");
// } // }
// } // }
// } // }
// } // }
// //
// perform = false; // perform = false;
// if (perform) { // if (perform) {
// Pattern p = Pattern // Pattern p = Pattern
// .compile("\\bPK WND (\\d{3})(\\d{2,3})/(\\d{2}|\\d{4})\\b"); // .compile("\\bPK WND (\\d{3})(\\d{2,3})/(\\d{2}|\\d{4})\\b");
// //
// String data = "PWINO TSNO T00500005 PK WND 08027/2104 SLP060 $="; // String data = "PWINO TSNO T00500005 PK WND 08027/2104 SLP060 $=";
// //
// Matcher m = p.matcher(data); // Matcher m = p.matcher(data);
// if (m.find()) { // if (m.find()) {
// for (int i = 0; i <= m.groupCount(); i++) { // for (int i = 0; i <= m.groupCount(); i++) {
// System.out.println(m.group(i)); // System.out.println(m.group(i));
// } // }
// } // }
// } // }
// //
// perform = false; // perform = false;
// if (perform) { // if (perform) {
// String[] data = { // String[] data = {
// "KGFA 281156Z AUTO 26005KT 7SM -RA OVC009 04/03 A2999 RMK AO2 RAB37" // "KGFA 281156Z AUTO 26005KT 7SM -RA OVC009 04/03 A2999 RMK AO2 RAB37"
// + "\r CIG 007V011 SLP200 P0001 60002 70074 T00390033 10044 20033" // + "\r CIG 007V011 SLP200 P0001 60002 70074 T00390033 10044 20033"
// + "\r 53003 $=", // + "\r 53003 $=",
// "KLWT 281154Z AUTO 27005KT 10SM -RA OVC020 04/04 A2997 RMK AO2" // "KLWT 281154Z AUTO 27005KT 10SM -RA OVC020 04/04 A2997 RMK AO2"
// + "\r RAB1057 SLP145 P0003 60011 70013 T00440039 10072 20044 53004" // +
// + "\r $=", // "\r RAB1057 SLP145 P0003 60011 70013 T00440039 10072 20044 53004"
// "KSIY 281153Z AUTO 19003KT 10SM BKN014 OVC023 07/06 A3006 RMK AO2" // + "\r $=",
// + "\r RAE10B36E48 SLP187 P0001 60003 70014 T00670056 10072 20067" // "KSIY 281153Z AUTO 19003KT 10SM BKN014 OVC023 07/06 A3006 RMK AO2"
// + "\r 53012=", // + "\r RAE10B36E48 SLP187 P0001 60003 70014 T00670056 10072 20067"
// "KFGN 281154Z AUTO 11007KT 080V140 10SM CLR 17/11 A3000 RMK AO2 LTG" // + "\r 53012=",
// + "\r DSNT W AND NW=", // "KFGN 281154Z AUTO 11007KT 080V140 10SM CLR 17/11 A3000 RMK AO2 LTG"
// "KUKI 281156Z AUTO 33003KT 10SM BKN006 BKN012 OVC016 06/06 A3010" // + "\r DSNT W AND NW=",
// + "\r RMK AO2 CIG 002V009 SLP190 70081 T00610056 10072 20061" // "KUKI 281156Z AUTO 33003KT 10SM BKN006 BKN012 OVC016 06/06 A3010"
// + "\r 51005=", // + "\r RMK AO2 CIG 002V009 SLP190 70081 T00610056 10072 20061"
// "PABR 281153Z COR 02003KT 10SM OVC003 M01/M02 A3009 RMK AO2 CIG" // + "\r 51005=",
// + "\r 001V005 SLP189 FZRAB12FZRAE50 P0002 60002 70002 4/012" // "PABR 281153Z COR 02003KT 10SM OVC003 M01/M02 A3009 RMK AO2 CIG"
// + "\r T10111017 11011 21011 56009=", // + "\r 001V005 SLP189 FZRAB12FZRAE50 P0002 60002 70002 4/012"
// "SAUS70 KWBC 281220 METAR KLUM 281216Z AUTO 00000KT 10SM CLR 13/08 A3014 RMK AO2", }; // + "\r T10111017 11011 21011 56009=",
// // "SAUS70 KWBC 281220 METAR KLUM 281216Z AUTO 00000KT 10SM CLR 13/08 A3014 RMK AO2",
// for (String s : data) { // };
// System.out.println(formatMetar(s)); //
// } // for (String s : data) {
// } // System.out.println(formatMetar(s));
// perform = true; // }
// if (perform) { // }
// // perform = true;
// try { // if (perform) {
// String obs = "\001023\r\r\nSAUS42 KOAX 191510\r\r\n" //
// + "" // try {
// // + // String obs = "\001023\r\r\nSAUS42 KOAX 191510\r\r\n"
// // "KOMA 281156Z AUTO 26005KT 7SM -FZDZSN FG OVC009 04/03 A2999 RMK AO2 RAB37" // + ""
// // + // // +
// // "\r\r\n CIG 007V011 SLP200 P0001 60002 70074 T00390033 10044 20033" // //
// // + "\r\r\n 53003 $=\r\r\b\003" // "KOMA 281156Z AUTO 26005KT 7SM -FZDZSN FG OVC009 04/03 A2999 RMK AO2 RAB37"
// // + // // +
// // "KFET 281156Z AUTO 26005KT 7SM -SNBR OVC009 04/03 A2999 RMK AO2 RAB37" // //
// // + // "\r\r\n CIG 007V011 SLP200 P0001 60002 70074 T00390033 10044 20033"
// // "\r\r\n CIG 007V011 SLP200 P0001 60002 70074 T00390033 10044 20033" // // + "\r\r\n 53003 $=\r\r\b\003"
// // + "\r\r\n 53003 $=\r\r\b\003" // // +
// + "VVNB 261830Z 04003KT 3700 TSRA SCT005 SCT030CB BKN040 26/25" // //
// + "\r\r\n Q1005 RMK PKWND 14527/1135 NOSIG"; // "KFET 281156Z AUTO 26005KT 7SM -SNBR OVC009 04/03 A2999 RMK AO2 RAB37"
// // // +
// MetarDecoder decoder = new MetarDecoder("obs"); // //
// ObStation station = new ObStation(); // "\r\r\n CIG 007V011 SLP200 P0001 60002 70074 T00390033 10044 20033"
// station.setIcao("KOMA"); // // + "\r\r\n 53003 $=\r\r\b\003"
// station.setLocation(createPoint(41.3, -95.9)); // + "VVNB 261830Z 04003KT 3700 TSRA SCT005 SCT030CB BKN040 26/25"
// station.setElevation(399); // + "\r\r\n Q1005 RMK PKWND 14527/1135 NOSIG";
// station.setCatalogType(ObStation.CAT_TYPE_ICAO); //
// station.setName("OMAHA/EPPLEY FIELD"); // MetarDecoder decoder = new MetarDecoder("obs");
// decoder.setMockInfo(station); // ObStation station = new ObStation();
// Headers headers = new Headers(); // station.setIcao("KOMA");
// headers.put(DecoderTools.INGEST_FILE_NAME, // station.setLocation(createPoint(41.3, -95.9));
// "SAUS42KOAX.20110103"); // station.setElevation(399);
// PluginDataObject[] m = decoder.decode(obs.getBytes(), headers); // station.setCatalogType(ObStation.CAT_TYPE_ICAO);
// if (m != null) { // station.setName("OMAHA/EPPLEY FIELD");
// for (PluginDataObject p : m) { // decoder.setMockInfo(station);
// MetarRecord mr = (MetarRecord) p; // Headers headers = new Headers();
// // headers.put(DecoderTools.INGEST_FILE_NAME,
// System.out.println(mr); // "SAUS42KOAX.20110103");
// System.out.println(formatMetar(mr.getReport())); // PluginDataObject[] m = decoder.decode(obs.getBytes(), headers);
// List<WeatherCondition> wx = mr.getWeatherCondition(); // if (m != null) {
// for (WeatherCondition w : wx) { // for (PluginDataObject p : m) {
// System.out.println(w); // MetarRecord mr = (MetarRecord) p;
// } //
// } // System.out.println(mr);
// } // System.out.println(formatMetar(mr.getReport()));
// } catch (DecoderException e) { // List<WeatherCondition> wx = mr.getWeatherCondition();
// // TODO Auto-generated catch block // for (WeatherCondition w : wx) {
// e.printStackTrace(); // System.out.println(w);
// } // }
// } // }
// }
// } catch (DecoderException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// }
String trailingData = " SLP124 P0036 60020 7//// T02220211 "; String trailingData = " SLP124 P0036 60020 7//// T02220211 ";
Matcher matcher = PRECIP_24HR_EXP.matcher(trailingData); Matcher matcher = PRECIP_24HR_EXP.matcher(trailingData);
// if (matcher.find()) { // if (matcher.find()) {
// String s = matcher.group(1); // String s = matcher.group(1);
// if(!"////".equals(s)) { // if(!"////".equals(s)) {
// try { // try {
// int precip = Integer.parseInt(s); // int precip = Integer.parseInt(s);
// System.out.println(precip); // System.out.println(precip);
// } catch (NumberFormatException nfe) { // } catch (NumberFormatException nfe) {
// nfe.printStackTrace(); // nfe.printStackTrace();
// } // }
// } else { // } else {
// System.out.println(-99.0f); // System.out.println(-99.0f);
// } // }
// } // }
trailingData = "SLP124 AO1=\r\r\n"; trailingData = "SLP124 AO1=\r\r\n";
matcher = AUTO_STATION_EXP.matcher(trailingData); matcher = AUTO_STATION_EXP.matcher(trailingData);
if(matcher.find()) { if (matcher.find()) {
String s = matcher.group().trim(); String s = matcher.group().trim();
System.out.println("[" + s + "]"); System.out.println("[" + s + "]");
} }
} }
} }