Skip to content

Commit 20b3ca4

Browse files
authored
Merge pull request #583 from xylar/fix-mesh-density-in-converter
Add `meshDensity` in mesh conversion if not already present
2 parents 2a46cbe + a9d730f commit 20b3ca4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

mesh_tools/mesh_conversion_tools_netcdf_c/mpas_mesh_converter.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,14 @@ int readGridInput(const string inputFilename){/*{{{*/
476476

477477
meshDensity.clear();
478478
meshDensity.resize(cells.size());
479-
ncutil::get_var(inputFilename, "meshDensity", &meshDensity[0]);
479+
try {
480+
ncutil::get_var(inputFilename, "meshDensity", &meshDensity[0]);
481+
} catch (...) {
482+
// should be all ones by default
483+
for(int i = 0; i < nCells; i++){
484+
meshDensity[i] = 1.0;
485+
}
486+
}
480487

481488
xCellDistance = fabs(xCellRange[1] - xCellRange[0]);
482489
yCellDistance = fabs(yCellRange[1] - yCellRange[0]);

0 commit comments

Comments
 (0)