mirror of https://github.com/ecmwf/eccodes.git
Performance: add test for header extraction
This commit is contained in:
parent
029ac17d6e
commit
4ce294d0c8
|
@ -28,6 +28,7 @@ list( APPEND test_bins
|
||||||
grib_ecc-386
|
grib_ecc-386
|
||||||
bufr_ecc-517
|
bufr_ecc-517
|
||||||
bufr_get_element
|
bufr_get_element
|
||||||
|
bufr_extract_headers
|
||||||
grib_sh_ieee64
|
grib_sh_ieee64
|
||||||
ieee
|
ieee
|
||||||
grib_sh_imag
|
grib_sh_imag
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2005-2019 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 "grib_api_internal.h"
|
||||||
|
#include "eccodes.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
int main(int argc,char* argv[])
|
||||||
|
{
|
||||||
|
char* filename;
|
||||||
|
int i, err = 0;
|
||||||
|
int num_messages = 0;
|
||||||
|
codes_bufr_header* headers = NULL;
|
||||||
|
codes_context* c = codes_context_get_default();
|
||||||
|
|
||||||
|
assert(argc == 2);
|
||||||
|
|
||||||
|
filename=argv[1];
|
||||||
|
err = codes_bufr_extract_headers_malloc(c, filename, &headers, &num_messages);
|
||||||
|
assert(!err);
|
||||||
|
|
||||||
|
for (i=0; i<num_messages; ++i) {
|
||||||
|
codes_bufr_header bh = headers[i];
|
||||||
|
printf("%ld %lu %ld %ld %ld\n",
|
||||||
|
bh.edition, bh.totalLength, bh.dataCategory,
|
||||||
|
bh.masterTablesVersionNumber, bh.rdbType);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(headers);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue