...
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!
Scroll pdf ignore | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Steps
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].
...
Edit a new Input Visualiser icon and set the following:
Input Plot Type | Geo Points |
Input Longitude Values | -74 |
Input Latitude Values | 40.71 |
Create a new Symbol Plotting icon to plot this as a red marker (the filled circle is marker index 28) with some text for its legend entry.
...
Generate a macro which will reproduce your plot with a single click. This can be done either by clicking the Generate Macro button from the Display Window or by editing a new Macro icon, dropping your data and visdef icons into it and adding a plot()
command. Do it using the Generate Macro button and we will gain a little extra functionality for free. The generated macro will be called MacroFramework1; Metview rescans its folders every few seconds, so it might not appear immediately. Right-click and choose visualise to obtain our normal on-screen plot, or choose execute to generate a PDF file of the plot. Look at the generated Macro code to see how this is done! Different output formats will be studied in more depth in Working with graphical output.
Overlaying Both Fields
Visualise your Geographical View icon and drop the following icons into the Display Window:
- your Coastlines icon
- the msl.grib icon with your MSLP Contouring icon
- the precip.grib icon with your precipitation Contouring icon
Extra Work
Try the following if you have time.
Add another location marker
Washington DC is quite close, at coordinates 38.5N, 77W. Create another Input Visualiser icon (or make a copy of the New York one) and set these co-ordinates. Create another Symbol Plotting icon to plot this marker in green and ensure it has a correct name in its legend entry. Drop the two icons into your existing plot.
Using the cursor data to examine the grid point values
Activate the Cursor Data tool and see what it shows you when you have multiple data layers in your plot. Note that both sets of data are scaled from their units in the GRIB files.
Experiment with different
...
contouring schemes
The precipitation could of course be shaded differently - try some different colour schemes.
Experiment with different backgrounds
Modify the Coastlines icon, for example:
...
By setting Contour Min Level to 5, you can choose to quickly show only those areas with 5mm or more precipitation (look at a global map to see all of these areas).
Metview has a built-in facility for using the same contouring styles for certain fields as ecCharts does. Create a new Contouring icon and set Contour Automatic Setting to Ecchart and Grib Scaling of Derived Fields to On. With this setting, various parameters from the GRIB data are used to choose a contouring style (if it exists in the ecCharts style library). In fact, this same icon can be used for both fields!
...
Ensuring the title has the correct date and time
...
- this procedure will be covered in Customising Your Plot Title
- if you have a fieldset variable called
msl_grib
, the following line will extract the date at which the field is valid:msl_date = gribvalid_get_longdate(msl_grib, 'validityDate')
- we can do something similar for the validity time
- these are extracted as integer numbers, but can be combined into a proper date variable in Macro:
full_date = date(msl_date) + hour(msl_time)
- use the
string()
function to construct a date string similar to the one used in the current title- see String Functions for details of how to use it
- insert this into the
mtext()
function instead of the current title (ensure that we read the msl data and extract its date before defining the title) - it is now more robust - if you use data from a different date or time, the title will still be correct
- note that this method will not work directly if you want to generate an animation from different time steps of data
Experiment with different backgrounds and projections
Modify the Coastlines icon, for example:
- plot the US state boundaries
- try different land or sea shading colours
- change the frequency of the grid lines
Try a different Geographical View icon and set the projection to, for example, Mollweide. Drop this into the plot, then update the macro to use this new view (to do this, edit the macro, then drop your view icon into the editor towards the bottom of the code, where the view is defined; a little editing will be required to use your new view instead of the original one).