Issue #1823: Trigger SAT smart inits based only on sector id and physical element.

Change-Id: I2d8c44ea6dbe9c227e3984f64caf5071b1c62e79

Former-commit-id: 1df8d39919 [formerly 1df8d39919 [formerly 4114f40bee478e8ab004c7b3d5fd7bdd0980bb14]]
Former-commit-id: bebfc60317
Former-commit-id: 07487a27dc
This commit is contained in:
David Gillingham 2013-03-26 10:33:42 -05:00
parent efec4d0365
commit 45bf26aa00
5 changed files with 80 additions and 68 deletions

View file

@ -1245,11 +1245,11 @@ elif SID == "HFO":
# San Juan OCONUS
elif SID == "SJU":
SATDATA = [("NESDIS/GOES-13(N)/East CONUS/Imager Visible", "visibleEast"),
("NESDIS/GOES-13(N)/East CONUS/Imager 11 micron IR", "ir11East"),
("NESDIS/GOES-13(N)/East CONUS/Imager 12 micron IR", "ir13East"),
("NESDIS/GOES-13(N)/East CONUS/Imager 3.9 micron IR", "ir39East"),
("NESDIS/GOES-13(N)/East CONUS/Imager 6.7-6.5 micron IR (WV)", "waterVaporEast")]
SATDATA = [("East CONUS/Imager Visible", "visibleEast"),
("East CONUS/Imager 11 micron IR", "ir11East"),
("East CONUS/Imager 13 micron (IR)", "ir13East"),
("East CONUS/Imager 3.9 micron IR", "ir39East"),
("East CONUS/Imager 6.7-6.5 micron IR (WV)", "waterVaporEast")]
# Guam OCONUS
elif SID == "GUM":
@ -1257,16 +1257,16 @@ elif SID == "GUM":
#CONUS sites
else:
SATDATA = [("NESDIS/GOES-11(L)/West CONUS/Imager Visible", "visibleWest"),
("NESDIS/GOES-11(L)/West CONUS/Imager 11 micron IR", "ir11West"),
("NESDIS/GOES-11(L)/West CONUS/Imager 12 micron IR", "ir13West"),
("NESDIS/GOES-11(L)/West CONUS/Imager 3.9 micron IR", "ir39West"),
("NESDIS/GOES-11(L)/West CONUS/Imager 6.7-6.5 micron IR (WV)", "waterVaporWest"),
("NESDIS/GOES-13(N)/East CONUS/Imager Visible", "visibleEast"),
("NESDIS/GOES-13(N)/East CONUS/Imager 11 micron IR", "ir11East"),
("NESDIS/GOES-13(N)/East CONUS/Imager 12 micron IR", "ir13East"),
("NESDIS/GOES-13(N)/East CONUS/Imager 3.9 micron IR", "ir39East"),
("NESDIS/GOES-13(N)/East CONUS/Imager 6.7-6.5 micron IR (WV)", "waterVaporEast")]
SATDATA = [("West CONUS/Imager Visible", "visibleWest"),
("West CONUS/Imager 11 micron IR", "ir11West"),
("West CONUS/Imager 13 micron (IR)", "ir13West"),
("West CONUS/Imager 3.9 micron IR", "ir39West"),
("West CONUS/Imager 6.7-6.5 micron IR (WV)", "waterVaporWest"),
("East CONUS/Imager Visible", "visibleEast"),
("East CONUS/Imager 11 micron IR", "ir11East"),
("East CONUS/Imager 13 micron (IR)", "ir13East"),
("East CONUS/Imager 3.9 micron IR", "ir39East"),
("East CONUS/Imager 6.7-6.5 micron IR (WV)", "waterVaporEast")]
#---------------------------------------------------------------------------
#

View file

