Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

A short example program is the best introduction to Magics programming. The following code contains enough comments to describe what the program is doing, and is followed by the plot that it generates.

 

Program: Using FORTRAN

 

 

Code Block
themeEclipse
titleExample Fortran program
linenumberstrue
PROGRAM MAGICS_EXAMPLE_FORTRAN

C This program shows an example of a simple MAGICS plot.

C We start MAGICS, load some data, set some plotting

C attributes then generate the plot. MAGICS is closed at

C the end.


C Open MAGICS and set the output device

CALL POPEN

CALL PSETC ('OUTPUT_FORMAT', 'PS')

CALL PSETC ('OUTPUT_NAME', 'using_fortran1')

CALL PSETC ('PAGE_ID_LINE_USER_TEXT','Using FORTRAN Interface')

C Pass the data to MAGICS

CALL PSETC ('GRIB_INPUT_FILE_NAME', 'data/z500.grb')

CALL PGRIB

C Set up and plot the coastlines

CALL PSETC ('MAP_COASTLINE_COLOUR', 'GREY')

CALL PSETC ('MAP_GRID_COLOUR','GREY')

CALL PCOAST

C Define and plot the contour

CALL PSETC ('CONTOUR_LINE_STYLE',

CALL PCONT

C Set up and plot the title text. We just use the default setting

C which generates an automatic title from the data.

CALL PTEXT

C Close MAGICS. It is this command that actually initiates the

C plotting.

CALL PCLOSE

STOP

END

 

 

 Image Added

 

Resultant Plot

Magics Initialisation Routines in FORTRAN

...