Raytheon satellite decoder now handles McIDAS native projection reconstruction from postgresql.
Former-commit-id: cbb6c6f45b
This commit is contained in:
parent
b9f2552744
commit
d39bc148e7
3 changed files with 164 additions and 24 deletions
|
@ -387,7 +387,7 @@ public class SatSpatialFactory {
|
||||||
minY = -minY;
|
minY = -minY;
|
||||||
|
|
||||||
return new SatMapCoverage(crsType, minX, minY, nx, ny,
|
return new SatMapCoverage(crsType, minX, minY, nx, ny,
|
||||||
dx, dy, crs, geometry);
|
dx, dy, upperLeftElement, upperLeftLine, xres, yres, crs, geometry);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,3 +24,5 @@ Export-Package: com.raytheon.uf.common.dataplugin.satellite,
|
||||||
com.raytheon.uf.common.dataplugin.satellite.units.goes.convert,
|
com.raytheon.uf.common.dataplugin.satellite.units.goes.convert,
|
||||||
com.raytheon.uf.common.dataplugin.satellite.units.ir,
|
com.raytheon.uf.common.dataplugin.satellite.units.ir,
|
||||||
com.raytheon.uf.common.dataplugin.satellite.units.water
|
com.raytheon.uf.common.dataplugin.satellite.units.water
|
||||||
|
Import-Package: gov.noaa.nws.ncep.common.dataplugin.mcidas,
|
||||||
|
gov.noaa.nws.ncep.common.tools
|
||||||
|
|
|
@ -20,6 +20,10 @@
|
||||||
|
|
||||||
package com.raytheon.uf.common.dataplugin.satellite;
|
package com.raytheon.uf.common.dataplugin.satellite;
|
||||||
|
|
||||||
|
import gov.noaa.nws.ncep.common.dataplugin.mcidas.McidasMapCoverage;
|
||||||
|
import gov.noaa.nws.ncep.common.dataplugin.mcidas.McidasSpatialFactory;
|
||||||
|
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
|
||||||
|
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
@ -86,7 +90,8 @@ import com.vividsolutions.jts.geom.Polygon;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "satellite_spatial", uniqueConstraints = { @UniqueConstraint(columnNames = {
|
@Table(name = "satellite_spatial", uniqueConstraints = { @UniqueConstraint(columnNames = {
|
||||||
"minX", "minY", "dx", "dy", "nx", "ny", "crsWKT" }) })
|
"minX", "minY", "dx", "dy", "nx", "ny", "upperLeftElement",
|
||||||
|
"upperLeftLine", "elementRes", "lineRes", "crsWKT" }) })
|
||||||
@SequenceGenerator(name = "SATELLITE_SPATIAL_GENERATOR", sequenceName = "satspatial_seq", allocationSize = 1)
|
@SequenceGenerator(name = "SATELLITE_SPATIAL_GENERATOR", sequenceName = "satspatial_seq", allocationSize = 1)
|
||||||
@XmlAccessorType(XmlAccessType.NONE)
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
@DynamicSerialize
|
@DynamicSerialize
|
||||||
|
@ -152,6 +157,30 @@ public class SatMapCoverage extends PersistableDataObject<Object> implements
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
private double dy;
|
private double dy;
|
||||||
|
|
||||||
|
/** image element coordinate of area line 0, element 0 */
|
||||||
|
@Column
|
||||||
|
@XmlAttribute
|
||||||
|
@DynamicSerializeElement
|
||||||
|
private int upperLeftElement;
|
||||||
|
|
||||||
|
/** image line coordinate of area line 0, element 0 */
|
||||||
|
@Column
|
||||||
|
@XmlAttribute
|
||||||
|
@DynamicSerializeElement
|
||||||
|
private int upperLeftLine;
|
||||||
|
|
||||||
|
/** element resolution */
|
||||||
|
@Column
|
||||||
|
@XmlAttribute
|
||||||
|
@DynamicSerializeElement
|
||||||
|
private int elementRes;
|
||||||
|
|
||||||
|
/** line resolution */
|
||||||
|
@Column
|
||||||
|
@XmlAttribute
|
||||||
|
@DynamicSerializeElement
|
||||||
|
private int lineRes;
|
||||||
|
|
||||||
@Column(length = 5120)
|
@Column(length = 5120)
|
||||||
@XmlAttribute
|
@XmlAttribute
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
|
@ -193,7 +222,31 @@ public class SatMapCoverage extends PersistableDataObject<Object> implements
|
||||||
*/
|
*/
|
||||||
public SatMapCoverage(int projection, double minX, double minY, int nx,
|
public SatMapCoverage(int projection, double minX, double minY, int nx,
|
||||||
int ny, double dx, double dy, CoordinateReferenceSystem crs) {
|
int ny, double dx, double dy, CoordinateReferenceSystem crs) {
|
||||||
this(projection, minX, minY, nx, ny, dx, dy, crs, null);
|
this.projection = projection;
|
||||||
|
this.minX = minX;
|
||||||
|
this.minY = minY;
|
||||||
|
this.nx = nx;
|
||||||
|
this.ny = ny;
|
||||||
|
this.dx = dx;
|
||||||
|
this.dy = dy;
|
||||||
|
this.upperLeftElement = IDecoderConstantsN.INTEGER_MISSING;
|
||||||
|
this.upperLeftLine = IDecoderConstantsN.INTEGER_MISSING;
|
||||||
|
this.elementRes = IDecoderConstantsN.INTEGER_MISSING;
|
||||||
|
this.lineRes = IDecoderConstantsN.INTEGER_MISSING;
|
||||||
|
this.crsObject = crs;
|
||||||
|
Geometry latLonGeometry = null;
|
||||||
|
try {
|
||||||
|
latLonGeometry = EnvelopeIntersection
|
||||||
|
.createEnvelopeIntersection(
|
||||||
|
getGridGeometry().getEnvelope(),
|
||||||
|
new Envelope2D(DefaultGeographicCRS.WGS84,
|
||||||
|
-180, -90, 360, 180), 1.0, 10, 10)
|
||||||
|
.getEnvelope();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// Ignore exception, null location
|
||||||
|
}
|
||||||
|
|
||||||
|
this.location = latLonGeometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -219,7 +272,8 @@ public class SatMapCoverage extends PersistableDataObject<Object> implements
|
||||||
* A Geometry representing the satellite bounds in lat/lon space
|
* A Geometry representing the satellite bounds in lat/lon space
|
||||||
*/
|
*/
|
||||||
public SatMapCoverage(int projection, double minX, double minY, int nx,
|
public SatMapCoverage(int projection, double minX, double minY, int nx,
|
||||||
int ny, double dx, double dy, CoordinateReferenceSystem crs,
|
int ny, double dx, double dy, int upperLeftElement,
|
||||||
|
int upperLeftLine, int xres, int yres, CoordinateReferenceSystem crs,
|
||||||
Geometry latLonGeometry) {
|
Geometry latLonGeometry) {
|
||||||
this.projection = projection;
|
this.projection = projection;
|
||||||
this.minX = minX;
|
this.minX = minX;
|
||||||
|
@ -228,19 +282,11 @@ public class SatMapCoverage extends PersistableDataObject<Object> implements
|
||||||
this.ny = ny;
|
this.ny = ny;
|
||||||
this.dx = dx;
|
this.dx = dx;
|
||||||
this.dy = dy;
|
this.dy = dy;
|
||||||
|
this.upperLeftElement = upperLeftElement;
|
||||||
|
this.upperLeftLine = upperLeftLine;
|
||||||
|
this.elementRes = xres;
|
||||||
|
this.lineRes = yres;
|
||||||
this.crsObject = crs;
|
this.crsObject = crs;
|
||||||
if (latLonGeometry == null) {
|
|
||||||
try {
|
|
||||||
latLonGeometry = EnvelopeIntersection
|
|
||||||
.createEnvelopeIntersection(
|
|
||||||
getGridGeometry().getEnvelope(),
|
|
||||||
new Envelope2D(DefaultGeographicCRS.WGS84,
|
|
||||||
-180, -90, 360, 180), 1.0, 10, 10)
|
|
||||||
.getEnvelope();
|
|
||||||
} catch (Exception e) {
|
|
||||||
// Ignore exception, null location
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.location = latLonGeometry;
|
this.location = latLonGeometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,6 +366,66 @@ public class SatMapCoverage extends PersistableDataObject<Object> implements
|
||||||
this.dy = dy;
|
this.dy = dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the upperLeftElement
|
||||||
|
*/
|
||||||
|
public int getUpperLeftElement() {
|
||||||
|
return upperLeftElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param upperLeftElement
|
||||||
|
* the upperLeftElement to set
|
||||||
|
*/
|
||||||
|
public void setUpperLeftElement(int upperLeftElement) {
|
||||||
|
this.upperLeftElement = upperLeftElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the upperLeftLine
|
||||||
|
*/
|
||||||
|
public int getUpperLeftLine() {
|
||||||
|
return upperLeftLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param upperLeftLine
|
||||||
|
* the upperLeftLine to set
|
||||||
|
*/
|
||||||
|
public void setUpperLeftLine(int upperLeftLine) {
|
||||||
|
this.upperLeftLine = upperLeftLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the elementRes
|
||||||
|
*/
|
||||||
|
public int getElementRes() {
|
||||||
|
return elementRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param elementRes
|
||||||
|
* the elementRes to set
|
||||||
|
*/
|
||||||
|
public void setElementRes(int elementRes) {
|
||||||
|
this.elementRes = elementRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the lineRes
|
||||||
|
*/
|
||||||
|
public int getLineRes() {
|
||||||
|
return lineRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param lineRes
|
||||||
|
* the lineRes to set
|
||||||
|
*/
|
||||||
|
public void setLineRes(int lineRes) {
|
||||||
|
this.lineRes = lineRes;
|
||||||
|
}
|
||||||
|
|
||||||
public String getCrsWKT() {
|
public String getCrsWKT() {
|
||||||
if (crsWKT == null && crsObject != null) {
|
if (crsWKT == null && crsObject != null) {
|
||||||
crsWKT = crsObject.toWKT();
|
crsWKT = crsObject.toWKT();
|
||||||
|
@ -328,7 +434,7 @@ public class SatMapCoverage extends PersistableDataObject<Object> implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCrsWKT(String crsWKT) {
|
public void setCrsWKT(String crsWKT) {
|
||||||
this.crsWKT = crsWKT;
|
this.crsWKT = crsWKT.replaceAll("\r\n", "");
|
||||||
if (crsObject != null) {
|
if (crsObject != null) {
|
||||||
crsObject = null;
|
crsObject = null;
|
||||||
}
|
}
|
||||||
|
@ -368,11 +474,18 @@ public class SatMapCoverage extends PersistableDataObject<Object> implements
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public CoordinateReferenceSystem getCrs() {
|
public CoordinateReferenceSystem getCrs() {
|
||||||
if (crsObject == null && crsWKT != null) {
|
if (crsObject == null && crsWKT != null) {
|
||||||
try {
|
try {
|
||||||
|
if (this.projection == PROJ_GVAR) {
|
||||||
|
crsObject = McidasSpatialFactory.getInstance()
|
||||||
|
.constructCRSfromWKT(crsWKT);
|
||||||
|
|
||||||
|
} else {
|
||||||
crsObject = CRSCache.getInstance()
|
crsObject = CRSCache.getInstance()
|
||||||
.getCoordinateReferenceSystem(crsWKT);
|
.getCoordinateReferenceSystem(crsWKT);
|
||||||
|
}
|
||||||
} catch (FactoryException e) {
|
} catch (FactoryException e) {
|
||||||
crsObject = null;
|
crsObject = null;
|
||||||
}
|
}
|
||||||
|
@ -382,16 +495,36 @@ public class SatMapCoverage extends PersistableDataObject<Object> implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GridGeometry2D getGridGeometry() {
|
public GridGeometry2D getGridGeometry() {
|
||||||
|
/*
|
||||||
GridEnvelope gridRange;
|
GridEnvelope gridRange;
|
||||||
Envelope crsRange;
|
Envelope crsRange;
|
||||||
|
|
||||||
int nx = getNx();
|
|
||||||
int ny = getNy();
|
|
||||||
gridRange = new GridEnvelope2D(0, 0, getNx(), getNy());
|
gridRange = new GridEnvelope2D(0, 0, getNx(), getNy());
|
||||||
crsRange = new Envelope2D(getCrs(), new Rectangle2D.Double(
|
crsRange = new Envelope2D(getCrs(), new Rectangle2D.Double(
|
||||||
minX, minY, getNx() * getDx(), getNy() * getDy()));
|
minX, minY, getNx() * getDx(), getNy() * getDy()));
|
||||||
|
*/
|
||||||
|
GridEnvelope gridRange;
|
||||||
|
Envelope crsRange;
|
||||||
|
if (projection == PROJ_GVAR) { // for native projection
|
||||||
|
minX = getUpperLeftElement();
|
||||||
|
int maxX = getUpperLeftElement() + (getNx() * getElementRes());
|
||||||
|
minY = getUpperLeftLine() + (getNy() * getLineRes());
|
||||||
|
minY = -minY;
|
||||||
|
int maxY = -1 * getUpperLeftLine();
|
||||||
|
|
||||||
|
gridRange = new GridEnvelope2D(0, 0, nx, ny);
|
||||||
|
Rectangle2D rect = new Rectangle2D.Double(minX,
|
||||||
|
minY, maxX, maxY);
|
||||||
|
crsRange = new Envelope2D(getCrs(), rect );
|
||||||
|
}else {
|
||||||
|
int nx = getNx();
|
||||||
|
int ny = getNy();
|
||||||
|
|
||||||
|
gridRange = new GridEnvelope2D(0, 0, nx, ny);
|
||||||
|
crsRange = new Envelope2D(getCrs(), new Rectangle2D.Double(minX,
|
||||||
|
minY, nx * getDx(), ny * getDy()));
|
||||||
|
}
|
||||||
|
GridGeometry2D tmpGrid = new GridGeometry2D(gridRange, crsRange);
|
||||||
return new GridGeometry2D(gridRange, crsRange);
|
return new GridGeometry2D(gridRange, crsRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,6 +542,11 @@ public class SatMapCoverage extends PersistableDataObject<Object> implements
|
||||||
return builder.toHashCode();
|
return builder.toHashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Geometry getGeometry() {
|
||||||
|
return getLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj)
|
if (this == obj)
|
||||||
|
|
Loading…
Add table
Reference in a new issue