00001 ! Copyright 2005-2007 ECMWF
00002 !
00003 ! Licensed under the GNU Lesser General Public License which
00004 ! incorporates the terms and conditions of version 3 of the GNU
00005 ! General Public License.
00006 ! See LICENSE and gpl-3.0.txt for details.
00007 !
00008 !
00009 ! Description: how to set missing a key value.
00010 !
00011 !
00012 ! Author: Enrico Fucile
00013 !
00014 !
00015 !
00016 program set
00017 use grib_api
00018 implicit none
00019 integer :: infile,outfile
00020 integer :: igrib
00021
00022 infile=5
00023 outfile=6
00024
00025 call grib_open_file(infile, &
00026 '../../data/reduced_gaussian_pressure_level.grib2','r')
00027
00028 call grib_open_file(outfile, &
00029 'out_surface_level.grib2','w')
00030
00031 ! a new grib message is loaded from file
00032 ! igrib is the grib id to be used in subsequent calls
00033 call grib_new_from_file(infile,igrib)
00034
00035 call grib_set(igrib,'typeOfFirstFixedSurface','sfc')
00036 call grib_set_missing(igrib,'scaleFactorOfFirstFixedSurface')
00037 call grib_set_missing(igrib,'scaledValueOfFirstFixedSurface')
00038
00039 call grib_write(igrib,outfile)
00040
00041 call grib_release(igrib)
00042
00043 call grib_close_file(infile)
00044
00045 call grib_close_file(outfile)
00046
00047 end program set