Skip to content

Commit

Permalink
Fixed #2285 (#2286)
Browse files Browse the repository at this point in the history
  • Loading branch information
clyne authored Apr 21, 2020
1 parent 00ac696 commit da1cb4d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 32 deletions.
62 changes: 32 additions & 30 deletions lib/vdc/DC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,43 +484,45 @@ bool DC::_getDataVarDimensions(
if (! status) return(false);

string mname = var.GetMeshName();
if (mname.empty()) return(true); // 0-d variable

Mesh mesh;
status = GetMesh(mname, mesh);
if (! status) return(false);

vector <string> dimnames;
if (mesh.GetMeshType() == Mesh::STRUCTURED) {
dimnames = mesh.GetDimNames();
}
else {
switch (var.GetSamplingLocation()) {
case Mesh::NODE:
dimnames.push_back(mesh.GetNodeDimName());
break;
case Mesh::EDGE:
dimnames.push_back(mesh.GetEdgeDimName());
break;
case Mesh::FACE:
dimnames.push_back(mesh.GetFaceDimName());
break;
case Mesh::VOLUME:
VAssert(0 && "VOLUME cells not supported");
break;
if (! mname.empty()) {; // 0-d variable
Mesh mesh;
status = GetMesh(mname, mesh);
if (! status) return(false);

vector <string> dimnames;
if (mesh.GetMeshType() == Mesh::STRUCTURED) {
dimnames = mesh.GetDimNames();
}
if (mesh.GetMeshType() == Mesh::UNSTRUC_LAYERED) {
dimnames.push_back(mesh.GetLayersDimName());
else {
switch (var.GetSamplingLocation()) {
case Mesh::NODE:
dimnames.push_back(mesh.GetNodeDimName());
break;
case Mesh::EDGE:
dimnames.push_back(mesh.GetEdgeDimName());
break;
case Mesh::FACE:
dimnames.push_back(mesh.GetFaceDimName());
break;
case Mesh::VOLUME:
VAssert(0 && "VOLUME cells not supported");
break;
}
if (mesh.GetMeshType() == Mesh::UNSTRUC_LAYERED) {
dimnames.push_back(mesh.GetLayersDimName());
}
}
}

for (int i=0; i<dimnames.size(); i++) {
Dimension dim;
for (int i=0; i<dimnames.size(); i++) {
Dimension dim;

status = GetDimension(dimnames[i], dim);
if (! status) return(false);
status = GetDimension(dimnames[i], dim);
if (! status) return(false);

dimensions.push_back(dim);
dimensions.push_back(dim);
}
}

// we're done if time dim isn't wanted
Expand Down
4 changes: 2 additions & 2 deletions lib/vdc/DCCF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,11 @@ int DCCF::_InitHorizontalCoordinates(
) {

//
// Get names of data variables in the CF data set that have 2 or 3
// Get names of data variables in the CF data set that have 1 to 3
// spatial dimensions
//
vector <string> dvars;
for (int i=2; i<4; i++) {
for (int i=1; i<4; i++) {
vector <string> v = ncdfc->GetDataVariableNames(i,true);
dvars.insert(dvars.end(), v.begin(), v.end());
}
Expand Down

0 comments on commit da1cb4d

Please sign in to comment.