Merge pull request #557 from tiffanycmeyer13/unidata_20.3.2
UNIWISC and NPP/VIIRS Updates
This commit is contained in:
commit
02a94228cd
33 changed files with 992 additions and 301 deletions
|
@ -1,6 +1,5 @@
|
|||
output.com.raytheon.uf.viz.npp.nucaps.jar = bin/
|
||||
bin.includes = META-INF/,\
|
||||
localization/,\
|
||||
plugin.xml,\
|
||||
com.raytheon.uf.viz.npp.nucaps.jar
|
||||
source.com.raytheon.uf.viz.npp.nucaps.jar = src/
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
output.com.raytheon.uf.viz.npp.viirs.jar = bin/
|
||||
bin.includes = META-INF/,\
|
||||
plugin.xml,\
|
||||
localization/,\
|
||||
res/,\
|
||||
com.raytheon.uf.viz.npp.viirs.jar
|
||||
source.com.raytheon.uf.viz.npp.viirs.jar = src/
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
output.com.raytheon.uf.viz.npp.jar = bin/
|
||||
bin.includes = META-INF/,\
|
||||
localization/,\
|
||||
com.raytheon.uf.viz.npp.jar
|
||||
source.com.raytheon.uf.viz.npp.jar = src/
|
||||
|
|
|
@ -50,6 +50,7 @@ import com.raytheon.uf.edex.database.dao.DaoConfig;
|
|||
* Jun 27, 2012 798 jkorman Corrected id query type.
|
||||
* Oct 02, 2013 2333 mschenke Removed unused code
|
||||
* Nov 05, 2014 3788 bsteffen add getOrCreateCoverage
|
||||
* Apr 30, 2016 ---- mjames add Criteria for line element/res
|
||||
* Mar 25, 2020 8103 randerso Fixed ContraintViolationException handling
|
||||
*
|
||||
* </pre>
|
||||
|
@ -144,6 +145,10 @@ public class SatMapCoverageDao extends CoreDao {
|
|||
crit.add(Restrictions.eq("ny", coverage.getNy()));
|
||||
crit.add(Restrictions.eq("dx", coverage.getDx()));
|
||||
crit.add(Restrictions.eq("dy", coverage.getDy()));
|
||||
crit.add(Restrictions.eq("upperLeftElement", coverage.getUpperLeftElement()));
|
||||
crit.add(Restrictions.eq("upperLeftLine", coverage.getUpperLeftLine()));
|
||||
crit.add(Restrictions.eq("elementRes", coverage.getElementRes()));
|
||||
crit.add(Restrictions.eq("lineRes", coverage.getLineRes()));
|
||||
crit.add(Restrictions.eq("minX", coverage.getMinX()));
|
||||
crit.add(Restrictions.eq("minY", coverage.getMinY()));
|
||||
crit.add(Restrictions.eq("crsWKT", coverage.getCrsWKT()));
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
package com.raytheon.edex.util.satellite;
|
||||
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import org.geotools.geometry.DirectPosition2D;
|
||||
import org.opengis.referencing.crs.ProjectedCRS;
|
||||
import org.opengis.referencing.operation.MathTransform;
|
||||
|
@ -29,6 +31,8 @@ import com.raytheon.edex.plugin.satellite.dao.SatMapCoverageDao;
|
|||
import com.raytheon.uf.common.dataplugin.satellite.SatMapCoverage;
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
import org.locationtech.jts.geom.Envelope;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.locationtech.jts.io.WKTReader;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -47,6 +51,8 @@ import org.locationtech.jts.geom.Envelope;
|
|||
* Sep 15, 2014 17303 jgerth Support for second standard latitude
|
||||
* Nov 05, 2014 2714 bclement replaced DecoderException with SatelliteDecoderException
|
||||
* Nov 05, 2014 3788 bsteffen use getOrCreateCoverage in place of queryByMapId
|
||||
* May 11, 2015 mjames South polar stereographic support added.
|
||||
* May 19, 2015 mjames Added GVAR native projection support.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -63,6 +69,8 @@ public class SatSpatialFactory {
|
|||
|
||||
public static final int PROJ_POLAR = 5;
|
||||
|
||||
public static final int PROJ_GVAR = 7585;
|
||||
|
||||
public static final int PROJ_CYLIN_EQUIDISTANT = 7;
|
||||
|
||||
public static final int UNDEFINED = -1;
|
||||
|
@ -209,6 +217,58 @@ public class SatSpatialFactory {
|
|||
return getCoverageSingleCorner(crsType, nx, ny, lov, latin, latin, la1, lo1, dx, dy);
|
||||
}
|
||||
|
||||
|
||||
public SatMapCoverage getCoverageNative(int crsType, int nx, int ny,
|
||||
double reflon, int upperLeftElement, int upperLeftLine,
|
||||
int xres, int yres, ProjectedCRS crs)
|
||||
throws SatelliteDecoderException {
|
||||
try {
|
||||
|
||||
// Construct the polygon constructor String
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("POLYGON((");
|
||||
buffer.append(reflon - 90. + " -90.0,");
|
||||
buffer.append(reflon + 90. + " -90.0,");
|
||||
buffer.append(reflon + 90. + " 90.0,");
|
||||
buffer.append(reflon - 90. + " 90.0,");
|
||||
buffer.append(reflon - 90. + " -90.0");
|
||||
buffer.append("))");
|
||||
// Create the geometry from the constructed String
|
||||
Geometry geometry = new WKTReader().read(buffer.toString());
|
||||
|
||||
// Construct rectangle
|
||||
double minX = upperLeftElement;
|
||||
int maxX = upperLeftElement + (nx * xres);
|
||||
double minY = upperLeftLine + (ny * yres);
|
||||
minY = -minY;
|
||||
int maxY = -1 * upperLeftLine;
|
||||
Rectangle2D rect = new Rectangle2D.Double(minX,
|
||||
minY, maxX, maxY);
|
||||
|
||||
SatMapCoverage coverage = createCoverageFromNative(crsType, nx, ny,
|
||||
reflon, upperLeftElement, upperLeftLine,
|
||||
xres, yres, crs, geometry );
|
||||
|
||||
return checkPersisted(coverage);
|
||||
|
||||
} catch (Exception e) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(
|
||||
"Error getting or constructing SatMapCoverage for values: ")
|
||||
.append("\n\t");
|
||||
buf.append("crsType=" + crsType).append("\n\t");
|
||||
buf.append("nx=" + nx).append("\n\t");
|
||||
buf.append("ny=" + ny).append("\n\t");
|
||||
buf.append("reflon=" + reflon).append("\n\t");
|
||||
buf.append("upperLeftElement=" + upperLeftElement).append("\n\t");
|
||||
buf.append("upperLeftLine=" + upperLeftLine).append("\n\t");
|
||||
buf.append("xres=" + xres).append("\n\t");
|
||||
buf.append("yres=" + yres).append("\n\t");
|
||||
throw new SatelliteDecoderException(buf.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Create a {@link SatMapCoverage} with an area defined by two corners. The
|
||||
|
@ -309,6 +369,24 @@ public class SatSpatialFactory {
|
|||
envelope.getMinY(), nx, ny, dx, dy, crs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a SatMapCoverage from native projection
|
||||
*/
|
||||
private static SatMapCoverage createCoverageFromNative(Integer crsType,
|
||||
Integer nx, Integer ny, double reflon, int upperLeftElement,
|
||||
int upperLeftLine, int xres, int yres, ProjectedCRS crs,
|
||||
Geometry geometry) {
|
||||
float dx = 999999.f;
|
||||
float dy = 999999.f;
|
||||
double minX, minY;
|
||||
minX = upperLeftElement;
|
||||
minY = upperLeftLine + (ny * yres);
|
||||
minY = -minY;
|
||||
return new SatMapCoverage(crsType, minX, minY, nx, ny,
|
||||
dx, dy, upperLeftElement, upperLeftLine,
|
||||
xres, yres, crs, geometry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@link ProjectedCRS} from a crsType and some parameters.
|
||||
*
|
||||
|
@ -336,6 +414,11 @@ public class SatSpatialFactory {
|
|||
switch (crsType) {
|
||||
case PROJ_MERCATOR:
|
||||
return createMercatorCrs(latin, cm);
|
||||
case PROJ_POLAR:
|
||||
if (latin >= 0.)
|
||||
return createNorthPolarStereoCrs(lov);
|
||||
else
|
||||
return createSouthPolarStereoCrs(latin, lov);
|
||||
case PROJ_LAMBERT:
|
||||
return createLambertCrs(latin, latin2, lov);
|
||||
case PROJ_CYLIN_EQUIDISTANT:
|
||||
|
@ -366,4 +449,9 @@ public class SatSpatialFactory {
|
|||
MapUtil.AWIPS_EARTH_RADIUS, 60, lov);
|
||||
}
|
||||
|
||||
private static ProjectedCRS createSouthPolarStereoCrs(double latin, double lov) {
|
||||
return MapUtil.constructSouthPolarStereo(MapUtil.AWIPS_EARTH_RADIUS,
|
||||
MapUtil.AWIPS_EARTH_RADIUS, latin, lov);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,80 +1,122 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<!--
|
||||
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
|
||||
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
|
||||
|
||||
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
|
||||
This_software_product_contains_export-restricted_data_whose
|
||||
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
|
||||
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
|
||||
an_export_license_or_other_authorization.
|
||||
|
||||
Contractor_Name:________Raytheon_Company
|
||||
Contractor_Address:_____6825_Pine_Street,_Suite_340
|
||||
________________________Mail_Stop_B8
|
||||
________________________Omaha,_NE_68106
|
||||
________________________402.291.0100
|
||||
|
||||
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
|
||||
further_licensing_information.
|
||||
-->
|
||||
<!--
|
||||
This is an absolute override file, indicating that a higher priority
|
||||
version of the file will completely replace a lower priority version
|
||||
of the file.
|
||||
-->
|
||||
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<contribute xsi:type="satBundleItem"
|
||||
file="bundles/DefaultCompositeSatellite.xml" menuText="IR Window"
|
||||
id="irWindow">
|
||||
<substitute key="timeMatchMode" value="${blendedTimeMatchMode;ALL_IMAGES}" />
|
||||
<contribute xsi:type="separator" id="Separator"/>
|
||||
<contribute xsi:type="titleItem" titleText="------ Legacy Satellitle Data ------" id="legacySat"/>
|
||||
<contribute xsi:type="subMenu" menuText="Legacy Satellite Data">
|
||||
<contribute xsi:type="titleItem" titleText="------ Composite Imagery ------" id="CompositeImagery" />
|
||||
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
|
||||
menuText="Global Rectilinear 20km IR" id="waterVapor">
|
||||
<substitute key="element" value="Imager 11 micron IR"/>
|
||||
<substitute key="sector" value="AREA3100"/>
|
||||
<substitute key="entity" value="UNIWISC"/>
|
||||
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="satBundleItem"
|
||||
file="bundles/DefaultCompositeSatellite.xml" menuText="Water Vapor"
|
||||
id="waterVapor">
|
||||
<substitute key="timeMatchMode" value="${blendedTimeMatchMode;ALL_IMAGES}" />
|
||||
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
|
||||
menuText="Global Rectilinear 20km WV" id="waterVapor">
|
||||
<substitute key="element" value="Imager 6.7-6.5 micron IR (WV)"/>
|
||||
<substitute key="colormap" value="Sat/WV/Gray Scale Water Vapor" />
|
||||
<substitute key="sector" value="AREA3101"/>
|
||||
<substitute key="entity" value="UNIWISC"/>
|
||||
<substitute key="colormap" value="Sat/WV/RAMSDIS WV"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="satBundleItem"
|
||||
file="bundles/DefaultCompositeSatellite.xml" menuText="Visible"
|
||||
id="visible">
|
||||
<substitute key="timeMatchMode" value="${blendedTimeMatchMode;ALL_IMAGES}" />
|
||||
<substitute key="element" value="Imager Visible" />
|
||||
<substitute key="colormap" value="Sat/VIS/ZA (Vis Default)" />
|
||||
</contribute>
|
||||
<contribute xsi:type="satBundleItem" file="bundles/DefaultCONUSSatellite.xml"
|
||||
menuText="3.9u" id="3.9u">
|
||||
<substitute key="element" value="Imager 3.9 micron IR" />
|
||||
<substitute key="colormap" value="Sat/VIS/ZA (Vis Default)" />
|
||||
</contribute>
|
||||
<contribute xsi:type="satBundleItem" file="bundles/DefaultCONUSSatellite.xml"
|
||||
menuText="13u" id="13u">
|
||||
<substitute key="element" value="Imager 13 micron (IR)" />
|
||||
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
|
||||
menuText="Global Mollweide 30km IR" id="waterVapor">
|
||||
<substitute key="element" value="Imager 11 micron IR"/>
|
||||
<substitute key="sector" value="AREA0700"/>
|
||||
<substitute key="entity" value="UNIWISC"/>
|
||||
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="satBundleItem" file="bundles/DerivedCONUSSatellite.xml"
|
||||
menuText="11u-3.9u" id="11-3.9u">
|
||||
<substitute key="element" value="satDif11u3_9uIR" />
|
||||
<substitute key="colormap" value="Sat/VIS/CA (Low Light Vis)" />
|
||||
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
|
||||
menuText="Global Mollweide 30km WV" id="waterVapor">
|
||||
<substitute key="element" value="Imager 6.7-6.5 micron IR (WV)"/>
|
||||
<substitute key="sector" value="AREA0600"/>
|
||||
<substitute key="entity" value="UNIWISC"/>
|
||||
<substitute key="colormap" value="Sat/WV/RAMSDIS WV"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="satBundleItem" file="bundles/DerivedCONUSSatellite.xml"
|
||||
menuText="11u-13u" id="11u-13u">
|
||||
<substitute key="timeMatchMode" value="${blendedTimeMatchMode;ALL_IMAGES}" />
|
||||
<substitute key="element" value="satDif11u13uIR" />
|
||||
<substitute key="colormap" value="Grid/gridded data" />
|
||||
|
||||
<contribute xsi:type="separator" id="Separator"/>
|
||||
|
||||
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
|
||||
menuText="Arctic 12 micron IR" id="irWindow">
|
||||
<substitute key="element" value="Imager 12 micron IR"/>
|
||||
<substitute key="sector" value="Arctic"/>
|
||||
<substitute key="entity" value="UNIWISC" />
|
||||
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="satBundleItem"
|
||||
file="bundles/DerivedCompositeSatellite.xml" menuText="WV/IR"
|
||||
id="WV/IR">
|
||||
<substitute key="timeMatchMode" value="${blendedTimeMatchMode;ALL_IMAGES}" />
|
||||
<substitute key="element" value="satDivWVIR" />
|
||||
<substitute key="colormap" value="Sat/IR/IR WV" />
|
||||
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
|
||||
menuText="Arctic 11 micron IR" id="irWindow">
|
||||
<substitute key="element" value="Imager 11 micron IR"/>
|
||||
<substitute key="sector" value="Arctic"/>
|
||||
<substitute key="entity" value="UNIWISC" />
|
||||
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
|
||||
menuText="Arctic 3.5-4.0 micron IR (Fog)" id="irWindow">
|
||||
<substitute key="element" value="Imager 3.5-4.0 micron IR (Fog)"/>
|
||||
<substitute key="sector" value="Arctic"/>
|
||||
<substitute key="entity" value="UNIWISC" />
|
||||
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
|
||||
menuText="Arctic 6.7-6.5 micron IR (WV)" id="irWindow">
|
||||
<substitute key="element" value="Imager 6.7-6.5 micron IR (WV)"/>
|
||||
<substitute key="sector" value="Arctic"/>
|
||||
<substitute key="entity" value="UNIWISC" />
|
||||
<substitute key="colormap" value="Sat/WV/RAMSDIS WV"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
|
||||
menuText="Arctic Visible" id="visible">
|
||||
<substitute key="element" value="Imager Visible"/>
|
||||
<substitute key="sector" value="Arctic"/>
|
||||
<substitute key="entity" value="UNIWISC" />
|
||||
<substitute key="colormap" value="Sat/VIS/Linear"/>
|
||||
</contribute>
|
||||
|
||||
<contribute xsi:type="separator" id="MySeparatorId"/>
|
||||
|
||||
|
||||
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
|
||||
menuText="Antarctic 12 micron IR" id="irWindow">
|
||||
<substitute key="element" value="Imager 12 micron IR"/>
|
||||
<substitute key="sector" value="Antarctic"/>
|
||||
<substitute key="entity" value="UNIWISC" />
|
||||
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
|
||||
menuText="Antarctic 11 micron IR" id="irWindow">
|
||||
<substitute key="element" value="Imager 11 micron IR"/>
|
||||
<substitute key="sector" value="Antarctic"/>
|
||||
<substitute key="entity" value="UNIWISC" />
|
||||
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
|
||||
menuText="Antarctic 3.5-4.0 micron IR (Fog)" id="irWindow">
|
||||
<substitute key="element" value="Imager 3.5-4.0 micron IR (Fog)"/>
|
||||
<substitute key="sector" value="Antarctic"/>
|
||||
<substitute key="entity" value="UNIWISC" />
|
||||
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
|
||||
menuText="Antarctic 6.7-6.5 micron IR (WV)" id="irWindow">
|
||||
<substitute key="element" value="Imager 6.7-6.5 micron IR (WV)"/>
|
||||
<substitute key="sector" value="Antarctic"/>
|
||||
<substitute key="entity" value="UNIWISC" />
|
||||
<substitute key="colormap" value="Sat/WV/RAMSDIS WV"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
|
||||
menuText="Antarctic Visible" id="visible">
|
||||
<substitute key="element" value="Imager Visible"/>
|
||||
<substitute key="sector" value="Antarctic"/>
|
||||
<substitute key="entity" value="UNIWISC" />
|
||||
<substitute key="colormap" value="Sat/VIS/Linear"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="titleItem" titleText="------ Satellite Winds ------" id="SatWind" />
|
||||
<contribute xsi:type="bundleItem" file="bundles/Scatterometer.xml"
|
||||
menuText="ASCAT Winds 25 km" id="ASCATWinds">
|
||||
<substitute key="legend" value="ASCAT"/>
|
||||
<substitute key="svg" value="ascatPlotDesign.svg"/>
|
||||
<substitute key="plugin" value="bufrascat"/>
|
||||
<substitute key="posOffset" value="5400"/>
|
||||
<substitute key="negOffset" value="5400"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="satBundleItem"
|
||||
file="bundles/satellite/FourPanelGoesMtoQ.xml" menuText="4 panel (GOES M-Q)"
|
||||
id="4_panel_(GOES_M-Q)">
|
||||
</contribute>
|
||||
</menuTemplate>
|
|
@ -3,9 +3,7 @@
|
|||
<include installTo="menu:satellite?before=GOESR"
|
||||
fileName="menus/satellite/goesr/goesrMenu.xml">
|
||||
</include>
|
||||
<!--
|
||||
<include installTo="menu:satellite?after=GOESR"
|
||||
<include installTo="menu:satellite"
|
||||
fileName="menus/satellite/baseSatellite.xml">
|
||||
</include>
|
||||
-->
|
||||
</menuContributionFile>
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
package com.raytheon.uf.common.dataplugin.satellite;
|
||||
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
@ -37,22 +39,30 @@ import javax.xml.bind.annotation.XmlAttribute;
|
|||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
import org.geotools.coverage.grid.GeneralGridEnvelope;
|
||||
import org.geotools.coverage.grid.GridEnvelope2D;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.geotools.geometry.Envelope2D;
|
||||
import org.geotools.geometry.GeneralEnvelope;
|
||||
import org.geotools.referencing.crs.DefaultGeographicCRS;
|
||||
import org.geotools.referencing.operation.DefaultMathTransformFactory;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.GeometryFactory;
|
||||
import org.locationtech.jts.geom.Polygon;
|
||||
import org.opengis.coverage.grid.GridEnvelope;
|
||||
import org.opengis.geometry.Envelope;
|
||||
import org.opengis.parameter.ParameterValueGroup;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.NoSuchIdentifierException;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
import org.opengis.referencing.crs.ProjectedCRS;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
|
||||
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
|
||||
import com.raytheon.uf.common.geospatial.CRSCache;
|
||||
import com.raytheon.uf.common.geospatial.IGridGeometryProvider;
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
import com.raytheon.uf.common.geospatial.adapter.GeometryAdapter;
|
||||
import com.raytheon.uf.common.geospatial.util.EnvelopeIntersection;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
@ -81,6 +91,8 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
* Apr 11, 2014 2947 bsteffen Fix equals
|
||||
* Oct 16, 2014 3454 bphillip Upgrading to Hibernate 4
|
||||
* Nov 05, 2014 3788 bsteffen Make gid a sequence instead of a hash.
|
||||
* May 19, 2015 mjames Added McIDAS GVAR native projection support.
|
||||
* Apr 03, 2017 mjames Un-deprecate projection and fix for goesr ingest.
|
||||
* Mar 20, 2019 6140 tgurney Hibernate 5 GeometryType fix
|
||||
* May 8, 2019 6140 tgurney Lower the log level of some previously
|
||||
* ignored exceptions (from error to debug)
|
||||
|
@ -88,15 +100,19 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
* </pre>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "satellite_spatial", uniqueConstraints = {
|
||||
@UniqueConstraint(columnNames = { "minX", "minY", "dx", "dy", "nx",
|
||||
"ny", "crsWKT" }) })
|
||||
@Table(name = "satellite_spatial", uniqueConstraints = { @UniqueConstraint(columnNames = {
|
||||
"minX", "minY", "dx", "dy", "nx", "ny", "projection", "upperLeftElement",
|
||||
"upperLeftLine", "elementRes", "lineRes", "crsWKT" }) })
|
||||
@SequenceGenerator(name = "SATELLITE_SPATIAL_GENERATOR", sequenceName = "satspatial_seq", allocationSize = 1)
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
public class SatMapCoverage extends PersistableDataObject<Object>
|
||||
implements IGridGeometryProvider {
|
||||
|
||||
public static final int PROJ_GVAR = 7585;
|
||||
|
||||
public static final Integer VAL_MISSING = new Integer(-9999998);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final IUFStatusHandler logger = UFStatus
|
||||
|
@ -157,7 +173,31 @@ public class SatMapCoverage extends PersistableDataObject<Object>
|
|||
@DynamicSerializeElement
|
||||
private double dy;
|
||||
|
||||
@Column(length = 2047)
|
||||
/** 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)
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
private String crsWKT;
|
||||
|
@ -166,7 +206,7 @@ public class SatMapCoverage extends PersistableDataObject<Object>
|
|||
private CoordinateReferenceSystem crsObject;
|
||||
|
||||
/** The map coverage */
|
||||
@Column(name = "the_geom", columnDefinition = "geometry")
|
||||
@Column(name = "the_geom")
|
||||
@XmlJavaTypeAdapter(value = GeometryAdapter.class)
|
||||
@DynamicSerializeElement
|
||||
private Geometry location;
|
||||
|
@ -232,6 +272,10 @@ public class SatMapCoverage extends PersistableDataObject<Object>
|
|||
this.ny = ny;
|
||||
this.dx = dx;
|
||||
this.dy = dy;
|
||||
setUpperLeftElement(VAL_MISSING);
|
||||
setUpperLeftLine(VAL_MISSING);
|
||||
setElementRes(VAL_MISSING);
|
||||
setLineRes(VAL_MISSING);
|
||||
this.crsObject = crs;
|
||||
if (latLonGeometry == null) {
|
||||
try {
|
||||
|
@ -251,8 +295,67 @@ public class SatMapCoverage extends PersistableDataObject<Object>
|
|||
}
|
||||
|
||||
/**
|
||||
* @deprecated This field is only useful for GINI satellite format decoding
|
||||
* and should not be in the coverage object
|
||||
* Constructs a new SatMapCoverage Object
|
||||
*
|
||||
* @param projection
|
||||
* the projection id value
|
||||
* @param minX
|
||||
* minimum x value in crs space
|
||||
* @param minY
|
||||
* minimum y value in crs space
|
||||
* @param nx
|
||||
* number of x points in the satellite grid
|
||||
* @param ny
|
||||
* number of y points in the satellite grid
|
||||
* @param dx
|
||||
* spacing between grid cells in crs x space
|
||||
* @param dy
|
||||
* spacing between grid cells in crs y space
|
||||
* @param upperLeftElement
|
||||
*
|
||||
* @param upperLeftLine
|
||||
*
|
||||
* @param xres
|
||||
*
|
||||
* @param yres
|
||||
*
|
||||
* @param crs
|
||||
* the satellite data crs
|
||||
* @param latLonGeometry
|
||||
* A Geometry representing the satellite bounds in lat/lon space
|
||||
*/
|
||||
public SatMapCoverage(int projection, double minX, double minY, int nx,
|
||||
int ny, double dx, double dy, int upperLeftElement, int upperLeftLine,
|
||||
int xres, int yres, CoordinateReferenceSystem crs, Geometry latLonGeometry) {
|
||||
this.projection = projection;
|
||||
this.minX = minX;
|
||||
this.minY = minY;
|
||||
this.nx = nx;
|
||||
this.ny = ny;
|
||||
this.dx = dx;
|
||||
this.dy = dy;
|
||||
setUpperLeftElement(upperLeftElement);
|
||||
setUpperLeftLine(upperLeftLine);
|
||||
setElementRes(xres);
|
||||
setLineRes(yres);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
|
@ -326,6 +429,38 @@ public class SatMapCoverage extends PersistableDataObject<Object>
|
|||
this.dy = dy;
|
||||
}
|
||||
|
||||
public int getUpperLeftElement() {
|
||||
return upperLeftElement;
|
||||
}
|
||||
|
||||
public void setUpperLeftElement(int upperLeftElement) {
|
||||
this.upperLeftElement = upperLeftElement;
|
||||
}
|
||||
|
||||
public int getUpperLeftLine() {
|
||||
return upperLeftLine;
|
||||
}
|
||||
|
||||
public void setUpperLeftLine(int upperLeftLine) {
|
||||
this.upperLeftLine = upperLeftLine;
|
||||
}
|
||||
|
||||
public int getElementRes() {
|
||||
return elementRes;
|
||||
}
|
||||
|
||||
public void setElementRes(int elementRes) {
|
||||
this.elementRes = elementRes;
|
||||
}
|
||||
|
||||
public int getLineRes() {
|
||||
return lineRes;
|
||||
}
|
||||
|
||||
public void setLineRes(int lineRes) {
|
||||
this.lineRes = lineRes;
|
||||
}
|
||||
|
||||
public String getCrsWKT() {
|
||||
if (crsWKT == null && crsObject != null) {
|
||||
crsWKT = crsObject.toWKT();
|
||||
|
@ -334,7 +469,7 @@ public class SatMapCoverage extends PersistableDataObject<Object>
|
|||
}
|
||||
|
||||
public void setCrsWKT(String crsWKT) {
|
||||
this.crsWKT = crsWKT;
|
||||
this.crsWKT = crsWKT.replaceAll("\r\n", "");;
|
||||
if (crsObject != null) {
|
||||
crsObject = null;
|
||||
}
|
||||
|
@ -387,8 +522,18 @@ public class SatMapCoverage extends PersistableDataObject<Object>
|
|||
public CoordinateReferenceSystem getCrs() {
|
||||
if (crsObject == null && crsWKT != null) {
|
||||
try {
|
||||
if (this.projection != null) {
|
||||
if (this.projection == PROJ_GVAR) {
|
||||
crsObject = constructCRSfromWKT(crsWKT);
|
||||
} else {
|
||||
crsObject = CRSCache.getInstance()
|
||||
.getCoordinateReferenceSystem(crsWKT);
|
||||
}
|
||||
} else {
|
||||
crsObject = CRSCache.getInstance()
|
||||
.getCoordinateReferenceSystem(crsWKT);
|
||||
}
|
||||
|
||||
} catch (FactoryException e) {
|
||||
logger.debug("Error in getting the Coordinate Reference System",
|
||||
e);
|
||||
|
@ -400,11 +545,109 @@ public class SatMapCoverage extends PersistableDataObject<Object>
|
|||
|
||||
@Override
|
||||
public GridGeometry2D getGridGeometry() {
|
||||
/*
|
||||
* Native projections
|
||||
*/
|
||||
if (this.projection != null) {
|
||||
|
||||
if (projection == PROJ_GVAR) {
|
||||
GridEnvelope gridRange = new GeneralGridEnvelope(new int[] {
|
||||
0, 0 }, new int[] { getNx(),getNy() }, false);
|
||||
GeneralEnvelope crsRange = new GeneralEnvelope(2);
|
||||
crsRange.setCoordinateReferenceSystem( getCrs() );
|
||||
|
||||
int minX = getUpperLeftElement();
|
||||
int maxX = getUpperLeftElement() + ( getNx() * getElementRes() );
|
||||
int minY = getUpperLeftLine() + ( getNy() * getLineRes() );
|
||||
minY = -minY;
|
||||
int maxY = -1 * getUpperLeftLine();
|
||||
crsRange.setRange(0, minX, maxX);
|
||||
crsRange.setRange(1, minY, maxY);
|
||||
return new GridGeometry2D(gridRange, crsRange);
|
||||
} else {
|
||||
GridEnvelope gridRange = new GridEnvelope2D(0, 0, getNx(), getNy());
|
||||
Envelope crsRange = new Envelope2D(getCrs(), new Rectangle2D.Double(
|
||||
minX, minY, getNx() * getDx(), getNy() * getDy()));
|
||||
return new GridGeometry2D(gridRange, crsRange);
|
||||
}
|
||||
} else {
|
||||
GridEnvelope gridRange = new GridEnvelope2D(0, 0, getNx(), getNy());
|
||||
Envelope crsRange = new Envelope2D(getCrs(), new Rectangle2D.Double(
|
||||
minX, minY, getNx() * getDx(), getNy() * getDy()));
|
||||
return new GridGeometry2D(gridRange, crsRange);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static ProjectedCRS constructCRSfromWKT(String crsWKT) {
|
||||
Pattern AREA_PATTERN = Pattern
|
||||
.compile("PROJCS\\[\"MCIDAS\\sAREA\\s(.*)\"");
|
||||
Pattern NAV_BLOCK_PATTERN = Pattern.compile(
|
||||
"\\[\"NAV_BLOCK_BASE64\",\\s\"(.*)\"\\]", Pattern.MULTILINE
|
||||
| Pattern.DOTALL);
|
||||
Matcher m = AREA_PATTERN.matcher(crsWKT);
|
||||
m.find();
|
||||
ProjectedCRS crsObject = null;
|
||||
|
||||
if (m.groupCount() == 1) {
|
||||
String type = m.group(1);
|
||||
m = NAV_BLOCK_PATTERN.matcher(crsWKT);
|
||||
boolean found = m.find();
|
||||
if (found) {
|
||||
String navBlock = m.group(1);
|
||||
crsObject = constructCRS(type, navBlock);
|
||||
}
|
||||
}
|
||||
|
||||
return crsObject;
|
||||
}
|
||||
|
||||
public static ProjectedCRS constructCRS(String type, String encoded) {
|
||||
ParameterValueGroup pvg = null;
|
||||
DefaultMathTransformFactory dmtFactory = new DefaultMathTransformFactory();
|
||||
try {
|
||||
pvg = dmtFactory.getDefaultParameters("MCIDAS_AREA_NAV");
|
||||
} catch (NoSuchIdentifierException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
/*
|
||||
* semi_major and semi_minor parameters are set to 1, so that no global
|
||||
* scaling is performed during coordinate transforms by
|
||||
* org.geotools.referencing.operation.projection.MapProjection based on
|
||||
* the radius of earth
|
||||
*/
|
||||
pvg.parameter("semi_major").setValue(1.0);
|
||||
pvg.parameter("semi_minor").setValue(1.0);
|
||||
pvg.parameter("central_meridian").setValue(0.0);
|
||||
pvg.parameter("NAV_BLOCK_BASE64").setValue(encoded);
|
||||
|
||||
String projectionName = "MCIDAS AREA " + type;
|
||||
ProjectedCRS mcidasCRS = null;
|
||||
try {
|
||||
mcidasCRS = MapUtil.constructProjection(projectionName, pvg);
|
||||
} catch (FactoryException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return mcidasCRS;
|
||||
}
|
||||
|
||||
public GridGeometry2D getGridGeometryNativeProjection() {
|
||||
GridEnvelope gridRange = new GeneralGridEnvelope(new int[] { 0, 0 }, new int[] { getNx(),getNy() }, false);
|
||||
GeneralEnvelope crsRange = new GeneralEnvelope(2);
|
||||
crsRange.setCoordinateReferenceSystem( constructCRSfromWKT(crsWKT) );
|
||||
int minX = getUpperLeftElement();
|
||||
int maxX = getUpperLeftElement() + ( getNx() * getElementRes() );
|
||||
int minY = getUpperLeftLine() + ( getNy() * getLineRes() );
|
||||
minY = -minY;
|
||||
int maxY = -1 * getUpperLeftLine();
|
||||
crsRange.setRange(0, minX, maxX);
|
||||
crsRange.setRange(1, minY, maxY);
|
||||
return new GridGeometry2D(gridRange, crsRange);
|
||||
}
|
||||
|
||||
public Geometry getGeometry() {
|
||||
return getLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
|
||||
<!--
|
||||
This is an absolute override file, indicating that a higher priority
|
||||
version of the file will completely replace a lower priority version
|
||||
of the file.
|
||||
-->
|
||||
<bundle>
|
||||
<displayList>
|
||||
<displays xsi:type="mapRenderableDisplay"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<descriptor xsi:type="mapDescriptor">
|
||||
<resource>
|
||||
<loadProperties />
|
||||
<resourceData xsi:type="nucapsSoundingMapResourceData">
|
||||
<metadataMap>
|
||||
<mapping key="pluginName">
|
||||
<constraint constraintValue="nucaps"
|
||||
constraintType="EQUALS" />
|
||||
</mapping>
|
||||
</metadataMap>
|
||||
</resourceData>
|
||||
</resource>
|
||||
</descriptor>
|
||||
</displays>
|
||||
</displayList>
|
||||
</bundle>
|
|
@ -30,7 +30,7 @@
|
|||
<descriptor xsi:type="mapDescriptor">
|
||||
<resource>
|
||||
<loadProperties />
|
||||
<resourceData xsi:type="nucapsSoundingMapResourceData">
|
||||
<resourceData xsi:type="nppSoundingMapResourceData">
|
||||
<nsharpResourceData>${soundingResourceData}</nsharpResourceData>
|
||||
<resourceName>${name;Unknown}</resourceName>
|
||||
<metadataMap>
|
|
@ -42,12 +42,13 @@
|
|||
<mapping key="parameter">
|
||||
<constraint constraintValue="0.7Ref" constraintType="EQUALS"/>
|
||||
</mapping>
|
||||
<mapping key="region">
|
||||
<constraint constraintValue="${region}" constraintType="EQUALS"/>
|
||||
</mapping>
|
||||
<mapping key="pluginName">
|
||||
<constraint constraintValue="viirs" constraintType="EQUALS"/>
|
||||
</mapping>
|
||||
<mapping key="region">
|
||||
<constraint constraintValue="${region}" constraintType="EQUALS"/>
|
||||
</mapping>
|
||||
|
||||
</metadataMap>
|
||||
</resourceData>
|
||||
</resource>
|
|
@ -30,14 +30,6 @@
|
|||
menuText="0.64 μm Imagery Band 1 (CH 01)" id="Img0.64J">
|
||||
<substitute key="parameter" value="0.64Ref"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml"
|
||||
menuText="0.865 μm Imagery Band 2 (CH 02)" id="Img0.865J">
|
||||
<substitute key="parameter" value="0.865Ref"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml"
|
||||
menuText="1.61 μm Imagery Band 3 (CH I3 (R))" id="Img1.61J">
|
||||
<substitute key="parameter" value="1.61Ref"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml"
|
||||
menuText="3.74 μm Imagery Band 4 (CH 04)" id="Img3.74J">
|
||||
<substitute key="parameter" value="3.74BT"/>
|
||||
|
@ -46,21 +38,8 @@
|
|||
menuText="11.45 μm Imagery Band 5 (CH 05)" id="Img11.45J">
|
||||
<substitute key="parameter" value="11.45BT"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml"
|
||||
menuText="Moderate Band 14 (8.55u)" id="Mod8.55J">
|
||||
<substitute key="parameter" value="8.55BT"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml"
|
||||
menuText="Moderate Band 15 (10.763u)" id="Mod10.763J">
|
||||
<substitute key="parameter" value="10.763BT"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml"
|
||||
menuText="Moderate Band 16 (12.013u)" id="Mod12.013J">
|
||||
<substitute key="parameter" value="12.013BT"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml"
|
||||
menuText="0.7 μm Near Constant Contrast" id="NCC0.7J">
|
||||
menuText="0.7 μm Near Constant Contrast" id="Moderate0.7J">
|
||||
<substitute key="channelType" value="Moderate"/>
|
||||
</contribute>
|
||||
|
||||
</menuTemplate>
|
|
@ -27,7 +27,7 @@
|
|||
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<contribute xsi:type="titleItem" id="VIIRSTitleJPSS" titleText="------ Imagery ------"/>
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml"
|
||||
menuText="0.7 μm Near Constant Contrast" id="NCC0.7J">
|
||||
menuText="0.7 μm Near Constant Contrast" id="Moderate0.7J">
|
||||
<substitute key="channelType" value="Moderate"/>
|
||||
</contribute>
|
||||
</menuTemplate>
|
|
@ -27,7 +27,7 @@
|
|||
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<contribute xsi:type="titleItem" id="VIIRSTitle" titleText="------ Imagery ------"/>
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml"
|
||||
menuText="0.7 μm Near Constant Contrast" id="NCC0.7">
|
||||
menuText="0.7 μm Near Constant Contrast" id="Moderate0.7">
|
||||
<substitute key="channelType" value="Moderate"/>
|
||||
</contribute>
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
menuText="0.64 μm Imagery Band 1 (CH 01)" id="Img0.64">
|
||||
<substitute key="parameter" value="0.64Ref"/>
|
||||
</contribute>
|
||||
<!--
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml"
|
||||
menuText="0.865 μm Imagery Band 2 (CH 02)" id="Img0.865">
|
||||
<substitute key="parameter" value="0.865Ref"/>
|
||||
|
@ -38,6 +39,7 @@
|
|||
menuText="1.61 μm Imagery Band 3 (CH I3 (R))" id="Img1.61">
|
||||
<substitute key="parameter" value="1.61Ref"/>
|
||||
</contribute>
|
||||
-->
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml"
|
||||
menuText="3.74 μm Imagery Band 4 (CH 04)" id="Img3.74">
|
||||
<substitute key="parameter" value="3.74BT"/>
|
||||
|
@ -57,7 +59,7 @@
|
|||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml"
|
||||
menuText="Moderate Band 13 (4.05u)" id="Mod4.05">
|
||||
<substitute key="parameter" value="4.05BT"/>
|
||||
</contribute> -->
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml"
|
||||
menuText="Moderate Band 14 (8.55u)" id="Mod8.55">
|
||||
<substitute key="parameter" value="8.55BT"/>
|
||||
|
@ -70,8 +72,9 @@
|
|||
menuText="Moderate Band 16 (12.013u)" id="Mod12.013">
|
||||
<substitute key="parameter" value="12.013BT"/>
|
||||
</contribute>
|
||||
-->
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml"
|
||||
menuText="0.7 μm Near Constant Contrast" id="NCC0.7">
|
||||
menuText="0.7 μm Near Constant Contrast" id="Moderate0.7">
|
||||
<substitute key="channelType" value="Moderate"/>
|
||||
</contribute>
|
||||
|
|
@ -45,45 +45,51 @@
|
|||
Lee Byerle 1/2/2018
|
||||
-->
|
||||
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<contribute xsi:type="titleItem" titleText="------ VIIRS ------" id="ImageryLine"/>
|
||||
<contribute xsi:type="subMenu" menuText="S-NPP CONUS" id="CONUSid">
|
||||
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/viirsBundleItems.xml">
|
||||
<contribute xsi:type="titleItem" titleText="------ S-NPP ------" id="ImageryLine"/>
|
||||
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml"
|
||||
menuText="S-NPP CONUS - 0.7 μm Near Constant Contrast" id="Moderate0.7">
|
||||
<substitute key="channelType" value="Moderate"/>
|
||||
<substitute key="region" value="CONUS"/>
|
||||
</contribute>
|
||||
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml"
|
||||
menuText="S-NPP Pacific - 0.7 μm Near Constant Contrast" id="Moderate0.7">
|
||||
<substitute key="channelType" value="Moderate"/>
|
||||
<substitute key="region" value="Pacific"/>
|
||||
</contribute>
|
||||
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml"
|
||||
menuText="S-NPP Puerto Rico - 0.7 μm Near Constant Contrast" id="Moderate0.7">
|
||||
<substitute key="channelType" value="Moderate"/>
|
||||
<substitute key="region" value="Puerto Rico"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="subMenu" menuText="S-NPP Alaska" id="Alaskaid">
|
||||
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/viirsBundleItems_AK.xml">
|
||||
<substitute key="region" value="Alaska"/>
|
||||
</contribute>
|
||||
</contribute>
|
||||
<contribute xsi:type="subMenu" menuText="S-NPP Pacific" id="Pacificid">
|
||||
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/viirsBundleItems.xml">
|
||||
<substitute key="region" value="Pacific"/>
|
||||
</contribute>
|
||||
</contribute>
|
||||
<contribute xsi:type="subMenu" menuText="S-NPP Puerto Rico" id="PuertoRicoid">
|
||||
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/viirsBundleItems.xml">
|
||||
<substitute key="region" value="Puerto Rico"/>
|
||||
</contribute>
|
||||
</contribute>
|
||||
<contribute xsi:type="subMenu" menuText="NOAA-20 CONUS" id="CONUSidJPSS">
|
||||
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/jpss/viirsBundleItems_JPSS.xml">
|
||||
|
||||
|
||||
<contribute xsi:type="titleItem" titleText="------ NOAA-20 ------" id="ImageryLine"/>
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml"
|
||||
menuText="NOAA-20 CONUS - 0.7 μm Near Constant Contrast" id="Moderate0.7J">
|
||||
<substitute key="channelType" value="Moderate"/>
|
||||
<substitute key="region" value="CONUSJPSS"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml"
|
||||
menuText="NOAA-20 Pacific - 0.7 μm Near Constant Contrast" id="Moderate0.7J">
|
||||
<substitute key="channelType" value="Moderate"/>
|
||||
<substitute key="region" value="PacificJPSS"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml"
|
||||
menuText="NOAA-20 Puerto Rico - 0.7 μm Near Constant Contrast" id="Moderate0.7J">
|
||||
<substitute key="channelType" value="Moderate"/>
|
||||
<substitute key="region" value="Puerto_RicoJPSS"/>
|
||||
</contribute>
|
||||
<contribute xsi:type="subMenu" menuText="NOAA-20 Alaska" id="AlaskaidJPSS">
|
||||
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/jpss/viirsBundleItems_AK_JPSS.xml">
|
||||
<substitute key="region" value="AlaskaJPSS"/>
|
||||
</contribute>
|
||||
</contribute>
|
||||
<contribute xsi:type="subMenu" menuText="NOAA-20 Pacific" id="PacificidJPSS">
|
||||
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/jpss/viirsBundleItems_JPSS.xml">
|
||||
<substitute key="region" value="PacificJPSS"/>
|
||||
</contribute>
|
||||
</contribute>
|
||||
<contribute xsi:type="subMenu" menuText="NOAA-20 Puerto Rico" id="PuertoRicoidJPSS">
|
||||
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/jpss/viirsBundleItems_JPSS.xml">
|
||||
<substitute key="region" value="Puerto_RicoJPSS"/>
|
||||
</contribute>
|
||||
</contribute>
|
||||
</menuTemplate>
|
|
@ -1,4 +1,5 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
.,\
|
||||
utility/
|
||||
|
|
|
@ -24,5 +24,5 @@
|
|||
of the file.
|
||||
-->
|
||||
<menuContributionFile>
|
||||
<include installTo="menu:satellite?before=GROUP5" fileName="menus/npp/nppMenuItems.xml" />
|
||||
<include installTo="menu:satellite" fileName="menus/npp/nppMenuItems.xml" />
|
||||
</menuContributionFile>
|
|
@ -24,12 +24,10 @@
|
|||
of the file.
|
||||
-->
|
||||
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<contribute xsi:type="subMenu" id="NPPProducts" menuText="S-NPP and NOAA-20">
|
||||
<contribute xsi:type="separator" id="Imagery"
|
||||
visible="false" />
|
||||
<contribute xsi:type="titleItem" id="SoundingsTitle"
|
||||
titleText="------ Soundings ------" />
|
||||
<contribute xsi:type="separator" id="Soundings"
|
||||
visible="false" />
|
||||
<contribute xsi:type="separator" id="MySeparatorId" />
|
||||
<contribute xsi:type="titleItem" titleText="------ Polar Orbiting Satellites ------" id="polarSat"/>
|
||||
<contribute xsi:type="subMenu" id="NPPProducts" menuText="S-NPP and NOAA-20 VIIRS Imagery">
|
||||
<contribute xsi:type="separator" id="Imagery" visible="false" />
|
||||
</contribute>
|
||||
|
||||
</menuTemplate>
|
|
@ -11,7 +11,9 @@ Require-Bundle: com.raytheon.edex.common,
|
|||
javax.persistence,
|
||||
com.raytheon.uf.common.dataplugin.satellite,
|
||||
com.raytheon.edex.plugin.satellite,
|
||||
javax.xml.bind
|
||||
org.apache.commons.codec,
|
||||
javax.xml.bind,
|
||||
ar.com.hjg.pngj
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Import-Package: com.raytheon.uf.common.localization,
|
||||
com.raytheon.uf.common.menus,
|
||||
|
|
|
@ -19,20 +19,32 @@
|
|||
**/
|
||||
package com.raytheon.uf.edex.plugin.satellite.mcidas;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.opengis.referencing.crs.ProjectedCRS;
|
||||
|
||||
import ar.com.hjg.pngj.ImageLineByte;
|
||||
import ar.com.hjg.pngj.PngReaderByte;
|
||||
|
||||
import com.raytheon.edex.esb.Headers;
|
||||
import com.raytheon.edex.exception.DecoderException;
|
||||
import com.raytheon.edex.plugin.satellite.SatelliteDecoderException;
|
||||
import com.raytheon.edex.util.satellite.SatSpatialFactory;
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.satellite.SatMapCoverage;
|
||||
import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
|
@ -71,6 +83,12 @@ import com.raytheon.uf.edex.plugin.satellite.mcidas.util.McidasSatelliteLookups.
|
|||
* IDataRecord required by the SatelliteDao
|
||||
* 12/03/2013 DR 16841 D. Friedman Allow record overwrites
|
||||
* 09/18/2014 3627 mapeters Updated deprecated method calls.
|
||||
* 05/11/2015 ---- mjames PS (south and north) stereogrpahic support added.
|
||||
* 05/19/2015 ---- mjames Added decoding of GVAR native projection products
|
||||
* 07/12/2015 ---- mjames Account for GOES E and W UNIWISC AREA file numbers
|
||||
* 01/21/2016 ---- mjames Cleanup
|
||||
* 10/24/2017 ---- mjames Native support for PNG-compressed AREA files.
|
||||
* 08/14/2018 ---- mjames Find and use position of PNG header.
|
||||
* Sep 23, 2021 8608 mapeters Handle PDO.traceId changes
|
||||
* </pre>
|
||||
*
|
||||
|
@ -88,6 +106,12 @@ public class McidasSatelliteDecoder {
|
|||
|
||||
private static final int EXPECTED_IMAGE_TYPE_BE = 0x04000000;
|
||||
|
||||
private static final int RADIUS = 6371200;
|
||||
|
||||
final int SIZE_OF_AREA = 256;
|
||||
|
||||
private final byte[] PNG_HDR = { -119, 80, 78, 71 };
|
||||
|
||||
private static final double HALFPI = Math.PI / 2.;
|
||||
|
||||
private static final double RTD = 180. / Math.PI;
|
||||
|
@ -132,6 +156,14 @@ public class McidasSatelliteDecoder {
|
|||
* @throws Exception
|
||||
*/
|
||||
private PluginDataObject[] decodeMcidasArea(byte[] data) throws Exception {
|
||||
|
||||
byte[] area = new byte[SIZE_OF_AREA];
|
||||
byte[] nonAreaBlock = new byte[data.length - SIZE_OF_AREA];
|
||||
|
||||
System.arraycopy(data, 0, area, 0, SIZE_OF_AREA);
|
||||
System.arraycopy(data, SIZE_OF_AREA, nonAreaBlock, 0,
|
||||
nonAreaBlock.length);
|
||||
|
||||
ByteBuffer buf = ByteBuffer.wrap(data);
|
||||
buf.order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
|
@ -146,80 +178,96 @@ public class McidasSatelliteDecoder {
|
|||
formatError(UNEXPECTED_HEADER_VALUE);
|
||||
}
|
||||
}
|
||||
int sensorSourceNumber = buf.getInt();
|
||||
int yyyddd = buf.getInt();
|
||||
int hhmmss = buf.getInt();
|
||||
int ulImageLine = buf.getInt();
|
||||
int ulImageElement = buf.getInt();
|
||||
buf.getInt(); // reserved
|
||||
int nLines = buf.getInt();
|
||||
int nElementsPerLine = buf.getInt();
|
||||
int nBytesPerElement = buf.getInt();
|
||||
int lineResolution = buf.getInt();
|
||||
int elementResolution = buf.getInt();
|
||||
int nBands = buf.getInt();
|
||||
int linePrefixLength = buf.getInt();
|
||||
/* int projectNumber = */buf.getInt();
|
||||
/* int creationYyyddd = */buf.getInt();
|
||||
/* int creationHhmmss = */buf.getInt();
|
||||
int bandMap1to32 = buf.getInt();
|
||||
int bandMap33to64 = buf.getInt();
|
||||
// sensor specific
|
||||
buf.position(buf.position() + (4 * 4));
|
||||
// memo
|
||||
buf.position(buf.position() + (4 * 8));
|
||||
|
||||
int sensorSourceNumber = buf.getInt(); // W3
|
||||
int yyyddd = buf.getInt(); // W4
|
||||
int hhmmss = buf.getInt(); // W5
|
||||
int ulImageLine = buf.getInt(); // W6
|
||||
int ulImageElement = buf.getInt(); // W7
|
||||
buf.getInt(); // W8 reserved
|
||||
int nLines = buf.getInt(); // W9
|
||||
int nElementsPerLine = buf.getInt(); // W10
|
||||
int nBytesPerElement = buf.getInt(); // W11
|
||||
int lineResolution = buf.getInt(); // W12
|
||||
int elementResolution = buf.getInt(); // W13
|
||||
int nBands = buf.getInt(); // W14
|
||||
int linePrefixLength = buf.getInt(); // W15
|
||||
/* int projectNumber = */buf.getInt(); // W16
|
||||
/* int creationYyyddd = */buf.getInt(); // W17
|
||||
/* int creationHhmmss = */buf.getInt(); // W18
|
||||
/*
|
||||
32-bit filter band map for multichannel
|
||||
images; if a bit is set, data exists for the band;
|
||||
band 1 is the least significant byte (rightmost)
|
||||
*/
|
||||
int bandMap1to32 = buf.getInt(); // W19
|
||||
/*
|
||||
* W20-24
|
||||
satellite specific information
|
||||
*/
|
||||
int bandMap33to64 = buf.getInt(); // W20
|
||||
buf.position(buf.position() + (4 * 4)); // sensor specific
|
||||
buf.position(buf.position() + (4 * 8)); // memo
|
||||
int areaNumber = buf.getInt();
|
||||
int dataBlockOffset = buf.getInt();
|
||||
int navBlockOffset = buf.getInt();
|
||||
/* int validityCode = */buf.getInt();
|
||||
buf.position(buf.position() + (8 * 4)); // PDL
|
||||
buf.getInt();
|
||||
// GOES AA band 8
|
||||
buf.getInt(); // GOES AA band 8
|
||||
/* int imageYyyddd = */buf.getInt();
|
||||
/* int imageHhmmssOrMillis = */buf.getInt();
|
||||
/* int imageStartScan = */buf.getInt();
|
||||
/* int prefixDocLength = */buf.getInt();
|
||||
/* int prefixCalibrationLength = */buf.getInt();
|
||||
/* int prefixBandListLength = */buf.getInt();
|
||||
// source type
|
||||
buf.getInt();
|
||||
// cal type
|
||||
buf.getInt();
|
||||
buf.position(buf.position() + (3 * 4));
|
||||
// reserved
|
||||
/* int originalSourceType = */buf.getInt();
|
||||
// actually a 4cc?
|
||||
/* int units = */buf.getInt();
|
||||
// also 4cc?
|
||||
int prefixCalibrationLength = buf.getInt(); // W50
|
||||
/* int prefixBandListLength = */buf.getInt(); // W51
|
||||
buf.getInt(); // W52 source type
|
||||
String calType = get4cc(buf); // W53 cal type
|
||||
buf.position(buf.position() + (3 * 4)); // reserved
|
||||
/* int originalSourceType = */buf.getInt(); // actually a 4cc?
|
||||
/* int units = */buf.getInt(); // also 4cc?
|
||||
/* int scaling = */buf.getInt();
|
||||
/* int supplementalBlockOffset = */buf.getInt();
|
||||
buf.getInt();
|
||||
// reserved
|
||||
/* int calibrationOffset = */buf.getInt();
|
||||
// comment cards
|
||||
buf.getInt();
|
||||
buf.getInt(); // reserved
|
||||
int calibrationOffset = buf.getInt(); // W63
|
||||
int numberOfComments = buf.getInt(); // W64 comment cards
|
||||
|
||||
/* Nav block */
|
||||
int navsize;
|
||||
if (calibrationOffset == 0){
|
||||
navsize = dataBlockOffset - navBlockOffset;
|
||||
} else {
|
||||
navsize = calibrationOffset - navBlockOffset;
|
||||
}
|
||||
byte[] navigation = new byte[navsize];
|
||||
System.arraycopy(nonAreaBlock, 0, navigation, 0, navigation.length);
|
||||
|
||||
byte[] nonNavBlock = new byte[nonAreaBlock.length - navsize];
|
||||
System.arraycopy(nonAreaBlock, navsize, nonNavBlock, 0, nonNavBlock.length);
|
||||
|
||||
/* PNG block */
|
||||
int PNG_HDR_POS = indexOf(nonNavBlock, PNG_HDR);
|
||||
byte[] pngBlock = new byte[nonNavBlock.length - PNG_HDR_POS];
|
||||
System.arraycopy(nonNavBlock, PNG_HDR_POS, pngBlock, 0, pngBlock.length);
|
||||
|
||||
long bandBits = ((long) bandMap33to64 << 32) | bandMap1to32;
|
||||
if (nBands != Long.bitCount(bandBits)) {
|
||||
formatError(
|
||||
"Specified number of bands does not match number of bits in band map");
|
||||
long bandBitsCount = Long.bitCount(bandBits);
|
||||
if (nBands != bandBitsCount && nBands > 1) {
|
||||
formatError("Specified number of bands does not match number of bits in band map");
|
||||
}
|
||||
|
||||
// Decode the navigation block
|
||||
buf.position(navBlockOffset);
|
||||
SatMapCoverage coverage = decodeNavigation(elementResolution,
|
||||
lineResolution, ulImageElement, ulImageLine, nElementsPerLine,
|
||||
nLines, buf);
|
||||
nLines, buf, navigation);
|
||||
|
||||
// Decode the data block, creating a SatelliteRecord for each band.
|
||||
PluginDataObject[] result = new PluginDataObject[nBands];
|
||||
int bitIndex = 0;
|
||||
for (int ri = 0; ri < nBands; ++ri) {
|
||||
RECORD: for (int ri = 0; ri < nBands; ++ri) {
|
||||
while ((bandBits & (1L << bitIndex)) == 0) {
|
||||
++bitIndex;
|
||||
if (bitIndex >= 64) {
|
||||
// shouldn't happen
|
||||
return result;
|
||||
if (++bitIndex >= 64) {
|
||||
break RECORD; // shouldn't happen
|
||||
}
|
||||
}
|
||||
SatelliteRecord rec = new SatelliteRecord();
|
||||
|
@ -231,18 +279,20 @@ public class McidasSatelliteDecoder {
|
|||
bitIndex + 1);
|
||||
rec.setPhysicalElement(pev.name);
|
||||
rec.setUnits(pev.units);
|
||||
rec.setSectorID(getAreaName(areaNumber));
|
||||
rec.setSectorID(getAreaName(sensorSourceNumber, areaNumber));
|
||||
rec.setCoverage(coverage);
|
||||
|
||||
// TODO: Line pad if not a multiple of four bytes
|
||||
if ((linePrefixLength == 0) && (nBytesPerElement == 1)
|
||||
&& (nBands == 1)) {
|
||||
if ((linePrefixLength == 0) && (nBytesPerElement == 1) && (nBands == 1)) {
|
||||
if (isPngCompressed(pngBlock)) {
|
||||
byte[] pngBytes = decompressPngSatellite(pngBlock);
|
||||
rec.setMessageData(pngBytes);
|
||||
} else {
|
||||
byte[] imageBytes = new byte[nLines * nElementsPerLine];
|
||||
buf.position(dataBlockOffset);
|
||||
buf.get(imageBytes);
|
||||
|
||||
rec.setMessageData(imageBytes);
|
||||
|
||||
}
|
||||
} else if (nBytesPerElement == 1) {
|
||||
byte[] imageBytes = new byte[nLines * nElementsPerLine];
|
||||
int si = dataBlockOffset + (ri * nBytesPerElement);
|
||||
|
@ -251,8 +301,7 @@ public class McidasSatelliteDecoder {
|
|||
for (int y = 0; y < nLines; ++y) {
|
||||
si += linePrefixLength;
|
||||
for (int x = 0; x < nElementsPerLine; ++x) {
|
||||
imageBytes[di] = buf.get(si);
|
||||
++di;
|
||||
imageBytes[di++] = buf.get(si);
|
||||
si += eincr;
|
||||
}
|
||||
}
|
||||
|
@ -260,11 +309,10 @@ public class McidasSatelliteDecoder {
|
|||
unimplemented("non-byte elements");
|
||||
}
|
||||
|
||||
rec.setSourceTraceId(traceId);
|
||||
rec.setTraceId(traceId);
|
||||
rec.setPersistenceTime(TimeUtil.newGmtCalendar().getTime());
|
||||
rec.setOverwriteAllowed(true);
|
||||
|
||||
// Set the data into the IDataRecord
|
||||
// Set the data into the IDataRecord
|
||||
IDataRecord dataRec = SatelliteRecord.getDataRecord(rec);
|
||||
if (dataRec != null) {
|
||||
|
@ -281,26 +329,91 @@ public class McidasSatelliteDecoder {
|
|||
result = new PluginDataObject[0];
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* from guava/guava/src/com/google/common/primitives/Bytes.java
|
||||
*
|
||||
* @param array
|
||||
* @param target
|
||||
* @return
|
||||
*/
|
||||
public static int indexOf(byte[] array, byte[] target) {
|
||||
if (target.length == 0) {
|
||||
return 0;
|
||||
}
|
||||
outer:
|
||||
for (int i = 0; i < array.length - target.length + 1; i++) {
|
||||
for (int j = 0; j < target.length; j++) {
|
||||
if (array[i + j] != target[j]) {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to check if file is PNG-compressed.
|
||||
*
|
||||
* @param messageData
|
||||
* @return
|
||||
*/
|
||||
private boolean isPngCompressed(byte[] messageData) {
|
||||
byte[] buffer = new byte[4];
|
||||
System.arraycopy(messageData, 0, buffer, 0, buffer.length);
|
||||
boolean compressed = Arrays.equals(buffer, PNG_HDR);
|
||||
return compressed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to handle Unidata PNG compressed satellite data.
|
||||
*
|
||||
* @param messageData
|
||||
* @return
|
||||
* @throws DecoderException
|
||||
*/
|
||||
private byte[] decompressPngSatellite(byte[] messageData)
|
||||
throws SatelliteDecoderException {
|
||||
|
||||
InputStream stream = new ByteArrayInputStream(messageData);
|
||||
PngReaderByte png = new PngReaderByte(stream);
|
||||
|
||||
int MAX_IMAGE_SIZE = 30000000;
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(MAX_IMAGE_SIZE);
|
||||
byte[] inflated = null;
|
||||
|
||||
for (int row=0;row< png.getImgInfo().rows;row++){
|
||||
ImageLineByte line = png.readRowByte();
|
||||
byte [] buf = line.getScanlineByte();
|
||||
bos.write(buf, 0, buf.length);
|
||||
}
|
||||
|
||||
inflated = bos.toByteArray();
|
||||
bos = null;
|
||||
return inflated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference:
|
||||
* http://www.ssec.wisc.edu/mcidas/doc/prog_man/2006/formats-13a.html
|
||||
*
|
||||
*/
|
||||
private SatMapCoverage decodeNavigation(int xImgRes, int yImgRes, int ulX,
|
||||
int ulY, int nx, int ny, ByteBuffer buf) throws Exception {
|
||||
int ulY, int nx, int ny, ByteBuffer buf, byte[] navigation)
|
||||
throws Exception {
|
||||
SatMapCoverage result = new SatMapCoverage();
|
||||
String navType = get4cc(buf);
|
||||
if ("MERC".equals(navType)) {
|
||||
int lineOfEquator = buf.getInt();
|
||||
int elementOfEquator = buf.getInt();
|
||||
int stdLatDDMMSS = buf.getInt();
|
||||
int spacingAtStdLatInMeters = buf.getInt();
|
||||
int nrmlLonDDMMSS = buf.getInt();
|
||||
|
||||
|
||||
// NOTE: We do not check the following for compatibility with WGS84.
|
||||
int radiusInMeters = buf.getInt();
|
||||
/* int eccentricity = */buf.getInt();
|
||||
|
@ -308,6 +421,7 @@ public class McidasSatelliteDecoder {
|
|||
|
||||
boolean westPositive = buf.getInt() >= 0;
|
||||
float la1, lo1, la2, lo2;
|
||||
double dy;
|
||||
|
||||
/*
|
||||
* The following is based on
|
||||
|
@ -320,9 +434,15 @@ public class McidasSatelliteDecoder {
|
|||
double dx = spacingAtStdLatInMeters * xImgRes;
|
||||
|
||||
double phi0r = clat * DTR;
|
||||
double sign = 1.;
|
||||
if (phi0r < 0.) {
|
||||
sign = -1.;
|
||||
}
|
||||
double rxp = (((double) (elementOfEquator - ulX) / xImgRes) + 1.);
|
||||
double ryp = (ny - ((double) (lineOfEquator - ulY) / yImgRes));
|
||||
|
||||
if (navType.equals("MERC")) {
|
||||
|
||||
double dxp = 1. - rxp;
|
||||
double dyp = 1. - ryp;
|
||||
double rm = dx * dyp;
|
||||
|
@ -341,8 +461,57 @@ public class McidasSatelliteDecoder {
|
|||
result = SatSpatialFactory.getInstance().getCoverageTwoCorners(
|
||||
SatSpatialFactory.PROJ_MERCATOR, nx, ny, (float) clon,
|
||||
(float) clat, la1, lo1, la2, lo2);
|
||||
|
||||
} else if (navType.trim().equals("PS")) {
|
||||
|
||||
dy = (float) spacingAtStdLatInMeters * yImgRes;
|
||||
double dxp = (1. - rxp) * dx;
|
||||
double dyp = (1. - ryp) * dy;
|
||||
double alpha = 1. + Math.sin(Math.abs(phi0r));
|
||||
double rm = Math.sqrt(((dxp * dxp) + (dyp * dyp))) / alpha;
|
||||
la1 = (float) (sign * ((HALFPI - (2. * Math.atan(rm / RADIUS)))) * RTD);
|
||||
double thta;
|
||||
if (dyp != 0) {
|
||||
dyp = (-dyp) * sign;
|
||||
thta = (Math.atan2(dxp, dyp)) * RTD;
|
||||
lo1 = (float) prnlon((clon + thta));
|
||||
} else {
|
||||
unimplemented(String.format("navigation type \"%s\"", navType));
|
||||
lo1 = (float) clon;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute lat/lon of the upper-right corner
|
||||
*/
|
||||
dxp = (nx - rxp) * dx;
|
||||
dyp = (ny - ryp) * dy;
|
||||
rm = Math.sqrt(((dxp * dxp) + (dyp * dyp))) / alpha;
|
||||
la2 = (float) (sign * ((HALFPI - (2. * Math.atan(rm / RADIUS)))) * RTD);
|
||||
|
||||
if (dyp != 0) {
|
||||
dyp = (-dyp) * sign;
|
||||
thta = (Math.atan2(dxp, dyp)) * RTD;
|
||||
lo2 = (float) prnlon((clon + thta));
|
||||
} else {
|
||||
lo2 = (float) clon;
|
||||
}
|
||||
|
||||
result = SatSpatialFactory.getInstance().getCoverageTwoCorners(
|
||||
SatSpatialFactory.PROJ_POLAR, nx, ny, (float) clon,
|
||||
(float) clat, la1, lo1, la2, lo2);
|
||||
|
||||
} else {
|
||||
/*
|
||||
* Native projection
|
||||
*/
|
||||
//unimplemented(String.format("navigation type \"%s\"", navType));
|
||||
clon = nrmlLonDDMMSS / 10000000.f;
|
||||
clon = (float) Math.toDegrees(clon);
|
||||
ProjectedCRS crs = MapUtil.constructNative(navType, encodeNavBlock(navigation));
|
||||
|
||||
result = SatSpatialFactory.getInstance().getCoverageNative(
|
||||
SatSpatialFactory.PROJ_GVAR, nx, ny, (float) clon,
|
||||
ulX, ulY, xImgRes, yImgRes, crs);
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -391,23 +560,21 @@ public class McidasSatelliteDecoder {
|
|||
}
|
||||
|
||||
private String getCreatingEntity(int sensorSourceNumber) {
|
||||
String value = McidasSatelliteLookups.getInstance()
|
||||
.getCreatingEntity(sensorSourceNumber);
|
||||
return value != null ? value
|
||||
: String.format("Unknown-%d", sensorSourceNumber);
|
||||
String value = McidasSatelliteLookups.getInstance().getCreatingEntity(
|
||||
sensorSourceNumber);
|
||||
return value != null ? value : String.format("Unknown-%d",
|
||||
sensorSourceNumber);
|
||||
}
|
||||
|
||||
private PhysicalElementValue getPhysicalElement(int ssn, int bandIndex) {
|
||||
PhysicalElementValue value = McidasSatelliteLookups.getInstance()
|
||||
.getPhysicalElement(ssn, bandIndex);
|
||||
return value != null ? value
|
||||
: new PhysicalElementValue(
|
||||
String.format("Unknown-%d", bandIndex), null);
|
||||
return value != null ? value : new PhysicalElementValue(String.format(
|
||||
"Unknown-%d", bandIndex), null);
|
||||
}
|
||||
|
||||
private String getAreaName(int areaNumber) {
|
||||
String value = McidasSatelliteLookups.getInstance()
|
||||
.getAreaName(areaNumber);
|
||||
private String getAreaName(int ssn, int areaNumber) {
|
||||
String value = McidasSatelliteLookups.getInstance().getAreaName(ssn);
|
||||
return value != null ? value : String.format("AREA%04d", areaNumber);
|
||||
}
|
||||
|
||||
|
@ -416,8 +583,14 @@ public class McidasSatelliteDecoder {
|
|||
}
|
||||
|
||||
protected void unimplemented(String feature) throws DecoderException {
|
||||
throw new DecoderException(
|
||||
String.format("%s: unimplemented: %s", traceId, feature));
|
||||
throw new DecoderException(String.format("%s: unimplemented: %s",
|
||||
traceId, feature));
|
||||
}
|
||||
private String encodeNavBlock(byte[] navigation) {
|
||||
|
||||
Base64 b64 = new Base64();
|
||||
byte[] coded = b64.encode(navigation);
|
||||
|
||||
return new String(coded);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
* Jul 29, 2011 dfriedma Initial creation
|
||||
* Jul 14, 2016 5744 mapeters Initial javadoc creation, config files moved
|
||||
* from edex_static to common_static
|
||||
* Aug 2018 mjames Changed area lookup name to sensor source
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -217,8 +218,8 @@ public class McidasSatelliteLookups {
|
|||
return creatingEntityLookup.map.get(sensorSource);
|
||||
}
|
||||
|
||||
public String getAreaName(int areaNumber) {
|
||||
return areaNameLookup.map.get(areaNumber);
|
||||
public String getAreaName(int sensorSource) {
|
||||
return areaNameLookup.map.get(sensorSource);
|
||||
}
|
||||
|
||||
private static McidasSatelliteLookups instance;
|
||||
|
|
|
@ -26,4 +26,6 @@
|
|||
-->
|
||||
<requestPatterns xmlns:ns2="group">
|
||||
<regex>AREA[0-9]{4}.*</regex>
|
||||
<regex>pnga2area</regex>
|
||||
<regex>.*uniwisc.*</regex>
|
||||
</requestPatterns>
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<areaNames>
|
||||
<map>
|
||||
<entry><key>401</key><value>Arctic</value></entry>
|
||||
<entry><key>400</key><value>Antarctic</value></entry>
|
||||
<entry><key>185</key><value>GOES-Sounder</value></entry>
|
||||
<entry><key>71</key><value>GOES-Sounder</value></entry>
|
||||
<entry><key>184</key><value>GOES-West</value></entry>
|
||||
<!--
|
||||
<entry><key>180</key><value>GOES-East</value></entry>
|
||||
<entry><key>86</key><value>HIMAWARI-8</value></entry>
|
||||
<entry><key>10</key><value>SSMIS</value></entry>
|
||||
<entry><key>3</key><value>WINDSAT</value></entry>
|
||||
<entry><key>3100</key><value>Global</value></entry>
|
||||
<entry><key>3101</key><value>Global</value></entry>
|
||||
<entry><key>601</key><value>Mollweide</value></entry>
|
||||
<entry><key>701</key><value>Mollweide</value></entry>
|
||||
<entry><key>9050</key><value>GOES-East-West</value></entry>
|
||||
<entry><key>9053</key><value>GOES-East-West</value></entry>
|
||||
<entry><key>9056</key><value>GOES-East-West</value></entry>
|
||||
<entry><key>9059</key><value>GOES-East-West</value></entry>
|
||||
<entry><key>9062</key><value>GOES-East-West</value></entry>
|
||||
-->
|
||||
</map>
|
||||
</areaNames>
|
|
@ -27,7 +27,38 @@
|
|||
-->
|
||||
<creatingEntities>
|
||||
<map>
|
||||
<entry><key>3</key><value>SOUNDER3</value></entry>
|
||||
<entry><key>9</key><value>COMP9</value></entry>
|
||||
<entry><key>10</key><value>SOUNDER10</value></entry>
|
||||
<entry><key>12</key><value>GMS</value></entry>
|
||||
<entry><key>13</key><value>GMS</value></entry>
|
||||
<entry><key>30</key><value>GOES6</value></entry>
|
||||
<entry><key>31</key><value>GOES6</value></entry>
|
||||
<entry><key>32</key><value>GOES7</value></entry>
|
||||
<entry><key>33</key><value>GOES7</value></entry>
|
||||
<entry><key>35</key><value>FYC</value></entry>
|
||||
<entry><key>36</key><value>FYC</value></entry>
|
||||
<entry><key>51</key><value>METEOSAT8</value></entry>
|
||||
<entry><key>52</key><value>METEOSAT9</value></entry>
|
||||
<entry><key>53</key><value>METEOSAT10</value></entry>
|
||||
<entry><key>54</key><value>METEOSAT3</value></entry>
|
||||
<entry><key>56</key><value>METEOSAT5</value></entry>
|
||||
<entry><key>57</key><value>METEOSAT6</value></entry>
|
||||
<entry><key>58</key><value>METEOSAT7</value></entry>
|
||||
<entry><key>70</key><value>GOES8</value></entry>
|
||||
<entry><key>74</key><value>GOES10</value></entry>
|
||||
<entry><key>76</key><value>GOES-11(L)</value></entry>
|
||||
<entry><key>77</key><value>DPD</value></entry>
|
||||
<entry><key>78</key><value>GOES-12(M)</value></entry>
|
||||
<entry><key>84</key><value>MTSAT-1R</value></entry>
|
||||
<entry><key>85</key><value>MTSAT-2</value></entry>
|
||||
<entry><key>86</key><value>HIMAWARI-8</value></entry>
|
||||
<entry><key>180</key><value>UNIWISC</value></entry>
|
||||
<entry><key>184</key><value>UNIWISC</value></entry>
|
||||
<entry><key>185</key><value>UNIWISC</value></entry>
|
||||
<entry><key>400</key><value>UNIWISC</value></entry>
|
||||
<entry><key>401</key><value>UNIWISC</value></entry>
|
||||
<entry><key>71</key><value>UNIWISC</value></entry>
|
||||
<entry><key>72</key><value>UNIWISC</value></entry>
|
||||
</map>
|
||||
</creatingEntities>
|
||||
|
|
|
@ -36,17 +36,87 @@
|
|||
<entry><key ss="84" band="2"/><value name="Imager 11 micron IR" units="IRPixel" /></entry>
|
||||
<entry><key ss="84" band="3"/><value name="Imager 12 micron IR" units="IRPixel" /></entry>
|
||||
<entry><key ss="84" band="4"/><value name="Imager 6.7-6.5 micron IR (WV)" /></entry>
|
||||
<entry><key ss="84" band="5"/><value name="Imager 3.5-4.0 micro IR (Fog)" /></entry>
|
||||
<entry><key ss="84" band="5"/><value name="Imager 3.5-4.0 micron IR (Fog)" /></entry>
|
||||
<!-- Not documented, but this is what is actually being received. -->
|
||||
<entry><key ss="84" band="6"/><value name="Imager 3.5-4.0 micro IR (Fog)" /></entry>
|
||||
<entry><key ss="84" band="6"/><value name="Imager 3.5-4.0 micron IR (Fog)" /></entry>
|
||||
|
||||
<!-- MTSAT-2 -->
|
||||
<entry><key ss="85" band="1"/><value name="Imager Visible" /></entry>
|
||||
<entry><key ss="85" band="2"/><value name="Imager 11 micron IR" units="IRPixel" /></entry>
|
||||
<entry><key ss="85" band="3"/><value name="Imager 12 micron IR" units="IRPixel" /></entry>
|
||||
<entry><key ss="85" band="4"/><value name="Imager 6.7-6.5 micron IR (WV)" /></entry>
|
||||
<entry><key ss="85" band="5"/><value name="Imager 3.5-4.0 micro IR (Fog)" /></entry>
|
||||
<entry><key ss="85" band="5"/><value name="Imager 3.5-4.0 micron IR (Fog)" /></entry>
|
||||
<!-- Not documented, but this is what is actually being received. -->
|
||||
<entry><key ss="85" band="6"/><value name="Imager 3.5-4.0 micro IR (Fog)" /></entry>
|
||||
<entry><key ss="85" band="6"/><value name="Imager 3.5-4.0 micron IR (Fog)" /></entry>
|
||||
|
||||
<!-- HIMAWARI-8 -->
|
||||
<entry><key ss="86" band="1"/><value name="Imager Blue .47 micron Visible" /></entry>
|
||||
<entry><key ss="86" band="2"/><value name="Imager Green .51 micron Visible" /></entry>
|
||||
<entry><key ss="86" band="3"/><value name="Imager Red .64 micron Visible" /></entry>
|
||||
<entry><key ss="86" band="4"/><value name="Imager .86 micron IR" /></entry>
|
||||
<entry><key ss="86" band="5"/><value name="Imager 1.6 micron IR" /></entry>
|
||||
<entry><key ss="86" band="6"/><value name="Imager 2.3 micron IR" /></entry>
|
||||
<entry><key ss="86" band="7"/><value name="Imager 3.9 micron IR" units="IRPixel" /></entry>
|
||||
<entry><key ss="86" band="8"/><value name="Imager 6.2 micron WV" units="IRPixel" /></entry>
|
||||
<entry><key ss="86" band="9"/><value name="Imager 6.9 micron WV" units="IRPixel" /></entry>
|
||||
<entry><key ss="86" band="10"/><value name="Imager 7.3 micron IR" /></entry>
|
||||
<entry><key ss="86" band="11"/><value name="Imager 8.6 micron IR" /></entry>
|
||||
<entry><key ss="86" band="12"/><value name="Imager 9.5 micron IR" /></entry>
|
||||
<entry><key ss="86" band="13"/><value name="Imager 10.4 micron IR" /></entry>
|
||||
<entry><key ss="86" band="14"/><value name="Imager 11.2 micron IR" /></entry>
|
||||
<entry><key ss="86" band="15"/><value name="Imager 12.4 micron IR" /></entry>
|
||||
<entry><key ss="86" band="16"/><value name="Imager 13.3 micron IR" /></entry>
|
||||
|
||||
<!-- WINDSAT -->
|
||||
<entry><key ss="3" band="1"/><value name="Brightness Temperature" /></entry>
|
||||
|
||||
<!-- ESPC/SSMIS.OWS -->
|
||||
<entry><key ss="10" band="22"/><value name="Channel 22" /></entry>
|
||||
|
||||
<!-- GOES13 -->
|
||||
<entry><key ss="180" band="1"/><value name="Imager Visible" /></entry>
|
||||
<entry><key ss="180" band="2"/><value name="Imager 3.5-4.0 micron IR (Fog)" units="IRPixel" /></entry>
|
||||
<entry><key ss="180" band="3"/><value name="Imager 6.7-6.5 micron IR (WV)" units="IRPixel" /></entry>
|
||||
<entry><key ss="180" band="4"/><value name="Imager 11 micron IR" /></entry>
|
||||
<entry><key ss="180" band="6"/><value name="Imager 13 micron IR" /></entry>
|
||||
|
||||
<!-- GOES15 -->
|
||||
<entry><key ss="184" band="1"/><value name="Imager Visible" /></entry>
|
||||
<entry><key ss="184" band="2"/><value name="Imager 3.5-4.0 micron IR (Fog)" units="IRPixel" /></entry>
|
||||
<entry><key ss="184" band="3"/><value name="Imager 6.7-6.5 micron IR (WV)" units="IRPixel" /></entry>
|
||||
<entry><key ss="184" band="4"/><value name="Imager 11 micron IR" /></entry>
|
||||
<entry><key ss="184" band="6"/><value name="Imager 13 micron IR" /></entry>
|
||||
|
||||
<!-- Arctic -->
|
||||
<entry><key ss="401" band="1"/><value name="Imager Visible" /></entry>
|
||||
<entry><key ss="401" band="2"/><value name="Imager 3.5-4.0 micron IR (Fog)" units="IRPixel" /> /></entry>
|
||||
<entry><key ss="401" band="3"/><value name="Imager 6.7-6.5 micron IR (WV)" units="IRPixel" /></entry>
|
||||
<entry><key ss="401" band="4"/><value name="Imager 11 micron IR" /></entry>
|
||||
<entry><key ss="401" band="5"/><value name="Imager 12 micron IR" /></entry>
|
||||
|
||||
<!-- Antarctic -->
|
||||
<entry><key ss="400" band="1"/><value name="Imager Visible" /></entry>
|
||||
<entry><key ss="400" band="2"/><value name="Imager 3.5-4.0 micron IR (Fog)" units="IRPixel" /> /></entry>
|
||||
<entry><key ss="400" band="3"/><value name="Imager 6.7-6.5 micron IR (WV)" units="IRPixel" /></entry>
|
||||
<entry><key ss="400" band="4"/><value name="Imager 11 micron IR" /></entry>
|
||||
<entry><key ss="400" band="5"/><value name="Imager 12 micron IR" /></entry>
|
||||
|
||||
<!-- SOUNDER ??? -->
|
||||
<entry><key ss="185" band="1"/><value name="Imager Visible" /></entry>
|
||||
<entry><key ss="185" band="2"/><value name="Imager 11 micron IR" units="IRPixel" /></entry>
|
||||
<entry><key ss="185" band="3"/><value name="Imager 12 micron IR" units="IRPixel" /></entry>
|
||||
<entry><key ss="185" band="4"/><value name="Imager 6.7-6.5 micron IR (WV)" /></entry>
|
||||
<entry><key ss="185" band="5"/><value name="Imager 3.5-4.0 micron IR (Fog)" /></entry>
|
||||
<entry><key ss="185" band="6"/><value name="Imager 3.5-4.0 micron IR (Fog)" /></entry>
|
||||
|
||||
<!-- UNIWISC GOES Sounder -->
|
||||
<entry><key ss="71" band="27"/><value name="Gridded Cloud Top Pressure or Height" /></entry>
|
||||
<entry><key ss="185" band="27"/><value name="Gridded Cloud Top Pressure or Height" /></entry>
|
||||
<entry><key ss="185" band="28"/><value name="Sounder Based Derived Precipitable Water (PW)" /></entry>
|
||||
<entry><key ss="185" band="29"/><value name="Sounder Based Derived Lifted Index (LI)" /></entry>
|
||||
<entry><key ss="185" band="30"/><value name="CAPE" /></entry>
|
||||
<entry><key ss="185" band="31"/><value name="Sounder Based Total Column Ozone" /></entry>
|
||||
<entry><key ss="10" band="31"/><value name="Sounder Based Derived Surface Skin Temp (SFC Skin)" /></entry>
|
||||
</map>
|
||||
</physicalElements>
|
||||
|
Loading…
Add table
Reference in a new issue