Merge pull request #557 from tiffanycmeyer13/unidata_20.3.2

UNIWISC and NPP/VIIRS Updates
This commit is contained in:
srcarter3 2023-06-20 13:28:02 -06:00 committed by GitHub
commit 02a94228cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 992 additions and 301 deletions

View file

@ -1,6 +1,5 @@
output.com.raytheon.uf.viz.npp.nucaps.jar = bin/ output.com.raytheon.uf.viz.npp.nucaps.jar = bin/
bin.includes = META-INF/,\ bin.includes = META-INF/,\
localization/,\
plugin.xml,\ plugin.xml,\
com.raytheon.uf.viz.npp.nucaps.jar com.raytheon.uf.viz.npp.nucaps.jar
source.com.raytheon.uf.viz.npp.nucaps.jar = src/ source.com.raytheon.uf.viz.npp.nucaps.jar = src/

View file

@ -1,7 +1,6 @@
output.com.raytheon.uf.viz.npp.viirs.jar = bin/ output.com.raytheon.uf.viz.npp.viirs.jar = bin/
bin.includes = META-INF/,\ bin.includes = META-INF/,\
plugin.xml,\ plugin.xml,\
localization/,\
res/,\ res/,\
com.raytheon.uf.viz.npp.viirs.jar com.raytheon.uf.viz.npp.viirs.jar
source.com.raytheon.uf.viz.npp.viirs.jar = src/ source.com.raytheon.uf.viz.npp.viirs.jar = src/

View file

@ -1,5 +1,4 @@
output.com.raytheon.uf.viz.npp.jar = bin/ output.com.raytheon.uf.viz.npp.jar = bin/
bin.includes = META-INF/,\ bin.includes = META-INF/,\
localization/,\
com.raytheon.uf.viz.npp.jar com.raytheon.uf.viz.npp.jar
source.com.raytheon.uf.viz.npp.jar = src/ source.com.raytheon.uf.viz.npp.jar = src/

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.edex.database.dao.DaoConfig;
* Jun 27, 2012 798 jkorman Corrected id query type. * Jun 27, 2012 798 jkorman Corrected id query type.
* Oct 02, 2013 2333 mschenke Removed unused code * Oct 02, 2013 2333 mschenke Removed unused code
* Nov 05, 2014 3788 bsteffen add getOrCreateCoverage * 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 * Mar 25, 2020 8103 randerso Fixed ContraintViolationException handling
* *
* </pre> * </pre>
@ -144,6 +145,10 @@ public class SatMapCoverageDao extends CoreDao {
crit.add(Restrictions.eq("ny", coverage.getNy())); crit.add(Restrictions.eq("ny", coverage.getNy()));
crit.add(Restrictions.eq("dx", coverage.getDx())); crit.add(Restrictions.eq("dx", coverage.getDx()));
crit.add(Restrictions.eq("dy", coverage.getDy())); 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("minX", coverage.getMinX()));
crit.add(Restrictions.eq("minY", coverage.getMinY())); crit.add(Restrictions.eq("minY", coverage.getMinY()));
crit.add(Restrictions.eq("crsWKT", coverage.getCrsWKT())); crit.add(Restrictions.eq("crsWKT", coverage.getCrsWKT()));

View file

