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 1: Navigate to the file directory#

First, change into the directory that contains the diagnostic output configuration files:

cd app/lfric_atm/file

See also

For help choosing the correct Monsoon3 service and finding the official setup guidance, see Using Monsoon3.

cd app/lfric_atm/file

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

Listing 1 trunk/app/lfric_atm/file/file_def_diags_user_temp.xml#
   <!-- 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"/>
Listing 2 trunk/app/lfric_atm/file/file_def_diags_user_temp.xml#
   <!-- 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:

  1. Select the variable v_in_w3.

  2. Choose a single time index (for example, the first output time).

  3. Choose one pressure level to plot.

  4. 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!