mirror of https://github.com/ecmwf/eccodes.git
Add codes_get_product_kind
This commit is contained in:
parent
7738c9e23e
commit
bdf2b02b49
|
@ -26,9 +26,12 @@ static void* process_grib(void* threadID)
|
|||
double min=0,max=0;
|
||||
double pv[4]={1,2,3,4};
|
||||
const size_t pvsize=4;
|
||||
ProductKind prod_kind = 0;
|
||||
|
||||
codes_handle* h = codes_grib_handle_new_from_samples(0, "regular_ll_pl_grib2");
|
||||
assert(h);
|
||||
CODES_CHECK(codes_get_product_kind(h, &prod_kind), 0);
|
||||
assert(prod_kind == PRODUCT_GRIB);
|
||||
printf("Thread %ld running\n", tid);
|
||||
|
||||
CODES_CHECK(codes_set_long(h,"indicatorOfUnitOfTimeRange", indicatorOfUnitOfTimeRange),0);
|
||||
|
|
|
@ -1208,6 +1208,7 @@ void codes_get_reduced_row_p(long pl, double lon_first, double lon_last, long *n
|
|||
/* read products */
|
||||
int codes_get_message_offset(codes_handle* h,off_t* offset);
|
||||
int codes_get_message_size(codes_handle* h,size_t* size);
|
||||
int codes_get_product_kind(codes_handle* h, ProductKind* product_kind);
|
||||
|
||||
codes_box* codes_box_new(codes_handle* h,int* error);
|
||||
codes_points* codes_box_get_points(codes_box *box,double north, double west,double south,double east, int *err);
|
||||
|
|
|
@ -1286,6 +1286,15 @@ int grib_get_message_offset ( grib_handle* h,off_t* offset )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int codes_get_product_kind(grib_handle* h, ProductKind* product_kind)
|
||||
{
|
||||
if (h) {
|
||||
*product_kind = h->product_kind;
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
return GRIB_NULL_HANDLE;
|
||||
}
|
||||
|
||||
int grib_get_message_size ( grib_handle* h,size_t* size )
|
||||
{
|
||||
long totalLength=0;
|
||||
|
|
|
@ -28,13 +28,16 @@ int main(int argc,char* argv[])
|
|||
const char* infile = "../data/bufr/mhen_55.bufr";
|
||||
const char* key_name = "#5#brightnessTemperature";
|
||||
const double tolerance = 1e-6;
|
||||
ProductKind prod_kind = 0;
|
||||
|
||||
in=fopen(infile,"rb");
|
||||
assert(in);
|
||||
|
||||
while ((h = codes_handle_new_from_file(NULL, in, PRODUCT_BUFR, &err)) != NULL || err != CODES_SUCCESS)
|
||||
{
|
||||
assert(h);
|
||||
CODES_CHECK(codes_get_product_kind(h, &prod_kind), 0);
|
||||
assert(prod_kind == PRODUCT_BUFR);
|
||||
|
||||
CODES_CHECK(codes_get_long(h, "compressedData", &compressed), 0);
|
||||
assert(compressed == 1);
|
||||
|
||||
|
|
Loading…
Reference in New Issue