00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 program get_pl
00016 use grib_api
00017 implicit none
00018 integer :: infile
00019 integer :: igrib
00020 integer :: PLPresent, nb_pl
00021 real, dimension(:), allocatable :: pl
00022
00023
00024 call grib_open_file(infile, &
00025 '../../data/reduced_gaussian_surface.grib1','r')
00026
00027
00028
00029 call grib_new_from_file(infile,igrib)
00030
00031
00032 call grib_get(igrib,'PLPresent',PLPresent)
00033 print*, "PLPresent= ", PLPresent
00034 if (PLPresent == 1) then
00035 call grib_get_size(igrib,'pl',nb_pl)
00036 print*, "there are ", nb_pl, " PL values"
00037 allocate(pl(nb_pl))
00038 call grib_get(igrib,'pl',pl)
00039 print*, "pl = ", pl
00040 deallocate(pl)
00041 else
00042 print*, "There is no PL values in your GRIB message!"
00043 end if
00044 call grib_release(igrib)
00045
00046 call grib_close_file(infile)
00047
00048 end program get_pl