Case description
In this exercise we will use Metview to explore the ways ensemble forecast can be processed and visualised. The case we will investigate is related to a low pressure system crossing the UK on 10 August 2014: it caused high winds and heavy rain especially in the South-Western part of the country.
The plots we want to produce with Metview are as follows:
The first three plots show the precipitation forecast for the period of August 24 00UTC - 25 00UTC from various model runs preceding the event by 1, 3 and 5 days, respectively. The last plot shows the observed rainfall for the same period.
We will use both Macro and icons to ....
...
These plots, for an obvious reason, are called stamp plots. This a complex plot so we will work in Macro againwrite a Macro for it.
Create a new Macro and edit it. Drop your Geographical View and the Coastlines icons into the Macro editor. Once the code is generated and tidied up define a 6x9 layout so that each plot should contain your view:
...
Next, drop your wgust_shade Contouring icon into the Macro editor and tidy up the generated code, . We will apply this icon to all the fields in the stamp - plot.
Continue with reading the GRIB file with the ENS forecasts in:
...
Define a variable to hold the time step we want to plot:
Code Block |
---|
step = 90 |
The first stamp plot will contain the control forecast. We need to filter it out with following read() command:
Code Block |
---|
f=read(
data: g,
step: step,
type: "cf"
) |
The available space for the title in the plot will be confined so we try to use a very short titlet:
Code Block |
---|
title = mtext(
text_line_1 : "control"
) |
...
spaghetti will be generated by plotting each perturbed forecasts member into a separate map. So we need to write a loop like this:
Code Block |
---|
for number=1 to 50 do
...your code will go here ...
end loop |
Within the loop, simply read all the current perturbed forecast members for the given timesteptime step:
Code Block |
---|
f=read(data: g, number: number, steptype: step"pf", numberstep: istep ) |
then compute their mean with the mean()
macro functionplot it into your view with your contour settings:
Next define a title. The available space for the title in the plot will be confined (we need to squeeze more than 50 maps into a page) so title should be short:
Code Block |
---|
title = mtext( text_line_1 : "memberPF: " &i, text_font_size: 0.2 ) number) |
We finish the loop by plotting the field into the right map in our layoutand add it to the resulting fieldset:
Code Block |
---|
plot(dw[i],title,f,wgust_shade) |
We finish the macro by returning the resulting fieldset:
Code Block |
---|
return e_mean |
By using the return
statement our Macro behaves as if it were a fieldset (GRIB file). Drag it into the bottom left map and customise it with the wgust_shade Contouring icon and the title_mean Text Plotting icon. You will see that the ensemble mean hints that high wind speed can happen.
Run your Macro (this will take a minute or so) and find the ENS members forecasting high wind speeds in our area of interest.
Part 4: Creating a spaghetti plot
We finish the exercise by looking into the predictability of the large scale flow pattern by generating spaghetti plots for 500 hPa geopotential from the same ENS run we investigated before. A spaghetti plot is composed by plotting each ENS member into the same map using a single contouring value. The plot we want to generate is shown below (it contains the spaghetti plot for 500 hPa geopotential using the 560 gpm contouring value):
This is a fairly complex plot and we will write a Macro to produce itThese plots, for an obvious reason, are called stamp-plots. This a complex plot so we will work in Macro again.
Create a new Macro and edit it. Drop your Geographical View and the Coastlines icons into the Macro editor. Once the code is generated and tidied up define a 6x9 layout so that each plot should contain your view:
Code Block |
---|
dw=plot_super_page(pages: mxn_layout(my_view,9,6)) |
Next, drop your wgust_shade Contouring icon into the Macro editor and tidy up the generated code, We will apply this icon to all the fields in the stamp-plot.
Continue with reading the GRIB file with the ENS forecasts in:
Code Block |
---|
g=read("fc_ens.grib") |
Define a variable to hold the time step we want to plot:
Code Block |
---|
step = 90 |
The first plot will contain the control forecast. We need to filter it out with following read() command:
Code Block |
---|
f=read(
data: g,
step: step,
type: "cf"
) |
The available space for the title in the plot will be confined so we try to use a very short titlet:
Code Block |
---|
title = mtext(
text_line_1 : "control"
) |
...
change the map area to
Code Block |
---|
[40,-40,70,20] |
so that map could show a larger (North Atlantic area).
Next define the contouring used for the "spaghetti":
Code Block |
---|
cont = mcont(
contour_label: "off",
contour_level_selection_type : "level_list",
contour_level_list : 560,
contour_line_colour: "blue",
contour_highlight: "off"
) |
We turned contour labels off so that keep the plot uncluttered and defined only a single contour value.
The spaghetti will be generated by plotting each perturbed forecasts member as a separate layer into the plot. So we need to write a loop like this:
Code Block |
---|
for number=1 to 50 do
...your code will go here ...
end loop |
Within the loop, simply read all the perturbed forecast members for the all the given timesteptime steps
Code Block |
---|
f=read(data: g, steptype: step"pf", number: inumber ) |
then compute their mean with the mean()
macro functionplot it into your view with your contour settings:
Code Block |
---|
plot(your_view,f,cont) |
If you run this macro you will see that the "spaghetti" was properly generated but you have too many titles (one for each layer i.e. 50). To get rid of the extra titles you need to define a custom Text Plotting inside the loop and add it to your plot() command:
Code Block |
---|
title = mtext( text_line_1 : "member: " &i, text_font_size: 0.2 ) |
and add it to the resulting fieldset:
Code Block |
---|
plot(dw[i],title,f,wgust_shade) |
We finish the macro by returning the resulting fieldset:
Code Block |
---|
return e_mean |
By using the return
statement our Macro behaves as if it were a fieldset (GRIB file). Drag it into the bottom left map and customise it with the wgust_shade Contouring icon and the title_mean Text Plotting icon. You will see that the ensemble mean hints that high wind speed can happen.
...
your custom title ....")
plot(your_view,f,cont,title) |
The idea is that you should use the where statement inside the grib_info tag (as described here) to have the title appear for one member only.
Once you sorted the the title out visualise your plot again and animate through the steps to see how the little spaghetti is dispersing over time.
Extra Work
Try the following if you have time.
Add more fields to the stamp plot
The stamp only shows the perturbed ENS members but there is still space left to display additional fields. Try to add the control forecast (from ENS) and the operational forecast to it.
Hints:
- plot the control forecast into map 51 (
dw[51]
). The control forecast is stored in the same file as the perturbed forecast members: fc_ens.grib. To access it (via theread()
function) you need to omit thenumber
parameter and settype
to "cf". - plot the operational forecast into map 52 (
dw[52]
). The operational forecast is stored in fc_oper.grib. For theread()
command you just need to specify thestep
.
Info |
---|
While setting up these extra plots it is good idea to temporarily comment out the whole loop processing the perturbed forecasts members. |
Add more fields to the spaghetti plot
The spaghetti only shows the perturbed ENS members. Try to add the control forecast (from ENS) and the operational forecast to it using different isoline colours.
Hints:
- plot the control forecast with a thick green isoline. The control forecast is stored in the same file as the perturbed forecast members: spag_ens.grib. To access it (via the
read()
function) you need to omit thenumber
parameter and settype
to "cf". - plot the operational forecast with thick red isoline. The operational forecast is stored in spag_oper.grib. You just need to simply read it in with the
read()
command.
Info |
---|
While setting up these extra layers it is good idea to temporarily comment out the whole loop processing the perturbed forecasts members |