Skip to content

Commit

Permalink
Sigmet classes and regex additions
Browse files Browse the repository at this point in the history
  • Loading branch information
moryakovdv committed Jul 10, 2018
1 parent 0090991 commit 09e87e7
Show file tree
Hide file tree
Showing 5 changed files with 505 additions and 83 deletions.
143 changes: 63 additions & 80 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,109 +1,105 @@
<!--
Copyright (C) 2018 Dmitry Moryakov, Main aeronautical meteorological center, Moscow, Russia
moryakovdv[at]gmail[dot]com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Copyright (C) 2018 Dmitry Moryakov, Main aeronautical meteorological
center, Moscow, Russia moryakovdv[at]gmail[dot]com Licensed under the Apache
License, Version 2.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied. See the License for
the specific language governing permissions and limitations under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>spmi</groupId>
<groupId>org.gamc.spmi</groupId>
<artifactId>iwxxmConverter</artifactId>
<packaging>jar</packaging>
<version>0.0.7</version>
<packaging>pom</packaging>
<version>0.0.9</version>

<properties>
<javaVersion>1.8</javaVersion>
<project.source.version>${javaVersion}</project.source.version>
<project.target.version>${javaVersion}</project.target.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.encoding>UTF-8</project.encoding>
<slf4jVersion>1.7.25</slf4jVersion>
</properties>

<dependencyManagement>

<dependencies>




</properties>

</dependencies>

</dependencyManagement>


<dependencies>

<!-- https://mvnrepository.com/artifact/edu.ucar.ral.xml/crux -->
<!-- Junit -->
<dependency>
<groupId>edu.ucar.ral.xml</groupId>
<artifactId>crux</artifactId>
<version>1.2</version>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>

<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.7</version>
</dependency>

<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
<scope>compile</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/edu.ucar.ral.xml/crux -->
<dependency>
<groupId>edu.ucar.ral.xml</groupId>
<artifactId>crux</artifactId>
<version>1.2</version>
</dependency>


<!-- https://mvnrepository.com/artifact/com.helger/ph-schematron -->
<!-- https://mvnrepository.com/artifact/com.helger/ph-schematron -->
<dependency>
<groupId>com.helger</groupId>
<artifactId>ph-schematron</artifactId>
<version>5.0.1</version>
</dependency>


<!-- Junit -->
<!-- https://mvnrepository.com/artifact/org.mariuszgromada.math/MathParser.org-mXparser -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<groupId>org.mariuszgromada.math</groupId>
<artifactId>MathParser.org-mXparser</artifactId>
<version>4.1.1</version>
</dependency>

<!-- Logger -->

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4jVersion}</version>
<scope>compile</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4jVersion}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.7</version>
</dependency>



<!-- https://mvnrepository.com/artifact/org.mariuszgromada.math/MathParser.org-mXparser -->
<dependency>
<groupId>org.mariuszgromada.math</groupId>
<artifactId>MathParser.org-mXparser</artifactId>
<version>4.1.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.sun.jersey/jersey-grizzly -->
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.containers/jersey-container-grizzly2-http -->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-http</artifactId>
Expand All @@ -116,7 +112,7 @@
<artifactId>jersey-hk2</artifactId>
<version>2.26</version>
</dependency>



</dependencies>
Expand All @@ -129,29 +125,13 @@

<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>

<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>


<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId>
<version>2.9</version> <executions> <execution> <id>copy-dependencies</id>
<phase>prepare-package</phase> <goals> <goal>copy-dependencies</goal> </goals>
<configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>true</overWriteReleases> <overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer> </configuration> </execution> </executions>
</plugin> -->


<plugin>
Expand Down Expand Up @@ -232,4 +212,7 @@

</build>

