Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This tutorial explains how to use the FLEXPART Lagrangian dispersion model within Metview.

Excerpt


Note
titleRequirements

Please note that this tutorial requires Metview version 5.0 or later.

Preparations

First start Metview; at ECMWF, the command to use is metview (see Metview at ECMWF for details of Metview versions). You should see the main Metview desktop popping up.

The icons you will work with are already prepared for you - please download the following file:

Panel
titleDownload
flextra

flexpart_tutorial.tar.gz

and save it in your $HOME/metview directory. You should see it appear on your main Metview desktop, from where you can right-click on it, then choose execute to extract the files.

Alternatively, if at ECMWF then you can copy it like this from the command line:
    cp -R /home/graphics/cgx/tutorials/flexpart_tutorial ~/metview

You should now (after a few seconds) see a flexpart_tutorial folder. Please open it up.

The input data

The input data is already prepared for you and is located in folder 'Data'. You will find a FLEXPART Prepare -old icon that was used to generate the data in folder 'Prepare'. The corresponding macro code can also be found there.

...

info

You do not need to run the data preparation. However, if you wish to do so please note that it requires MARS access and you must set the Output Path parameter accordingly.

Running a forward simulation

Enter folder 'fwd'.

We will run FLEXPART to simulate a volcano eruption by releasing of some SO2 from the Icelandic volcano Eyjafjallajökull.

The simulation is defined by the 'fwd_conc' FLEXPART Run icon and the 'rel_volcano' FLEXPART Release icon, respectively. Both these are encompassed in a single macro called 'fw_cond.mv'. For simplicity will use this macro to examine the settings in detail. 

The macro starts with defining the release like this:

Code Block
languagepy
rel_volcano = flexpart_release(
	name			:	"VOLCANO", 
	starting_date	:	0,
	starting_time	:	15,
	ending_date		:	2,
	ending_time		:	12,
	area			:	[63.63,-19.6,63.63,-19.6],
	top_level		:	9000,
	bottom_level	:	1651,
	particle_count	:	10000,
	masses			:	1000000
	)

This says that the release will happen over a 45 h period between heights 1651 and 10000 m at the location of the volcano and we will release 1000 tons of material in total.

Info

Please note that

  • the species is not defined here (will be defined in flexpart_run())
  • we used dates relative to the starting date of the simulation (see also in flexpart_run())

The actual simulation is carried out by calling flexpart_run():

Code Block
languagepy
#Run flexpart (asynchronous call!)

r = flexpart_run(
	output_path		:	"result_fwd_conc",
	input_path		:	"../data",
	starting_date	:	20120517,
	starting_time	:	12,
	ending_date		:	20120519,
	ending_time		:	12,
	output_field_type: "concentration",
    output_flux		:	"on",
	output_trajectory	:	"on",
	output_area		:	[40,-25,66,10],
	output_grid		:	[0.25,0.25],
	output_levels	:	[500,1000,2000,3000,4000,5000,7500,10000,15000],
	release_species	:	8,
	receptors		:	"on",
	receptor_names	:	["rec1","rec2"],
	receptor_latitudes	:	[60,56.9],
	receptor_longitudes	:	[6.43,-3.5],
	releases		:	rel_volcano
	)

print(r)

Here we defined both the input and output path and specified the simulation period, the output grid and levels as well. We also told FLEXPART to generate gridded concentration fields and plume trajectories on output..

Info

The actual species that will be released is defined as an integer number (for details about using the species see here). With the default species settings 8 stands for SO2

If we run this macro (or alternatively right-click execute the FLEXPART Run icon) the results (after a minute or so) will be available in folder 'result_fw_conc' . The computations were actually taken place in a temporary folder then metview copied the results to the output folder. If we open this older we will see two files there:

...

Info

Please note that these are not the original outputs form FLEXTRA but were converted to formats more suitable for use in Metview. For details about the FLEXPART outputs please click here.

Visualising gridded fields

To plot a particular parameter and level we need to filter the desired dataset from the resulting FLEXPART output file. Unfortunately, Metview's Grib Filter icon cannot handle these files (partly due to the local GRIB definition they use) so we need to use other means to cope with this task. For this reason and also to make FLEXPART output handling easier a set of Metview Macro Library Functions were developed. We will heavily use these functions in the examples below.

First we inspect the 'conc_s001.grib' GRIB file containing the fields we want to plot. Double-click on the GRIB icon to start up the Grib Examiner and see that it only contains "mdc" (=Mass density concentration) fields. We can find out further details about this parameter by setting the Dump mode to Namespace and Namespace to Parameter:

Image Removed

The macro to visualise the concentration fields on a given level is 'plot_level.mv'.

First, we define the level (8000 m) and the parameter ("mdc") we want to plot. Then we call mvl_flexpart_read_hl() to filter the data into a fieldset.

Code Block
dIn="result_fwd_conc/"
inFile=dIn  & "conc_s001.grib"
lev=8000
par="mdc"

#Read fields on the given height level
g=mvl_flexpart_read_hl(inFile,par,lev,-1,-1)

Next, we define the contouring definition. The units we used here are ng m**-3 because for parameter "mdc" the native units (kg m**-3) are automatically scaled by the plotting library (see details about the this scaling for various FLEXPART GRIB fields here.

Code Block
languagepy
#The contour levels
cont_list=[1,10,50,100,150,200,250,500,750,1000,2000,6000]

#Define contour shading
conc_shade = mcont(
	legend	:	"on",
	contour	:	"off",	
	contour_level_selection_type	:	"level_list",
	contour_level_list  : cont_list,
	contour_label	:	"off",
	contour_shade	:	"on",
	contour_shade_method	:	"area_fill",
	contour_shade_max_level_colour	:	"red",
	contour_shade_min_level_colour	:	"RGB(0.14,0.37,0.86)",
	contour_shade_colour_direction	:	"clockwise",	
    contour_method: "linear"
	)

Next, we build the title with mvl_flexpart_title(). Please note that we need to explicitly specify the plotting units!

Code Block
languagepy
title=mvl_flexpart_title(g,0.3,"ng m**-3") 

Finally we define the view with the map:

Code Block
languagepy
collapsetrue
#Define coastlines
coast_grey = mcoast(
	map_coastline_thickness	:	2,
	map_coastline_land_shade	:	"on",
	map_coastline_land_shade_colour	:	"grey",
	map_coastline_sea_shade	:	"on",
	map_coastline_sea_shade_colour	:	"RGB(0.89,0.89,0.89)",
	map_boundaries	:	"on",
	map_boundaries_colour	:	"black",
	map_grid_latitude_increment	:	5,
	map_grid_longitude_increment	:	5
	)

#Define geo view
view = geoview(
	map_area_definition	:	"corners",
	area	:	[40,-25,66,9],
	coastlines: coast_grey
	)

and generate the plot:

Code Block
languagepy
plot(view,g,conc_shade,title)
Code Block
#Metview Macro

#  **************************** LICENSE START ***********************************
# 
#  Copyright 2017 ECMWF. This software is distributed under the terms
#  of the Apache License version 2.0. In applying this license, ECMWF does not
#  waive the privileges and immunities granted to it by virtue of its status as
#  an Intergovernmental Organization or submit itself to any jurisdiction.
# 
#  ***************************** LICENSE END ************************************

dIn="result_fwd_conc/"
inFile=dIn  & "conc_s001.grib"
lev=8000
par="mdc"

#Read fields on the given height level
g=mvl_flexpart_read_hl(inFile,par,lev,-1,-1)

#The countour levels
cont_list=[1,10,50,100,150,200,250,500,750,1000,2000,6000]

#Define contour shading
conc_shade = mcont(
	legend	:	"on",
	contour	:	"off",	
	contour_level_selection_type	:	"level_list",
	contour_level_list  : cont_list,
	contour_label	:	"off",
	contour_shade	:	"on",
	contour_shade_method	:	"area_fill",
	contour_shade_max_level_colour	:	"red",
	contour_shade_min_level_colour	:	"RGB(0.14,0.37,0.86)",
	contour_shade_colour_direction	:	"clockwise",	
    contour_method: "linear"
	)

#Define coastlines
coast_grey = mcoast(
	map_coastline_thickness	:	2,
	map_coastline_land_shade	:	"on",
	map_coastline_land_shade_colour	:	"grey",
	map_coastline_sea_shade	:	"on",
	map_coastline_sea_shade_colour	:	"RGB(0.89,0.89,0.89)",
	map_boundaries	:	"on",
	map_boundaries_colour	:	"black",
	map_grid_latitude_increment	:	5,
	map_grid_longitude_increment	:	5
	)

#Define geo view
view = geoview(
	map_area_definition	:	"corners",
	area	:	[40,-25,66,9],
	coastlines: coast_grey
	)

#Title
title=mvl_flexpart_title(g,0.3,"ng m**-3") 

plot(view,g,conc_shade,title)

Please look into the visualisation macros to see how to use them. The most important Metview Macro Library Functions are as follows:

...

mvl_flexpart_read_hl(inFile,par,lev,ts,ac)
  
# Function to get flexpart fields on height level
# params:
#   inFile: input file
#   par: parameter shortname
#   lev: level (-1 means all)
#   ts: step (-1 means all)
#   ac: ageclass (-1 means all)

Tutorials

Children Display
alltrue
depth3

...

mvl_flexpart_read_sfc(inFile,par,ts,ac)
  
# Function to get surface flexpart fields
# params:
#   inFile: input file
#   par: parameter shortname
#   ts: step (-1 means all)
#   ac: ageclass (-1 means all)

mvl_flexpart_total_column(inFile,ac)
  
# Function to compute the column-integrated density for concentration
# params:
#   inFile: input file
#   ac: ageclass (-1 means all)

 

Image Removed

Forward simultaions

Fields

Trajecories

receprotros

volume fill

fluxes

cross section

time-height diagram

total column

age class

backward simulation

residence time

fluxes

trajecory