eccodes/examples/F90/set_missing_fortran.f90

44 lines
1.3 KiB
Fortran
Raw Permalink Normal View History

2020-01-28 14:32:34 +00:00
! (C) Copyright 2005- ECMWF.
2013-03-25 12:04:10 +00:00
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
2017-02-06 16:45:30 +00:00
!
2013-03-25 12:04:10 +00:00
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
!
! Description: how to set key values.
!
!
2024-01-13 17:14:08 +00:00
program set_missing_fortran
use eccodes
implicit none
integer :: infile, outfile
integer :: igrib
2013-03-25 12:04:10 +00:00
infile = 5
outfile = 6
2013-03-25 12:04:10 +00:00
call codes_open_file(infile, &
'../../data/reduced_gaussian_pressure_level.grib2', 'r')
2013-03-25 12:04:10 +00:00
call codes_open_file(outfile, &
'out_surface_level.grib2', 'w')
2013-03-25 12:04:10 +00:00
2021-10-13 15:47:23 +00:00
! A new GRIB message is loaded from file
! igrib is the GRIB id to be used in subsequent calls
call codes_grib_new_from_file(infile, igrib)
2013-03-25 12:04:10 +00:00
call codes_set(igrib, 'typeOfFirstFixedSurface', 'sfc')
call codes_set_missing(igrib, 'scaleFactorOfFirstFixedSurface')
call codes_set_missing(igrib, 'scaledValueOfFirstFixedSurface')
2013-03-25 12:04:10 +00:00
call codes_write(igrib, outfile)
2013-03-25 12:04:10 +00:00
call codes_release(igrib)
2013-03-25 12:04:10 +00:00
call codes_close_file(infile)
2013-03-25 12:04:10 +00:00
call codes_close_file(outfile)
2013-03-25 12:04:10 +00:00
2024-01-13 17:14:08 +00:00
end program