Issue #1260 Fix non-overlapping grids
Change-Id: I27bc2a2d4db33abb81c1733046e8eef5729a4384 Former-commit-id:bc348506c7
[formerly25ddccf57a
] [formerly fc1973e46fa09bbe462aadedbabc7fa9b7afe440 [formerlyb31e52cbd0
]] [formerlybce2713c31
[formerlyb31e52cbd0
[formerly 6b05875f6bd24d027bb5817eee9b412bb83f9b3a]]] Former-commit-id:bce2713c31
Former-commit-id: 47450e981114ed07456e058317564c040fc01547 [formerly87e518de29
] Former-commit-id:5de80732ea
This commit is contained in:
parent
5d8b3a00df
commit
9ecd0271a2
2 changed files with 61 additions and 28 deletions
|
@ -173,14 +173,15 @@ public class D2DGridDatabase extends VGridDatabase {
|
||||||
- subdomain.height;
|
- subdomain.height;
|
||||||
|
|
||||||
if (subdomain.isEmpty()) {
|
if (subdomain.isEmpty()) {
|
||||||
valid = false;
|
statusHandler.warn(this.dbId
|
||||||
throw new GfeException("Unable to create " + this.dbId
|
+ ": GFE domain does not overlap dataset domain.");
|
||||||
+ ". GFE domain does not overlap dataset domain.");
|
this.remap = null;
|
||||||
|
} else {
|
||||||
|
this.remap = new RemapGrid(NetCDFUtils.subGridGL(
|
||||||
|
dbId.toString(), this.inputLoc, subdomain),
|
||||||
|
this.outputLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.remap = new RemapGrid(NetCDFUtils.subGridGL(dbId.toString(),
|
|
||||||
this.inputLoc, subdomain), this.outputLoc);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,7 +476,14 @@ public class D2DGridDatabase extends VGridDatabase {
|
||||||
|
|
||||||
switch (gpi.getGridType()) {
|
switch (gpi.getGridType()) {
|
||||||
case SCALAR:
|
case SCALAR:
|
||||||
Grid2DFloat data = getGrid(parmId, time, gpi, convertUnit);
|
Grid2DFloat data = null;
|
||||||
|
if (this.remap == null) {
|
||||||
|
// GFE domain does not overlap D2D grid, return default grid
|
||||||
|
data = new Grid2DFloat(gpi.getGridLoc().getNx(), gpi
|
||||||
|
.getGridLoc().getNy(), gpi.getMinValue());
|
||||||
|
} else {
|
||||||
|
data = getGrid(parmId, time, gpi, convertUnit);
|
||||||
|
}
|
||||||
gs = new ScalarGridSlice(time, gpi, gdh, data);
|
gs = new ScalarGridSlice(time, gpi, gdh, data);
|
||||||
break;
|
break;
|
||||||
case VECTOR:
|
case VECTOR:
|
||||||
|
@ -483,7 +491,14 @@ public class D2DGridDatabase extends VGridDatabase {
|
||||||
.getGridLoc().getNy());
|
.getGridLoc().getNy());
|
||||||
Grid2DFloat dir = new Grid2DFloat(gpi.getGridLoc().getNx(), gpi
|
Grid2DFloat dir = new Grid2DFloat(gpi.getGridLoc().getNx(), gpi
|
||||||
.getGridLoc().getNy());
|
.getGridLoc().getNy());
|
||||||
getWindGrid(parmId, time, gpi, mag, dir);
|
|
||||||
|
if (this.remap == null) {
|
||||||
|
// GFE domain does not overlap D2D grid, return default grid
|
||||||
|
mag.setAllValues(gpi.getMinValue());
|
||||||
|
dir.setAllValues(0.0f);
|
||||||
|
} else {
|
||||||
|
getWindGrid(parmId, time, gpi, mag, dir);
|
||||||
|
}
|
||||||
gs = new VectorGridSlice(time, gpi, gdh, mag, dir);
|
gs = new VectorGridSlice(time, gpi, gdh, mag, dir);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -511,6 +526,7 @@ public class D2DGridDatabase extends VGridDatabase {
|
||||||
*/
|
*/
|
||||||
private Grid2DFloat getGrid(ParmID parmId, TimeRange time,
|
private Grid2DFloat getGrid(ParmID parmId, TimeRange time,
|
||||||
GridParmInfo gpi, boolean convertUnit) throws GfeException {
|
GridParmInfo gpi, boolean convertUnit) throws GfeException {
|
||||||
|
|
||||||
Grid2DFloat bdata = null;
|
Grid2DFloat bdata = null;
|
||||||
GribRecord d2dRecord = null;
|
GribRecord d2dRecord = null;
|
||||||
|
|
||||||
|
@ -628,6 +644,7 @@ public class D2DGridDatabase extends VGridDatabase {
|
||||||
*/
|
*/
|
||||||
private void getWindGrid(ParmID parmId, TimeRange time, GridParmInfo gpi,
|
private void getWindGrid(ParmID parmId, TimeRange time, GridParmInfo gpi,
|
||||||
Grid2DFloat mag, Grid2DFloat dir) throws GfeException {
|
Grid2DFloat mag, Grid2DFloat dir) throws GfeException {
|
||||||
|
|
||||||
GFEDao dao = null;
|
GFEDao dao = null;
|
||||||
try {
|
try {
|
||||||
dao = (GFEDao) PluginFactory.getInstance().getPluginDao("gfe");
|
dao = (GFEDao) PluginFactory.getInstance().getPluginDao("gfe");
|
||||||
|
|
|
@ -201,14 +201,14 @@ public class NetCDFGridDatabase extends VGridDatabase {
|
||||||
this.outputGloc);
|
this.outputGloc);
|
||||||
|
|
||||||
if (this.subdomain.isEmpty()) {
|
if (this.subdomain.isEmpty()) {
|
||||||
valid = false;
|
statusHandler.warn(this.dbId
|
||||||
throw new GfeException("Unable to create " + this.dbId
|
+ ": GFE domain does not overlap dataset domain.");
|
||||||
+ ". GFE domain does not overlap dataset domain.");
|
this.remap = null;
|
||||||
|
} else {
|
||||||
|
this.remap = new RemapGrid(NetCDFUtils.subGridGL(
|
||||||
|
this.dbId.toString(), this.inputGloc, this.subdomain),
|
||||||
|
this.outputGloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.remap = new RemapGrid(NetCDFUtils.subGridGL(
|
|
||||||
this.dbId.toString(), this.inputGloc, this.subdomain),
|
|
||||||
this.outputGloc);
|
|
||||||
loadParms();
|
loadParms();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -584,35 +584,51 @@ public class NetCDFGridDatabase extends VGridDatabase {
|
||||||
GridDataHistory gdh = new GridDataHistory(OriginType.INITIALIZED,
|
GridDataHistory gdh = new GridDataHistory(OriginType.INITIALIZED,
|
||||||
p.getPid(), p.getInv().get(index));
|
p.getPid(), p.getInv().get(index));
|
||||||
|
|
||||||
switch (p.getGpi().getGridType()) {
|
GridParmInfo gpi = p.getGpi();
|
||||||
|
GridLocation gloc = gpi.getGridLoc();
|
||||||
|
|
||||||
|
switch (gpi.getGridType()) {
|
||||||
case SCALAR: {
|
case SCALAR: {
|
||||||
Grid2DFloat data = new Grid2DFloat(getGrid(p.getVarName(),
|
Grid2DFloat data = null;
|
||||||
p.getIndices()[index], p.getLevel(), p.getGpi()
|
if (this.remap == null) {
|
||||||
.getMinValue(), p.getGpi().getMaxValue()));
|
// GFE domain does not overlap D2D grid, return default grid
|
||||||
|
data = new Grid2DFloat(gloc.getNx(), gloc.getNy(),
|
||||||
|
gpi.getMinValue());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
data = new Grid2DFloat(getGrid(p.getVarName(),
|
||||||
|
p.getIndices()[index], p.getLevel(), gpi.getMinValue(),
|
||||||
|
gpi.getMaxValue()));
|
||||||
|
}
|
||||||
if (!data.isValid()) {
|
if (!data.isValid()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
gs = new ScalarGridSlice(p.getInv().get(index), p.getGpi(),
|
gs = new ScalarGridSlice(p.getInv().get(index), gpi,
|
||||||
Arrays.asList(gdh), data);
|
Arrays.asList(gdh), data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case VECTOR: {
|
case VECTOR: {
|
||||||
Grid2DFloat mag = new Grid2DFloat(p.getGpi().getGridLoc().getNx(),
|
Grid2DFloat mag = new Grid2DFloat(gloc.getNx(), gloc.getNy());
|
||||||
p.getGpi().getGridLoc().getNy());
|
Grid2DFloat dir = new Grid2DFloat(gloc.getNx(), gloc.getNy());
|
||||||
Grid2DFloat dir = new Grid2DFloat(p.getGpi().getGridLoc().getNx(),
|
|
||||||
p.getGpi().getGridLoc().getNy());
|
if (this.remap == null) {
|
||||||
getWindGrid(p.getIndices()[index], p.getLevel(), p.getGpi()
|
// GFE domain does not overlap D2D grid, return default grid
|
||||||
.getMinValue(), p.getGpi().getMaxValue(), mag, dir);
|
mag.setAllValues(gpi.getMinValue());
|
||||||
|
dir.setAllValues(0.0f);
|
||||||
|
} else {
|
||||||
|
getWindGrid(p.getIndices()[index], p.getLevel(),
|
||||||
|
gpi.getMinValue(), gpi.getMaxValue(), mag, dir);
|
||||||
|
}
|
||||||
if (!mag.isValid() || !dir.isValid()) {
|
if (!mag.isValid() || !dir.isValid()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
gs = new VectorGridSlice(p.getInv().get(index), p.getGpi(),
|
gs = new VectorGridSlice(p.getInv().get(index), gpi,
|
||||||
Arrays.asList(gdh), mag, dir);
|
Arrays.asList(gdh), mag, dir);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
"unsupported parm type for: " + p.getGpi());
|
"unsupported parm type for: " + gpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
return gs;
|
return gs;
|
||||||
|
|
Loading…
Add table
Reference in a new issue