merge USPLN lightning text decoder from unidata_16.2.2
This commit is contained in:
parent
15bb24a364
commit
ba32836aba
1 changed files with 51 additions and 2 deletions
|
@ -51,6 +51,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* 999
|
||||
* Feb 12, 2014 2655 njensen Use status handler for logging
|
||||
* Jun 05, 2014 3226 bclement LightningStikePoint refactor
|
||||
* Jun 22, 2015 mjames@ucar Support for USPLN
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -84,6 +85,12 @@ public class TextLightningParser {
|
|||
|
||||
private static final Pattern LTG_PTRN_C = Pattern.compile(LIGHTNING_PTRN_C);
|
||||
|
||||
// USPLN
|
||||
// 2015-06-22T22:26:56.988,20.0405176,-83.8311105,-117.00,1.50,0.25,28
|
||||
private static final String LIGHTNING_PTRN_USPLN = "(\\d{4,4}-\\d{2,2}-\\d{2,2})T(\\d{2,2}:\\d{2,2}:\\d{2,2}.\\d{3,3}),(-?\\d{1,2}.\\d{2,}),(-?\\d{1,3}.\\d{2,}),(-?\\d{1,3}\\.\\d{2,2}),(\\d{1,1}\\.\\d{2,2}),(\\d{1,1}\\.\\d{2,2}),(-?\\d{1,2})";
|
||||
|
||||
private static final Pattern LTG_PTRN_USPLN = Pattern.compile(LIGHTNING_PTRN_USPLN);
|
||||
|
||||
/**
|
||||
* default constructor.
|
||||
*/
|
||||
|
@ -159,6 +166,7 @@ public class TextLightningParser {
|
|||
LightningStrikePoint strike;
|
||||
for (String line : lines) {
|
||||
try {
|
||||
// 03/23/2010 13:35:01 72.00 -157.00 -142 1
|
||||
Matcher m = LTG_PTRN_A.matcher(line);
|
||||
if (m.matches()) {
|
||||
String[] date = m.group(1).split("/");
|
||||
|
@ -191,6 +199,7 @@ public class TextLightningParser {
|
|||
strike.setLightSource("UNKN");
|
||||
reports.add(strike);
|
||||
} else {
|
||||
// 10:03:24:13:35:00.68 72.000 157.000 -14.2 1
|
||||
m = LTG_PTRN_B.matcher(line);
|
||||
if (m.matches()) {
|
||||
String[] datetime = m.group(1).split(":");
|
||||
|
@ -228,6 +237,7 @@ public class TextLightningParser {
|
|||
strike.setLightSource("UNKN");
|
||||
reports.add(strike);
|
||||
} else {
|
||||
// 2012-03-14T18:58:00,-5.5021,-45.9669,0.0,1
|
||||
m = LTG_PTRN_C.matcher(line);
|
||||
if (m.matches()) {
|
||||
String[] datec = m.group(1).split("-");
|
||||
|
@ -264,11 +274,50 @@ public class TextLightningParser {
|
|||
strike.setLightSource(sls);
|
||||
reports.add(strike);
|
||||
} else {
|
||||
// 2015-06-22T23:04:46.884,30.6349741,-88.3066673,-27.10,0.25,0.25,8
|
||||
m = LTG_PTRN_USPLN.matcher(line);
|
||||
if (m.matches()) {
|
||||
String[] datec = m.group(1).split("-");
|
||||
String[] timec = m.group(2).split(":");
|
||||
String year = datec[0];
|
||||
String month = datec[1];
|
||||
String day = datec[2];
|
||||
String hour = timec[0];
|
||||
String min = timec[1];
|
||||
String sec = timec[2].substring(0, 2);
|
||||
String msec = timec[2].substring(3, 6);
|
||||
|
||||
String sls = "USPLN";
|
||||
|
||||
String latitude = m.group(3);
|
||||
String longitude = m.group(4);
|
||||
String strength = m.group(5);
|
||||
String count = "1";
|
||||
|
||||
strike = new LightningStrikePoint(
|
||||
Double.parseDouble(latitude),
|
||||
Double.parseDouble(longitude));
|
||||
strike.setStrikeStrength(Double
|
||||
.parseDouble(strength));
|
||||
strike.setPulseCount(Integer.parseInt(count));
|
||||
strike.setMonth(Integer.parseInt(month));
|
||||
strike.setDay(Integer.parseInt(day));
|
||||
strike.setYear(Integer.parseInt(year));
|
||||
strike.setHour(Integer.parseInt(hour));
|
||||
strike.setMinute(Integer.parseInt(min));
|
||||
strike.setSecond(Integer.parseInt(sec));
|
||||
strike.setMillis(Integer.parseInt(msec));
|
||||
strike.setMsgType(LtgMsgType.STRIKE_MSG_FL);
|
||||
strike.setType(LtgStrikeType.CLOUD_TO_GROUND);
|
||||
strike.setLightSource(sls);
|
||||
reports.add(strike);
|
||||
} else if (!line.startsWith("LIGHTNING-USPLN1EX")) {
|
||||
logger.error("Cannot match lightning input "
|
||||
+ line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
logger.handle(Priority.DEBUG, "Invalid numerical value", e);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue