mirror of https://github.com/ecmwf/eccodes.git
ECC-80: Python example/test
This commit is contained in:
parent
988cf877c6
commit
5e40052511
|
@ -48,6 +48,7 @@ list( APPEND tests
|
||||||
bufr_print_data
|
bufr_print_data
|
||||||
bufr_set_keys
|
bufr_set_keys
|
||||||
bufr_subset
|
bufr_subset
|
||||||
|
get_product_kind
|
||||||
)
|
)
|
||||||
foreach( test ${tests} )
|
foreach( test ${tests} )
|
||||||
ecbuild_add_test( TARGET p_${test}_test
|
ecbuild_add_test( TARGET p_${test}_test
|
||||||
|
|
|
@ -4,7 +4,7 @@ AM_CFLAGS = @WARN_PEDANTIC@ @WERROR@
|
||||||
TESTS = clone.sh count_messages.sh get.sh index.sh iterator.sh keys_iterator.sh multi_write.sh nearest.sh print_data.sh \
|
TESTS = clone.sh count_messages.sh get.sh index.sh iterator.sh keys_iterator.sh multi_write.sh nearest.sh print_data.sh \
|
||||||
samples.sh set.sh set_missing.sh binary_message.sh set_bitmap.sh bufr_print_header.sh bufr_print_data.sh \
|
samples.sh set.sh set_missing.sh binary_message.sh set_bitmap.sh bufr_print_header.sh bufr_print_data.sh \
|
||||||
bufr_clone.sh bufr_get_keys.sh bufr_set_keys.sh bufr_expanded.sh bufr_keys_iterator.sh bufr_subset.sh \
|
bufr_clone.sh bufr_get_keys.sh bufr_set_keys.sh bufr_expanded.sh bufr_keys_iterator.sh bufr_subset.sh \
|
||||||
bufr_attributes.sh
|
bufr_attributes.sh get_product_kind.sh
|
||||||
TESTS_ENVIRONMENT = TOPBUILDDIR=$(top_builddir) PYTHON=$(PYTHON)
|
TESTS_ENVIRONMENT = TOPBUILDDIR=$(top_builddir) PYTHON=$(PYTHON)
|
||||||
|
|
||||||
noinst_PROGRAMS = p_keys_iterator p_print_data p_iterator p_count_messages
|
noinst_PROGRAMS = p_keys_iterator p_print_data p_iterator p_count_messages
|
||||||
|
@ -20,5 +20,6 @@ EXTRA_DIST = $(TESTS) include.sh clone.py count_messages.py get.py index.py iter
|
||||||
nearest.py print_data.py samples.py set.py set_missing.py binary_message.py set_pv.py set_bitmap.py \
|
nearest.py print_data.py samples.py set.py set_missing.py binary_message.py set_pv.py set_bitmap.py \
|
||||||
bufr_print_header.py bufr_print_data.py bufr_clone.py bufr_get_keys.py bufr_set_keys.py \
|
bufr_print_header.py bufr_print_data.py bufr_clone.py bufr_get_keys.py bufr_set_keys.py \
|
||||||
bufr_expanded.py bufr_keys_iterator.py bufr_subset.py bufr_attributes.py \
|
bufr_expanded.py bufr_keys_iterator.py bufr_subset.py bufr_attributes.py \
|
||||||
|
get_product_kind.py \
|
||||||
CMakeLists.txt include.ctest.sh.in
|
CMakeLists.txt include.ctest.sh.in
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -40,6 +40,7 @@ import_array();
|
||||||
|
|
||||||
// creation
|
// creation
|
||||||
int grib_c_new_from_file(FILE* f, int* INOUT, int headers_only);
|
int grib_c_new_from_file(FILE* f, int* INOUT, int headers_only);
|
||||||
|
int grib_c_new_any_from_file(FILE* f, int headers_only, int* INOUT);
|
||||||
int grib_c_new_bufr_from_file(FILE* f, int headers_only, int* INOUT);
|
int grib_c_new_bufr_from_file(FILE* f, int headers_only, int* INOUT);
|
||||||
int grib_c_new_gts_from_file(FILE* f, int headers_only, int* INOUT);
|
int grib_c_new_gts_from_file(FILE* f, int headers_only, int* INOUT);
|
||||||
int grib_c_iterator_new(int* INPUT, int* OUTPUT, int* INPUT);
|
int grib_c_iterator_new(int* INPUT, int* OUTPUT, int* INPUT);
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
from gribapi import GRIB_CHECK as CODES_CHECK
|
from gribapi import GRIB_CHECK as CODES_CHECK
|
||||||
|
from gribapi import CODES_PRODUCT_GRIB
|
||||||
|
from gribapi import CODES_PRODUCT_BUFR
|
||||||
|
from gribapi import CODES_PRODUCT_ANY
|
||||||
|
|
||||||
from gribapi import grib_new_from_file as codes_grib_new_from_file
|
from gribapi import grib_new_from_file as codes_grib_new_from_file
|
||||||
from gribapi import bufr_new_from_file as codes_bufr_new_from_file
|
from gribapi import bufr_new_from_file as codes_bufr_new_from_file
|
||||||
|
from gribapi import any_new_from_file as codes_any_new_from_file
|
||||||
|
from gribapi import codes_new_from_file
|
||||||
|
|
||||||
from gribapi import grib_count_in_file as codes_count_in_file
|
from gribapi import grib_count_in_file as codes_count_in_file
|
||||||
from gribapi import grib_multi_support_on as codes_grib_multi_support_on
|
from gribapi import grib_multi_support_on as codes_grib_multi_support_on
|
||||||
|
|
|
@ -1000,6 +1000,24 @@ int grib_c_new_gts_from_file(FILE* f,int headers_only, int* gid){
|
||||||
return GRIB_INVALID_FILE;
|
return GRIB_INVALID_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int grib_c_new_any_from_file(FILE* f,int headers_only,int* gid){
|
||||||
|
grib_handle *h = NULL;
|
||||||
|
int err = 0;
|
||||||
|
if(f){
|
||||||
|
h = codes_handle_new_from_file(0,f,PRODUCT_ANY, &err);
|
||||||
|
if(h){
|
||||||
|
push_handle(h,gid);
|
||||||
|
return GRIB_SUCCESS;
|
||||||
|
} else {
|
||||||
|
*gid=-1;
|
||||||
|
return GRIB_END_OF_FILE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*gid=-1;
|
||||||
|
return GRIB_INVALID_FILE;
|
||||||
|
}
|
||||||
|
|
||||||
int grib_c_new_bufr_from_file(FILE* f,int headers_only,int* gid){
|
int grib_c_new_bufr_from_file(FILE* f,int headers_only,int* gid){
|
||||||
grib_handle *h = NULL;
|
grib_handle *h = NULL;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
|
@ -31,6 +31,7 @@ int grib_c_clone(int *gidsrc, int *giddest);
|
||||||
int grib_c_copy_namespace(int *gidsrc, char *name, int *giddest);
|
int grib_c_copy_namespace(int *gidsrc, char *name, int *giddest);
|
||||||
int grib_c_count_in_file(FILE *f, int *n);
|
int grib_c_count_in_file(FILE *f, int *n);
|
||||||
int grib_c_new_from_file(FILE *f, int *gid, int headers_only);
|
int grib_c_new_from_file(FILE *f, int *gid, int headers_only);
|
||||||
|
int grib_c_new_any_from_file(FILE *f, int headers_only,int *gid);
|
||||||
int grib_c_new_bufr_from_file(FILE *f, int headers_only,int *gid);
|
int grib_c_new_bufr_from_file(FILE *f, int headers_only,int *gid);
|
||||||
int grib_c_new_gts_from_file(FILE *f,int headers_only, int *gid);
|
int grib_c_new_gts_from_file(FILE *f,int headers_only, int *gid);
|
||||||
int grib_c_new_from_index(int *iid, int *gid);
|
int grib_c_new_from_index(int *iid, int *gid);
|
||||||
|
|
|
@ -40,6 +40,7 @@ import_array();
|
||||||
|
|
||||||
// creation
|
// creation
|
||||||
int grib_c_new_from_file(FILE* f, int* INOUT, int headers_only);
|
int grib_c_new_from_file(FILE* f, int* INOUT, int headers_only);
|
||||||
|
int grib_c_new_any_from_file(FILE* f, int headers_only, int* INOUT);
|
||||||
int grib_c_new_bufr_from_file(FILE* f, int headers_only, int* INOUT);
|
int grib_c_new_bufr_from_file(FILE* f, int headers_only, int* INOUT);
|
||||||
int grib_c_new_gts_from_file(FILE* f, int headers_only, int* INOUT);
|
int grib_c_new_gts_from_file(FILE* f, int headers_only, int* INOUT);
|
||||||
int grib_c_iterator_new(int* INPUT, int* OUTPUT, int* INPUT);
|
int grib_c_iterator_new(int* INPUT, int* OUTPUT, int* INPUT);
|
||||||
|
|
Loading…
Reference in New Issue