...
Preparation
In this exercise we will apply use Metview to produce the plots aligned on the same page shown above:
- top plot:a the plot at the top shows map with mean sea level pressure forecast fields overlayed with the track of Hurricane Sandy.
- bottom plot: the plot at the bottom contains a graph chart showing the evolution of the minimum of the mean sea level pressure computed along the storm track.
...
We will also attach a marker to show a specific location on the map (New York City) and customise the legend and title.
...
We will prepare the plot interactively using icons. Then, at the end, we will put it all together into a macro. Remember to give your icons useful names!
Setting the map View
With a new Geographical View icon, set up a cylindrical projection with its area defined as
Code Block |
---|
South/West/North/East: 17/-97/51/-45 |
Set up a new Coastlines icon with the following:
- the land coloured in grey
- the sea coloured as #dcf0ff
Plotting the Mean Sea Level Pressure field
Plot the GRIB file sandy_msl.grib into this view using a new Contouring icon. Plot black isolines with an interval of 5 hPa between them.
Info |
---|
The fields you visualised were taken from the model run at 2012-10-27 0UTC and containing 12 hourly forecast steps from 0 to 120 hours. |
Plotting the storm track
The storm track data is stored in the CSV file called 'sandy_track.txt'. If you open this file you will see that it contains the date, time and geographical coordinates of the track points.
Create a newTable ReaderTable Visualiser icon and set it to visualise your CSV file:
- set the plot type to geo points
- select the columns holding the latitude and longitude by their index
- carefully specify the table delimiter and header information like this
Code Block |
---|
TABLE_DELIMITER = ' ' //it means whitespace. In the editor do not type in the quotes it just press whitespace
TABLE_COMBINE_DELIMITERS = ON
TABLE_HEADER_ROW = 0 |
Now drag your Table Visualiser icon the map plot to overlay with the mean sea level forecast.
Customise the storm track
The storm track in its current for does not look great so you need to customise it with a Graph Plotting icon by setting the
- the track line to black and thick
- the track points to white filled circles (their marker index is 15) with red outline.
Plotting date/time labels onto the track
To finalise the track plot you need to plot the date/time labels next to the track points. This can be done with a Symbol Plotting icon by specifying the list of labels you want to plot into the map. Since it would require too much editing you will learn a better way of doing it programatically by using Metview Macro,
Create new Macro and edit it. First, read the CSV file in with theTable Reader (see its documentation here):
Code Block |
---|
tbl = read_table(
table_delimiter : " ",
table_combine_delimiters : "on",
table_header_row : 0,
table_filename : "sandy_track.txt"
) |
Here variable tbl
contains all the columns from the CSV file. Now read the date and time (from the first two columns) into vectors:
Code Block |
---|
val_date=values(tbl,1)
val_time=values(tbl,2) |
Next, you need to build the list of labels. Each label is made up from a day and and a hour part. Use this loop to construct the list:
Code Block |
---|
labels=nil
for i=1 to count(val_date) do
labels = labels & [" " & substring(string(val_date[i]),7,8) & "/" & val_time[i] ]
end for |
Finally, define a Symbol Plotting icon to plot the text labels and return it.
Code Block |
---|
sym = msymb(
symbol_type : "text",
symbol_text_font_colour : "black",
symbol_text_font_size: "0.3",
symbol_text_font_style: "bold",
symbol_text_list : labels
)
return [sym] |
By returning the visual definition you built Macro behaves as if it were a real Symbol Plotting icon. So once the Macro is finished drag it into the plot and you should see the labels appearing along the track.
Setting the View
With a new Geographical View icon, set up a cylindrical projection with its area defined by its lower-left corner [20oN, 110oW] and its upper-right corner [70oN, 30oW].
...
- the land coloured in cream
- the coastlines in grey
- the grid as a grey dashed line
Plotting the Mean Sea Level Pressure field
Plot the GRIB file msl.grib into this view using a new Contouring icon. Plot black isolines with an interval of 5 hPa between them. Since this will be plotted on top of another field, it would also be a good idea to increase the thickness of the isolines. Activate the legend in the Contouring icon and set the legend text for this icon to "MSLP". Animate through the filelds to see how the forecast evolving.
Plotting the Precipitation Field
...