<modules>
<module>IwxxmConverterRest</module>
</modules>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright (C) 2018 Dmitry Moryakov, Main aeronautical meteorological center, Moscow, Russia
* moryakovdv[at]gmail[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gamc.spmi.iwxxmConverter.sigmetconverter;

import org.gamc.spmi.iwxxmConverter.exceptions.ParsingException;

/**Derived class to throw exception during SIGMET processing*/
public class SIGMETParsingException extends ParsingException {

/**
*
*/
private static final long serialVersionUID = -5909939229644148539L;

public SIGMETParsingException(String string) {
super(string);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/**
* Copyright (C) 2018 Dmitry Moryakov, Main aeronautical meteorological center, Moscow, Russia
* moryakovdv[at]gmail[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gamc.spmi.iwxxmConverter.sigmetconverter;

import java.util.regex.Pattern;

import org.gamc.spmi.iwxxmConverter.common.MessageStatusType;
import org.gamc.spmi.iwxxmConverter.common.MessageType;
import org.gamc.spmi.iwxxmConverter.iwxxmenums.SPEED_UNITS;
import org.gamc.spmi.iwxxmConverter.tac.TacMessageImpl;
import org.joda.time.DateTime;
import org.joda.time.Interval;

/**
* Implemetation of a SIGMET Tac message
*
* @author moryakov
*/
public class SIGMETTacMessage extends TacMessageImpl {

public enum Severity {
OBSCURED,SQALL,EMBEDDED,FREQUENT,SEVERE,HEAVY, NOTSET;
}

public enum ObservationType {
FORECAST, OBSERVE, NOTSET;
}

private String firName;
private String phenomenaName;
private boolean isMoving=false;
private String movingDirection;
private int movingSpeed;
private SPEED_UNITS speedUnits;
private String fl;

private Severity phenomenaSeverity=Severity.NOTSET;
private ObservationType phenomenaObservation=ObservationType.NOTSET;



public SIGMETTacMessage(String initialTacMessage) {
super(initialTacMessage);

}

MessageStatusType messageStatusType = MessageStatusType.NORMAL;

@Override
public String getTacStartToken() {
return "";
}

@Override
public MessageType getMessageType() {
return MessageType.SIGMET;
}

@Override
public void parseMessage() throws SIGMETParsingException {



}

@Override
public MessageStatusType getMessageStatusType() {

return messageStatusType;
}

public void setMessageStatusType(MessageStatusType messageStatusType) {
this.messageStatusType = messageStatusType;
}

@Override
public Interval getValidityInterval() {

/**TODO - calculate sigmet validity!!*/
DateTime start = getMessageIssueDateTime();
DateTime end = getMessageIssueDateTime().plusMinutes(30);

return new Interval(start,end);
}

@Override
public Pattern getHeaderPattern() {
return SigmetParsingRegexp.sigmetHeader;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public class SigmetParsingRegexp {

/**SIGMET Mandatory header*/
public final static Pattern sigmetHeader = Pattern.compile(
"^(?<icao>[A-Z]{4})\\s+(?<isSigmet>SIGMET)\\s+(?<sigmetNumber>.?\\d+)\\s+(?<isValid>VALID)\\s+(?<ddf>\\d\\d)(?<hhf>\\d\\d)(?<mmf>\\d\\d)\\/(?<ddt>\\d\\d)(?<hht>\\d\\d)(?<mmt>\\d\\d)\\s+(?<watchOffice>[A-Z]{4})-?\\s+(?<firCode>[A-Z]{4})\\s+(?<firName>[A-Z]+)\\s+FIR(?<uir>\\/UIR)?");
"(?<icao>[A-Z]{4})\\s+(?<isSigmet>SIGMET)\\s+(?<sigmetNumber>(([A-Z]+)?\\s*\\d+))\\s+(?<isValid>VALID)\\s+(?<ddf>\\d\\d)(?<hhf>\\d\\d)(?<mmf>\\d\\d)\\/(?<ddt>\\d\\d)(?<hht>\\d\\d)(?<mmt>\\d\\d)\\s+(?<watchOffice>[A-Z]{4})-?\\s*(?<firCode>[A-Z]{4})?\\s+((?<firName>.+)\\s+(FIR|CTA))+(?<uir>\\/UIR)?");

/**Pattern for phenomenas except VA,VC*/
public final static Pattern sigmetPhenomena = Pattern.compile("(?<phenomenaType>OBSC|SQL|EMBD|FRQ|SEV|HVY)\\s+(?<phenomena>.+)\\s+(?<obsfcst>OBS|FCST)\\s+(?:AT\\s+(?<atHour>\\d\\d)(?<atMinutes>\\d\\d)Z)?");
public final static Pattern sigmetPhenomena = Pattern.compile("(?<severity>ISOL|OBSC|SQL|EMBD|FRQ|SEV|HVY)\\s+(?<phenomena>.+)\\s+(?<obsfcst>OBS|FCST)\\s+(?:AT\\s+(?<atHour>\\d\\d)(?<atMinutes>\\d\\d)Z)?");

/**Pattern to determine polygon*/
public final static Pattern sigmetFirRegion = Pattern.compile("(?<isFirRegion>WI)");
Expand All @@ -61,10 +61,13 @@ public class SigmetParsingRegexp {
/**Within corridor with distance of certain line*/
public final static Pattern sigmetWithin = Pattern.compile("(APRX|WTN)\\s+(?<range>\\d+)\\s?(KM|NM)\\s+(WID|OF)\\s+LINE\\s+(?:BTN|\\/)?");

/**Whether phenomena moves or stands and intensity*/
public final static Pattern sigmetMoves = Pattern.compile("((?<notMoving>STNR)|(MOV\\s+(?<movDirection>[A-Z]{1,3})\\s+(?<movSpeed>\\d+)(<?speedunits>KMH|KT)?))\\s+(?<force>INTSF|WKN|NC)?");

public final static Pattern sigmetSector = Pattern.compile("");


/**Vertical length (height) of the phenomena*/
public final static Pattern sigmetVerticalHeight = Pattern.compile("(?<hastopfl>(?<top>TOP)\\s+(?<above>ABV)?\\s*FL(?<fl>\\d+))|(?<hassurface>(?<surface>SFC)\\/(FL(?<topfl>(\\d+))|(?<heightmeters>\\d+)M))|(?<hasbothfls>FL(?<lowfl>\\d+)\\/(?<highfl>\\d+))");


}
Loading

0 comments on commit 09e87e7

Please sign in to comment.