eccodes/examples/F90/grib_read_bytes.f90

28 lines
829 B
Fortran
Raw Normal View History

2024-01-08 13:42:39 +00:00
! (C) Copyright 2005- ECMWF.
!
! 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.
!
! 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.
!
!
2024-04-10 16:06:19 +00:00
program read_bytes
2024-01-08 13:42:39 +00:00
use eccodes
implicit none
integer :: ifile
integer :: intsize
parameter(intsize=10000)
2024-08-14 14:08:39 +00:00
character, dimension(intsize) :: bufferChar = ''
2024-01-08 13:42:39 +00:00
character(len=32) :: input_grib_file = '../../data/v.grib2'
call codes_open_file(ifile, input_grib_file, 'r')
! First 4 chars should be 'GRIB'
call codes_read_bytes(ifile, bufferChar, 4)
print*, bufferChar(1:5)
call codes_close_file(ifile)
end program