set_missing.f90

How to set a missing value in the header.

00001 ! Copyright 2005-2015 ECMWF
00002 ! This software is licensed under the terms of the Apache Licence Version 2.0
00003 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
00004 ! 
00005 ! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
00006 ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
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

Generated on Tue Sep 22 15:18:22 2009 for grib_api by  doxygen 1.5.3