Skip to content

Conversation

@costachris
Copy link
Member

@costachris costachris commented Nov 12, 2025

Improvements to WeatherQuest ERA5 initial conditions:

  • Adjust for ERA5/ClimaAtmos topo differences when initializing from surface pressure.
  • Improve initialization by including upstream 3D lat/lon/z interp, extrapolation beyond 1000mb surface, and high resolution custom vertical grid. These changes are needed to reduce vertical interpolation errors because upstream Clima utilities lack tri-linear interpolation to the spectral element space, resulting in what were otherwise significant interpolation errors.
  • Account for lapse rate in mslp sea level reduction (diagnostics).

The colorbars vary, but note each improvement significantly reduces the RMSE/Bias.
Current 😭
mslp_v1
Topography correction in surface pressure init 👀
mslp_v2
Topography correction + account for lapse rate in MSLP diagnostic 🥳
mslp_v3

@costachris costachris requested a review from Julians42 November 12, 2025 23:48
@costachris costachris force-pushed the cc/improve_wxmodel_pressure_init_diag branch from 6f20da6 to 1ce4418 Compare November 13, 2025 00:47
@assert all(map(x -> x in (keys(ncin)), in_dims)) "Source file $source_file is missing subset of the required dimensions: $in_dims"

# assert ncin has required variables
req_vars = ["u", "v", "w", "t", "q", "skt", "sp"]
Copy link
Member

Choose a reason for hiding this comment

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

If it breaks without surface_geopotential catch it with the @assert here

end
var_obj = defVar(ncout, dst_name, FT, ("lon", "lat", "z"), attrib = var_attrib)
# Read first time slice and coalesce; follow same convention as sp (use [:, :, 1])
data2d = FT.(coalesce.(ncin[src_name][:, :, 1], NaN))
Copy link
Member

Choose a reason for hiding this comment

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

Do we need a coalesce? Are there instances when the data is NaN and our model will still run? If not then we could consider asserting not NaN

Comment on lines 1672 to 1677
bracket = similar(t_level)
@. bracket = max(ϵ, 1 + Γ * z_level / t_level)

# exponent = g / (R_m Γ)
exponent = similar(R_m_surf)
@. exponent = g / (R_m_surf * Γ)
Copy link
Member

Choose a reason for hiding this comment

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

This will allocate new arrays which is slow. Maybe @dennisYatunin could recommend a fix?

Copy link
Member Author

@costachris costachris Nov 17, 2025

Choose a reason for hiding this comment

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

I consolidated the logic and reduced the number of new variables. But also diagnostics are computed on the CPU so I'm not sure we need to worry about allocations as much here (note we already materialize a lot of our lazy fields throughout diagnostics as is). But maybe @dennisYatunin can comment how much it matters in the end.

Copy link
Member

@Julians42 Julians42 left a comment

Choose a reason for hiding this comment

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

Left some comments to improve clarity and then one performance optimization we should do in the diagnostics for Dennis. Glad this is looking so much better!

@costachris costachris force-pushed the cc/improve_wxmodel_pressure_init_diag branch 2 times, most recently from b961ecc to 0e88889 Compare November 18, 2025 00:57
@costachris costachris force-pushed the cc/improve_wxmodel_pressure_init_diag branch 2 times, most recently from 9deb1c7 to 2644b8b Compare December 2, 2025 22:31
@costachris costachris force-pushed the cc/improve_wxmodel_pressure_init_diag branch 3 times, most recently from 0d327d8 to 4754f88 Compare December 5, 2025 22:43
@costachris costachris changed the title Account for ERA5/ClimaAtmos topo differences Improve Initialization from ERA5 Dec 5, 2025
@costachris costachris changed the title Improve Initialization from ERA5 Improve Initialization from ERA5 and MSLP Diagnostic Dec 5, 2025
@costachris costachris force-pushed the cc/improve_wxmodel_pressure_init_diag branch from 4754f88 to 9e6854a Compare December 6, 2025 17:19
…re. Account for lapse rate in mslp sea level reduction (diagnostics).
@costachris costachris force-pushed the cc/improve_wxmodel_pressure_init_diag branch from 9e6854a to ec99268 Compare December 7, 2025 19:00
@costachris costachris added this pull request to the merge queue Dec 7, 2025
Merged via the queue into main with commit be24457 Dec 7, 2025
14 of 17 checks passed
@costachris costachris deleted the cc/improve_wxmodel_pressure_init_diag branch December 7, 2025 21:17
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