Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Scroll pdf ignore
Panel
titleDownload
Expand
titleClick here for files to download...
Excerpt Include
A Quick Tour of Metview
A Quick Tour of Metview
nopaneltrue

Attachments
uploadfalse
oldfalse
patterns*.tar.gz,*.grib,*.grb
sortByname

Overview

In addition to geographic map plots, Metview can also generate XY plots including time series.

The possible ways to provide data for graph plotting are:

...

Also try dropping a Graph Plotting icon to get connecting lines between the points. Try changing the plot type to a bar chart using the Graph Plotting icon.

Notice that the automatically-generated view fits your data so that the 'edge points' are on the axes.

...

Now create another one called v_axis and make it the vertical axis:

Axis OrientationVertical

Customise this similarly.

...

Now extract the dates and times of the fields and combine them into a list of date variables. There is more than one way to organise this code, but here is one suggestion:

Code Block
languagepy
# obtain two lists - one of dates and one of times
d = grib_get_long(fs, 'validityDate')
t = grib_get_long(fs, 'validityTime')

# times are in hours, like 1200 is 12:00, so we have to divide by 100
# to get them into hours, then by 24 to get them into fractions of days
dates = d + (t / 2400 ) # ASSUME the times are in hours, like 1200 is 12:00
print(dates)

# but these are still numbers - we need to call the date() function to convert
# into proper date variables, and we need to loop through the list to do it
date_list = nil
loop dt in dates
    date_list = date_list & [date(dt)]
end loop
print(date_list)valid_date(fs)
print(dates)

Now construct an Input Visualiser icon which you will drop into the Macro Editor: ensure that the Input X Type is set to type Date and enter some dummy values so that useful Macro code generated. Replace In the macro, replace the values of input_date_x_values and input_y_values with your lists of data. 

Plot In your macro, plot the Input Visualiser variable to get your time series plot. Use the Macro code for a Graph Plotting icon to connect the points with blue lines. If you have time at the end, you can customise the plot further.

Now duplicate the bulk of the code (change some variable names!) in order to additionally plot the time series for the data stored in t2m_analysis.grib, with the points connected by red lines. The plotting part can be done either with an additional plot() command, or else by adding the new Input Visualiser and Graph Plotting code to the end of the existing plot() command.

...

Customise the time series plot:

Image Added

  • put some extra space around the data points - add a day to each end of the x axis using a custom Cartesian View
  • add a useful legend indicating that the blue line is the 24h forecast data and the red line is the analysis data

Logarithmic scales

Image Added

Create an X/Y plot similar to the first one from this session. Make sure there are some large y-values (e.g. 100, 1000). Set up a Cartesian View icon with Y Axis Type = Logarithmic to view your data differently. Logarithmic Y axes are often used when representing the atmospheric levels.

Scatterplot

Image Added

Plot the analysis values on the x-axis and the forecast values on the y-axis. Add a diagonal line.

Geo boxes side-by-side

Write a macro which creates a 2-page layout similar to the image under "Plotting onto a Map". Use the two different box-drawing techniques, one in each page. Ensure they use the same variables to define the bounds of the box.

...