Merge branch 'eccodes' of ssh://software.ecmwf.int:7999/grib/grib_api into eccodes

This commit is contained in:
Enrico Fucile 2015-03-17 16:00:26 +00:00
commit 767d813e63
76 changed files with 506 additions and 515 deletions

37
.gitignore vendored
View File

@ -92,26 +92,27 @@ examples/F90/*.sh.log
examples/F90/*.sh.trs examples/F90/*.sh.trs
examples/F90/test-suite.log examples/F90/test-suite.log
examples/C/bufr_read_header examples/C/bufr_read_header
examples/C/bufr_read_synop
examples/C/bufr_read_temp examples/C/bufr_read_temp
examples/C/bufr_print_data examples/C/bufr_print_data
examples/C/bufr_print_header examples/C/bufr_print_header
examples/C/get examples/C/grib_get_keys
examples/C/get_data examples/C/get_data
examples/C/get_product_kind examples/C/get_product_kind
examples/C/iterator examples/C/grib_iterator
examples/C/keys_iterator examples/C/grib_keys_iterator
examples/C/large_grib1 examples/C/large_grib1
examples/C/list examples/C/list
examples/C/mars_param examples/C/mars_param
examples/C/multi examples/C/multi
examples/C/multi2 examples/C/multi2
examples/C/multi_write examples/C/multi_write
examples/C/nearest examples/C/grib_nearest
examples/C/points examples/C/points
examples/C/precision examples/C/precision
examples/C/print_data examples/C/grib_print_data
examples/C/sections_copy examples/C/sections_copy
examples/C/set examples/C/grib_set_keys
examples/C/set_bitmap examples/C/set_bitmap
examples/C/set_data examples/C/set_data
examples/C/set_missing examples/C/set_missing
@ -248,35 +249,35 @@ include
#from make #from make
examples/C/check_gaussian_grid examples/C/check_gaussian_grid
examples/C/ensemble_index examples/C/grib_ensemble_index
examples/C/clone examples/C/grib_clone
examples/C/iterator_bitmap examples/C/grib_iterator_bitmap
examples/C/new_sample examples/C/new_sample
examples/F90/f_bufr_read_header examples/F90/f_bufr_read_header
examples/F90/f_bufr_clone examples/F90/f_bufr_clone
examples/F90/f_bufr_print_header examples/F90/f_bufr_print_header
examples/F90/f_clone examples/F90/f_grib_clone
examples/F90/f_copy_message examples/F90/f_copy_message
examples/F90/f_copy_namespace examples/F90/f_copy_namespace
examples/F90/f_count_messages examples/F90/f_count_messages
examples/F90/f_get examples/F90/f_grib_get_keys
examples/F90/f_get_data examples/F90/f_get_data
examples/F90/f_get_product_kind examples/F90/f_get_product_kind
examples/F90/f_get_pl examples/F90/f_get_pl
examples/F90/f_get_pv examples/F90/f_get_pv
examples/F90/f_get_set_uuid examples/F90/f_get_set_uuid
examples/F90/f_index examples/F90/f_index
examples/F90/f_keys_iterator examples/F90/f_grib_keys_iterator
examples/F90/f_multi examples/F90/f_multi
examples/F90/f_multi_write examples/F90/f_multi_write
examples/F90/f_nearest examples/F90/f_grib_nearest
examples/F90/f_new_from_file examples/F90/f_new_from_file
examples/F90/f_precision examples/F90/f_precision
examples/F90/f_print_data examples/F90/f_grib_print_data
examples/F90/f_read_from_file examples/F90/f_read_from_file
examples/F90/f_read_message examples/F90/f_read_message
examples/F90/f_samples examples/F90/f_samples
examples/F90/f_set examples/F90/f_grib_set_keys
examples/F90/f_set_bitmap examples/F90/f_set_bitmap
examples/F90/f_set_gvc examples/F90/f_set_gvc
examples/F90/f_set_missing examples/F90/f_set_missing
@ -284,9 +285,9 @@ examples/F90/f_set_pv
examples/python/.libs/ examples/python/.libs/
examples/python/my.idx examples/python/my.idx
examples/python/p_count_messages examples/python/p_count_messages
examples/python/p_iterator examples/python/p_grib_iterator
examples/python/p_keys_iterator examples/python/p_grib_keys_iterator
examples/python/p_print_data examples/python/p_grib_print_data
examples/python/*.sh.log examples/python/*.sh.log
examples/python/*.sh.trs examples/python/*.sh.trs
examples/python/test-suite.log examples/python/test-suite.log

View File

@ -1,22 +1,22 @@
#examples #examples
GRIB ( GRIB (
clone grib_clone
ensemble_index grib_ensemble_index
get grib_get_keys
index index
iterator_bitmap grib_iterator_bitmap
iterator grib_iterator
keys_iterator grib_keys_iterator
multi_write multi_write
multi multi
nearest grib_nearest
precision precision
print_data grib_print_data
set_bitmap set_bitmap
set_data set_data
set_pv set_pv
set grib_set_keys
) )
!BUFR ( !BUFR (
bufr_attributes bufr_attributes

View File

@ -1,18 +1,18 @@
/*! \page examples Grib API examples /*! \page examples Grib API examples
\example get.c get.c How to get values through the key names. \example grib_get_keys.c grib_get_keys.c How to get values through the key names.
\example set.c set.c How to set values through the key names. \example set.c set.c How to set values through the key names.
\example keys_iterator.c keys_iterator.c How to get the names of all the keys \example grib_keys_iterator.c grib_keys_iterator.c How to get the names of all the keys
defined in a message and how to iterate through them. defined in a message and how to iterate through them.
\example iterator.c iterator.c How to use an iterator on latitude, longitude, values. \example grib_iterator.c grib_iterator.c How to use an iterator on latitude, longitude, values.
\example precision.c precision.c How to control precision when coding a grib field. \example precision.c precision.c How to control precision when coding a grib field.
\example multi.c multi.c How to decode a grib message containing many fields. \example multi.c multi.c How to decode a grib message containing many fields.
\example multi_write.c multi_write.c How to encode a grib message containing many fields. \example multi_write.c multi_write.c How to encode a grib message containing many fields.
\example print_data.c print_data.c How to print all the data from a grib message. \example grib_print_data.c grib_print_data.c How to print all the data from a grib message.
\example nearest.c nearest.c How to find the nearest grid points. \example grib_nearest.c grib_nearest.c How to find the nearest grid points.
\example index.f90 How access a grib file through and index. \example index.f90 How access a grib file through and index.
\example get.f90 How to get values through the key names. \example grib_get_keys.f90 How to get values through the key names.
\example count_messages.f90 count the messages in a file and loop through them. \example count_messages.f90 count the messages in a file and loop through them.
\example get_pl.f90 How to get the list of number of points for each parallel in reduced grids. \example get_pl.f90 How to get the list of number of points for each parallel in reduced grids.
\example get_pv.f90 How to get the list of levels. \example get_pv.f90 How to get the list of levels.
@ -22,15 +22,15 @@ defined in a message and how to iterate through them.
\example set_missing.f90 How to set a missing value in the header. \example set_missing.f90 How to set a missing value in the header.
\example set_pv.f90 How to set the list of levels. \example set_pv.f90 How to set the list of levels.
\example samples.f90 How to create a new message from a samples. \example samples.f90 How to create a new message from a samples.
\example clone.f90 How to clone a message. \example grib_clone.f90 How to clone a message.
\example copy_message.f90 How to copy a message in memory and create a new message. \example copy_message.f90 How to copy a message in memory and create a new message.
\example keys_iterator.f90 How to get the names of all the keys \example grib_keys_iterator.f90 How to get the names of all the keys
defined in a message and how to iterate through them. defined in a message and how to iterate through them.
\example precision.f90 How to control precision when coding a grib field. \example precision.f90 How to control precision when coding a grib field.
\example multi_write.f90 How to encode a grib message containing many fields. \example multi_write.f90 How to encode a grib message containing many fields.
\example multi.f90 How to decode a grib message containing many fields. \example multi.f90 How to decode a grib message containing many fields.
\example print_data.f90 How to print all the data contained in a grib file. \example grib_print_data.f90 How to print all the data contained in a grib file.
\example nearest.f90 How to find the nearest grid points. \example grib_nearest.f90 How to find the nearest grid points.
\example get_fortran.F get_fortran.F How to get values through the key names. \example get_fortran.F get_fortran.F How to get values through the key names.
\example set_fortran.F set_fortran.F How to set values through the key names. \example set_fortran.F set_fortran.F How to set values through the key names.
@ -42,16 +42,16 @@ defined in a message and how to iterate through them.
\example print_data_fortran.F print_data_fortran.F How to print all the data from a grib message. \example print_data_fortran.F print_data_fortran.F How to print all the data from a grib message.
\example index.py How access a grib file through and index. \example index.py How access a grib file through and index.
\example get.py How to get values through the key names. \example grib_get_keys.py How to get values through the key names.
\example print_data.py How to print all the data contained in a grib file. \example grib_print_data.py How to print all the data contained in a grib file.
\example set.py How to set values through the key names. \example set.py How to set values through the key names.
\example nearest.py How to find the nearest grid points. \example grib_nearest.py How to find the nearest grid points.
\example set_missing.py How to set a missing value in the header. \example set_missing.py How to set a missing value in the header.
\example count_messages.py How to count the messages in a file and loop through them. \example count_messages.py How to count the messages in a file and loop through them.
\example samples.py How to create a new message from a sample. \example samples.py How to create a new message from a sample.
\example clone.py How to clone a message. \example grib_clone.py How to clone a message.
\example iterator.py How to use an iterator on latitude, longitude, values. \example grib_iterator.py How to use an iterator on latitude, longitude, values.
\example keys_iterator.py How to get the names of all the keys. \example grib_keys_iterator.py How to get the names of all the keys.
\example multi_write.py How to encode a multi grib message. \example multi_write.py How to encode a multi grib message.
\example set_pv.py How to encode the pv coefficients. \example set_pv.py How to encode the pv coefficients.

View File

@ -24,7 +24,7 @@ giving access to the main features of the C library.
The library is designed to access and modify messages in both editions with the same The library is designed to access and modify messages in both editions with the same
\ref get_set "function calls" using a set of \ref keys to access the coded information \ref get_set "function calls" using a set of \ref keys to access the coded information
( examples: \ref get.f90 "get.f90" \ref set.f90 "set.f90", \ref get.c "get.c", \ref set.c "set.c", \ref grib_get_examples "grib_get", \ref grib_set_examples "grib_set" ). ( examples: \ref grib_get_keys.f90 "grib_get_keys.f90" \ref set.f90 "set.f90", \ref grib_get_keys.c "grib_get_keys.c", \ref set.c "set.c", \ref grib_get_examples "grib_get", \ref grib_set_examples "grib_set" ).
The \ref keys "keys" available for a message are different depending not only on the edition The \ref keys "keys" available for a message are different depending not only on the edition
but also and mainly on the type of each message and the information it contains. but also and mainly on the type of each message and the information it contains.

View File

@ -5,22 +5,22 @@ that can be taken as a starting point to write more complex programs.\n
\section python Python \section python Python
- \ref index.py "index.py" How access a grib file through and index. - \ref index.py "index.py" How access a grib file through and index.
- \ref get.py "get.py" How to get values through the key names. - \ref grib_get_keys.py "grib_get_keys.py" How to get values through the key names.
- \ref print_data.py "print_data.py" How to print all the data contained in a grib file. - \ref grib_print_data.py "grib_print_data.py" How to print all the data contained in a grib file.
- \ref set.py "set.py" How to set values through the key names. - \ref set.py "set.py" How to set values through the key names.
- \ref nearest.py "nearest.py" How to find the nearest grid points. - \ref grib_nearest.py "grib_nearest.py" How to find the nearest grid points.
- \ref set_missing.py "set_missing.py" How to set a missing value in the header. - \ref set_missing.py "set_missing.py" How to set a missing value in the header.
- \ref count_messages.py "count_messages.py" How to count the messages in a file and loop through them. - \ref count_messages.py "count_messages.py" How to count the messages in a file and loop through them.
- \ref samples.py "samples.py" How to create a new message from a sample. - \ref samples.py "samples.py" How to create a new message from a sample.
- \ref clone.py "clone.py" How to clone a message. - \ref grib_clone.py "grib_clone.py" How to clone a message.
- \ref iterator.py "iterator.py" How to use an iterator on latitude, longitude, values. - \ref grib_iterator.py "grib_iterator.py" How to use an iterator on latitude, longitude, values.
- \ref keys_iterator.py "keys_iterator.py" How to get the names of all the keys. - \ref grib_keys_iterator.py "grib_keys_iterator.py" How to get the names of all the keys.
- \ref multi_write.py "multi_write.py" How to encode a multi grib message. - \ref multi_write.py "multi_write.py" How to encode a multi grib message.
- \ref set_pv.py "set_pv.py" How to encode the pv coefficients. - \ref set_pv.py "set_pv.py" How to encode the pv coefficients.
\section fortran90 Fortran 90 \section fortran90 Fortran 90
- \ref index.f90 "index.f90" how to access a grib file through an index. - \ref index.f90 "index.f90" how to access a grib file through an index.
- \ref get.f90 "get.f90" how to get values through the key names. - \ref grib_get_keys.f90 "grib_get_keys.f90" how to get values through the key names.
- \ref count_messages.f90 "count_messages.f90" count the messages in a file and loop through them. - \ref count_messages.f90 "count_messages.f90" count the messages in a file and loop through them.
- \ref get_pl.f90 "get_pl.f90" how to get the list of number of points for each parallel in reduced grids. - \ref get_pl.f90 "get_pl.f90" how to get the list of number of points for each parallel in reduced grids.
- \ref get_pv.f90 "get_pv.f90" how to get the list of levels. - \ref get_pv.f90 "get_pv.f90" how to get the list of levels.
@ -30,26 +30,26 @@ that can be taken as a starting point to write more complex programs.\n
- \ref set_missing.f90 "set_missing.f90" how to set a missing value in the header. - \ref set_missing.f90 "set_missing.f90" how to set a missing value in the header.
- \ref set_pv.f90 "set_pv.f90" how to set the list of levels. - \ref set_pv.f90 "set_pv.f90" how to set the list of levels.
- \ref samples.f90 "samples.f90" how to create a new message from a template. - \ref samples.f90 "samples.f90" how to create a new message from a template.
- \ref clone.f90 "clone.f90" how to clone a message. - \ref grib_clone.f90 "grib_clone.f90" how to clone a message.
- \ref copy_message.f90 "copy_message.f90" how to copy a message in memory and create a new message. - \ref copy_message.f90 "copy_message.f90" how to copy a message in memory and create a new message.
- \ref keys_iterator.f90 "keys_iterator.f90" how to get the names of all the keys - \ref grib_keys_iterator.f90 "grib_keys_iterator.f90" how to get the names of all the keys
defined in a message and how to iterate through them. defined in a message and how to iterate through them.
- \ref precision.f90 "precision.f90" how to control precision when coding a grib field. - \ref precision.f90 "precision.f90" how to control precision when coding a grib field.
- \ref multi_write.f90 "multi_write.f90" how to encode a grib message containing many fields. - \ref multi_write.f90 "multi_write.f90" how to encode a grib message containing many fields.
- \ref multi.f90 "multi.f90" how to decode a grib message containing many fields. - \ref multi.f90 "multi.f90" how to decode a grib message containing many fields.
- \ref print_data.f90 "print_data.f90" how to print all the data contained in a grib file. - \ref grib_print_data.f90 "grib_print_data.f90" how to print all the data contained in a grib file.
- \ref nearest.f90 "nearest.f90" how to find the nearest grid points. - \ref grib_nearest.f90 "grib_nearest.f90" how to find the nearest grid points.
\section C \section C
- \ref get.c "get.c" is an example showing how to get values through the key names. - \ref grib_get_keys.c "grib_get_keys.c" is an example showing how to get values through the key names.
- \ref set.c "set.c" is an example illustrating how to set values through the key names. - \ref set.c "set.c" is an example illustrating how to set values through the key names.
- \ref keys_iterator.c "keys_iterator.c" explains how to get the names of all the keys - \ref grib_keys_iterator.c "grib_keys_iterator.c" explains how to get the names of all the keys
defined in a message and how to iterate through them. defined in a message and how to iterate through them.
- \ref iterator.c "iterator.c" shows how to use an iterator on latitude, longitude, values. - \ref grib_iterator.c "grib_iterator.c" shows how to use an iterator on latitude, longitude, values.
- \ref precision.c "precision.c" illustrates how to control precision when coding a grib field. - \ref precision.c "precision.c" illustrates how to control precision when coding a grib field.
- \ref multi.c "multi.c" is an example describing how to decode a grib message containing many fields. - \ref multi.c "multi.c" is an example describing how to decode a grib message containing many fields.
- \ref print_data.c "print_data.c" is an example on how to print all the data contained in a grib file. - \ref grib_print_data.c "grib_print_data.c" is an example on how to print all the data contained in a grib file.
- \ref nearest.c "nearest.c" is an example on how to find the nearest grid points. - \ref grib_nearest.c "grib_nearest.c" is an example on how to find the nearest grid points.
- \ref multi_write.c "multi_write.c" how to encode a grib message containing many fields. - \ref multi_write.c "multi_write.c" how to encode a grib message containing many fields.
\section fortran77 Fortran 77 \section fortran77 Fortran 77

View File

@ -7,14 +7,14 @@ configure_file( include.ctest.sh.in include.ctest.sh @ONLY )
# Build the executables used by test scripts # Build the executables used by test scripts
################################################ ################################################
list( APPEND test_bins list( APPEND test_bins
nearest grib_nearest
set_bitmap set_bitmap
iterator grib_iterator
get grib_get_keys
print_data grib_print_data
set grib_set_keys
set_missing set_missing
keys_iterator grib_keys_iterator
set_data set_data
mars_param mars_param
values_check values_check
@ -27,11 +27,11 @@ list( APPEND test_bins
list list
get_data get_data
sections_copy sections_copy
iterator_bitmap grib_iterator_bitmap
large_grib1 large_grib1
clone grib_clone
check_gaussian_grid check_gaussian_grid
ensemble_index grib_ensemble_index
get_product_kind get_product_kind
bufr_attributes bufr_attributes
bufr_clone bufr_clone
@ -56,11 +56,11 @@ endforeach()
# Now add each test (shell scripts) # Now add each test (shell scripts)
################################################# #################################################
list( APPEND tests list( APPEND tests
iterator grib_iterator
get grib_get_keys
print_data grib_print_data
set grib_set_keys
keys_iterator grib_keys_iterator
multi multi
multi_write multi_write
precision precision
@ -68,7 +68,7 @@ list( APPEND tests
large_grib1 large_grib1
get_data get_data
set_missing set_missing
clone grib_clone
sections_copy sections_copy
set_pv set_pv
check_gaussian_grids check_gaussian_grids

View File

@ -1,17 +1,19 @@
AM_CFLAGS = @WARN_PEDANTIC@ @WERROR@ AM_CFLAGS = @WARN_PEDANTIC@ @WERROR@
TESTS = iterator.sh get.sh print_data.sh set.sh keys_iterator.sh multi.sh multi_write.sh \ TESTS = grib_iterator.sh grib_get_keys.sh grib_print_data.sh grib_set_keys.sh \
precision.sh list.sh large_grib1.sh get_data.sh sections_copy.sh set_missing.sh clone.sh set_pv.sh \ grib_keys_iterator.sh multi.sh multi_write.sh precision.sh \
check_gaussian_grids.sh \ list.sh large_grib1.sh get_data.sh sections_copy.sh \
bufr_attributes.sh bufr_clone.sh bufr_expanded.sh bufr_get_keys.sh bufr_read_header.sh bufr_read_synop.sh \ set_missing.sh grib_clone.sh set_pv.sh \
bufr_set_keys.sh bufr_subset.sh bufr_keys_iterator.sh bufr_missing.sh bufr_read_temp.sh \ check_gaussian_grids.sh bufr_attributes.sh bufr_clone.sh bufr_expanded.sh \
get_product_kind.sh bufr_get_keys.sh bufr_read_header.sh bufr_read_synop.sh \
bufr_set_keys.sh bufr_subset.sh bufr_keys_iterator.sh bufr_missing.sh \
bufr_read_temp.sh get_product_kind.sh
noinst_PROGRAMS = nearest set_bitmap iterator get print_data set set_missing keys_iterator \ noinst_PROGRAMS = grib_nearest set_bitmap grib_iterator grib_get_keys grib_print_data grib_set_keys set_missing grib_keys_iterator \
set_data mars_param values_check box multi multi2 multi_write precision \ set_data mars_param values_check box multi multi2 multi_write precision \
set_pv list sections_copy large_grib1 get_data iterator_bitmap clone new_sample \ set_pv list sections_copy large_grib1 get_data grib_iterator_bitmap grib_clone new_sample \
check_gaussian_grid ensemble_index points \ check_gaussian_grid grib_ensemble_index points \
bufr_attributes bufr_clone bufr_expanded bufr_get_keys bufr_read_header bufr_read_synop \ bufr_attributes bufr_clone bufr_expanded bufr_get_keys bufr_read_header bufr_read_synop \
bufr_get_keys bufr_subset bufr_keys_iterator bufr_set_keys bufr_missing bufr_read_temp \ bufr_get_keys bufr_subset bufr_keys_iterator bufr_set_keys bufr_missing bufr_read_temp \
get_product_kind get_product_kind
@ -22,29 +24,29 @@ box_SOURCES = box.c
set_data_SOURCES = set_data.c set_data_SOURCES = set_data.c
mars_param_SOURCES = mars_param.c mars_param_SOURCES = mars_param.c
values_check_SOURCES = values_check.c values_check_SOURCES = values_check.c
nearest_SOURCES = nearest.c grib_nearest_SOURCES = grib_nearest.c
multi_write_SOURCES = multi_write.c multi_write_SOURCES = multi_write.c
get_SOURCES = get.c grib_get_keys_SOURCES = grib_get_keys.c
print_data_SOURCES = print_data.c grib_print_data_SOURCES = grib_print_data.c
set_SOURCES = set.c grib_set_keys_SOURCES = grib_set_keys.c
set_missing_SOURCES = set_missing.c set_missing_SOURCES = set_missing.c
set_bitmap_SOURCES = set_bitmap.c set_bitmap_SOURCES = set_bitmap.c
multi_SOURCES = multi.c multi_SOURCES = multi.c
multi2_SOURCES = multi2.c multi2_SOURCES = multi2.c
keys_iterator_SOURCES = keys_iterator.c grib_keys_iterator_SOURCES = grib_keys_iterator.c
iterator_SOURCES = iterator.c grib_iterator_SOURCES = grib_iterator.c
iterator_bitmap_SOURCES = iterator_bitmap.c grib_iterator_bitmap_SOURCES = grib_iterator_bitmap.c
set_pv_SOURCES = set_pv.c set_pv_SOURCES = set_pv.c
points_SOURCES = points.c points_SOURCES = points.c
list_SOURCES = list.c list_SOURCES = list.c
sections_copy_SOURCES = sections_copy.c sections_copy_SOURCES = sections_copy.c
large_grib1_SOURCES = large_grib1.c large_grib1_SOURCES = large_grib1.c
get_data_SOURCES = get_data.c get_data_SOURCES = get_data.c
clone_SOURCES = clone.c grib_clone_SOURCES = grib_clone.c
new_sample_SOURCES = new_sample.c new_sample_SOURCES = new_sample.c
check_gaussian_grid_SOURCES = check_gaussian_grid.c check_gaussian_grid_SOURCES = check_gaussian_grid.c
ensemble_index_SOURCES = ensemble_index.c grib_ensemble_index_SOURCES = grib_ensemble_index.c
bufr_attributes_SOURCES = bufr_attributes.c bufr_attributes_SOURCES = bufr_attributes.c
bufr_clone_SOURCES = bufr_clone.c bufr_clone_SOURCES = bufr_clone.c
bufr_expanded_SOURCES = bufr_expanded.c bufr_expanded_SOURCES = bufr_expanded.c
bufr_get_keys_SOURCES = bufr_get_keys.c bufr_get_keys_SOURCES = bufr_get_keys.c

View File

@ -21,10 +21,10 @@
int main(int argc,char* argv[]) int main(int argc,char* argv[])
{ {
FILE* in = NULL; FILE* in = NULL;
/* message handle. Required in all the eccodes calls acting on a message.*/ /* message handle. Required in all the eccodes calls acting on a message.*/
codes_handle* h=NULL; codes_handle* h=NULL;
char* units= NULL; char* units= NULL;
char* unitsPercent= NULL; char* unitsPercent= NULL;
long longVal; long longVal;
@ -39,7 +39,7 @@ int main(int argc,char* argv[])
printf("ERROR: unable to open file %s\n", infile); printf("ERROR: unable to open file %s\n", infile);
return 1; return 1;
} }
/* loop over the messages in the bufr file */ /* loop over the messages in the bufr file */
while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS) while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS)
{ {
@ -48,95 +48,95 @@ int main(int argc,char* argv[])
cnt++; cnt++;
continue; continue;
} }
printf("message: %d\n",cnt); printf("message: %d\n",cnt);
/* we need to instruct ecCodes to expand the descriptors /* we need to instruct ecCodes to expand the descriptors
i.e. unpack the data values */ i.e. unpack the data values */
CODES_CHECK(codes_set_long(h,"unpack",1),0); CODES_CHECK(codes_set_long(h,"unpack",1),0);
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
We will read the value and all the attributes available for We will read the value and all the attributes available for
the 2m temperature. the 2m temperature.
-------------------------------------------------------------------*/ -------------------------------------------------------------------*/
/* get the value as double */ /* get the value as double */
CODES_CHECK(codes_get_double(h,"airTemperatureAt2M",&doubleVal),0); CODES_CHECK(codes_get_double(h,"airTemperatureAt2M",&doubleVal),0);
printf(" airTemperatureAt2M: %.2f\n",doubleVal); printf(" airTemperatureAt2M: %.2f\n",doubleVal);
/* get the element's code (see BUFR code table B) */ /* get the element's code (see BUFR code table B) */
CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->code",&longVal),0); CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->code",&longVal),0);
printf(" airTemperatureAt2M->code: %ld\n",longVal); printf(" airTemperatureAt2M->code: %ld\n",longVal);
/* get the element's units (see BUFR code table B) */ /* get the element's units (see BUFR code table B) */
/* get the size and allocate memory*/ /* get the size and allocate memory*/
CODES_CHECK(codes_get_length(h, "airTemperatureAt2M->units", &len), 0); CODES_CHECK(codes_get_length(h, "airTemperatureAt2M->units", &len), 0);
units = (char*)malloc(len*sizeof(char)); units = (char*)malloc(len*sizeof(char));
/* get the values*/ /* get the values*/
codes_get_string(h, "airTemperatureAt2M->units", units, &len); codes_get_string(h, "airTemperatureAt2M->units", units, &len);
printf(" airTemperatureAt2M->units: %s\n", units); printf(" airTemperatureAt2M->units: %s\n", units);
/* get the element's scale (see BUFR code table B) */ /* get the element's scale (see BUFR code table B) */
CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->scale",&longVal),0); CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->scale",&longVal),0);
printf(" airTemperatureAt2M->scale: %ld\n",longVal); printf(" airTemperatureAt2M->scale: %ld\n",longVal);
/* get the element's reference (see BUFR code table B) */ /* get the element's reference (see BUFR code table B) */
CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->reference",&longVal),0); CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->reference",&longVal),0);
printf(" airTemperatureAt2M->reference: %ld\n",longVal); printf(" airTemperatureAt2M->reference: %ld\n",longVal);
/* get the element's width (see BUFR code table B) */ /* get the element's width (see BUFR code table B) */
CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->width",&longVal),0); CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->width",&longVal),0);
printf(" airTemperatureAt2M->width: %ld\n",longVal); printf(" airTemperatureAt2M->width: %ld\n",longVal);
/* -------------------------------------------------------------------- /* --------------------------------------------------------------------
The 2m temperature data element in this message has an associated The 2m temperature data element in this message has an associated
field: percentConfidence. Its value and attributes can be accessed field: percentConfidence. Its value and attributes can be accessed
in a similar manner as was shown above for 2m temperature. in a similar manner as was shown above for 2m temperature.
-------------------------------------------------------------------*/ -------------------------------------------------------------------*/
/* get the value as long */ /* get the value as long */
CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->percentConfidence",&longVal),0); CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->percentConfidence",&longVal),0);
printf(" airTemperatureAt2M->percentConfidence: %ld\n",longVal); printf(" airTemperatureAt2M->percentConfidence: %ld\n",longVal);
/* get the element's code (see BUFR code table B) */ /* get the element's code (see BUFR code table B) */
CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->percentConfidence->code",&longVal),0); CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->percentConfidence->code",&longVal),0);
printf(" airTemperatureAt2M->percentConfidence->code: %ld\n",longVal); printf(" airTemperatureAt2M->percentConfidence->code: %ld\n",longVal);
/* get the element's units (see BUFR code table B) */ /* get the element's units (see BUFR code table B) */
/* get the size and allocate memory*/ /* get the size and allocate memory*/
CODES_CHECK(codes_get_length(h, "airTemperatureAt2M->percentConfidence->units", &len), 0); CODES_CHECK(codes_get_length(h, "airTemperatureAt2M->percentConfidence->units", &len), 0);
unitsPercent = (char*)malloc(len*sizeof(char)); unitsPercent = (char*)malloc(len*sizeof(char));
/* get the values*/ /* get the values*/
codes_get_string(h, "airTemperatureAt2M->percentConfidence->units", unitsPercent, &len); codes_get_string(h, "airTemperatureAt2M->percentConfidence->units", unitsPercent, &len);
printf(" airTemperatureAt2M->percentConfidence->units: %s\n", unitsPercent); printf(" airTemperatureAt2M->percentConfidence->units: %s\n", unitsPercent);
/* get the element's scale (see BUFR code table B) */ /* get the element's scale (see BUFR code table B) */
CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->percentConfidence->scale",&longVal),0); CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->percentConfidence->scale",&longVal),0);
printf(" airTemperatureAt2M->percentConfidence->scale: %ld\n",longVal); printf(" airTemperatureAt2M->percentConfidence->scale: %ld\n",longVal);
/* get the element's reference (see BUFR code table B) */ /* get the element's reference (see BUFR code table B) */
CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->percentConfidence->reference",&longVal),0); CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->percentConfidence->reference",&longVal),0);
printf(" airTemperatureAt2M->percentConfidence->reference: %ld\n",longVal); printf(" airTemperatureAt2M->percentConfidence->reference: %ld\n",longVal);
/* get the element's width (see BUFR code table B) */ /* get the element's width (see BUFR code table B) */
CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->percentConfidence->width",&longVal),0); CODES_CHECK(codes_get_long(h,"airTemperatureAt2M->percentConfidence->width",&longVal),0);
printf(" airTemperatureAt2M->percentConfidence->width: %ld\n",longVal); printf(" airTemperatureAt2M->percentConfidence->width: %ld\n",longVal);
/* free allocated arrays */ /* free allocated arrays */
free(units); free(units);
free(unitsPercent); free(unitsPercent);
/* delete handle */ /* delete handle */
codes_handle_delete(h); codes_handle_delete(h);
cnt++; cnt++;
} }
fclose(in); fclose(in);
return 0; return 0;
} }

View File

@ -27,10 +27,10 @@ int main(int argc, char *argv[])
{ {
FILE *in = NULL; FILE *in = NULL;
FILE *out = NULL; FILE *out = NULL;
/* message handle. Required in all the eccodes calls acting on a message.*/ /* message handle. Required in all the eccodes calls acting on a message.*/
codes_handle *source_handle = NULL; codes_handle *source_handle = NULL;
const void *buffer = NULL; const void *buffer = NULL;
size_t size = 0; size_t size = 0;
int i, err = 0; int i, err = 0;
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
if (in) fclose(in); if (in) fclose(in);
return 1; return 1;
} }
/* create a handle for the first message */ /* create a handle for the first message */
source_handle = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err); source_handle = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err);
@ -76,22 +76,22 @@ int main(int argc, char *argv[])
/* This is the place where you may wish to modify the clone /* This is the place where you may wish to modify the clone
E.g. we change the bufrHeaderCentre */ E.g. we change the bufrHeaderCentre */
CODES_CHECK(codes_set_long(clone_handle, "bufrHeaderCentre", 222),0); CODES_CHECK(codes_set_long(clone_handle, "bufrHeaderCentre", 222),0);
/* get the coded message in a buffer */ /* get the coded message in a buffer */
CODES_CHECK(codes_get_message(clone_handle,&buffer,&size),0); CODES_CHECK(codes_get_message(clone_handle,&buffer,&size),0);
/* write the buffer to a file */ /* write the buffer to a file */
if(fwrite(buffer,1,size,out) != size) { if(fwrite(buffer,1,size,out) != size) {
perror("ERROR: could not write message to file"); perror("ERROR: could not write message to file");
return 1; return 1;
} }
/* relase the clone's handle */ /* relase the clone's handle */
codes_handle_delete(clone_handle); codes_handle_delete(clone_handle);
} }
/* release the source's handle */ /* release the source's handle */
codes_handle_delete(source_handle); codes_handle_delete(source_handle);

View File

@ -26,17 +26,17 @@ int main(int argc,char* argv[])
{ {
char* filename = NULL; char* filename = NULL;
FILE* in = NULL; FILE* in = NULL;
/* message handle. Required in all the eccodes calls acting on a message.*/ /* message handle. Required in all the eccodes calls acting on a message.*/
codes_handle* h=NULL; codes_handle* h=NULL;
double *values = NULL; double *values = NULL;
size_t values_len=0; size_t values_len=0;
int i, err=0; int i, err=0;
int cnt=0; int cnt=0;
if (argc!=2) usage(argv[0]); if (argc!=2) usage(argv[0]);
filename=argv[1]; filename=argv[1];
/* open bufr file */ /* open bufr file */
@ -45,7 +45,7 @@ int main(int argc,char* argv[])
printf("ERROR: unable to open file %s\n", filename); printf("ERROR: unable to open file %s\n", filename);
return 1; return 1;
} }
/* loop over the messages in the bufr file */ /* loop over the messages in the bufr file */
while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS) while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS)
{ {
@ -54,30 +54,30 @@ int main(int argc,char* argv[])
cnt++; cnt++;
continue; continue;
} }
/* get the size of the values array*/ /* get the size of the values array*/
CODES_CHECK(codes_get_size(h,"numericValues",&values_len),0); CODES_CHECK(codes_get_size(h,"numericValues",&values_len),0);
printf(" number of expanded values: %ld\n",values_len); printf(" number of expanded values: %ld\n",values_len);
/* allocate array for data values */ /* allocate array for data values */
values = malloc(values_len*sizeof(double)); values = malloc(values_len*sizeof(double));
/* get the exapanded data values*/ /* get the exapanded data values*/
CODES_CHECK(codes_get_double_array(h,"numericValues",values,&values_len),0); CODES_CHECK(codes_get_double_array(h,"numericValues",values,&values_len),0);
for(i = 0; i < values_len; i++) for(i = 0; i < values_len; i++)
{ {
printf(" %.10e\n",values[i]); printf(" %.10e\n",values[i]);
} }
free(values); free(values);
/* delete handle */ /* delete handle */
codes_handle_delete(h); codes_handle_delete(h);
cnt++; cnt++;
} }
fclose(in); fclose(in);
return 0; return 0;
} }

View File

@ -21,10 +21,10 @@
int main(int argc,char* argv[]) int main(int argc,char* argv[])
{ {
FILE* in = NULL; FILE* in = NULL;
/* message handle. Required in all the eccodes calls acting on a message.*/ /* message handle. Required in all the eccodes calls acting on a message.*/
codes_handle* h=NULL; codes_handle* h=NULL;
long *descriptors=NULL; long *descriptors=NULL;
double *values = NULL; double *values = NULL;
char* typicalDate= NULL; char* typicalDate= NULL;
@ -40,7 +40,7 @@ int main(int argc,char* argv[])
printf("ERROR: unable to open file %s\n", infile); printf("ERROR: unable to open file %s\n", infile);
return 1; return 1;
} }
/* loop over the messages in the bufr file */ /* loop over the messages in the bufr file */
while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS) while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS)
{ {
@ -49,43 +49,43 @@ int main(int argc,char* argv[])
cnt++; cnt++;
continue; continue;
} }
printf("message: %d\n",cnt); printf("message: %d\n",cnt);
/* we need to instruct ecCodes to expand the descriptors /* we need to instruct ecCodes to expand the descriptors
i.e. unpack the data values */ i.e. unpack the data values */
CODES_CHECK(codes_set_long(h,"unpack",1),0); CODES_CHECK(codes_set_long(h,"unpack",1),0);
/* read and print some data values */ /* read and print some data values */
/* long value */ /* long value */
CODES_CHECK(codes_get_long(h,"blockNumber",&longVal),0); CODES_CHECK(codes_get_long(h,"blockNumber",&longVal),0);
printf(" blockNumber: %ld\n",longVal); printf(" blockNumber: %ld\n",longVal);
/* long value */ /* long value */
CODES_CHECK(codes_get_long(h,"stationNumber",&longVal),0); CODES_CHECK(codes_get_long(h,"stationNumber",&longVal),0);
printf(" stationNumber: %ld\n",longVal); printf(" stationNumber: %ld\n",longVal);
/* double value */ /* double value */
CODES_CHECK(codes_get_double(h,"airTemperatureAt2M",&doubleVal),0); CODES_CHECK(codes_get_double(h,"airTemperatureAt2M",&doubleVal),0);
printf(" airTemperatureAt2M: %f\n",doubleVal); printf(" airTemperatureAt2M: %f\n",doubleVal);
/* ---- string value -----------------*/ /* ---- string value -----------------*/
/* get the size and allocate memory*/ /* get the size and allocate memory*/
CODES_CHECK(codes_get_length(h, "typicalDate", &len), 0); CODES_CHECK(codes_get_length(h, "typicalDate", &len), 0);
typicalDate = (char*)malloc(len*sizeof(char)); typicalDate = (char*)malloc(len*sizeof(char));
/* get the values*/ /* get the values*/
codes_get_string(h, "typicalDate", typicalDate, &len); codes_get_string(h, "typicalDate", typicalDate, &len);
printf(" typicalDate: %s\n", typicalDate); printf(" typicalDate: %s\n", typicalDate);
/* ---- array of long ----------------*/ /* ---- array of long ----------------*/
/* get the size and allocate memory*/ /* get the size and allocate memory*/
CODES_CHECK(codes_get_size(h,"bufrdcExpandedDescriptors",&desc_len),0); CODES_CHECK(codes_get_size(h,"bufrdcExpandedDescriptors",&desc_len),0);
descriptors = malloc(desc_len*sizeof(long)); descriptors = malloc(desc_len*sizeof(long));
/* get the values */ /* get the values */
CODES_CHECK(codes_get_long_array(h,"bufrdcExpandedDescriptors",descriptors,&desc_len),0); CODES_CHECK(codes_get_long_array(h,"bufrdcExpandedDescriptors",descriptors,&desc_len),0);
printf(" bufrdcExpandedDescriptors:\n"); printf(" bufrdcExpandedDescriptors:\n");
@ -93,13 +93,13 @@ int main(int argc,char* argv[])
{ {
printf(" %ld\n",descriptors[i]); printf(" %ld\n",descriptors[i]);
} }
/* ---- array of double ---------------*/ /* ---- array of double ---------------*/
/* get the size and allocate memory*/ /* get the size and allocate memory*/
CODES_CHECK(codes_get_size(h,"numericValues",&values_len),0); CODES_CHECK(codes_get_size(h,"numericValues",&values_len),0);
values = malloc(values_len*sizeof(double)); values = malloc(values_len*sizeof(double));
/* get the values*/ /* get the values*/
CODES_CHECK(codes_get_double_array(h,"numericValues",values,&values_len),0); CODES_CHECK(codes_get_double_array(h,"numericValues",values,&values_len),0);
printf(" numericValues:\n"); printf(" numericValues:\n");
@ -107,18 +107,18 @@ int main(int argc,char* argv[])
{ {
printf(" %.10e\n",values[i]); printf(" %.10e\n",values[i]);
} }
/* free allocated arrays */ /* free allocated arrays */
free(descriptors); free(descriptors);
free(values); free(values);
free(typicalDate); free(typicalDate);
/* delete handle */ /* delete handle */
codes_handle_delete(h); codes_handle_delete(h);
cnt++; cnt++;
} }
fclose(in); fclose(in);
return 0; return 0;
} }

View File

@ -31,15 +31,15 @@ int main(int argc,char* argv[])
{ {
char* filename = NULL; char* filename = NULL;
FILE* in = NULL; FILE* in = NULL;
/* message handle. Required in all the eccodes calls acting on a message.*/ /* message handle. Required in all the eccodes calls acting on a message.*/
codes_handle* h=NULL; codes_handle* h=NULL;
long longVal; long longVal;
int err=0, cnt=0; int err=0, cnt=0;
int keyType; int keyType;
/* To skip certain keys use the combination of these flags: /* To skip certain keys use the combination of these flags:
unsigned long key_iterator_filter_flags= unsigned long key_iterator_filter_flags=
CODES_KEYS_ITERATOR_SKIP_READ_ONLY || CODES_KEYS_ITERATOR_SKIP_READ_ONLY ||
CODES_KEYS_ITERATOR_SKIP_COMPUTED || CODES_KEYS_ITERATOR_SKIP_COMPUTED ||
@ -47,18 +47,18 @@ int main(int argc,char* argv[])
CODES_KEYS_ITERATOR_SKIP_EDITION_SPECIFIC || CODES_KEYS_ITERATOR_SKIP_EDITION_SPECIFIC ||
CODES_KEYS_ITERATOR_SKIP_DUPLICATES || CODES_KEYS_ITERATOR_SKIP_DUPLICATES ||
CODES_KEYS_ITERATOR_SKIP_FUNCTION; */ CODES_KEYS_ITERATOR_SKIP_FUNCTION; */
unsigned long key_iterator_filter_flags=CODES_KEYS_ITERATOR_ALL_KEYS; unsigned long key_iterator_filter_flags=CODES_KEYS_ITERATOR_ALL_KEYS;
/* name_space=NULL to get all the keys. Other namespaces are e.g. "ls" */ /* name_space=NULL to get all the keys. Other namespaces are e.g. "ls" */
char* name_space=0; char* name_space=0;
char value[MAX_VAL_LEN]; char value[MAX_VAL_LEN];
size_t vlen=MAX_VAL_LEN; size_t vlen=MAX_VAL_LEN;
size_t klen=0; size_t klen=0;
if (argc!=2) usage(argv[0]); if (argc!=2) usage(argv[0]);
filename=argv[1]; filename=argv[1];
in=fopen(filename,"r"); in=fopen(filename,"r");
@ -66,7 +66,7 @@ int main(int argc,char* argv[])
printf("ERROR: unable to open file %s\n", filename); printf("ERROR: unable to open file %s\n", filename);
return 1; return 1;
} }
/* loop over the messages in the bufr file */ /* loop over the messages in the bufr file */
while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS) while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS)
{ {
@ -76,7 +76,7 @@ int main(int argc,char* argv[])
cnt++; cnt++;
continue; continue;
} }
printf("message: %d\n",cnt); printf("message: %d\n",cnt);
/* get key iterator */ /* get key iterator */
@ -85,28 +85,28 @@ int main(int argc,char* argv[])
printf("ERROR: Unable to create keys iterator\n"); printf("ERROR: Unable to create keys iterator\n");
exit(1); exit(1);
} }
/* we need to instruct ecCodes to unpack the data values */ /* we need to instruct ecCodes to unpack the data values */
CODES_CHECK(codes_set_long(h,"unpack",1),0); CODES_CHECK(codes_set_long(h,"unpack",1),0);
/* loop over the keys */ /* loop over the keys */
while(codes_keys_iterator_next(kiter)) while(codes_keys_iterator_next(kiter))
{ {
/* get key name*/ /* get key name*/
const char* name = codes_keys_iterator_get_name(kiter); const char* name = codes_keys_iterator_get_name(kiter);
printf(" %s=",name); printf(" %s=",name);
CODES_CHECK(codes_get_native_type(h,name,&keyType),0); CODES_CHECK(codes_get_native_type(h,name,&keyType),0);
/* get key size to see if it is an array */ /* get key size to see if it is an array */
CODES_CHECK(codes_get_size(h,name,&klen),0); CODES_CHECK(codes_get_size(h,name,&klen),0);
/* not array */ /* not array */
if(klen ==1 || keyType == CODES_TYPE_STRING) if(klen ==1 || keyType == CODES_TYPE_STRING)
{ {
vlen=MAX_VAL_LEN; vlen=MAX_VAL_LEN;
bzero(value,vlen); bzero(value,vlen);
codes_get_string(h,name,value,&vlen); codes_get_string(h,name,value,&vlen);
printf("%s\n",value); printf("%s\n",value);
} }
@ -114,16 +114,16 @@ int main(int argc,char* argv[])
else else
printf("(array of %ld)\n",klen); printf("(array of %ld)\n",klen);
} }
/* delete key iterator */ /* delete key iterator */
codes_keys_iterator_delete(kiter); codes_keys_iterator_delete(kiter);
/* delete handle */ /* delete handle */
codes_handle_delete(h); codes_handle_delete(h);
cnt++; cnt++;
} }
fclose(in); fclose(in);
return 0; return 0;
} }

View File

@ -21,10 +21,10 @@
int main(int argc,char* argv[]) int main(int argc,char* argv[])
{ {
FILE* in = NULL; FILE* in = NULL;
/* message handle. Required in all the eccodes calls acting on a message.*/ /* message handle. Required in all the eccodes calls acting on a message.*/
codes_handle* h=NULL; codes_handle* h=NULL;
double doubleVal; double doubleVal;
int i, err=0; int i, err=0;
int cnt=0; int cnt=0;
@ -36,7 +36,7 @@ int main(int argc,char* argv[])
printf("ERROR: unable to open file %s\n", infile); printf("ERROR: unable to open file %s\n", infile);
return 1; return 1;
} }
/* loop over the messages in the bufr file */ /* loop over the messages in the bufr file */
while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS) while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS)
{ {
@ -45,17 +45,17 @@ int main(int argc,char* argv[])
cnt++; cnt++;
continue; continue;
} }
printf("message: %d\n",cnt); printf("message: %d\n",cnt);
/* we need to instruct ecCodes to expand the descriptors /* we need to instruct ecCodes to expand the descriptors
i.e. unpack the data values */ i.e. unpack the data values */
CODES_CHECK(codes_set_long(h,"unpack",1),0); CODES_CHECK(codes_set_long(h,"unpack",1),0);
/* the value of this key is missing in the message*/ /* the value of this key is missing in the message*/
CODES_CHECK(codes_get_double(h,"relativeHumidity",&doubleVal),0); CODES_CHECK(codes_get_double(h,"relativeHumidity",&doubleVal),0);
printf(" relativeHumidity: %.2f\n",doubleVal); printf(" relativeHumidity: %.2f\n",doubleVal);
/* we will print "value missing" */ /* we will print "value missing" */
if(doubleVal == CODES_MISSING_DOUBLE) if(doubleVal == CODES_MISSING_DOUBLE)
{ {
@ -65,13 +65,13 @@ int main(int argc,char* argv[])
{ {
printf(" --> value present\n"); printf(" --> value present\n");
} }
/* delete handle */ /* delete handle */
codes_handle_delete(h); codes_handle_delete(h);
cnt++; cnt++;
} }
fclose(in); fclose(in);
return 0; return 0;
} }

View File

