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

remove allocations in ground albedo of snowy land #981

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

kmdeck
Copy link
Member

@kmdeck kmdeck commented Jan 14, 2025

Purpose

Closes part of #976

To-do

Content


  • I have read and checked the items on the review checklist.

@kmdeck kmdeck mentioned this pull request Jan 14, 2025
3 tasks
@kmdeck kmdeck requested a review from Sbozzolo January 14, 2025 18:35
@. p.scratch1 =
(1 - p.snow.snow_cover_fraction) * p.soil.PAR_albedo +
p.snow.snow_cover_fraction * ground.α_snow
return p.scratch1
Copy link
Member

Choose a reason for hiding this comment

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

I think that this is a little risky. Other lines in the functions that call this function might modify the value of p.scratch, which would affect the result of this field.

We should try keeping the scope of scratch variables visible limited and assume that something else will overwrite them at the next line

Copy link
Member Author

Choose a reason for hiding this comment

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

good call. I fixed this!

@kmdeck kmdeck requested a review from Sbozzolo January 15, 2025 16:42
@kmdeck kmdeck force-pushed the kd/ground_albedo_inplace branch from 7050876 to dbcfd05 Compare January 15, 2025 19:35
@kmdeck kmdeck merged commit f081127 into main Jan 15, 2025
16 checks passed
@kmdeck kmdeck deleted the kd/ground_albedo_inplace branch January 15, 2025 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants