Processed diagnostics needed for PS49 - #673
Conversation
Some of the content of this change has been produced with the assistance
of Anthropic Claude Opus 5 (Claude Code).
Adds two diagnostics:
thlev__pv Ertel potential vorticity on theta surfaces
dyn_trop__theta potential temperature on the PV = +/-2 surface
Both are vertical interpolations of fields the model already holds, so
no new science is introduced: gungho already computes Ertel PV on model
levels (W3) via potential_vorticity_diagnostic_alg, and theta_in_w3 is
already a derived field.
level_interp_mdi_kernel_mod interpolates a field onto surfaces of
constant value of a second field. It differs from the existing
pres_interp_kernel_mod in three ways:
* the bracketing level is the *highest* level at which the coordinate
field is at or below the target, so for a non-monotonic coordinate
such as |PV| the uppermost crossing is selected. This is what makes
dyn_trop__theta a dynamical tropopause rather than a boundary layer
artefact;
* columns which do not span the target are set to missing data rather
than extrapolated;
* cubic interpolation degrades to linear at both ends of the column.
Cubic interpolation is used for the theta surfaces, where the
coordinate is monotonic, and linear for the PV surface, taken against
|PV| = 2.0e-6 m2 s-1 K kg-1.
The kernel takes an array of target levels, which PSyclone cannot pass
(stfc/PSyclone#1312), so the PSy layer is hand written in
psykal_lite_phys_mod alongside invoke_pres_interp_kernel_type.
The theta_levels axis holds a single 320 K surface, following the TIGGE
standard. Both fields are added to the oper_nwp_gl output stream.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Some of the content of this change has been produced with the assistance of Anthropic Claude Opus 5 (Claude Code). Renames the two diagnostics into the processed__ namespace: thlev__pv -> processed__pv_on_theta_levs dyn_trop__theta -> processed__theta_on_pv2 The XIOS output names and the local field names in pv_surface_diags_alg_mod follow suit. The theta_levels axis now carries the 475, 425 and 315 K surfaces rather than a single 320 K surface. The axis values are listed in the order requested; the kernel treats each target level independently, so the ordering affects only the layout of the output. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Adds processed__u50m and processed__v50m, the eastward and northward wind components interpolated onto a height surface 50 m above the ground. Both reuse the existing u_in_w3 and v_in_w3 derived fields and the level_interp_mdi kernel, so only the vertical coordinate is new: height_above_surface_kernel_mod subtracts the lowest Wtheta level, this being the orography, from the W3 heights above mean sea level. Interpolation is linear. Some of the content of this change has been produced with the assistance of Anthropic Claude Opus 5 (Claude Code).
Andrew Coughtrie (andrewcoughtrie)
left a comment
There was a problem hiding this comment.
Code Owner Review
I'm happy with the changes to the files I am listed as code owner of.
There was a problem hiding this comment.
Why do two columns need to be tested?
There was a problem hiding this comment.
No idea - I'm happy to take that test out if you like
There was a problem hiding this comment.
Perhaps just one test is sufficient. I'd keep test_over_orography and ditch the other two, removing comments as needed.
mo-cjsmith
left a comment
There was a problem hiding this comment.
Replicates UM diagnostics. Code and results look fine.
There was a problem hiding this comment.
This subroutine replicates the corresponding subroutine in the UM. This is what is required, so it should stay as it is but a few comments are worth adding:
- The loop to find level_below need only be done if target_lev <= coord_in(base_in+top_df). This would also allow for level_below to be set to -1 in just one place.
- Any order of Lagrange interpolation could be more compactly coded, with a loop to calculate basis functions.
- Would there be any improvement in the diagnostic if monotone cubic interpolation were used?
There was a problem hiding this comment.
I've resolved (1) in 22c6ac1.
Not sure about how to do (2), or whether this is worthwhile.
For (3), at the moment I think we're keen just to replicate what the UM does.
There was a problem hiding this comment.
Perhaps just one test is sufficient. I'd keep test_over_orography and ditch the other two, removing comments as needed.
|
Your CLA signature was found on the base branch, but you appear to have modified the CONTRIBUTORS.md file in this PR. Please do not edit the CONTRIBUTORS.md file. If you have already signed the CLA, revert changes to the file and your signature will be picked up. |
Thanks Chris - have addressed your comments in 22c6ac1. Over to Steve Mullerworth (@stevemullerworth) for code review |
PR Summary
Sci/Tech Reviewer: mo-cjsmith
Code Reviewer: Steve Mullerworth (@stevemullerworth)
Diagnostics requested by R2O for downstream users as part of PS49
N.B. The UM diagnostics 212-213 are actually incorrect - they are 50m above the lowest rho level (which typically lies at 10m in the global model). We have implemented them correctly here as 50m above the surface.
Some example output plots:




Code Quality Checklist
Testing
trac.log
Test Suite Results - lfric_apps - pv_theta_diags/run1
Suite Information
Task Information
✅ succeeded tasks - 1213
Security Considerations
Performance Impact
AI Assistance and Attribution
Documentation
PSyclone Approval
Sci/Tech Review
(Please alert the code reviewer via a tag when you have approved the SR)
Code Review