@ -17,147 +17,141 @@
#include "eccodes.h" #include "eccodes.h"
int main(int argc,char* argv[]) int main(int argc,char* argv[])
{ {
FILE* in = NULL; FILE* in = NULL;
/* message handle. Required in all the eccodes calls acting on a message.*/ /* message handle. Required in all the eccodes calls acting on a message.*/
codes_handle* h=NULL; codes_handle* h=NULL;
char* units= NULL; char* units= NULL;
char* unitsPercent= NULL; char* unitsPercent= NULL;
double *sigt_pres=NULL, *sigt_geo=NULL, *sigt_t=NULL; double *sigt_pres=NULL, *sigt_geo=NULL, *sigt_t=NULL;
double *sigt_td=NULL; double *sigt_td=NULL;
long longVal; long longVal;
double doubleVal; double doubleVal;
size_t sigt_len=0, desc_len=0, len=0; size_t sigt_len=0, desc_len=0, len=0;
int i, err=0; int i, err=0;
int cnt=0; int cnt=0;
char* infile = "../../data/bufr/temp_101.bufr"; char* infile = "../../data/bufr/temp_101.bufr";
char key_name[128]; char key_name[128];
in=fopen(infile,"r"); in=fopen(infile,"r");
if (!in) { if (!in) {
printf("ERROR: unable to open file %s\n", infile); printf("ERROR: unable to open file %s\n", infile);
return 1; return 1;
}
/* loop over the messages in the bufr file */
while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS)
{
if (h == NULL) {
printf("Error: unable to create handle for message %d\n",cnt);
cnt++;
continue;
} }
printf("message: %d\n",cnt); /* loop over the messages in the bufr file */
while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS)
/* we need to instruct ecCodes to expand the descriptors
i.e. unpack the data values */
CODES_CHECK(codes_set_long(h,"unpack",1),0);
/* In what follows we rely on the fact that for
temperature significant levels the value of key
verticalSoundingSignificance is 4 (see flag table 8001 for details).
We also make use of the fact that in our BUFR message
verticalSoundingSignificance is always followed by geopotential,
airTemperature, dewpointTemperature,
windDirection, windSpeed and pressure. */
/* Get the number of the temperature significant levels.*/
/* We find out the number of temperature significant levels by
counting how many pressure values we have on these levels. */
sprintf(key_name,"/verticalSoundingSignificance=4/pressure");
CODES_CHECK(codes_get_size(h,key_name,&sigt_len),0);
printf("Number of T significant levels: %ld\n",sigt_len);
/* Allocate memory for the values to be read. Each
parameter must have the same number of values. */
sigt_pres = malloc(sigt_len*sizeof(double));
sigt_geo = malloc(sigt_len*sizeof(double));
sigt_t = malloc(sigt_len*sizeof(double));
sigt_td = malloc(sigt_len*sizeof(double));
/* Get pressure */
sprintf(key_name,"/verticalSoundingSignificance=4/pressure");
/* get the values */
len=sigt_len;
CODES_CHECK(codes_get_double_array(h,key_name,sigt_pres,&len),0);
/* Get gepotential */
sprintf(key_name,"/verticalSoundingSignificance=4/geopotential");
/* check the size*/
CODES_CHECK(codes_get_size(h,key_name,&len),0);
if(len != sigt_len)
{ {
printf("inconsistent number of geopotential values found!\n"); if (h == NULL) {
return 1; printf("Error: unable to create handle for message %d\n",cnt);
} cnt++;
continue;
}
/* get the values */ printf("message: %d\n",cnt);
CODES_CHECK(codes_get_double_array(h,key_name,sigt_geo,&len),0);
/* Get temperature */ /* we need to instruct ecCodes to expand the descriptors
i.e. unpack the data values */
CODES_CHECK(codes_set_long(h,"unpack",1),0);
sprintf(key_name,"/verticalSoundingSignificance=4/airTemperature"); /* In what follows we rely on the fact that for
temperature significant levels the value of key
verticalSoundingSignificance is 4 (see flag table 8001 for details).
/* check the size*/ We also make use of the fact that in our BUFR message
if(len != sigt_len) verticalSoundingSignificance is always followed by geopotential,
{ airTemperature, dewpointTemperature,
printf("inconsistent number of temperature values found!\n"); windDirection, windSpeed and pressure. */
return 1;
}
/* get the values */ /* Get the number of the temperature significant levels.*/
CODES_CHECK(codes_get_double_array(h,key_name,sigt_t,&len),0);
/* Get dew point */ /* We find out the number of temperature significant levels by
counting how many pressure values we have on these levels. */
sprintf(key_name,"/verticalSoundingSignificance=4/dewpointTemperature"); sprintf(key_name,"/verticalSoundingSignificance=4/pressure");
CODES_CHECK(codes_get_size(h,key_name,&sigt_len),0);
/* check the size*/ printf("Number of T significant levels: %ld\n",sigt_len);
if(len != sigt_len)
{
printf("inconsistent number of dewpoint temperature values found!\n");
return 1;
}
/* get the values */ /* Allocate memory for the values to be read. Each
CODES_CHECK(codes_get_double_array(h,key_name,sigt_td,&len),0); parameter must have the same number of values. */
sigt_pres = malloc(sigt_len*sizeof(double));
sigt_geo = malloc(sigt_len*sizeof(double));
sigt_t = malloc(sigt_len*sizeof(double));
sigt_td = malloc(sigt_len*sizeof(double));
/* Print the values */ /* Get pressure */
sprintf(key_name,"/verticalSoundingSignificance=4/pressure");
printf("lev pres geo t td\n");
printf("-------------------------------\n"); /* get the values */
len=sigt_len;
for(i=0; i < sigt_len; i++) CODES_CHECK(codes_get_double_array(h,key_name,sigt_pres,&len),0);
{
printf("%3d %6.0f %6.0f %.1f %.1f\n", /* Get geopotential */
i+1,sigt_pres[i],sigt_geo[i],sigt_t[i],sigt_td[i]); sprintf(key_name,"/verticalSoundingSignificance=4/geopotential");
/* check the size*/
CODES_CHECK(codes_get_size(h,key_name,&len),0);
if(len != sigt_len)
{
printf("inconsistent number of geopotential values found!\n");
return 1;
}
/* get the values */
CODES_CHECK(codes_get_double_array(h,key_name,sigt_geo,&len),0);
/* Get temperature */
sprintf(key_name,"/verticalSoundingSignificance=4/airTemperature");
/* check the size*/
if(len != sigt_len)
{
printf("inconsistent number of temperature values found!\n");
return 1;
}
/* get the values */
CODES_CHECK(codes_get_double_array(h,key_name,sigt_t,&len),0);
/* Get dew point */
sprintf(key_name,"/verticalSoundingSignificance=4/dewpointTemperature");
/* check the size*/
if(len != sigt_len)
{
printf("inconsistent number of dewpoint temperature values found!\n");
return 1;
}
/* get the values */
CODES_CHECK(codes_get_double_array(h,key_name,sigt_td,&len),0);
/* Print the values */
printf("lev pres geo t td\n");
printf("-------------------------------\n");
for(i=0; i < sigt_len; i++)
{
printf("%3d %6.0f %6.0f %.1f %.1f\n",
i+1,sigt_pres[i],sigt_geo[i],sigt_t[i],sigt_td[i]);
}
/* delete handle */
codes_handle_delete(h);
/*Release memory*/
free(sigt_pres);
free(sigt_geo);
free(sigt_t);
free(sigt_td);
cnt++;
} }
/* delete handle */ fclose(in);
codes_handle_delete(h); return 0;
/*Release memory*/
free(sigt_pres);
free(sigt_geo);
free(sigt_t);
free(sigt_td);
cnt++;
}
fclose(in);
return 0;
} }

View File

@ -26,10 +26,10 @@ int main(int argc,char* argv[])
{ {
FILE* in = NULL; FILE* in = NULL;
FILE* out = NULL; FILE* out = NULL;
/* message handle. Required in all the eccodes calls acting on a message.*/ /* message handle. Required in all the eccodes calls acting on a message.*/
codes_handle* h=NULL; codes_handle* h=NULL;
long longVal; long longVal;
/*double doubleVal;*/ /*double doubleVal;*/
int i, err=0; int i, err=0;
@ -37,7 +37,7 @@ int main(int argc,char* argv[])
size_t size = 0; size_t size = 0;
char* infile = "../../data/bufr/syno_multi.bufr"; char* infile = "../../data/bufr/syno_multi.bufr";
const void *buffer = NULL; const void *buffer = NULL;
if (argc != 2) { if (argc != 2) {
usage(argv[0]); usage(argv[0]);
return 1; return 1;
@ -52,7 +52,7 @@ int main(int argc,char* argv[])
if (in) fclose(in); if (in) fclose(in);
return 1; return 1;
} }
/* loop over the messages in the bufr file */ /* loop over the messages in the bufr file */
while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS) while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS)
{ {
@ -61,41 +61,41 @@ int main(int argc,char* argv[])
cnt++; cnt++;
continue; continue;
} }
printf("message: %d\n",cnt); printf("message: %d\n",cnt);
/* we need to instruct ecCodes to expand the descriptors /* we need to instruct ecCodes to expand the descriptors
i.e. unpack the data values */ i.e. unpack the data values */
/*CODES_CHECK(codes_set_long(h,"unpack",1),0);*/ /*CODES_CHECK(codes_set_long(h,"unpack",1),0);*/
/* This is the place where you may wish to modify the message*/ /* This is the place where you may wish to modify the message*/
/*E.g. we change the centre */ /*E.g. we change the centre */
/* set bufrHeaderCentre */ /* set bufrHeaderCentre */
longVal=222; longVal=222;
CODES_CHECK(codes_set_long(h, "bufrHeaderCentre", longVal),0); CODES_CHECK(codes_set_long(h, "bufrHeaderCentre", longVal),0);
printf(" set bufrHeaderCentre to: %ld\n",longVal); printf(" set bufrHeaderCentre to: %ld\n",longVal);
/* check bufrHeaderCentre */ /* check bufrHeaderCentre */
CODES_CHECK(codes_get_long(h,"bufrHeaderCentre",&longVal),0); CODES_CHECK(codes_get_long(h,"bufrHeaderCentre",&longVal),0);
printf(" bufrHeaderCentre's new value is: %ld\n",longVal); printf(" bufrHeaderCentre's new value is: %ld\n",longVal);
/* get the modified message in a buffer */ /* get the modified message in a buffer */
CODES_CHECK(codes_get_message(h,&buffer,&size),0); CODES_CHECK(codes_get_message(h,&buffer,&size),0);
/* write the buffer to a file */ /* write the buffer to a file */
if(fwrite(buffer,1,size,out) != size) { if(fwrite(buffer,1,size,out) != size) {
perror(argv[0]); perror(argv[0]);
return 1; return 1;
} }
/* delete handle */ /* delete handle */
codes_handle_delete(h); codes_handle_delete(h);
cnt++; cnt++;
} }
fclose(in); fclose(in);
return 0; return 0;
} }

View File

@ -25,10 +25,10 @@ void usage(char* prog) {
int main(int argc,char* argv[]) int main(int argc,char* argv[])
{ {
FILE* in = NULL; FILE* in = NULL;
/* message handle. Required in all the eccodes calls acting on a message.*/ /* message handle. Required in all the eccodes calls acting on a message.*/
codes_handle* h=NULL; codes_handle* h=NULL;
long numberOfSubsets=0; long numberOfSubsets=0;
long longVal; long longVal;
/*double doubleVal;*/ /*double doubleVal;*/
@ -41,7 +41,7 @@ int main(int argc,char* argv[])
printf("ERROR: unable to open file %s\n", infile); printf("ERROR: unable to open file %s\n", infile);
return 1; return 1;
} }
/* loop over the messages in the bufr file */ /* loop over the messages in the bufr file */
while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS) while ((h = codes_handle_new_from_file(NULL,in,PRODUCT_BUFR,&err)) != NULL || err != CODES_SUCCESS)
{ {
@ -50,39 +50,39 @@ int main(int argc,char* argv[])
cnt++; cnt++;
continue; continue;
} }
printf("message: %d\n",cnt); printf("message: %d\n",cnt);
/* we need to instruct ecCodes to expand all the descriptors i.e. unpack the data values */ /* we need to instruct ecCodes to expand all the descriptors i.e. unpack the data values */
CODES_CHECK(codes_set_long(h,"unpack",1),0); CODES_CHECK(codes_set_long(h,"unpack",1),0);
/* find out the number of subsets */ /* find out the number of subsets */
CODES_CHECK(codes_get_long(h,"numberOfSubsets",&numberOfSubsets),0); CODES_CHECK(codes_get_long(h,"numberOfSubsets",&numberOfSubsets),0);
printf(" numberOfSubsets: %ld\n",numberOfSubsets); printf(" numberOfSubsets: %ld\n",numberOfSubsets);
/* loop over the subsets */ /* loop over the subsets */
for(i=1; i <= numberOfSubsets; i++) for(i=1; i <= numberOfSubsets; i++)
{ {
/* specify the subset number */ /* specify the subset number */
CODES_CHECK(codes_set_long(h,"subsetNumber",0),0); CODES_CHECK(codes_set_long(h,"subsetNumber",0),0);
/* read and print some data values */ /* read and print some data values */
CODES_CHECK(codes_get_long(h,"blockNumber",&longVal),0); CODES_CHECK(codes_get_long(h,"blockNumber",&longVal),0);
printf(" blockNumber: %ld\n",longVal); printf(" blockNumber: %ld\n",longVal);
CODES_CHECK(codes_get_long(h,"stationNumber",&longVal),0); CODES_CHECK(codes_get_long(h,"stationNumber",&longVal),0);
printf(" stationNumber: %ld\n",longVal); printf(" stationNumber: %ld\n",longVal);
/*CODES_CHECK(codes_get_double(h,"airTemperatureAt2M",&doubleVal),0); /*CODES_CHECK(codes_get_double(h,"airTemperatureAt2M",&doubleVal),0);
printf(" airTemperatureAt2M %f\n",doubleVal);*/ printf(" airTemperatureAt2M %f\n",doubleVal);*/
} }
/* delete handle */ /* delete handle */
codes_handle_delete(h); codes_handle_delete(h);
cnt++; cnt++;
} }
fclose(in); fclose(in);
return 0; return 0;
} }

View File

@ -9,7 +9,7 @@
*/ */
/* /*
* C Implementation: clone * C Implementation: grib_clone
* *
* Description: How to create a new GRIB message by cloning * Description: How to create a new GRIB message by cloning
* an existing message. * an existing message.

View File

@ -12,11 +12,11 @@
TEMP=cloned.grib TEMP=cloned.grib
INPUT=${data_dir}/reduced_gaussian_pressure_level.grib1 INPUT=${data_dir}/reduced_gaussian_pressure_level.grib1
${examples_dir}clone ${INPUT} ${TEMP} > /dev/null ${examples_dir}grib_clone ${INPUT} ${TEMP} > /dev/null
${tools_dir}grib_compare ${INPUT} ${TEMP} ${tools_dir}grib_compare ${INPUT} ${TEMP}
INPUT=${data_dir}/sample.grib2 INPUT=${data_dir}/sample.grib2
${examples_dir}clone ${INPUT} ${TEMP} > /dev/null ${examples_dir}grib_clone ${INPUT} ${TEMP} > /dev/null
${tools_dir}grib_compare ${INPUT} ${TEMP} ${tools_dir}grib_compare ${INPUT} ${TEMP}
rm -f ${TEMP} rm -f ${TEMP}

View File

@ -9,9 +9,9 @@
*/ */
/* /*
* C Implementation: get * C Implementation: grib_get_keys
* *
* Description: how to get values using keys. * Description: how to get values using keys from GRIB messages
* *
*/ */
#include <stdio.h> #include <stdio.h>

View File

@ -9,6 +9,5 @@
. ./include.sh . ./include.sh
${examples_dir}get > /dev/null ${examples_dir}grib_get_keys > /dev/null

View File

@ -9,9 +9,9 @@
*/ */
/* /*
* C Implementation: iterator * C Implementation: grib_iterator
* *
* Description: how to use an iterator on lat/lon/values. * Description: how to use an iterator on lat/lon/values for GRIB messages
* *
*/ */

View File

