Issue #2655 fix textlightning distribution regex
Change-Id: Ia8900e8baa05d831c984fbf355034ca189364d99 Former-commit-id:16d6a29bb9
[formerlya6c562d3f0
[formerly 48825cb03da5bde6f8b1252fe2e366119535f8f3]] Former-commit-id:a6c562d3f0
Former-commit-id:cf1dcae597
This commit is contained in:
parent
6d4e5d79de
commit
2cd9b9ef13
4 changed files with 172 additions and 157 deletions
|
@ -2,13 +2,16 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Textlightning Plug-in
|
||||
Bundle-SymbolicName: com.raytheon.edex.plugin.textlightning
|
||||
Bundle-Version: 1.12.1174.qualifier
|
||||
Bundle-Version: 1.14.0.qualifier
|
||||
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization, com.raytheon.edex.common
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Require-Bundle: com.raytheon.edex.common,
|
||||
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
|
||||
javax.persistence
|
||||
Require-Bundle: com.raytheon.uf.edex.decodertools,
|
||||
com.raytheon.uf.common.dataplugin
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Import-Package: com.raytheon.uf.common.dataplugin.binlightning,
|
||||
Import-Package: com.raytheon.edex.exception,
|
||||
com.raytheon.edex.plugin,
|
||||
com.raytheon.uf.common.dataplugin.binlightning,
|
||||
com.raytheon.uf.common.dataplugin.binlightning.impl,
|
||||
org.apache.commons.logging
|
||||
com.raytheon.uf.common.status,
|
||||
com.raytheon.uf.common.time,
|
||||
com.raytheon.uf.edex.core
|
||||
|
|
|
@ -22,23 +22,21 @@ package com.raytheon.edex.plugin.textlightning;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.edex.exception.DecoderException;
|
||||
import com.raytheon.edex.plugin.AbstractDecoder;
|
||||
import com.raytheon.edex.plugin.IBinaryDecoder;
|
||||
import com.raytheon.edex.plugin.textlightning.impl.TextLightningParser;
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord;
|
||||
import com.raytheon.uf.common.dataplugin.binlightning.impl.LightningStrikePoint;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.TimeRange;
|
||||
import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Decoder for text lightning data
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -48,6 +46,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 25, 2010 jsanchez Initial creation
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* Feb 12, 2014 2655 njensen Set source
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -57,7 +56,9 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
|||
|
||||
public class TextLightningDecoder extends AbstractDecoder implements
|
||||
IBinaryDecoder {
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private static final IUFStatusHandler logger = UFStatus
|
||||
.getHandler(TextLightningDecoder.class);
|
||||
|
||||
private String traceId = null;
|
||||
|
||||
|
@ -66,6 +67,7 @@ public class TextLightningDecoder extends AbstractDecoder implements
|
|||
* will return false, decode() will return a null.
|
||||
*/
|
||||
public TextLightningDecoder() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,11 +118,10 @@ public class TextLightningDecoder extends AbstractDecoder implements
|
|||
|
||||
if (report != null) {
|
||||
report.setTraceId(traceId);
|
||||
try {
|
||||
report.constructDataURI();
|
||||
} catch (PluginException e) {
|
||||
throw new DecoderException("Error constructing datauri", e);
|
||||
}
|
||||
|
||||
// TODO anyone have any idea what the source should actually be
|
||||
// named?
|
||||
report.setSource("text");
|
||||
}
|
||||
|
||||
return new PluginDataObject[] { report };
|
||||
|
|
|
@ -28,15 +28,15 @@ import java.util.List;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.binlightning.impl.LightningStrikePoint;
|
||||
import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgMsgType;
|
||||
import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgStrikeType;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
||||
/**
|
||||
*
|
||||
* Parser for text lightning data
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -45,6 +45,7 @@ import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgStrikeType;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 15, 2009 3983 jsanchez Initial creation
|
||||
* Feb 27, 2013 DCS 152 jgerth/elau Support for WWLLN
|
||||
* Feb 12, 2014 2655 njensen Use status handler for logging
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -54,7 +55,8 @@ import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgStrikeType;
|
|||
public class TextLightningParser {
|
||||
|
||||
/** The logger */
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
private static final IUFStatusHandler logger = UFStatus
|
||||
.getHandler(TextLightningParser.class);
|
||||
|
||||
int currentReport = -1;
|
||||
|
||||
|
@ -62,14 +64,17 @@ public class TextLightningParser {
|
|||
|
||||
// 03/23/2010 13:35:01 72.00 -157.00 -14 1
|
||||
private static final String LIGHTNING_PTRN_A = "(\\d{2,2}/\\d{2,2}/\\d{4,4}) (\\d{2,2}:\\d{2,2}:\\d{2,2})\\s{1,}(\\d{1,2}.\\d{2,2})\\s{1,}( |-\\d{1,3}.\\d{2,2})\\s{1,}( |-\\d{1,2})\\s{1,}(\\d{1,2})";
|
||||
|
||||
private static final Pattern LTG_PTRN_A = Pattern.compile(LIGHTNING_PTRN_A);
|
||||
|
||||
// 10:03:24:13:35:00.68 72.000 157.000 -14.2 1
|
||||
private static final String LIGHTNING_PTRN_B = "(\\d{2,2}:\\d{2,2}:\\d{2,2}:\\d{2,2}:\\d{2,2}:\\d{2,2}\\.\\d{2,2})\\s{1,}(\\d{1,2}\\.\\d{2,})\\s{1,}(-?\\d{1,3}\\.\\d{2,})\\s{1,}(-?\\d{1,3}\\.\\d{1,})\\s{1,}(\\d{1,2}).*";
|
||||
|
||||
private static final Pattern LTG_PTRN_B = Pattern.compile(LIGHTNING_PTRN_B);
|
||||
|
||||
// 2012-03-14T18:58:00,-5.5021,-45.9669,0.0,1
|
||||
private static final String LIGHTNING_PTRN_C = "(\\d{4,4}-\\d{2,2}-\\d{2,2})T(\\d{2,2}:\\d{2,2}:\\d{2,2}),(-?\\d{1,2}.\\d{1,4}),(-?\\d{1,3}.\\d{1,4}),(0.0),(1)";
|
||||
|
||||
private static final Pattern LTG_PTRN_C = Pattern.compile(LIGHTNING_PTRN_C);
|
||||
|
||||
/**
|
||||
|
@ -85,7 +90,9 @@ public class TextLightningParser {
|
|||
|
||||
/**
|
||||
* Set the message data and decode all message reports.
|
||||
* @param message Raw message data.
|
||||
*
|
||||
* @param message
|
||||
* Raw message data.
|
||||
*/
|
||||
private void setData(byte[] message) {
|
||||
currentReport = -1;
|
||||
|
@ -97,6 +104,7 @@ public class TextLightningParser {
|
|||
|
||||
/**
|
||||
* Does this parser contain any more reports.
|
||||
*
|
||||
* @return Does this parser contain any more reports.
|
||||
*/
|
||||
public boolean hasNext() {
|
||||
|
@ -112,8 +120,9 @@ public class TextLightningParser {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the next available report. Returns a null reference if no
|
||||
* more reports are available.
|
||||
* Get the next available report. Returns a null reference if no more
|
||||
* reports are available.
|
||||
*
|
||||
* @return The next available report.
|
||||
*/
|
||||
public LightningStrikePoint next() {
|
||||
|
@ -131,7 +140,6 @@ public class TextLightningParser {
|
|||
return report;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param start
|
||||
|
@ -187,20 +195,19 @@ public class TextLightningParser {
|
|||
String sec = datetime[5].substring(0, 2);
|
||||
String msec = datetime[5].substring(3, 5);
|
||||
|
||||
|
||||
String latitude = m.group(2);
|
||||
String longitude = m.group(3);
|
||||
String strength = m.group(4);
|
||||
String count = m.group(5);
|
||||
|
||||
|
||||
double lon = Double.parseDouble(longitude);
|
||||
if (lon > 0) {
|
||||
lon = -lon;
|
||||
}
|
||||
strike = new LightningStrikePoint(
|
||||
Double.parseDouble(latitude), lon);
|
||||
strike.setStrikeStrength(Double.parseDouble(strength));
|
||||
strike.setStrikeStrength(Double
|
||||
.parseDouble(strength));
|
||||
strike.setStrikeCount(Integer.parseInt(count));
|
||||
strike.setMonth(Integer.parseInt(month));
|
||||
strike.setDay(Integer.parseInt(day));
|
||||
|
@ -233,8 +240,10 @@ public class TextLightningParser {
|
|||
String count = m.group(6);
|
||||
|
||||
strike = new LightningStrikePoint(
|
||||
Double.parseDouble(latitude),Double.parseDouble(longitude));
|
||||
strike.setStrikeStrength(Double.parseDouble(strength));
|
||||
Double.parseDouble(latitude),
|
||||
Double.parseDouble(longitude));
|
||||
strike.setStrikeStrength(Double
|
||||
.parseDouble(strength));
|
||||
strike.setStrikeCount(Integer.parseInt(count));
|
||||
strike.setMonth(Integer.parseInt(month));
|
||||
strike.setDay(Integer.parseInt(day));
|
||||
|
@ -248,12 +257,13 @@ public class TextLightningParser {
|
|||
strike.setLightSource(sls);
|
||||
reports.add(strike);
|
||||
} else {
|
||||
logger.error("Cannot match lightning input " + line);
|
||||
logger.error("Cannot match lightning input "
|
||||
+ line);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
logger.debug("Invalid numerical value", e);
|
||||
logger.handle(Priority.DEBUG, "Invalid numerical value", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -295,38 +305,39 @@ public class TextLightningParser {
|
|||
return reportLines;
|
||||
}
|
||||
|
||||
|
||||
public static final void main(String[] args) {
|
||||
// 10: 03: 24: 13: 35: 00.68 72.000 157.000 -14.2 1
|
||||
// String LIGHTNING_PTRN_B = "(\\d{2,2}:\\d{2,2}:\\d{2,2}:\\d{2,2}:\\d{2,2}:\\d{2,2}\\.\\d{2,2})\\s{1,}(\\d{1,2}.\\d{2,})\\s{1,}( |-\\d{1,3}.\\d{2,})\\s{1,}( |-\\d{1,2}\\.\\d{1,})\\s{1,}(\\d{1,2})";
|
||||
// String LIGHTNING_PTRN_B = "(\\d{2,2}:\\d{2,2}:\\d{2,2}:\\d{2,2}:\\d{2,2}:\\d{2,2}\\.\\d{2,2})\\s{1,}(\\d{1,2}\\.\\d{2,})\\s{1,}(-?\\d{1,3}\\.\\d{2,})\\s{1,}(-?\\d{1,3}\\.\\d{1,})\\s{1,}(\\d{1,2}).*";
|
||||
// String LIGHTNING_PTRN_B =
|
||||
// "(\\d{2,2}:\\d{2,2}:\\d{2,2}:\\d{2,2}:\\d{2,2}:\\d{2,2}\\.\\d{2,2})\\s{1,}(\\d{1,2}.\\d{2,})\\s{1,}( |-\\d{1,3}.\\d{2,})\\s{1,}( |-\\d{1,2}\\.\\d{1,})\\s{1,}(\\d{1,2})";
|
||||
// String LIGHTNING_PTRN_B =
|
||||
// "(\\d{2,2}:\\d{2,2}:\\d{2,2}:\\d{2,2}:\\d{2,2}:\\d{2,2}\\.\\d{2,2})\\s{1,}(\\d{1,2}\\.\\d{2,})\\s{1,}(-?\\d{1,3}\\.\\d{2,})\\s{1,}(-?\\d{1,3}\\.\\d{1,})\\s{1,}(\\d{1,2}).*";
|
||||
//
|
||||
// Pattern LTG_PTRN_B = Pattern.compile(LIGHTNING_PTRN_B);
|
||||
//
|
||||
// Matcher m = LTG_PTRN_B.matcher("10:03:24:13:35:00.68 72.000 157.000 -14.2 1");
|
||||
// Matcher m =
|
||||
// LTG_PTRN_B.matcher("10:03:24:13:35:00.68 72.000 157.000 -14.2 1");
|
||||
// if(m.matches()) {
|
||||
// for(int i = 0;i <= m.groupCount();i++) {
|
||||
// System.out.println(m.group(i));
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
TextLightningParser parser = null;
|
||||
|
||||
parser = new TextLightningParser("03/23/2010 13:35:01 72.00 -157.00 -14 1\n03/23/2010 13:36:01 72.00 -157.00 -14 1".getBytes());
|
||||
parser = new TextLightningParser(
|
||||
"03/23/2010 13:35:01 72.00 -157.00 -14 1\n03/23/2010 13:36:01 72.00 -157.00 -14 1"
|
||||
.getBytes());
|
||||
while (parser.hasNext()) {
|
||||
System.out.println(parser.next());
|
||||
}
|
||||
|
||||
|
||||
parser = new TextLightningParser("10:03:24:13:35:00.68 72.000 157.000 -14.2 1\n10:03:24:13:36:00.68 72.000 157.000 -14.2 1".getBytes());
|
||||
parser = new TextLightningParser(
|
||||
"10:03:24:13:35:00.68 72.000 157.000 -14.2 1\n10:03:24:13:36:00.68 72.000 157.000 -14.2 1"
|
||||
.getBytes());
|
||||
while (parser.hasNext()) {
|
||||
System.out.println(parser.next());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,6 @@
|
|||
further_licensing_information.
|
||||
-->
|
||||
<requestPatterns xmlns:ns2="group">
|
||||
<regex>FAA_*</regex>
|
||||
<regex>WWLLN_*</regex>
|
||||
<regex>FAA_</regex>
|
||||
<regex>WWLLN_</regex>
|
||||
</requestPatterns>
|
||||
|
|
Loading…
Add table
Reference in a new issue