MAGICS Tutorial
Introduction During the training course, we will present the functionalities of Magics. Most of the time we will use the fortran interface and MAGICS User Version, 6.11. We will also use MAGICS++ User Version, 2.6 to present the main differences between the two versions and discover the new functionalities of MAGICS++. In addtion, we will present how to use the new XML-Base interface called MagML.
Creating a Basic MAGICS Program First, create a new Fortran source file using your favourite text editor, for example vi or NEdit. Here is the code of your first basic MAGICS program: basic.f
Compiling using <productname>MAGICS++</productname> Type on an xterm window use newmagics++ pgf90 -o basic basic.f $MAGPLUSLIB_SHARED
Compiling using <productname>MAGICS</productname> Type on an xterm window use magics pgf90 -o basic basic.f $MAGLIB $EMOSLIB
Executing and visualising the result Type on an xterm window basic --> run the program gv basic.ps --> Visualise the postscript
Sending us a bug report Magics++ is still under development, it will help us a lot if you could send us any program that are not behaving the way you think they should. You can send the Fortran program in question to magplus@ecmwf.int by typing: mail magicsplus -s "magics course 2009" < your-fortran-file.f
Spot the differences! If you compare the two plots you can immediately see some differences.
Output from basic.f using <productname>MAGICS</productname>
Output from basic.f using <productname>MAGICS++</productname>
MAGICS++ MAGICS++ has black coastlines and grid by default Can you change your program in order to get a black coastlines and grid even when using MAGICS ? Try to add the following instructions call psetc ('map_grid_colour', 'black') call psetc ('map_coastline_colour', 'black') compile, execute and visualise again ...
Projection and coastlines In this first tutorial, we will learn how to set a geographical area and a projection. We will also discover the plotting attributes for coastlines You will have to use the following Magics routines PSETR to set the MAGICS parameters which expect real parameters PSETC to set the MAGICS parameters which expect character parameters PSETI to set the MAGICS parameters which expect integer parameters You will also use the following Action or Pseudo-Action routines PCOAST to draw the coastlines. PNEW to change page. PTEXT to add some titles.
Europe in cylindrical projection In the example we are going to plot a european map on cylindrical projection
The result
Requirements Here are our requirements Geographical Area : 15W/30N/40E/70N Grid setting : Coastlines:colour=tan, Grid: colour=tan, line-style=dot
Clues
Setting the geographical area Parameters for setting the geographical area Parameters Functions subpage_lower_left_latitude psetr subpage_lower_left_longitude psetr subpage_upper_right_latitude psetr subpage_upper_right_longitude psetr
Action routine for setting the geographical area Action routines pcoast
More information in .
Setting of the visual Attributes Parameters for setting the coastline attributes Parameters Functions map_coastline_colour psetc map_grid_colour psetc map_grid_line_style psetc
Action routine for setting the coastline attributes Action routines pcoast
More information on the coastlines parameters
Solution Here is the complete solution coast_01.f
Spot the differences... Output for Magics++ Output for Magics 6.11
Using MagML To get the same result, you can create the following magml description coast_1.magml
Contouring In this second tutorial, we will learn how to load a grib file and how to contour it. We will also discover the various attributes of the contour action routines. Download the data z500_tc.grib from http://www.ecmwf.int/publications/manuals/magics/magplus/data You will have use the following Action routines PCOAST to draw the coastlines. PCONT to add some isolines. PTEXT to add some titles. You will also have to use the following Magics routines PSETR to set the MAGICS parameters which expect real parameters PSETC to set the MAGICS parameters which expect character parameters PSETI to set the MAGICS parameters which expect integer parameters
Wind plotting In this section , we will learn how to load the components of the wind from a grib file and how to contour it. We will also discover the various attributes of the wind action routine. Download the data uv500_tc.grib from http://www.ecmwf.int/publications/manuals/magics/magplus/data You will have use the following Action routines PCOAST to draw the coastlines. PWIND to draw the wind. PCONT to add some contours. You will also have to use the following Magics routines PSETR to set the MAGICS parameters which expect real parameters PSETC to set the MAGICS parameters which expect character parameters PSETI to set the MAGICS parameters which expect integer parameters
Observation plotting In this section, we will learn how to filter observations from a bufr file and how to plot them. We will also discover the various attributes of the obs action routine. Please be aware that, because observation plotting is still in the devlopment stage, these examples are all run only with MAGICS 6.11. Download the data obs_tc.bfrfrom http://www.ecmwf.int/publications/manuals/magics/magplus/data You will have use the following Action routines PCOAST to draw the coastlines. POBS to plot the observations You will also to use the following Magics routines PSETR to set the MAGICS parameters which expect real parameters PSETC to set the MAGICS parameters which expect character parameters PSETI to set the MAGICS parameters which expect integer parameters
Graph plotting In this section , we will lear how to use the pgraph action routine. We will discover the various attributes of the graph plotting You will have use the following Action routines PAXIS to draw the axis and define the coordinates system. PGRAPH to plot the curves. You will also to use the following Magics routines PSET1R to set the MAGICS parameters which expect an array of real parameters PSETR to set the MAGICS parameters which expect real parameters PSETC to set the MAGICS parameters which expect character parameters PSETI to set the MAGICS parameters which expect integer parameters