@ -9,7 +9,7 @@
. ./include.sh . ./include.sh
${examples_dir}keys_iterator ${data_dir}/reduced_latlon_surface.grib1 > /dev/null ${examples_dir}grib_iterator ${data_dir}/reduced_gaussian_model_level.grib1 > /dev/null
${examples_dir}keys_iterator ${data_dir}/regular_gaussian_model_level.grib1 > /dev/null ${examples_dir}grib_iterator ${data_dir}/regular_gaussian_model_level.grib1 > /dev/null

View File

@ -9,12 +9,12 @@
*/ */
/* /*
* C Implementation: keys_iterator * C Implementation: grib_keys_iterator
* *
* Description: * Description:
* Example on how to use keys_iterator functions and the * Example on how to use keys_iterator functions and the
* codes_keys_iterator structure to get all the available * codes_keys_iterator structure to get all the available
* keys in a message. * keys in a GRIB message.
* *
*/ */

View File

@ -9,7 +9,7 @@
. ./include.sh . ./include.sh
${examples_dir}iterator ${data_dir}/reduced_gaussian_model_level.grib1 > /dev/null ${examples_dir}grib_keys_iterator ${data_dir}/reduced_latlon_surface.grib1 > /dev/null
${examples_dir}iterator ${data_dir}/regular_gaussian_model_level.grib1 > /dev/null ${examples_dir}grib_keys_iterator ${data_dir}/regular_gaussian_model_level.grib1 > /dev/null

View File

@ -9,9 +9,9 @@
*/ */
/* /*
* C Implementation: print_data * C Implementation: grib_print_data
* *
* Description: prints all the data contained in a grib file * Description: prints all the data contained in a GRIB file
* *
*/ */
#include <stdio.h> #include <stdio.h>

View File

@ -9,7 +9,7 @@
. ./include.sh . ./include.sh
numberOfValues=`${examples_dir}print_data ../../data/constant_field.grib1 | grep values | awk '{print $1}'` numberOfValues=`${examples_dir}grib_print_data ../../data/constant_field.grib1 | grep values | awk '{print $1}'`
if [ $numberOfValues -ne 99200 ] if [ $numberOfValues -ne 99200 ]
then then

View File

@ -9,9 +9,9 @@
*/ */
/* /*
* C Implementation: set * C Implementation: grib_set_keys
* *
* Description: how to set key values. * Description: how to set key values in GRIB messages
* *
*/ */
#include <stdio.h> #include <stdio.h>

View File

@ -9,6 +9,6 @@
. ./include.sh . ./include.sh
${examples_dir}set > /dev/null ${examples_dir}grib_set_keys > /dev/null
rm -f out.set.grib1 rm -f out.set.grib1

View File

