-
Notifications
You must be signed in to change notification settings - Fork 321
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
Change renormalization of landunit areas in mksurfdata_map to be consistent with raw datasets #1564
Conversation
…istent with raw datasets (Issue ESCOMP#1555)
As @ekluzek pointed out at today's ctsm software meeting, we should wait to merge this until we're ready to make new surface datasets, so that mksurfdata_map stays more in sync with our out-of-the-box surface datasets. I'll still go ahead and review it. |
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.
Thanks a lot for working on this, and for documenting all of the testing you have done! I'm sorry it has taken me a couple of weeks to finish reviewing it.
I have some comments below. They are mostly pretty minor, but there is one more substantial one relating to the possible need for merging this with #1579 and #1073, because I'm now seeing that it's hard to bring this one in without some of the changes from #1579 (specifically related to the storing of the "_orig" variables).
! Make sure sum of all land cover types except natural vegetation | ||
! does not exceed 100. If it does, subtract excess from these land cover | ||
! types proportionally. | ||
|
||
do n = 1,ns_o | ||
suma = pctlak(n) + pctwet(n) + pcturb(n) + pctgla(n) + pctcft(n)%get_pct_l2g() | ||
if (suma > 250._r4) then | ||
write (6,*) subname, ' error: sum of pctlak, pctwet,', & | ||
'pcturb, pctgla, and pctcrop is greater than 250%' | ||
write (6,*)'n,pctlak,pctwet,pcturb,pctgla,pctcrop= ', & | ||
n,pctlak(n),pctwet(n),pcturb(n),pctgla(n),pctcft(n)%get_pct_l2g() | ||
call abort() | ||
else if (suma > 100._r4) then | ||
pctlak(n) = pctlak(n) * 100._r8/suma | ||
pctwet(n) = pctwet(n) * 100._r8/suma | ||
pcturb(n) = pcturb(n) * 100._r8/suma | ||
pctgla(n) = pctgla(n) * 100._r8/suma | ||
call pctcft(n)%set_pct_l2g(pctcft(n)%get_pct_l2g() * 100._r8/suma) | ||
end if | ||
end do |
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 think I understand why you added this here (because now you potentially need to redo the renormalization each year, since crop areas may have changed). However, I think that doing it right requires the addition of "_orig" variables that are used to reset non-changing landunit areas each year, as is done now by @keerzhang1 in Enable the mksurfdata_map to generate landuse_timeseries for dynamic urban and lake #1579 . I also like the solution in Enable the mksurfdata_map to generate landuse_timeseries for dynamic urban and lake #1579 of moving this code into "normalizencheck_landuse" to avoid duplication.
For this reason and maybe others, I'm starting to think that it's not going to work well to do my original suggestion of keeping this PR separate from #1579 , and instead we should do a single set of changes that combines the changes from this PR with #1579 as well as those in #1073, since there is so much overlap between these three sets of changes. @olyson and @keerzhang1 what do you think about that? Alternatively, if we want to keep the behavior change in this PR separate from the feature additions of #1579 and #1073, I think the best way to do it would be to (1) combine #1579 with #1073, then (2) apply the changes in this PR in a new PR in their own (but probably new) PR on top of (1). It comes down to how much we care about keeping feature additions separate from behavior/answer changes in mksurfdata_map; @ekluzek do you have any feeling about how important it is to keep these separate?
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.
After reviewing the changes made by @keerzhang1 last week, I was beginning to come to the same conclusion. My preferred approach would be to combine these three PRs into one PR (#1579 ), rather than in two steps. But will leave it up to you and Erik to decide. As you've noted, there is also a fourth PR forthcoming from issue #1572 , code that reads in HASURBAN and initializes landunits in memory (which will now need to be changed to PCT_URBAN_MAX I guess). I think that would come in as part of the feature additions if we separated out feature from behavior.
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.
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.
Thanks @keerzhang1 for offering to combine #1073 with #1579 , that sounds good to me. Let us know if you have any questions. I'll work on responding to the review of #1564
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.
Thanks a lot @keerzhang1 ! I'm thinking it will be easiest if you use #1579 as a starting point, since that's already in good shape, and then bring in the relevant changes from #1073 into that. Once we look that over and are happy with that merge, then @olyson can bring his changes from this PR (#1564 ) on top of that.
A few notes when integrating the changes from #1073
- There's no need to bring in the namelist changes from that PR
- For the text file that connects the perl script to the mksurfdata_map fortran code, you can use the approach you implemented for urban: using the same text file as for transient PFTs but adding an extra line for each year.
- You don't need to update the perl code to add these lake files for now, unless that will help you with your testing.
Please let us know if you have questions or run into any problems.
Closing this, since it has been superseded by #1587 |
Description of changes
This PR is based on code branched off of ctsm5.1.dev062.
Per Issue #1555 the following problems are corrected:
Specific notes
There is an existing subroutine called adjust_total_veg_area that adjusts the total vegetated area (natural veg & crop) to a new specified total, which is no longer appropriate since crops are treated symmetrically as with other landunits. Instead of modifying this subroutine, I created a new one, adjust_total_natveg_area that adjusts only the natural vegetated area to a new specified total. I haven’t removed the old subroutine for now even though it is no longer used.
There are two errors checks I’ve left in (marked with “!KO”) that may no longer be useful or necessary or correct. It may be that they need to be changed with respect to the crop landunit, but I’m not quite sure what the intended purpose of these are. I’ve left these in unmodified for now since they are simply error checks and don’t actually change any of the landcover variables. And they don’t seem to be triggered in my testing.
Contributors other than yourself, if any: Bill Sacks
CTSM Issues Fixed (include github issue #):
Resolves #1555
Are answers expected to change (and if so in what way)? Yes, surface datasets will be different
Any User Interface Changes (namelist or namelist defaults changes)? No
Testing performed, if any:
For initial testing, I’ve created a 0.9x1.25 surface dataset and landuse file from ctsm5.1.dev062 and then the same set of files from the modified mksurfdata_map. The new surface dataset has 7 variables that are different: PCT_NATVEG, PCT_CROP, PCT_NAT_PFT, PCT_CFT, PCT_LAKE, PCT_GLACIER, PCT_URBAN. The MAXimum (increase) and MINimum (decrease) of these differences are:
(0) MAX pct_natveg: 2.842170943040401e-14
(0) MIN pct_natveg: -10.67630993642207
(0) MAX pct_crop: 10.67630993642206
(0) MIN pct_crop: -1.4210854715202e-14
(0) MAX pct_lake: 1.55750967678614e-11
(0) MIN pct_lake: -0.2633625082721949
(0) MAX pct_glacier: 4.760636329592671e-13
(0) MIN pct_glacier: -7.105427357601002e-15
(0) MAX pct_urban: 6.350475700855895e-13
(0) MIN pct_urban: -0.03106996610432056
(0) MAX pct_wetland: 0
(0) MIN pct_wetland: 0
(0) MAX pct_nat_pft: 90.21452585120576
(0) MIN pct_nat_pft: -52.42969544487663
(0) MAX pct_cft: 2.81071874515417e-09
(0) MIN pct_cft: -9.416396551387152e-10
The largest differences are in PCT_NAT_PFT. The largest increase is associated with bare soil because urban is no longer replacing bare soil preferentially. Glacier has roundoff differences. Lake and Urban show a small decrease, presumably because Crop is now included in the initial normalization. The largest increase is crop is equivalent to the largest decrease in natural vegetation. I might not expect PCT_CFT to change but the largest changes are on the order of e-09 (roundoff?).
The new landuse timeseries has 6 variables that are different: PCT_CROP_MAX, PCT_NAT_PFT_MAX, PCT_CFT_MAX, PCT_CROP, PCT_NAT_PFT, PCT_CFT. The MAXimum (increase) and MINimum (decrease) of these differences are:
(0) MAX pct_crop: 16.4328269096183
(0) MIN pct_crop: -5.684341886080801e-14
(0) MAX pct_crop_max: 16.4328269096183
(0) MIN pct_crop_max: -2.842170943040401e-14
(0) MAX pct_nat_pft: 98.50930869418386
(0) MIN pct_nat_pft: -77.092800323726
(0) MAX pct_nat_pft_max: 90.6516908188529
(0) MIN pct_nat_pft_max: -77.092800323726
(0) MAX pct_cft: 0.2290990088236286
(0) MIN pct_cft: -0.2965845809809196
(0) MAX pct_cft_max: 0.172655463450238
(0) MIN pct_cft_max: -0.2965845427981293
I ran a short historical simulation with the new files successfully.
Are there any mksurdata unit tests or other tests that should be run to check functionality?