@ -20,6 +20,8 @@
package com.raytheon.edex.util.satellite; package com.raytheon.edex.util.satellite;
import java.awt.geom.Rectangle2D;
import org.geotools.geometry.DirectPosition2D; import org.geotools.geometry.DirectPosition2D;
import org.opengis.referencing.crs.ProjectedCRS; import org.opengis.referencing.crs.ProjectedCRS;
import org.opengis.referencing.operation.MathTransform; 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.dataplugin.satellite.SatMapCoverage;
import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.MapUtil;
import org.locationtech.jts.geom.Envelope; 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 * Sep 15, 2014 17303 jgerth Support for second standard latitude
* Nov 05, 2014 2714 bclement replaced DecoderException with SatelliteDecoderException * Nov 05, 2014 2714 bclement replaced DecoderException with SatelliteDecoderException
* Nov 05, 2014 3788 bsteffen use getOrCreateCoverage in place of queryByMapId * 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> * </pre>
@ -62,6 +68,8 @@ public class SatSpatialFactory {
public static final int PROJ_LAMBERT = 3; public static final int PROJ_LAMBERT = 3;
public static final int PROJ_POLAR = 5; 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 PROJ_CYLIN_EQUIDISTANT = 7;
@ -209,6 +217,58 @@ public class SatSpatialFactory {
return getCoverageSingleCorner(crsType, nx, ny, lov, latin, latin, la1, lo1, dx, dy); 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 * 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); 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. * Create a {@link ProjectedCRS} from a crsType and some parameters.
* *
@ -336,6 +414,11 @@ public class SatSpatialFactory {
switch (crsType) { switch (crsType) {
case PROJ_MERCATOR: case PROJ_MERCATOR:
return createMercatorCrs(latin, cm); return createMercatorCrs(latin, cm);
case PROJ_POLAR:
if (latin >= 0.)
return createNorthPolarStereoCrs(lov);
else
return createSouthPolarStereoCrs(latin, lov);
case PROJ_LAMBERT: case PROJ_LAMBERT:
return createLambertCrs(latin, latin2, lov); return createLambertCrs(latin, latin2, lov);
case PROJ_CYLIN_EQUIDISTANT: case PROJ_CYLIN_EQUIDISTANT:
@ -365,5 +448,10 @@ public class SatSpatialFactory {
return MapUtil.constructNorthPolarStereo(MapUtil.AWIPS_EARTH_RADIUS, return MapUtil.constructNorthPolarStereo(MapUtil.AWIPS_EARTH_RADIUS,
MapUtil.AWIPS_EARTH_RADIUS, 60, lov); 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);
}
} }

View file

@ -1,80 +1,122 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?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"> <menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="satBundleItem" <contribute xsi:type="separator" id="Separator"/>
file="bundles/DefaultCompositeSatellite.xml" menuText="IR Window" <contribute xsi:type="titleItem" titleText="------ Legacy Satellitle Data ------" id="legacySat"/>
id="irWindow"> <contribute xsi:type="subMenu" menuText="Legacy Satellite Data">
<substitute key="timeMatchMode" value="${blendedTimeMatchMode;ALL_IMAGES}" /> <contribute xsi:type="titleItem" titleText="------ Composite Imagery ------" id="CompositeImagery" />
<substitute key="element" value="Imager 11 micron IR" /> <contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)" /> menuText="Global Rectilinear 20km IR" id="waterVapor">
</contribute> <substitute key="element" value="Imager 11 micron IR"/>
<contribute xsi:type="satBundleItem" <substitute key="sector" value="AREA3100"/>
file="bundles/DefaultCompositeSatellite.xml" menuText="Water Vapor" <substitute key="entity" value="UNIWISC"/>
id="waterVapor"> <substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
<substitute key="timeMatchMode" value="${blendedTimeMatchMode;ALL_IMAGES}" /> </contribute>
<substitute key="element" value="Imager 6.7-6.5 micron IR (WV)" /> <contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
<substitute key="colormap" value="Sat/WV/Gray Scale Water Vapor" /> menuText="Global Rectilinear 20km WV" id="waterVapor">
</contribute> <substitute key="element" value="Imager 6.7-6.5 micron IR (WV)"/>
<contribute xsi:type="satBundleItem" <substitute key="sector" value="AREA3101"/>
file="bundles/DefaultCompositeSatellite.xml" menuText="Visible" <substitute key="entity" value="UNIWISC"/>
id="visible"> <substitute key="colormap" value="Sat/WV/RAMSDIS WV"/>
<substitute key="timeMatchMode" value="${blendedTimeMatchMode;ALL_IMAGES}" /> </contribute>
<substitute key="element" value="Imager Visible" /> <contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
<substitute key="colormap" value="Sat/VIS/ZA (Vis Default)" /> menuText="Global Mollweide 30km IR" id="waterVapor">
</contribute> <substitute key="element" value="Imager 11 micron IR"/>
<contribute xsi:type="satBundleItem" file="bundles/DefaultCONUSSatellite.xml" <substitute key="sector" value="AREA0700"/>
menuText="3.9u" id="3.9u"> <substitute key="entity" value="UNIWISC"/>
<substitute key="element" value="Imager 3.9 micron IR" /> <substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
<substitute key="colormap" value="Sat/VIS/ZA (Vis Default)" /> </contribute>
</contribute> <contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
<contribute xsi:type="satBundleItem" file="bundles/DefaultCONUSSatellite.xml" menuText="Global Mollweide 30km WV" id="waterVapor">
menuText="13u" id="13u"> <substitute key="element" value="Imager 6.7-6.5 micron IR (WV)"/>
<substitute key="element" value="Imager 13 micron (IR)" /> <substitute key="sector" value="AREA0600"/>
<substitute key="colormap" value="Sat/IR/CIRA (IR Default)" /> <substitute key="entity" value="UNIWISC"/>
</contribute> <substitute key="colormap" value="Sat/WV/RAMSDIS WV"/>
<contribute xsi:type="satBundleItem" file="bundles/DerivedCONUSSatellite.xml" </contribute>
menuText="11u-3.9u" id="11-3.9u">
<substitute key="element" value="satDif11u3_9uIR" /> <contribute xsi:type="separator" id="Separator"/>
<substitute key="colormap" value="Sat/VIS/CA (Low Light Vis)" />
</contribute> <contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
<contribute xsi:type="satBundleItem" file="bundles/DerivedCONUSSatellite.xml" menuText="Arctic 12 micron IR" id="irWindow">
menuText="11u-13u" id="11u-13u"> <substitute key="element" value="Imager 12 micron IR"/>
<substitute key="timeMatchMode" value="${blendedTimeMatchMode;ALL_IMAGES}" /> <substitute key="sector" value="Arctic"/>
<substitute key="element" value="satDif11u13uIR" /> <substitute key="entity" value="UNIWISC" />
<substitute key="colormap" value="Grid/gridded data" /> <substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
</contribute> </contribute>
<contribute xsi:type="satBundleItem" <contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
file="bundles/DerivedCompositeSatellite.xml" menuText="WV/IR" menuText="Arctic 11 micron IR" id="irWindow">
id="WV/IR"> <substitute key="element" value="Imager 11 micron IR"/>
<substitute key="timeMatchMode" value="${blendedTimeMatchMode;ALL_IMAGES}" /> <substitute key="sector" value="Arctic"/>
<substitute key="element" value="satDivWVIR" /> <substitute key="entity" value="UNIWISC" />
<substitute key="colormap" value="Sat/IR/IR WV" /> <substitute key="colormap" value="Sat/IR/CIRA (IR Default)"/>
</contribute> </contribute>
<contribute xsi:type="satBundleItem" <contribute xsi:type="bundleItem" file="bundles/DefaultSatellite.xml"
file="bundles/satellite/FourPanelGoesMtoQ.xml" menuText="4 panel (GOES M-Q)" menuText="Arctic 3.5-4.0 micron IR (Fog)" id="irWindow">
id="4_panel_(GOES_M-Q)"> <substitute key="element" value="Imager 3.5-4.0 micron IR (Fog)"/>
</contribute> <substitute key="sector" value="Arctic"/>
</menuTemplate> <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>
</menuTemplate>

View file

@ -3,9 +3,7 @@
<include installTo="menu:satellite?before=GOESR" <include installTo="menu:satellite?before=GOESR"
fileName="menus/satellite/goesr/goesrMenu.xml"> fileName="menus/satellite/goesr/goesrMenu.xml">
</include> </include>
<!-- <include installTo="menu:satellite"
<include installTo="menu:satellite?after=GOESR"
fileName="menus/satellite/baseSatellite.xml"> fileName="menus/satellite/baseSatellite.xml">
</include> </include>
-->
</menuContributionFile> </menuContributionFile>

View file

@ -21,6 +21,8 @@
package com.raytheon.uf.common.dataplugin.satellite; package com.raytheon.uf.common.dataplugin.satellite;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
@ -37,22 +39,30 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.geotools.coverage.grid.GeneralGridEnvelope;
import org.geotools.coverage.grid.GridEnvelope2D; import org.geotools.coverage.grid.GridEnvelope2D;
import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.coverage.grid.GridGeometry2D;
import org.geotools.geometry.Envelope2D; import org.geotools.geometry.Envelope2D;
import org.geotools.geometry.GeneralEnvelope;
import org.geotools.referencing.crs.DefaultGeographicCRS; 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.Geometry;
import org.locationtech.jts.geom.GeometryFactory; import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Polygon; import org.locationtech.jts.geom.Polygon;
import org.opengis.coverage.grid.GridEnvelope; import org.opengis.coverage.grid.GridEnvelope;
import org.opengis.geometry.Envelope; import org.opengis.geometry.Envelope;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.referencing.FactoryException; import org.opengis.referencing.FactoryException;
import org.opengis.referencing.NoSuchIdentifierException;
import org.opengis.referencing.crs.CoordinateReferenceSystem; 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.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject; import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.geospatial.CRSCache; import com.raytheon.uf.common.geospatial.CRSCache;
import com.raytheon.uf.common.geospatial.IGridGeometryProvider; 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.adapter.GeometryAdapter;
import com.raytheon.uf.common.geospatial.util.EnvelopeIntersection; import com.raytheon.uf.common.geospatial.util.EnvelopeIntersection;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; 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 * Apr 11, 2014 2947 bsteffen Fix equals
* Oct 16, 2014 3454 bphillip Upgrading to Hibernate 4 * Oct 16, 2014 3454 bphillip Upgrading to Hibernate 4
* Nov 05, 2014 3788 bsteffen Make gid a sequence instead of a hash. * 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 * Mar 20, 2019 6140 tgurney Hibernate 5 GeometryType fix
* May 8, 2019 6140 tgurney Lower the log level of some previously * May 8, 2019 6140 tgurney Lower the log level of some previously
* ignored exceptions (from error to debug) * ignored exceptions (from error to debug)
@ -88,15 +100,19 @@ import com.raytheon.uf.common.status.UFStatus;
* </pre> * </pre>
*/ */
@Entity @Entity
@Table(name = "satellite_spatial", uniqueConstraints = { @Table(name = "satellite_spatial", uniqueConstraints = { @UniqueConstraint(columnNames = {
@UniqueConstraint(columnNames = { "minX", "minY", "dx", "dy", "nx", "minX", "minY", "dx", "dy", "nx", "ny", "projection", "upperLeftElement",
"ny", "crsWKT" }) }) "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
public class SatMapCoverage extends PersistableDataObject<Object> public class SatMapCoverage extends PersistableDataObject<Object>
implements IGridGeometryProvider { 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 long serialVersionUID = 1L;
private static final IUFStatusHandler logger = UFStatus private static final IUFStatusHandler logger = UFStatus
@ -157,7 +173,31 @@ public class SatMapCoverage extends PersistableDataObject<Object>
@DynamicSerializeElement @DynamicSerializeElement
private double dy; 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 @XmlAttribute
@DynamicSerializeElement @DynamicSerializeElement
private String crsWKT; private String crsWKT;
@ -166,7 +206,7 @@ public class SatMapCoverage extends PersistableDataObject<Object>
private CoordinateReferenceSystem crsObject; private CoordinateReferenceSystem crsObject;
/** The map coverage */ /** The map coverage */
@Column(name = "the_geom", columnDefinition = "geometry") @Column(name = "the_geom")
@XmlJavaTypeAdapter(value = GeometryAdapter.class) @XmlJavaTypeAdapter(value = GeometryAdapter.class)
@DynamicSerializeElement @DynamicSerializeElement
private Geometry location; private Geometry location;
@ -232,6 +272,10 @@ public class SatMapCoverage extends PersistableDataObject<Object>
this.ny = ny; this.ny = ny;
this.dx = dx; this.dx = dx;
this.dy = dy; this.dy = dy;
setUpperLeftElement(VAL_MISSING);
setUpperLeftLine(VAL_MISSING);
setElementRes(VAL_MISSING);
setLineRes(VAL_MISSING);
this.crsObject = crs; this.crsObject = crs;
if (latLonGeometry == null) { if (latLonGeometry == null) {
try { try {
@ -251,8 +295,67 @@ public class SatMapCoverage extends PersistableDataObject<Object>
} }
/** /**
* @deprecated This field is only useful for GINI satellite format decoding * Constructs a new SatMapCoverage Object
* and should not be in the coverage 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 * @return
*/ */
@Deprecated @Deprecated
@ -326,6 +429,38 @@ public class SatMapCoverage extends PersistableDataObject<Object>
this.dy = dy; 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() { public String getCrsWKT() {
if (crsWKT == null && crsObject != null) { if (crsWKT == null && crsObject != null) {
crsWKT = crsObject.toWKT(); crsWKT = crsObject.toWKT();
@ -334,7 +469,7 @@ public class SatMapCoverage extends PersistableDataObject<Object>
} }
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;
} }
@ -387,8 +522,18 @@ public class SatMapCoverage extends PersistableDataObject<Object>
public CoordinateReferenceSystem getCrs() { public CoordinateReferenceSystem getCrs() {
if (crsObject == null && crsWKT != null) { if (crsObject == null && crsWKT != null) {
try { try {
crsObject = CRSCache.getInstance() if (this.projection != null) {
.getCoordinateReferenceSystem(crsWKT); if (this.projection == PROJ_GVAR) {
crsObject = constructCRSfromWKT(crsWKT);
} else {
crsObject = CRSCache.getInstance()
.getCoordinateReferenceSystem(crsWKT);
}
} else {
crsObject = CRSCache.getInstance()
.getCoordinateReferenceSystem(crsWKT);
}
} catch (FactoryException e) { } catch (FactoryException e) {
logger.debug("Error in getting the Coordinate Reference System", logger.debug("Error in getting the Coordinate Reference System",
e); e);
@ -400,10 +545,108 @@ public class SatMapCoverage extends PersistableDataObject<Object>
@Override @Override
public GridGeometry2D getGridGeometry() { public GridGeometry2D getGridGeometry() {
GridEnvelope gridRange = new GridEnvelope2D(0, 0, getNx(), getNy()); /*
Envelope crsRange = new Envelope2D(getCrs(), new Rectangle2D.Double( * Native projections
minX, minY, getNx() * getDx(), getNy() * getDy())); */
return new GridGeometry2D(gridRange, crsRange); 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 @Override

View file

@ -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>

View file

@ -30,7 +30,7 @@
<descriptor xsi:type="mapDescriptor"> <descriptor xsi:type="mapDescriptor">
<resource> <resource>
<loadProperties /> <loadProperties />
<resourceData xsi:type="nucapsSoundingMapResourceData"> <resourceData xsi:type="nppSoundingMapResourceData">
<nsharpResourceData>${soundingResourceData}</nsharpResourceData> <nsharpResourceData>${soundingResourceData}</nsharpResourceData>
<resourceName>${name;Unknown}</resourceName> <resourceName>${name;Unknown}</resourceName>
<metadataMap> <metadataMap>

View file

@ -42,16 +42,17 @@
<mapping key="parameter"> <mapping key="parameter">
<constraint constraintValue="0.7Ref" constraintType="EQUALS"/> <constraint constraintValue="0.7Ref" constraintType="EQUALS"/>
</mapping> </mapping>
<mapping key="region">
<constraint constraintValue="${region}" constraintType="EQUALS"/>
</mapping>
<mapping key="pluginName"> <mapping key="pluginName">
<constraint constraintValue="viirs" constraintType="EQUALS"/> <constraint constraintValue="viirs" constraintType="EQUALS"/>
</mapping> </mapping>
<mapping key="region">
<constraint constraintValue="${region}" constraintType="EQUALS"/>
</mapping>
</metadataMap> </metadataMap>
</resourceData> </resourceData>
</resource> </resource>
</descriptor> </descriptor>
</displays> </displays>
</displayList> </displayList>
</bundle> </bundle>

View file

@ -30,14 +30,6 @@
menuText="0.64 μm Imagery Band 1 (CH 01)" id="Img0.64J"> menuText="0.64 μm Imagery Band 1 (CH 01)" id="Img0.64J">
<substitute key="parameter" value="0.64Ref"/> <substitute key="parameter" value="0.64Ref"/>
</contribute> </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" <contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml"
menuText="3.74 μm Imagery Band 4 (CH 04)" id="Img3.74J"> menuText="3.74 μm Imagery Band 4 (CH 04)" id="Img3.74J">
<substitute key="parameter" value="3.74BT"/> <substitute key="parameter" value="3.74BT"/>
@ -46,21 +38,8 @@
menuText="11.45 μm Imagery Band 5 (CH 05)" id="Img11.45J"> menuText="11.45 μm Imagery Band 5 (CH 05)" id="Img11.45J">
<substitute key="parameter" value="11.45BT"/> <substitute key="parameter" value="11.45BT"/>
</contribute> </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" <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"/> <substitute key="channelType" value="Moderate"/>
</contribute> </contribute>
</menuTemplate> </menuTemplate>

View file

@ -27,7 +27,7 @@
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="titleItem" id="VIIRSTitleJPSS" titleText="------ Imagery ------"/> <contribute xsi:type="titleItem" id="VIIRSTitleJPSS" titleText="------ Imagery ------"/>
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml" <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"/> <substitute key="channelType" value="Moderate"/>
</contribute> </contribute>
</menuTemplate> </menuTemplate>

View file

@ -27,7 +27,7 @@
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="titleItem" id="VIIRSTitle" titleText="------ Imagery ------"/> <contribute xsi:type="titleItem" id="VIIRSTitle" titleText="------ Imagery ------"/>
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml" <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"/> <substitute key="channelType" value="Moderate"/>
</contribute> </contribute>

View file

@ -30,6 +30,7 @@
menuText="0.64 μm Imagery Band 1 (CH 01)" id="Img0.64"> menuText="0.64 μm Imagery Band 1 (CH 01)" id="Img0.64">
<substitute key="parameter" value="0.64Ref"/> <substitute key="parameter" value="0.64Ref"/>
</contribute> </contribute>
<!--
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml" <contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml"
menuText="0.865 μm Imagery Band 2 (CH 02)" id="Img0.865"> menuText="0.865 μm Imagery Band 2 (CH 02)" id="Img0.865">
<substitute key="parameter" value="0.865Ref"/> <substitute key="parameter" value="0.865Ref"/>
@ -38,6 +39,7 @@
menuText="1.61 μm Imagery Band 3 (CH I3 (R))" id="Img1.61"> menuText="1.61 μm Imagery Band 3 (CH I3 (R))" id="Img1.61">
<substitute key="parameter" value="1.61Ref"/> <substitute key="parameter" value="1.61Ref"/>
</contribute> </contribute>
-->
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml" <contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml"
menuText="3.74 μm Imagery Band 4 (CH 04)" id="Img3.74"> menuText="3.74 μm Imagery Band 4 (CH 04)" id="Img3.74">
<substitute key="parameter" value="3.74BT"/> <substitute key="parameter" value="3.74BT"/>
@ -57,7 +59,7 @@
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml" <contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml"
menuText="Moderate Band 13 (4.05u)" id="Mod4.05"> menuText="Moderate Band 13 (4.05u)" id="Mod4.05">
<substitute key="parameter" value="4.05BT"/> <substitute key="parameter" value="4.05BT"/>
</contribute> --> </contribute>
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml" <contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsImagery.xml"
menuText="Moderate Band 14 (8.55u)" id="Mod8.55"> menuText="Moderate Band 14 (8.55u)" id="Mod8.55">
<substitute key="parameter" value="8.55BT"/> <substitute key="parameter" value="8.55BT"/>
@ -70,8 +72,9 @@
menuText="Moderate Band 16 (12.013u)" id="Mod12.013"> menuText="Moderate Band 16 (12.013u)" id="Mod12.013">
<substitute key="parameter" value="12.013BT"/> <substitute key="parameter" value="12.013BT"/>
</contribute> </contribute>
-->
<contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml" <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"/> <substitute key="channelType" value="Moderate"/>
</contribute> </contribute>

View file

@ -45,45 +45,51 @@
Lee Byerle 1/2/2018 Lee Byerle 1/2/2018
--> -->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="titleItem" titleText="------ VIIRS ------" id="ImageryLine"/> <contribute xsi:type="titleItem" titleText="------ S-NPP ------" 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="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml"
<substitute key="region" value="CONUS"/> menuText="S-NPP CONUS - 0.7 μm Near Constant Contrast" id="Moderate0.7">
</contribute> <substitute key="channelType" value="Moderate"/>
</contribute> <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="subMenu" menuText="S-NPP Alaska" id="Alaskaid">
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/viirsBundleItems_AK.xml"> <contribute xsi:type="subinclude" fileName="menus/npp/viirs/viirsBundleItems_AK.xml">
<substitute key="region" value="Alaska"/> <substitute key="region" value="Alaska"/>
</contribute> </contribute>
</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 xsi:type="titleItem" titleText="------ NOAA-20 ------" id="ImageryLine"/>
</contribute> <contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml"
</contribute> menuText="NOAA-20 CONUS - 0.7 μm Near Constant Contrast" id="Moderate0.7J">
<contribute xsi:type="subMenu" menuText="S-NPP Puerto Rico" id="PuertoRicoid"> <substitute key="channelType" value="Moderate"/>
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/viirsBundleItems.xml"> <substitute key="region" value="CONUSJPSS"/>
<substitute key="region" value="Puerto Rico"/> </contribute>
</contribute> <contribute xsi:type="bundleItem" file="bundles/npp/viirs/viirsDayNightBandImagery.xml"
</contribute> menuText="NOAA-20 Pacific - 0.7 μm Near Constant Contrast" id="Moderate0.7J">
<contribute xsi:type="subMenu" menuText="NOAA-20 CONUS" id="CONUSidJPSS"> <substitute key="channelType" value="Moderate"/>
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/jpss/viirsBundleItems_JPSS.xml"> <substitute key="region" value="PacificJPSS"/>
<substitute key="region" value="CONUSJPSS"/> </contribute>
</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>
<contribute xsi:type="subMenu" menuText="NOAA-20 Alaska" id="AlaskaidJPSS"> <contribute xsi:type="subMenu" menuText="NOAA-20 Alaska" id="AlaskaidJPSS">
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/jpss/viirsBundleItems_AK_JPSS.xml"> <contribute xsi:type="subinclude" fileName="menus/npp/viirs/jpss/viirsBundleItems_AK_JPSS.xml">
<substitute key="region" value="AlaskaJPSS"/> <substitute key="region" value="AlaskaJPSS"/>
</contribute> </contribute>
</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> </menuTemplate>

View file

@ -1,4 +1,5 @@
source.. = src/ source.. = src/
output.. = bin/ output.. = bin/
bin.includes = META-INF/,\ bin.includes = META-INF/,\
. .,\
utility/

View file

@ -24,5 +24,5 @@
of the file. of the file.
--> -->
<menuContributionFile> <menuContributionFile>
<include installTo="menu:satellite?before=GROUP5" fileName="menus/npp/nppMenuItems.xml" /> <include installTo="menu:satellite" fileName="menus/npp/nppMenuItems.xml" />
</menuContributionFile> </menuContributionFile>

View file

@ -24,12 +24,10 @@
of the file. of the file.
--> -->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <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="MySeparatorId" />
<contribute xsi:type="separator" id="Imagery" <contribute xsi:type="titleItem" titleText="------ Polar Orbiting Satellites ------" id="polarSat"/>
visible="false" /> <contribute xsi:type="subMenu" id="NPPProducts" menuText="S-NPP and NOAA-20 VIIRS Imagery">
<contribute xsi:type="titleItem" id="SoundingsTitle" <contribute xsi:type="separator" id="Imagery" visible="false" />
titleText="------ Soundings ------" />
<contribute xsi:type="separator" id="Soundings"
visible="false" />
</contribute> </contribute>
</menuTemplate> </menuTemplate>

View file

@ -11,7 +11,9 @@ Require-Bundle: com.raytheon.edex.common,
javax.persistence, javax.persistence,
com.raytheon.uf.common.dataplugin.satellite, com.raytheon.uf.common.dataplugin.satellite,
com.raytheon.edex.plugin.satellite, com.raytheon.edex.plugin.satellite,
javax.xml.bind org.apache.commons.codec,
javax.xml.bind,
ar.com.hjg.pngj
Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-RequiredExecutionEnvironment: JavaSE-11
Import-Package: com.raytheon.uf.common.localization, Import-Package: com.raytheon.uf.common.localization,
com.raytheon.uf.common.menus, com.raytheon.uf.common.menus,

View file

@ -19,20 +19,32 @@
**/ **/
package com.raytheon.uf.edex.plugin.satellite.mcidas; 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.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.TimeZone; 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.esb.Headers;
import com.raytheon.edex.exception.DecoderException; import com.raytheon.edex.exception.DecoderException;
import com.raytheon.edex.plugin.satellite.SatelliteDecoderException;
import com.raytheon.edex.util.satellite.SatSpatialFactory; import com.raytheon.edex.util.satellite.SatSpatialFactory;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.satellite.SatMapCoverage; import com.raytheon.uf.common.dataplugin.satellite.SatMapCoverage;
import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord; import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord;
import com.raytheon.uf.common.datastorage.records.IDataRecord; 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.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.DataTime; 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 * IDataRecord required by the SatelliteDao
* 12/03/2013 DR 16841 D. Friedman Allow record overwrites * 12/03/2013 DR 16841 D. Friedman Allow record overwrites
* 09/18/2014 3627 mapeters Updated deprecated method calls. * 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 * Sep 23, 2021 8608 mapeters Handle PDO.traceId changes
* </pre> * </pre>
* *
@ -87,6 +105,12 @@ public class McidasSatelliteDecoder {
private static final int EXPECTED_IMAGE_TYPE_LE = 4; private static final int EXPECTED_IMAGE_TYPE_LE = 4;
private static final int EXPECTED_IMAGE_TYPE_BE = 0x04000000; 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 HALFPI = Math.PI / 2.;
@ -132,6 +156,14 @@ public class McidasSatelliteDecoder {
* @throws Exception * @throws Exception
*/ */
private PluginDataObject[] decodeMcidasArea(byte[] data) 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); ByteBuffer buf = ByteBuffer.wrap(data);
buf.order(ByteOrder.LITTLE_ENDIAN); buf.order(ByteOrder.LITTLE_ENDIAN);
@ -146,80 +178,96 @@ public class McidasSatelliteDecoder {
formatError(UNEXPECTED_HEADER_VALUE); formatError(UNEXPECTED_HEADER_VALUE);
} }
} }
int sensorSourceNumber = buf.getInt();
int yyyddd = buf.getInt(); int sensorSourceNumber = buf.getInt(); // W3
int hhmmss = buf.getInt(); int yyyddd = buf.getInt(); // W4
int ulImageLine = buf.getInt(); int hhmmss = buf.getInt(); // W5
int ulImageElement = buf.getInt(); int ulImageLine = buf.getInt(); // W6
buf.getInt(); // reserved int ulImageElement = buf.getInt(); // W7
int nLines = buf.getInt(); buf.getInt(); // W8 reserved
int nElementsPerLine = buf.getInt(); int nLines = buf.getInt(); // W9
int nBytesPerElement = buf.getInt(); int nElementsPerLine = buf.getInt(); // W10
int lineResolution = buf.getInt(); int nBytesPerElement = buf.getInt(); // W11
int elementResolution = buf.getInt(); int lineResolution = buf.getInt(); // W12
int nBands = buf.getInt(); int elementResolution = buf.getInt(); // W13
int linePrefixLength = buf.getInt(); int nBands = buf.getInt(); // W14
/* int projectNumber = */buf.getInt(); int linePrefixLength = buf.getInt(); // W15
/* int creationYyyddd = */buf.getInt(); /* int projectNumber = */buf.getInt(); // W16
/* int creationHhmmss = */buf.getInt(); /* int creationYyyddd = */buf.getInt(); // W17
int bandMap1to32 = buf.getInt(); /* int creationHhmmss = */buf.getInt(); // W18
int bandMap33to64 = buf.getInt(); /*
// sensor specific 32-bit filter band map for multichannel
buf.position(buf.position() + (4 * 4)); images; if a bit is set, data exists for the band;
// memo band 1 is the least significant byte (rightmost)
buf.position(buf.position() + (4 * 8)); */
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 areaNumber = buf.getInt();
int dataBlockOffset = buf.getInt(); int dataBlockOffset = buf.getInt();
int navBlockOffset = buf.getInt(); int navBlockOffset = buf.getInt();
/* int validityCode = */buf.getInt(); /* int validityCode = */buf.getInt();
buf.position(buf.position() + (8 * 4)); // PDL buf.position(buf.position() + (8 * 4)); // PDL
buf.getInt(); buf.getInt(); // GOES AA band 8
// GOES AA band 8
/* int imageYyyddd = */buf.getInt(); /* int imageYyyddd = */buf.getInt();
/* int imageHhmmssOrMillis = */buf.getInt(); /* int imageHhmmssOrMillis = */buf.getInt();
/* int imageStartScan = */buf.getInt(); /* int imageStartScan = */buf.getInt();
/* int prefixDocLength = */buf.getInt(); /* int prefixDocLength = */buf.getInt();
/* int prefixCalibrationLength = */buf.getInt(); int prefixCalibrationLength = buf.getInt(); // W50
/* int prefixBandListLength = */buf.getInt(); /* int prefixBandListLength = */buf.getInt(); // W51
// source type buf.getInt(); // W52 source type
buf.getInt(); String calType = get4cc(buf); // W53 cal type
// cal type buf.position(buf.position() + (3 * 4)); // reserved
buf.getInt(); /* int originalSourceType = */buf.getInt(); // actually a 4cc?
buf.position(buf.position() + (3 * 4)); /* int units = */buf.getInt(); // also 4cc?
// reserved
/* int originalSourceType = */buf.getInt();
// actually a 4cc?
/* int units = */buf.getInt();
// also 4cc?
/* int scaling = */buf.getInt(); /* int scaling = */buf.getInt();
/* int supplementalBlockOffset = */buf.getInt(); /* int supplementalBlockOffset = */buf.getInt();
buf.getInt(); buf.getInt(); // reserved
// reserved int calibrationOffset = buf.getInt(); // W63
/* int calibrationOffset = */buf.getInt(); int numberOfComments = buf.getInt(); // W64 comment cards
// comment cards
buf.getInt(); /* 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; long bandBits = ((long) bandMap33to64 << 32) | bandMap1to32;
if (nBands != Long.bitCount(bandBits)) { long bandBitsCount = Long.bitCount(bandBits);
formatError( if (nBands != bandBitsCount && nBands > 1) {
"Specified number of bands does not match number of bits in band map"); formatError("Specified number of bands does not match number of bits in band map");
} }
// Decode the navigation block // Decode the navigation block
buf.position(navBlockOffset); buf.position(navBlockOffset);
SatMapCoverage coverage = decodeNavigation(elementResolution, SatMapCoverage coverage = decodeNavigation(elementResolution,
lineResolution, ulImageElement, ulImageLine, nElementsPerLine, lineResolution, ulImageElement, ulImageLine, nElementsPerLine,
nLines, buf); nLines, buf, navigation);
// Decode the data block, creating a SatelliteRecord for each band. // Decode the data block, creating a SatelliteRecord for each band.
PluginDataObject[] result = new PluginDataObject[nBands]; PluginDataObject[] result = new PluginDataObject[nBands];
int bitIndex = 0; int bitIndex = 0;
for (int ri = 0; ri < nBands; ++ri) { RECORD: for (int ri = 0; ri < nBands; ++ri) {
while ((bandBits & (1L << bitIndex)) == 0) { while ((bandBits & (1L << bitIndex)) == 0) {
++bitIndex; if (++bitIndex >= 64) {
if (bitIndex >= 64) { break RECORD; // shouldn't happen
// shouldn't happen
return result;
} }
} }
SatelliteRecord rec = new SatelliteRecord(); SatelliteRecord rec = new SatelliteRecord();
@ -231,18 +279,20 @@ public class McidasSatelliteDecoder {
bitIndex + 1); bitIndex + 1);
rec.setPhysicalElement(pev.name); rec.setPhysicalElement(pev.name);
rec.setUnits(pev.units); rec.setUnits(pev.units);
rec.setSectorID(getAreaName(areaNumber)); rec.setSectorID(getAreaName(sensorSourceNumber, areaNumber));
rec.setCoverage(coverage); rec.setCoverage(coverage);
// TODO: Line pad if not a multiple of four bytes // TODO: Line pad if not a multiple of four bytes
if ((linePrefixLength == 0) && (nBytesPerElement == 1) if ((linePrefixLength == 0) && (nBytesPerElement == 1) && (nBands == 1)) {
&& (nBands == 1)) { if (isPngCompressed(pngBlock)) {
byte[] imageBytes = new byte[nLines * nElementsPerLine]; byte[] pngBytes = decompressPngSatellite(pngBlock);
buf.position(dataBlockOffset); rec.setMessageData(pngBytes);
buf.get(imageBytes); } else {
byte[] imageBytes = new byte[nLines * nElementsPerLine];
rec.setMessageData(imageBytes); buf.position(dataBlockOffset);
buf.get(imageBytes);
rec.setMessageData(imageBytes);
}
} else if (nBytesPerElement == 1) { } else if (nBytesPerElement == 1) {
byte[] imageBytes = new byte[nLines * nElementsPerLine]; byte[] imageBytes = new byte[nLines * nElementsPerLine];
int si = dataBlockOffset + (ri * nBytesPerElement); int si = dataBlockOffset + (ri * nBytesPerElement);
@ -251,8 +301,7 @@ public class McidasSatelliteDecoder {
for (int y = 0; y < nLines; ++y) { for (int y = 0; y < nLines; ++y) {
si += linePrefixLength; si += linePrefixLength;
for (int x = 0; x < nElementsPerLine; ++x) { for (int x = 0; x < nElementsPerLine; ++x) {
imageBytes[di] = buf.get(si); imageBytes[di++] = buf.get(si);
++di;
si += eincr; si += eincr;
} }
} }
@ -260,11 +309,10 @@ public class McidasSatelliteDecoder {
unimplemented("non-byte elements"); unimplemented("non-byte elements");
} }
rec.setSourceTraceId(traceId); rec.setTraceId(traceId);
rec.setPersistenceTime(TimeUtil.newGmtCalendar().getTime()); rec.setPersistenceTime(TimeUtil.newGmtCalendar().getTime());
rec.setOverwriteAllowed(true); rec.setOverwriteAllowed(true);
// Set the data into the IDataRecord
// Set the data into the IDataRecord // Set the data into the IDataRecord
IDataRecord dataRec = SatelliteRecord.getDataRecord(rec); IDataRecord dataRec = SatelliteRecord.getDataRecord(rec);
if (dataRec != null) { if (dataRec != null) {
@ -281,47 +329,119 @@ public class McidasSatelliteDecoder {
result = new PluginDataObject[0]; result = new PluginDataObject[0];
} }
} }
return result; 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: * Reference:
* http://www.ssec.wisc.edu/mcidas/doc/prog_man/2006/formats-13a.html * http://www.ssec.wisc.edu/mcidas/doc/prog_man/2006/formats-13a.html
* *
*/ */
private SatMapCoverage decodeNavigation(int xImgRes, int yImgRes, int ulX, 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(); SatMapCoverage result = new SatMapCoverage();
String navType = get4cc(buf); String navType = get4cc(buf);
if ("MERC".equals(navType)) { int lineOfEquator = buf.getInt();
int lineOfEquator = buf.getInt(); int elementOfEquator = buf.getInt();
int elementOfEquator = buf.getInt(); int stdLatDDMMSS = buf.getInt();
int stdLatDDMMSS = buf.getInt(); int spacingAtStdLatInMeters = buf.getInt();
int spacingAtStdLatInMeters = buf.getInt(); int nrmlLonDDMMSS = 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();
/* boolean geodetic = */buf.getInt()/* >= 0 */;
// NOTE: We do not check the following for compatibility with WGS84. boolean westPositive = buf.getInt() >= 0;
int radiusInMeters = buf.getInt(); float la1, lo1, la2, lo2;
/* int eccentricity = */buf.getInt(); double dy;
/* boolean geodetic = */buf.getInt()/* >= 0 */;
boolean westPositive = buf.getInt() >= 0; /*
float la1, lo1, la2, lo2; * The following is based on
* gov.noaa.nws.ncep.edex.plugin.mcidas/src
* /gov/noaa/nws/ncep/edex/plugin/mcidas/decoder/McidasDecoder.java
*/
/* double clon = flipLon(unpackDdmmss(nrmlLonDDMMSS), westPositive);
* The following is based on double clat = unpackDdmmss(stdLatDDMMSS);
* gov.noaa.nws.ncep.edex.plugin.mcidas/src double dx = spacingAtStdLatInMeters * xImgRes;
* /gov/noaa/nws/ncep/edex/plugin/mcidas/decoder/McidasDecoder.java
*/
double clon = flipLon(unpackDdmmss(nrmlLonDDMMSS), westPositive); double phi0r = clat * DTR;
double clat = unpackDdmmss(stdLatDDMMSS); double sign = 1.;
double dx = spacingAtStdLatInMeters * xImgRes; if (phi0r < 0.) {
sign = -1.;
double phi0r = clat * DTR; }
double rxp = (((double) (elementOfEquator - ulX) / xImgRes) + 1.); double rxp = (((double) (elementOfEquator - ulX) / xImgRes) + 1.);
double ryp = (ny - ((double) (lineOfEquator - ulY) / yImgRes)); double ryp = (ny - ((double) (lineOfEquator - ulY) / yImgRes));
if (navType.equals("MERC")) {
double dxp = 1. - rxp; double dxp = 1. - rxp;
double dyp = 1. - ryp; double dyp = 1. - ryp;
@ -337,12 +457,61 @@ public class McidasSatelliteDecoder {
la2 = (float) (((2. * Math.atan(arg)) - HALFPI) * RTD); la2 = (float) (((2. * Math.atan(arg)) - HALFPI) * RTD);
lo2 = (float) prnlon((clon + (((dx * dxp) / rcos) * RTD))); lo2 = (float) prnlon((clon + (((dx * dxp) / rcos) * RTD)));
lo2 = (float) prnlon(lo2); lo2 = (float) prnlon(lo2);
result = SatSpatialFactory.getInstance().getCoverageTwoCorners( result = SatSpatialFactory.getInstance().getCoverageTwoCorners(
SatSpatialFactory.PROJ_MERCATOR, nx, ny, (float) clon, SatSpatialFactory.PROJ_MERCATOR, nx, ny, (float) clon,
(float) clat, la1, lo1, la2, lo2); (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 {
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 { } else {
unimplemented(String.format("navigation type \"%s\"", navType)); /*
* 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; return result;
@ -391,24 +560,22 @@ public class McidasSatelliteDecoder {
} }
private String getCreatingEntity(int sensorSourceNumber) { private String getCreatingEntity(int sensorSourceNumber) {
String value = McidasSatelliteLookups.getInstance() String value = McidasSatelliteLookups.getInstance().getCreatingEntity(
.getCreatingEntity(sensorSourceNumber); sensorSourceNumber);
return value != null ? value return value != null ? value : String.format("Unknown-%d",
: String.format("Unknown-%d", sensorSourceNumber); sensorSourceNumber);
} }
private PhysicalElementValue getPhysicalElement(int ssn, int bandIndex) { private PhysicalElementValue getPhysicalElement(int ssn, int bandIndex) {
PhysicalElementValue value = McidasSatelliteLookups.getInstance() PhysicalElementValue value = McidasSatelliteLookups.getInstance()
.getPhysicalElement(ssn, bandIndex); .getPhysicalElement(ssn, bandIndex);
return value != null ? value return value != null ? value : new PhysicalElementValue(String.format(
: new PhysicalElementValue( "Unknown-%d", bandIndex), null);
String.format("Unknown-%d", bandIndex), null);
} }
private String getAreaName(int areaNumber) { private String getAreaName(int ssn, int areaNumber) {
String value = McidasSatelliteLookups.getInstance() String value = McidasSatelliteLookups.getInstance().getAreaName(ssn);
.getAreaName(areaNumber); return value != null ? value : String.format("AREA%04d", areaNumber);
return value != null ? value : String.format("AREA%04d", areaNumber);
} }
private void formatError(String message) throws DecoderException { private void formatError(String message) throws DecoderException {
@ -416,8 +583,14 @@ public class McidasSatelliteDecoder {
} }
protected void unimplemented(String feature) throws DecoderException { protected void unimplemented(String feature) throws DecoderException {
throw new DecoderException( throw new DecoderException(String.format("%s: unimplemented: %s",
String.format("%s: unimplemented: %s", traceId, feature)); traceId, feature));
} }
private String encodeNavBlock(byte[] navigation) {
Base64 b64 = new Base64();
byte[] coded = b64.encode(navigation);
return new String(coded);
}
} }

View file

@ -54,6 +54,7 @@ import com.raytheon.uf.common.status.UFStatus;
* Jul 29, 2011 dfriedma Initial creation * Jul 29, 2011 dfriedma Initial creation
* Jul 14, 2016 5744 mapeters Initial javadoc creation, config files moved * Jul 14, 2016 5744 mapeters Initial javadoc creation, config files moved
* from edex_static to common_static * from edex_static to common_static
* Aug 2018 mjames Changed area lookup name to sensor source
* *
* </pre> * </pre>
* *
@ -217,8 +218,8 @@ public class McidasSatelliteLookups {
return creatingEntityLookup.map.get(sensorSource); return creatingEntityLookup.map.get(sensorSource);
} }
public String getAreaName(int areaNumber) { public String getAreaName(int sensorSource) {
return areaNameLookup.map.get(areaNumber); return areaNameLookup.map.get(sensorSource);
} }
private static McidasSatelliteLookups instance; private static McidasSatelliteLookups instance;

View file

@ -26,4 +26,6 @@
--> -->
<requestPatterns xmlns:ns2="group"> <requestPatterns xmlns:ns2="group">
<regex>AREA[0-9]{4}.*</regex> <regex>AREA[0-9]{4}.*</regex>
<regex>pnga2area</regex>
<regex>.*uniwisc.*</regex>
</requestPatterns> </requestPatterns>

View file

@ -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>

View file

@ -26,8 +26,39 @@
different localization levels will be combined. different localization levels will be combined.
--> -->
<creatingEntities> <creatingEntities>
<map> <map>
<entry><key>84</key><value>MTSAT-1R</value></entry> <entry><key>3</key><value>SOUNDER3</value></entry>
<entry><key>85</key><value>MTSAT-2</value></entry> <entry><key>9</key><value>COMP9</value></entry>
</map> <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> </creatingEntities>

View file

@ -30,23 +30,93 @@
different localization levels will be combined. different localization levels will be combined.
--> -->
<physicalElements> <physicalElements>
<map> <map>
<!-- MTSAT-1R --> <!-- MTSAT-1R -->
<entry><key ss="84" band="1"/><value name="Imager Visible" /></entry> <entry><key ss="84" band="1"/><value name="Imager Visible" /></entry>
<entry><key ss="84" band="2"/><value name="Imager 11 micron IR" units="IRPixel" /></entry> <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="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="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. --> <!-- 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 --> <!-- MTSAT-2 -->
<entry><key ss="85" band="1"/><value name="Imager Visible" /></entry> <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="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="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="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. --> <!-- 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>
</map>
<!-- 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> </physicalElements>