Skip to content

Warn users when SlabOceanSST overwrites surface_condition temperature - #4604

Draft
jefftyoder with Copilot wants to merge 10 commits into
mainfrom
copilot/fix-surface-temperature-overwrite
Draft

Warn users when SlabOceanSST overwrites surface_condition temperature#4604
jefftyoder with Copilot wants to merge 10 commits into
mainfrom
copilot/fix-surface-temperature-overwrite

Conversation

Copilot AI commented Jun 23, 2026

Copy link
Copy Markdown

When using the SlabOceanSST surface model, any surface temperature specified via surface_condition in a case setup is overwritten by the slab ocean's prognostic initialization. This is correct and intended behavior, but the silent overwrite can confuse users, particularly when adapting existing cases or debugging initialization values.

Changes

Warning in model initialization

  • Added a conditional warning in AtmosSurface() (src/config/model_getters.jl, lines 833–835) that emits when SlabOceanSST is active and a setup provides a surface_condition temperature
  • Warning informs users their value will be overwritten and directs them to prognostic_variables.jl
  • No impact on model creation or existing behavior—purely informational

Test coverage

  • Added test/slab_ocean_warning.jl with three test cases:
    • Warning emitted when setup provides surface temperature with SlabOceanSST
    • No warning when setup_type is nothing
    • No warning when using PrescribedSST (as expected)

Example

# Using SlabOceanSST with a setup that provides surface_condition temperature:
config = CA.AtmosConfig(Dict("prognostic_surface" => "SlabOceanSST", ...))
setup_type = CA.Setups.TRMM_LBA()  # Defines surface_condition temperature
surface = CA.AtmosSurface(config, params, FT; setup_type = setup_type)

# Emits warning:
# ┌ Warning: `SlabOceanSST` is active; the surface temperature specified via
# │ `surface_condition` in the case setup will be overwritten by the slab ocean's
# │ prognostic initialization (see `prognostic_variables.jl`).
# └ @ ClimaAtmos.config.model_getters ...

Copilot AI changed the title [WIP] Fix SlabOceanSST overwriting surface temperature from setup Warn users when SlabOceanSST overwrites surface_condition temperature Jun 23, 2026
Copilot AI requested a review from jefftyoder June 23, 2026 00:21

@jefftyoder jefftyoder left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

Copilot AI and others added 3 commits July 1, 2026 12:29
Co-authored-by: jefftyoder <170672604+jefftyoder@users.noreply.github.com>
Co-authored-by: jefftyoder <170672604+jefftyoder@users.noreply.github.com>
Co-authored-by: jefftyoder <170672604+jefftyoder@users.noreply.github.com>
@jefftyoder
jefftyoder force-pushed the copilot/fix-surface-temperature-overwrite branch from c2d9e90 to 2d76856 Compare July 1, 2026 19:29
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

📖 Docs preview for this PR: https://clima.github.io/ClimaAtmos.jl/previews/PR4604/

jefftyoder and others added 7 commits July 1, 2026 13:04
- Add slab_ocean_warning.jl to runtests.jl infrastructure group so CI
  actually runs the tests
- Hoist shared AtmosConfig, params, and setup_type to outer testset scope,
  reducing AtmosConfig constructions from 3 to 2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Triple-quoted string at top of file was parsed as a docstring for
`using Test`, which Julia 1.10 rejects. Convert to a # comment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@test expr "message" is not supported in Julia 1.10's Test stdlib.
Drop the message; the testset context makes the intent clear.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
….ClimaAtmosParameters

The convenience constructor ClimaAtmosParameters(::Type{FT}) lives in the
top-level CA namespace (create_parameters.jl), not in CA.Parameters which
only defines the struct. Matches the pattern used across all other tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
`TRMM_LBA()` requires `prognostic_tke::Bool` and `thermo_params`; the
zero-arg call was crashing on all Julia versions with
`UndefKeywordError: keyword argument 'prognostic_tke' not assigned`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jefftyoder
jefftyoder requested a review from nefrathenrici July 14, 2026 21:52
@jefftyoder

Copy link
Copy Markdown
Contributor

@nefrathenrici I tried using CoPilot + Claude Code to write up this PR. If the changes look sensible to you, I'm happy to help clean it up and merge it in. If not, we can close this draft.

@nefrathenrici nefrathenrici left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! Looks good, just minor comments

Setups.surface_condition(setup_type, params)

temperature = if pa["prognostic_surface"] == "SlabOceanSST"
if !isnothing(setup_type) && !isnothing(setup_pieces.temperature)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if !isnothing(setup_type) && !isnothing(setup_pieces.temperature)
if !isnothing(setup_type)

nit, this check is redundant

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This file should be moved to test/config/.

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.

3 participants