Merge "ASM #18440 - Making small changes to grids and subgrids requires clearing out data for affected models" into asm_16.2.2
This commit is contained in:
parent
910149df71
commit
3b805eaada
6 changed files with 49 additions and 25 deletions
|
@ -88,6 +88,7 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
* Oct 01, 2015 4868 rjpeter Reject subGrids that don't meet minimum
|
||||
* coverage percent.
|
||||
* Feb 26, 2016 5414 rjpeter Fix subgrids along boundary.
|
||||
* Jun 24, 2016 ASM18440 dfriedman Fix spatial tolerance for degree values.
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -109,7 +110,9 @@ public abstract class GridCoverage extends PersistableDataObject<Integer>
|
|||
|
||||
protected static final String SUBGRID_TOKEN = "SubGrid-";
|
||||
|
||||
public static final double SPATIAL_TOLERANCE = 0.1;
|
||||
public static final double SPATIAL_TOLERANCE_KM = 0.1;
|
||||
|
||||
public static final double SPATIAL_TOLERANCE_DEG = 0.0025;
|
||||
|
||||
/** The id for this grid. This value is generated in the initialize method **/
|
||||
@Id
|
||||
|
@ -887,19 +890,34 @@ public abstract class GridCoverage extends PersistableDataObject<Integer>
|
|||
if (firstGridPointCorner != other.firstGridPointCorner) {
|
||||
return false;
|
||||
}
|
||||
if (Math.abs(dx - other.dx) > SPATIAL_TOLERANCE) {
|
||||
double spacingUnitTolerance = getSpacingUnitTolerance();
|
||||
if (Math.abs(dx - other.dx) > spacingUnitTolerance) {
|
||||
return false;
|
||||
} else if (Math.abs(dy - other.dy) > SPATIAL_TOLERANCE) {
|
||||
} else if (Math.abs(dy - other.dy) > spacingUnitTolerance) {
|
||||
return false;
|
||||
} else if (Math.abs(la1 - other.la1) > SPATIAL_TOLERANCE) {
|
||||
} else if (Math.abs(la1 - other.la1) > SPATIAL_TOLERANCE_DEG) {
|
||||
return false;
|
||||
} else if (Math.abs(MapUtil.correctLon(lo1)
|
||||
- MapUtil.correctLon(other.lo1)) > SPATIAL_TOLERANCE) {
|
||||
- MapUtil.correctLon(other.lo1)) > SPATIAL_TOLERANCE_DEG) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public double getSpacingUnitTolerance() {
|
||||
if ("degree".equals(spacingUnit)) {
|
||||
return SPATIAL_TOLERANCE_DEG;
|
||||
} else {
|
||||
Unit<?> spacingUnitObj = Unit.valueOf(spacingUnit);
|
||||
if (spacingUnitObj.isCompatible(SI.KILOMETER)) {
|
||||
UnitConverter converter = SI.KILOMETER.getConverterTo(spacingUnitObj);
|
||||
return converter.convert(SPATIAL_TOLERANCE_KM);
|
||||
} else {
|
||||
return SPATIAL_TOLERANCE_KM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique key containing the spatial attributes of this coverage.
|
||||
*
|
||||
|
|
|
@ -51,6 +51,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* Jan 17, 2014 2125 rjpeter Removed invalid @Table annotation.
|
||||
* Jun 05, 2014 3243 bsteffen Remove deprecated lambert conformal call.
|
||||
* Mar 04, 2015 3959 rjpeter Update for grid based subgridding.
|
||||
* Jun 24, 2016 ASM18440 dfriedman Fix spatial tolerance for degree values.
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -269,11 +270,11 @@ public class LambertConformalGridCoverage extends GridCoverage {
|
|||
public boolean spatialEquals(GridCoverage other) {
|
||||
if (super.spatialEquals(other)) {
|
||||
LambertConformalGridCoverage otherLambert = (LambertConformalGridCoverage) other;
|
||||
if (Math.abs(latin1 - otherLambert.latin1) > SPATIAL_TOLERANCE) {
|
||||
if (Math.abs(latin1 - otherLambert.latin1) > SPATIAL_TOLERANCE_DEG) {
|
||||
return false;
|
||||
} else if (Math.abs(latin2 - otherLambert.latin2) > SPATIAL_TOLERANCE) {
|
||||
} else if (Math.abs(latin2 - otherLambert.latin2) > SPATIAL_TOLERANCE_DEG) {
|
||||
return false;
|
||||
} else if (Math.abs(lov - otherLambert.lov) > SPATIAL_TOLERANCE) {
|
||||
} else if (Math.abs(lov - otherLambert.lov) > SPATIAL_TOLERANCE_DEG) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -55,6 +55,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* 09/10/2012 DR 15270 D. Friedman Fix subgrid model name handling.
|
||||
* Jan 17, 2014 2125 rjpeter Removed invalid @Table annotation.
|
||||
* Mar 04, 2015 3959 rjpeter Update for grid based subgridding.
|
||||
* Jun 24, 2016 ASM18440 dfriedman Fix spatial tolerance for degree values.
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -338,7 +339,7 @@ public class MercatorGridCoverage extends GridCoverage {
|
|||
public boolean spatialEquals(GridCoverage other) {
|
||||
if (super.spatialEquals(other)) {
|
||||
MercatorGridCoverage otherMercator = (MercatorGridCoverage) other;
|
||||
if (Math.abs(latin - otherMercator.latin) > SPATIAL_TOLERANCE) {
|
||||
if (Math.abs(latin - otherMercator.latin) > SPATIAL_TOLERANCE_DEG) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -51,6 +51,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* 09/10/2012 DR 15270 D. Friedman Fix subgrid model name handling.
|
||||
* Jan 17, 2014 2125 rjpeter Removed invalid @Table annotation.
|
||||
* Mar 04, 2015 3959 rjpeter Update for grid based subgridding.
|
||||
* Jun 24, 2016 ASM18440 dfriedman Fix spatial tolerance for degree values.
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -268,9 +269,9 @@ public class PolarStereoGridCoverage extends GridCoverage {
|
|||
public boolean spatialEquals(GridCoverage other) {
|
||||
if (super.spatialEquals(other)) {
|
||||
PolarStereoGridCoverage otherPolar = (PolarStereoGridCoverage) other;
|
||||
if (Math.abs(lad - otherPolar.lad) > SPATIAL_TOLERANCE) {
|
||||
if (Math.abs(lad - otherPolar.lad) > SPATIAL_TOLERANCE_DEG) {
|
||||
return false;
|
||||
} else if (Math.abs(lov - otherPolar.lov) > SPATIAL_TOLERANCE) {
|
||||
} else if (Math.abs(lov - otherPolar.lov) > SPATIAL_TOLERANCE_DEG) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -46,6 +46,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 7, 2010 #4473 rjpeter Initial creation
|
||||
* Mar 04, 2015 3959 rjpeter Update for grid based subgridding.
|
||||
* Jun 24, 2016 ASM18440 dfriedman Fix spatial tolerance for degree values.
|
||||
* </pre>
|
||||
*
|
||||
* @author rjpeter
|
||||
|
@ -151,9 +152,9 @@ public class StereographicGridCoverage extends GridCoverage {
|
|||
public boolean spatialEquals(GridCoverage other) {
|
||||
if (super.spatialEquals(other)) {
|
||||
StereographicGridCoverage otherStereo = (StereographicGridCoverage) other;
|
||||
if (Math.abs(lad - otherStereo.lad) > SPATIAL_TOLERANCE) {
|
||||
if (Math.abs(lad - otherStereo.lad) > SPATIAL_TOLERANCE_DEG) {
|
||||
return false;
|
||||
} else if (Math.abs(lov - otherStereo.lov) > SPATIAL_TOLERANCE) {
|
||||
} else if (Math.abs(lov - otherStereo.lov) > SPATIAL_TOLERANCE_DEG) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -51,6 +51,7 @@ import com.raytheon.uf.edex.database.dao.DaoConfig;
|
|||
* Mar 07, 2013 1771 bsteffen fix gridcoverage duplicate checks.
|
||||
* Mar 20, 2013 2910 bsteffen Commit transaction within cluster locks.
|
||||
* May 10, 2016 5642 rjpeter Remove transaction nesting.
|
||||
* Jun 24, 2016 ASM18440 dfriedman Fix spatial tolerance for degree values.
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
|
@ -107,21 +108,22 @@ public class GetGridCoverageHandler implements
|
|||
trans = sess.beginTransaction();
|
||||
|
||||
Criteria crit = sess.createCriteria(coverage.getClass());
|
||||
double spacingUnitTolerance = coverage.getSpacingUnitTolerance();
|
||||
|
||||
crit.add(Restrictions.eq("nx", coverage.getNx()));
|
||||
crit.add(Restrictions.eq("ny", coverage.getNy()));
|
||||
crit.add(Restrictions.between("dx", coverage.getDx()
|
||||
- GridCoverage.SPATIAL_TOLERANCE, coverage.getDx()
|
||||
+ GridCoverage.SPATIAL_TOLERANCE));
|
||||
- spacingUnitTolerance, coverage.getDx()
|
||||
+ spacingUnitTolerance));
|
||||
crit.add(Restrictions.between("dy", coverage.getDy()
|
||||
- GridCoverage.SPATIAL_TOLERANCE, coverage.getDy()
|
||||
+ GridCoverage.SPATIAL_TOLERANCE));
|
||||
- spacingUnitTolerance, coverage.getDy()
|
||||
+ spacingUnitTolerance));
|
||||
crit.add(Restrictions.between("la1", coverage.getLa1()
|
||||
- GridCoverage.SPATIAL_TOLERANCE, coverage.getLa1()
|
||||
+ GridCoverage.SPATIAL_TOLERANCE));
|
||||
- GridCoverage.SPATIAL_TOLERANCE_DEG, coverage.getLa1()
|
||||
+ GridCoverage.SPATIAL_TOLERANCE_DEG));
|
||||
crit.add(Restrictions.between("lo1", coverage.getLo1()
|
||||
- GridCoverage.SPATIAL_TOLERANCE, coverage.getLo1()
|
||||
+ GridCoverage.SPATIAL_TOLERANCE));
|
||||
- GridCoverage.SPATIAL_TOLERANCE_DEG, coverage.getLo1()
|
||||
+ GridCoverage.SPATIAL_TOLERANCE_DEG));
|
||||
List<?> vals = crit.list();
|
||||
|
||||
for (Object val : vals) {
|
||||
|
@ -142,11 +144,11 @@ public class GetGridCoverageHandler implements
|
|||
crit.add(Restrictions.eq("nx", coverage.getNx()));
|
||||
crit.add(Restrictions.eq("ny", coverage.getNy()));
|
||||
crit.add(Restrictions.between("dx", coverage.getDx()
|
||||
- GridCoverage.SPATIAL_TOLERANCE, coverage.getDx()
|
||||
+ GridCoverage.SPATIAL_TOLERANCE));
|
||||
- spacingUnitTolerance, coverage.getDx()
|
||||
+ spacingUnitTolerance));
|
||||
crit.add(Restrictions.between("dy", coverage.getDy()
|
||||
- GridCoverage.SPATIAL_TOLERANCE, coverage.getDy()
|
||||
+ GridCoverage.SPATIAL_TOLERANCE));
|
||||
- spacingUnitTolerance, coverage.getDy()
|
||||
+ spacingUnitTolerance));
|
||||
vals = crit.list();
|
||||
for (Object val : vals) {
|
||||
if (((GridCoverage) val).spatialEquals(coverage)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue