Skip to content
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

mksurfdata_map rounding/truncation of special landunits should happen before wetland filling #1118

Closed
billsacks opened this issue Aug 21, 2020 · 0 comments · Fixed by #1119
Closed
Labels
bug something is working incorrectly priority: high High priority to fix/merge soon, e.g., because it is a problem in important configurations

Comments

@billsacks
Copy link
Member

Brief summary of bug

I think the current ordering of the rounding/truncation of special landunits in mksurfdata_map relative to the wetland filling could cause issues in some edge cases. These should be reversed. I haven't actually observed any problems; this comes just from looking at the code.

General bug information

CTSM version you are using: master

Does this bug cause significantly incorrect results in the model's science? No

Configurations affected: Probably unusual conditions in mksurfdata_map

Details of bug

I think this may be important to avoid errors and/or wrong behavior in some edge cases where we have < 0.5% cover of glacier and/or lake. I think the best thing to do would be to move the whole block of truncation code to above the wetland adjustment. i.e., move this block:

! Truncate all percentage fields on output grid. This is needed to
! insure that wt is zero (not a very small number such as
! 1e-16) where it really should be zero
do k = 1,nlevsoi
pctsand(n,k) = float(nint(pctsand(n,k)))
pctclay(n,k) = float(nint(pctclay(n,k)))
end do
pctlak(n) = float(nint(pctlak(n)))
pctwet(n) = float(nint(pctwet(n)))
pctgla(n) = float(nint(pctgla(n)))

to above this block:

! Assume wetland, glacier and/or lake when dataset landmask implies ocean
! (assume medium soil color (15) and loamy texture).
! Also set pftdata_mask here
if (pctlnd_pft(n) < 1.e-6_r8) then
pftdata_mask(n) = 0
soicol(n) = 15
if (pctgla(n) < 1.e-6_r8) then
pctwet(n) = 100._r8 - pctlak(n)
pctgla(n) = 0._r8
else
pctwet(n) = max(100._r8 - pctgla(n) - pctlak(n), 0.0_r8)
end if
pcturb(n) = 0._r8
call pctnatpft(n)%set_pct_l2g(0._r8)
call pctcft(n)%set_pct_l2g(0._r8)
pctsand(n,:) = 43._r8
pctclay(n,:) = 18._r8
organic(n,:) = 0._r8
else
pftdata_mask(n) = 1
end if

In addition to the edge case where pctlak or pctgla is < 0.5%, this could also be relevant in a case like this: pctlak = 5.4%, pctgla = 94.4%. With the current code, we'd first get pctwet = 0.2%. But then, after the rounding, we'd end up with pctlak = 5%, pctgla = 94%, pctwet = 0%. Then later, in normalizencheck_landuse, I think we'd end up with 1% natural veg, which could trigger the 'vegetation found outside the pft mask' abort. (Caveat: I may be missing something here, since there are so many corrections done at different points. It's also possible that there are other problems with doing the rounding first, but I'm not seeing any off-hand.)

(This split off from #1001 )

@billsacks billsacks added bug something is working incorrectly priority: high High priority to fix/merge soon, e.g., because it is a problem in important configurations labels Aug 21, 2020
billsacks added a commit that referenced this issue Aug 29, 2020
I think this may be important to avoid errors and/or wrong behavior in
some edge cases where we have < 0.5% cover of glacier and/or lake, and
other cases.

See #1118 for detailed thoughts

Resolves #1118
ekluzek added a commit to ekluzek/CTSM that referenced this issue Sep 6, 2020
Small changes to mksurfdata_map, singlept tool and run_sys_tests

(1) Move mksurfdata_map rounding of special landunits to before wetland
    fill: I think this may be important to avoid errors and/or wrong
    behavior in some edge cases where we have < 0.5% cover of glacier
    and/or lake, and other cases. See
    ESCOMP#1118 for detailed
    thoughts. May change answers in rare cases, but no answer changes
    observed for present-day surface datasets at standard resolutions
    (f09, f19, f10, f45).

(2) run_sys_tests: record command-line arguments in SRCROOT_GIT_STATUS
    file

(3) (From Will Wieder) Updates to current surfdata & landuse files in
    tools/contrib/singlept
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something is working incorrectly priority: high High priority to fix/merge soon, e.g., because it is a problem in important configurations
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant