-
Notifications
You must be signed in to change notification settings - Fork 318
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
Enable the mksurfdata_map to generate landuse_timeseries for dynamic urban and lake #1579
Enable the mksurfdata_map to generate landuse_timeseries for dynamic urban and lake #1579
Conversation
In normalizencheck_landuse, still reduce crop and natveg proportionally when urban exist.
changed a txt file name
Add PCT_NATVEG for testing purpose
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.
This basically looks great! Thanks a lot for your work on it @keerzhang1 @olyson @fang-bowen and @Face2sea !
I have a few comments below. I'm curious what you think about my suggestion to write PCT_URB_MAX instead of HASURBAN. The comment on the perl code is probably something we'll do on our end.
The biggest thing I see at this point is figuring out a plan to merge this with #1564 and #1073 . (Now I'm sorry that I suggested two different PRs for this and #1564 because I see this isn't as clean as I was hoping.) I'll follow up on this by email.
call ncd_def_spatial_var(ncid=ncid, varname='HASURBAN', xtype=nf_int, & | ||
lev1name='numurbl', & | ||
long_name='whether the grid ever has urban during the considered time period', units='unitless') |
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'm starting to think it would be better to use
PCT_URBAN_MAX
instead ofHASURBAN
. See Improve mechanism for determining where to allocate memory for urban when running with dynamic urban #1572 (comment) for details.
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.
Done. I've deleted HASURBAN and used PCT_URBAN_MAX instead.
! Save special land unit areas of surface dataset | ||
pctlak_orig(:) = pctlak(:) | ||
pctwet_orig(:) = pctwet(:) | ||
pcturb_orig(:) = pcturb(:) |
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 looks like pcturb_orig can be removed, since it isn't referenced anywhere. (And once this is merged with Dynamical lakes and new lake cover map #1073 pctlak_orig can also be removed.)
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! Done.
tools/mksurfdata_map/mksurfdata.pl
Outdated
my $urbanyr = "/glade/scratch/keerzhang/archive/BNU_NoAdjust/05deg_".$yr."_new_NoAdjust.nc"; | ||
chomp( $urbanyr); | ||
printf $fh_landuse_timeseries $dynpft_format, $urbanyr, $yr; # I hard coded this part just to generate a txt file with urban raw data file locations | ||
if ( $yr % 100 == 0 ) { # And note that I made no change to the "landuse_timeseries_override_$desc.txt" because I am not sure how to deal with the the 'pft_override' option |
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.
- [deferring] We'll need a final solution here (@ekluzek )
|
||
do n = 1, ns_o | ||
do k =1, numurbl | ||
if (pcturb_max(n,k) > 1.e-3_r8) then |
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 it could be problematic to have a hard-coded threshold of 1e-3 here: I feel like this should just check for
pcturb_max > 0
. (There would be a problem if hasurban is set to 0 but pcturb is large enough to trigger the attempted creation of an urban landunit. Maybe the solution is to do a truncation to 0 of too-small urban (e.g., less than 1e-3) at some point prior to this, and then this check here can just check for > 0?) However, this may be irrelevant if you go with my suggestion elsewhere of getting rid of HASURBAN and just writing PCT_URBAN_MAX to the landuse timeseries file – in which case this whole block of code would be removed.
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.
Yes, this block of code is deleted since we now use PCT_URBAN_MAX.
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.
This looks great now. Thanks a lot for the recent changes.
I think the next step will be combining the changes from #1073 with this PR. My feeling is that the best way to do that would be to bring the #1073 changes into this branch (so incorporating them into this PR), but I'm open to other workflows if you feel something else would be easier.
OK, Thanks! I incorporated the changes from #1073 into this PR #1579. At this point, the PCT_URBAN_MAX and PCT_LAKE_MAX were saved in the landuse.timeseries file. Please let me know if anything needs to be changed. |
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.
This looks great! Thanks a lot for doing it, @keerzhang1 - and for doing it so quickly!
I just noticed one minor copy-and-paste error - see my inline comment.
I'm going to add a few more comments and todo notes to this PR about next steps, but they are mainly notes for ourselves (@olyson @ekluzek and me). Thanks again for your great work on this!
|
||
call ncd_def_spatial_var(ncid=ncid, varname='PCT_LAKE_MAX', xtype=xtype, & | ||
long_name='maximum percent lake for each density type', units='unitless') |
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.
- Minor copy and paste error:
long_name='maximum percent lake for each density type', units='unitless') | |
long_name='maximum percent lake', units='unitless') |
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.
OK, I've corrected it.
|
@keerzhang1 @olyson @ekluzek - as we (Erik, Keith, Negin and I) discussed, I have changed the base branch for this PR to the new ctsm5.2.mksurfdata branch, which will integrate a number of changes needed for mksurfdata_map for CTSM5.2. I noticed that there are some changes to the mksurfdata_map code on that ctsm5.2.mksurfdata branch (from changes made to CTSM master over the last few months) beyond what was used as the base for this PR. I don't think there are any conflicts yet, but @olyson I think it would be a good idea to merge the latest ctsm5.2.mksurfdata into this before making any further changes. |
Hmm, ok @billsacks . git clone https://github.com/ESCOMP/CTSM.git ./ctsm_dynurb_mksurf The "origin" in front of ctsm5.2.mksurfdata seems to be necessary but I don't understand why. |
Sorry for the delayed reply. Yes, that looks right. You need the "origin" in front of "ctsm5.2.mksurfdata" because it's a branch on the ESCOMP remote. Maybe you're thinking that it's a tag, and/or are used to merging tags in. If you want to merge a remote branch in, and don't have a local copy of the branch already checked out, then you need to give the remote name like this. |
Thanks for the explanation. The merge seems to have gone well, no conflicts, however, I don't seem to have push permission for this branch. @keerzhang1 or @billsacks , can you give me permission? |
@olyson @ekluzek this is in good shape now in terms of the merge with #1073. I can see three possible paths forward at this point, and I'm wondering if you have feelings on which would be best. Maybe we resolved this in our discussions yesterday, but if we did, I can't remember what we decided:
My gut feeling is that (1) or (3) is best, with (3) feeling more "right" but (1) being simpler. @ekluzek and @olyson do you have preferences? |
I don't think I can do this; @keerzhang1 will have to. Or this would be resolved if we go with option (3) in my last comment, which would involve moving this branch to ESCOMP for now. |
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'm marking this as approved, even though we will still need to clean up the perl. (I'm assuming that @ekluzek will do that at some point because he's most familiar with that code, and so my review work on this PR is done now, which is why I'm marking it as approved from my point of view.)
I think option 2 is out because right now the urban landuse data only starts in year 2000, so if the tools testing tests the generation of transient datasets (1850-2014), I think it will fail based on that alone. |
Thanks, good point.
I should have clarified that, if we go with option (3), then we would wait to merge this current PR (or its new equivalent using a branch on ESCOMP) until everything is in place for the tools testing to pass. So (3) would involve:
Yes, it checks for answer changes in the generated surface datasets
I'd be happy to help with the git / GitHub details if we go with this option. |
I just added @olyson as a collaborator. Do you have the push permission now? |
Thanks for the invitation @keerzhang1, I now have push access. I'll hold off until we decide which option to go with. |
@olyson @keerzhang1 @ekluzek - I'm going to do a slight modification of the plan for (3) that I laid out above, to better communicate the status of this PR: As far as I'm concerned @keerzhang1 's work on this PR is complete (thank you!). I want to give Keer the satisfaction of having a merged PR while also indicating that this branch is moving on to phase 2, which just involves some work on our end (primarily in the perl code), and also moving the branch into ESCOMP (both to facilitate @ekluzek continuing to work on it, and to allow @olyson to open a PR into it). To accomplish this, I have started a new branch in the ESCOMP repository named dynurb_mksurf_part2 which is for now identical to the ctsm5.2.mksurfdata branch. I have changed the base branch for this PR to be dynurb_mksurf_part2. Now I will merge this PR. The end result will be the same as if I moved the dynurb_mksurf branch into ESCOMP (renaming it to add "_part2"), but this approach will show this PR as merged rather than just closed, which I think better indicates the status given that @keerzhang1 has seen this through to completion of everything we have asked. Thank you again @keerzhang1 ! |
Description of changes
This update includes code changes that enable the mksurfdata_map to generate landuse_timeseries with transient urban variables (PCT_URBAN and HASURBAN).
Update (2021-12-21): The changes in #1073 was combined with this PR. Now the code changes enable the mksurfdata_map to generate landuse_timeseries with dynamic urban and lake variables (PCT_URBAN, PCT_LAKE, PCT_URBAN_MAX, and PCT_LAKE_MAX)
Specific notes
For now, the changes in the mksurfdata.pl are hardcoded to simply generate a landuse_timeseries*. txt file containing urban raw data locations that I specified.
Contributors other than yourself, if any: @olyson @fang-bowen @Face2sea
CTSM Issues Fixed (include github issue #): #1445
Are answers expected to change (and if so in what way)?
The surface datasets will be different.
Any User Interface Changes (namelist or namelist defaults changes)?
No.
Testing performed, if any:
(List what testing you did to show your changes worked as expected)
(This can be manual testing or running of the different test suites)
(Documentation on system testing is here: https://github.com/ESCOMP/ctsm/wiki/System-Testing-Guide)
(aux_clm on cheyenne for intel/gnu and izumi for intel/gnu/nag/pgi is the standard for tags on master)
NOTE: Be sure to check your coding style against the standard
(https://github.com/ESCOMP/ctsm/wiki/CTSM-coding-guidelines) and review
the list of common problems to watch out for
(https://github.com/ESCOMP/CTSM/wiki/List-of-common-problems).