Skip to content

Commit

Permalink
Sigmet phenomenon description blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
moryakovdv committed Jul 11, 2018
1 parent 09e87e7 commit 5726049
Show file tree
Hide file tree
Showing 6 changed files with 261 additions and 23 deletions.
136 changes: 136 additions & 0 deletions src/main/java/org/gamc/spmi/iwxxmConverter/common/CoordPoint.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
package org.gamc.spmi.iwxxmConverter.common;

import java.math.BigDecimal;

public final class CoordPoint {

private String latitude;
private int laDeg;
private int laMin;

private String longitude;
private int loDeg;
private int loMin;

public CoordPoint() {

}

public CoordPoint(String lat, int laDeg, int laMin, String lon, int loDeg, int loMin) {
this.latitude=lat;
this.laDeg = laDeg;
this.laMin = laMin;

this.longitude = lon;
this.loDeg = loDeg;
this.loMin = loMin;

}

@Override
public String toString() {

return String.format("%s%d%d %s%d%d", latitude,laDeg,laMin,longitude,loDeg,loMin);
}

/**Implement if need to get decimal coordinates*/
public BigDecimal getDecimalLatitude() {
throw new RuntimeException("Not implemented yet");
}

public BigDecimal getDecimalLongitude() {
throw new RuntimeException("Not implemented yet");
}

public String getLatitude() {
return latitude;
}

public void setLatitude(String latitude) {
this.latitude = latitude;
}

public int getLaDeg() {
return laDeg;
}

public void setLaDeg(int laDeg) {
this.laDeg = laDeg;
}

public int getLaMin() {
return laMin;
}

public void setLaMin(int laMin) {
this.laMin = laMin;
}

public String getLongitude() {
return longitude;
}

public void setLongitude(String longitude) {
this.longitude = longitude;
}

public int getLoDeg() {
return loDeg;
}

public void setLoDeg(int loDeg) {
this.loDeg = loDeg;
}

public int getLoMin() {
return loMin;
}

public void setLoMin(int loMin) {
this.loMin = loMin;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + laDeg;
result = prime * result + laMin;
result = prime * result + ((latitude == null) ? 0 : latitude.hashCode());
result = prime * result + loDeg;
result = prime * result + loMin;
result = prime * result + ((longitude == null) ? 0 : longitude.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CoordPoint other = (CoordPoint) obj;
if (laDeg != other.laDeg)
return false;
if (laMin != other.laMin)
return false;
if (latitude == null) {
if (other.latitude != null)
return false;
} else if (!latitude.equals(other.latitude))
return false;
if (loDeg != other.loDeg)
return false;
if (loMin != other.loMin)
return false;
if (longitude == null) {
if (other.longitude != null)
return false;
} else if (!longitude.equals(other.longitude))
return false;
return true;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,25 @@
import org.joda.time.Interval;

/**
* Implemetation of a SIGMET Tac message
* Implemetation of a SIGMET Tac message for meteorological sigmet (WS, not WV or WC)
*
* @author moryakov
*/
public class SIGMETTacMessage extends TacMessageImpl {

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

public enum ObservationType {
FORECAST, OBSERVE, NOTSET;
public enum Type {
METEO,VOLCANO,CYCLONE;
}

private DateTime validFrom;
private DateTime validTo;
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;





Expand Down Expand Up @@ -90,11 +85,7 @@ public void setMessageStatusType(MessageStatusType messageStatusType) {
@Override
public Interval getValidityInterval() {

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

return new Interval(start,end);
return new Interval(this.validFrom,this.validTo);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package org.gamc.spmi.iwxxmConverter.sigmetconverter;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.LinkedList;

import org.gamc.spmi.iwxxmConverter.common.CoordPoint;
import org.gamc.spmi.iwxxmConverter.common.Line;
import org.gamc.spmi.iwxxmConverter.iwxxmenums.RUMB_UNITS;


/**Describes location of the sigmet phenomenon inside FIR/UIR/CTA*/
public class SigmetHorizontalPhenomenonLocation {


/**Describes direction from certain line, e.g 'NE OF LINE ...'*/
public static final class DirectionFromLine implements Serializable {

private RUMB_UNITS direction;
private Line sigmetLine;

public RUMB_UNITS getDirection() {
return direction;
}
public void setDirection(RUMB_UNITS direction) {
this.direction = direction;
}
public Line getSigmetLine() {
return sigmetLine;
}
public void setSigmetLine(Line sigmetLine) {
this.sigmetLine = sigmetLine;
}


}

/**Phenomenon reported for entire FIR/UIR/CTA*/
private boolean entireFIR = false;

/**Phenomenon reported for polygon inside (WI token)*/
private boolean inPolygon = false;

/**Phenomenon reported for aisle(corridor) at both sides of certain line (e.g. WTN 45 NM OF LINE ...)*/
private boolean withinCorridor = false;

/**Wideness of the aisle(corridor) or radius from certain line*/
private int wideness;

/**Vertexes of polygon*/
private LinkedList<CoordPoint> polygonPoints = new LinkedList<>();

private LinkedList<DirectionFromLine> directionsFromLines = new LinkedList<>();


}
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ public class SigmetParsingRegexp {
/**Pattern for phenomenas except VA,VC*/
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 entire fir*/
public final static Pattern sigmetEntireFir = Pattern.compile("ENTIRE FIR(?:\\/UIR)?");

/**Pattern to determine polygon*/
public final static Pattern sigmetFirRegion = Pattern.compile("(?<isFirRegion>WI)");
public final static Pattern sigmetInPolygon = Pattern.compile("(?<isInPolygon>WI)");

/**Pattern to extract coordinate point*/
public final static Pattern sigmetCoordPoint = Pattern.compile("(?<point>(?<latitude>N|S)(?<ladeg>\\d{2})(?<lamin>\\d{2})?\\s+(?<longitude>E|W)(?<lodeg>\\d{2,3})(?<lomin>\\d{2})?)");

/**Pattern to determine entire fir*/
public final static Pattern sigmetEntireFir = Pattern.compile("ENTIRE FIR(?:\\/UIR)?");

/**Pattern to extract lines into collection*/
public final static Pattern sigmetLines = Pattern.compile("((N|NE|E|SE|S|SW|W|NW) OF LINE (?<pointStart>(?<latitudeStart>N|S)(?<ladegStart>\\d{2})(?<laminStart>\\d{2})?\\s+(?<longitudeStart>E|W))(?<lodegStart>\\d{2,3})(?<lominStart>\\d{2})?)\\s+(.)?\\s+(?<pointEnd>(?<latitudeEnd>N|S)(?<ladegEnd>\\d{2})(?<laminEnd>\\d{2})?\\s+(?<longitudeEnd>E|W)(?<lodegEnd>\\d{2,3})(?<lominEnd>\\d{2})?)");

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package org.gamc.spmi.iwxxmConverter.sigmetconverter;

import java.io.Serializable;


import org.gamc.spmi.iwxxmConverter.iwxxmenums.RUMB_UNITS;
import org.gamc.spmi.iwxxmConverter.iwxxmenums.SPEED_UNITS;
import org.joda.time.DateTime;

/**Description of meteorological phenomenon in the SIGMET*/
public class SigmetPhenomenonDescription implements Serializable {

/**
*
*/
private static final long serialVersionUID = 7906212608215801464L;



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

public enum ObservationType {
FORECAST, OBSERVE, NOTSET;
}



private String phenomenon;
private Severity phenomenonSeverity=Severity.NOTSET;
private ObservationType phenomenonObservation=ObservationType.NOTSET;
private DateTime phenomenonTimeStamp;

private boolean isMoving=false;
private RUMB_UNITS movingDirection;
private int movingSpeed;
private SPEED_UNITS speedUnits;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.gamc.spmi.iwxxmConverter.sigmetconverter;

import java.util.Optional;

/**Describes vertical location of the sigmet phenomenon e.g. from surface to FL or between two FLs*/
public class SigmetVerticalPhenomenonLocation {

private boolean topMarginAboveFl = false;
private boolean bottomMarginOnSurface = false;

private Optional<Integer> bottomFL;
private Optional<Integer> topFL;
private Optional<Integer> topMarginMeters;


}

0 comments on commit 5726049

Please sign in to comment.