ECC-1134: BUFR indexing (Part 1)

This commit is contained in:
Shahram Najm 2020-07-16 17:51:42 +01:00
parent d42b0223eb
commit 1bd6da5881
4 changed files with 12 additions and 8 deletions

View File

@ -272,17 +272,19 @@ grib_index* grib_index_new_from_file(grib_context* c,
*
* @param c : context (NULL for default context)
* @param keys : comma separated list of keys for the index.
* The type of the key can be explicitly declared appending :l for long,
* (or alternatively :i)
* :d for double, :s for string to the key name. If the type is not
* The type of the key can be explicitly declared appending ":l" for long,
* (or alternatively ":i"), ":d" for double, ":s" for string to the key name. If the type is not
* declared explicitly, the native type is assumed.
* @param err : 0 if OK, integer value on error
* @return the newly created index
*/
grib_index* grib_index_new(grib_context* c, const char* keys, int* err);
/* EXPERIMENTAL */
int codes_index_set_product_kind(grib_index* index, ProductKind product_kind);
int codes_index_set_unpack_bufr(grib_index* index, int unpack);
/**
* Indexes the file given in argument in the index given in argument.
*

View File

@ -1394,7 +1394,7 @@ struct grib_index
grib_file* files;
int count;
ProductKind product_kind;
int unpack_bufr; /* For meaningful for BUFR */
int unpack_bufr; /* Only meaningful for product_kind of BUFR */
};
/* header compute */

View File

@ -1986,8 +1986,10 @@ int is_index_file(const char* filename)
{
FILE* fh;
char buf[8] = {0,};
const char* id_grib = "GRBIDX";
const char* id_bufr = "BFRIDX";
/* Only read the first 6 characters of identifier. Exclude version */
const size_t numChars = 6;
const char* id_grib = "GRBIDX";
const char* id_bufr = "BFRIDX";
int ret = 0;
size_t size = 0;
@ -2000,7 +2002,7 @@ int is_index_file(const char* filename)
fclose(fh);
return 0;
}
size = fread(buf, 6, 1, fh);
size = fread(buf, numChars, 1, fh);
if (size != 1) {
fclose(fh);
return 0;

View File

@ -30,7 +30,7 @@ list( APPEND ecc_tools_binaries
codes_info codes_count codes_split_file
grib_histogram grib_filter grib_ls grib_dump grib_merge
grib2ppm grib_set grib_get grib_get_data grib_copy
grib_compare codes_parser grib_index_build bufr_index_build
grib_compare codes_parser grib_index_build
bufr_ls bufr_dump bufr_set bufr_get
bufr_copy bufr_compare
gts_get gts_compare gts_copy gts_dump gts_filter gts_ls