Merge "Issue #1260 Fix non-overlapping grids" into development
Former-commit-id:3331977842
[formerly80e78b722f
] [formerly3331977842
[formerly80e78b722f
] [formerly4803fd42bb
[formerly 182a6039347848d11a5ced10e50fea40269ed95b]]] Former-commit-id:4803fd42bb
Former-commit-id:7a3a3328d7
[formerlya5874c822d
] Former-commit-id:33675ad271
This commit is contained in:
commit
8fecba812a
2 changed files with 61 additions and 28 deletions
|
@ -173,14 +173,15 @@ public class D2DGridDatabase extends VGridDatabase {
|
|||
- subdomain.height;
|
||||
|
||||
if (subdomain.isEmpty()) {
|
||||
valid = false;
|
||||
throw new GfeException("Unable to create " + this.dbId
|
||||
+ ". GFE domain does not overlap dataset domain.");
|
||||
statusHandler.warn(this.dbId
|
||||
+ ": 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()) {
|
||||
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);
|
||||
break;
|
||||
case VECTOR:
|
||||
|
@ -483,7 +491,14 @@ public class D2DGridDatabase extends VGridDatabase {
|
|||
.getGridLoc().getNy());
|
||||
Grid2DFloat dir = new Grid2DFloat(gpi.getGridLoc().getNx(), gpi
|
||||
.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);
|
||||
break;
|
||||
default:
|
||||
|
@ -511,6 +526,7 @@ public class D2DGridDatabase extends VGridDatabase {
|
|||
*/
|
||||
private Grid2DFloat getGrid(ParmID parmId, TimeRange time,
|
||||
GridParmInfo gpi, boolean convertUnit) throws GfeException {
|
||||
|
||||
Grid2DFloat bdata = null;
|
||||
GribRecord d2dRecord = null;
|
||||
|
||||
|
@ -628,6 +644,7 @@ public class D2DGridDatabase extends VGridDatabase {
|
|||
*/
|
||||
private void getWindGrid(ParmID parmId, TimeRange time, GridParmInfo gpi,
|
||||
Grid2DFloat mag, Grid2DFloat dir) throws GfeException {
|
||||
|
||||
GFEDao dao = null;
|
||||
try {
|
||||
dao = (GFEDao) PluginFactory.getInstance().getPluginDao("gfe");
|
||||
|
|
|
@ -201,14 +201,14 @@ public class NetCDFGridDatabase extends VGridDatabase {
|
|||
this.outputGloc);
|
||||
|
||||
if (this.subdomain.isEmpty()) {
|
||||
valid = false;
|
||||
throw new GfeException("Unable to create " + this.dbId
|
||||
+ ". GFE domain does not overlap dataset domain.");
|
||||
statusHandler.warn(this.dbId
|
||||
+ ": 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();
|
||||
}
|
||||
}
|
||||
|
@ -584,35 +584,51 @@ public class NetCDFGridDatabase extends VGridDatabase {
|
|||
GridDataHistory gdh = new GridDataHistory(OriginType.INITIALIZED,
|
||||
p.getPid(), p.getInv().get(index));
|
||||
|
||||
switch (p.getGpi().getGridType()) {
|
||||
GridParmInfo gpi = p.getGpi();
|
||||
GridLocation gloc = gpi.getGridLoc();
|
||||
|
||||
switch (gpi.getGridType()) {
|
||||
case SCALAR: {
|
||||
Grid2DFloat data = new Grid2DFloat(getGrid(p.getVarName(),
|
||||
p.getIndices()[index], p.getLevel(), p.getGpi()
|
||||
.getMinValue(), p.getGpi().getMaxValue()));
|
||||
Grid2DFloat data = null;
|
||||
if (this.remap == null) {
|
||||
// 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()) {
|
||||
return null;
|
||||
}
|
||||
gs = new ScalarGridSlice(p.getInv().get(index), p.getGpi(),
|
||||
gs = new ScalarGridSlice(p.getInv().get(index), gpi,
|
||||
Arrays.asList(gdh), data);
|
||||
break;
|
||||
}
|
||||
case VECTOR: {
|
||||
Grid2DFloat mag = new Grid2DFloat(p.getGpi().getGridLoc().getNx(),
|
||||
p.getGpi().getGridLoc().getNy());
|
||||
Grid2DFloat dir = new Grid2DFloat(p.getGpi().getGridLoc().getNx(),
|
||||
p.getGpi().getGridLoc().getNy());
|
||||
getWindGrid(p.getIndices()[index], p.getLevel(), p.getGpi()
|
||||
.getMinValue(), p.getGpi().getMaxValue(), mag, dir);
|
||||
Grid2DFloat mag = new Grid2DFloat(gloc.getNx(), gloc.getNy());
|
||||
Grid2DFloat dir = new Grid2DFloat(gloc.getNx(), gloc.getNy());
|
||||
|
||||
if (this.remap == null) {
|
||||
// GFE domain does not overlap D2D grid, return default grid
|
||||
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()) {
|
||||
return null;
|
||||
}
|
||||
gs = new VectorGridSlice(p.getInv().get(index), p.getGpi(),
|
||||
gs = new VectorGridSlice(p.getInv().get(index), gpi,
|
||||
Arrays.asList(gdh), mag, dir);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"unsupported parm type for: " + p.getGpi());
|
||||
"unsupported parm type for: " + gpi);
|
||||
}
|
||||
|
||||
return gs;
|
||||
|
|
Loading…
Add table
Reference in a new issue