Merge "Omaha #5414 - Fix subgrids along boundary." into omaha_16.2.1

Former-commit-id: edd56b84955310a0fe7fc61b4d58bba764d8e44e
This commit is contained in:
Richard Peter 2016-03-02 09:10:34 -06:00 committed by Gerrit Code Review
commit e90384109e
2 changed files with 13 additions and 4 deletions

View file

@ -82,6 +82,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jul 21, 2014 3373 bclement JAXB managers only live during initializeGrids()
* Mar 04, 2015 3959 rjpeter Update for grid based subgridding.
* Sep 28, 2015 4868 rjpeter Allow subgrids to be defined per coverage.
* Feb 26, 2016 5414 rjpeter Fix subgrids along boundary.
* </pre>
*
* @author bphillip
@ -348,7 +349,14 @@ public class GribSpatialCache {
*/
SubGrid subGrid = new SubGrid(leftX, upperY, nx, ny);
GridCoverage subGridCoverage = referenceCoverage.trim(subGrid);
if (((subGrid.getNX() * subGrid.getNY()) / (nx * ny)) < MIN_SUBGRID_COVERAGE) {
double coveragePercent = ((double) subGrid.getNX() * subGrid
.getNY()) / (nx * ny);
if (coveragePercent < MIN_SUBGRID_COVERAGE) {
statusHandler
.warn(String
.format("Rejecting data from model [%s]. SubGrid only covers %.2f%%, minimum coverage is %.2f%%",
modelName, coveragePercent * 100,
MIN_SUBGRID_COVERAGE * 100));
/* minimum subGrid coverage not available, set nx/ny to 0 */
subGrid.setNX(0);
subGrid.setNY(0);
@ -499,7 +507,7 @@ public class GribSpatialCache {
/**
* scan the grib grid definition for changes, when force is false this will
* only scan if we have not scanne din the last 60 seconds.
* only scan if we have not scanned in the last 60 seconds.
*
* @param force
* @return

View file

@ -87,6 +87,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Sep 16, 2015 4696 nabowle Implement cloneable and add clone().
* Oct 01, 2015 4868 rjpeter Reject subGrids that don't meet minimum
* coverage percent.
* Feb 26, 2016 5414 rjpeter Fix subgrids along boundary.
* </pre>
*
* @author bphillip
@ -322,7 +323,7 @@ public abstract class GridCoverage extends PersistableDataObject<Integer>
} else {
/* Check western boundary */
if (sgUlx < 0) {
sgNx -= sgUlx;
sgNx += sgUlx;
sgUlx = 0;
}
@ -336,7 +337,7 @@ public abstract class GridCoverage extends PersistableDataObject<Integer>
/* Check northern boundary */
if (sgUly < 0) {
sgNy -= sgUly;
sgNy += sgUly;
sgUly = 0;
}