-
Notifications
You must be signed in to change notification settings - Fork 408
Fixes indexing issue in SurfaceAreaWeighted AM #173
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -350,9 +350,10 @@ subroutine ocn_compute_surface_area_weighted_averages(domain, timeLevel, err)!{{ | |
| ! copy data into work array | ||
| ! Note: Order of indices must match the ordering of vars in var_arrays in Registry_surface_area_weighted_averages.xml | ||
| ! (and all var_arrays in Registry_surface_area_weighted_averages.xml must have same ordering!) | ||
|
|
||
| !initialize workArray to zeros | ||
| workArray(:,:) = 0.0_RKIND | ||
| n = 1 | ||
| workArray(n,:) = 0.0_RKIND | ||
| n = n + 1 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are removing an index advancement here. Were all the variables off by an index of one before?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, everything is off by one index. Currently, we only use SST in MPAS analysis so that's the only one we noticed.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. I've answered my own question. This is the original in 0b984bd and the bug was introduced in 4b64b2d. So this PR just restores the indexing back to the original. |
||
| workArray(n,:) = workMask(:) | ||
| n = n + 1 | ||
| workArray(n,:) = areaCell(:) | ||
|
|
||
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.
good catch @vanroekel. But didn't the
n=1on the previous line help initializeworkArray(n,:)correctly?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.
it only initialized the 1st index, previously all indices were initialized to zero. I've reverted now to using
which should initialize the whole array to zero and not just workArray(1,:)
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.
I see. I don't even remember when this analysis member was changed. Anyways, thanks for finding this.