Skip to content

Set default snow parameters to calibrated values #1137

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AlexisRenchon
Copy link
Member

This commit sets alpha_0, Delta_alpha, k, beta,
and x0 to calibrated values in src/standalone/Snow/Snow.jl and experiments/long_runs/snowy_land.jl.

This commit sets alpha_0, Delta_alpha, k, beta,
and x0 to calibrated values in src/standalone/Snow/Snow.jl
and experiments/long_runs/snowy_land.jl.
@AlexisRenchon AlexisRenchon requested a review from kmdeck May 5, 2025 16:39
Copy link

coderabbitai bot commented May 5, 2025

Walkthrough

This change updates the snow albedo parameterization in both the experiment setup and the core snow model code. In the experiment script, the parameters for the Snow.ZenithAngleAlbedoModel are replaced with newly calibrated values, affecting both the positional and keyword arguments for the model. In the main snow model source, the default albedo model in the SnowParameters constructor is changed from a constant value to the zenith-angle-dependent model with the same new calibrated parameters. Additionally, the default values for the β and x0 parameters in the ZenithAngleAlbedoModel constructor are updated to the calibrated values. No other logic or exported APIs are altered.

Possibly related PRs

Suggested labels

Run long runs


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91d2105 and c1d6480.

📒 Files selected for processing (2)
  • experiments/long_runs/snowy_land.jl (2 hunks)
  • src/standalone/Snow/Snow.jl (6 hunks)
🧰 Additional context used
🧠 Learnings (1)
src/standalone/Snow/Snow.jl (1)
Learnt from: kmdeck
PR: CliMA/ClimaLand.jl#1107
File: src/standalone/Snow/Snow.jl:109-116
Timestamp: 2025-04-17T15:19:46.548Z
Learning: The snow albedo model in ClimaLand.jl uses a density-dependent prefactor f(x) = min(1 - β(x-x0), 1) where x = ρ_snow/ρ_liq. This formula is correctly bounded at 1 by design through the min function.
🪛 GitHub Actions: JuliaFormatter
src/standalone/Snow/Snow.jl

[error] 294-303: Git diff detected formatting changes in Snow.jl around line 294. The indentation and alignment of parameters in the function SnowParameters were modified, indicating a formatting inconsistency.

⏰ Context from checks skipped due to timeout of 90000ms (13)
  • GitHub Check: ci 1.11 - windows-latest
  • GitHub Check: ci 1.11 - macOS-latest
  • GitHub Check: ci 1.11 - ubuntu-latest
  • GitHub Check: ci 1.10 - windows-latest
  • GitHub Check: downstream ClimaCoupler.jl (1.11)
  • GitHub Check: test (1.11)
  • GitHub Check: ci 1.10 - macOS-latest
  • GitHub Check: docbuild
  • GitHub Check: downstream ClimaCoupler.jl (1.10)
  • GitHub Check: test (1.10)
  • GitHub Check: ci 1.10 - ubuntu-latest
  • GitHub Check: lib-climalandsimulations (1.11)
  • GitHub Check: lib-climalandsimulations (1.10)
🔇 Additional comments (7)
src/standalone/Snow/Snow.jl (5)

86-91: Minor docstring improvements

Small readability improvement to the AbstractAlbedoModel docstring.


113-116: Approved docstring clarification

Small improvement to the explanation of the albedo formula parameters.


139-140: Updated default parameters to calibrated values

Default values for β and x0 parameters have been updated to calibrated values, which should improve model accuracy.

  • β changed from 0 to 0.7875
  • x0 changed from 0.1046 to 0.2

This change makes the density-dependent prefactor active by default (previously β=0 disabled this effect).


151-154: Improved docstring formatting

Small improvement to documentation structure.


161-175: Improved docstring formatting

Minor formatting changes to the documentation.

experiments/long_runs/snowy_land.jl (2)

172-172: Minor whitespace fix

Removed trailing whitespace.


319-324: Updated snow albedo parameters to match core model

Updated the snow albedo model parameters to use the same calibrated values as defined in the core Snow.jl file:

  • α_0: 0.64 → 0.7899
  • Δα: 0.06 → 0.06575
  • k: 2 → 17.92
  • β: 0.4 → 0.7875
  • x0: 0.2 → 0.1046

This ensures consistency between the experiment configuration and the core model defaults.

Comment on lines +296 to +300
α_snow::AM = ZenithAngleAlbedoModel(
FT(0.7899), # Calibrated α_0
FT(0.06575), # Calibrated Δα
FT(17.92), # Calibrated k
), # β and x0 default values are calibrated as well
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Changed default snow albedo model to calibrated values

Major improvement: Changed the default snow albedo model from a simple constant value (ConstantAlbedoModel(0.8)) to a more sophisticated zenith-angle-dependent model with calibrated parameters.

This change will provide more realistic snow albedo representation by default, accounting for both solar angle and snow density effects.

The pipeline reports a formatting issue around this line. Please fix the indentation to match the project's formatting guidelines:

#!/bin/bash
# Check the formatting error mentioned in the pipeline failure
grep -A 10 "Git diff detected formatting changes" pipeline_failures.txt

@@ -136,8 +136,8 @@ function ZenithAngleAlbedoModel(
α_0::FT,
Δα::FT,
k::FT;
β = FT(0),
x0 = FT(0.2),
β = FT(0.7875), # Calibrated value
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 we can change the constructor to supply defaults for all parameters now, and then use this in the long run.

@@ -293,7 +293,11 @@ function SnowParameters{FT}(
density::DM = MinimumDensityModel(FT(200)),
z_0m = FT(0.0024),
z_0b = FT(0.00024),
α_snow::AM = ConstantAlbedoModel(FT(0.8)),
Copy link
Member

Choose a reason for hiding this comment

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

Some of our unit tests fail probably because they use this default.

Others fail probably because they are testing the default of the ZenithAngleAlbedo model and now that has changed.

can test locally with "julia --project=test test/standalone/Snow/test_file_name.jl" for each of the files in that directory.

@kmdeck
Copy link
Member

kmdeck commented May 5, 2025

albedo_parameterization
And here is the dependence on rho_snow with mu = 0.5:
albedo_parameterization_mu_fixed

@kmdeck
Copy link
Member

kmdeck commented May 5, 2025

Note that when we had the simpler model (only a dependence on zenith angle), we got:
albedo_parameterization_simpler

so it looks like most of variation in albedo is now being covered by the snow density portion of the parameterization, rather than the zenith angle portion.

This is probably fine, but we may want to confirm at some point that the fit with all 5 parameters is improved enough, compared with that with only three parameters, so that the extra two parameters are justified. I mention this also because the zenith angle is completely known, so a parameterization based on that should be pretty stable, while snow density computed by the model could change as other things change in the model. @AlexisRenchon

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