mirror of https://github.com/ecmwf/eccodes.git
ECC-1134: BUFR indexing (Part 1)
This commit is contained in:
parent
d42b0223eb
commit
1bd6da5881
|
@ -272,17 +272,19 @@ grib_index* grib_index_new_from_file(grib_context* c,
|
||||||
*
|
*
|
||||||
* @param c : context (NULL for default context)
|
* @param c : context (NULL for default context)
|
||||||
* @param keys : comma separated list of keys for the index.
|
* @param keys : comma separated list of keys for the index.
|
||||||
* The type of the key can be explicitly declared appending :l for long,
|
* The type of the key can be explicitly declared appending ":l" for long,
|
||||||
* (or alternatively :i)
|
* (or alternatively ":i"), ":d" for double, ":s" for string to the key name. If the type is not
|
||||||
* :d for double, :s for string to the key name. If the type is not
|
|
||||||
* declared explicitly, the native type is assumed.
|
* declared explicitly, the native type is assumed.
|
||||||
* @param err : 0 if OK, integer value on error
|
* @param err : 0 if OK, integer value on error
|
||||||
* @return the newly created index
|
* @return the newly created index
|
||||||
*/
|
*/
|
||||||
grib_index* grib_index_new(grib_context* c, const char* keys, int* err);
|
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_product_kind(grib_index* index, ProductKind product_kind);
|
||||||
int codes_index_set_unpack_bufr(grib_index* index, int unpack);
|
int codes_index_set_unpack_bufr(grib_index* index, int unpack);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indexes the file given in argument in the index given in argument.
|
* Indexes the file given in argument in the index given in argument.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1394,7 +1394,7 @@ struct grib_index
|
||||||
grib_file* files;
|
grib_file* files;
|
||||||
int count;
|
int count;
|
||||||
ProductKind product_kind;
|
ProductKind product_kind;
|
||||||
int unpack_bufr; /* For meaningful for BUFR */
|
int unpack_bufr; /* Only meaningful for product_kind of BUFR */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* header compute */
|
/* header compute */
|
||||||
|
|
|
@ -1986,8 +1986,10 @@ int is_index_file(const char* filename)
|
||||||
{
|
{
|
||||||
FILE* fh;
|
FILE* fh;
|
||||||
char buf[8] = {0,};
|
char buf[8] = {0,};
|
||||||
const char* id_grib = "GRBIDX";
|
/* Only read the first 6 characters of identifier. Exclude version */
|
||||||
const char* id_bufr = "BFRIDX";
|
const size_t numChars = 6;
|
||||||
|
const char* id_grib = "GRBIDX";
|
||||||
|
const char* id_bufr = "BFRIDX";
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
|
||||||
|
@ -2000,7 +2002,7 @@ int is_index_file(const char* filename)
|
||||||
fclose(fh);
|
fclose(fh);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
size = fread(buf, 6, 1, fh);
|
size = fread(buf, numChars, 1, fh);
|
||||||
if (size != 1) {
|
if (size != 1) {
|
||||||
fclose(fh);
|
fclose(fh);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -30,7 +30,7 @@ list( APPEND ecc_tools_binaries
|
||||||
codes_info codes_count codes_split_file
|
codes_info codes_count codes_split_file
|
||||||
grib_histogram grib_filter grib_ls grib_dump grib_merge
|
grib_histogram grib_filter grib_ls grib_dump grib_merge
|
||||||
grib2ppm grib_set grib_get grib_get_data grib_copy
|
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_ls bufr_dump bufr_set bufr_get
|
||||||
bufr_copy bufr_compare
|
bufr_copy bufr_compare
|
||||||
gts_get gts_compare gts_copy gts_dump gts_filter gts_ls
|
gts_get gts_compare gts_copy gts_dump gts_filter gts_ls
|
||||||
|
|
Loading…
Reference in New Issue