Scroll pdf ignore | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Case description
In this exercise we will use Metview to produce the plots shown above:
...
Next, we build the list of labels. Each label is made up from a day and an hour part separated by a slash. We convert the date into a string and then take the last two characters to get the day. Use this loop to construct the list of labels:
Code Block |
---|
labels=nil for i=1 to count(val_date) do dPart = substring(string(val_date[i]),7,8) tPart = val_time[i] label = " " & dPart & "/" & tPart labels = labels & [label] end for |
...
Create new Macro and edit it. First, read the CSV file in the very same way as before. However, this time, on top of date and time, we also need to read latitude and longitude into vectors:
Code Block |
---|
val_latlon=values(tbl,3) val_lonlat=values(tbl,4) |
Next, read in the GRIB file containing the mean sea level forecast:
...
Code Block |
---|
p=read( data: g, step: (i-1)*2412, area : wbox ) |
Here we used the fact the forecasts steps are stored in hours units in the GRIB file.
Next, compute the minimum of the field in the subarea using the minval()
macro function:
Code Block |
---|
pmin=minvalminvalue(p) |
Finally, build the lists list for the values (scaling Pa units stored in the GRIB to hPa units):
Code Block |
---|
trVal= trVal & [vpmin/100] |
And also build the list of dates:
...
Hints:
- first, just try to add your Graph Plotting definition to the Macro. In the end return both the Input Visualiser and the Graph Plotting as a list like this:
Code Block |
---|
return [vis,graph] |
...
- next, compute the maximum of the pressure (with the
maxval maxvalue()
function) in the loop and store its values in another list. Build an input visualiser out of it (e.g. call itvis_max
). Add a Graph Plotting for it (e.g. call it graph_max) using a different colour. In the end you need to return a longer list like this:
...
add a Legend with disjoint mode. Use user text Set legend_text_composition to user_text_only and carefully set the legend_user_lines to provide a textual description to each curve in the legend. Add your legend to the back of the list you return from the macroMacro.
Doing the whole task in Macro
...