mirror of https://github.com/ecmwf/eccodes.git
Testing: Fortran read bytes
This commit is contained in:
parent
808aa46225
commit
75d9b0ccc0
|
@ -50,6 +50,7 @@ if( HAVE_BUILD_TOOLS )
|
||||||
grib_copy_namespace
|
grib_copy_namespace
|
||||||
grib_read_message
|
grib_read_message
|
||||||
grib_read_from_file
|
grib_read_from_file
|
||||||
|
grib_read_bytes
|
||||||
grib_get_set_uuid
|
grib_get_set_uuid
|
||||||
grib_clone
|
grib_clone
|
||||||
grib_ecc-1316
|
grib_ecc-1316
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
! (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.
|
||||||
|
!
|
||||||
|
!
|
||||||
|
program grib_read_bytes
|
||||||
|
use eccodes
|
||||||
|
implicit none
|
||||||
|
integer :: ifile
|
||||||
|
integer :: intsize
|
||||||
|
parameter(intsize=10000)
|
||||||
|
character, dimension(intsize) :: bufferChar
|
||||||
|
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
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# (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.
|
||||||
|
|
||||||
|
. ./include.ctest.sh
|
||||||
|
|
||||||
|
${examples_dir}/eccodes_f_grib_read_bytes
|
|
@ -840,6 +840,7 @@ static int clear_bufr_keys_iterator(int keys_iterator_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
#if 0
|
||||||
int grib_f_read_any_headers_only_from_file_(int* fid, char* buffer, size_t* nbytes) {
|
int grib_f_read_any_headers_only_from_file_(int* fid, char* buffer, size_t* nbytes) {
|
||||||
grib_context* c;
|
grib_context* c;
|
||||||
int err=0;
|
int err=0;
|
||||||
|
@ -853,6 +854,7 @@ int grib_f_read_any_headers_only_from_file_(int* fid, char* buffer, size_t* nbyt
|
||||||
return GRIB_INVALID_FILE;
|
return GRIB_INVALID_FILE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int grib_f_read_any_from_file_(int* fid, void* buffer, size_t* nbytes) {
|
int grib_f_read_any_from_file_(int* fid, void* buffer, size_t* nbytes) {
|
||||||
|
|
Loading…
Reference in New Issue