Skip to content

Commit

Permalink
#2968 Compare the DataPlane size and the variable data size
Browse files Browse the repository at this point in the history
  • Loading branch information
Howard Soh committed Sep 9, 2024
1 parent 5d96163 commit 0ce79d4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/libcode/vx_data2d_nc_cf/nc_cf_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,18 @@ bool NcCfFile::getData(NcVar * v, const LongArray & a, DataPlane & plane) const
const int nx = grid.nx();
const int ny = grid.ny();

int data_size = 1;
for (int k=0; k<dim_count; k++) {
if (a[k] == vx_data2d_star) data_size *= v->getDim(k).getSize();
}
if (data_size == 1) data_size = v->getDim(x_slot).getSize() * v->getDim(y_slot).getSize();
if (!is_eq(data_size, nx*ny)) {
mlog << Error << "\n" << method_name
<< "Allocated DataPlane from Grid (" << nx*ny << ") does not match with the variable size ("
<< data_size << "). Please check set_attr_grid settings if applied.\n\n";
exit(1);
}

plane.clear();
plane.set_size(nx, ny);

Expand Down

0 comments on commit 0ce79d4

Please sign in to comment.