-
Notifications
You must be signed in to change notification settings - Fork 358
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
Bug in finding layers with given depths in MPAS-Ocean high-frequency output #6496
Comments
I am making this bug report mostly because this error is now also potentially propagating to other code (see, E3SM-Ocean-Discussion#94 (comment)). |
@mark-petersen and @vanroekel, if you agree that this is a bug, I'm happy to submit a fix. |
@xylar thanks for pinging me on this. I agree. this is a bug. It should be |
I think the code should have simply been: ! for now, just get close enough
do iLevel=1,nVertLevels
if(refBottomDepth(iLevel) > 100.0_RKIND) then
iLevelTarget = iLevel
exit
endif
enddo possibly with some handling of the possibility that |
If we want the closest layer, we should be looking at |
great point @xylar -- I'm happy with your fix you propose just above. |
I believe there is a bug, introduced 9 years ago in this commit:
3c77a2e#diff-904437d562948f083fb74894026c6c469cba2ff0e057a29cc1b33e80534736d9
and propagated many places from there within the high-frequency analysis member:
As far as I can tell, the level containing a depth of 100 m has index
iLevel
notiLevel - 1
.As an example, here are the values of
refBottomDepth
for the 80-layer grid:If you just count the entries, you will see that a depth of 100 m would be the 20th index. This is the layer where
refBottomDepth = 102.752599076403
. But if you follow the logic of the original code, copied many times, you incorrectly subtract one and get the 19th entry, which is one layer to shallow withrefBottomDepth = 92.3661273493374
. This is not the layer that contains a depth of 100 m.The text was updated successfully, but these errors were encountered: