Adding a new diagnostic#
In this exercise, you will add the atmospheric diagnostic “v component of wind on pressure levels” back into the model configuration. This diagnostic has been intentionally removed, and your task is to restore it by editing the relevant XML configuration file.
The v_in_w3 field represents the northward (v) component of wind
interpolated onto pressure levels. Without it, this wind component will not be
written to the model output.
Step 2: Open the diagnostics configuration file#
Open file_def_diags_user.xml in a text editor of your choice. This file
defines which diagnostic fields are written to output for each field group.
Step 3: Locate the pressure level output group#
Search for the field group named lfric_stream_g. This group controls which
fields are output on pressure levels as time-day means. You should find a block
of <field> entries that includes u_in_w3 (the u component of wind) but
is missing v_in_w3.
Step 4: Add the missing field for v_in_w3
<!-- Stream G - Monthly mean fields -->
...
<field field_ref="ageofair"/>
<field field_ref="u_in_w3"/>
<field field_ref="v_in_w3"/>
<field field_ref="m_v" long_name="vapour_mixing_ratio"/>
<!-- Stream G - Monthly mean fields -->
...
<field field_ref="ageofair"/>
<field field_ref="u_in_w3"/>
<field field_ref="v_in_w3"/>
<field field_ref="m_v" long_name="vapour_mixing_ratio"/>
Add the line <field field_ref="v_in_w3"/> to include the v component of
wind in the output. Make sure to save your changes to the file.
Step 5: Run the model and check the output#
Now that you have added the missing diagnostic, run the model using what you
have learnt in the previous exercises. After the model has completed, check the
output files to confirm that the v_in_w3 field is now included in the
pressure level diagnostics. You can use tools like ncdump or ncks to
inspect the contents of the output NetCDF files and verify that the v component
of wind is present.
Step 6: Visualise the v_in_w3 field#
To quickly visualise the new diagnostic, open the NetCDF output in xconv
and display a pressure-level slice of v_in_w3.
Running graphical applications over SSH
If you are connected to a remote system over SSH, graphical applications need X11 forwarding to display on your computer. Start an X server on your computer first (for example, XQuartz on macOS), then connect from a terminal using generic host details supplied by your service:
$ ssh -AY <remote-host>
Repeat the options for every additional SSH hop. The -Y option enables
trusted X11 forwarding. The -A option forwards your SSH authentication
agent and should only be used with systems you trust. A terminal integrated
into an editor such as VS Code works in the same way as any other terminal.
On the system where you will start the graphical application, run
echo "$DISPLAY". It should return a value. If it is blank, disconnect
and reconnect with X11 forwarding enabled at every hop before continuing.
xconv lfric_stream_g.nc # replace with your output file name
xconv lfric_stream_g.nc # replace with your output file name
In xconv:
Select the variable
v_in_w3.Choose a single
timeindex (for example, the first output time).Choose one pressure level to plot.
Display the field using a diverging colour scale (for example, red-blue).
This gives a quick spatial check that the field is present and has realistic structure.
You should now have successfully added the v component of wind back into the model output diagnostics!