Example of a VM2 parser for Fortran90.
2 include
"meteo-vm2-fortran.h"
4 character (len=255) :: filename
5 integer :: parserhandle, errorcode
7 integer :: year, month, day, hour, mins, sec
8 integer :: station, variable
10 character (len=30) :: value3, flags
12 call getarg(1, filename)
13 filename = trim(filename)
16 call meteovm2_parser_open(parserhandle, filename, errorcode)
18 if (errorcode .ne. 0)
then
19 print *,
"Error while opening parser for file ", filename
25 call meteovm2_parser_next(parserhandle, havenext, &
26 year, month, day, hour, mins, sec, &
28 value1, value2, value3, flags, errorcode)
30 if (errorcode .ne. 0)
then
31 print *,
"Error while reading file"
35 if (.not. havenext)
then
36 print *,
"end of VM2 file reached"
40 print *,
"values: ", value1,
", ", value2,
", ", value3
45 call meteovm2_parser_close(parserhandle, errorcode)
47 if (errorcode .ne. 0)
then
48 print *,
"Error while closing parser"