-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: testDataMgr doesn't compute grid extents correctly #2957
Conversation
minExt[i] /= 32.0; | ||
maxExt[i] /= 32.0; | ||
} | ||
for (int i = 0; i < minExt.size(); i++) maxExt[i] = minExt[i] + maxExt[i] / 32.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the goal here is to reduce the data size to 1/32 of its original, keeping the original coordinate origin, then what I believe you want is:
maxExt[i] = minExt[i] + (maxExt[i]-minExt[i]) / 32.0
Consider what would happen with the code as implemented if the extents were, for example, -1000 .. 0. (the volume size is unchanged). Or if the original extents were 1,000,000..1,000,010 (the domain grows!).
To center the reduced domain you could do something like;
center = (maxExt + minExt) / 2.0;
width = (maxExt - minExt) / 32.0
minExt = center - (width / 2.0)
maxExt = center + (width / 2.0);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, that didn't occur to me. Updated with comment that the origin must be maintained.
* Replace use of std::vector with std::array in DataMgr for compability with Grid class. WIP * WIP * Incremental * clang-format pre-push hook * Merged with main * clang-format pre-push hook * Port to centos * Fixed edge case - grids with dimesions of 1 * clang-format pre-push hook * Fix: testDataMgr doesn't compute grid extents correctly (#2957) * fix 2944 by adding offset to resampled extents * test * Only reduce maximum extents * clang format * update extents with comment * remove old code * Update dataMgrTools.cpp Co-authored-by: clyne <clyne@ucar.edu> Co-authored-by: sgpearse <pearse@ucar.edu>
Fixes #2944 by reducing the maximum extents after offsetting them by the minimum value. Removes the reduction to the minimum extents which are not needed.
I'm not sure why clang-format is modifying lines 115 through 117.
@clyne Since this fixes an issue that doesn't present itself on main, this PR is targeting your ROMS PR fix, #2943.