@ -9,17 +9,17 @@ configure_file( include.ctest.sh.in include.ctest.sh @ONLY )
list( APPEND tests list( APPEND tests
index index
copy_message copy_message
get grib_get_keys
get_data get_data
get_pl get_pl
get_pv get_pv
keys_iterator grib_keys_iterator
multi_write multi_write
multi multi
nearest grib_nearest
precision precision
print_data grib_print_data
set grib_set_keys
set_bitmap set_bitmap
set_missing set_missing
set_pv set_pv
@ -28,7 +28,7 @@ list( APPEND tests
read_message read_message
read_from_file read_from_file
get_set_uuid get_set_uuid
clone grib_clone
bufr_attributes bufr_attributes
bufr_clone bufr_clone
bufr_expanded bufr_expanded

View File

@ -1,32 +1,33 @@
AM_CFLAGS = @WARN_PEDANTIC@ @WERROR@ @FORCE_32_CFLAGS@ AM_CFLAGS = @WARN_PEDANTIC@ @WERROR@ @FORCE_32_CFLAGS@
TESTS = copy_message.sh get.sh get_data.sh get_pl.sh get_pv.sh keys_iterator.sh \ TESTS = copy_message.sh grib_get_keys.sh get_data.sh get_pl.sh get_pv.sh grib_keys_iterator.sh \
nearest.sh precision.sh multi_write.sh multi.sh print_data.sh set.sh set_bitmap.sh set_missing.sh \ grib_nearest.sh precision.sh multi_write.sh multi.sh grib_print_data.sh grib_set_keys.sh \
set_pv.sh samples.sh count_messages.sh read_message.sh read_from_file.sh index.sh get_set_uuid.sh \ set_bitmap.sh set_missing.sh set_pv.sh samples.sh count_messages.sh read_message.sh \
bufr_attributes.sh bufr_clone.sh bufr_expanded.sh bufr_get_keys.sh bufr_print_header.sh bufr_print_data.sh bufr_set_keys.sh \ read_from_file.sh index.sh get_set_uuid.sh bufr_attributes.sh bufr_clone.sh \
bufr_keys_iterator.sh bufr_subset.sh get_product_kind.sh bufr_read_temp.sh bufr_expanded.sh bufr_get_keys.sh bufr_print_header.sh bufr_print_data.sh \
bufr_set_keys.sh bufr_keys_iterator.sh bufr_subset.sh get_product_kind.sh bufr_read_temp.sh
noinst_PROGRAMS = f_index f_copy_message f_get f_get_data f_get_pl f_get_pv f_keys_iterator \ noinst_PROGRAMS = f_index f_copy_message f_grib_get_keys f_get_data f_get_pl f_get_pv f_grib_keys_iterator \
f_multi_write f_multi f_nearest f_precision f_print_data f_set f_set_bitmap f_set_missing \ f_multi_write f_multi f_grib_nearest f_precision f_grib_print_data f_grib_set_keys f_set_bitmap f_set_missing \
f_set_pv f_samples f_count_messages f_read_message f_read_from_file f_new_from_file \ f_set_pv f_samples f_count_messages f_read_message f_read_from_file f_new_from_file \
f_copy_namespace f_get_set_uuid f_set_gvc f_clone f_bufr_clone f_bufr_expanded f_bufr_get_keys \ f_copy_namespace f_get_set_uuid f_set_gvc f_grib_clone f_bufr_clone f_bufr_expanded f_bufr_get_keys \
f_bufr_print_header f_bufr_print_data f_bufr_set_keys f_bufr_keys_iterator f_bufr_subset f_bufr_attributes \ f_bufr_print_header f_bufr_print_data f_bufr_set_keys f_bufr_keys_iterator f_bufr_subset f_bufr_attributes \
f_get_product_kind f_bufr_read_temp f_get_product_kind f_bufr_read_temp
f_index_SOURCES=index.f90 f_index_SOURCES=index.f90
f_copy_message_SOURCES=copy_message.f90 f_copy_message_SOURCES=copy_message.f90
f_get_SOURCES=get.f90 f_grib_get_keys_SOURCES=grib_get_keys.f90
f_get_data_SOURCES=get_data.f90 f_get_data_SOURCES=get_data.f90
f_get_pl_SOURCES=get_pl.f90 f_get_pl_SOURCES=get_pl.f90
f_get_pv_SOURCES=get_pv.f90 f_get_pv_SOURCES=get_pv.f90
f_keys_iterator_SOURCES=keys_iterator.f90 f_grib_keys_iterator_SOURCES=grib_keys_iterator.f90
f_multi_write_SOURCES=multi_write.f90 f_multi_write_SOURCES=multi_write.f90
f_multi_SOURCES=multi.f90 f_multi_SOURCES=multi.f90
f_nearest_SOURCES=nearest.f90 f_grib_nearest_SOURCES=grib_nearest.f90
f_precision_SOURCES=precision.f90 f_precision_SOURCES=precision.f90
f_print_data_SOURCES=print_data.f90 f_grib_print_data_SOURCES=grib_print_data.f90
f_set_SOURCES=set.f90 f_grib_set_keys_SOURCES=grib_set_keys.f90
f_set_bitmap_SOURCES=set_bitmap.f90 f_set_bitmap_SOURCES=set_bitmap.f90
f_set_missing_SOURCES=set_missing.f90 f_set_missing_SOURCES=set_missing.f90
f_set_pv_SOURCES=set_pv.f90 f_set_pv_SOURCES=set_pv.f90
@ -38,7 +39,7 @@ f_new_from_file_SOURCES=new_from_file.f90
f_copy_namespace_SOURCES=copy_namespace.f90 f_copy_namespace_SOURCES=copy_namespace.f90
f_get_set_uuid_SOURCES=get_set_uuid.f90 f_get_set_uuid_SOURCES=get_set_uuid.f90
f_set_gvc_SOURCES=set_gvc.f90 f_set_gvc_SOURCES=set_gvc.f90
f_clone_SOURCES=clone.f90 f_grib_clone_SOURCES=grib_clone.f90
f_bufr_attributes_SOURCES=bufr_attributes.f90 f_bufr_attributes_SOURCES=bufr_attributes.f90
f_bufr_clone_SOURCES=bufr_clone.f90 f_bufr_clone_SOURCES=bufr_clone.f90
f_bufr_expanded_SOURCES=bufr_expanded.f90 f_bufr_expanded_SOURCES=bufr_expanded.f90

View File

@ -7,12 +7,12 @@
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
! !
! !
! FOTRAN 90 Implementation: grib_clone
! !
! Description: how to create a new GRIB message by cloning ! Description: how to create a new GRIB message by cloning
! an existing message. ! an existing message.
! !
! !
!
program clone program clone
use eccodes use eccodes
implicit none implicit none

View File

@ -9,5 +9,5 @@
. ./include.sh . ./include.sh
${examples_dir}f_clone > /dev/null ${examples_dir}f_grib_clone > /dev/null
rm -f out.clone.grib1 rm -f out.clone.grib1

View File

@ -7,10 +7,10 @@
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
! !
! !
! Description: how to get values using keys. ! Description: how to get values using keys from GRIB messages
! !
! !
program get program grib_get_keys
use eccodes use eccodes
implicit none implicit none
@ -120,4 +120,4 @@ program get
call codes_close_file(ifile) call codes_close_file(ifile)
end program get end program grib_get_keys

View File

@ -9,4 +9,4 @@
. ./include.sh . ./include.sh
${examples_dir}f_nearest > /dev/null ${examples_dir}f_grib_get_keys > /dev/null

View File

@ -0,0 +1,12 @@
#!/bin/sh
# Copyright 2005-2015 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.sh
${examples_dir}f_grib_keys_iterator > /dev/null

View File

@ -11,7 +11,6 @@
! !
! !
! !
!
program find program find
use eccodes use eccodes
implicit none implicit none

View File

@ -9,4 +9,4 @@
. ./include.sh . ./include.sh
${examples_dir}f_get > /dev/null ${examples_dir}f_grib_nearest > /dev/null

View File

@ -7,7 +7,7 @@
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
! !
! !
! Description: prints all the data contained in a grib file ! Description: prints all the data contained in a GRIB file
! !
! !
! !

View File

@ -9,4 +9,4 @@
. ./include.sh . ./include.sh
${examples_dir}f_keys_iterator > /dev/null ${examples_dir}f_grib_print_data > /dev/null

View File

@ -7,9 +7,7 @@
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. ! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
! !
! !
! ! Description: how to set key values in GRIB messages
! Description: how to set key values.
!
! !
! !
program set program set
@ -19,7 +17,6 @@ program set
integer :: infile,outfile integer :: infile,outfile
integer :: igrib integer :: igrib
centre = 80 centre = 80
call current_date(date1) call current_date(date1)
call codes_open_file(infile, & call codes_open_file(infile, &

View File

@ -9,7 +9,7 @@
. ./include.sh . ./include.sh
${examples_dir}f_set > /dev/null ${examples_dir}f_grib_set_keys > /dev/null
${examples_dir}f_set_gvc > /dev/null ${examples_dir}f_set_gvc > /dev/null
[ -f out_gvc.grib2 ] [ -f out_gvc.grib2 ]

View File

@ -1,12 +0,0 @@
#!/bin/sh
# Copyright 2005-2015 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.sh
${examples_dir}f_print_data > /dev/null

View File

@ -7,9 +7,9 @@ configure_file( include.ctest.sh.in include.ctest.sh @ONLY )
# Build the executables used by test scripts # Build the executables used by test scripts
################################################ ################################################
list( APPEND test_bins list( APPEND test_bins
keys_iterator grib_keys_iterator
print_data grib_print_data
iterator grib_iterator
count_messages count_messages
) )
foreach( tool ${test_bins} ) foreach( tool ${test_bins} )
@ -25,17 +25,17 @@ endforeach()
# Now add each test # Now add each test
################################################# #################################################
list( APPEND tests list( APPEND tests
clone grib_clone
count_messages count_messages
get grib_get_keys
index index
iterator grib_iterator
keys_iterator grib_keys_iterator
multi_write multi_write
nearest grib_nearest
print_data grib_print_data
samples samples
set grib_set_keys
set_missing set_missing
binary_message binary_message
set_bitmap set_bitmap

View File

@ -1,23 +1,26 @@
if WITH_PYTHON if WITH_PYTHON
AM_CFLAGS = @WARN_PEDANTIC@ @WERROR@ 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 = grib_clone.sh count_messages.sh grib_get_keys.sh index.sh grib_iterator.sh \
samples.sh set.sh set_missing.sh binary_message.sh set_bitmap.sh bufr_print_header.sh bufr_print_data.sh \ grib_keys_iterator.sh multi_write.sh grib_nearest.sh grib_print_data.sh \
bufr_clone.sh bufr_get_keys.sh bufr_set_keys.sh bufr_expanded.sh bufr_keys_iterator.sh bufr_subset.sh \ samples.sh grib_set_keys.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_attributes.sh get_product_kind.sh bufr_read_temp.sh bufr_attributes.sh get_product_kind.sh bufr_read_temp.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_grib_keys_iterator p_grib_print_data p_grib_iterator p_count_messages
p_keys_iterator_SOURCES = keys_iterator.c p_grib_keys_iterator_SOURCES = grib_keys_iterator.c
p_print_data_SOURCES = print_data.c p_grib_print_data_SOURCES = grib_print_data.c
p_iterator_SOURCES = iterator.c p_grib_iterator_SOURCES = grib_iterator.c
p_count_messages_SOURCES = count_messages.c p_count_messages_SOURCES = count_messages.c
INCLUDES = -I$(top_builddir)/src INCLUDES = -I$(top_builddir)/src
LDADD = $(top_builddir)/src/libeccodes.la LDADD = $(top_builddir)/src/libeccodes.la
DEPENDENCIES = $(LDADD) DEPENDENCIES = $(LDADD)
EXTRA_DIST = $(TESTS) include.sh clone.py count_messages.py get.py index.py iterator.py keys_iterator.py multi_write.py \ EXTRA_DIST = $(TESTS) include.sh grib_clone.py count_messages.py grib_get_keys.py index.py grib_iterator.py \
nearest.py print_data.py samples.py set.py set_missing.py binary_message.py set_pv.py set_bitmap.py \ grib_keys_iterator.py multi_write.py \
grib_nearest.py grib_print_data.py samples.py grib_set_keys.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 bufr_read_temp.py \ get_product_kind.py bufr_read_temp.py \

View File

@ -3,5 +3,5 @@
. ./include.sh . ./include.sh
REDIRECT=/dev/null REDIRECT=/dev/null
$PYTHON clone.py 2> $REDIRECT > $REDIRECT $PYTHON grib_clone.py 2> $REDIRECT > $REDIRECT
rm -f out.clone.grib || true rm -f out.clone.grib || true

View File

@ -3,8 +3,8 @@
. ./include.sh . ./include.sh
REDIRECT=/dev/null REDIRECT=/dev/null
$PYTHON get.py 2> $REDIRECT > $REDIRECT $PYTHON grib_get_keys.py 2> $REDIRECT > $REDIRECT
# Rerun test with no type check decorator (See GRIB-51) # Rerun test with no type check decorator (See GRIB-51)
export GRIB_API_PYTHON_NO_TYPE_CHECKS=1 export GRIB_API_PYTHON_NO_TYPE_CHECKS=1
$PYTHON get.py 2> $REDIRECT > $REDIRECT $PYTHON grib_get_keys.py 2> $REDIRECT > $REDIRECT

View File

@ -9,13 +9,10 @@
*/ */
/* /*
* C Implementation: iterator * C Implementation: grib_iterator
* *
* Description: how to use an iterator on lat/lon/values. * Description: how to use an iterator on lat/lon/values.
* *
*
*
*
*/ */
#include <stdio.h> #include <stdio.h>

View File

@ -6,15 +6,15 @@ TEMP1=temp1.$$
TEMP2=temp2.$$ TEMP2=temp2.$$
FILE="${data_dir}/reduced_latlon_surface.grib1" FILE="${data_dir}/reduced_latlon_surface.grib1"
$PYTHON iterator.py $FILE 2> $TEMP1 > $TEMP1 $PYTHON grib_iterator.py $FILE 2> $TEMP1 > $TEMP1
./p_iterator $FILE 2> $TEMP2 > $TEMP2 ./p_grib_iterator $FILE 2> $TEMP2 > $TEMP2
diff $TEMP1 $TEMP2 diff $TEMP1 $TEMP2
# Polar stereographic # Polar stereographic
FILE="${ECCODES_SAMPLES_PATH}/polar_stereographic_pl_grib2.tmpl" FILE="${ECCODES_SAMPLES_PATH}/polar_stereographic_pl_grib2.tmpl"
$PYTHON iterator.py $FILE 2> $TEMP1 > $TEMP1 $PYTHON grib_iterator.py $FILE 2> $TEMP1 > $TEMP1
./p_iterator $FILE 2> $TEMP2 > $TEMP2 ./p_grib_iterator $FILE 2> $TEMP2 > $TEMP2
diff $TEMP1 $TEMP2 diff $TEMP1 $TEMP2

View File

@ -9,13 +9,12 @@
*/ */
/* /*
* C Implementation: keys_iterator * C Implementation: grib_keys_iterator
* *
* Description: * Description:
* Example on how to use keys_iterator functions and the * Example on how to use keys_iterator functions and the
* grib_keys_iterator structure to get all the available * grib_keys_iterator structure to get all the available
* keys in a message. * keys in a GRIB message.
*
* *
* *
*/ */

View File

@ -0,0 +1,12 @@
#!/bin/sh
. ./include.sh
TEMP1=temp1.$$
TEMP2=temp2.$$
$PYTHON grib_keys_iterator.py 2> $TEMP1 > $TEMP1
./p_grib_keys_iterator ../../data/reduced_latlon_surface.grib1 2> $TEMP2 > $TEMP2
diff $TEMP1 $TEMP2
rm $TEMP1 $TEMP2 || true

View File

@ -0,0 +1,6 @@
#!/bin/sh
. ./include.sh
REDIRECT=/dev/null
$PYTHON grib_nearest.py 2> $REDIRECT > $REDIRECT

View File

@ -9,10 +9,9 @@
*/ */
/* /*
* C Implementation: print_data * C Implementation: grib_print_data
*
* Description: prints all the data contained in a grib file
* *
* Description: prints all the data contained in a GRIB file
* *
* *
*/ */

View File

@ -0,0 +1,12 @@
#!/bin/sh
. ./include.sh
TEMP1=temp1.$$
TEMP2=temp2.$$
$PYTHON grib_print_data.py 2> $TEMP1 > $TEMP1
./p_grib_print_data ../../data/regular_latlon_surface.grib1 2> $TEMP2 > $TEMP2
diff $TEMP1 $TEMP2
rm $TEMP1 $TEMP2 || true

View File

@ -3,5 +3,5 @@
. ./include.sh . ./include.sh
REDIRECT=/dev/null REDIRECT=/dev/null
$PYTHON set.py 2> $REDIRECT > $REDIRECT $PYTHON grib_set_keys.py 2> $REDIRECT > $REDIRECT
rm -f out.set.grib || true rm -f out.set.grib || true

View File

@ -1,12 +0,0 @@
#!/bin/sh
. ./include.sh
TEMP1=temp1.$$
TEMP2=temp2.$$
$PYTHON keys_iterator.py 2> $TEMP1 > $TEMP1
./p_keys_iterator ../../data/reduced_latlon_surface.grib1 2> $TEMP2 > $TEMP2
diff $TEMP1 $TEMP2
rm $TEMP1 $TEMP2 || true

View File

@ -1,6 +0,0 @@
#!/bin/sh
. ./include.sh
REDIRECT=/dev/null
$PYTHON nearest.py 2> $REDIRECT > $REDIRECT

View File

@ -1,12 +0,0 @@
#!/bin/sh
. ./include.sh
TEMP1=temp1.$$
TEMP2=temp2.$$
$PYTHON print_data.py 2> $TEMP1 > $TEMP1
./p_print_data ../../data/regular_latlon_surface.grib1 2> $TEMP2 > $TEMP2
diff $TEMP1 $TEMP2
rm $TEMP1 $TEMP2 || true

View File

@ -56,7 +56,7 @@ module eccodes
!> exit with an error message.\n Otherwise the error message can be !> exit with an error message.\n Otherwise the error message can be
!> gathered with @ref codes_get_error_string. !> gathered with @ref codes_get_error_string.
!> !>
!> \b Examples: \ref nearest.f90 "nearest.f90" !> \b Examples: \ref grib_nearest.f90 "grib_nearest.f90"
!> !>
!> @see codes_new_from_file, codes_release, codes_get !> @see codes_new_from_file, codes_release, codes_get
!> !>
@ -96,7 +96,7 @@ module eccodes
!> exit with an error message.\n Otherwise the error message can be !> exit with an error message.\n Otherwise the error message can be
!> gathered with @ref codes_get_error_string. !> gathered with @ref codes_get_error_string.
!> !>
!> \b Examples: \ref nearest.f90 "nearest.f90" !> \b Examples: \ref grib_nearest.f90 "grib_nearest.f90"
!> !>
!> @param[in] gribid id of the grib loaded in memory !> @param[in] gribid id of the grib loaded in memory
!> @param[in] is_lsm .true. if the nearest land point is required otherwise .false. !> @param[in] is_lsm .true. if the nearest land point is required otherwise .false.

View File

@ -82,7 +82,7 @@
!> exit with an error message.\n Otherwise the error message can be !> exit with an error message.\n Otherwise the error message can be
!> gathered with @ref codes_get_error_string. !> gathered with @ref codes_get_error_string.
!> !>
!> \b Examples: \ref get.f90 "get.f90", \ref print_data.f90 "print_data.f90" !> \b Examples: \ref grib_get_keys.f90 "grib_get_keys.f90", \ref print_data.f90 "print_data.f90"
!> !>
!> @see codes_new_from_file, codes_release, codes_set !> @see codes_new_from_file, codes_release, codes_set
!> !>

View File

@ -85,7 +85,7 @@
!> exit with an error message.\n Otherwise the error message can be !> exit with an error message.\n Otherwise the error message can be
!> gathered with @ref codes_get_error_string. !> gathered with @ref codes_get_error_string.
!> !>
!> \b Examples: \ref get.f90 "get.f90", \ref print_data.f90 "print_data.f90" !> \b Examples: \ref grib_get_keys.f90 "grib_get_keys.f90", \ref print_data.f90 "print_data.f90"
!> !>
!> @see codes_new_from_file, codes_release, codes_set !> @see codes_new_from_file, codes_release, codes_set
!> !>

View File

@ -52,7 +52,7 @@ module grib_api
!> exit with an error message.\n Otherwise the error message can be !> exit with an error message.\n Otherwise the error message can be
!> gathered with @ref grib_get_error_string. !> gathered with @ref grib_get_error_string.
!> !>
!> \b Examples: \ref nearest.f90 "nearest.f90" !> \b Examples: \ref grib_nearest.f90 "grib_nearest.f90"
!> !>
!> @see grib_new_from_file, grib_release, grib_get !> @see grib_new_from_file, grib_release, grib_get
!> !>
@ -92,7 +92,7 @@ module grib_api
!> exit with an error message.\n Otherwise the error message can be !> exit with an error message.\n Otherwise the error message can be
!> gathered with @ref grib_get_error_string. !> gathered with @ref grib_get_error_string.
!> !>
!> \b Examples: \ref nearest.f90 "nearest.f90" !> \b Examples: \ref grib_nearest.f90 "grib_nearest.f90"
!> !>
!> @param[in] gribid id of the grib loaded in memory !> @param[in] gribid id of the grib loaded in memory
!> @param[in] is_lsm .true. if the nearest land point is required otherwise .false. !> @param[in] is_lsm .true. if the nearest land point is required otherwise .false.

View File

@ -82,7 +82,7 @@
!> exit with an error message.\n Otherwise the error message can be !> exit with an error message.\n Otherwise the error message can be
!> gathered with @ref grib_get_error_string. !> gathered with @ref grib_get_error_string.
!> !>
!> \b Examples: \ref get.f90 "get.f90", \ref print_data.f90 "print_data.f90" !> \b Examples: \ref grib_get_keys.f90 "grib_get_keys.f90", \ref print_data.f90 "print_data.f90"
!> !>
!> @see grib_new_from_file, grib_release, grib_set !> @see grib_new_from_file, grib_release, grib_set
!> !>

View File

@ -85,7 +85,7 @@
!> exit with an error message.\n Otherwise the error message can be !> exit with an error message.\n Otherwise the error message can be
!> gathered with @ref grib_get_error_string. !> gathered with @ref grib_get_error_string.
!> !>
!> \b Examples: \ref get.f90 "get.f90", \ref print_data.f90 "print_data.f90" !> \b Examples: \ref grib_get_keys.f90 "grib_get_keys.f90", \ref print_data.f90 "print_data.f90"
!> !>
!> @see grib_new_from_file, grib_release, grib_set !> @see grib_new_from_file, grib_release, grib_set
!> !>

View File

@ -488,7 +488,7 @@
!> exit with an error message.\n Otherwise the error message can be !> exit with an error message.\n Otherwise the error message can be
!> gathered with @ref grib_get_error_string. !> gathered with @ref grib_get_error_string.
!> !>
!> \b Examples: \ref get.f90 "get.f90" !> \b Examples: \ref grib_get_keys.f90 "grib_get_keys.f90"
!> !>
!> @param ifile id of the opened file to be used in all the file functions. !> @param ifile id of the opened file to be used in all the file functions.
!> @param filename name of the file to be open !> @param filename name of the file to be open
@ -1202,7 +1202,7 @@
!> If the \em fileid does not refer to an opened file an error code !> If the \em fileid does not refer to an opened file an error code
!> is returned in status.\n !> is returned in status.\n
!> !>
!> \b Examples: \ref get.f90 "get.f90" !> \b Examples: \ref grib_get_keys.f90 "grib_get_keys.f90"
!> !>
!> In case of error, if the status parameter (optional) is not given, the program will !> In case of error, if the status parameter (optional) is not given, the program will
!> exit with an error message.\n Otherwise the error message can be !> exit with an error message.\n Otherwise the error message can be
@ -1249,7 +1249,7 @@
!> The message can be accessed through its gribid and it will be available\n !> The message can be accessed through its gribid and it will be available\n
!> until @ref grib_release is called.\n !> until @ref grib_release is called.\n
!> !>
!> \b Examples: \ref get.f90 "get.f90" !> \b Examples: \ref grib_get_keys.f90 "grib_get_keys.f90"
!> !>
!> @param ifile id of the file opened with @ref grib_open_file !> @param ifile id of the file opened with @ref grib_open_file
!> @param gribid id of the grib loaded in memory !> @param gribid id of the grib loaded in memory
@ -1273,7 +1273,7 @@
!> The message can be accessed through its gribid and it will be available\n !> The message can be accessed through its gribid and it will be available\n
!> until @ref grib_release is called.\n !> until @ref grib_release is called.\n
!> !>
!> \b Examples: \ref get.f90 "get.f90" !> \b Examples: \ref grib_get_keys.f90 "grib_get_keys.f90"
!> !>
!> @param ifile id of the file opened with @ref grib_open_file !> @param ifile id of the file opened with @ref grib_open_file
!> @param gribid id of the grib loaded in memory !> @param gribid id of the grib loaded in memory
@ -1297,7 +1297,7 @@
!> The message can be accessed through its bufrid and it will be available\n !> The message can be accessed through its bufrid and it will be available\n
!> until @ref codes_release is called.\n !> until @ref codes_release is called.\n
!> !>
!> \b Examples: \ref get.f90 "get.f90" !> \b Examples: \ref grib_get_keys.f90 "grib_get_keys.f90"
!> !>
!> @param ifile id of the file opened with @ref codes_open_file !> @param ifile id of the file opened with @ref codes_open_file
!> @param bufrid id of the BUFR loaded in memory !> @param bufrid id of the BUFR loaded in memory
@ -1432,7 +1432,7 @@
!> exit with an error message.\n Otherwise the error message can be !> exit with an error message.\n Otherwise the error message can be
!> gathered with @ref grib_get_error_string. !> gathered with @ref grib_get_error_string.
!> !>
!> \b Examples: \ref get.f90 "get.f90" !> \b Examples: \ref grib_get_keys.f90 "grib_get_keys.f90"
!> !>
!> @param gribid id of the grib loaded in memory !> @param gribid id of the grib loaded in memory
!> @param status GRIB_SUCCESS if OK, integer value on error !> @param status GRIB_SUCCESS if OK, integer value on error
@ -1462,7 +1462,7 @@
!> gathered with @ref grib_get_error_string. !> gathered with @ref grib_get_error_string.
!> !>
!> !>
!> \b Examples: \ref clone.f90 "clone.f90" !> \b Examples: \ref grib_clone.f90 "grib_clone.f90"
!> !>
!> @param gribid_src grib to be cloned !> @param gribid_src grib to be cloned
!> @param gribid_dest new grib returned !> @param gribid_dest new grib returned

View File

@ -164,7 +164,7 @@ def gts_new_from_file(fileobj, headers_only = False):
Any attempt to retrieve data values keys when in the headers only mode will Any attempt to retrieve data values keys when in the headers only mode will
result in a key not found error. result in a key not found error.
\b Examples: \ref get.py "get.py" \b Examples: \ref grib_get_keys.py "grib_get_keys.py"
@param fileobj python file object @param fileobj python file object
@param headers_only whether or not to load the message with the headers only @param headers_only whether or not to load the message with the headers only
@ -198,7 +198,7 @@ def any_new_from_file(fileobj, headers_only = False):
The message can be accessed through its id and it will be available\n The message can be accessed through its id and it will be available\n
until @ref codes_release is called.\n until @ref codes_release is called.\n
\b Examples: \ref get.py "get.py" \b Examples: \ref grib_get_keys.py "grib_get_keys.py"
@param fileobj python file object @param fileobj python file object
@param headers_only whether or not to load the message with the headers only @param headers_only whether or not to load the message with the headers only
@ -229,7 +229,7 @@ def bufr_new_from_file(fileobj, headers_only = False):
Any attempt to retrieve data values keys when in the headers only mode will Any attempt to retrieve data values keys when in the headers only mode will
result in a key not found error. result in a key not found error.
\b Examples: \ref get.py "get.py" \b Examples: \ref grib_get_keys.py "grib_get_keys.py"
@param fileobj python file object @param fileobj python file object
@param headers_only whether or not to load the message with the headers only @param headers_only whether or not to load the message with the headers only
@ -260,7 +260,7 @@ def grib_new_from_file(fileobj, headers_only = False):
Any attempt to retrieve data values keys when in the headers only mode will Any attempt to retrieve data values keys when in the headers only mode will
result in a key not found error. result in a key not found error.
\b Examples: \ref get.py "get.py" \b Examples: \ref grib_get_keys.py "grib_get_keys.py"
@param fileobj python file object @param fileobj python file object
@param headers_only whether or not to load the message with the headers only @param headers_only whether or not to load the message with the headers only
@ -312,7 +312,7 @@ def grib_release(gribid):
""" """
@brief Free the memory for the message referred as gribid. @brief Free the memory for the message referred as gribid.
\b Examples: \ref get.py "get.py" \b Examples: \ref grib_get_keys.py "grib_get_keys.py"
@param gribid id of the grib loaded in memory @param gribid id of the grib loaded in memory
@exception GribInternalError @exception GribInternalError
@ -372,7 +372,7 @@ def grib_write(gribid, fileobj):
""" """
@brief Write a message to a file. @brief Write a message to a file.
\b Examples: \ref set.py "set.py" \b Examples: \ref grib_set_keys.py "grib_set_keys.py"
@param gribid id of the grib loaded in memory @param gribid id of the grib loaded in memory
@param fileobj python file object @param fileobj python file object
@ -416,7 +416,7 @@ def grib_get_size(gribid,key):
""" """
@brief Get the size of an array key. @brief Get the size of an array key.
\b Examples: \ref get.py "get.py",\ref count_messages.py "count_messages.py" \b Examples: \ref grib_get_keys.py "grib_get_keys.py",\ref count_messages.py "count_messages.py"
@param gribid id of the grib loaded in memory @param gribid id of the grib loaded in memory
@param key name of the key @param key name of the key
@ -526,7 +526,7 @@ def grib_iterator_new(gribid,mode):
The geoiterator can be used to go through all the geopoints in a message and The geoiterator can be used to go through all the geopoints in a message and
retrieve the values corresponding to those geopoints. retrieve the values corresponding to those geopoints.
\b Examples: \ref iterator.py "iterator.py" \b Examples: \ref grib_iterator.py "grib_iterator.py"
@param gribid id of the grib loaded in memory @param gribid id of the grib loaded in memory
@param mode flags for future use @param mode flags for future use
@ -541,7 +541,7 @@ def grib_iterator_delete(iterid):
""" """
@brief Delete a geoiterator and free memory. @brief Delete a geoiterator and free memory.
\b Examples: \ref iterator.py "iterator.py" \b Examples: \ref grib_iterator.py "grib_iterator.py"
@param iterid geoiterator id @param iterid geoiterator id
@exception GribInternalError @exception GribInternalError
@ -553,7 +553,7 @@ def grib_iterator_next(iterid):
""" """
@brief Retrieve the next value from a geoiterator. @brief Retrieve the next value from a geoiterator.
\b Examples: \ref iterator.py "iterator.py" \b Examples: \ref grib_iterator.py "grib_iterator.py"
@param iterid geoiterator id @param iterid geoiterator id
@return tuple with the latitude, longitude and value @return tuple with the latitude, longitude and value
@ -583,7 +583,7 @@ def grib_keys_iterator_new(gribid,namespace=None):
that namespace are returned. Example namespaces are "ls" (to get the same that namespace are returned. Example namespaces are "ls" (to get the same
default keys as the grib_ls) and "mars" to get the keys used by mars. default keys as the grib_ls) and "mars" to get the keys used by mars.
\b Examples: \ref iterator.py "iterator.py" \b Examples: \ref grib_iterator.py "grib_iterator.py"
@param gribid id of the grib loaded in memory @param gribid id of the grib loaded in memory
@param namespace the namespace of the keys to search for (all the keys if None) @param namespace the namespace of the keys to search for (all the keys if None)
@ -599,7 +599,7 @@ def grib_keys_iterator_next(iterid):
""" """
@brief Advance to the next keys iterator value. @brief Advance to the next keys iterator value.
\b Examples: \ref keys_iterator.py "keys_iterator.py" \b Examples: \ref grib_keys_iterator.py "grib_keys_iterator.py"
@param iterid keys iterator id created with @ref grib_keys_iterator_new @param iterid keys iterator id created with @ref grib_keys_iterator_new
@exception GribInternalError @exception GribInternalError
@ -614,7 +614,7 @@ def grib_keys_iterator_delete(iterid):
""" """
@brief Delete a keys iterator and free memory. @brief Delete a keys iterator and free memory.
\b Examples: \ref keys_iterator.py "keys_iterator.py" \b Examples: \ref grib_keys_iterator.py "grib_keys_iterator.py"
@param iterid keys iterator id created with @ref grib_keys_iterator_new @param iterid keys iterator id created with @ref grib_keys_iterator_new
@exception GribInternalError @exception GribInternalError
@ -626,7 +626,7 @@ def grib_keys_iterator_get_name(iterid):
""" """
@brief Get the name of a key from a keys iterator. @brief Get the name of a key from a keys iterator.
\b Examples: \ref keys_iterator.py "keys_iterator.py" \b Examples: \ref grib_keys_iterator.py "grib_keys_iterator.py"
@param iterid keys iterator id created with @ref grib_keys_iterator_new @param iterid keys iterator id created with @ref grib_keys_iterator_new
@return key name to be retrieved @return key name to be retrieved
@ -744,7 +744,7 @@ def grib_clone(gribid_src):
Create a copy of a given message (\em gribid_src) resulting in a new Create a copy of a given message (\em gribid_src) resulting in a new
message in memory (\em gribid_dest) identical to the original one. message in memory (\em gribid_dest) identical to the original one.
\b Examples: \ref clone.py "clone.py" \b Examples: \ref grib_clone.py "grib_clone.py"
@param gribid_src id of grib to be cloned @param gribid_src id of grib to be cloned
@return id of clone @return id of clone
@ -1345,7 +1345,7 @@ def grib_find_nearest(gribid,inlat,inlon,is_lsm = False,npoints = 1):
The number of nearest points returned can be controled through the npoints function argument. The number of nearest points returned can be controled through the npoints function argument.
\b Examples: \ref nearest.py "nearest.py" \b Examples: \ref grib_nearest.py "grib_nearest.py"
@param gribid id of the grib loaded in memory @param gribid id of the grib loaded in memory
@param inlat latitude of the point @param inlat latitude of the point
@ -1418,7 +1418,7 @@ def grib_get(gribid,key, ktype=None):
The \em gribid references a grib message loaded in memory. The \em gribid references a grib message loaded in memory.
\b Examples: \ref get.py "get.py", \ref print_data.py "print_data.py" \b Examples: \ref grib_get_keys.py "grib_get_keys.py", \ref print_data.py "print_data.py"
@see grib_new_from_file, grib_release, grib_set @see grib_new_from_file, grib_release, grib_set
@ -1496,7 +1496,7 @@ def grib_set_values(gribid,values):
The elements of the input sequence need to be convertible to a double. The elements of the input sequence need to be convertible to a double.
\b Examples: \ref clone.py "clone.py", \ref samples.py "samples.py" \b Examples: \ref grib_clone.py "grib_clone.py", \ref samples.py "samples.py"
@param gribid id of the grib loaded in memory @param gribid id of the grib loaded in memory
@param values array of values to set as tuple, list, array or numpy.ndarray @param values array of values to set as tuple, list, array or numpy.ndarray
@ -1510,7 +1510,7 @@ def grib_set(gribid,key,value):
The input value can be a python int, float or str. The input value can be a python int, float or str.
\b Examples: \ref set.py "set.py" \b Examples: \ref grib_set_keys.py "grib_set_keys.py"
@see grib_new_from_file, grib_release, grib_get @see grib_new_from_file, grib_release, grib_get