@ -47,6 +47,7 @@ import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.edex.database.plugin.PluginFactory;
/**
@ -59,6 +60,9 @@ import com.raytheon.uf.edex.database.plugin.PluginFactory;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 16, 2011 bphillip Initial creation
* Mar 25, 2013 1823 dgilling Disassociate data from Source and
* CreatingEntity metadata, rely only
* on SectorId and PhysicalElement as in A1.
*
* </pre>
*
@ -72,8 +76,7 @@ public class D2DSatParm extends GridParm {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(D2DSatParm.class);
private static final long TIME_MATCH_FACTOR = 3 * 60 * 1000; // 3 minutes in
// ms
private static final long TIME_MATCH_FACTOR = 3 * TimeUtil.MILLIS_PER_MINUTE;
/** The ParmID associated with this D2DSatParm */
private ParmID pid;
@ -84,12 +87,6 @@ public class D2DSatParm extends GridParm {
/** Time constraints used by satellite data */
private static final TimeConstraints tc = new TimeConstraints(60, 60, 0);
/** The satellite source for this satellite data */
private String source;
/** The creating entity for this satellite data */
private String creatingEntity;
/** The sector ID for this satellite data */
private String sectorID;
@ -117,10 +114,8 @@ public class D2DSatParm extends GridParm {
productURI = productURI.substring(1);
}
String[] tokens = productURI.split("/");
source = tokens[0];
creatingEntity = tokens[1];
sectorID = tokens[2];
physicalElement = tokens[3];
sectorID = tokens[0];
physicalElement = tokens[1];
}
}
@ -152,8 +147,8 @@ public class D2DSatParm extends GridParm {
satDao = (SatelliteDao) PluginFactory.getInstance().getPluginDao(
"satellite");
satInventory = satDao.getSatelliteInventory(source, creatingEntity,
sectorID, physicalElement);
satInventory = satDao.getSatelliteInventory(null, null, sectorID,
physicalElement);
} catch (Exception e) {
statusHandler.error("Error getting inventory for sectorID ["
+ sectorID + "] and physicalElement [" + physicalElement
@ -221,9 +216,8 @@ public class D2DSatParm extends GridParm {
try {
dao = (SatelliteDao) PluginFactory.getInstance().getPluginDao(
"satellite");
List<SatelliteRecord> satRecords = dao.getSatelliteData(source,
creatingEntity, sectorID, physicalElement,
rangesToDates(matchedTimes));
List<SatelliteRecord> satRecords = dao.getSatelliteData(null, null,
sectorID, physicalElement, rangesToDates(matchedTimes));
for (int i = 0; i < satRecords.size(); i++) {
GridLocation satGridLoc = satMapCoverageToGridLocation(satRecords
.get(i).getCoverage());

View file

@ -75,6 +75,8 @@ import com.raytheon.uf.edex.core.EDEXUtil;
* Sep 19, 2012 jdynina DR 15442 fix
* Jan 18, 2013 #1504 randerso Moved D2D to GFE parameter name translation from
* D2DParmIdCache to GfeIngestNotificationFilter
* Mar 25, 2013 1823 dgilling Trigger SAT smart init based only on record's
* SectorId and PhysicalElement.
*
* </pre>
*
@ -270,9 +272,8 @@ public class GfeIngestNotificationFilter {
for (SatelliteRecord msg : records) {
Date validTime = msg.getDataTime().getValidPeriod().getStart();
String product = msg.getSource() + "/"
+ msg.getCreatingEntity() + "/" + msg.getSectorID()
+ "/" + msg.getPhysicalElement();
String product = msg.getSectorID() + "/"
+ msg.getPhysicalElement();
if (satData.containsKey(product)) {
ParmID pid = new ParmID(satData.get(product),
satDb.getDbId());

View file

@ -39,7 +39,6 @@ import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.satellite.SatMapCoverage;
import com.raytheon.uf.common.dataplugin.satellite.SatelliteMessageData;
import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord;
import com.raytheon.uf.common.dataquery.db.QueryResult;
import com.raytheon.uf.common.datastorage.DataStoreFactory;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.StorageException;
@ -71,6 +70,9 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
* Feb 11, 2009 bphillip Initial creation
* - AWIPS2 Baseline Repository --------
* 07/09/2012 798 jkorman Modified datastore population.
* 03/25/2013 1823 dgilling Modified getSatelliteData() and
* getSatelliteInventory() to allow optional
* input arguments.
* </pre>
*
* @author bphillip
@ -78,12 +80,6 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
*/
public class SatelliteDao extends PluginDao {
/**
* Database query used for retrieving the inventory of data based on the
* source, creating entity, sector id, and physical element
*/
private static final String INVENTORY_QUERY = "select reftime from awips.satellite where source='%s' and creatingentity='%s' and sectorid='%s' and physicalElement='%s' order by reftime asc";
/** The creating entity data access object */
private SatelliteCreatingEntityDao creatingEntityDao = new SatelliteCreatingEntityDao();
@ -235,10 +231,18 @@ public class SatelliteDao extends PluginDao {
continue;
}
DatabaseQuery query = new DatabaseQuery(SatelliteRecord.class);
query.addQueryParam("source", source);
query.addQueryParam("creatingEntity", creatingEntity);
query.addQueryParam("sectorID", sectorID);
query.addQueryParam("physicalElement", physicalElement);
if (source != null) {
query.addQueryParam("source", source);
}
if (creatingEntity != null) {
query.addQueryParam("creatingEntity", creatingEntity);
}
if (sectorID != null) {
query.addQueryParam("sectorID", sectorID);
}
if (physicalElement != null) {
query.addQueryParam("physicalElement", physicalElement);
}
query.addQueryParam("dataTime.refTime", theDate);
query.addOrder("dataTime.refTime", true);
try {
@ -277,16 +281,25 @@ public class SatelliteDao extends PluginDao {
public List<Date> getSatelliteInventory(String source,
String creatingEntity, String sectorID, String physicalElement)
throws DataAccessLayerException {
QueryResult result = (QueryResult) this.executeNativeSql(String.format(
INVENTORY_QUERY, source, creatingEntity, sectorID,
physicalElement));
List<Date> inventory = new ArrayList<Date>();
if (result.getResultCount() > 0) {
for (int i = 0; i < result.getResultCount(); i++) {
inventory.add((Date) result.getRowColumnValue(i, 0));
}
DatabaseQuery query = new DatabaseQuery(this.daoClass);
if (source != null) {
query.addQueryParam("source", source);
}
return inventory;
if (creatingEntity != null) {
query.addQueryParam("creatingEntity", creatingEntity);
}
if (sectorID != null) {
query.addQueryParam("sectorID", sectorID);
}
if (physicalElement != null) {
query.addQueryParam("physicalElement", physicalElement);
}
query.addReturnedField("dataTime.refTime");
query.addOrder("dataTime.refTime", true);
@SuppressWarnings("unchecked")
List<Date> times = (List<Date>) this.queryByCriteria(query);
return new ArrayList<Date>(times);
}
/**

View file

@ -57,7 +57,9 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* 20071129 472 jkorman Added IDecoderGettable interface.
* 20081106 1515 jkorman Changed units length from 16 to 26
* - AWIPS2 Baseline Repository --------
* 07/30/2012 798 jkorman Support for common satellite data.
* 07/30/2012 798 jkorman Support for common satellite data.
* 03/25/2013 1823 dgilling Replace underscores with spaces in URI
* constructor.
* </pre>
*
* @author bphillip
@ -77,7 +79,7 @@ public class SatelliteRecord extends ServerSpecificPersistablePluginDataObject
* The default dataset name to use for persisted satellite data.
*/
public static final String SAT_DATASET_NAME = DataStoreFactory.DEF_DATASET_NAME;
/**
* The attribute name for a value that will be used to "fill" undefined
* data.
@ -178,8 +180,8 @@ public class SatelliteRecord extends ServerSpecificPersistablePluginDataObject
@XmlAttribute
@DynamicSerializeElement
private Integer interpolationLevels;
@DataURI(position = 5, embedded=true)
@DataURI(position = 5, embedded = true)
@ManyToOne
@PrimaryKeyJoinColumn
@XmlElement
@ -247,7 +249,7 @@ public class SatelliteRecord extends ServerSpecificPersistablePluginDataObject
* The table definition associated with this class
*/
public SatelliteRecord(String uri) {
super(uri);
super(uri.replace('_', ' '));
}
public Integer getNumRecords() {
@ -334,21 +336,24 @@ public class SatelliteRecord extends ServerSpecificPersistablePluginDataObject
/**
* Get the number of interpolation levels in the data store.
*
* @return The number of interpolation levels. Data that is not interpolated
* should return a value of 0.
* should return a value of 0.
*/
public Integer getInterpolationLevels() {
return interpolationLevels;
}
/**
* Set the number of interpolation levels in the data store. If the data
* are not interpolated a value of 0 should be used.
* @param levels The number of interpolation levels in the data. Any value less than
* zero is set to zero.
* Set the number of interpolation levels in the data store. If the data are
* not interpolated a value of 0 should be used.
*
* @param levels
* The number of interpolation levels in the data. Any value less
* than zero is set to zero.
*/
public void setInterpolationLevels(Integer levels) {
if(!DataStoreFactory.isInterpolated(levels)) {
if (!DataStoreFactory.isInterpolated(levels)) {
levels = 0;
}
interpolationLevels = levels;
@ -378,5 +383,4 @@ public class SatelliteRecord extends ServerSpecificPersistablePluginDataObject
return dataRec;
}
}