Issue #189 minor fixes to grid for issues discovered during dev tests

Former-commit-id: 509c09ebb0 [formerly 23da6e6494 [formerly 4ae112f6fcc9c2d0bb8715033a80d265dbdfe8b4]]
Former-commit-id: 23da6e6494
Former-commit-id: fa380d06c1
This commit is contained in:
Ben Steffensmeier 2012-10-02 17:06:26 -05:00
parent 4d8e42f460
commit 735099e934
10 changed files with 54 additions and 25 deletions

View file

@ -134,4 +134,36 @@ public class StaticGridDataLevelNode extends AbstractBaseDataNode {
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result
+ ((dataType == null) ? 0 : dataType.hashCode());
result = prime * result + ((source == null) ? 0 : source.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
StaticGridDataLevelNode other = (StaticGridDataLevelNode) obj;
if (dataType == null) {
if (other.dataType != null)
return false;
} else if (!dataType.equals(other.dataType))
return false;
if (source == null) {
if (other.source != null)
return false;
} else if (!source.equals(other.source))
return false;
return true;
}
}

View file

@ -173,7 +173,7 @@ public class CoverageUtils implements IAlertObserver {
public RemappedImage remapGrid(GridCoverage sourceGrid,
GridCoverage destinationGrid, FloatDataRecord inputData,
Interpolation interpolation) throws VizException {
if (sourceGrid.getName().equals(destinationGrid.getName())) {
if (sourceGrid.getId().equals(destinationGrid.getId())) {
// we don't need to remap anything. the grids are the same
return new RemappedImage(inputData);
}

View file

@ -130,7 +130,7 @@ public class GridDataCubeAdapter extends AbstractDataCubeAdapter {
IDataStore ds = DataStoreFactory.getDataStore(HDF5Util
.findHDF5Location(obj));
try {
record = ds.retrieve("/" + gridRec.getLocation().getName(),
record = ds.retrieve("/" + gridRec.getLocation().getId(),
gridRec.getParameter().getAbbreviation(), req);
} catch (Exception e) {
throw new VizException("Error retrieving staticTopo data!",

View file

@ -10,6 +10,7 @@ Require-Bundle: org.apache.batik,
org.eclipse.ui,
org.eclipse.core.runtime,
com.raytheon.viz.core,
com.raytheon.uf.viz.core,
com.raytheon.viz.ui,
org.apache.commons.lang,
javax.measure,

View file

@ -423,7 +423,7 @@ class GribDecoder():
record.addExtraAttribute("pdsTemplate", Integer(pdsSectionValues['pdsTemplateNumber']))
record.addExtraAttribute("gridid", origCoverage.getName())
if "numForecasts" in pdsSectionValues:
record.addExtraAttribute("numForecasts", Integer(pdsSectionValues['numForecasts']))
record.addExtraAttribute("numForecasts", pdsSectionValues['numForecasts'])
record.setEnsembleId(pdsSectionValues['ensembleId'])
param = Parameter(pdsSectionValues['parameterAbbreviation'], pdsSectionValues['parameterName'], pdsSectionValues['parameterUnit'])
GribParamTranslator.getInstance().getParameterNameAlias(modelName, param)
@ -1027,8 +1027,7 @@ class GribDecoder():
# If not found, create a new GribCoverage and store in the cache
if grid is None:
GridCoverageLookup.getInstance().putCoverage(temp)
grid = GridCoverageLookup.getInstance().getCoverage(temp)
grid = GridCoverageLookup.getInstance().getCoverage(temp, True)
return grid
@ -1260,7 +1259,7 @@ class GribDecoder():
def _createModelName(self, pdsSectionValues, grid):
gridModel = self._getGridModel(pdsSectionValues, grid)
if gridModel is None:
name = "UnknownModel:" + str(pdsSectionValues['centerid']) + ":" + str(pdsSectionValues['subcenterid']) + ":" + str(pdsSectionValues['genprocess']) + ":" + grid.getName()
name = "UnknownModel:" + str(pdsSectionValues['centerid']) + ":" + str(pdsSectionValues['subcenterid']) + ":" + str(pdsSectionValues['genprocess']) + ":" + str(grid.getId())
else:
name = gridModel.getName()
return name

View file

@ -914,7 +914,8 @@ public class Grib1Decoder extends AbstractDecoder {
if (gridModel == null || gridModel.getName() == null) {
return "UnknownModel:" + String.valueOf(centerId) + ":"
+ String.valueOf(subcenterId) + ":"
+ String.valueOf(process) + ":" + grid.getName();
+ String.valueOf(process) + ":"
+ String.valueOf(grid.getId());
} else {
return gridModel.getName();
}

View file

@ -154,7 +154,7 @@ public class EnsembleGridAssembler implements IDecoderPostProcessor {
ClusterLockUtils.unlock(ct, clearTime);
}
return new GridRecord[] { rec, newRec };
return new GridRecord[] { rec };
}
return new GridRecord[] { rec };
}
@ -203,10 +203,12 @@ public class EnsembleGridAssembler implements IDecoderPostProcessor {
GridDao dao = (GridDao) PluginFactory.getInstance().getPluginDao(
GridConstants.GRID);
String modelName = record.getDatasetId();
String grid = record.getLocation().getName();
String oldGrid = record.getLocation().getId().toString();
String newGrid = GribSpatialCache.getInstance()
.getGridByName(thinned.getGrid()).getId().toString();
String dataURI = record.getDataURI();
String assembledDataURI = dataURI.replace(modelName,
thinned.getModelName()).replace(grid, thinned.getGrid());
thinned.getModelName()).replace(oldGrid, newGrid);
List<?> result = dao.queryBySingleCriteria("dataURI", assembledDataURI);
GridRecord assembledRecord = null;

View file

@ -267,7 +267,7 @@ public class StaticDataGenerator implements Processor {
float[] rawData = (float[]) record.getMessageData();
FloatDataRecord staticTopoData = new FloatDataRecord(
STATIC_TOPO, "/" + record.getLocation().getName(),
STATIC_TOPO, "/" + record.getLocation().getId(),
rawData, 2, new long[] { record.getLocation().getNx(),
record.getLocation().getNy() });
staticTopoGridRecord = createTopoRecord(record);
@ -321,7 +321,7 @@ public class StaticDataGenerator implements Processor {
try {
// check if its already been stored
dataSets = dataStore.getDatasets("/"
+ record.getLocation().getName());
+ record.getLocation().getId());
} catch (Exception e) {
// Ignore
}
@ -333,7 +333,7 @@ public class StaticDataGenerator implements Processor {
.getInstance().getStopoData(
record.getLocation());
staticTopoRecord.setGroup("/"
+ record.getLocation().getName());
+ record.getLocation().getId());
staticTopoRecord.setName(STATIC_TOPO);
dataStore.addDataRecord(staticTopoRecord);
}
@ -440,7 +440,7 @@ public class StaticDataGenerator implements Processor {
} else {
dxRecord.setName("staticXspacing");
}
dxRecord.setGroup("/" + staticXRecord.getLocation().getName());
dxRecord.setGroup("/" + staticXRecord.getLocation().getId());
dataStore.addDataRecord(dxRecord);
}
@ -448,7 +448,7 @@ public class StaticDataGenerator implements Processor {
FloatDataRecord dyRecord = StaticGridData.getInstance(
staticYRecord.getLocation()).getDy();
dyRecord.setName("staticYspacing");
dyRecord.setGroup("/" + staticXRecord.getLocation().getName());
dyRecord.setGroup("/" + staticXRecord.getLocation().getId());
dataStore.addDataRecord(dyRecord);
}
@ -456,8 +456,7 @@ public class StaticDataGenerator implements Processor {
FloatDataRecord coriolisRecord = StaticGridData.getInstance(
staticCoriolisRecord.getLocation()).getCoriolis();
coriolisRecord.setName("staticCoriolis");
coriolisRecord
.setGroup("/" + staticXRecord.getLocation().getName());
coriolisRecord.setGroup("/" + staticXRecord.getLocation().getId());
dataStore.addDataRecord(coriolisRecord);
}
}

View file

@ -123,7 +123,7 @@ public class MercatorGridCoverage extends GridCoverage {
@Override
public void initialize() throws GridCoverageException {
double meridian = 0;
if (true || la2 == null || lo2 == null) {
if (la2 == null || lo2 == null) {
initializeSecondCorner();
}
@ -208,11 +208,6 @@ public class MercatorGridCoverage extends GridCoverage {
// Convert the corner points from meters to lat/lon
DirectPosition2D cornerPosition = new DirectPosition2D();
toLatLon.transform(position, cornerPosition);
System.err.println("dx = " + (lo2 - cornerPosition.x));
System.err.println("dy = " + (la2 - cornerPosition.y));
if (Math.abs(lo2 - cornerPosition.x) > 4) {
System.err.println();
}
lo2 = cornerPosition.x;
la2 = cornerPosition.y;
} catch (Exception e) {

View file

@ -100,7 +100,7 @@ public class GridDao extends PluginDao {
String abbrev = gridRec.getParameter().getAbbreviation();
String group = gridRec.getDataURI();
if (GridPathProvider.STATIC_PARAMETERS.contains(abbrev)) {
group = "/" + location.getName();
group = "/" + location.getId();
}
AbstractStorageRecord storageRecord = new FloatDataRecord("Data",
group, (float[]) messageData, 2, sizes);
@ -187,7 +187,7 @@ public class GridDao extends PluginDao {
if (GridPathProvider.STATIC_PARAMETERS.contains(abbrev)) {
IDataRecord[] record = new IDataRecord[4];
record[0] = dataStore.retrieve("/"
+ obj.getLocation().getName(), abbrev,
+ obj.getLocation().getId(), abbrev,
Request.ALL);
retVal.add(record);
} else {