mirror of https://github.com/ecmwf/eccodes.git
Merge branch 'develop' into feature/ECC-1620_sub-hourly
This commit is contained in:
commit
560702839d
|
@ -90,3 +90,5 @@ gfs.complex.mvmu.grib2
|
||||||
mercator.grib2
|
mercator.grib2
|
||||||
run_length_packing.grib2
|
run_length_packing.grib2
|
||||||
boustrophedonic.grib1
|
boustrophedonic.grib1
|
||||||
|
reduced_gaussian_sub_area.legacy.grib1
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Concept combinationOfAttributesOfTile
|
# Concept combinationOfAttributesOfTile
|
||||||
|
|
||||||
|
'UNDEF' = {attributeOfTile = [0];}
|
||||||
'UNMOD' = {attributeOfTile = [1];}
|
'UNMOD' = {attributeOfTile = [1];}
|
||||||
'SNOW' = {attributeOfTile = [2];}
|
'SNOW' = {attributeOfTile = [2];}
|
||||||
'FLOOD' = {attributeOfTile = [3];}
|
'FLOOD' = {attributeOfTile = [3];}
|
||||||
|
|
|
@ -39,14 +39,13 @@ alias ls.CCCC=CCCC;
|
||||||
alias ls.YY=YY;
|
alias ls.YY=YY;
|
||||||
alias ls.GG=GG;
|
alias ls.GG=GG;
|
||||||
alias ls.gg=gg;
|
alias ls.gg=gg;
|
||||||
position endOfHeadersMarker;
|
position endOfHeadersMarker;
|
||||||
|
|
||||||
message[4] theMessage;
|
message[4] theMessage;
|
||||||
|
|
||||||
meta lengthOfHeaders evaluate( endOfHeadersMarker-startOfHeaders);
|
meta lengthOfHeaders evaluate(endOfHeadersMarker-startOfHeaders);
|
||||||
meta md5Headers md5(startOfHeaders,lengthOfHeaders);
|
meta md5Headers md5(startOfHeaders, lengthOfHeaders);
|
||||||
|
|
||||||
ascii[4] endMark;
|
ascii[4] endMark;
|
||||||
position totalLength;
|
position totalLength;
|
||||||
alias ls.totalLength=totalLength;
|
alias ls.totalLength=totalLength;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ if( HAVE_BUILD_TOOLS )
|
||||||
list( APPEND tests_extra
|
list( APPEND tests_extra
|
||||||
grib_index
|
grib_index
|
||||||
codes_dump
|
codes_dump
|
||||||
|
codes_scan_file
|
||||||
|
codes_load_file
|
||||||
grib_copy_message
|
grib_copy_message
|
||||||
bufr_copy_message
|
bufr_copy_message
|
||||||
grib_get_keys
|
grib_get_keys
|
||||||
|
@ -36,6 +38,7 @@ if( HAVE_BUILD_TOOLS )
|
||||||
grib_elements
|
grib_elements
|
||||||
grib_nearest
|
grib_nearest
|
||||||
grib_nearest_single
|
grib_nearest_single
|
||||||
|
grib_nearest_four_single
|
||||||
grib_precision
|
grib_precision
|
||||||
grib_print_data
|
grib_print_data
|
||||||
grib_set_keys
|
grib_set_keys
|
||||||
|
@ -89,6 +92,7 @@ else()
|
||||||
grib_nearest
|
grib_nearest
|
||||||
grib_elements
|
grib_elements
|
||||||
grib_nearest_single
|
grib_nearest_single
|
||||||
|
grib_nearest_four_single
|
||||||
grib_precision
|
grib_precision
|
||||||
grib_print_data
|
grib_print_data
|
||||||
grib_set_missing
|
grib_set_missing
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
! (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 codes_load_file
|
||||||
|
use eccodes
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
integer :: ifile, cnt, level, step
|
||||||
|
integer :: i, igrib, iret
|
||||||
|
character(len=32) :: infile_name = '../../data/index.grib'
|
||||||
|
|
||||||
|
call codes_open_file(ifile, infile_name, 'r')
|
||||||
|
|
||||||
|
call codes_any_load_all_from_file(ifile, cnt)
|
||||||
|
|
||||||
|
i = 45
|
||||||
|
call codes_any_new_from_loaded(i, igrib)
|
||||||
|
call codes_get(igrib, 'level', level)
|
||||||
|
call codes_get(igrib, 'stepRange', step)
|
||||||
|
|
||||||
|
print *, 'Num messages=', cnt
|
||||||
|
print *, 'Msg ',i,' level=',level, ' step=', step
|
||||||
|
|
||||||
|
call codes_release(igrib)
|
||||||
|
|
||||||
|
! Invalid msg number
|
||||||
|
i = 450
|
||||||
|
call codes_any_new_from_loaded(i, igrib, iret)
|
||||||
|
if (iret /= GRIB_INVALID_ARGUMENT) then
|
||||||
|
call codes_check(iret, 'Error', 'codes_any_new_from_loaded should have failed')
|
||||||
|
else
|
||||||
|
print *,'Invalid message index returned error (as expected)'
|
||||||
|
end if
|
||||||
|
|
||||||
|
call codes_close_file(ifile)
|
||||||
|
|
||||||
|
end program
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/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
|
||||||
|
|
||||||
|
label='eccodes_f_codes_load_file'
|
||||||
|
temp=temp.$label.txt
|
||||||
|
|
||||||
|
# The input file is hard coded => data/index.grib
|
||||||
|
${examples_dir}/eccodes_f_codes_load_file > $temp
|
||||||
|
|
||||||
|
grep -q "Num messages= *384" $temp
|
||||||
|
grep -q "level= *700 step= *60" $temp
|
||||||
|
|
||||||
|
rm -f $temp
|
|
@ -0,0 +1,43 @@
|
||||||
|
! (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 codes_scan_file
|
||||||
|
use eccodes
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
integer :: ifile, cnt, level, step
|
||||||
|
integer :: i, igrib, iret
|
||||||
|
character(len=32) :: infile_name = '../../data/index.grib'
|
||||||
|
|
||||||
|
call codes_open_file(ifile, infile_name, 'r')
|
||||||
|
|
||||||
|
call codes_any_scan_file(ifile,cnt)
|
||||||
|
|
||||||
|
i = 45
|
||||||
|
call codes_any_new_from_scanned_file(ifile, i, igrib)
|
||||||
|
call codes_get(igrib, 'level', level)
|
||||||
|
call codes_get(igrib, 'stepRange', step)
|
||||||
|
|
||||||
|
print *, 'Num messages=', cnt
|
||||||
|
print *, 'Msg ',i,' level=',level, ' step=', step
|
||||||
|
|
||||||
|
call codes_release(igrib)
|
||||||
|
|
||||||
|
! Invalid msg number
|
||||||
|
i = 450
|
||||||
|
call codes_any_new_from_scanned_file(ifile, i, igrib, iret)
|
||||||
|
if (iret /= GRIB_INVALID_ARGUMENT) then
|
||||||
|
call codes_check(iret, 'Error', 'codes_any_new_from_scanned_file should have failed')
|
||||||
|
else
|
||||||
|
print *,'Invalid message index returned error (as expected)'
|
||||||
|
end if
|
||||||
|
|
||||||
|
call codes_close_file(ifile)
|
||||||
|
|
||||||
|
end program
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/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
|
||||||
|
|
||||||
|
label='eccodes_f_codes_scan_file'
|
||||||
|
temp=temp.$label.txt
|
||||||
|
|
||||||
|
# The input file is hard coded => data/index.grib
|
||||||
|
${examples_dir}/eccodes_f_codes_scan_file > $temp
|
||||||
|
|
||||||
|
grep -q "Num messages= *384" $temp
|
||||||
|
grep -q "level= *700 step= *60" $temp
|
||||||
|
|
||||||
|
rm -f $temp
|
|
@ -23,7 +23,7 @@ program index
|
||||||
character(len=20) :: oshortName
|
character(len=20) :: oshortName
|
||||||
integer :: shortNameSize, numberSize, levelSize, stepSize
|
integer :: shortNameSize, numberSize, levelSize, stepSize
|
||||||
integer :: i, j, k, l
|
integer :: i, j, k, l
|
||||||
integer :: idx, igrib, count1
|
integer :: idx, idx1, igrib, count1
|
||||||
character(len=10) :: index_file = 'index.idx'
|
character(len=10) :: index_file = 'index.idx'
|
||||||
|
|
||||||
! uncomment following line to load index from file
|
! uncomment following line to load index from file
|
||||||
|
@ -107,7 +107,10 @@ program index
|
||||||
! save the index to a file for later reuse
|
! save the index to a file for later reuse
|
||||||
call codes_index_write(idx, index_file)
|
call codes_index_write(idx, index_file)
|
||||||
|
|
||||||
|
call codes_index_read(idx1, index_file)
|
||||||
|
|
||||||
call codes_index_release(idx)
|
call codes_index_release(idx)
|
||||||
|
call codes_index_release(idx1)
|
||||||
|
|
||||||
deallocate (level)
|
deallocate (level)
|
||||||
deallocate (shortName)
|
deallocate (shortName)
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
! (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 find_nearest_4single
|
||||||
|
use eccodes
|
||||||
|
implicit none
|
||||||
|
integer :: infile, i
|
||||||
|
integer :: igrib
|
||||||
|
real(8) :: inlat = 5, inlon = 10
|
||||||
|
real(8) :: outlats(4), outlons(4)
|
||||||
|
real(8) :: values(4), distances(4)
|
||||||
|
integer(kind=kindOfInt) :: indexes(4)
|
||||||
|
|
||||||
|
call codes_open_file(infile, '../../data/reduced_gaussian_lsm.grib1', 'r')
|
||||||
|
call codes_grib_new_from_file(infile, igrib)
|
||||||
|
|
||||||
|
call codes_grib_find_nearest_four_single(igrib, .true., inlat, inlon, outlats, outlons, values, distances, indexes)
|
||||||
|
call codes_release(igrib)
|
||||||
|
|
||||||
|
call codes_close_file(infile)
|
||||||
|
|
||||||
|
print *, ' outlats outlons values distances indexes'
|
||||||
|
do i = 1, 4
|
||||||
|
write (*, '(F10.3, F10.3, F10.5, F10.3, I8)') outlats(i), outlons(i), values(i), distances(i), indexes(i)
|
||||||
|
end do
|
||||||
|
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_nearest_four_single
|
|
@ -13,7 +13,8 @@ program set_data_force
|
||||||
integer :: outfile
|
integer :: outfile
|
||||||
integer :: i, igrib, iret, numberOfValues, cnt
|
integer :: i, igrib, iret, numberOfValues, cnt
|
||||||
real :: d, e
|
real :: d, e
|
||||||
real, dimension(:), allocatable :: values
|
real(4), dimension(:), allocatable :: values_real4
|
||||||
|
real(8), dimension(:), allocatable :: values_real8
|
||||||
integer, parameter :: max_strsize = 200
|
integer, parameter :: max_strsize = 200
|
||||||
character(len=max_strsize) :: outfile_name
|
character(len=max_strsize) :: outfile_name
|
||||||
|
|
||||||
|
@ -24,7 +25,8 @@ program set_data_force
|
||||||
|
|
||||||
call codes_get_size(igrib, 'values', numberOfValues)
|
call codes_get_size(igrib, 'values', numberOfValues)
|
||||||
|
|
||||||
allocate (values(numberOfValues), stat=iret)
|
allocate (values_real4(numberOfValues), stat=iret)
|
||||||
|
allocate (values_real8(numberOfValues), stat=iret)
|
||||||
d = 10e-8
|
d = 10e-8
|
||||||
e = d
|
e = d
|
||||||
cnt = 1
|
cnt = 1
|
||||||
|
@ -33,7 +35,8 @@ program set_data_force
|
||||||
e = e*10
|
e = e*10
|
||||||
cnt = 1
|
cnt = 1
|
||||||
end if
|
end if
|
||||||
values(i) = d
|
values_real4(i) = d
|
||||||
|
values_real8(i) = d
|
||||||
d = d + e
|
d = d + e
|
||||||
cnt = cnt + 1
|
cnt = cnt + 1
|
||||||
end do
|
end do
|
||||||
|
@ -42,9 +45,11 @@ program set_data_force
|
||||||
call codes_set(igrib, 'bitmapPresent', 1)
|
call codes_set(igrib, 'bitmapPresent', 1)
|
||||||
|
|
||||||
! set data values
|
! set data values
|
||||||
call codes_set_force(igrib, 'codedValues', values)
|
call codes_set_force(igrib, 'codedValues', values_real4)
|
||||||
|
call codes_set_force(igrib, 'codedValues', values_real8)
|
||||||
call codes_write(igrib, outfile)
|
call codes_write(igrib, outfile)
|
||||||
call codes_release(igrib)
|
call codes_release(igrib)
|
||||||
deallocate (values)
|
deallocate (values_real4)
|
||||||
|
deallocate (values_real8)
|
||||||
|
|
||||||
end program set_data_force
|
end program set_data_force
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
# (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.
|
|
||||||
|
|
||||||
CMAKE_INCLUDE_FILE=include.ctest.sh
|
|
||||||
if [ -f "$CMAKE_INCLUDE_FILE" ]; then
|
|
||||||
# This is the config file for Cmake tests
|
|
||||||
. ./$CMAKE_INCLUDE_FILE
|
|
||||||
|
|
||||||
else
|
|
||||||
set -eax
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "TEST: $0"
|
|
||||||
|
|
||||||
if [ -z "${data_dir}" ]
|
|
||||||
then
|
|
||||||
cd ../../
|
|
||||||
cpath=`pwd`
|
|
||||||
ECCODES_DEFINITION_PATH=$cpath/definitions
|
|
||||||
export ECCODES_DEFINITION_PATH
|
|
||||||
ECCODES_SAMPLES_PATH=$cpath/samples
|
|
||||||
export ECCODES_SAMPLES_PATH
|
|
||||||
tools_dir=$cpath/tools
|
|
||||||
examples_dir=$cpath/examples/F90
|
|
||||||
data_dir=$cpath/data
|
|
||||||
samples_dir=$cpath/samples
|
|
||||||
|
|
||||||
if test "x$ECCODES_TEST_WITH_VALGRIND" != "x"; then
|
|
||||||
tools_dir="valgrind --error-exitcode=1 -q $cpath/tools"
|
|
||||||
examples_dir="valgrind --error-exitcode=1 -q $cpath/examples/F90"
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "Skipping test $0"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd "$cpath/examples/F90"
|
|
||||||
|
|
||||||
if [ -z "${GRIB_API_INCLUDE}" ]
|
|
||||||
then
|
|
||||||
GRIB_API_INCLUDE=`pwd`/src
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${GRIB_API_LIB}" ]
|
|
||||||
then
|
|
||||||
GRIB_API_LIB=`pwd`/src
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Download the data needed for tests
|
|
||||||
${data_dir}/download.sh "${data_dir}"
|
|
||||||
|
|
||||||
set -u
|
|
||||||
fi
|
|
|
@ -1,32 +0,0 @@
|
||||||
CMAKE_INCLUDE_FILE=include.ctest.sh
|
|
||||||
if [ -f "$CMAKE_INCLUDE_FILE" ]; then
|
|
||||||
# This is the config file for Cmake tests
|
|
||||||
. ./$CMAKE_INCLUDE_FILE
|
|
||||||
|
|
||||||
else
|
|
||||||
set -eax
|
|
||||||
echo
|
|
||||||
echo "TEST: $0"
|
|
||||||
|
|
||||||
cpath=$TOPBUILDDIR
|
|
||||||
ECCODES_DEFINITION_PATH=$cpath/definitions
|
|
||||||
export ECCODES_DEFINITION_PATH
|
|
||||||
ECCODES_SAMPLES_PATH=$cpath/samples
|
|
||||||
export ECCODES_SAMPLES_PATH
|
|
||||||
tools_dir=$cpath/tools
|
|
||||||
examples_dir=$cpath/examples/python
|
|
||||||
data_dir=$cpath/data
|
|
||||||
examples_src=$examples_dir
|
|
||||||
|
|
||||||
PYTHONPATH=$cpath/python:$cpath/python/.libs:$PYTHONPATH
|
|
||||||
export PYTHONPATH
|
|
||||||
|
|
||||||
HAVE_MEMFS=0
|
|
||||||
ECCODES_ON_WINDOWS=0
|
|
||||||
|
|
||||||
# Download the data needed for tests
|
|
||||||
${data_dir}/download.sh "${data_dir}"
|
|
||||||
|
|
||||||
set -u
|
|
||||||
|
|
||||||
fi
|
|
|
@ -1439,117 +1439,126 @@ int any_f_scan_file_(int* fid, int* n) {
|
||||||
grib_context* c=grib_context_get_default();
|
grib_context* c=grib_context_get_default();
|
||||||
|
|
||||||
/* this needs a callback to a destructor*/
|
/* this needs a callback to a destructor*/
|
||||||
/* grib_oarray_delete_content(c,binary_messages); */
|
/* grib_oarray_delete_content(c, info_messages); */
|
||||||
|
|
||||||
grib_oarray_delete(c,info_messages);
|
grib_oarray_delete(c, info_messages);
|
||||||
info_messages=grib_oarray_new(c,1000,1000);
|
info_messages=grib_oarray_new(c, 1000, 1000);
|
||||||
|
|
||||||
if (f) {
|
if (f) {
|
||||||
while (err!=GRIB_END_OF_FILE) {
|
while (err!=GRIB_END_OF_FILE) {
|
||||||
data = wmo_read_any_from_file_malloc ( f, 0,&olen,&offset,&err );
|
data = wmo_read_any_from_file_malloc ( f, 0, &olen, &offset, &err );
|
||||||
msg=(l_message_info*)grib_context_malloc_clear(c,sizeof(l_message_info));
|
msg=(l_message_info*)grib_context_malloc_clear(c,sizeof(l_message_info));
|
||||||
msg->offset=offset;
|
msg->offset = offset;
|
||||||
msg->size=olen;
|
msg->size = olen;
|
||||||
|
|
||||||
if (err==0 && data) grib_oarray_push(c,info_messages,msg);
|
if (err == 0 && data) grib_oarray_push(c, info_messages, msg);
|
||||||
grib_context_free(c,data);
|
grib_context_free(c, data);
|
||||||
}
|
}
|
||||||
if (err==GRIB_END_OF_FILE) err=0;
|
if (err == GRIB_END_OF_FILE) err = 0;
|
||||||
}
|
}
|
||||||
*n=info_messages->n;
|
*n = info_messages->n;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int any_f_new_from_scanned_file_(int* fid,int* msgid,int* gid)
|
int any_f_new_from_scanned_file_(int* fid, int* msgid, int* gid)
|
||||||
{
|
{
|
||||||
grib_handle *h = NULL;
|
grib_handle *h = NULL;
|
||||||
grib_context* c=grib_context_get_default();
|
grib_context* c = grib_context_get_default();
|
||||||
int err=0;
|
int err = 0;
|
||||||
FILE* f = get_file(*fid);
|
FILE* f = get_file(*fid);
|
||||||
|
l_message_info* msg = NULL;
|
||||||
|
|
||||||
/* fortran convention of 1 based index*/
|
/* fortran convention of 1-based index */
|
||||||
const int n=*msgid-1;
|
const int n = *msgid - 1;
|
||||||
|
|
||||||
l_message_info* msg=(l_message_info*)grib_oarray_get(info_messages,n);
|
if (info_messages == NULL) {
|
||||||
|
return GRIB_INVALID_ARGUMENT;
|
||||||
|
}
|
||||||
|
if (*msgid < 1 || *msgid > info_messages->n) {
|
||||||
|
return GRIB_INVALID_ARGUMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = (l_message_info*)grib_oarray_get(info_messages, n);
|
||||||
|
|
||||||
if (msg && f) {
|
if (msg && f) {
|
||||||
GRIB_MUTEX_INIT_ONCE(&once,&init);
|
GRIB_MUTEX_INIT_ONCE(&once, &init);
|
||||||
GRIB_MUTEX_LOCK(&read_mutex);
|
GRIB_MUTEX_LOCK(&read_mutex);
|
||||||
fseeko(f,msg->offset,SEEK_SET);
|
fseeko(f, msg->offset, SEEK_SET);
|
||||||
h=any_new_from_file (c,f,&err);
|
h = any_new_from_file (c, f, &err);
|
||||||
GRIB_MUTEX_UNLOCK(&read_mutex);
|
GRIB_MUTEX_UNLOCK(&read_mutex);
|
||||||
}
|
}
|
||||||
if (err) return err;
|
if (err) return err;
|
||||||
|
|
||||||
if(h){
|
if (h) {
|
||||||
push_handle(h,gid);
|
push_handle(h, gid);
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
*gid=-1;
|
*gid = -1;
|
||||||
return GRIB_END_OF_FILE;
|
return GRIB_END_OF_FILE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int any_f_load_all_from_file_(int* fid,int* n) {
|
int any_f_load_all_from_file_(int* fid, int* n) {
|
||||||
int err = 0;
|
int err = 0;
|
||||||
off_t offset=0;
|
off_t offset=0;
|
||||||
void *data = NULL;
|
void* data = NULL;
|
||||||
size_t olen = 0;
|
size_t olen = 0;
|
||||||
l_binary_message* msg=0;
|
l_binary_message* msg=0;
|
||||||
FILE* f = get_file(*fid);
|
FILE* f = get_file(*fid);
|
||||||
grib_context* c=grib_context_get_default();
|
grib_context* c = grib_context_get_default();
|
||||||
|
|
||||||
/* this needs a callback to a destructor*/
|
/* this needs a callback to a destructor*/
|
||||||
/* grib_oarray_delete_content(c,binary_messages); */
|
/* grib_oarray_delete_content(c, binary_messages); */
|
||||||
|
|
||||||
grib_oarray_delete(c,binary_messages);
|
grib_oarray_delete(c, binary_messages);
|
||||||
binary_messages=grib_oarray_new(c,1000,1000);
|
binary_messages = grib_oarray_new(c, 1000, 1000);
|
||||||
|
|
||||||
if (f) {
|
if (f) {
|
||||||
while (err!=GRIB_END_OF_FILE) {
|
while (err != GRIB_END_OF_FILE) {
|
||||||
data = wmo_read_any_from_file_malloc ( f, 0,&olen,&offset,&err );
|
data = wmo_read_any_from_file_malloc (f, 0,&olen, &offset, &err);
|
||||||
msg=(l_binary_message*)grib_context_malloc_clear(c,sizeof(l_binary_message));
|
msg = (l_binary_message*)grib_context_malloc_clear(c,sizeof(l_binary_message));
|
||||||
msg->data=data;
|
msg->data = data;
|
||||||
msg->size=olen;
|
msg->size = olen;
|
||||||
|
|
||||||
if (err==0 && data) grib_oarray_push(c,binary_messages,msg);
|
if (err == 0 && data) grib_oarray_push(c, binary_messages, msg);
|
||||||
}
|
}
|
||||||
if (err==GRIB_END_OF_FILE) err=0;
|
if (err == GRIB_END_OF_FILE) err = 0;
|
||||||
}
|
}
|
||||||
*n=binary_messages->n;
|
*n = binary_messages->n;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int any_f_new_from_loaded_(int* msgid,int* gid)
|
int any_f_new_from_loaded_(int* msgid, int* gid)
|
||||||
{
|
{
|
||||||
grib_handle *h = NULL;
|
grib_handle* h = NULL;
|
||||||
grib_context* c=grib_context_get_default();
|
grib_context* c = grib_context_get_default();
|
||||||
|
|
||||||
/* fortran convention of 1 based index*/
|
/* fortran convention of 1 based index*/
|
||||||
const int n=*msgid-1;
|
const int n = *msgid - 1;
|
||||||
|
|
||||||
l_binary_message* msg=(l_binary_message*)grib_oarray_get(binary_messages,n);
|
l_binary_message* msg = (l_binary_message*)grib_oarray_get(binary_messages, n);
|
||||||
|
|
||||||
if (msg && msg->data)
|
if (msg && msg->data)
|
||||||
h=grib_handle_new_from_message_copy (c,msg->data,msg->size);
|
h = grib_handle_new_from_message_copy(c, msg->data, msg->size);
|
||||||
|
|
||||||
if(h){
|
if (h) {
|
||||||
push_handle(h,gid);
|
push_handle(h, gid);
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
} else {
|
}
|
||||||
*gid=-1;
|
else {
|
||||||
|
*gid = -1;
|
||||||
return GRIB_END_OF_FILE;
|
return GRIB_END_OF_FILE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int codes_f_clear_loaded_from_file_(void) {
|
int codes_f_clear_loaded_from_file_(void) {
|
||||||
grib_context* c=grib_context_get_default();
|
grib_context* c = grib_context_get_default();
|
||||||
/* grib_oarray_delete_content(c,binary_messages); */
|
/* grib_oarray_delete_content(c,binary_messages); */
|
||||||
grib_oarray_delete(c,binary_messages);
|
grib_oarray_delete(c, binary_messages);
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1557,27 +1566,28 @@ int codes_f_clear_loaded_from_file_(void) {
|
||||||
int grib_f_count_in_file_(int* fid,int* n) {
|
int grib_f_count_in_file_(int* fid,int* n) {
|
||||||
int err = 0;
|
int err = 0;
|
||||||
FILE* f = get_file(*fid);
|
FILE* f = get_file(*fid);
|
||||||
if (f) err=grib_count_in_file(0, f,n);
|
if (f) err = grib_count_in_file(0, f, n);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int any_f_new_from_file_(int* fid, int* gid){
|
int any_f_new_from_file_(int* fid, int* gid) {
|
||||||
int err = 0;
|
int err = 0;
|
||||||
FILE* f = get_file(*fid);
|
FILE* f = get_file(*fid);
|
||||||
grib_handle *h = NULL;
|
grib_handle* h = NULL;
|
||||||
|
|
||||||
if(f){
|
if (f) {
|
||||||
h = codes_handle_new_from_file(0,f,PRODUCT_ANY,&err);
|
h = codes_handle_new_from_file(0, f, PRODUCT_ANY, &err);
|
||||||
if(h){
|
if (h) {
|
||||||
push_handle(h,gid);
|
push_handle(h, gid);
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
} else {
|
}
|
||||||
*gid=-1;
|
else {
|
||||||
|
*gid = -1;
|
||||||
return GRIB_END_OF_FILE;
|
return GRIB_END_OF_FILE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*gid=-1;
|
*gid = -1;
|
||||||
return GRIB_INVALID_FILE;
|
return GRIB_INVALID_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -1020,8 +1020,6 @@ int wmo_read_any_from_file(FILE* f, void* buffer, size_t* len);
|
||||||
int wmo_read_grib_from_file(FILE* f, void* buffer, size_t* len);
|
int wmo_read_grib_from_file(FILE* f, void* buffer, size_t* len);
|
||||||
int wmo_read_bufr_from_file(FILE* f, void* buffer, size_t* len);
|
int wmo_read_bufr_from_file(FILE* f, void* buffer, size_t* len);
|
||||||
int wmo_read_gts_from_file(FILE* f, void* buffer, size_t* len);
|
int wmo_read_gts_from_file(FILE* f, void* buffer, size_t* len);
|
||||||
int wmo_read_taf_from_file(FILE* f, void* buffer, size_t* len);
|
|
||||||
int wmo_read_metar_from_file(FILE* f, void* buffer, size_t* len);
|
|
||||||
int wmo_read_any_from_file_fast(FILE* f, size_t* msg_len, off_t* msg_offset);
|
int wmo_read_any_from_file_fast(FILE* f, size_t* msg_len, off_t* msg_offset);
|
||||||
int wmo_read_grib_from_file_fast(FILE* f, size_t* msg_len, off_t* msg_offset);
|
int wmo_read_grib_from_file_fast(FILE* f, size_t* msg_len, off_t* msg_offset);
|
||||||
int wmo_read_bufr_from_file_fast(FILE* f, size_t* msg_len, off_t* msg_offset);
|
int wmo_read_bufr_from_file_fast(FILE* f, size_t* msg_len, off_t* msg_offset);
|
||||||
|
@ -1162,8 +1160,6 @@ int grib_set_float_array(grib_handle* h, const char* name, const float* val, siz
|
||||||
int grib_set_long_array_internal(grib_handle* h, const char* name, const long* val, size_t length);
|
int grib_set_long_array_internal(grib_handle* h, const char* name, const long* val, size_t length);
|
||||||
int grib_set_long_array(grib_handle* h, const char* name, const long* val, size_t length);
|
int grib_set_long_array(grib_handle* h, const char* name, const long* val, size_t length);
|
||||||
int grib_get_long_internal(grib_handle* h, const char* name, long* val);
|
int grib_get_long_internal(grib_handle* h, const char* name, long* val);
|
||||||
int grib_is_in_dump(const grib_handle* h, const char* name);
|
|
||||||
int grib_attributes_count(const grib_accessor* a, size_t* size);
|
|
||||||
int grib_get_long(const grib_handle* h, const char* name, long* val);
|
int grib_get_long(const grib_handle* h, const char* name, long* val);
|
||||||
int grib_get_double_internal(grib_handle* h, const char* name, double* val);
|
int grib_get_double_internal(grib_handle* h, const char* name, double* val);
|
||||||
int grib_get_double(const grib_handle* h, const char* name, double* val);
|
int grib_get_double(const grib_handle* h, const char* name, double* val);
|
||||||
|
@ -1201,9 +1197,6 @@ int grib_get_string_array(const grib_handle* h, const char* name, char** val, si
|
||||||
int ecc__grib_get_long_array_internal(const grib_handle* h, grib_accessor* a, long* val, size_t buffer_len, size_t* decoded_length);
|
int ecc__grib_get_long_array_internal(const grib_handle* h, grib_accessor* a, long* val, size_t buffer_len, size_t* decoded_length);
|
||||||
int grib_get_long_array_internal(grib_handle* h, const char* name, long* val, size_t* length);
|
int grib_get_long_array_internal(grib_handle* h, const char* name, long* val, size_t* length);
|
||||||
int grib_get_long_array(const grib_handle* h, const char* name, long* val, size_t* length);
|
int grib_get_long_array(const grib_handle* h, const char* name, long* val, size_t* length);
|
||||||
grib_key_value_list* grib_key_value_list_clone(grib_context* c, grib_key_value_list* list);
|
|
||||||
void grib_key_value_list_delete(grib_context* c, grib_key_value_list* kvl);
|
|
||||||
int grib_get_key_value_list(grib_handle* h, grib_key_value_list* list);
|
|
||||||
int grib_get_values(grib_handle* h, grib_values* args, size_t count);
|
int grib_get_values(grib_handle* h, grib_values* args, size_t count);
|
||||||
int grib_set_values(grib_handle* h, grib_values* args, size_t count);
|
int grib_set_values(grib_handle* h, grib_values* args, size_t count);
|
||||||
int grib_get_nearest_smaller_value(grib_handle* h, const char* name, double val, double* nearest);
|
int grib_get_nearest_smaller_value(grib_handle* h, const char* name, double val, double* nearest);
|
||||||
|
|
|
@ -428,6 +428,8 @@ grib_handle* codes_handle_new_from_file(grib_context* c, FILE* f, ProductKind pr
|
||||||
return metar_new_from_file(c, f, error);
|
return metar_new_from_file(c, f, error);
|
||||||
if (product == PRODUCT_GTS)
|
if (product == PRODUCT_GTS)
|
||||||
return gts_new_from_file(c, f, error);
|
return gts_new_from_file(c, f, error);
|
||||||
|
//if (product == PRODUCT_TAF)
|
||||||
|
// return taf_new_from_file(c, f, error);
|
||||||
if (product == PRODUCT_ANY)
|
if (product == PRODUCT_ANY)
|
||||||
return any_new_from_file(c, f, error);
|
return any_new_from_file(c, f, error);
|
||||||
|
|
||||||
|
|
|
@ -1267,57 +1267,49 @@ int wmo_read_gts_from_file(FILE* f, void* buffer, size_t* len)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wmo_read_taf_from_file(FILE* f, void* buffer, size_t* len)
|
// int wmo_read_taf_from_file(FILE* f, void* buffer, size_t* len)
|
||||||
{
|
// {
|
||||||
int err;
|
// int err;
|
||||||
user_buffer_t u;
|
// user_buffer_t u;
|
||||||
reader r;
|
// reader r;
|
||||||
|
// u.user_buffer = buffer;
|
||||||
|
// u.buffer_size = *len;
|
||||||
|
// r.read_data = f;
|
||||||
|
// r.read = &stdio_read;
|
||||||
|
// r.alloc_data = &u;
|
||||||
|
// r.alloc = &user_provider_buffer;
|
||||||
|
// r.headers_only = 0;
|
||||||
|
// r.seek = &stdio_seek;
|
||||||
|
// r.seek_from_start = &stdio_seek_from_start;
|
||||||
|
// r.tell = &stdio_tell;
|
||||||
|
// r.offset = 0;
|
||||||
|
// r.message_size = 0;
|
||||||
|
// err = read_any_taf(&r);
|
||||||
|
// *len = r.message_size;
|
||||||
|
// return err;
|
||||||
|
// }
|
||||||
|
|
||||||
u.user_buffer = buffer;
|
// int wmo_read_metar_from_file(FILE* f, void* buffer, size_t* len)
|
||||||
u.buffer_size = *len;
|
// {
|
||||||
|
// int err;
|
||||||
r.read_data = f;
|
// user_buffer_t u;
|
||||||
r.read = &stdio_read;
|
// reader r;
|
||||||
r.alloc_data = &u;
|
// u.user_buffer = buffer;
|
||||||
r.alloc = &user_provider_buffer;
|
// u.buffer_size = *len;
|
||||||
r.headers_only = 0;
|
// r.read_data = f;
|
||||||
r.seek = &stdio_seek;
|
// r.read = &stdio_read;
|
||||||
r.seek_from_start = &stdio_seek_from_start;
|
// r.alloc_data = &u;
|
||||||
r.tell = &stdio_tell;
|
// r.alloc = &user_provider_buffer;
|
||||||
r.offset = 0;
|
// r.headers_only = 0;
|
||||||
r.message_size = 0;
|
// r.seek = &stdio_seek;
|
||||||
|
// r.seek_from_start = &stdio_seek_from_start;
|
||||||
err = read_any_taf(&r);
|
// r.tell = &stdio_tell;
|
||||||
*len = r.message_size;
|
// r.offset = 0;
|
||||||
|
// r.message_size = 0;
|
||||||
return err;
|
// err = read_any_metar(&r);
|
||||||
}
|
// *len = r.message_size;
|
||||||
|
// return err;
|
||||||
int wmo_read_metar_from_file(FILE* f, void* buffer, size_t* len)
|
// }
|
||||||
{
|
|
||||||
int err;
|
|
||||||
user_buffer_t u;
|
|
||||||
reader r;
|
|
||||||
|
|
||||||
u.user_buffer = buffer;
|
|
||||||
u.buffer_size = *len;
|
|
||||||
|
|
||||||
r.read_data = f;
|
|
||||||
r.read = &stdio_read;
|
|
||||||
r.alloc_data = &u;
|
|
||||||
r.alloc = &user_provider_buffer;
|
|
||||||
r.headers_only = 0;
|
|
||||||
r.seek = &stdio_seek;
|
|
||||||
r.seek_from_start = &stdio_seek_from_start;
|
|
||||||
r.tell = &stdio_tell;
|
|
||||||
r.offset = 0;
|
|
||||||
r.message_size = 0;
|
|
||||||
|
|
||||||
err = read_any_metar(&r);
|
|
||||||
*len = r.message_size;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*================== */
|
/*================== */
|
||||||
|
|
||||||
|
@ -1731,7 +1723,6 @@ int grib_read_any_from_memory(grib_context* ctx, unsigned char** data, size_t* d
|
||||||
|
|
||||||
err = read_any(&r, /*no_alloc=*/0, 1, ECCODES_READS_BUFR, ECCODES_READS_HDF5, ECCODES_READS_WRAP);
|
err = read_any(&r, /*no_alloc=*/0, 1, ECCODES_READS_BUFR, ECCODES_READS_HDF5, ECCODES_READS_WRAP);
|
||||||
*len = r.message_size;
|
*len = r.message_size;
|
||||||
|
|
||||||
*data_length = m.data_len;
|
*data_length = m.data_len;
|
||||||
*data = m.data;
|
*data = m.data;
|
||||||
|
|
||||||
|
|
|
@ -951,27 +951,26 @@ int grib_get_long_internal(grib_handle* h, const char* name, long* val)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_is_in_dump(const grib_handle* h, const char* name)
|
// int grib_is_in_dump(const grib_handle* h, const char* name)
|
||||||
{
|
// {
|
||||||
const grib_accessor* a = grib_find_accessor(h, name);
|
// const grib_accessor* a = grib_find_accessor(h, name);
|
||||||
if (a != NULL && (a->flags & GRIB_ACCESSOR_FLAG_DUMP))
|
// if (a != NULL && (a->flags & GRIB_ACCESSOR_FLAG_DUMP))
|
||||||
return 1;
|
// return 1;
|
||||||
else
|
// else
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
// }
|
||||||
|
|
||||||
int grib_attributes_count(const grib_accessor* a, size_t* size)
|
// int grib_attributes_count(const grib_accessor* a, size_t* size)
|
||||||
{
|
// {
|
||||||
if (a) {
|
// if (a) {
|
||||||
*size = 0;
|
// *size = 0;
|
||||||
while (a->attributes[*size] != NULL) {
|
// while (a->attributes[*size] != NULL) {
|
||||||
(*size)++;
|
// (*size)++;
|
||||||
}
|
// }
|
||||||
return GRIB_SUCCESS;
|
// return GRIB_SUCCESS;
|
||||||
}
|
// }
|
||||||
|
// return GRIB_NOT_FOUND;
|
||||||
return GRIB_NOT_FOUND;
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
int grib_get_long(const grib_handle* h, const char* name, long* val)
|
int grib_get_long(const grib_handle* h, const char* name, long* val)
|
||||||
{
|
{
|
||||||
|
@ -1580,133 +1579,127 @@ int grib_get_long_array(const grib_handle* h, const char* name, long* val, size_
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void grib_clean_key_value(grib_context* c, grib_key_value_list* kv)
|
// static void grib_clean_key_value(grib_context* c, grib_key_value_list* kv)
|
||||||
{
|
// {
|
||||||
if (kv->long_value)
|
// if (kv->long_value)
|
||||||
grib_context_free(c, kv->long_value);
|
// grib_context_free(c, kv->long_value);
|
||||||
kv->long_value = NULL;
|
// kv->long_value = NULL;
|
||||||
if (kv->double_value)
|
// if (kv->double_value)
|
||||||
grib_context_free(c, kv->double_value);
|
// grib_context_free(c, kv->double_value);
|
||||||
kv->double_value = NULL;
|
// kv->double_value = NULL;
|
||||||
if (kv->string_value)
|
// if (kv->string_value)
|
||||||
grib_context_free(c, kv->string_value);
|
// grib_context_free(c, kv->string_value);
|
||||||
kv->string_value = NULL;
|
// kv->string_value = NULL;
|
||||||
if (kv->namespace_value)
|
// if (kv->namespace_value)
|
||||||
grib_key_value_list_delete(c, kv->namespace_value);
|
// grib_key_value_list_delete(c, kv->namespace_value);
|
||||||
kv->namespace_value = NULL;
|
// kv->namespace_value = NULL;
|
||||||
kv->error = 0;
|
// kv->error = 0;
|
||||||
kv->has_value = 0;
|
// kv->has_value = 0;
|
||||||
kv->size = 0;
|
// kv->size = 0;
|
||||||
}
|
// }
|
||||||
|
|
||||||
static int grib_get_key_value(grib_handle* h, grib_key_value_list* kv)
|
// static int grib_get_key_value(grib_handle* h, grib_key_value_list* kv)
|
||||||
{
|
// {
|
||||||
int err = 0;
|
// int err = 0;
|
||||||
size_t size = 0;
|
// size_t size = 0;
|
||||||
grib_keys_iterator* iter = NULL;
|
// grib_keys_iterator* iter = NULL;
|
||||||
grib_key_value_list* list = NULL;
|
// grib_key_value_list* list = NULL;
|
||||||
|
// if (kv->has_value)
|
||||||
|
// grib_clean_key_value(h->context, kv);
|
||||||
|
// err = grib_get_size(h, kv->name, &size);
|
||||||
|
// if (err) {
|
||||||
|
// kv->error = err;
|
||||||
|
// return err;
|
||||||
|
// }
|
||||||
|
// if (size == 0)
|
||||||
|
// size = 512;
|
||||||
|
// switch (kv->type) {
|
||||||
|
// case GRIB_TYPE_LONG:
|
||||||
|
// kv->long_value = (long*)grib_context_malloc_clear(h->context, size * sizeof(long));
|
||||||
|
// err = grib_get_long_array(h, kv->name, kv->long_value, &size);
|
||||||
|
// kv->error = err;
|
||||||
|
// break;
|
||||||
|
// case GRIB_TYPE_DOUBLE:
|
||||||
|
// kv->double_value = (double*)grib_context_malloc_clear(h->context, size * sizeof(double));
|
||||||
|
// err = grib_get_double_array(h, kv->name, kv->double_value, &size);
|
||||||
|
// kv->error = err;
|
||||||
|
// break;
|
||||||
|
// case GRIB_TYPE_STRING:
|
||||||
|
// grib_get_string_length(h, kv->name, &size);
|
||||||
|
// kv->string_value = (char*)grib_context_malloc_clear(h->context, size * sizeof(char));
|
||||||
|
// err = grib_get_string(h, kv->name, kv->string_value, &size);
|
||||||
|
// kv->error = err;
|
||||||
|
// break;
|
||||||
|
// case GRIB_TYPE_BYTES:
|
||||||
|
// kv->string_value = (char*)grib_context_malloc_clear(h->context, size * sizeof(char));
|
||||||
|
// err = grib_get_bytes(h, kv->name, (unsigned char*)kv->string_value, &size);
|
||||||
|
// kv->error = err;
|
||||||
|
// break;
|
||||||
|
// case CODES_NAMESPACE:
|
||||||
|
// iter = grib_keys_iterator_new(h, 0, kv->name);
|
||||||
|
// list = (grib_key_value_list*)grib_context_malloc_clear(h->context, sizeof(grib_key_value_list));
|
||||||
|
// kv->namespace_value = list;
|
||||||
|
// while (grib_keys_iterator_next(iter)) {
|
||||||
|
// list->name = grib_keys_iterator_get_name(iter);
|
||||||
|
// err = grib_get_native_type(h, list->name, &(list->type));
|
||||||
|
// if (err)
|
||||||
|
// return err;
|
||||||
|
// err = grib_get_key_value(h, list);
|
||||||
|
// if (err)
|
||||||
|
// return err;
|
||||||
|
// list->next = (grib_key_value_list*)grib_context_malloc_clear(h->context, sizeof(grib_key_value_list));
|
||||||
|
// list = list->next;
|
||||||
|
// }
|
||||||
|
// grib_keys_iterator_delete(iter);
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// err = grib_get_native_type(h, kv->name, &(kv->type));
|
||||||
|
// if (err)
|
||||||
|
// return err;
|
||||||
|
// err = grib_get_key_value(h, kv);
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// kv->has_value = 1;
|
||||||
|
// return err;
|
||||||
|
// }
|
||||||
|
|
||||||
if (kv->has_value)
|
// grib_key_value_list* grib_key_value_list_clone(grib_context* c, grib_key_value_list* list)
|
||||||
grib_clean_key_value(h->context, kv);
|
// {
|
||||||
|
// grib_key_value_list* next = list;
|
||||||
|
// grib_key_value_list* the_clone = (grib_key_value_list*)grib_context_malloc_clear(c, sizeof(grib_key_value_list));
|
||||||
|
// grib_key_value_list* p = the_clone;
|
||||||
|
// while (next && next->name) {
|
||||||
|
// p->name = grib_context_strdup(c, next->name);
|
||||||
|
// p->type = next->type;
|
||||||
|
// next = next->next;
|
||||||
|
// }
|
||||||
|
// return the_clone;
|
||||||
|
// }
|
||||||
|
|
||||||
err = grib_get_size(h, kv->name, &size);
|
// void grib_key_value_list_delete(grib_context* c, grib_key_value_list* kvl)
|
||||||
if (err) {
|
// {
|
||||||
kv->error = err;
|
// grib_key_value_list* next = kvl;
|
||||||
return err;
|
// grib_key_value_list* p = NULL;
|
||||||
}
|
// while (next) {
|
||||||
if (size == 0)
|
// p = next->next;
|
||||||
size = 512;
|
// if (next->type == CODES_NAMESPACE)
|
||||||
|
// grib_key_value_list_delete(c, next->namespace_value);
|
||||||
|
// grib_clean_key_value(c, next);
|
||||||
|
// grib_context_free(c, next);
|
||||||
|
// next = p;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
switch (kv->type) {
|
// int grib_get_key_value_list(grib_handle* h, grib_key_value_list* list)
|
||||||
case GRIB_TYPE_LONG:
|
// {
|
||||||
kv->long_value = (long*)grib_context_malloc_clear(h->context, size * sizeof(long));
|
// int ret = 0;
|
||||||
err = grib_get_long_array(h, kv->name, kv->long_value, &size);
|
// grib_key_value_list* kvl = list;
|
||||||
kv->error = err;
|
// while (kvl) {
|
||||||
break;
|
// ret = grib_get_key_value(h, kvl);
|
||||||
case GRIB_TYPE_DOUBLE:
|
// kvl = kvl->next;
|
||||||
kv->double_value = (double*)grib_context_malloc_clear(h->context, size * sizeof(double));
|
// }
|
||||||
err = grib_get_double_array(h, kv->name, kv->double_value, &size);
|
// return ret;
|
||||||
kv->error = err;
|
// }
|
||||||
break;
|
|
||||||
case GRIB_TYPE_STRING:
|
|
||||||
grib_get_string_length(h, kv->name, &size);
|
|
||||||
kv->string_value = (char*)grib_context_malloc_clear(h->context, size * sizeof(char));
|
|
||||||
err = grib_get_string(h, kv->name, kv->string_value, &size);
|
|
||||||
kv->error = err;
|
|
||||||
break;
|
|
||||||
case GRIB_TYPE_BYTES:
|
|
||||||
kv->string_value = (char*)grib_context_malloc_clear(h->context, size * sizeof(char));
|
|
||||||
err = grib_get_bytes(h, kv->name, (unsigned char*)kv->string_value, &size);
|
|
||||||
kv->error = err;
|
|
||||||
break;
|
|
||||||
case CODES_NAMESPACE:
|
|
||||||
iter = grib_keys_iterator_new(h, 0, kv->name);
|
|
||||||
list = (grib_key_value_list*)grib_context_malloc_clear(h->context, sizeof(grib_key_value_list));
|
|
||||||
kv->namespace_value = list;
|
|
||||||
while (grib_keys_iterator_next(iter)) {
|
|
||||||
list->name = grib_keys_iterator_get_name(iter);
|
|
||||||
err = grib_get_native_type(h, list->name, &(list->type));
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
err = grib_get_key_value(h, list);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
list->next = (grib_key_value_list*)grib_context_malloc_clear(h->context, sizeof(grib_key_value_list));
|
|
||||||
list = list->next;
|
|
||||||
}
|
|
||||||
grib_keys_iterator_delete(iter);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
err = grib_get_native_type(h, kv->name, &(kv->type));
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
err = grib_get_key_value(h, kv);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
kv->has_value = 1;
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
grib_key_value_list* grib_key_value_list_clone(grib_context* c, grib_key_value_list* list)
|
|
||||||
{
|
|
||||||
grib_key_value_list* next = list;
|
|
||||||
grib_key_value_list* the_clone = (grib_key_value_list*)grib_context_malloc_clear(c, sizeof(grib_key_value_list));
|
|
||||||
grib_key_value_list* p = the_clone;
|
|
||||||
|
|
||||||
while (next && next->name) {
|
|
||||||
p->name = grib_context_strdup(c, next->name);
|
|
||||||
p->type = next->type;
|
|
||||||
next = next->next;
|
|
||||||
}
|
|
||||||
return the_clone;
|
|
||||||
}
|
|
||||||
|
|
||||||
void grib_key_value_list_delete(grib_context* c, grib_key_value_list* kvl)
|
|
||||||
{
|
|
||||||
grib_key_value_list* next = kvl;
|
|
||||||
grib_key_value_list* p = NULL;
|
|
||||||
while (next) {
|
|
||||||
p = next->next;
|
|
||||||
if (next->type == CODES_NAMESPACE)
|
|
||||||
grib_key_value_list_delete(c, next->namespace_value);
|
|
||||||
|
|
||||||
grib_clean_key_value(c, next);
|
|
||||||
grib_context_free(c, next);
|
|
||||||
next = p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int grib_get_key_value_list(grib_handle* h, grib_key_value_list* list)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
grib_key_value_list* kvl = list;
|
|
||||||
while (kvl) {
|
|
||||||
ret = grib_get_key_value(h, kvl);
|
|
||||||
kvl = kvl->next;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int grib_get_values(grib_handle* h, grib_values* args, size_t count)
|
int grib_get_values(grib_handle* h, grib_values* args, size_t count)
|
||||||
{
|
{
|
||||||
|
|
|
@ -255,7 +255,9 @@ if( HAVE_BUILD_TOOLS )
|
||||||
gts_ls
|
gts_ls
|
||||||
gts_count
|
gts_count
|
||||||
gts_compare
|
gts_compare
|
||||||
|
gts_dump
|
||||||
wrap
|
wrap
|
||||||
|
hdf5
|
||||||
taf
|
taf
|
||||||
pseudo_diag
|
pseudo_diag
|
||||||
metar_ls
|
metar_ls
|
||||||
|
@ -361,6 +363,10 @@ if( HAVE_BUILD_TOOLS )
|
||||||
TYPE SCRIPT
|
TYPE SCRIPT
|
||||||
CONDITION ECCODES_INSTALL_EXTRA_TOOLS
|
CONDITION ECCODES_INSTALL_EXTRA_TOOLS
|
||||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_check_gaussian_grids.sh )
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_check_gaussian_grids.sh )
|
||||||
|
ecbuild_add_test( TARGET eccodes_t_grib_repair
|
||||||
|
TYPE SCRIPT
|
||||||
|
CONDITION ECCODES_INSTALL_EXTRA_TOOLS AND ENABLE_EXTRA_TESTS
|
||||||
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_repair.sh )
|
||||||
|
|
||||||
|
|
||||||
# Note: making the test dependent on the grib files (with DEPENDS)
|
# Note: making the test dependent on the grib files (with DEPENDS)
|
||||||
|
|
|
@ -328,6 +328,28 @@ set -e
|
||||||
[ $status -ne 0 ]
|
[ $status -ne 0 ]
|
||||||
grep -q "Failed to unpack 2nd message" $fLog
|
grep -q "Failed to unpack 2nd message" $fLog
|
||||||
|
|
||||||
|
# ----------------------------------------
|
||||||
|
# Summary mode (-f)
|
||||||
|
# ----------------------------------------
|
||||||
|
set +e
|
||||||
|
${tools_dir}/bufr_compare -f aaen_55.bufr aben_55.bufr > $fLog 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -eq 1 ]
|
||||||
|
grep -q "Summary of different key values" $fLog
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------
|
||||||
|
# Unreadable message
|
||||||
|
# ----------------------------------------
|
||||||
|
echo BUFR > $fBufrTmp
|
||||||
|
set +e
|
||||||
|
${tools_dir}/bufr_compare $fBufrTmp $fBufrTmp > $fLog 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
grep -q "unreadable message" $fLog
|
||||||
|
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
# -------------
|
# -------------
|
||||||
|
|
|
@ -105,6 +105,22 @@ cat $tempErr
|
||||||
grep -q "Input output problem" $tempErr
|
grep -q "Input output problem" $tempErr
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------
|
||||||
|
# Unreadable message
|
||||||
|
# ------------------------
|
||||||
|
cat > $fRules <<EOF
|
||||||
|
print "[edition]";
|
||||||
|
EOF
|
||||||
|
outfile=temp.$label.out
|
||||||
|
echo BUFR > $outfile
|
||||||
|
set +e
|
||||||
|
${tools_dir}/bufr_filter $fRules $outfile > $tempErr 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
grep -q "unreadable message" $tempErr
|
||||||
|
rm -f $outfile
|
||||||
|
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -f $fLog $fRules $tempErr
|
rm -f $fLog $fRules $tempErr
|
||||||
|
|
|
@ -120,6 +120,18 @@ result=`${tools_dir}/bufr_get -p unpack:s,heightOfStation aaen_55.bufr`
|
||||||
[ "$result" = "0 858000" ]
|
[ "$result" = "0 858000" ]
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------------------
|
||||||
|
# Unreadable message
|
||||||
|
# ----------------------------------------
|
||||||
|
echo BUFR > $fTmp
|
||||||
|
set +e
|
||||||
|
${tools_dir}/bufr_get -p edition $fTmp > $fLog 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
grep -q "unreadable message" $fLog
|
||||||
|
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -f $fLog $fTmp $res_get $tempRef
|
rm -f $fLog $fTmp $res_get $tempRef
|
||||||
|
|
||||||
|
|
|
@ -48,5 +48,13 @@ set -e
|
||||||
[ $status -ne 0 ]
|
[ $status -ne 0 ]
|
||||||
grep -q "Wrong message length" $tempLog
|
grep -q "Wrong message length" $tempLog
|
||||||
|
|
||||||
|
set +e
|
||||||
|
$EXEC ${test_dir}/extract_offsets nonexistentfile > $tempLog 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
grep -q "Unable to read file" $tempLog
|
||||||
|
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -f $temp1 $temp2 $tempLog
|
rm -f $temp1 $temp2 $tempLog
|
||||||
|
|
|
@ -175,6 +175,16 @@ ${tools_dir}/grib_compare -b $BLACKLIST -R all=2 $temp1 $temp2
|
||||||
cp ${data_dir}/tigge_cf_ecmwf.grib2 $temp1
|
cp ${data_dir}/tigge_cf_ecmwf.grib2 $temp1
|
||||||
${tools_dir}/grib_compare -w typeOfLevel=surface ${data_dir}/tigge_cf_ecmwf.grib2 $temp1
|
${tools_dir}/grib_compare -w typeOfLevel=surface ${data_dir}/tigge_cf_ecmwf.grib2 $temp1
|
||||||
|
|
||||||
|
# ----------------------------------------
|
||||||
|
# Summary mode (-f)
|
||||||
|
# ----------------------------------------
|
||||||
|
set +e
|
||||||
|
${tools_dir}/grib_compare -f ${data_dir}/tigge_cf_ecmwf.grib2 ${data_dir}/tigge_pf_ecmwf.grib2 > $outfile 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -eq 1 ]
|
||||||
|
grep -q "indicatorOfUnitForTimeIncrement . 7 different" $outfile
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
# ECC-651: Two-way (symmetric) comparison
|
# ECC-651: Two-way (symmetric) comparison
|
||||||
|
|
|
@ -66,7 +66,6 @@ cat > $tempRef <<EOF
|
||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
EOF
|
EOF
|
||||||
cat $tempOut
|
|
||||||
diff $tempRef $tempOut
|
diff $tempRef $tempOut
|
||||||
grib_check_key_equals $tempGrib dateOfForecastUsedInLocalTime '20200804'
|
grib_check_key_equals $tempGrib dateOfForecastUsedInLocalTime '20200804'
|
||||||
grib_check_key_equals $tempGrib timeOfForecastUsedInLocalTime '0'
|
grib_check_key_equals $tempGrib timeOfForecastUsedInLocalTime '0'
|
||||||
|
@ -76,7 +75,6 @@ grib_check_key_equals $tempGrib timeOfForecastUsedInLocalTime '0'
|
||||||
${tools_dir}/grib_get -n ls $tempGrib > $tempOut
|
${tools_dir}/grib_get -n ls $tempGrib > $tempOut
|
||||||
# edition centre date time dataType gridType typeOfLevel level shortName packingType
|
# edition centre date time dataType gridType typeOfLevel level shortName packingType
|
||||||
echo "2 ecmf 20200805 1200 an regular_ll surface 0 t grid_simple" > $tempRef
|
echo "2 ecmf 20200805 1200 an regular_ll surface 0 t grid_simple" > $tempRef
|
||||||
cat $tempOut
|
|
||||||
diff -w $tempRef $tempOut
|
diff -w $tempRef $tempOut
|
||||||
|
|
||||||
# Check "time" namespace
|
# Check "time" namespace
|
||||||
|
@ -84,7 +82,6 @@ ${tools_dir}/grib_get -n time $tempGrib > $tempOut
|
||||||
echo "h 20200804 0000 36" > $tempRef
|
echo "h 20200804 0000 36" > $tempRef
|
||||||
diff -w $tempRef $tempOut
|
diff -w $tempRef $tempOut
|
||||||
|
|
||||||
|
|
||||||
# numberOfForecastsUsedInLocalTime > 1
|
# numberOfForecastsUsedInLocalTime > 1
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
cat > $tempFilt <<EOF
|
cat > $tempFilt <<EOF
|
||||||
|
|
|
@ -50,6 +50,36 @@ set -e
|
||||||
grep -q "Key Nj cannot be 0" $tempText
|
grep -q "Key Nj cannot be 0" $tempText
|
||||||
|
|
||||||
|
|
||||||
|
set +e
|
||||||
|
${tools_dir}/grib_get -l 0,0,5 $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
grep -q "Wrong mode given" $tempText
|
||||||
|
|
||||||
|
|
||||||
|
set +e
|
||||||
|
${tools_dir}/grib_get -l 0,0,1,nonexistingmask $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
cat $tempText
|
||||||
|
grep -q "unable to open mask file" $tempText
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------
|
||||||
|
# Unreadable message
|
||||||
|
# ------------------------
|
||||||
|
outfile=temp.$label.out
|
||||||
|
echo GRIB > $outfile
|
||||||
|
set +e
|
||||||
|
${tools_dir}/grib_get -p edition $outfile /dev/null > $tempText 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
grep -q "unreadable message" $tempText
|
||||||
|
rm -f $outfile
|
||||||
|
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -f $tempText
|
rm -f $tempText
|
||||||
|
|
|
@ -35,7 +35,6 @@ ${tools_dir}/grib_index_build -N -o $tempIndex ${infile} >/dev/null
|
||||||
|
|
||||||
# Must remove first two lines (filename specifics)
|
# Must remove first two lines (filename specifics)
|
||||||
${tools_dir}/grib_dump ${tempIndex} | sed '1,2d' > $tempOut
|
${tools_dir}/grib_dump ${tempIndex} | sed '1,2d' > $tempOut
|
||||||
#cat $tempOut
|
|
||||||
|
|
||||||
cat > $tempRef <<EOF
|
cat > $tempRef <<EOF
|
||||||
Index keys:
|
Index keys:
|
||||||
|
@ -118,7 +117,6 @@ ${tools_dir}/grib_compare -v $tempIndex1 $tempIndex2 2>$tempOut
|
||||||
status=$?
|
status=$?
|
||||||
set -e
|
set -e
|
||||||
[ $status -ne 0 ]
|
[ $status -ne 0 ]
|
||||||
cat $tempOut
|
|
||||||
grep -q "Indexes contained in the input files have different keys" $tempOut
|
grep -q "Indexes contained in the input files have different keys" $tempOut
|
||||||
rm -f $tempIndex1 $tempIndex2 $tempOut
|
rm -f $tempIndex1 $tempIndex2 $tempOut
|
||||||
|
|
||||||
|
@ -130,7 +128,6 @@ ${tools_dir}/grib_compare -v $tempIndex2 $tempIndex1 2>$tempOut
|
||||||
status=$?
|
status=$?
|
||||||
set -e
|
set -e
|
||||||
[ $status -ne 0 ]
|
[ $status -ne 0 ]
|
||||||
cat $tempOut
|
|
||||||
grep -q "Indexes contained in the input files have different keys" $tempOut
|
grep -q "Indexes contained in the input files have different keys" $tempOut
|
||||||
rm -f $tempIndex1 $tempIndex2 $tempOut
|
rm -f $tempIndex1 $tempIndex2 $tempOut
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,11 @@ files="reduced_latlon_surface.grib1 \
|
||||||
regular_latlon_surface.grib2"
|
regular_latlon_surface.grib2"
|
||||||
|
|
||||||
for f in $files; do
|
for f in $files; do
|
||||||
file=${data_dir}/$f
|
file=${data_dir}/$f
|
||||||
# Must exclude the first line of grib_get_data which is "Latitude Longitude Value"
|
# Must exclude the first line of grib_get_data which is "Latitude Longitude Value"
|
||||||
iterator_count=`${tools_dir}/grib_get_data -m 9999:missing -f -p centre -F "%g" -w count=1 $file | grep -v Lat |wc -l `
|
iterator_count=`${tools_dir}/grib_get_data -m 9999:missing -f -p centre -F "%g" -w count=1 $file | grep -v Lat |wc -l `
|
||||||
numberOfPoints=`${tools_dir}/grib_get -w count=1 -p numberOfPoints $file`
|
numberOfPoints=`${tools_dir}/grib_get -w count=1 -p numberOfPoints $file`
|
||||||
[ $numberOfPoints = ${iterator_count} ]
|
[ $numberOfPoints = ${iterator_count} ]
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ ${tools_dir}/grib_set -s Ni=33 $samp_dir/GRIB2.tmpl $tempGrib
|
||||||
set +e
|
set +e
|
||||||
${tools_dir}/grib_get_data $tempGrib > $tempText 2>&1
|
${tools_dir}/grib_get_data $tempGrib > $tempText 2>&1
|
||||||
status=$?
|
status=$?
|
||||||
set +e
|
set -e
|
||||||
[ $status -ne 0 ]
|
[ $status -ne 0 ]
|
||||||
grep -q "Grid description is wrong or inconsistent" $tempText
|
grep -q "Grid description is wrong or inconsistent" $tempText
|
||||||
|
|
||||||
|
@ -60,16 +60,61 @@ ${tools_dir}/grib_set -s Ni=MISSING $samp_dir/GRIB2.tmpl $tempGrib
|
||||||
set +e
|
set +e
|
||||||
${tools_dir}/grib_get_data $tempGrib > $tempText 2>&1
|
${tools_dir}/grib_get_data $tempGrib > $tempText 2>&1
|
||||||
status=$?
|
status=$?
|
||||||
set +e
|
set -e
|
||||||
[ $status -ne 0 ]
|
[ $status -ne 0 ]
|
||||||
grep -q "Grid description is wrong or inconsistent" $tempText
|
grep -q "Grid description is wrong or inconsistent" $tempText
|
||||||
|
|
||||||
|
|
||||||
|
set +e
|
||||||
${tools_dir}/grib_ls -s Ni=missing -j -p latLonValues $data_dir/sample.grib2 > $tempText 2>&1
|
${tools_dir}/grib_ls -s Ni=missing -j -p latLonValues $data_dir/sample.grib2 > $tempText 2>&1
|
||||||
cat $tempText
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
grep -q "Key Ni cannot be 'missing' for a regular grid" $tempText
|
grep -q "Key Ni cannot be 'missing' for a regular grid" $tempText
|
||||||
grep -q "latlonvalues: Unable to create iterator" $tempText
|
grep -q "latlonvalues: Unable to create iterator" $tempText
|
||||||
|
|
||||||
|
|
||||||
|
# -w option
|
||||||
|
${tools_dir}/grib_get_data -w count=11 $data_dir/tigge_cf_ecmwf.grib2 > $tempText
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------
|
||||||
|
# Bad key
|
||||||
|
# ------------------------
|
||||||
|
${tools_dir}/grib_get_data -f -p nonexistingkey $data_dir/sample.grib2 > $tempText
|
||||||
|
grep -q "not found" $tempText
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------------
|
||||||
|
# Unreadable message
|
||||||
|
# ------------------------
|
||||||
|
echo GRIB > $tempGrib
|
||||||
|
set +e
|
||||||
|
${tools_dir}/grib_get_data $tempGrib > $tempText 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
cat $tempText
|
||||||
|
grep -q "unreadable message" $tempText
|
||||||
|
|
||||||
|
# Legacy Gaussian sub-area (produced by old ProdGen)
|
||||||
|
# See ECC-906:
|
||||||
|
# grib_get_data not working correctly with old-style sub-areas of reduced grids
|
||||||
|
# -------------------------------------------------
|
||||||
|
input=$data_dir/reduced_gaussian_sub_area.legacy.grib1
|
||||||
|
if [ -f "$input" ]; then
|
||||||
|
${tools_dir}/grib_get_data $input > $tempText
|
||||||
|
grib_check_key_equals $input legacyGaussSubarea 1
|
||||||
|
|
||||||
|
ECCODES_DEBUG=-1 ${tools_dir}/grib_ls -p numberOfDataPoints $input > $tempText 2>&1
|
||||||
|
grep -q "LEGACY MODE activated. Count.=253982. changed to num values.=254139" $tempText
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Iterate with DEBUG on
|
||||||
|
input=$ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib2.tmpl
|
||||||
|
ECCODES_DEBUG=1 ${tools_dir}/grib_get_data $input > $tempText 2>&1
|
||||||
|
grep "global num points=6114" $tempText
|
||||||
|
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -f $tempText $tempGrib
|
rm -f $tempText $tempGrib
|
||||||
|
|
|
@ -225,6 +225,8 @@ grib_check_key_equals $file 'expver:s' '0001'
|
||||||
${tools_dir}/grib_ls -j -l0,0 -p referenceValue:d $data_dir/sample.grib2
|
${tools_dir}/grib_ls -j -l0,0 -p referenceValue:d $data_dir/sample.grib2
|
||||||
${tools_dir}/grib_ls -j -l0,0 -p referenceValue:i $data_dir/sample.grib2
|
${tools_dir}/grib_ls -j -l0,0 -p referenceValue:i $data_dir/sample.grib2
|
||||||
|
|
||||||
|
${tools_dir}/grib_get -l0,0,4 $data_dir/sample.grib2
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
${tools_dir}/grib_ls -l0,0,666 $data_dir/sample.grib2 > $tempText 2>&1
|
${tools_dir}/grib_ls -l0,0,666 $data_dir/sample.grib2 > $tempText 2>&1
|
||||||
status=$?
|
status=$?
|
||||||
|
@ -233,5 +235,13 @@ set -e
|
||||||
grep -q "Wrong mode given" $tempText
|
grep -q "Wrong mode given" $tempText
|
||||||
|
|
||||||
|
|
||||||
|
set +e
|
||||||
|
${tools_dir}/grib_ls -l0,0,1,nonexistingmask $data_dir/sample.grib2 > $tempText 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
grep -q "unable to open mask file" $tempText
|
||||||
|
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -f $temp1 $temp2 $tempText $tempLog
|
rm -f $temp1 $temp2 $tempText $tempLog
|
||||||
|
|
|
@ -15,6 +15,11 @@ REDIRECT=/dev/null
|
||||||
tempGrib=temp.local.$label.grib1
|
tempGrib=temp.local.$label.grib1
|
||||||
tempFilt=temp.local.$label.filt
|
tempFilt=temp.local.$label.filt
|
||||||
|
|
||||||
|
if [ $ECCODES_ON_WINDOWS -eq 1 ]; then
|
||||||
|
echo "$0: This test is currently disabled on Windows"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
${tools_dir}/grib_set -s setLocalDefinition=1 ${data_dir}/regular_latlon_surface.grib1 $tempGrib
|
${tools_dir}/grib_set -s setLocalDefinition=1 ${data_dir}/regular_latlon_surface.grib1 $tempGrib
|
||||||
cat > $tempFilt <<EOF
|
cat > $tempFilt <<EOF
|
||||||
if (GRIBEXSection1Problem ) {
|
if (GRIBEXSection1Problem ) {
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
#!/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
|
||||||
|
|
||||||
|
label="grib_repair_test"
|
||||||
|
tempText=temp.$label.txt
|
||||||
|
tempGoodGribs=temp.$label.good.grib
|
||||||
|
tempBadGribs=temp.$label.bad.grib
|
||||||
|
|
||||||
|
if [ -e "${tools_dir}/grib_repair" ]; then
|
||||||
|
export ECCODES_GRIB_REPAIR_MAX_NUM_MESSAGES=3
|
||||||
|
${tools_dir}/grib_repair $data_dir/bad.grib $tempGoodGribs $tempBadGribs > $tempText 2>&1
|
||||||
|
grep -q "Wrong message length" $tempText
|
||||||
|
|
||||||
|
count=$( ${tools_dir}/grib_count $tempGoodGribs )
|
||||||
|
[ $count -eq 1 ]
|
||||||
|
|
||||||
|
count=$( ${tools_dir}/grib_count $tempBadGribs )
|
||||||
|
[ $count -eq 3 ]
|
||||||
|
|
||||||
|
${tools_dir}/grib_ls $tempGoodGribs
|
||||||
|
${tools_dir}/grib_ls $tempBadGribs
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
rm -f $tempText $tempGoodGribs $tempBadGribs
|
|
@ -64,7 +64,34 @@ set -e
|
||||||
# Add correct blocklist
|
# Add correct blocklist
|
||||||
${tools_dir}/gts_compare -b GG $gts_file $fGtsTmp
|
${tools_dir}/gts_compare -b GG $gts_file $fGtsTmp
|
||||||
|
|
||||||
|
#----------------------------------------------------
|
||||||
|
# Compare using -c
|
||||||
|
#----------------------------------------------------
|
||||||
|
temp1=temp.$label.1.gts
|
||||||
|
temp2=temp.$label.2.gts
|
||||||
|
# Pick two messages which do have different contents
|
||||||
|
${tools_dir}/gts_copy -w count=1 $gts_file $temp1
|
||||||
|
${tools_dir}/gts_copy -w count=4 $gts_file $temp2
|
||||||
|
${tools_dir}/gts_compare -c theMessage $temp1 $temp2
|
||||||
|
${tools_dir}/gts_compare -c theMessage -a $temp1 $temp2
|
||||||
|
|
||||||
|
set +e
|
||||||
|
${tools_dir}/gts_compare -c ls:n $temp1 $temp2
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -eq 1 ]
|
||||||
|
|
||||||
|
set +e
|
||||||
|
${tools_dir}/gts_compare -c ls:n -a $temp1 $temp2
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -eq 1 ]
|
||||||
|
|
||||||
|
rm -f $temp1 $temp2
|
||||||
|
|
||||||
|
#----------------------------------------------------
|
||||||
# Test with file of the same name in a dir
|
# Test with file of the same name in a dir
|
||||||
|
#----------------------------------------------------
|
||||||
tempDir=temp.$label.dir
|
tempDir=temp.$label.dir
|
||||||
rm -fr $tempDir
|
rm -fr $tempDir
|
||||||
mkdir $tempDir
|
mkdir $tempDir
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/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
|
||||||
|
|
||||||
|
label="gts_dump_test"
|
||||||
|
|
||||||
|
fLog=${label}.log
|
||||||
|
fTmp=${label}.tmp.txt
|
||||||
|
|
||||||
|
# Enter data dir
|
||||||
|
cd ${data_dir}/gts
|
||||||
|
|
||||||
|
gts_file=EGRR20150317121020_00493212.DAT
|
||||||
|
${tools_dir}/gts_dump -w count=1 $gts_file
|
||||||
|
${tools_dir}/gts_dump -Dat $gts_file
|
||||||
|
${tools_dir}/gts_dump -OH $gts_file
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
rm -f $fLog $fTmp
|
|
@ -0,0 +1,34 @@
|
||||||
|
#!/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
|
||||||
|
|
||||||
|
label="hdf5_test"
|
||||||
|
|
||||||
|
if [ $ECCODES_ON_WINDOWS -eq 1 ]; then
|
||||||
|
echo "$0: This test is currently disabled on Windows"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
tempOut=temp.${label}.out
|
||||||
|
tempTxt=temp.${label}.txt
|
||||||
|
tempRef=temp.${label}.ref
|
||||||
|
|
||||||
|
input=$ECCODES_SAMPLES_PATH/hdf5.tmpl
|
||||||
|
|
||||||
|
${tools_dir}/grib_dump -TA -O $input > $tempTxt
|
||||||
|
grep -q "versionNumberOfSuperblock = 2" $tempTxt
|
||||||
|
grep -q "endOfFileAddress = 342" $tempTxt
|
||||||
|
|
||||||
|
id=`${tools_dir}/grib_get -TA -p identifier $input`
|
||||||
|
[ "$id" = "HDF5" ]
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
rm -f $tempOut $tempRef $tempTxt
|
|
@ -65,6 +65,18 @@ grep -q "DIFFERENCE == string.*theMessage" $fLog
|
||||||
# The -d option should have created these files
|
# The -d option should have created these files
|
||||||
rm -f error1_1.metar error2_1.metar error1_2.metar error2_2.metar
|
rm -f error1_1.metar error2_1.metar error1_2.metar error2_2.metar
|
||||||
|
|
||||||
|
#----------------------------------------------------
|
||||||
|
# Compare a key of type double
|
||||||
|
#----------------------------------------------------
|
||||||
|
temp1=temp.$label.metar.1
|
||||||
|
temp2=temp.$label.metar.2
|
||||||
|
${tools_dir}/metar_copy -w count=1 $metar_file $temp1
|
||||||
|
${tools_dir}/metar_copy -w count=2 $metar_file $temp2
|
||||||
|
# absolute diff. = 16.53, relative diff. = 0.381315
|
||||||
|
${tools_dir}/metar_compare -c latitude -R latitude=0.4 $temp1 $temp2
|
||||||
|
${tools_dir}/metar_compare -c latitude -A 17 $temp1 $temp2
|
||||||
|
rm -f $temp1 $temp2
|
||||||
|
|
||||||
#----------------------------------------------------
|
#----------------------------------------------------
|
||||||
# Test: comparing with and without the -b switch
|
# Test: comparing with and without the -b switch
|
||||||
#----------------------------------------------------
|
#----------------------------------------------------
|
||||||
|
|
|
@ -46,4 +46,14 @@ ${tools_dir}/metar_dump $f 2> $REDIRECT > $res_dump
|
||||||
|
|
||||||
diff $ref_dump $res_dump >$REDIRECT 2> $REDIRECT
|
diff $ref_dump $res_dump >$REDIRECT 2> $REDIRECT
|
||||||
|
|
||||||
|
# Data
|
||||||
|
${tools_dir}/metar_dump -d $f
|
||||||
|
|
||||||
|
# JSON
|
||||||
|
${tools_dir}/metar_dump -j $f
|
||||||
|
|
||||||
|
# Skip
|
||||||
|
${tools_dir}/metar_dump -w count=11 $f
|
||||||
|
|
||||||
|
# Clean up
|
||||||
rm -f $fLog $res_dump
|
rm -f $fLog $res_dump
|
||||||
|
|
|
@ -714,7 +714,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
|
||||||
|
|
||||||
if (type1 == GRIB_TYPE_UNDEFINED && (err = grib_get_native_type(handle1, name, &type1)) != GRIB_SUCCESS) {
|
if (type1 == GRIB_TYPE_UNDEFINED && (err = grib_get_native_type(handle1, name, &type1)) != GRIB_SUCCESS) {
|
||||||
printInfo(handle1);
|
printInfo(handle1);
|
||||||
printf("Oops... cannot get type of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
|
printf("Error: cannot get type of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -727,7 +727,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
printInfo(handle1);
|
printInfo(handle1);
|
||||||
printf("Oops... cannot get type of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
|
printf("Error: cannot get type of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -747,7 +747,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
|
||||||
|
|
||||||
if ((err = grib_get_size(handle1, name, &len1)) != GRIB_SUCCESS) {
|
if ((err = grib_get_size(handle1, name, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(handle1);
|
printInfo(handle1);
|
||||||
printf("Oops... cannot get size of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
|
printf("Error: cannot get size of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -761,7 +761,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
|
||||||
}
|
}
|
||||||
|
|
||||||
printInfo(handle1);
|
printInfo(handle1);
|
||||||
printf("Oops... cannot get size of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
|
printf("Error: cannot get size of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -826,13 +826,13 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
|
||||||
sval2 = (char*)grib_context_malloc(handle2->context, slen2 * sizeof(char));
|
sval2 = (char*)grib_context_malloc(handle2->context, slen2 * sizeof(char));
|
||||||
if ((err1 = grib_get_string(handle1, name, sval1, &slen1)) != GRIB_SUCCESS) {
|
if ((err1 = grib_get_string(handle1, name, sval1, &slen1)) != GRIB_SUCCESS) {
|
||||||
printInfo(handle1);
|
printInfo(handle1);
|
||||||
printf("Oops... cannot get string value of [%s] in %s field: %s\n",
|
printf("Error: cannot get string value of [%s] in %s field: %s\n",
|
||||||
name, first_str, grib_get_error_message(err1));
|
name, first_str, grib_get_error_message(err1));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
if ((err2 = grib_get_string(handle2, name, sval2, &slen2)) != GRIB_SUCCESS) {
|
if ((err2 = grib_get_string(handle2, name, sval2, &slen2)) != GRIB_SUCCESS) {
|
||||||
printInfo(handle1);
|
printInfo(handle1);
|
||||||
printf("Oops... cannot get string value of [%s] in %s field: %s\n",
|
printf("Error: cannot get string value of [%s] in %s field: %s\n",
|
||||||
name, second_str, grib_get_error_message(err2));
|
name, second_str, grib_get_error_message(err2));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
@ -855,13 +855,13 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
|
||||||
|
|
||||||
if ((err1 = grib_get_string_array(handle1, name, svals1, &len1)) != GRIB_SUCCESS) {
|
if ((err1 = grib_get_string_array(handle1, name, svals1, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(handle1);
|
printInfo(handle1);
|
||||||
printf("Oops... cannot get string value of [%s] in %s field: %s\n",
|
printf("Error: cannot get string value of [%s] in %s field: %s\n",
|
||||||
name, first_str, grib_get_error_message(err1));
|
name, first_str, grib_get_error_message(err1));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
if ((err2 = grib_get_string_array(handle2, name, svals2, &len2)) != GRIB_SUCCESS) {
|
if ((err2 = grib_get_string_array(handle2, name, svals2, &len2)) != GRIB_SUCCESS) {
|
||||||
printInfo(handle1);
|
printInfo(handle1);
|
||||||
printf("Oops... cannot get string value of [%s] in %s field: %s\n",
|
printf("Error: cannot get string value of [%s] in %s field: %s\n",
|
||||||
name, second_str, grib_get_error_message(err2));
|
name, second_str, grib_get_error_message(err2));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
@ -910,14 +910,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
|
||||||
|
|
||||||
if ((err1 = grib_get_long_array(handle1, name, lval1, &len1)) != GRIB_SUCCESS) {
|
if ((err1 = grib_get_long_array(handle1, name, lval1, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(handle1);
|
printInfo(handle1);
|
||||||
printf("Oops... cannot get long value of [%s] in %s field: %s\n",
|
printf("Error: cannot get long value of [%s] in %s field: %s\n",
|
||||||
name, first_str, grib_get_error_message(err1));
|
name, first_str, grib_get_error_message(err1));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err2 = grib_get_long_array(handle2, name, lval2, &len2)) != GRIB_SUCCESS) {
|
if ((err2 = grib_get_long_array(handle2, name, lval2, &len2)) != GRIB_SUCCESS) {
|
||||||
printInfo(handle1);
|
printInfo(handle1);
|
||||||
printf("Oops... cannot get long value of [%s] in %s field: %s\n",
|
printf("Error: cannot get long value of [%s] in %s field: %s\n",
|
||||||
name, second_str, grib_get_error_message(err2));
|
name, second_str, grib_get_error_message(err2));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
@ -995,14 +995,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
|
||||||
|
|
||||||
if ((err1 = grib_get_double_array(handle1, name, dval1, &len1)) != GRIB_SUCCESS) {
|
if ((err1 = grib_get_double_array(handle1, name, dval1, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(handle1);
|
printInfo(handle1);
|
||||||
printf("Oops... cannot get double value of [%s] in %s field: %s\n",
|
printf("Error: cannot get double value of [%s] in %s field: %s\n",
|
||||||
name, first_str, grib_get_error_message(err1));
|
name, first_str, grib_get_error_message(err1));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err2 = grib_get_double_array(handle2, name, dval2, &len2)) != GRIB_SUCCESS) {
|
if ((err2 = grib_get_double_array(handle2, name, dval2, &len2)) != GRIB_SUCCESS) {
|
||||||
printInfo(handle1);
|
printInfo(handle1);
|
||||||
printf("Oops... cannot get double value of [%s] in %s field: %s\n",
|
printf("Error: cannot get double value of [%s] in %s field: %s\n",
|
||||||
name, second_str, grib_get_error_message(err2));
|
name, second_str, grib_get_error_message(err2));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
@ -1104,14 +1104,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
|
||||||
if ((err1 = grib_get_bytes(handle1, name, uval1, &len1)) != GRIB_SUCCESS) {
|
if ((err1 = grib_get_bytes(handle1, name, uval1, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(handle1);
|
printInfo(handle1);
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
printf("Oops... cannot get bytes value of [%s] in %s field: %s\n",
|
printf("Error: cannot get bytes value of [%s] in %s field: %s\n",
|
||||||
name, first_str, grib_get_error_message(err1));
|
name, first_str, grib_get_error_message(err1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err2 = grib_get_bytes(handle2, name, uval2, &len2)) != GRIB_SUCCESS) {
|
if ((err2 = grib_get_bytes(handle2, name, uval2, &len2)) != GRIB_SUCCESS) {
|
||||||
printInfo(handle1);
|
printInfo(handle1);
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
printf("Oops... cannot get bytes value of [%s] in %s field: %s\n",
|
printf("Error: cannot get bytes value of [%s] in %s field: %s\n",
|
||||||
name, second_str, grib_get_error_message(err2));
|
name, second_str, grib_get_error_message(err2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1316,7 +1316,6 @@ static int compare_handles(grib_handle* handle1, grib_handle* handle2, grib_runt
|
||||||
}
|
}
|
||||||
while (grib_keys_iterator_next(iter)) {
|
while (grib_keys_iterator_next(iter)) {
|
||||||
name = grib_keys_iterator_get_name(iter);
|
name = grib_keys_iterator_get_name(iter);
|
||||||
/*printf("----- comparing %s\n",name);*/
|
|
||||||
|
|
||||||
if (blocklisted(name))
|
if (blocklisted(name))
|
||||||
continue;
|
continue;
|
||||||
|
@ -1336,7 +1335,6 @@ static int compare_handles(grib_handle* handle1, grib_handle* handle2, grib_runt
|
||||||
const void *msg1 = NULL, *msg2 = NULL;
|
const void *msg1 = NULL, *msg2 = NULL;
|
||||||
size_t size1 = 0, size2 = 0;
|
size_t size1 = 0, size2 = 0;
|
||||||
int memcmp_ret = 0;
|
int memcmp_ret = 0;
|
||||||
/* int ii=0; */
|
|
||||||
GRIB_CHECK_NOLINE(grib_get_message(handle1, &msg1, &size1), 0);
|
GRIB_CHECK_NOLINE(grib_get_message(handle1, &msg1, &size1), 0);
|
||||||
GRIB_CHECK_NOLINE(grib_get_message(handle2, &msg2, &size2), 0);
|
GRIB_CHECK_NOLINE(grib_get_message(handle2, &msg2, &size2), 0);
|
||||||
if (size1 == size2 && !(memcmp_ret = memcmp(msg1, msg2, size1))) {
|
if (size1 == size2 && !(memcmp_ret = memcmp(msg1, msg2, size1))) {
|
||||||
|
|
|
@ -383,21 +383,19 @@ int grib_tool_init(grib_runtime_options* options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
// Check for 2nd file being a directory. If so, we assume user is comparing to a file
|
||||||
/* Check for 2nd file being a directory. If so, we assume user is comparing to a file */
|
// with the same name as first file in that directory
|
||||||
/* with the same name as first file in that directory */
|
grib_tools_file* infile = options->infile; // the 2nd file in comparison
|
||||||
grib_tools_file* infile = options->infile; /* the 2nd file in comparison */
|
if (infile) {
|
||||||
if (infile) {
|
if (path_is_directory(infile->name)) {
|
||||||
if (path_is_directory(infile->name)) {
|
// Take the filename of the 1st file and append to dir
|
||||||
/* Take the filename of the 1st file and append to dir */
|
char bufr[2048] = {0,};
|
||||||
char bufr[2048] = {0,};
|
// options->infile_extra->name is the 1st file
|
||||||
/* options->infile_extra->name is the 1st file */
|
snprintf(bufr, sizeof(bufr), "%s%c%s",
|
||||||
snprintf(bufr, sizeof(bufr), "%s%c%s",
|
infile->name,
|
||||||
infile->name,
|
get_dir_separator_char(),
|
||||||
get_dir_separator_char(),
|
extract_filename(options->infile_extra->name));
|
||||||
extract_filename(options->infile_extra->name));
|
infile->name = strdup(bufr);
|
||||||
infile->name = strdup(bufr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,7 +711,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
|
|
||||||
if (type1 == GRIB_TYPE_UNDEFINED && (err = grib_get_native_type(h1, name, &type1)) != GRIB_SUCCESS) {
|
if (type1 == GRIB_TYPE_UNDEFINED && (err = grib_get_native_type(h1, name, &type1)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get type of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
|
printf("Error: cannot get type of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -726,7 +724,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get type of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
|
printf("Error: cannot get type of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -748,7 +746,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
|
|
||||||
if ((err = grib_get_size(h1, name, &len1)) != GRIB_SUCCESS) {
|
if ((err = grib_get_size(h1, name, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get size of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
|
printf("Error: cannot get size of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -762,7 +760,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
}
|
}
|
||||||
|
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get size of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
|
printf("Error: cannot get size of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -820,14 +818,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
|
|
||||||
if ((err1 = grib_get_string(h1, name, sval1, &len1)) != GRIB_SUCCESS) {
|
if ((err1 = grib_get_string(h1, name, sval1, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get string value of [%s] in %s field: %s\n",
|
printf("Error: cannot get string value of [%s] in %s field: %s\n",
|
||||||
name, first_str, grib_get_error_message(err1));
|
name, first_str, grib_get_error_message(err1));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err2 = grib_get_string(h2, name, sval2, &len2)) != GRIB_SUCCESS) {
|
if ((err2 = grib_get_string(h2, name, sval2, &len2)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get string value of [%s] in %s field: %s\n",
|
printf("Error: cannot get string value of [%s] in %s field: %s\n",
|
||||||
name, second_str, grib_get_error_message(err2));
|
name, second_str, grib_get_error_message(err2));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
@ -877,14 +875,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
|
|
||||||
if ((err1 = grib_get_long_array(h1, name, lval1, &len1)) != GRIB_SUCCESS) {
|
if ((err1 = grib_get_long_array(h1, name, lval1, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get long value of [%s] in %s field: %s\n",
|
printf("Error: cannot get long value of [%s] in %s field: %s\n",
|
||||||
name, first_str, grib_get_error_message(err1));
|
name, first_str, grib_get_error_message(err1));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err2 = grib_get_long_array(h2, name, lval2, &len2)) != GRIB_SUCCESS) {
|
if ((err2 = grib_get_long_array(h2, name, lval2, &len2)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get long value of [%s] in %s field: %s\n",
|
printf("Error: cannot get long value of [%s] in %s field: %s\n",
|
||||||
name, second_str, grib_get_error_message(err2));
|
name, second_str, grib_get_error_message(err2));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
@ -1002,14 +1000,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
|
|
||||||
if ((err1 = grib_get_double_array(h1, name, dval1, &len1)) != GRIB_SUCCESS) {
|
if ((err1 = grib_get_double_array(h1, name, dval1, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get double value of [%s] in %s field: %s\n",
|
printf("Error: cannot get double value of [%s] in %s field: %s\n",
|
||||||
name, first_str, grib_get_error_message(err1));
|
name, first_str, grib_get_error_message(err1));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err2 = grib_get_double_array(h2, name, dval2, &len2)) != GRIB_SUCCESS) {
|
if ((err2 = grib_get_double_array(h2, name, dval2, &len2)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get double value of [%s] in %s field: %s\n",
|
printf("Error: cannot get double value of [%s] in %s field: %s\n",
|
||||||
name, second_str, grib_get_error_message(err2));
|
name, second_str, grib_get_error_message(err2));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
@ -1123,14 +1121,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
if ((err1 = grib_get_bytes(h1, name, uval1, &len1)) != GRIB_SUCCESS) {
|
if ((err1 = grib_get_bytes(h1, name, uval1, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
printf("Oops... cannot get bytes value of [%s] in %s field: %s\n",
|
printf("Error: cannot get bytes value of [%s] in %s field: %s\n",
|
||||||
name, first_str, grib_get_error_message(err1));
|
name, first_str, grib_get_error_message(err1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err2 = grib_get_bytes(h2, name, uval2, &len2)) != GRIB_SUCCESS) {
|
if ((err2 = grib_get_bytes(h2, name, uval2, &len2)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
printf("Oops... cannot get bytes value of [%s] in %s field: %s\n",
|
printf("Error: cannot get bytes value of [%s] in %s field: %s\n",
|
||||||
name, second_str, grib_get_error_message(err2));
|
name, second_str, grib_get_error_message(err2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,7 @@ int grib_tool_init(grib_runtime_options* options)
|
||||||
grib_handle* hh;
|
grib_handle* hh;
|
||||||
FILE* f = fopen(options->latlon_mask, "r");
|
FILE* f = fopen(options->latlon_mask, "r");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
fprintf(stderr, "%s: unable to open mask file %s\n", tool_name, options->latlon_mask);
|
||||||
perror(options->latlon_mask);
|
perror(options->latlon_mask);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,6 +137,7 @@ int grib_tool_init(grib_runtime_options* options)
|
||||||
int idx_overall = -1;
|
int idx_overall = -1;
|
||||||
FILE* f = fopen(options->latlon_mask, "r");
|
FILE* f = fopen(options->latlon_mask, "r");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
fprintf(stderr, "%s: unable to open mask file %s\n", tool_name, options->latlon_mask);
|
||||||
perror(options->latlon_mask);
|
perror(options->latlon_mask);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -383,7 +383,7 @@ static void save_error(grib_context* c, const char* key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_handle* h2, const char* name, int type)
|
static int compare_values(const grib_runtime_options* options, grib_handle* h1, grib_handle* h2, const char* name, int type)
|
||||||
{
|
{
|
||||||
size_t len1 = 0;
|
size_t len1 = 0;
|
||||||
size_t len2 = 0;
|
size_t len2 = 0;
|
||||||
|
@ -395,7 +395,6 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
int isMissing1 = 0, isMissing2 = 0;
|
int isMissing1 = 0, isMissing2 = 0;
|
||||||
|
|
||||||
char *sval1 = NULL, *sval2 = NULL;
|
char *sval1 = NULL, *sval2 = NULL;
|
||||||
unsigned char *uval1 = NULL, *uval2 = NULL;
|
|
||||||
long *lval1 = NULL, *lval2 = NULL;
|
long *lval1 = NULL, *lval2 = NULL;
|
||||||
grib_context* c = h1->context;
|
grib_context* c = h1->context;
|
||||||
|
|
||||||
|
@ -406,7 +405,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
|
|
||||||
if (type1 == GRIB_TYPE_UNDEFINED && (err = grib_get_native_type(h1, name, &type1)) != GRIB_SUCCESS) {
|
if (type1 == GRIB_TYPE_UNDEFINED && (err = grib_get_native_type(h1, name, &type1)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get type of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
|
printf("Error: cannot get type of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -419,31 +418,20 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get type of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
|
printf("Error: cannot get type of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if(type1 != type2)
|
|
||||||
{
|
|
||||||
printInfo(h1);
|
|
||||||
printf("Warning, [%s] has different types: 1st field: [%s], 2nd field: [%s]\n",
|
|
||||||
name,grib_get_type_name(type1),grib_get_type_name(type2));
|
|
||||||
return GRIB_TYPE_MISMATCH;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (type1 == GRIB_TYPE_LABEL)
|
if (type1 == GRIB_TYPE_LABEL)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (type1 == GRIB_TYPE_SECTION)
|
if (type1 == GRIB_TYPE_SECTION)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
|
||||||
if ((err = grib_get_size(h1, name, &len1)) != GRIB_SUCCESS) {
|
if ((err = grib_get_size(h1, name, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get size of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
|
printf("Error: cannot get size of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -457,21 +445,11 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
}
|
}
|
||||||
|
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get size of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
|
printf("Error: cannot get size of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if(len1 != len2 && type1 != GRIB_TYPE_STRING)
|
|
||||||
{
|
|
||||||
printInfo(h1);
|
|
||||||
printf("[%s] has different size: 1st field: %ld, 2nd field: %ld\n",name,(long)len1,(long)len2);
|
|
||||||
save_error(c,name);
|
|
||||||
return GRIB_COUNT_MISMATCH;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (options->mode != MODE_GTS) {
|
if (options->mode != MODE_GTS) {
|
||||||
/* TODO: Ignore missing values for keys in GTS. Not yet implemented */
|
/* TODO: Ignore missing values for keys in GTS. Not yet implemented */
|
||||||
isMissing1 = ((grib_is_missing(h1, name, &err1) == 1) && (err1 == 0)) ? 1 : 0;
|
isMissing1 = ((grib_is_missing(h1, name, &err1) == 1) && (err1 == 0)) ? 1 : 0;
|
||||||
|
@ -485,8 +463,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMissing1 == 1) {
|
if (isMissing1 == 1) {
|
||||||
if (verbose)
|
if (verbose) printf(" is set to missing in 1st field\n");
|
||||||
printf(" is set to missing in 1st field\n");
|
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("%s is set to missing in 1st field but is not missing in 2nd field\n", name);
|
printf("%s is set to missing in 1st field but is not missing in 2nd field\n", name);
|
||||||
err1 = GRIB_VALUE_MISMATCH;
|
err1 = GRIB_VALUE_MISMATCH;
|
||||||
|
@ -495,8 +472,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMissing2 == 1) {
|
if (isMissing2 == 1) {
|
||||||
if (verbose)
|
if (verbose) printf(" is set to missing in 1st field\n");
|
||||||
printf(" is set to missing in 1st field\n");
|
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("%s is set to missing in 2nd field but is not missing in 1st field\n", name);
|
printf("%s is set to missing in 2nd field but is not missing in 1st field\n", name);
|
||||||
err1 = GRIB_VALUE_MISMATCH;
|
err1 = GRIB_VALUE_MISMATCH;
|
||||||
|
@ -506,8 +482,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
|
|
||||||
switch (type1) {
|
switch (type1) {
|
||||||
case GRIB_TYPE_STRING:
|
case GRIB_TYPE_STRING:
|
||||||
if (verbose)
|
if (verbose) printf(" as string\n");
|
||||||
printf(" as string\n");
|
|
||||||
grib_get_string_length(h1, name, &len1);
|
grib_get_string_length(h1, name, &len1);
|
||||||
grib_get_string_length(h2, name, &len2);
|
grib_get_string_length(h2, name, &len2);
|
||||||
sval1 = (char*)grib_context_malloc(h1->context, len1 * sizeof(char));
|
sval1 = (char*)grib_context_malloc(h1->context, len1 * sizeof(char));
|
||||||
|
@ -515,14 +490,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
|
|
||||||
if ((err1 = grib_get_string(h1, name, sval1, &len1)) != GRIB_SUCCESS) {
|
if ((err1 = grib_get_string(h1, name, sval1, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get string value of [%s] in 1st field: %s\n",
|
printf("Error: cannot get string value of [%s] in 1st field: %s\n",
|
||||||
name, grib_get_error_message(err1));
|
name, grib_get_error_message(err1));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err2 = grib_get_string(h2, name, sval2, &len2)) != GRIB_SUCCESS) {
|
if ((err2 = grib_get_string(h2, name, sval2, &len2)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get string value of [%s] in 2nd field: %s\n",
|
printf("Error: cannot get string value of [%s] in 2nd field: %s\n",
|
||||||
name, grib_get_error_message(err2));
|
name, grib_get_error_message(err2));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
@ -548,22 +523,21 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GRIB_TYPE_LONG:
|
case GRIB_TYPE_LONG:
|
||||||
if (verbose)
|
if (verbose) printf(" as long\n");
|
||||||
printf(" as long\n");
|
|
||||||
|
|
||||||
lval1 = (long*)grib_context_malloc(h1->context, len1 * sizeof(long));
|
lval1 = (long*)grib_context_malloc(h1->context, len1 * sizeof(long));
|
||||||
lval2 = (long*)grib_context_malloc(h2->context, len2 * sizeof(long));
|
lval2 = (long*)grib_context_malloc(h2->context, len2 * sizeof(long));
|
||||||
|
|
||||||
if ((err1 = grib_get_long_array(h1, name, lval1, &len1)) != GRIB_SUCCESS) {
|
if ((err1 = grib_get_long_array(h1, name, lval1, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get long value of [%s] in 1st field: %s\n",
|
printf("Error: cannot get long value of [%s] in 1st field: %s\n",
|
||||||
name, grib_get_error_message(err1));
|
name, grib_get_error_message(err1));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err2 = grib_get_long_array(h2, name, lval2, &len2)) != GRIB_SUCCESS) {
|
if ((err2 = grib_get_long_array(h2, name, lval2, &len2)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get long value of [%s] in 2nd field: %s\n",
|
printf("Error: cannot get long value of [%s] in 2nd field: %s\n",
|
||||||
name, grib_get_error_message(err2));
|
name, grib_get_error_message(err2));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
@ -609,69 +583,19 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GRIB_TYPE_BYTES:
|
case GRIB_TYPE_BYTES:
|
||||||
if (verbose)
|
if (verbose) printf(" as bytes\n");
|
||||||
printf(" as bytes\n");
|
if (options->mode == MODE_GTS) {
|
||||||
if (options->mode == MODE_GTS)
|
// We do not want to compare the message itself
|
||||||
return 0;
|
return 0;
|
||||||
if (len1 < 2)
|
|
||||||
len1 = 512;
|
|
||||||
if (len2 < 2)
|
|
||||||
len2 = 512;
|
|
||||||
uval1 = (unsigned char*)grib_context_malloc(h1->context, len1 * sizeof(unsigned char));
|
|
||||||
uval2 = (unsigned char*)grib_context_malloc(h2->context, len2 * sizeof(unsigned char));
|
|
||||||
|
|
||||||
if ((err1 = grib_get_bytes(h1, name, uval1, &len1)) != GRIB_SUCCESS) {
|
|
||||||
printInfo(h1);
|
|
||||||
save_error(c, name);
|
|
||||||
printf("Oops... cannot get bytes value of [%s] in 1st field: %s\n",
|
|
||||||
name, grib_get_error_message(err1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err2 = grib_get_bytes(h2, name, uval2, &len2)) != GRIB_SUCCESS) {
|
|
||||||
printInfo(h1);
|
|
||||||
save_error(c, name);
|
|
||||||
printf("Oops... cannot get bytes value of [%s] in 2nd field: %s\n",
|
|
||||||
name, grib_get_error_message(err2));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (err1 == GRIB_SUCCESS && err2 == GRIB_SUCCESS) {
|
|
||||||
if (memcmp(uval1, uval2, len1) != 0) {
|
|
||||||
size_t i;
|
|
||||||
for (i = 0; i < len1; i++)
|
|
||||||
if (uval1[i] != uval2[i]) {
|
|
||||||
printInfo(h1);
|
|
||||||
save_error(c, name);
|
|
||||||
if (len1 == 1)
|
|
||||||
printf("[%s] byte values are different: [%02x] and [%02x]\n",
|
|
||||||
name, uval1[i], uval2[i]);
|
|
||||||
else
|
|
||||||
printf("[%s] byte value %zu of %ld are different: [%02x] and [%02x]\n",
|
|
||||||
name, i, (long)len1, uval1[i], uval2[i]);
|
|
||||||
|
|
||||||
err1 = GRIB_VALUE_MISMATCH;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
err1 = GRIB_VALUE_MISMATCH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
grib_context_free(h1->context, uval1);
|
|
||||||
grib_context_free(h2->context, uval2);
|
|
||||||
|
|
||||||
if (err1)
|
|
||||||
return err1;
|
|
||||||
if (err2)
|
|
||||||
return err2;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GRIB_TYPE_LABEL:
|
case GRIB_TYPE_LABEL:
|
||||||
if (verbose)
|
if (verbose) printf(" as label\n");
|
||||||
printf(" as label\n");
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (verbose)
|
if (verbose) printf("\n");
|
||||||
printf("\n");
|
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
printf("Cannot compare [%s], unsupported type %d\n", name, type1);
|
printf("Cannot compare [%s], unsupported type %d\n", name, type1);
|
||||||
|
@ -697,7 +621,6 @@ static int compare_all_dump_keys(grib_handle* h1, grib_handle* h2, grib_runtime_
|
||||||
while (grib_keys_iterator_next(iter)) {
|
while (grib_keys_iterator_next(iter)) {
|
||||||
grib_accessor* xa = grib_keys_iterator_get_accessor(iter);
|
grib_accessor* xa = grib_keys_iterator_get_accessor(iter);
|
||||||
name = grib_keys_iterator_get_name(iter);
|
name = grib_keys_iterator_get_name(iter);
|
||||||
/* printf("----- comparing %s\n",name); */
|
|
||||||
|
|
||||||
if (blocklisted(name))
|
if (blocklisted(name))
|
||||||
continue;
|
continue;
|
||||||
|
@ -733,7 +656,6 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
|
||||||
}
|
}
|
||||||
while (grib_keys_iterator_next(iter)) {
|
while (grib_keys_iterator_next(iter)) {
|
||||||
name = grib_keys_iterator_get_name(iter);
|
name = grib_keys_iterator_get_name(iter);
|
||||||
/*printf("----- comparing %s\n",name);*/
|
|
||||||
|
|
||||||
if (blocklisted(name))
|
if (blocklisted(name))
|
||||||
continue;
|
continue;
|
||||||
|
@ -794,7 +716,6 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
|
||||||
}
|
}
|
||||||
while (grib_keys_iterator_next(iter)) {
|
while (grib_keys_iterator_next(iter)) {
|
||||||
name = grib_keys_iterator_get_name(iter);
|
name = grib_keys_iterator_get_name(iter);
|
||||||
/*printf("----- comparing %s\n",name);*/
|
|
||||||
|
|
||||||
if (blocklisted(name))
|
if (blocklisted(name))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -8,12 +8,6 @@
|
||||||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* Implementation: gts_dump
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "grib_tools.h"
|
#include "grib_tools.h"
|
||||||
|
|
||||||
grib_option grib_options[] = {
|
grib_option grib_options[] = {
|
||||||
|
@ -41,7 +35,6 @@ const char* tool_usage = "[options] file file ...";
|
||||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gts_dump
|
|
||||||
* Dump the content of a GTS file
|
* Dump the content of a GTS file
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -57,11 +50,10 @@ int grib_tool_before_getopt(grib_runtime_options* options)
|
||||||
|
|
||||||
int grib_tool_init(grib_runtime_options* options)
|
int grib_tool_init(grib_runtime_options* options)
|
||||||
{
|
{
|
||||||
int opt = grib_options_on("C") + grib_options_on("O") + grib_options_on("D");
|
int opt = grib_options_on("O") + grib_options_on("D");
|
||||||
|
|
||||||
options->dump_mode = (char*)"default";
|
options->dump_mode = (char*)"default";
|
||||||
|
|
||||||
|
|
||||||
if (opt > 1) {
|
if (opt > 1) {
|
||||||
printf("%s: simultaneous O/D options not allowed\n", tool_name);
|
printf("%s: simultaneous O/D options not allowed\n", tool_name);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -279,21 +279,29 @@ int grib_tool_init(grib_runtime_options* options)
|
||||||
if (grib_options_on("t:"))
|
if (grib_options_on("t:"))
|
||||||
tolerance_factor = atof(grib_options_get_option("t:"));
|
tolerance_factor = atof(grib_options_get_option("t:"));
|
||||||
|
|
||||||
{
|
if (grib_options_on("R:")) {
|
||||||
/* Check for 2nd file being a directory. If so, we assume user is comparing to a file */
|
char* sarg = grib_options_get_option("R:");
|
||||||
/* with the same name as first file in that directory */
|
options->tolerance_count = MAX_KEYS;
|
||||||
grib_tools_file* infile = options->infile; /* the 2nd file in comparison */
|
int err = parse_keyval_string(tool_name, sarg, 1, GRIB_TYPE_DOUBLE, options->tolerance, &(options->tolerance_count));
|
||||||
if (infile) {
|
if (err == GRIB_INVALID_ARGUMENT) {
|
||||||
if (path_is_directory(infile->name)) {
|
usage();
|
||||||
/* Take the filename of the 1st file and append to dir */
|
exit(1);
|
||||||
char bufr[2048] = {0,};
|
}
|
||||||
/* options->infile_extra->name is the 1st file */
|
}
|
||||||
snprintf(bufr, 2048, "%s%c%s",
|
|
||||||
infile->name,
|
// Check for 2nd file being a directory. If so, we assume user is comparing to a file
|
||||||
get_dir_separator_char(),
|
// with the same name as first file in that directory
|
||||||
extract_filename(options->infile_extra->name));
|
grib_tools_file* infile = options->infile; // the 2nd file in comparison
|
||||||
infile->name = strdup(bufr);
|
if (infile) {
|
||||||
}
|
if (path_is_directory(infile->name)) {
|
||||||
|
// Take the filename of the 1st file and append to dir
|
||||||
|
char bufr[2048] = {0,};
|
||||||
|
// options->infile_extra->name is the 1st file
|
||||||
|
snprintf(bufr, 2048, "%s%c%s",
|
||||||
|
infile->name,
|
||||||
|
get_dir_separator_char(),
|
||||||
|
extract_filename(options->infile_extra->name));
|
||||||
|
infile->name = strdup(bufr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +452,7 @@ static void save_error(grib_context* c, const char* key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_handle* h2, const char* name, int type)
|
static int compare_values(const grib_runtime_options* options, grib_handle* h1, grib_handle* h2, const char* name, int type)
|
||||||
{
|
{
|
||||||
size_t len1 = 0;
|
size_t len1 = 0;
|
||||||
size_t len2 = 0;
|
size_t len2 = 0;
|
||||||
|
@ -456,7 +464,6 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
int isMissing1 = 0, isMissing2 = 0;
|
int isMissing1 = 0, isMissing2 = 0;
|
||||||
|
|
||||||
char *sval1 = NULL, *sval2 = NULL;
|
char *sval1 = NULL, *sval2 = NULL;
|
||||||
unsigned char *uval1 = NULL, *uval2 = NULL;
|
|
||||||
double *dval1 = NULL, *dval2 = NULL;
|
double *dval1 = NULL, *dval2 = NULL;
|
||||||
long *lval1 = NULL, *lval2 = NULL;
|
long *lval1 = NULL, *lval2 = NULL;
|
||||||
double maxdiff = 0;
|
double maxdiff = 0;
|
||||||
|
@ -470,7 +477,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
|
|
||||||
if (type1 == GRIB_TYPE_UNDEFINED && (err = grib_get_native_type(h1, name, &type1)) != GRIB_SUCCESS) {
|
if (type1 == GRIB_TYPE_UNDEFINED && (err = grib_get_native_type(h1, name, &type1)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get type of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
|
printf("Error: cannot get type of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -483,7 +490,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get type of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
|
printf("Error: cannot get type of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -497,7 +504,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
|
|
||||||
if ((err = grib_get_size(h1, name, &len1)) != GRIB_SUCCESS) {
|
if ((err = grib_get_size(h1, name, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get size of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
|
printf("Error: cannot get size of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -511,7 +518,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
}
|
}
|
||||||
|
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get size of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
|
printf("Error: cannot get size of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -559,14 +566,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
|
|
||||||
if ((err1 = grib_get_string(h1, name, sval1, &len1)) != GRIB_SUCCESS) {
|
if ((err1 = grib_get_string(h1, name, sval1, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get string value of [%s] in 1st field: %s\n",
|
printf("Error: cannot get string value of [%s] in 1st field: %s\n",
|
||||||
name, grib_get_error_message(err1));
|
name, grib_get_error_message(err1));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err2 = grib_get_string(h2, name, sval2, &len2)) != GRIB_SUCCESS) {
|
if ((err2 = grib_get_string(h2, name, sval2, &len2)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get string value of [%s] in 2nd field: %s\n",
|
printf("Error: cannot get string value of [%s] in 2nd field: %s\n",
|
||||||
name, grib_get_error_message(err2));
|
name, grib_get_error_message(err2));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
@ -600,14 +607,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
|
|
||||||
if ((err1 = grib_get_long_array(h1, name, lval1, &len1)) != GRIB_SUCCESS) {
|
if ((err1 = grib_get_long_array(h1, name, lval1, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get long value of [%s] in 1st field: %s\n",
|
printf("Error: cannot get long value of [%s] in 1st field: %s\n",
|
||||||
name, grib_get_error_message(err1));
|
name, grib_get_error_message(err1));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err2 = grib_get_long_array(h2, name, lval2, &len2)) != GRIB_SUCCESS) {
|
if ((err2 = grib_get_long_array(h2, name, lval2, &len2)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get long value of [%s] in 2nd field: %s\n",
|
printf("Error: cannot get long value of [%s] in 2nd field: %s\n",
|
||||||
name, grib_get_error_message(err2));
|
name, grib_get_error_message(err2));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
@ -666,14 +673,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
|
|
||||||
if ((err1 = grib_get_double_array(h1, name, dval1, &len1)) != GRIB_SUCCESS) {
|
if ((err1 = grib_get_double_array(h1, name, dval1, &len1)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get double value of [%s] in 1st field: %s\n",
|
printf("Error: cannot get double value of [%s] in 1st field: %s\n",
|
||||||
name, grib_get_error_message(err1));
|
name, grib_get_error_message(err1));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err2 = grib_get_double_array(h2, name, dval2, &len2)) != GRIB_SUCCESS) {
|
if ((err2 = grib_get_double_array(h2, name, dval2, &len2)) != GRIB_SUCCESS) {
|
||||||
printInfo(h1);
|
printInfo(h1);
|
||||||
printf("Oops... cannot get double value of [%s] in 2nd field: %s\n",
|
printf("Error: cannot get double value of [%s] in 2nd field: %s\n",
|
||||||
name, grib_get_error_message(err2));
|
name, grib_get_error_message(err2));
|
||||||
save_error(c, name);
|
save_error(c, name);
|
||||||
}
|
}
|
||||||
|
@ -693,8 +700,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
pv1 = dval1;
|
pv1 = dval1;
|
||||||
pv2 = dval2;
|
pv2 = dval2;
|
||||||
value_tolerance *= tolerance_factor;
|
value_tolerance *= tolerance_factor;
|
||||||
if (verbose)
|
if (verbose) {
|
||||||
printf(" (%d values) tolerance=%g\n", (int)len1, value_tolerance);
|
printf(" (%d values) tolerance=%g \t", (int)len1, value_tolerance);
|
||||||
|
if (compare_double == &compare_double_absolute)
|
||||||
|
printf("using compare_double_absolute");
|
||||||
|
if (compare_double == &compare_double_relative)
|
||||||
|
printf("using compare_double_relative");
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
for (i = 0; i < len1; i++) {
|
for (i = 0; i < len1; i++) {
|
||||||
if ((diff = compare_double(pv1++, pv2++, &value_tolerance)) != 0) {
|
if ((diff = compare_double(pv1++, pv2++, &value_tolerance)) != 0) {
|
||||||
countdiff++;
|
countdiff++;
|
||||||
|
@ -746,54 +759,6 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
|
||||||
printf(" as bytes\n");
|
printf(" as bytes\n");
|
||||||
if (options->mode == MODE_METAR)
|
if (options->mode == MODE_METAR)
|
||||||
return 0;
|
return 0;
|
||||||
if (len1 < 2)
|
|
||||||
len1 = 512;
|
|
||||||
if (len2 < 2)
|
|
||||||
len2 = 512;
|
|
||||||
uval1 = (unsigned char*)grib_context_malloc(h1->context, len1 * sizeof(unsigned char));
|
|
||||||
uval2 = (unsigned char*)grib_context_malloc(h2->context, len2 * sizeof(unsigned char));
|
|
||||||
|
|
||||||
if ((err1 = grib_get_bytes(h1, name, uval1, &len1)) != GRIB_SUCCESS) {
|
|
||||||
printInfo(h1);
|
|
||||||
save_error(c, name);
|
|
||||||
printf("Oops... cannot get bytes value of [%s] in 1st field: %s\n",
|
|
||||||
name, grib_get_error_message(err1));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((err2 = grib_get_bytes(h2, name, uval2, &len2)) != GRIB_SUCCESS) {
|
|
||||||
printInfo(h1);
|
|
||||||
save_error(c, name);
|
|
||||||
printf("Oops... cannot get bytes value of [%s] in 2nd field: %s\n",
|
|
||||||
name, grib_get_error_message(err2));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (err1 == GRIB_SUCCESS && err2 == GRIB_SUCCESS) {
|
|
||||||
if (memcmp(uval1, uval2, len1) != 0) {
|
|
||||||
for (i = 0; i < len1; i++)
|
|
||||||
if (uval1[i] != uval2[i]) {
|
|
||||||
printInfo(h1);
|
|
||||||
save_error(c, name);
|
|
||||||
if (len1 == 1)
|
|
||||||
printf("[%s] byte values are different: [%02x] and [%02x]\n",
|
|
||||||
name, uval1[i], uval2[i]);
|
|
||||||
else
|
|
||||||
printf("[%s] byte value %d of %ld are different: [%02x] and [%02x]\n",
|
|
||||||
name, i, (long)len1, uval1[i], uval2[i]);
|
|
||||||
|
|
||||||
err1 = GRIB_VALUE_MISMATCH;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
err1 = GRIB_VALUE_MISMATCH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
grib_context_free(h1->context, uval1);
|
|
||||||
grib_context_free(h2->context, uval2);
|
|
||||||
|
|
||||||
if (err1)
|
|
||||||
return err1;
|
|
||||||
if (err2)
|
|
||||||
return err2;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GRIB_TYPE_LABEL:
|
case GRIB_TYPE_LABEL:
|
||||||
|
@ -828,7 +793,6 @@ static int compare_all_dump_keys(grib_handle* h1, grib_handle* h2, grib_runtime_
|
||||||
while (grib_keys_iterator_next(iter)) {
|
while (grib_keys_iterator_next(iter)) {
|
||||||
grib_accessor* xa = grib_keys_iterator_get_accessor(iter);
|
grib_accessor* xa = grib_keys_iterator_get_accessor(iter);
|
||||||
name = grib_keys_iterator_get_name(iter);
|
name = grib_keys_iterator_get_name(iter);
|
||||||
/* printf("----- comparing %s\n",name); */
|
|
||||||
|
|
||||||
if (blocklisted(name))
|
if (blocklisted(name))
|
||||||
continue;
|
continue;
|
||||||
|
@ -864,7 +828,6 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
|
||||||
}
|
}
|
||||||
while (grib_keys_iterator_next(iter)) {
|
while (grib_keys_iterator_next(iter)) {
|
||||||
name = grib_keys_iterator_get_name(iter);
|
name = grib_keys_iterator_get_name(iter);
|
||||||
/*printf("----- comparing %s\n",name);*/
|
|
||||||
|
|
||||||
if (blocklisted(name))
|
if (blocklisted(name))
|
||||||
continue;
|
continue;
|
||||||
|
@ -886,7 +849,6 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
|
||||||
const void *msg1 = NULL, *msg2 = NULL;
|
const void *msg1 = NULL, *msg2 = NULL;
|
||||||
size_t size1 = 0, size2 = 0;
|
size_t size1 = 0, size2 = 0;
|
||||||
int memcmp_ret = 0;
|
int memcmp_ret = 0;
|
||||||
/* int ii=0; */
|
|
||||||
GRIB_CHECK_NOLINE(grib_get_message(h1, &msg1, &size1), 0);
|
GRIB_CHECK_NOLINE(grib_get_message(h1, &msg1, &size1), 0);
|
||||||
GRIB_CHECK_NOLINE(grib_get_message(h2, &msg2, &size2), 0);
|
GRIB_CHECK_NOLINE(grib_get_message(h2, &msg2, &size2), 0);
|
||||||
if (size1 == size2 && !(memcmp_ret = memcmp(msg1, msg2, size1))) {
|
if (size1 == size2 && !(memcmp_ret = memcmp(msg1, msg2, size1))) {
|
||||||
|
@ -905,7 +867,6 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
|
||||||
}
|
}
|
||||||
while (grib_keys_iterator_next(iter)) {
|
while (grib_keys_iterator_next(iter)) {
|
||||||
name = grib_keys_iterator_get_name(iter);
|
name = grib_keys_iterator_get_name(iter);
|
||||||
/*printf("----- comparing %s\n",name);*/
|
|
||||||
|
|
||||||
if (blocklisted(name))
|
if (blocklisted(name))
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue