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

modify_fsurdat: Add dom_cft as alternative user-choice to dom_nat_pft #1615

Merged
merged 10 commits into from
Feb 28, 2022

Conversation

slevis-lmwg
Copy link
Contributor

Description of changes

This PR addresses Isla Simpson's CSSI example (2b), which requires replacement of the vegetation with crop in a rectangle of North America.

I am adding this capability to the modify_fsurdat tool.

Specific notes

Contributors other than yourself, if any:
@billsacks @ekluzek

CTSM Issues Fixed (include github issue #):
None

Are answers expected to change (and if so in what way)?
No. This is a new feature.

Any User Interface Changes (namelist or namelist defaults changes)?
modify_template.cfg now includes the line
dom_cft = UNSET
to allow users to set the cft of their choice to replace the non-crop vegetation.

Testing performed, if any:
I have modified a few fsurdat files to confirm that the code does what I want.

@slevis-lmwg slevis-lmwg added enhancement new capability or improved behavior of existing capability tag: simple bfb labels Jan 25, 2022
@slevis-lmwg slevis-lmwg requested a review from billsacks January 25, 2022 20:24
@slevis-lmwg slevis-lmwg self-assigned this Jan 25, 2022
Copy link
Collaborator

@ekluzek ekluzek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slevisconsulting this is actually something that we might want to be consistent with subset_data. In subset_data, you can pick either a crop or a nat-veg with the same --dom_pft option, by using PFT numbering. See the issue #1606 which goes over this, and if you go with that you'd need to do the same here. Here you have one way to set a Crop PFT and another for a natural-veg PFT. We likely want to have this consistent in the way we handle it. An advantage of the former is that you only need one option rather than two, and I think that's helpful.

The other thing I noticed is that there are a few magic numbers in here (15, 79, and 12 is what I saw), these should be changed to variables so the context of the meaning behind them is given.

And finally I didn't see the change added to a unit test and if you can it would be good to do that.

Thanks for putting this together. Feel free to reach out to me to go over it.

@billsacks billsacks removed their request for review January 25, 2022 21:16
@billsacks
Copy link
Member

Thank you very much for your work on this @slevisconsulting . I don't feel a need to review it.

- Removed a bunch of "magic" numbers
- Consolidated two options (dom_nat_pft and dom_cft) into one (dom_plant)
- Not in Erik's review, but I added some new logger.info lines to indicate the
progress of a run when using --verbose
@slevis-lmwg
Copy link
Contributor Author

And finally I didn't see the change added to a unit test and if you can it would be good to do that.

Thank you for your comments, @ekluzek
Next I will work on your unit test suggestion.

@slevis-lmwg
Copy link
Contributor Author

Python tests PASS
clm_pymods tests PASS

@slevis-lmwg slevis-lmwg requested a review from ekluzek February 10, 2022 18:24
@ekluzek ekluzek marked this pull request as ready for review February 22, 2022 22:44
Copy link
Collaborator

@ekluzek ekluzek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. You addressed the suggestions I had earlier.

I'd still like to meet with you to go over it a bit. It would help me to understand how the testing for this works. There is one comment I made about a magic number, but I'm not sure it's something we can really change and might be OK as it is...

tools/modify_fsurdat/modify_template.cfg Outdated Show resolved Hide resolved
@slevis-lmwg slevis-lmwg added the PR status: ready PR: this is ready to merge in, with all tests satisfactory and reviews complete label Feb 25, 2022
@slevis-lmwg
Copy link
Contributor Author

I linked the dev081 tests to dev082.

@ekluzek
Copy link
Collaborator

ekluzek commented Feb 25, 2022

@slevisconsulting OK is this ready to go from your perspective? If so I'll do a final review and approve it and then make the tag. Also are there new clm_pymod tests or are answers different for them than before? If so we should link each specific test directory, rather than the top level, and then remove the softlinks for the clm_pymod tests and then rerun them. Could you do that?

@slevis-lmwg
Copy link
Contributor Author

@slevisconsulting OK is this ready to go from your perspective? If so I'll do a final review and approve it and then make the tag. Also are there new clm_pymod tests or are answers different for them than before? If so we should link each specific test directory, rather than the top level, and then remove the softlinks for the clm_pymod tests and then rerun them. Could you do that?

I think this is ready.
No new clm_pymod tests.
Existing clm_pymod tests PASSed against baseline.
Thanks, @ekluzek !

@ekluzek
Copy link
Collaborator

ekluzek commented Feb 25, 2022 via email

@ekluzek
Copy link
Collaborator

ekluzek commented Feb 26, 2022

On @negin513 point about making the user interface more similar. I was about to make an issue, but then I looked and the difference is that this tool has it as a config file, and most of the contents of that file follow what's on the surface dataset.

I've noticed here in the namelist the user can choose either dom_nat_pft or dom_cft to modify the surface dataset. In the subset_data code which is really similar, the user can choose dom_pdf that they want to modify and the code calculates if it means changing dom_nat_pft or dom_cft based on the value of dom_pft. So for example it automatically modifies dom_cft if it is above 15.

Since subset_data is using a simpler user-interface I think it's OK that the user interfaces are different. This one more closely reflects what's on the surface dataset being modified. While subset_data is making a command line option that's easier for the user. So I'm siding with the idea that it's OK they are different now. But, I'm also happy to be convinced back the other way again. So I'm open to still having a discussion on this next week. So @negin513 what do you think should we schedule a meeting to discuss?

@slevis-lmwg
Copy link
Contributor Author

@negin513 I also couldn't see your comment here in github. As @ekluzek said, he made the same comment early in the PR. If you look at my cumulative code modifications, I did make that change. But instead of using dompft I chose dom_plant to avoid confusion between the terms pft and cft.

@negin513
Copy link
Contributor

I agree with @ekluzek. Overall I think it might be good to have our options relatively similar, but maybe we can worry about them in future.

For example. previously subset_data had the option of zero_nonveg which is also used here. However, in #1461 based on reviewers comments on the names being confusing we changed it to include_nonveg which is the opposite of zero_nonveg. But we are still using zero_nonveg here...

@negin513 I also couldn't see your comment here in github. As @ekluzek said, he made the same comment early in the PR. If you look at my cumulative code modifications, I did make that change. But instead of using dompft I chose dom_plant to avoid confusion between the terms pft and cft.

I intentionally removed my original comment, because upon further looking into the newer version of the code I've noticed you have made this change from dam_nat_pft and dom_cft to dom_plant which is great.

@slevis-lmwg
Copy link
Contributor Author

For example. previously subset_data had the option of zero_nonveg which is also used here. However, in #1461 based on reviewers comments on the names being confusing we changed it to include_nonveg which is the opposite of zero_nonveg. But we are still using zero_nonveg here...

Oh, interesting. Would you like to open an issue @negin513 to remind us that the zero_nonveg function could be replaced in this tool with the include_nonveg function to avoid duplication?

@slevis-lmwg
Copy link
Contributor Author

Unless @ekluzek you'd like me to revisit this PR with @negin513 's comments about zero_nonveg and dom_plant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bfb bit-for-bit enhancement new capability or improved behavior of existing capability PR status: ready PR: this is ready to merge in, with all tests satisfactory and reviews complete
Projects
Status: Done (non release/external)
Development

Successfully merging this pull request may close these issues.

5 participants