Example of a VM2 source table reader for Fortran90.
3 include
"meteo-vm2-fortran.h"
5 integer :: sourcehandle, errorcode
8 character (len=255) :: svalue
13 call meteovm2_source_open(sourcehandle, errorcode)
14 if (errorcode .ne. 0)
then
15 print *,
"Error while opening default source"
20 call meteovm2_get_station_attr(sourcehandle, 1,
"lon", ivalue, errorcode)
22 if (errorcode .ne. 0)
then
23 if (errorcode .eq. meteovm2_error_key_not_found)
then
24 print *,
"Key 'lon' not found"
26 print *,
"Error while reading station attribute 'lon'"
30 print *,
"Longitude: ", real(ivalue) / 100000
33 call meteovm2_get_station_attr(sourcehandle, 1,
"rep", svalue, errorcode)
34 if (errorcode .ne. 0)
then
35 if (errorcode .eq. meteovm2_error_key_not_found)
then
36 print *,
"Key 'rep' not found"
38 print *,
"Error while reading station attribute 'rep'"
42 print *,
"Report: ", trim(svalue)
46 call meteovm2_source_close(sourcehandle, errorcode)