[eccodes] 01/13: new upstream 2.5.0

Alastair McKinstry mckinstry at moszumanska.debian.org
Wed Oct 25 10:55:28 UTC 2017


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to tag debian/2.5.0-2
in repository eccodes.

commit 99beefe4a51f57a5611ff026e78503ef4cff9851
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Tue Oct 3 19:55:43 2017 +0100

    new upstream 2.5.0
---
 CMakeLists.txt                                     |   36 +-
 VERSION.cmake                                      |    2 +-
 cmake/FindAIO.cmake                                |   52 +-
 cmake/VERSION.cmake                                |    4 +-
 .../contrib/GreatCMakeCookOff/AddCPP11Flags.cmake  |   48 +-
 cmake/ecbuild_add_library.cmake                    |    6 +-
 cmake/ecbuild_policies.cmake                       |   10 +-
 data/bufr/bufr_data_files.txt                      |    2 +
 data/grib_data_files.txt                           |    1 +
 .../bufr/tables/0/local/19-1/254/0/element.table   |   48 +
 definitions/grib1/2.98.140.table                   |    4 +-
 definitions/grib1/2.98.172.table                   |   28 +-
 definitions/grib1/2.98.173.table                   |   46 +-
 definitions/grib1/grid_definition_5.def            |    3 +
 definitions/grib1/grid_definition_latlon.def       |    2 +-
 definitions/grib1/localConcepts/ecmf/cfVarName.def |   62 +-
 definitions/grib1/localConcepts/ecmf/name.def      |   28 +-
 definitions/grib1/localConcepts/ecmf/paramId.def   |   24 +-
 definitions/grib1/localConcepts/ecmf/shortName.def |   24 +-
 definitions/grib1/localConcepts/ecmf/units.def     |   24 +-
 definitions/grib1/localConcepts/edzw/name.def      |   96 +-
 definitions/grib1/localConcepts/edzw/paramId.def   |   92 +-
 definitions/grib1/localConcepts/edzw/shortName.def |   98 +-
 definitions/grib1/localConcepts/edzw/units.def     |   98 +-
 definitions/grib2/cfVarName.def                    |   20 +
 definitions/grib2/diff.out                         |  793 ------
 definitions/grib2/localConcepts/ecmf/cfVarName.def |   16 +-
 definitions/grib2/localConcepts/ecmf/name.def      |   20 +-
 definitions/grib2/localConcepts/ecmf/paramId.def   |   16 +-
 definitions/grib2/localConcepts/ecmf/shortName.def |   16 +-
 definitions/grib2/localConcepts/ecmf/units.def     |   16 +-
 definitions/grib2/localConcepts/edzw/name.def      |  594 ++++-
 definitions/grib2/localConcepts/edzw/paramId.def   |  596 ++++-
 definitions/grib2/localConcepts/edzw/shortName.def |  596 ++++-
 definitions/grib2/localConcepts/edzw/units.def     |  606 ++++-
 definitions/grib2/name.def                         |   20 +
 definitions/grib2/paramId.def                      |   20 +
 definitions/grib2/shortName.def                    |   20 +
 definitions/grib2/template.3.20.def                |   11 +-
 definitions/grib2/template.3.latlon.def            |    2 +-
 definitions/grib2/template.4.67.def                |   13 +
 definitions/grib2/template.4.68.def                |   14 +
 definitions/grib2/template.4.horizontal.def        |    4 +
 definitions/grib2/units.def                        |   20 +
 definitions/grib3/template.3.20.def                |    9 +-
 definitions/grib3/template.component.4.1.def       |    2 +-
 examples/C/bufr_clone.c                            |    2 +-
 examples/C/bufr_copy_data.c                        |    2 +-
 examples/C/bufr_expanded.c                         |    4 +-
 examples/C/bufr_keys_iterator.c                    |    4 +-
 examples/C/bufr_read_header.c                      |    2 +-
 examples/C/bufr_read_synop.c                       |    5 -
 examples/C/bufr_read_temp.c                        |   20 +-
 examples/C/bufr_set_keys.c                         |    2 +-
 examples/C/bufr_subset.c                           |    5 -
 examples/C/get_product_kind.c                      |    2 +-
 examples/C/grib_clone.c                            |    2 +-
 examples/C/grib_copy_message.c                     |    4 +-
 examples/C/grib_ensemble_index.c                   |    4 +-
 examples/C/grib_index.c                            |    2 +-
 examples/C/grib_iterator.c                         |    2 +-
 examples/C/grib_iterator_bitmap.c                  |    4 +-
 examples/C/grib_multi_write.c                      |    2 +-
 examples/C/grib_nearest.c                          |    2 +-
 examples/C/grib_print_data.c                       |    4 +-
 examples/C/grib_set_data.c                         |    2 +-
 examples/C/grib_set_pv.c                           |    2 +-
 examples/C/multi2.c                                |   32 +-
 examples/C/new_sample.c                            |    3 +-
 examples/C/sections_copy.c                         |    2 +-
 examples/F90/get_set_uuid.f90                      |   66 +-
 examples/F90/grib_keys_iterator.f90                |    5 +-
 examples/F90/new_from_file.f90                     |    7 +-
 examples/F90/precision_fortran.f90                 |   17 +-
 examples/python/binary_message.py                  |    1 +
 examples/python/bufr_attributes.py                 |   22 +-
 examples/python/bufr_clone.py                      |    5 +-
 examples/python/bufr_copy_data.py                  |   21 +-
 examples/python/bufr_encode_flight.py              |   20 +-
 examples/python/bufr_expanded.py                   |   12 +-
 examples/python/bufr_get_keys.py                   |   33 +-
 examples/python/bufr_keys_iterator.py              |   10 +-
 examples/python/bufr_read_header.py                |    9 +-
 examples/python/bufr_read_scatterometer.py         |   18 +-
 examples/python/bufr_read_synop.py                 |    9 +-
 examples/python/bufr_read_temp.py                  |   18 +-
 examples/python/bufr_read_tropical_cyclone.py      |  145 +-
 examples/python/bufr_set_keys.py                   |   13 +-
 examples/python/bufr_subset.py                     |   14 +-
 examples/python/ecc-448.py                         |   12 +-
 examples/python/get_product_kind.py                |   13 +-
 examples/python/get_product_kind.sh                |   17 +-
 examples/python/grib_ccsds.py                      |    6 +-
 examples/python/grib_clone.py                      |    1 +
 examples/python/grib_count_messages.py             |   12 +-
 examples/python/grib_get_keys.py                   |   10 +-
 examples/python/grib_get_keys.sh                   |   13 +-
 examples/python/grib_get_message_offset.py         |   12 +-
 examples/python/grib_index.py                      |   16 +-
 examples/python/grib_iterator.py                   |    9 +-
 examples/python/grib_iterator_bitmap.py            |    6 +-
 examples/python/grib_keys_iterator.py              |    4 +-
 examples/python/grib_ls_JSON.py                    |   49 +-
 examples/python/grib_multi_write.py                |    1 +
 examples/python/grib_nearest.py                    |   14 +-
 examples/python/grib_print_data.py                 |   10 +-
 examples/python/grib_samples.py                    |    1 +
 examples/python/grib_set_bitmap.py                 |    4 +-
 examples/python/grib_set_keys.py                   |   40 +-
 examples/python/grib_set_missing.py                |    3 +-
 examples/python/grib_set_missing.sh                |    7 +-
 examples/python/grib_set_pv.py                     |    3 +-
 examples/python/grib_set_pv.sh                     |    4 +
 examples/python/gts_get_keys.py                    |    9 +-
 examples/python/high_level_api.py                  |   91 +-
 examples/python/keys_iterator_gts.py               |    6 +-
 examples/python/metar_get_keys.py                  |    9 +-
 fortran/create_grib_f90.sh                         |    1 +
 fortran/eccodes_f90_tail.f90                       |   10 +-
 fortran/grib_f90_int.f90                           |    4 +-
 fortran/grib_f90_long_int.f90                      |   30 +-
 fortran/grib_fortran_prototypes.h                  |    4 +-
 html/classeccodes.html                             |   26 +-
 html/eccodes_8h.html                               |    4 +-
 html/group__codes__handle.html                     |   12 +-
 html/interfaceeccodes_1_1codes__get.html           |    2 +-
 html/interfaceeccodes_1_1codes__set.html           |    2 +-
 memfs.py                                           |   12 +-
 memfs/CMakeLists.txt                               |    6 +
 python/eccodes/high_level/codesfile.py             |    2 +-
 python/gribapi/gribapi.py                          |    3 +-
 share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake     |   12 +-
 src/CMakeLists.txt                                 |    2 +
 src/Makefile.am                                    |    2 +
 src/eccodes.c                                      |   13 +-
 src/eccodes.h                                      |   41 +-
 src/grib_accessor.c                                |    2 +-
 src/grib_accessor_class.c                          |    5 +-
 src/grib_accessor_class_bufr_data_array.c          |   11 +-
 src/grib_accessor_class_bufr_data_element.c        |   17 +
 src/grib_accessor_class_codetable.c                |   88 +-
 src/grib_accessor_class_concept.c                  |    2 +-
 src/grib_accessor_class_data_2order_packing.c      |    4 +-
 ...grib_accessor_class_data_2order_packing_count.c |   94 +-
 src/grib_accessor_class_data_apply_gdsnotpresent.c |  243 +-
 src/grib_accessor_class_data_complex_packing.c     |   16 +-
 src/grib_accessor_class_data_g22order_packing.c    |    4 +-
 src/grib_accessor_class_data_g2simple_packing.c    |  203 +-
 ...lass_data_g2simple_packing_with_preprocessing.c |  196 +-
 src/grib_accessor_class_data_raw_packing.c         |  226 +-
 src/grib_accessor_class_data_sh_packed.c           |   18 +-
 src/grib_accessor_class_data_sh_unpacked.c         |   18 +-
 src/grib_accessor_class_data_simple_packing.c      |    6 +-
 src/grib_accessor_class_g2end_step.c               |   59 +-
 src/grib_accessor_class_g2latlon.c                 |  141 +-
 src/grib_accessor_class_global_gaussian.c          |   13 +-
 src/grib_accessor_class_md5.c                      |   51 +-
 src/grib_accessor_class_non_alpha.c                |  207 +-
 src/grib_accessor_class_octahedral_gaussian.c      |   52 +-
 src/grib_accessor_factory_hash_list                |    1 +
 src/grib_api.h                                     |   30 +-
 src/grib_api_internal.h                            |  265 +-
 src/grib_api_prototypes.h                          |   25 +-
 src/grib_api_version.c                             |    2 +-
 src/grib_darray.c                                  |   12 +
 src/grib_dumper_class.h                            |    2 +-
 src/grib_dumper_class_bufr_decode_C.c              |   31 +-
 src/grib_dumper_class_bufr_decode_filter.c         |   24 +-
 src/grib_dumper_class_bufr_decode_fortran.c        |   33 +-
 src/grib_dumper_class_bufr_decode_python.c         |   27 +-
 src/grib_dumper_class_bufr_encode_C.c              |   52 +-
 src/grib_dumper_class_bufr_encode_filter.c         |   35 +-
 src/grib_dumper_class_bufr_encode_fortran.c        |   36 +-
 src/grib_dumper_class_bufr_encode_python.c         |   36 +-
 ...de_filter.c => grib_dumper_class_bufr_simple.c} |  182 +-
 src/grib_dumper_class_default.c                    |    6 +-
 src/grib_dumper_class_json.c                       |   53 +-
 src/grib_dumper_factory.h                          |    1 +
 src/grib_handle.c                                  |    4 +-
 src/grib_iarray.c                                  |   12 +
 src/grib_ieeefloat.c                               |    6 +
 src/grib_io.c                                      |   74 +-
 src/grib_iterator_class_gen.c                      |  144 +-
 src/grib_iterator_class_lambert_conformal.c        |  103 +-
 src/grib_iterator_class_latlon.c                   |   82 +-
 src/grib_iterator_class_polar_stereographic.c      |  163 +-
 src/grib_iterator_class_regular.c                  |   80 +-
 src/grib_iterator_class_space_view.c               |    2 +-
 src/grib_loader_from_handle.c                      |    4 +-
 src/grib_nearest_class.h                           |    1 +
 src/grib_nearest_class_lambert_conformal.c         |    2 +-
 src/grib_nearest_class_latlon_reduced.c            |  496 ++--
 ....c => grib_nearest_class_polar_stereographic.c} |   22 +-
 src/grib_nearest_class_reduced.c                   |    2 +-
 src/grib_nearest_factory.h                         |    1 +
 src/grib_optimize_decimal_factor.h                 |    4 +-
 src/grib_parse_utils.c                             |    2 +-
 src/grib_query.c                                   |   29 +-
 src/grib_trie_with_rank.c                          |    2 +-
 src/grib_util.c                                    |  119 +-
 src/grib_yacc.c                                    | 2328 +++++++++---------
 src/griby.y                                        |   15 +-
 src/makeyacc                                       |    4 +-
 tests/CMakeLists.txt                               |   18 +
 tests/bufr_dump_decode_C.sh                        |    7 +-
 tests/bufr_dump_decode_filter.sh                   |    2 +-
 tests/bufr_dump_encode_C.sh                        |    7 +-
 tests/bufr_dump_encode_filter.sh                   |    2 +-
 tests/bufr_filter.sh                               |   44 +-
 tests/bufr_filter_extract_area.sh                  |    4 +-
 tests/bufr_filter_extract_datetime.sh              |    8 +-
 tests/bufr_get_element.c                           |    2 +-
 tests/bufr_keys_iter.c                             |   42 +-
 tests/bufr_keys_iter.sh                            |  170 +-
 tests/ecc-286.sh                                   |    2 +-
 tests/ecc-288.sh                                   |    2 +-
 tests/ecc-313.sh                                   |    2 +-
 tests/ecc-379.sh                                   |    8 +-
 tests/ecc-386.c                                    |    2 +-
 tests/ecc-393.sh                                   |    2 +-
 tests/ecc-433.sh                                   |    2 +-
 tests/ecc-490.sh                                   |   38 +
 tests/ecc-517.c                                    |  114 +
 .../python/get_product_kind.sh => tests/ecc-517.sh |   16 +-
 tests/grib_double_cmp.c                            |    2 +-
 tests/grib_encode_pthreads.c                       |  119 +
 .../grib_encode_pthreads.sh                        |   10 +-
 tests/grib_statistics.sh                           |    7 +
 tests/grib_util_set_spec.c                         |   98 +-
 tests/ieee.c                                       |   94 +-
 tests/index.c                                      |    2 +-
 tests/julian.c                                     |   12 +-
 tests/multi_from_message.c                         |    8 +-
 tests/read_any.c                                   |    4 +-
 tests/read_index.c                                 |    2 +-
 tests/sh_ieee64.c                                  |  276 +++
 version.sh => tests/sh_ieee64.sh                   |   17 +-
 tests/unit_tests.c                                 | 2592 ++++++++++----------
 tigge/tigge_accumulations.c                        |  401 ++-
 tigge/tigge_name.c                                 |  356 ++-
 tigge/tigge_split.c                                |    2 +-
 tools/bufr_dump.c                                  |    9 +-
 tools/bufr_index_build.c                           |   21 +-
 tools/codes_count.c                                |    6 +-
 tools/codes_info.c                                 |   14 +-
 tools/grib2ppm.c                                   |    2 +-
 tools/grib_get.c                                   |    2 +-
 tools/grib_get_data.c                              |   38 +-
 tools/grib_histogram.c                             |    4 +-
 tools/grib_ls.c                                    |    2 +-
 tools/grib_merge.c                                 |    4 +-
 tools/grib_to_netcdf.c                             |   84 +-
 tools/grib_tools.c                                 |    6 +-
 tools/gts_compare.c                                |    4 +-
 tools/gts_ls.c                                     |    4 +-
 tools/metar_ls.c                                   |    2 +-
 version.sh                                         |    4 +-
 windows/msvc/grib_api_lib/grib_api_lib.vcproj      |    4 +
 258 files changed, 10068 insertions(+), 6260 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index db4cdeb..bf4d78b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,7 +24,7 @@ set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}
 
 include( ecbuild_system NO_POLICY_SCOPE )
 
-ecbuild_requires_macro_version( 2.6 )
+ecbuild_requires_macro_version( 2.7.2 )
 
 ###############################################################################
 # local project
@@ -39,18 +39,6 @@ ecbuild_add_option( FEATURE EXAMPLES
     DEFAULT ON
 )
 
-# controls installation of files in definitions/ -- note that it still creates the symlinks in the build dir
-ecbuild_add_option( FEATURE INSTALL_ECCODES_DEFINITIONS
-    DESCRIPTION "Install the ecCodes definitions"
-    DEFAULT ON
-)
-
-# controls installation of files in samples/ and ifs_samples/ -- note that it still creates the symlinks in the build dir
-ecbuild_add_option( FEATURE INSTALL_ECCODES_SAMPLES
-    DESCRIPTION "Install the ecCodes samples, including IFS samples"
-    DEFAULT ON
-)
-
 ecbuild_add_option( FEATURE JPG
     DESCRIPTION "Support for JPG decoding/encoding"
     DEFAULT ON
@@ -108,7 +96,7 @@ ecbuild_add_option( FEATURE MEMFS
     DESCRIPTION "Memory based access to definitions/samples"
     DEFAULT OFF
     CONDITION EC_HAVE_FMEMOPEN OR EC_HAVE_FUNOPEN
-    REQUIRED_PACKAGES "Python VERSION 2.6 NO_LIBS"
+    REQUIRED_PACKAGES PythonInterp
 )
 
 #if( HAVE_MEMFS AND "${CMAKE_C_COMPILER_ID}" STREQUAL "Cray")
@@ -116,6 +104,26 @@ ecbuild_add_option( FEATURE MEMFS
 #  ecbuild_warn("MEMFS not supported with Cray C compiler")
 #endif()
 
+if(HAVE_MEMFS)
+  set( _will_install_defs_samples OFF )
+else()
+  set( _will_install_defs_samples ON )
+endif()
+
+# controls installation of files in definitions/ -- note that it still creates the symlinks in the build dir
+# by default, if memfs is available, then we don't need to install definitions
+ecbuild_add_option( FEATURE INSTALL_ECCODES_DEFINITIONS
+    DESCRIPTION "Install the ecCodes definitions"
+    DEFAULT ${_will_install_defs_samples}
+)
+
+# controls installation of files in samples/ and ifs_samples/ -- note that it still creates the symlinks in the build dir
+# by default, if memfs is available, then we don't need to install samples
+ecbuild_add_option( FEATURE INSTALL_ECCODES_SAMPLES
+    DESCRIPTION "Install the ecCodes samples, including IFS samples"
+    DEFAULT ${_will_install_defs_samples}
+)
+
 # advanced options (not visible in cmake-gui )
 
 ecbuild_add_option( FEATURE MEMORY_MANAGEMENT   DESCRIPTION "Enable memory management" DEFAULT OFF ADVANCED )
diff --git a/VERSION.cmake b/VERSION.cmake
index 973f50d..c7efa99 100644
--- a/VERSION.cmake
+++ b/VERSION.cmake
@@ -1 +1 @@
-set( ${PROJECT_NAME}_VERSION_STR  "2.4.1" )
+set( ${PROJECT_NAME}_VERSION_STR  "2.5.0" )
diff --git a/cmake/FindAIO.cmake b/cmake/FindAIO.cmake
index 5dd9244..5606529 100644
--- a/cmake/FindAIO.cmake
+++ b/cmake/FindAIO.cmake
@@ -1,8 +1,8 @@
 # (C) Copyright 1996-2017 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 
+# 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.
 
@@ -32,34 +32,38 @@ if( AIO_FOUND )
 
 	include( CheckCSourceCompiles )
 	include( CMakePushCheckState )
-    
+
     cmake_push_check_state()
-    
+
 		set( CMAKE_REQUIRED_INCLUDES ${AIO_INCLUDE_DIRS} )
 
 		if( AIO_LIBRARIES )
 			set( CMAKE_REQUIRED_LIBRARIES ${AIO_LIBRARIES} )
 		endif()
 
-		check_c_source_compiles( "#include <aio.h>
-								  #include <fcntl.h>
-								  int main(){
-									  struct aiocb* aiocbp;
-									  int n = aio_write(aiocbp);
-									  n = aio_read(aiocbp);
-									  n = aio_fsync(O_SYNC,aiocbp);
-									  return 0; }"
-								EC_HAVE_AIOCB )
-
-		check_c_source_compiles( "#include <aio.h>
-								  #include <fcntl.h>
-								  int main(){
-									  struct aiocb64* aiocbp;
-									  int n = aio_write64(aiocbp);
-									  n = aio_read64(aiocbp);
-									  n = aio_fsync64(O_SYNC,aiocbp);
-									  return 0; }"
-								EC_HAVE_AIOCB64 )
+		if( NOT DEFINED EC_HAVE_AIOCB )
+			ecbuild_cache_check_c_source_compiles( "#include <aio.h>
+									  #include <fcntl.h>
+									  int main(){
+										  struct aiocb* aiocbp;
+										  int n = aio_write(aiocbp);
+										  n = aio_read(aiocbp);
+										  n = aio_fsync(O_SYNC,aiocbp);
+										  return 0; }"
+									EC_HAVE_AIOCB )
+		endif()
+
+		if( NOT DEFINED EC_HAVE_AIOCB64 )
+			check_c_source_compiles( "#include <aio.h>
+									  #include <fcntl.h>
+									  int main(){
+										  struct aiocb64* aiocbp;
+										  int n = aio_write64(aiocbp);
+										  n = aio_read64(aiocbp);
+										  n = aio_fsync64(O_SYNC,aiocbp);
+										  return 0; }"
+									EC_HAVE_AIOCB64 )
+		endif()
 
     cmake_pop_check_state()
 
diff --git a/cmake/VERSION.cmake b/cmake/VERSION.cmake
index 3449f42..3b36296 100644
--- a/cmake/VERSION.cmake
+++ b/cmake/VERSION.cmake
@@ -1,7 +1,7 @@
 set( ECBUILD_MAJOR_VERSION "2" )
 set( ECBUILD_MINOR_VERSION "7" )
-set( ECBUILD_PATCH_VERSION "2" )
+set( ECBUILD_PATCH_VERSION "3" )
 
-set( ECBUILD_VERSION_STR  "2.7.2" )
+set( ECBUILD_VERSION_STR  "2.7.3" )
 
 set( ECBUILD_MACRO_VERSION "${ECBUILD_VERSION_STR}" )
diff --git a/cmake/contrib/GreatCMakeCookOff/AddCPP11Flags.cmake b/cmake/contrib/GreatCMakeCookOff/AddCPP11Flags.cmake
index ac7f456..eb17be5 100644
--- a/cmake/contrib/GreatCMakeCookOff/AddCPP11Flags.cmake
+++ b/cmake/contrib/GreatCMakeCookOff/AddCPP11Flags.cmake
@@ -27,24 +27,36 @@ if(CMAKE_VERSION VERSION_LESS 2.8.9)
   endmacro ()
 endif(CMAKE_VERSION VERSION_LESS 2.8.9)
 
-check_cxx_compiler_flag(-std=c++11 has_std_cpp11)
-check_cxx_compiler_flag(-std=c++0x has_std_cpp0x)
-check_cxx_compiler_flag(-hstd=c++11 has_hstd_cpp11)
-if(MINGW) 
-  check_cxx_compiler_flag(-std=gnu++11 has_std_gnupp11)
-  check_cxx_compiler_flag(-std=gnu++0x has_std_gnupp0x)
-endif(MINGW)
-if(has_std_gnupp11)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
-elseif(has_std_gnupp0x)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
-elseif(has_std_cpp11)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-elseif(has_std_cpp0x)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
-elseif(has_hstd_cpp11)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -hstd=c++11")
-endif(has_std_gnupp11)
+if( CXX11_FLAG )
+
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAG}")
+
+else()
+
+  if(MINGW)
+    LIST( APPEND CHECK_CXX11_FLAGS
+      "-std=gnu++11"
+      "-std=gnu++0x"
+    )
+  endif(MINGW)
+
+  LIST( APPEND CHECK_CXX11_FLAGS
+    "-std=c++11"
+    "-hstd=c++11"
+    "-std=c++0x"
+  )
+
+  set( __N 1 )
+  foreach( _cxx11_flag ${CHECK_CXX11_FLAGS} )
+    check_cxx_compiler_flag( ${_cxx11_flag} has_cxx11_flag_${__N} )
+    if( has_cxx11_flag_${__N} )
+      set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_cxx11_flag}" )
+      break()
+    endif()
+    math( EXPR __N '${__N}+1' )
+  endforeach()
+
+endif()
 
 if(MSVC) 
   set(MSWINDOBE TRUE)
diff --git a/cmake/ecbuild_add_library.cmake b/cmake/ecbuild_add_library.cmake
index 9dfe25b..e267333 100644
--- a/cmake/ecbuild_add_library.cmake
+++ b/cmake/ecbuild_add_library.cmake
@@ -298,7 +298,11 @@ function( ecbuild_add_library_impl )
       list(REMOVE_ITEM _PAR_LIBS optimized)
       foreach( lib ${_PAR_LIBS} ) # skip NOTFOUND
         if( lib )
-          ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): linking with ${lib}")
+
+          string(REGEX REPLACE "[ ]+$" "" ${lib} "${${lib}}") # strips leading whitespaces
+          string(REGEX REPLACE "^[ ]+" "" ${lib} "${${lib}}") # strips trailing whitespaces
+
+          ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): linking with [${lib}]")
           target_link_libraries( ${_PAR_TARGET} ${lib} )
         else()
           ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): ${lib} not found - not linking")
diff --git a/cmake/ecbuild_policies.cmake b/cmake/ecbuild_policies.cmake
index df2b40f..e24c435 100644
--- a/cmake/ecbuild_policies.cmake
+++ b/cmake/ecbuild_policies.cmake
@@ -18,9 +18,9 @@
 #
 ##############################################################################
 
-# allow for empty spaces around library names 
+# fail if empty spaces are found around linked library names
 if( POLICY CMP0004 )
-    cmake_policy( SET CMP0004 OLD )
+    cmake_policy( SET CMP0004 NEW )
 endif()
 
 # Allow use of the LOCATION target property.
@@ -65,3 +65,9 @@ endif()
 if( POLICY CMP0054 )
     cmake_policy( SET CMP0054 NEW )
 endif()
+
+# RPATH settings on macOS do not affect "install_name"
+# FTM, keep old behavior -- need to test if new behavior impacts binaries in build directory
+if( POLICY CMP0068 )
+    cmake_policy( SET CMP0068 OLD )
+endif()
diff --git a/data/bufr/bufr_data_files.txt b/data/bufr/bufr_data_files.txt
index cbe5331..79c74c8 100644
--- a/data/bufr/bufr_data_files.txt
+++ b/data/bufr/bufr_data_files.txt
@@ -140,3 +140,5 @@ imssnow.bufr
 sentinel1.bufr
 srals3_ecmwf4.bufr
 srals3_eumetsat.bufr
+eumetsat_iasi_co.bufr
+eum_iasi_twt.bufr
diff --git a/data/grib_data_files.txt b/data/grib_data_files.txt
index d25ae3e..43b7674 100644
--- a/data/grib_data_files.txt
+++ b/data/grib_data_files.txt
@@ -86,3 +86,4 @@ tp_ecmwf.grib
 v.grib2
 msl.octa.glob.grib1
 test_file.grib2
+gfs.complex.mvmu.grib2
diff --git a/definitions/bufr/tables/0/local/19-1/254/0/element.table b/definitions/bufr/tables/0/local/19-1/254/0/element.table
index 9f546a6..1b1eaed 100644
--- a/definitions/bufr/tables/0/local/19-1/254/0/element.table
+++ b/definitions/bufr/tables/0/local/19-1/254/0/element.table
@@ -1,4 +1,52 @@
 #code|abbreviation|type|name|unit|scale|reference|width|crex_unit|crex_scale|crex_width
+001007|satelliteIdentifier|table|SATELLITE IDENTIFIER|CODE TABLE|0|0|10|CODE TABLE|0|4
+001031|centre|table|IDENTIFICATION OF ORIGINATING/GENERATING CENTRE|CODE TABLE|0|0|16|CODE TABLE|0|5
+010200|meanDynamicTopographyAccuracy|double|MEAN DYNAMIC TOPOGRAPHY ACCURACY|m|3|-131072|18|m|3|6
+010220|pressureHighPrecision|double|PRESSURE (HIGH PRECISION)|Pa|-1|0|30
+002019|satelliteInstruments|table|SATELLITE INSTRUMENTS|CODE TABLE|0|0|11|CODE TABLE|0|4
+002020|satelliteClassification|table|SATELLITE CLASSIFICATION|CODE TABLE|0|0|9|CODE TABLE|0|3
+004001|year|long|YEAR|a|0|0|12|a|0|4
+004002|month|long|MONTH|mon|0|0|4|mon|0|2
+004003|day|long|DAY|d|0|0|6|d|0|2
+004004|hour|long|HOUR|h|0|0|5|h|0|2
+004005|minute|long|MINUTE|min|0|0|6|min|0|2
+004006|second|long|SECOND|s|0|0|6|s|0|2
+040197|SatelliteManoeuvreIndicator|table|SATELLITE MANOEUVRE INDICATOR|CODE TABLE|0|0|3
+040220|qualityIndicatorForAtmosphericTemperature|double|QUALITY INDICATOR FOR ATMOSPHERIC TEMPERATURE|double|1|0|8
+040221|qualityIndicatorForAtmosphericWaterVapour|double|QUALITY INDICATOR FOR ATMOSPHERIC WATER_VAPOUR|double|1|0|8
+040223|qualityIndicatorForSurfaceTemperature|double|QUALITY INDICATOR FOR SURFACE TEMPERATURE|double|1|0|8
+040231|cloudinessSummary|table|CLOUDINESS SUMMARY|CODE TABLE|0|0|3 
+040232|newValidationFlagForIASILevel1PRD|table|NEW VALIDATION FLAG FOR IASI LEVEL 1 PRODUCT|CODE TABLE|0|0|3
+040233|validationFlagForAMSUBLevel1PRD|table|VALIDATION FLAG FOR AMSU-B LEVEL 1 PRODUCT|CODE TABLE|0|0|3
+040235|retrievalInitialization|table|RETRIEVAL INITIALISATION|CODE TABLE|0|0|8
+040236|convergenceOfTheIterativeRetrieval|table|CONVERGENCE OF THE ITERATIVE RETRIEVAL|CODE TABLE|0|0|3
+040237|validationFlagOfMHSLevel1DataFlow|table|VALIDATION FLAG OF MHS  LEVEL 1 DATA FLOW|CODE TABLE|0|0|3
+040238|validationFlagOfNWPForecast|table|VALIDATION FLAG OF NWP FORECAST|CODE TABLE|0|0|3
+040239|indicationOfSuperAdiabaticAndSuperSaturationInFinalRet|table|INDICATION OF SUPER-ADIABATIC AND SUPER-SATURATION IN FINAL RET|FLAG TABLE|0|0|8
+040240|numberOfIterationUsedForRetrieval|long|NUMBER OF ITERATION USED FOR RETRIEVAL|long|0|0|8
+040242|generalRetrievalQualityFlag|table|GENERAL RETRIEVAL QUALITY FLAG|CODE TABLE|0|0|3
+040243|retrievalFlags|table|RETRIEVAL FLAGS|CODE TABLE|0|0|31 
+040244|numberOfVectorsDescribingTheCharMatrices|long|NUMBER OF VECTORS DESCRIBING THE CHAR. MATRICES|Numeric|0|0|8
+040245|numberOfLayersActuallyRetrieved|long|NUMBER OF LAYERS ACTUALLY RETRIEVED|Numeric|0|0|8
+040246|numberOfCOProfilesRetrievedInScanline|long|NUMBER OF CO PROFILES RETRIEVED IN SCANLINE|Numeric|0|0|8
+040247|airPartialColumnsOnEachRetrievedLayer|double|AIR PARTIAL COLUMNS ON EACH RETRIEVED LAYER|Numeric|-20|0|16
+040248|aPrioriPartialColumnsForCOonEachRetrievedLayer|double|A-PRIORI PARTIAL COLUMNS FOR CO EN EACH RETRIEVED LAYER|Numeric|-13|0|16
+040249|scalVecMultAprioriCoVecDefRetrCoVec|double|SCAL. VEC. MULT. A-PRI. CO VEC. DEF. RETR. CO VEC.|Numeric|5|0|26
+040250|mainEigenValuesOfTheSensitivityMatrix|double|MAIN EIGENVALUES OF THE SENSITIVITY MATRIX|Numeric|6|0|31
+040251|mainEigenVectorsOfTheSensitivityMatrix|double|MAIN EIGENVECTORS OF THE SENSITIVITY MATRIX|Numeric|6|-1000000000|31
+040252|retrievalFlagsPart1ProcessingAndInputsPotentialErrors|flag|RETRIEVAL FLAGS PART 1 PROCESSING AND INPUTS POTENTIAL ERRORS|FLAG TABLE|0|0|13 
+040253|retrievalFlagsPart2DiagnosticsOnTheRetrieval|flag|RETRIEVAL FLAGS PART 2 DIAGNOSTICS ON THE RETRIEVAL|FLAG TABLE|0|0|21 
+005001|latitude|double|LATITUDE (HIGH ACCURACY)|deg|5|-9000000|25|deg|5|7
+005021|bearingOrAzimuth|double|BEARING OR AZIMUTH|deg|2|0|16|deg|2|5
+005022|solarAzimuth|double|SOLAR AZIMUTH|deg|2|0|16|deg|2|5
+005040|orbitNumber|long|ORBIT NUMBER|Numeric|0|0|24|Numeric|0|8
+005041|scanLineNumber|long|SCAN LINE NUMBER|Numeric|0|0|8|Numeric|0|3
+005043|fieldOfViewNumber|long|FIELD OF VIEW NUMBER|Numeric|0|0|8|Numeric|0|3
+006001|longitude|double|LONGITUDE (HIGH ACCURACY)|deg|5|-18000000|26|deg|5|8
+007007|height|long|HEIGHT|m|0|-1000|17|m|0|6
+007024|satelliteZenithAngle|double|SATELLITE ZENITH ANGLE|deg|2|-9000|15|deg|2|5
+007025|solarZenithAngle|double|SOLAR ZENITH ANGLE|deg|2|-9000|15|deg|2|5
+025060|softwareIdentification|long|SOFTWARE IDENTIFICATION|Numeric|0|0|14|Numeric|0|5
 025200|bandSpecificOceanQualityFlag|flag|BAND SPECIFIC OCEAN QUALITY FLAG|Flag table|0|0|9|Flag table|0|3
 025201|altimeterEchoProcessingMode|table|Altimeter Echo Processing Mode|Code Table|0|0|8|Code Table|0|3
 025202|altimeterTrackingMode|table|Altimeter Tracking Mode|Code Table|0|0|8|Code Table|0|3
diff --git a/definitions/grib1/2.98.140.table b/definitions/grib1/2.98.140.table
index d5cbc20..19e2c32 100644
--- a/definitions/grib1/2.98.140.table
+++ b/definitions/grib1/2.98.140.table
@@ -37,7 +37,7 @@
 218 218 HMAX Maximum individual wave height (m)
 219 219 WMB Model bathymetry (m)
 220 220 MP1 Mean wave period based on first moment (s)
-221 221 MP2 Mean wave period based on second moment (s)
+221 221 MP2 Mean zero-crossing wave period (s)
 222 222 WDW Wave spectral directional width (dimensionless)
 223 223 P1WW Mean wave period based on first moment for wind waves (s)
 224 224 P2WW Mean wave period based on second moment for wind waves (s)
@@ -47,7 +47,7 @@
 228 228 DWPS Wave spectral directional width for swell (dimensionless)
 229 229 SWH Significant height of combined wind waves and swell (m)
 230 230 MWD Mean wave direction (Degree true)
-231 231 PP1D Peak period of 1D spectra (s)
+231 231 PP1D Peak wave period (s)
 232 232 MWP Mean wave period (s)
 233 233 CDWW Coefficient of drag with waves (dimensionless)
 234 234 SHWW Significant height of wind waves (m)
diff --git a/definitions/grib1/2.98.172.table b/definitions/grib1/2.98.172.table
index bb51fc5..95d1ea7 100644
--- a/definitions/grib1/2.98.172.table
+++ b/definitions/grib1/2.98.172.table
@@ -1,12 +1,14 @@
 # This file was automatically generated by ./param.pl
-44 44 - Snow evaporation m of water (s**-1)
-45 45 - Snowmelt m of water (s**-1)
-48 48 - Magnitude of surface stress (N m**-2)
-50 50 - Large-scale precipitation fraction
+8 8 MSROR Mean surface runoff rate (m of water equivalent s**-1)
+9 9 MSSROR Mean sub-surface runoff rate (m of water equivalent s**-1)
+44 44 ESRATE Snow evaporation (m of water s**-1)
+45 45 - Snowmelt (m of water s**-1)
+48 48 - Magnitude of turbulent surface stress (N m**-2)
+50 50 - Large-scale precipitation fraction (~)
 142 142 - Stratiform precipitation (Large-scale precipitation) (m s**-1)
-143 143 - Convective precipitation (m s**-1)
+143 143 CPRATE Convective precipitation (m s**-1)
 144 144 - Snowfall (convective + stratiform) (m of water equivalent s**-1)
-145 145 - Boundary layer dissipation (W m**-2)
+145 145 BLDRATE Boundary layer dissipation (W m**-2)
 146 146 - Surface sensible heat flux (W m**-2)
 147 147 - Surface latent heat flux (W m**-2)
 149 149 - Surface net radiation (W m**-2)
@@ -20,18 +22,18 @@
 179 179 - Top thermal radiation (W m**-2)
 180 180 - East-West surface stress (N m**-2)
 181 181 - North-South surface stress (N m**-2)
-182 182 - Evaporation m of water (s**-1)
-189 189 - Sunshine duration
+182 182 ERATE Evaporation (m of water s**-1)
+189 189 - Sunshine duration (~)
 195 195 - Longitudinal component of gravity wave stress (N m**-2)
 196 196 - Meridional component of gravity wave stress (N m**-2)
-197 197 - Gravity wave dissipation (W m**-2)
+197 197 GWDRATE Gravity wave dissipation (W m**-2)
 205 205 - Runoff (m s**-1)
 208 208 - Top net solar radiation, clear sky (W m**-2)
 209 209 - Top net thermal radiation, clear sky (W m**-2)
 210 210 - Surface net solar radiation, clear sky (W m**-2)
 211 211 - Surface net thermal radiation, clear sky (W m**-2)
-212 212 - Solar insolation (W m**-2 s**-1)
-228 228 - Total precipitation (m s**-1)
-239 239 - Convective snowfall m of water equivalent (s**-1)
-240 240 - Large scale snowfall m of water equivalent (s**-1)
+212 212 - Solar insolation (W m**-2)
+228 228 TPRATE Total precipitation (m s**-1)
+239 239 - Convective snowfall (m of water equivalent s**-1)
+240 240 - Large scale snowfall (m of water equivalent s**-1)
 255 255 - Indicates a missing value
diff --git a/definitions/grib1/2.98.173.table b/definitions/grib1/2.98.173.table
index b1e6581..d16e3ef 100644
--- a/definitions/grib1/2.98.173.table
+++ b/definitions/grib1/2.98.173.table
@@ -1,37 +1,39 @@
 # This file was automatically generated by ./param.pl
-44 44 - Snow evaporation anomaly m of water (s**-1)
-45 45 - Snowmelt anomaly m of water (s**-1)
-48 48 - Magnitude of surface stress anomaly (N m**-2)
-50 50 - Large-scale precipitation fraction anomaly
+8 8 MSRORA Mean surface runoff rate anomaly (m of water equivalent s**-1)
+9 9 MSSRORA Mean sub-surface runoff rate anomaly (m of water equivalent s**-1)
+44 44 - Snow evaporation anomaly (m of water s**-1)
+45 45 - Snowmelt anomaly (m of water s**-1)
+48 48 - Magnitude of turbulent surface stress anomaly (N m**-2)
+50 50 - Large-scale precipitation fraction anomaly (~)
 142 142 - Stratiform precipitation (Large-scale precipitation) anomaly (m s**-1)
 143 143 - Convective precipitation anomaly (m s**-1)
-144 144 - Snowfall (convective + stratiform) anomalous rate of accumulation (m of water equivalent s**-1)
-145 145 - Boundary layer dissipation anomaly (W m**-2)
-146 146 - Surface sensible heat flux anomaly (W m**-2)
-147 147 - Surface latent heat flux anomaly (W m**-2)
-149 149 - Surface net radiation anomaly (W m**-2)
+144 144 SFARA Snowfall (convective + stratiform) anomalous rate of accumulation (m of water equivalent s**-1)
+145 145 - Boundary layer dissipation anomaly (J m**-2)
+146 146 - Surface sensible heat flux anomaly (J m**-2)
+147 147 - Surface latent heat flux anomaly (J m**-2)
+149 149 - Surface net radiation anomaly (J m**-2)
 153 153 - Short-wave heating rate anomaly (K s**-1)
 154 154 - Long-wave heating rate anomaly (K s**-1)
-169 169 - Surface solar radiation downwards anomaly (W m**-2)
-175 175 - Surface thermal radiation downwards anomaly (W m**-2)
-176 176 - Surface solar radiation anomaly (W m**-2)
-177 177 - Surface thermal radiation anomaly (W m**-2)
-178 178 - Top solar radiation anomaly (W m**-2)
-179 179 - Top thermal radiation anomaly (W m**-2)
+169 169 - Surface solar radiation downwards anomaly (J m**-2)
+175 175 - Surface thermal radiation downwards anomaly (J m**-2)
+176 176 - Surface solar radiation anomaly (J m**-2)
+177 177 - Surface thermal radiation anomaly (J m**-2)
+178 178 - Top solar radiation anomaly (J m**-2)
+179 179 - Top thermal radiation anomaly (J m**-2)
 180 180 - East-West surface stress anomaly (N m**-2)
 181 181 - North-South surface stress anomaly (N m**-2)
 182 182 - Evaporation anomaly (m of water s**-1)
-189 189 - Sunshine duration anomalous rate of accumulation
+189 189 SUNDARA Sunshine duration anomalous rate of accumulation (dimensionless)
 195 195 - Longitudinal component of gravity wave stress anomaly (N m**-2)
 196 196 - Meridional component of gravity wave stress anomaly (N m**-2)
-197 197 - Gravity wave dissipation anomaly (W m**-2)
+197 197 - Gravity wave dissipation anomaly (J m**-2)
 205 205 - Runoff anomaly (m s**-1)
-208 208 - Top net solar radiation, clear sky anomaly (W m**-2)
-209 209 - Top net thermal radiation, clear sky anomaly (W m**-2)
-210 210 - Surface net solar radiation, clear sky anomaly (W m**-2)
-211 211 - Surface net thermal radiation, clear sky anomaly (W m**-2)
+208 208 - Top net solar radiation, clear sky anomaly (J m**-2)
+209 209 - Top net thermal radiation, clear sky anomaly (J m**-2)
+210 210 - Surface net solar radiation, clear sky anomaly (J m**-2)
+211 211 - Surface net thermal radiation, clear sky anomaly (J m**-2)
 212 212 - Solar insolation anomaly (W m**-2 s**-1)
-228 228 - Total precipitation anomalous rate of accumulation (m s**-1)
+228 228 TPARA Total precipitation anomalous rate of accumulation (m s**-1)
 239 239 - Convective snowfall anomaly (m of water equivalent s**-1)
 240 240 - Large scale snowfall anomaly (m of water equivalent s**-1)
 255 255 - Indicates a missing value 
diff --git a/definitions/grib1/grid_definition_5.def b/definitions/grib1/grid_definition_5.def
index 8ec6c28..9271d9e 100644
--- a/definitions/grib1/grid_definition_5.def
+++ b/definitions/grib1/grid_definition_5.def
@@ -81,9 +81,12 @@ iterator polar_stereographic(numberOfPoints,missingValue,values,
           latitudeOfFirstGridPointInDegrees,longitudeOfFirstGridPointInDegrees,
           southPoleOnProjectionPlane,
           orientationOfTheGridInDegrees,
+          LaDInDegrees,
           Dx,Dy,
           iScansNegatively,
           jScansPositively,
           jPointsAreConsecutive,
           alternativeRowScanning);
 
+nearest polar_stereographic(values,radius,Nx,Ny);
+
diff --git a/definitions/grib1/grid_definition_latlon.def b/definitions/grib1/grid_definition_latlon.def
index ce247b7..2c2a280 100644
--- a/definitions/grib1/grid_definition_latlon.def
+++ b/definitions/grib1/grid_definition_latlon.def
@@ -59,7 +59,7 @@ if(missing(Ni)){
 } else {
    iterator latlon(numberOfPoints,missingValue,values,longitudeFirstInDegrees,
                    DiInDegrees ,Ni,Nj,iScansNegatively ,
-                   latitudeFirstInDegrees,DjInDegrees,jScansPositively );
+                   latitudeFirstInDegrees,DjInDegrees,jScansPositively,jPointsAreConsecutive);
    nearest regular(values,radius,Ni,Nj);
 }
 
diff --git a/definitions/grib1/localConcepts/ecmf/cfVarName.def b/definitions/grib1/localConcepts/ecmf/cfVarName.def
index 3ecdd9f..71755a8 100644
--- a/definitions/grib1/localConcepts/ecmf/cfVarName.def
+++ b/definitions/grib1/localConcepts/ecmf/cfVarName.def
@@ -3694,33 +3694,53 @@
 	 table2Version = 171 ;
 	 indicatorOfParameter = 122 ;
 	}
+#Mean surface runoff rate
+'msror' = {
+	 table2Version = 172 ;
+	 indicatorOfParameter = 8 ;
+	}
+#Mean sub-surface runoff rate
+'mssror' = {
+	 table2Version = 172 ;
+	 indicatorOfParameter = 9 ;
+	}
+#Mean surface runoff rate anomaly
+'msrora' = {
+	 table2Version = 173 ;
+	 indicatorOfParameter = 8 ;
+	}
+#Mean sub-surface runoff rate anomaly
+'mssrora' = {
+	 table2Version = 173 ;
+	 indicatorOfParameter = 9 ;
+	}
 #Clear-sky (II) down surface sw flux
-'p174010' = {
+'sswcsdown' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 10 ;
 	}
 #Clear-sky (II) up surface sw flux
-'p174013' = {
+'sswcsup' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 13 ;
 	}
 #Visibility at 1.5m
-'p174025' = {
+'vis15' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 25 ;
 	}
 #Minimum temperature at 1.5m since previous post-processing
-'p174050' = {
+'mn15t' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 50 ;
 	}
 #Maximum temperature at 1.5m since previous post-processing
-'p174051' = {
+'mx15t' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 51 ;
 	}
 #Relative humidity at 1.5m
-'p174052' = {
+'rhum' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 52 ;
 	}
@@ -3735,52 +3755,52 @@
 	 indicatorOfParameter = 97 ;
 	}
 #Short wave radiation flux at surface
-'p174116' = {
+'swrsurf' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 116 ;
 	}
 #Short wave radiation flux at top of atmosphere
-'p174117' = {
+'swrtop' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 117 ;
 	}
 #Total column water vapour
-'p174137' = {
+'tcwvap' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 137 ;
 	}
 #Large scale rainfall rate
-'p174142' = {
+'lsrrate' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 142 ;
 	}
 #Convective rainfall rate
-'p174143' = {
+'crfrate' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 143 ;
 	}
 #Very low cloud amount
-'p174186' = {
+'vlca' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 186 ;
 	}
 #Convective snowfall rate
-'p174239' = {
+'csfrate' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 239 ;
 	}
 #Large scale snowfall rate
-'p174240' = {
+'lsfrate' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 240 ;
 	}
 #Total cloud amount - random overlap
-'p174248' = {
+'tccro' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 248 ;
 	}
 #Total cloud amount in lw radiation
-'p174249' = {
+'tcclwr' = {
 	 table2Version = 174 ;
 	 indicatorOfParameter = 249 ;
 	}
@@ -3870,7 +3890,7 @@
 	 indicatorOfParameter = 74 ;
 	}
 #Wildfire viewing angle of observation
-'p210079' = {
+'vafire' = {
 	 table2Version = 210 ;
 	 indicatorOfParameter = 79 ;
 	}
@@ -3880,7 +3900,7 @@
 	 indicatorOfParameter = 118 ;
 	}
 #Mean altitude of maximum injection
-'ale' = {
+'mami' = {
 	 table2Version = 210 ;
 	 indicatorOfParameter = 119 ;
 	}
@@ -4110,7 +4130,7 @@
 	 indicatorOfParameter = 14 ;
 	}
 #Aerosol type 15 mass mixing ratio
-'p211015' = {
+'aermr15diff' = {
 	 table2Version = 211 ;
 	 indicatorOfParameter = 15 ;
 	}
@@ -11999,7 +12019,7 @@
 	 table2Version = 140 ;
 	 indicatorOfParameter = 220 ;
 	}
-#Mean wave period based on second moment
+#Mean zero-crossing wave period
 'mp2' = {
 	 table2Version = 140 ;
 	 indicatorOfParameter = 221 ;
@@ -12049,7 +12069,7 @@
 	 table2Version = 140 ;
 	 indicatorOfParameter = 230 ;
 	}
-#Peak period of 1D spectra
+#Peak wave period
 'pp1d' = {
 	 table2Version = 140 ;
 	 indicatorOfParameter = 231 ;
diff --git a/definitions/grib1/localConcepts/ecmf/name.def b/definitions/grib1/localConcepts/ecmf/name.def
index 0532c3a..fe6dd1c 100644
--- a/definitions/grib1/localConcepts/ecmf/name.def
+++ b/definitions/grib1/localConcepts/ecmf/name.def
@@ -3694,6 +3694,26 @@
 	 table2Version = 171 ;
 	 indicatorOfParameter = 122 ;
 	}
+#Mean surface runoff rate
+'Mean surface runoff rate' = {
+	 table2Version = 172 ;
+	 indicatorOfParameter = 8 ;
+	}
+#Mean sub-surface runoff rate
+'Mean sub-surface runoff rate' = {
+	 table2Version = 172 ;
+	 indicatorOfParameter = 9 ;
+	}
+#Mean surface runoff rate anomaly
+'Mean surface runoff rate anomaly' = {
+	 table2Version = 173 ;
+	 indicatorOfParameter = 8 ;
+	}
+#Mean sub-surface runoff rate anomaly
+'Mean sub-surface runoff rate anomaly' = {
+	 table2Version = 173 ;
+	 indicatorOfParameter = 9 ;
+	}
 #Clear-sky (II) down surface sw flux
 'Clear-sky (II) down surface sw flux' = {
 	 table2Version = 174 ;
@@ -11999,8 +12019,8 @@
 	 table2Version = 140 ;
 	 indicatorOfParameter = 220 ;
 	}
-#Mean wave period based on second moment
-'Mean wave period based on second moment' = {
+#Mean zero-crossing wave period
+'Mean zero-crossing wave period' = {
 	 table2Version = 140 ;
 	 indicatorOfParameter = 221 ;
 	}
@@ -12049,8 +12069,8 @@
 	 table2Version = 140 ;
 	 indicatorOfParameter = 230 ;
 	}
-#Peak period of 1D spectra
-'Peak period of 1D spectra' = {
+#Peak wave period
+'Peak wave period' = {
 	 table2Version = 140 ;
 	 indicatorOfParameter = 231 ;
 	}
diff --git a/definitions/grib1/localConcepts/ecmf/paramId.def b/definitions/grib1/localConcepts/ecmf/paramId.def
index bae8e7a..b1c0ac1 100644
--- a/definitions/grib1/localConcepts/ecmf/paramId.def
+++ b/definitions/grib1/localConcepts/ecmf/paramId.def
@@ -3694,6 +3694,26 @@
 	 table2Version = 171 ;
 	 indicatorOfParameter = 122 ;
 	}
+#Mean surface runoff rate
+'172008' = {
+	 table2Version = 172 ;
+	 indicatorOfParameter = 8 ;
+	}
+#Mean sub-surface runoff rate
+'172009' = {
+	 table2Version = 172 ;
+	 indicatorOfParameter = 9 ;
+	}
+#Mean surface runoff rate anomaly
+'173008' = {
+	 table2Version = 173 ;
+	 indicatorOfParameter = 8 ;
+	}
+#Mean sub-surface runoff rate anomaly
+'173009' = {
+	 table2Version = 173 ;
+	 indicatorOfParameter = 9 ;
+	}
 #Clear-sky (II) down surface sw flux
 '174010' = {
 	 table2Version = 174 ;
@@ -11999,7 +12019,7 @@
 	 table2Version = 140 ;
 	 indicatorOfParameter = 220 ;
 	}
-#Mean wave period based on second moment
+#Mean zero-crossing wave period
 '140221' = {
 	 table2Version = 140 ;
 	 indicatorOfParameter = 221 ;
@@ -12049,7 +12069,7 @@
 	 table2Version = 140 ;
 	 indicatorOfParameter = 230 ;
 	}
-#Peak period of 1D spectra
+#Peak wave period
 '140231' = {
 	 table2Version = 140 ;
 	 indicatorOfParameter = 231 ;
diff --git a/definitions/grib1/localConcepts/ecmf/shortName.def b/definitions/grib1/localConcepts/ecmf/shortName.def
index b43b8fb..d6f729e 100644
--- a/definitions/grib1/localConcepts/ecmf/shortName.def
+++ b/definitions/grib1/localConcepts/ecmf/shortName.def
@@ -3694,6 +3694,26 @@
 	 table2Version = 171 ;
 	 indicatorOfParameter = 122 ;
 	}
+#Mean surface runoff rate
+'msror' = {
+	 table2Version = 172 ;
+	 indicatorOfParameter = 8 ;
+	}
+#Mean sub-surface runoff rate
+'mssror' = {
+	 table2Version = 172 ;
+	 indicatorOfParameter = 9 ;
+	}
+#Mean surface runoff rate anomaly
+'msrora' = {
+	 table2Version = 173 ;
+	 indicatorOfParameter = 8 ;
+	}
+#Mean sub-surface runoff rate anomaly
+'mssrora' = {
+	 table2Version = 173 ;
+	 indicatorOfParameter = 9 ;
+	}
 #Clear-sky (II) down surface sw flux
 'sswcsdown' = {
 	 table2Version = 174 ;
@@ -11999,7 +12019,7 @@
 	 table2Version = 140 ;
 	 indicatorOfParameter = 220 ;
 	}
-#Mean wave period based on second moment
+#Mean zero-crossing wave period
 'mp2' = {
 	 table2Version = 140 ;
 	 indicatorOfParameter = 221 ;
@@ -12049,7 +12069,7 @@
 	 table2Version = 140 ;
 	 indicatorOfParameter = 230 ;
 	}
-#Peak period of 1D spectra
+#Peak wave period
 'pp1d' = {
 	 table2Version = 140 ;
 	 indicatorOfParameter = 231 ;
diff --git a/definitions/grib1/localConcepts/ecmf/units.def b/definitions/grib1/localConcepts/ecmf/units.def
index c2b1b2c..f9f754c 100644
--- a/definitions/grib1/localConcepts/ecmf/units.def
+++ b/definitions/grib1/localConcepts/ecmf/units.def
@@ -3694,6 +3694,26 @@
 	 table2Version = 171 ;
 	 indicatorOfParameter = 122 ;
 	}
+#Mean surface runoff rate
+'m of water equivalent s**-1' = {
+	 table2Version = 172 ;
+	 indicatorOfParameter = 8 ;
+	}
+#Mean sub-surface runoff rate
+'m of water equivalent s**-1' = {
+	 table2Version = 172 ;
+	 indicatorOfParameter = 9 ;
+	}
+#Mean surface runoff rate anomaly
+'m of water equivalent s**-1' = {
+	 table2Version = 173 ;
+	 indicatorOfParameter = 8 ;
+	}
+#Mean sub-surface runoff rate anomaly
+'m of water equivalent s**-1' = {
+	 table2Version = 173 ;
+	 indicatorOfParameter = 9 ;
+	}
 #Clear-sky (II) down surface sw flux
 'W m**-2' = {
 	 table2Version = 174 ;
@@ -11999,7 +12019,7 @@
 	 table2Version = 140 ;
 	 indicatorOfParameter = 220 ;
 	}
-#Mean wave period based on second moment
+#Mean zero-crossing wave period
 's' = {
 	 table2Version = 140 ;
 	 indicatorOfParameter = 221 ;
@@ -12049,7 +12069,7 @@
 	 table2Version = 140 ;
 	 indicatorOfParameter = 230 ;
 	}
-#Peak period of 1D spectra
+#Peak wave period
 's' = {
 	 table2Version = 140 ;
 	 indicatorOfParameter = 231 ;
diff --git a/definitions/grib1/localConcepts/edzw/name.def b/definitions/grib1/localConcepts/edzw/name.def
index fe1608b..3efbfb1 100755
--- a/definitions/grib1/localConcepts/edzw/name.def
+++ b/definitions/grib1/localConcepts/edzw/name.def
@@ -1,4 +1,4 @@
-# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE, do not edit! 2016-08-11 07:00
+# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE, do not edit! 2017-09-01 10:27
 #paramId: 500000
 #Pressure (S) (not reduced)
 'Pressure (S) (not reduced)' = {
@@ -1661,15 +1661,15 @@
 	}
 
 #paramId: 500225
-#Total soil dust aerosol
-'Total soil dust aerosol' = {
+#Total soil dust aerosol (climatology)
+'Total soil dust aerosol (climatology)' = {
 	 table2Version = 202 ;
 	 indicatorOfParameter = 86 ;
 	}
 
 #paramId: 500226
-#Total soil dust aerosol (12M)
-'Total soil dust aerosol (12M)' = {
+#Total soil dust aerosol (climatology,12M)
+'Total soil dust aerosol (climatology,12M)' = {
 	 table2Version = 202 ;
 	 indicatorOfParameter = 86 ;
 	 timeRangeIndicator = 3 ;
@@ -8989,3 +8989,89 @@
 	 indicatorOfParameter = 34 ;
 	}
 
+#paramId: 503325
+#Lightning Potential Index
+'Lightning Potential Index' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 196 ;
+	}
+
+#paramId: 503341
+#Maximum amplitude (positive or negative) of updraft helicity  (over given time interval)
+'Maximum amplitude (positive or negative) of updraft helicity  (over given time interval)' = {
+	 table2Version = 203 ;
+	 indicatorOfParameter = 35 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503342
+#Maximum rotation amplitude (positive or negative)  (over given time interval and column)
+'Maximum rotation amplitude (positive or negative)  (over given time interval and column)' = {
+	 table2Version = 203 ;
+	 indicatorOfParameter = 36 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503343
+#Maximum updraft track (over given time interval and column)
+'Maximum updraft track (over given time interval and column)' = {
+	 table2Version = 203 ;
+	 indicatorOfParameter = 37 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503344
+#Maximum total-column integrated condensed water above -10 C isotherm (over given time interval)
+'Maximum total-column integrated condensed water above -10 C isotherm (over given time interval)' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 49 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503345
+#Maximum total-column integrated condensed  water (over given time interval)
+'Maximum total-column integrated condensed  water (over given time interval)' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 48 ;
+	 indicatorOfTypeOfLevel = 200 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503346
+#Composite reflectivity - observation
+'Composite reflectivity - observation' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 235 ;
+	}
+
+#paramId: 503347
+#Composite reflectivity - forecast (simulation)
+'Composite reflectivity - forecast (simulation)' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 234 ;
+	}
+
+#paramId: 503348
+#Maximum of Lightning Potential Index (over given time interval)
+'Maximum of Lightning Potential Index (over given time interval)' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 196 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503349
+#Maximum reflectivity track (over given time interval and entire atmosphere)
+'Maximum reflectivity track (over given time interval and entire atmosphere)' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 230 ;
+	 indicatorOfTypeOfLevel = 200 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503350
+#relative vorticity
+'relative vorticity' = {
+	 table2Version = 2 ;
+	 indicatorOfParameter = 43 ;
+	}
+
diff --git a/definitions/grib1/localConcepts/edzw/paramId.def b/definitions/grib1/localConcepts/edzw/paramId.def
index c373f52..19877d1 100755
--- a/definitions/grib1/localConcepts/edzw/paramId.def
+++ b/definitions/grib1/localConcepts/edzw/paramId.def
@@ -1,4 +1,4 @@
-# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE,do not edit! 2016-08-11 07:00
+# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE,do not edit! 2017-09-01 10:27
 #paramId: 500000
 #Pressure (S) (not reduced)
 '500000' = {
@@ -3460,6 +3460,13 @@
 	 indicatorOfParameter = 149 ;
 	}
 
+#paramId: 503350
+#relative vorticity
+'503350' = {
+	 table2Version = 2 ;
+	 indicatorOfParameter = 43 ;
+	}
+
 #paramId: 500090
 #Photosynthetically active radiation (m) (at the surface)
 '500090' = {
@@ -4425,14 +4432,14 @@
 	}
 
 #paramId: 500225
-#Total soil dust aerosol
+#Total soil dust aerosol (climatology)
 '500225' = {
 	 table2Version = 202 ;
 	 indicatorOfParameter = 86 ;
 	}
 
 #paramId: 500226
-#Total soil dust aerosol (12M)
+#Total soil dust aerosol (climatology,12M)
 '500226' = {
 	 table2Version = 202 ;
 	 indicatorOfParameter = 86 ;
@@ -8989,3 +8996,82 @@
 	 indicatorOfParameter = 34 ;
 	}
 
+#paramId: 503325
+#Lightning Potential Index
+'503325' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 196 ;
+	}
+
+#paramId: 503341
+#Maximum amplitude (positive or negative) of updraft helicity  (over given time interval)
+'503341' = {
+	 table2Version = 203 ;
+	 indicatorOfParameter = 35 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503342
+#Maximum rotation amplitude (positive or negative)  (over given time interval and column)
+'503342' = {
+	 table2Version = 203 ;
+	 indicatorOfParameter = 36 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503343
+#Maximum updraft track (over given time interval and column)
+'503343' = {
+	 table2Version = 203 ;
+	 indicatorOfParameter = 37 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503344
+#Maximum total-column integrated condensed water above -10 C isotherm (over given time interval)
+'503344' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 49 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503345
+#Maximum total-column integrated condensed  water (over given time interval)
+'503345' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 48 ;
+	 indicatorOfTypeOfLevel = 200 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503346
+#Composite reflectivity - observation
+'503346' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 235 ;
+	}
+
+#paramId: 503347
+#Composite reflectivity - forecast (simulation)
+'503347' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 234 ;
+	}
+
+#paramId: 503348
+#Maximum of Lightning Potential Index (over given time interval)
+'503348' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 196 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503349
+#Maximum reflectivity track (over given time interval and entire atmosphere)
+'503349' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 230 ;
+	 indicatorOfTypeOfLevel = 200 ;
+	 timeRangeIndicator = 2 ;
+	}
+
diff --git a/definitions/grib1/localConcepts/edzw/shortName.def b/definitions/grib1/localConcepts/edzw/shortName.def
index a5a21b8..2e6de99 100755
--- a/definitions/grib1/localConcepts/edzw/shortName.def
+++ b/definitions/grib1/localConcepts/edzw/shortName.def
@@ -1,4 +1,4 @@
-# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE, do not edit! 2016-08-11 07:00
+# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE, do not edit! 2017-09-01 10:27
 #paramId: 500000
 #Pressure (S) (not reduced)
 'PS' = {
@@ -1051,14 +1051,14 @@
 
 #paramId: 500138
 #rain amount, grid-scale plus convective
-'RR_F' = {
+'TOT_RAIN' = {
 	 table2Version = 201 ;
 	 indicatorOfParameter = 122 ;
 	}
 
 #paramId: 500139
 #snow amount, grid-scale plus convective
-'RR_C' = {
+'TOT_SNOW' = {
 	 table2Version = 201 ;
 	 indicatorOfParameter = 123 ;
 	}
@@ -1661,14 +1661,14 @@
 	}
 
 #paramId: 500225
-#Total soil dust aerosol
+#Total soil dust aerosol (climatology)
 'AER_DUST' = {
 	 table2Version = 202 ;
 	 indicatorOfParameter = 86 ;
 	}
 
 #paramId: 500226
-#Total soil dust aerosol (12M)
+#Total soil dust aerosol (climatology,12M)
 'AER_DUST12' = {
 	 table2Version = 202 ;
 	 indicatorOfParameter = 86 ;
@@ -4198,7 +4198,7 @@
 
 #paramId: 500588
 #Snow melt
-'SNOW' = {
+'SNOW_MELT' = {
 	 table2Version = 1 ;
 	 indicatorOfParameter = 99 ;
 	}
@@ -8989,3 +8989,89 @@
 	 indicatorOfParameter = 34 ;
 	}
 
+#paramId: 503325
+#Lightning Potential Index
+'LPI' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 196 ;
+	}
+
+#paramId: 503341
+#Maximum amplitude (positive or negative) of updraft helicity  (over given time interval)
+'UH_MAX' = {
+	 table2Version = 203 ;
+	 indicatorOfParameter = 35 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503342
+#Maximum rotation amplitude (positive or negative)  (over given time interval and column)
+'VORW_CTMAX' = {
+	 table2Version = 203 ;
+	 indicatorOfParameter = 36 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503343
+#Maximum updraft track (over given time interval and column)
+'W_CTMAX' = {
+	 table2Version = 203 ;
+	 indicatorOfParameter = 37 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503344
+#Maximum total-column integrated condensed water above -10 C isotherm (over given time interval)
+'TCOND10_MX' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 49 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503345
+#Maximum total-column integrated condensed  water (over given time interval)
+'TCOND_MAX' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 48 ;
+	 indicatorOfTypeOfLevel = 200 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503346
+#Composite reflectivity - observation
+'DBZCMP_OBS' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 235 ;
+	}
+
+#paramId: 503347
+#Composite reflectivity - forecast (simulation)
+'DBZCMP_SIM' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 234 ;
+	}
+
+#paramId: 503348
+#Maximum of Lightning Potential Index (over given time interval)
+'LPI_MAX' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 196 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503349
+#Maximum reflectivity track (over given time interval and entire atmosphere)
+'DBZ_CTMAX' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 230 ;
+	 indicatorOfTypeOfLevel = 200 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503350
+#relative vorticity
+'RELV' = {
+	 table2Version = 2 ;
+	 indicatorOfParameter = 43 ;
+	}
+
diff --git a/definitions/grib1/localConcepts/edzw/units.def b/definitions/grib1/localConcepts/edzw/units.def
index c0ab8cb..6f23f30 100755
--- a/definitions/grib1/localConcepts/edzw/units.def
+++ b/definitions/grib1/localConcepts/edzw/units.def
@@ -1,4 +1,4 @@
-# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE, do not edit! 2016-08-11 07:00
+# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE, do not edit! 2017-09-01 10:27
 #paramId: 500000
 #Pressure (S) (not reduced)
 'Pa' = {
@@ -1298,7 +1298,7 @@
 
 #paramId: 500173
 #Base reflectivity
-'dB' = {
+'dBZ' = {
 	 table2Version = 201 ;
 	 indicatorOfParameter = 230 ;
 	 indicatorOfTypeOfLevel = 1 ;
@@ -1306,7 +1306,7 @@
 
 #paramId: 500174
 #Base reflectivity
-'dB' = {
+'dBZ' = {
 	 table2Version = 201 ;
 	 indicatorOfParameter = 230 ;
 	 indicatorOfTypeOfLevel = 110 ;
@@ -1314,7 +1314,7 @@
 
 #paramId: 500175
 #Base reflectivity (cmax)
-'dB' = {
+'dBZ' = {
 	 table2Version = 201 ;
 	 indicatorOfParameter = 230 ;
 	 indicatorOfTypeOfLevel = 200 ;
@@ -1661,14 +1661,14 @@
 	}
 
 #paramId: 500225
-#Total soil dust aerosol
+#Total soil dust aerosol (climatology)
 'Numeric' = {
 	 table2Version = 202 ;
 	 indicatorOfParameter = 86 ;
 	}
 
 #paramId: 500226
-#Total soil dust aerosol (12M)
+#Total soil dust aerosol (climatology,12M)
 'Numeric' = {
 	 table2Version = 202 ;
 	 indicatorOfParameter = 86 ;
@@ -8989,3 +8989,89 @@
 	 indicatorOfParameter = 34 ;
 	}
 
+#paramId: 503325
+#Lightning Potential Index
+'J kg-1' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 196 ;
+	}
+
+#paramId: 503341
+#Maximum amplitude (positive or negative) of updraft helicity  (over given time interval)
+'m2s-2' = {
+	 table2Version = 203 ;
+	 indicatorOfParameter = 35 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503342
+#Maximum rotation amplitude (positive or negative)  (over given time interval and column)
+'s-1' = {
+	 table2Version = 203 ;
+	 indicatorOfParameter = 36 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503343
+#Maximum updraft track (over given time interval and column)
+'m s-1' = {
+	 table2Version = 203 ;
+	 indicatorOfParameter = 37 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503344
+#Maximum total-column integrated condensed water above -10 C isotherm (over given time interval)
+'kg m-2' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 49 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503345
+#Maximum total-column integrated condensed  water (over given time interval)
+'kg m-2' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 48 ;
+	 indicatorOfTypeOfLevel = 200 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503346
+#Composite reflectivity - observation
+'dBZ' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 235 ;
+	}
+
+#paramId: 503347
+#Composite reflectivity - forecast (simulation)
+'dBZ' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 234 ;
+	}
+
+#paramId: 503348
+#Maximum of Lightning Potential Index (over given time interval)
+'J kg-1' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 196 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503349
+#Maximum reflectivity track (over given time interval and entire atmosphere)
+'dBZ' = {
+	 table2Version = 201 ;
+	 indicatorOfParameter = 230 ;
+	 indicatorOfTypeOfLevel = 200 ;
+	 timeRangeIndicator = 2 ;
+	}
+
+#paramId: 503350
+#relative vorticity
+'s-1' = {
+	 table2Version = 2 ;
+	 indicatorOfParameter = 43 ;
+	}
+
diff --git a/definitions/grib2/cfVarName.def b/definitions/grib2/cfVarName.def
index 6a40734..16ffc73 100644
--- a/definitions/grib2/cfVarName.def
+++ b/definitions/grib2/cfVarName.def
@@ -501,6 +501,26 @@
 	 parameterCategory = 0 ;
 	 parameterNumber = 15 ;
 	}
+#Mean discharge in the last 6 hours
+'dis06' = {
+	 discipline = 1 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 7 ;
+	 typeOfStatisticalProcessing = 0 ;
+	 lengthOfTimeRange = 6 ;
+	 indicatorOfUnitForTimeRange = 1 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+#Mean discharge in the last 24 hours
+'dis24' = {
+	 discipline = 1 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 7 ;
+	 indicatorOfUnitForTimeRange = 1 ;
+	 typeOfFirstFixedSurface = 1 ;
+	 typeOfStatisticalProcessing = 0 ;
+	 lengthOfTimeRange = 24 ;
+	}
 #Snow depth at elevation bands
 'sd_elev' = {
 	 discipline = 2 ;
diff --git a/definitions/grib2/diff.out b/definitions/grib2/diff.out
deleted file mode 100644
index c997c34..0000000
--- a/definitions/grib2/diff.out
+++ /dev/null
@@ -1,793 +0,0 @@
-boot.def
-boot_multifield.def
-meta.def
-parameters.def
-11,18c11,18
-< #   od, "0" = {
-< #     productionStatusOfProcessedData = 0;
-< #     marsExpver = "0001";
-< #   }
-< #
-< #   rd, "2" = {
-< #     productionStatusOfProcessedData = 2;
-< #   }
----
-> # 	od, "0" = {
-> # 		productionStatusOfProcessedData = 0;	
-> # 		marsExpver = "0001";
-> # 	}
-> # 
-> # 	rd, "2" = {
-> # 		productionStatusOfProcessedData = 2;	
-> # 	}
-24,25c24,25
-<   constant marsExpver = "prod";
-<   template tigge "grib2/tigge.def";
----
-> 	constant marsExpver = "prod";
-> 	template tigge "grib2/tigge.def";
-33,34c33,34
-<   constant marsExpver = "test";
-<   template tigge "grib2/tigge.def";
----
-> 	constant marsExpver = "test";
-> 	template tigge "grib2/tigge.def";
-48,62c48,62
-<     an, "2" = {
-<       typeOfProcessedData = 0;
-<     }
-< 
-<     fc, "9" = {
-<       typeOfProcessedData = 2;
-<     }
-< 
-<     cf, "10" = {
-<       typeOfProcessedData = 3;
-<     }
-< 
-<     pf, "11" = {
-<       typeOfProcessedData = 4;
-<     }
----
-> 		an, "2" = {
-> 			typeOfProcessedData = 0;
-> 		}
-> 
-> 		fc, "9" = {
-> 			typeOfProcessedData = 2;
-> 		}
-> 
-> 		cf, "10" = {
-> 			typeOfProcessedData = 3;
-> 		}
-> 
-> 		pf, "11" = {
-> 			typeOfProcessedData = 4;
-> 		}
-69,103c69,83
-<     oper = {
-<       typeOfProcessedData = 0;
-<     }
-< 
-<     oper = {
-<       typeOfProcessedData = 2;
-<     }
-< 
-<     wave = {
-<       discipline=10;
-<       typeOfProcessedData = 0;
-<     }
-< 
-<     wave = {
-<       discipline=10;
-<       typeOfProcessedData = 2;
-<     }
-< 
-<     enfo = {
-<       typeOfProcessedData = 3;
-<     }
-< 
-<     enfo = {
-<       typeOfProcessedData = 4;
-<     }
-< 
-<     waef = {
-<       discipline=10;
-<       typeOfProcessedData = 3;
-<     }
-< 
-<     waefs = {
-<       discipline=10;
-<       typeOfProcessedData = 4;
-<     }
----
-> 		oper = {
-> 			typeOfProcessedData = 0;
-> 		}
-> 
-> 		oper = {
-> 			typeOfProcessedData = 2;
-> 		}
-> 
-> 		enfo = {
-> 			typeOfProcessedData = 3;
-> 		}
-> 
-> 		enfo = {
-> 			typeOfProcessedData = 4;
-> 		}
-point_in_time.def
-rules.def
-section.0.def
-section.1.def
-section.2.def
-section.3.def
-24c24
-< alias numberOfOctectsForListOfPoints=numberOfOctetsForOptionalListOfNumbersDefiningNumberOfPoints;
----
-> alias numberOfOctectsForNumberOfPoints=numberOfOctetsForOptionalListOfNumbersDefiningNumberOfPoints;
-30,35d29
-< if( numberOfOctectsForListOfPoints  == 0){
-<   transient PLPresent = 0;
-< }else {
-<   transient PLPresent = 1;
-< }
-< 
-40c34,35
-< # Octets 15-xx:Grid Def Template (see Template 3.N, where N is the Grid Def Template Number)
----
-> # Octets 15-xx : Grid Definition Template (see Template 3.N, where N is the Grid Definition Template Number
-> # ????          grid_definition_template_see_template_3_n_where_n_is_the_grid_definition_template_number
-44c39,43
-< 
----
-> if(numberOfOctectsForNumberOfPoints  == 0){
->   transient PLPresent = 0;
-> }else{
->   transient PLPresent = 1;
-> }
-47c46
-<   if(numberOfOctectsForListOfPoints == 1){
----
->   if(numberOfOctectsForNumberOfPoints == 1){
-50c49
-<   if(numberOfOctectsForListOfPoints == 2){
----
->   if(numberOfOctectsForNumberOfPoints == 2){
-53c52
-<   if(numberOfOctectsForListOfPoints == 3){
----
->   if(numberOfOctectsForNumberOfPoints == 3){
-57,61c56,60
-< 
-< when (PLPresent == 0) {
-<   set numberOfOctectsForListOfPoints = 0;
-<   set sinterpretationOfNumberOfPoints = 0;
-< }
----
->  when (PLPresent == 0)
->      {
->        set numberOfOctectsForNumberOfPoints = 0;
->        set interpretationOfNumberOfPoints = 0;
->      }
-64a64,65
-> 
-> 
-section.4.def
-section.5.def
-section.6.def
-section.7.def
-section.8.def
-sections.def
-template.3.0.def
-template.3.1.def
-template.3.10.def
-template.3.100.def
-template.3.1000.def
-template.3.110.def
-template.3.1100.def
-template.3.120.def
-template.3.1200.def
-template.3.2.def
-template.3.20.def
-template.3.3.def
-template.3.30.def
-template.3.31.def
-template.3.40.def
-template.3.41.def
-template.3.42.def
-template.3.43.def
-template.3.50.def
-template.3.51.def
-template.3.52.def
-template.3.53.def
-template.3.90.def
-template.3.gaussian.def
-17,25c17,25
-<     latitudeOfFirstGridPoint,
-<     longitudeOfFirstGridPoint,
-<     latitudeOfLastGridPoint,
-<     longitudeOfLastGridPoint,
-<     iDirectionIncrement,
-<     null,
-<     basicAngleOfTheInitialProductionDomain,
-<     subdivisionsOfBasicAngle
-<     );
----
-> 		latitudeOfFirstGridPoint,
-> 		longitudeOfFirstGridPoint,
-> 		latitudeOfLastGridPoint,
-> 		longitudeOfLastGridPoint,
-> 		iDirectionIncrement,
-> 		null,
-> 		basicAngleOfTheInitialProductionDomain,
-> 		subdivisionsOfBasicAngle
-> 		);
-31,32c31,32
-< meta      iDirectionIncrementInDegrees         g2latlon(g2grid,4,
-<     iDirectionIncrementGiven) : can_be_missing;
----
-> meta      iDirectionIncrementInDegrees         g2latlon(g2grid,4, 
-> 		iDirectionIncrementGiven) : can_be_missing;
-34,47d33
-< alias geography.laFirst = latitudeOfFirstGridPointInDegrees;
-< alias geography.loFirst = longitudeOfFirstGridPointInDegrees;
-< alias geography.laLast = latitudeOfLastGridPointInDegrees;
-< alias geography.loLast = longitudeOfLastGridPointInDegrees;
-< alias geography.iInc = iDirectionIncrementInDegrees;
-< alias geography.Nj = numberOfPointsAlongAMeridian;
-< alias geography.Ni = numberOfPointsAlongAParallel;
-< 
-< if(missing(numberOfPointsAlongAParallel) && PLPresent == 1){
-<     iterator gaussian_reduced(values,laFirst,loFirst,laLast,loLast,
-<       numberOfParallelsBetweenAPoleAndTheEquator,iInc,pl,Nj);
-< } else {
-<     iterator gaussian(values,loFirst,iInc  ,Ni   ,Nj, laFirst, laLast, trunc);
-< }
-template.3.grid.def
-template.3.latlon.def
-16,24c16,24
-<   latitudeOfFirstGridPoint,
-<   longitudeOfFirstGridPoint,
-<   latitudeOfLastGridPoint,
-<   longitudeOfLastGridPoint,
-<   iDirectionIncrement,
-<   jDirectionIncrement,
-<   basicAngleOfTheInitialProductionDomain,
-<   subdivisionsOfBasicAngle
-<   );
----
-> 	latitudeOfFirstGridPoint,
-> 	longitudeOfFirstGridPoint,
-> 	latitudeOfLastGridPoint,
-> 	longitudeOfLastGridPoint,
-> 	iDirectionIncrement,
-> 	jDirectionIncrement,
-> 	basicAngleOfTheInitialProductionDomain,
-> 	subdivisionsOfBasicAngle
-> 	);
-31,32c31,32
-< meta iDirectionIncrementInDegrees    g2latlon(g2grid,4,
-<   iDirectionIncrementGiven) : can_be_missing;
----
-> meta iDirectionIncrementInDegrees    g2latlon(g2grid,4, 
-> 	iDirectionIncrementGiven) : can_be_missing;
-35c35
-<   jDirectionIncrementGiven) : can_be_missing;
----
-> 	jDirectionIncrementGiven) : can_be_missing;
-37,51d36
-< alias geography.laFirst = latitudeOfFirstGridPointInDegrees;
-< alias geography.loFirst = longitudeOfFirstGridPointInDegrees;
-< alias geography.laLast = latitudeOfLastGridPointInDegrees;
-< alias geography.loLast = longitudeOfLastGridPointInDegrees;
-< alias geography.iInc = iDirectionIncrementInDegrees;
-< alias geography.jInc = jDirectionIncrementInDegrees;
-< alias geography.gridWestEast = iDirectionIncrementInDegrees;
-< alias geography.gridNorthSouth = jDirectionIncrementInDegrees;
-< 
-< if ( missing(numberOfPointsAlongAParallel) && PLPresent == 1 ) {
-<   iterator latlon_reduced(values,laFirst,loFirst,laLast,loLast,
-<       Nj,jInc,pl);
-< } else {
-<   iterator latlon(values,loFirst,iInc  ,Ni   ,Nj, laFirst, jInc);
-< }
-template.3.resolution_flags.def
-template.3.rotation.def
-template.3.scanning_mode.def
-template.3.shape_of_the_earth.def
-template.3.spherical_harmonics.def
-template.3.stretching.def
-template.4.0.def
-template.4.1.def
-template.4.10.def
-template.4.1000.def
-template.4.1001.def
-template.4.1002.def
-template.4.11.def
-template.4.1100.def
-template.4.1101.def
-template.4.12.def
-template.4.13.def
-template.4.14.def
-template.4.2.def
-template.4.20.def
-template.4.254.def
-template.4.3.def
-template.4.30.def
-template.4.4.def
-template.4.5.def
-template.4.6.def
-template.4.7.def
-template.4.8.def
-template.4.9.def
-template.4.circular_cluster.def
-template.4.derived.def
-template.4.eps.def
-template.4.horizontal.def
-template.4.parameter.def
-template.4.percentile.def
-template.4.point_in_time.def
-template.4.probability.def
-template.4.rectangular_cluster.def
-template.4.statistical.def
-template.5.0.def
-template.5.1.def
-template.5.2.def
-template.5.3.def
-template.5.4.def
-template.5.40.def
-template.5.40000.def
-template.5.40010.def
-template.5.41.def
-template.5.42.def
-template.5.50.def
-template.5.51.def
-template.5.6.def
-template.5.61.def
-template.5.original_values.def
-template.5.packing.def
-template.7.0.def
-template.7.1.def
-template.7.2.def
-template.7.3.def
-template.7.4.def
-template.7.40.def
-template.7.40000.def
-template.7.40010.def
-template.7.41.def
-template.7.50.def
-template.7.51.def
-template.7.6.def
-template.7.61.def
-tigge.def
-0a1
-> # Automatically generated by .//tigge_def.pl, do not edit
-7c8
-< concept parameter "grib2/tigge_parameter.def";
----
-> concept parameter {
-9,10c10,200
-< concept tigge_short_name "grib2/tigge_short_name.def";
-< alias ls.short_name=tigge_short_name;
----
-> # 10_meter_u_velocity 
->    '165' = {
->          discipline = 0;
->          parameterCategory = 2;
->          parameterNumber = 2;
->          scaleFactorOfFirstFixedSurface = 0;
->          scaledValueOfFirstFixedSurface = 10;
->          typeOfFirstFixedSurface = 103;
->    }
-> 
-> # 10_meter_v_velocity 
->    '166' = {
->          discipline = 0;
->          parameterCategory = 2;
->          parameterNumber = 3;
->          scaleFactorOfFirstFixedSurface = 0;
->          scaledValueOfFirstFixedSurface = 10;
->          typeOfFirstFixedSurface = 103;
->    }
-> 
-> # convective_available_potential_energy 
->    '59' = {
->          discipline = 0;
->          parameterCategory = 7;
->          parameterNumber = 6;
->          typeOfFirstFixedSurface = 1;
->          typeOfSecondFixedSurface = 8;
->    }
-> 
-> # convective_inhibition 
->    '228001' = {
->          discipline = 0;
->          parameterCategory = 7;
->          parameterNumber = 7;
->          typeOfFirstFixedSurface = 1;
->          typeOfSecondFixedSurface = 8;
->    }
-> 
-> # field_capacity 
->    '228170' = {
->          discipline = 2;
->          parameterCategory = 3;
->          parameterNumber = 7;
->          scaleFactorOfFirstFixedSurface = 0;
->          scaleFactorOfSecondFixedSurface = 1;
->          scaledValueOfFirstFixedSurface = 0;
->          scaledValueOfSecondFixedSurface = 2;
->          typeOfFirstFixedSurface = 106;
->          typeOfSecondFixedSurface = 106;
->    }
-> 
-> # geopotential_height 
->    '156' = {
->          discipline = 0;
->          parameterCategory = 3;
->          parameterNumber = 5;
->          typeOfFirstFixedSurface = 100;
->    }
-> 
-> # land_sea_mask 
->    '172' = {
->          discipline = 2;
->          parameterCategory = 0;
->          parameterNumber = 0;
->          typeOfFirstFixedSurface = 1;
->    }
-> 
-> # mean_sea_level_pressure 
->    '151' = {
->          discipline = 0;
->          parameterCategory = 3;
->          parameterNumber = 0;
->          typeOfFirstFixedSurface = 101;
->    }
-> 
-> # orography 
->    '228002' = {
->          discipline = 0;
->          parameterCategory = 3;
->          parameterNumber = 5;
->          typeOfFirstFixedSurface = 1;
->    }
-> 
-> # potential_temperature 
->    '3' = {
->          discipline = 0;
->          parameterCategory = 0;
->          parameterNumber = 2;
->          scaleFactorOfFirstFixedSurface = 6;
->          scaledValueOfFirstFixedSurface = 2;
->          typeOfFirstFixedSurface = 109;
->    }
-> 
-> # potential_vorticity 
->    '60' = {
->          discipline = 0;
->          parameterCategory = 2;
->          parameterNumber = 14;
->          scaleFactorOfFirstFixedSurface = 0;
->          scaledValueOfFirstFixedSurface = 320;
->          typeOfFirstFixedSurface = 107;
->    }
-> 
-> # saturation_of_soil_moisture 
->    '228172' = {
->          discipline = 2;
->          parameterCategory = 3;
->          parameterNumber = 10;
->          scaleFactorOfFirstFixedSurface = 0;
->          scaleFactorOfSecondFixedSurface = 1;
->          scaledValueOfFirstFixedSurface = 0;
->          scaledValueOfSecondFixedSurface = 2;
->          typeOfFirstFixedSurface = 106;
->          typeOfSecondFixedSurface = 106;
->    }
-> 
-> # skin_temperature 
->    '235' = {
->          discipline = 0;
->          parameterCategory = 0;
->          parameterNumber = 17;
->          typeOfFirstFixedSurface = 1;
->    }
-> 
-> # snow_depth_water_equivalent 
->    '228141' = {
->          discipline = 0;
->          parameterCategory = 1;
->          parameterNumber = 60;
->          typeOfFirstFixedSurface = 1;
->    }
-> 
-> # snow_fall_water_equivalent 
->    '228144' = {
->          discipline = 0;
->          parameterCategory = 1;
->          parameterNumber = 53;
->          typeOfFirstFixedSurface = 1;
->          typeOfStatisticalProcessing = 1;
->    }
-> 
-> # soil_moisture 
->    '228039' = {
->          discipline = 2;
->          parameterCategory = 0;
->          parameterNumber = 22;
->          scaleFactorOfFirstFixedSurface = 0;
->          scaleFactorOfSecondFixedSurface = 1;
->          scaledValueOfFirstFixedSurface = 0;
->          scaledValueOfSecondFixedSurface = 2;
->          typeOfFirstFixedSurface = 106;
->          typeOfSecondFixedSurface = 106;
->    }
-> 
-> # soil_temperature 
->    '228139' = {
->          discipline = 2;
->          parameterCategory = 0;
->          parameterNumber = 2;
->          scaleFactorOfFirstFixedSurface = 0;
->          scaleFactorOfSecondFixedSurface = 1;
->          scaledValueOfFirstFixedSurface = 0;
->          scaledValueOfSecondFixedSurface = 2;
->          typeOfFirstFixedSurface = 106;
->          typeOfSecondFixedSurface = 106;
->    }
-> 
-> # specific_humidity 
->    '133' = {
->          discipline = 0;
->          parameterCategory = 1;
->          parameterNumber = 0;
->          typeOfFirstFixedSurface = 100;
->    }
-> 
-> # sunshine_duration 
->    '189' = {
->          discipline = 0;
->          parameterCategory = 6;
->          parameterNumber = 24;
->          typeOfFirstFixedSurface = 1;
->          typeOfStatisticalProcessing = 1;
->    }
-> 
-> # surface_air_dew_point_temperature 
->    '168' = {
->          discipline = 0;
->          parameterCategory = 0;
->          parameterNumber = 6;
->          typeOfFirstFixedSurface = 103;
->    }
-12,13c202,384
-< concept tigge_name "grib2/tigge_name.def";
-< alias name=tigge_name;
----
-> # surface_air_maximum_temperature 
->    '121' = {
->          discipline = 0;
->          parameterCategory = 0;
->          parameterNumber = 0;
->          typeOfFirstFixedSurface = 103;
->          typeOfStatisticalProcessing = 2;
->    }
-> 
-> # surface_air_minimum_temperature 
->    '122' = {
->          discipline = 0;
->          parameterCategory = 0;
->          parameterNumber = 0;
->          typeOfFirstFixedSurface = 103;
->          typeOfStatisticalProcessing = 3;
->    }
-> 
-> # surface_air_temperature 
->    '167' = {
->          discipline = 0;
->          parameterCategory = 0;
->          parameterNumber = 0;
->          typeOfFirstFixedSurface = 103;
->    }
-> 
-> # surface_pressure 
->    '134' = {
->          discipline = 0;
->          parameterCategory = 3;
->          parameterNumber = 0;
->          typeOfFirstFixedSurface = 1;
->    }
-> 
-> # temperature 
->    '130' = {
->          discipline = 0;
->          parameterCategory = 0;
->          parameterNumber = 0;
->          typeOfFirstFixedSurface = 100;
->    }
-> 
-> # time_integrated_outgoing_long_wave_radiation 
->    '179' = {
->          discipline = 0;
->          parameterCategory = 5;
->          parameterNumber = 5;
->          typeOfFirstFixedSurface = 8;
->          typeOfStatisticalProcessing = 1;
->    }
-> 
-> # time_integrated_surface_latent_heat_flux 
->    '147' = {
->          discipline = 0;
->          parameterCategory = 0;
->          parameterNumber = 10;
->          typeOfFirstFixedSurface = 1;
->          typeOfStatisticalProcessing = 1;
->    }
-> 
-> # time_integrated_surface_net_solar_radiation 
->    '176' = {
->          discipline = 0;
->          parameterCategory = 4;
->          parameterNumber = 9;
->          typeOfFirstFixedSurface = 1;
->          typeOfStatisticalProcessing = 1;
->    }
-> 
-> # time_integrated_surface_net_thermal_radiation 
->    '177' = {
->          discipline = 0;
->          parameterCategory = 5;
->          parameterNumber = 5;
->          typeOfFirstFixedSurface = 1;
->          typeOfStatisticalProcessing = 1;
->    }
-> 
-> # time_integrated_surface_sensible_heat_flux 
->    '146' = {
->          discipline = 0;
->          parameterCategory = 0;
->          parameterNumber = 11;
->          typeOfFirstFixedSurface = 1;
->          typeOfStatisticalProcessing = 1;
->    }
-> 
-> # total_cloud_cover 
->    '228164' = {
->          discipline = 0;
->          parameterCategory = 6;
->          parameterNumber = 1;
->          typeOfFirstFixedSurface = 1;
->          typeOfSecondFixedSurface = 8;
->    }
-> 
-> # total_column_water 
->    '136' = {
->          discipline = 0;
->          parameterCategory = 1;
->          parameterNumber = 51;
->          typeOfFirstFixedSurface = 1;
->          typeOfSecondFixedSurface = 8;
->    }
-> 
-> # total_precipitation 
->    '228228' = {
->          discipline = 0;
->          parameterCategory = 1;
->          parameterNumber = 52;
->          typeOfFirstFixedSurface = 1;
->          typeOfStatisticalProcessing = 1;
->    }
-> 
-> # u_velocity 
->    '131' = {
->          discipline = 0;
->          parameterCategory = 2;
->          parameterNumber = 2;
->    }
-> 
-> # v_velocity 
->    '132' = {
->          discipline = 0;
->          parameterCategory = 2;
->          parameterNumber = 3;
->    }
-> 
-> # wilting_point 
->    '228171' = {
->          discipline = 2;
->          parameterCategory = 0;
->          parameterNumber = 17;
->          scaleFactorOfFirstFixedSurface = 0;
->          scaleFactorOfSecondFixedSurface = 1;
->          scaledValueOfFirstFixedSurface = 0;
->          scaledValueOfSecondFixedSurface = 2;
->          typeOfFirstFixedSurface = 106;
->          typeOfSecondFixedSurface = 106;
->    }
-> 
-> }
-> 
-> concept tigge_short_name {
->    '10v' = { parameter = 166; }
->    '10u' = { parameter = 165; }
->    'pv' = { parameter = 60; }
->    '2d' = { parameter = 168; }
->    'ci' = { parameter = 228001; }
->    'cape' = { parameter = 59; }
->    'cap' = { parameter = 228170; }
->    'gh' = { parameter = 156; }
->    'lsm' = { parameter = 172; }
->    'msl' = { parameter = 151; }
->    'pt' = { parameter = 3; }
->    'sat' = { parameter = 228172; }
->    'sf' = { parameter = 228144; }
->    'sd' = { parameter = 228141; }
->    '2t' = { parameter = 167; }
->    'slhf' = { parameter = 147; }
->    'q' = { parameter = 133; }
->    'st' = { parameter = 228139; }
->    'mn2t6' = { parameter = 122; }
->    'orog' = { parameter = 228002; }
->    'skt' = { parameter = 235; }
->    'sm' = { parameter = 228039; }
->    'str' = { parameter = 177; }
->    'sp' = { parameter = 134; }
->    'sund' = { parameter = 189; }
->    'mx2t6' = { parameter = 121; }
->    'tcw' = { parameter = 136; }
->    'tcc' = { parameter = 228164; }
->    't' = { parameter = 130; }
->    'sshf' = { parameter = 146; }
->    'ssr' = { parameter = 176; }
->    'ttr' = { parameter = 179; }
->    'tp' = { parameter = 228228; }
->    'u' = { parameter = 131; }
->    'v' = { parameter = 132; }
->    'wilt' = { parameter = 228171; }
-> }
-> 
-> alias ls.short_name=tigge_short_name;
-14a386,423
-> concept tigge_name {
->    '10_meter_u_velocity' = { parameter = 165; }
->    '10_meter_v_velocity' = { parameter = 166; }
->    'convective_available_potential_energy' = { parameter = 59; }
->    'convective_inhibition' = { parameter = 228001; }
->    'field_capacity' = { parameter = 228170; }
->    'geopotential_height' = { parameter = 156; }
->    'land_sea_mask' = { parameter = 172; }
->    'mean_sea_level_pressure' = { parameter = 151; }
->    'orography' = { parameter = 228002; }
->    'potential_temperature' = { parameter = 3; }
->    'potential_vorticity' = { parameter = 60; }
->    'saturation_of_soil_moisture' = { parameter = 228172; }
->    'skin_temperature' = { parameter = 235; }
->    'snow_depth_water_equivalent' = { parameter = 228141; }
->    'snow_fall_water_equivalent' = { parameter = 228144; }
->    'soil_moisture' = { parameter = 228039; }
->    'soil_temperature' = { parameter = 228139; }
->    'specific_humidity' = { parameter = 133; }
->    'sunshine_duration' = { parameter = 189; }
->    'surface_air_dew_point_temperature' = { parameter = 168; }
->    'surface_air_maximum_temperature' = { parameter = 121; }
->    'surface_air_minimum_temperature' = { parameter = 122; }
->    'surface_air_temperature' = { parameter = 167; }
->    'surface_pressure' = { parameter = 134; }
->    'temperature' = { parameter = 130; }
->    'time_integrated_outgoing_long_wave_radiation' = { parameter = 179; }
->    'time_integrated_surface_latent_heat_flux' = { parameter = 147; }
->    'time_integrated_surface_net_solar_radiation' = { parameter = 176; }
->    'time_integrated_surface_net_thermal_radiation' = { parameter = 177; }
->    'time_integrated_surface_sensible_heat_flux' = { parameter = 146; }
->    'total_cloud_cover' = { parameter = 228164; }
->    'total_column_water' = { parameter = 136; }
->    'total_precipitation' = { parameter = 228228; }
->    'u_velocity' = { parameter = 131; }
->    'v_velocity' = { parameter = 132; }
->    'wilting_point' = { parameter = 228171; }
-> }
-tigge_name.def
-tigge_parameter.def
-tigge_short_name.def
diff --git a/definitions/grib2/localConcepts/ecmf/cfVarName.def b/definitions/grib2/localConcepts/ecmf/cfVarName.def
index 3d59929..751d0be 100644
--- a/definitions/grib2/localConcepts/ecmf/cfVarName.def
+++ b/definitions/grib2/localConcepts/ecmf/cfVarName.def
@@ -12009,7 +12009,13 @@
 	 parameterCategory = 140 ;
 	 parameterNumber = 220 ;
 	}
-#Mean wave period based on second moment
+#Mean zero-crossing wave period
+'mp2' = {
+	 discipline = 10 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 28 ;
+	}
+#Mean zero-crossing wave period
 'mp2' = {
 	 discipline = 192 ;
 	 parameterCategory = 140 ;
@@ -12057,7 +12063,13 @@
 	 parameterCategory = 140 ;
 	 parameterNumber = 228 ;
 	}
-#Peak period of 1D spectra
+#Peak wave period
+'pp1d' = {
+	 discipline = 10 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 34 ;
+	}
+#Peak wave period
 'pp1d' = {
 	 discipline = 192 ;
 	 parameterCategory = 140 ;
diff --git a/definitions/grib2/localConcepts/ecmf/name.def b/definitions/grib2/localConcepts/ecmf/name.def
index d58f3b8..34efcbe 100644
--- a/definitions/grib2/localConcepts/ecmf/name.def
+++ b/definitions/grib2/localConcepts/ecmf/name.def
@@ -12009,8 +12009,14 @@
 	 parameterCategory = 140 ;
 	 parameterNumber = 220 ;
 	}
-#Mean wave period based on second moment
-'Mean wave period based on second moment' = {
+#Mean zero-crossing wave period
+'Mean zero-crossing wave period' = {
+	 discipline = 10 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 28 ;
+	}
+#Mean zero-crossing wave period
+'Mean zero-crossing wave period' = {
 	 discipline = 192 ;
 	 parameterCategory = 140 ;
 	 parameterNumber = 221 ;
@@ -12057,8 +12063,14 @@
 	 parameterCategory = 140 ;
 	 parameterNumber = 228 ;
 	}
-#Peak period of 1D spectra
-'Peak period of 1D spectra' = {
+#Peak wave period
+'Peak wave period' = {
+	 discipline = 10 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 34 ;
+	}
+#Peak wave period
+'Peak wave period' = {
 	 discipline = 192 ;
 	 parameterCategory = 140 ;
 	 parameterNumber = 231 ;
diff --git a/definitions/grib2/localConcepts/ecmf/paramId.def b/definitions/grib2/localConcepts/ecmf/paramId.def
index 28b51b2..8d55489 100644
--- a/definitions/grib2/localConcepts/ecmf/paramId.def
+++ b/definitions/grib2/localConcepts/ecmf/paramId.def
@@ -12009,7 +12009,13 @@
 	 parameterCategory = 140 ;
 	 parameterNumber = 220 ;
 	}
-#Mean wave period based on second moment
+#Mean zero-crossing wave period
+'140221' = {
+	 discipline = 10 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 28 ;
+	}
+#Mean zero-crossing wave period
 '140221' = {
 	 discipline = 192 ;
 	 parameterCategory = 140 ;
@@ -12057,7 +12063,13 @@
 	 parameterCategory = 140 ;
 	 parameterNumber = 228 ;
 	}
-#Peak period of 1D spectra
+#Peak wave period
+'140231' = {
+	 discipline = 10 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 34 ;
+	}
+#Peak wave period
 '140231' = {
 	 discipline = 192 ;
 	 parameterCategory = 140 ;
diff --git a/definitions/grib2/localConcepts/ecmf/shortName.def b/definitions/grib2/localConcepts/ecmf/shortName.def
index 1c2b9ec..69663f6 100644
--- a/definitions/grib2/localConcepts/ecmf/shortName.def
+++ b/definitions/grib2/localConcepts/ecmf/shortName.def
@@ -12009,7 +12009,13 @@
 	 parameterCategory = 140 ;
 	 parameterNumber = 220 ;
 	}
-#Mean wave period based on second moment
+#Mean zero-crossing wave period
+'mp2' = {
+	 discipline = 10 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 28 ;
+	}
+#Mean zero-crossing wave period
 'mp2' = {
 	 discipline = 192 ;
 	 parameterCategory = 140 ;
@@ -12057,7 +12063,13 @@
 	 parameterCategory = 140 ;
 	 parameterNumber = 228 ;
 	}
-#Peak period of 1D spectra
+#Peak wave period
+'pp1d' = {
+	 discipline = 10 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 34 ;
+	}
+#Peak wave period
 'pp1d' = {
 	 discipline = 192 ;
 	 parameterCategory = 140 ;
diff --git a/definitions/grib2/localConcepts/ecmf/units.def b/definitions/grib2/localConcepts/ecmf/units.def
index 341b0f1..b34737b 100644
--- a/definitions/grib2/localConcepts/ecmf/units.def
+++ b/definitions/grib2/localConcepts/ecmf/units.def
@@ -12009,7 +12009,13 @@
 	 parameterCategory = 140 ;
 	 parameterNumber = 220 ;
 	}
-#Mean wave period based on second moment
+#Mean zero-crossing wave period
+'s' = {
+	 discipline = 10 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 28 ;
+	}
+#Mean zero-crossing wave period
 's' = {
 	 discipline = 192 ;
 	 parameterCategory = 140 ;
@@ -12057,7 +12063,13 @@
 	 parameterCategory = 140 ;
 	 parameterNumber = 228 ;
 	}
-#Peak period of 1D spectra
+#Peak wave period
+'s' = {
+	 discipline = 10 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 34 ;
+	}
+#Peak wave period
 's' = {
 	 discipline = 192 ;
 	 parameterCategory = 140 ;
diff --git a/definitions/grib2/localConcepts/edzw/name.def b/definitions/grib2/localConcepts/edzw/name.def
index 49723fd..2785814 100755
--- a/definitions/grib2/localConcepts/edzw/name.def
+++ b/definitions/grib2/localConcepts/edzw/name.def
@@ -1,4 +1,4 @@
-# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE, do not edit! 2016-08-11 07:00
+# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE, do not edit! 2017-09-01 10:27
 #paramId: 500000
 #Pressure (S) (not reduced)
 'Pressure (S) (not reduced)' = {
@@ -1444,8 +1444,8 @@
 	}
 
 #paramId: 500225
-#Total soil dust aerosol
-'Total soil dust aerosol' = {
+#Total soil dust aerosol (climatology)
+'Total soil dust aerosol (climatology)' = {
 	 discipline = 0 ;
 	 parameterCategory = 20 ;
 	 parameterNumber = 102 ;
@@ -1453,8 +1453,8 @@
 	}
 
 #paramId: 500226
-#Total soil dust aerosol (12M)
-'Total soil dust aerosol (12M)' = {
+#Total soil dust aerosol (climatology,12M)
+'Total soil dust aerosol (climatology,12M)' = {
 	 discipline = 0 ;
 	 parameterCategory = 20 ;
 	 parameterNumber = 102 ;
@@ -6572,8 +6572,8 @@
 	}
 
 #paramId: 503274
-#Diagnostic maximum total mass concentration of volcanic ash in layer SFC-FL200
-'Diagnostic maximum total mass concentration of volcanic ash in layer SFC-FL200' = {
+#Diagnostic maximum total mass concentration of volcanic ash in layer SFC-FL100
+'Diagnostic maximum total mass concentration of volcanic ash in layer SFC-FL100' = {
 	 discipline = 0 ;
 	 parameterCategory = 20 ;
 	 parameterNumber = 61 ;
@@ -6663,6 +6663,483 @@
 	 parameterNumber = 102 ;
 	}
 
+#paramId: 503293
+#Large Scale Rain Difference
+'Large Scale Rain Difference' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 77 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503294
+#Large Scale Snowfall water Equivalent Difference
+'Large Scale Snowfall water Equivalent Difference' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 56 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503295
+#Convective Rain Difference
+'Convective Rain Difference' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 76 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503296
+#Convective Snowfall Water Equivalent Difference
+'Convective Snowfall Water Equivalent Difference' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 55 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503303
+#Total precipitation rate
+'Total precipitation rate' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 52 ;
+	}
+
+#paramId: 503304
+#Horizontal moisture convergence
+'Horizontal moisture convergence' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 26 ;
+	}
+
+#paramId: 503305
+#TOA downward solar radiation
+'TOA downward solar radiation' = {
+	 discipline = 0 ;
+	 parameterCategory = 4 ;
+	 parameterNumber = 7 ;
+	 typeOfFirstFixedSurface = 8 ;
+	}
+
+#paramId: 503306
+#Surface upward thermal radiation
+'Surface upward thermal radiation' = {
+	 discipline = 0 ;
+	 parameterCategory = 5 ;
+	 parameterNumber = 4 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503307
+#Surface upward thermal radiation
+'Surface upward thermal radiation' = {
+	 discipline = 0 ;
+	 parameterCategory = 5 ;
+	 parameterNumber = 4 ;
+	 typeOfStatisticalProcessing = 0 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503308
+#Specific mass of liquid water coating on hail
+'Specific mass of liquid water coating on hail' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 110 ;
+	}
+
+#paramId: 503309
+#Specific mass of liquid water coating on graupel
+'Specific mass of liquid water coating on graupel' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 113 ;
+	}
+
+#paramId: 503310
+#Specific mass of liquid water coating on snow
+'Specific mass of liquid water coating on snow' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 116 ;
+	}
+
+#paramId: 503311
+#Specific number concentration of rain
+'Specific number concentration of rain' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 100 ;
+	}
+
+#paramId: 503312
+#Number density of rain
+'Number density of rain' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 104 ;
+	}
+
+#paramId: 503313
+#Specific number concentration of snow
+'Specific number concentration of snow' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 101 ;
+	}
+
+#paramId: 503314
+#Specific number concentration of graupel
+'Specific number concentration of graupel' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 102 ;
+	}
+
+#paramId: 503315
+#Specific number concentration of hail
+'Specific number concentration of hail' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 103 ;
+	}
+
+#paramId: 503316
+#Number density of snow
+'Number density of snow' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 105 ;
+	}
+
+#paramId: 503317
+#Number density of graupel
+'Number density of graupel' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 106 ;
+	}
+
+#paramId: 503318
+#Number density of hail
+'Number density of hail' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 107 ;
+	}
+
+#paramId: 503319
+#Mass density of rain
+'Mass density of rain ' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 96 ;
+	}
+
+#paramId: 503320
+#Mass density of snow
+'Mass density of snow ' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 97 ;
+	}
+
+#paramId: 503321
+#Mass density of graupel
+'Mass density of graupel' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 98 ;
+	}
+
+#paramId: 503322
+#Mass density of cloud droplets
+'Mass density of cloud droplets' = {
+	 discipline = 0 ;
+	 parameterCategory = 6 ;
+	 parameterNumber = 38 ;
+	}
+
+#paramId: 503323
+#Mass density of cloud ice
+'Mass density of cloud ice' = {
+	 discipline = 0 ;
+	 parameterCategory = 6 ;
+	 parameterNumber = 39 ;
+	}
+
+#paramId: 503324
+#Mass density of hail
+'Mass density of hail' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 99 ;
+	}
+
+#paramId: 503326
+#Diagnostic total column of activity concentration of radionuclides
+'Diagnostic total column of activity concentration of radionuclides' = {
+	 discipline = 0 ;
+	 parameterCategory = 18 ;
+	 parameterNumber = 17 ;
+	 typeOfFirstFixedSurface = 10 ;
+	}
+
+#paramId: 503327
+#Base for given threshold of mass density for volcanic ash cloud
+'Base for given threshold of mass density for volcanic ash cloud' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 21 ;
+	 constituentType = 62025 ;
+	}
+
+#paramId: 503328
+#Base for given threshold of mass density for mineral dust cloud
+'Base for given threshold of mass density for mineral dust cloud' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 21 ;
+	 constituentType = 62001 ;
+	}
+
+#paramId: 503330
+#Top for given threshold of mass density for volcanic ash cloud
+'Top for given threshold of mass density for volcanic ash cloud' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 22 ;
+	 constituentType = 62025 ;
+	}
+
+#paramId: 503331
+#Top for given threshold of mass density for mineral dust cloud
+'Top for given threshold of mass density for mineral dust cloud' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 22 ;
+	 constituentType = 62001 ;
+	}
+
+#paramId: 503332
+#Top for given threshold of air concentration of radionuclides
+'Top for given threshold of air concentration of radionuclides' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 24 ;
+	}
+
+#paramId: 503333
+#Emission rate of dust for mode 2
+'Emission rate of dust for mode 2' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 constituentType = 62001 ;
+	 modeNumber = 2 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503334
+#Emission rate of dust for mode 3
+'Emission rate of dust for mode 3' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 constituentType = 62001 ;
+	 modeNumber = 3 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503335
+#Emission rate of dust for mode 1
+'Emission rate of dust for mode 1' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 constituentType = 62001 ;
+	 modeNumber = 1 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503336
+#Accumulated dust Emission for mode 2
+'Accumulated dust Emission for mode 2' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 typeOfStatisticalProcessing = 1 ;
+	 constituentType = 62001 ;
+	 modeNumber = 2 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503337
+#Accumulated dust Emission for mode 1
+'Accumulated dust Emission for mode 1' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 typeOfStatisticalProcessing = 1 ;
+	 constituentType = 62001 ;
+	 modeNumber = 1 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503338
+#Accumulated dust Emission for mode 3
+'Accumulated dust Emission for mode 3' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 typeOfStatisticalProcessing = 1 ;
+	 constituentType = 62001 ;
+	 modeNumber = 3 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503340
+#Base for given threshold of air concentration of radionuclides
+'Base for given threshold of air concentration of radionuclides' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 23 ;
+	}
+
+#paramId: 503341
+#Maximum amplitude (positive or negative) of updraft helicity  (over given time interval)
+'Maximum amplitude (positive or negative) of updraft helicity  (over given time interval)' = {
+	 discipline = 0 ;
+	 parameterCategory = 7 ;
+	 parameterNumber = 15 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503344
+#Maximum total-column integrated condensed water above -10 C isotherm (over given time interval)
+'Maximum total-column integrated condensed water above -10 C isotherm (over given time interval)' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 81 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfSecondFixedSurface = 8 ;
+	 typeOfFirstFixedSurface = 20 ;
+	 scaleFactorOfFirstFixedSurface = 2 ;
+	 scaledValueOfFirstFixedSurface = 26315 ;
+	}
+
+#paramId: 503345
+#Maximum total-column integrated condensed  water (over given time interval)
+'Maximum total-column integrated condensed  water (over given time interval)' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 81 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfSecondFixedSurface = 8 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503346
+#Composite reflectivity - observation
+'Composite reflectivity - observation' = {
+	 discipline = 0 ;
+	 parameterCategory = 16 ;
+	 parameterNumber = 5 ;
+	 typeOfGeneratingProcess = 8 ;
+	}
+
+#paramId: 503347
+#Composite reflectivity - forecast (simulation)
+'Composite reflectivity - forecast (simulation)' = {
+	 discipline = 0 ;
+	 parameterCategory = 16 ;
+	 parameterNumber = 5 ;
+	}
+
+#paramId: 503349
+#Maximum reflectivity track (over given time interval and entire atmosphere)
+'Maximum reflectivity track (over given time interval and entire atmosphere)' = {
+	 discipline = 0 ;
+	 parameterCategory = 15 ;
+	 parameterNumber = 1 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfSecondFixedSurface = 8 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503350
+#relative vorticity
+'relative vorticity' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 12 ;
+	}
+
+#paramId: 503352
+#2m Temperature, restricted to land
+'2m Temperature, restricted to land' = {
+	 discipline = 0 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 0 ;
+	 typeOfSecondFixedSurface = 181 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 2 ;
+	}
+
+#paramId: 503353
+#2m Dew Point Temperature, restricted to land
+'2m Dew Point Temperature, restricted to land' = {
+	 discipline = 0 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 6 ;
+	 typeOfSecondFixedSurface = 181 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 2 ;
+	}
+
+#paramId: 503354
+#2m Relative Humidity, restricted to land
+'2m Relative Humidity, restricted to land' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 1 ;
+	 typeOfSecondFixedSurface = 181 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 2 ;
+	}
+
+#paramId: 503355
+#v-component of wind (gust)
+'v-component of wind (gust)' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 24 ;
+	}
+
+#paramId: 503357
+#Maximum 10m wind speed without  gust
+'Maximum 10m wind speed without  gust' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 1 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 10 ;
+	}
+
 #paramId: 500092
 #Solar radiation heating rate
 'Solar radiation heating rate' = {
@@ -11419,3 +11896,106 @@
 	 parameterNumber = 234 ;
 	}
 
+#paramId: 503299
+#Sky-view-factor
+'Sky-view-factor' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 0 ;
+	}
+
+#paramId: 503300
+#Horizon angle - topography
+'Horizon angle - topography' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 1 ;
+	}
+
+#paramId: 503301
+#Slope aspect - topography
+'Slope aspect - topography' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 3 ;
+	}
+
+#paramId: 503302
+#Slope angle - topography
+'Slope angle - topography' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 2 ;
+	}
+
+#paramId: 503339
+#Threshold friction velocity
+'Threshold friction velocity' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 203 ;
+	}
+
+#paramId: 503342
+#Maximum rotation amplitude (positive or negative)  (over given time interval and column)
+'Maximum rotation amplitude (positive or negative)  (over given time interval and column)' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 206 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503343
+#Maximum updraft track (over given time interval and column)
+'Maximum updraft track (over given time interval and column)' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 207 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503348
+#Maximum of Lightning Potential Index (over given time interval)
+'Maximum of Lightning Potential Index (over given time interval)' = {
+	 discipline = 0 ;
+	 parameterCategory = 17 ;
+	 parameterNumber = 192 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503351
+#mean radiation temperature of an environment assumed black body related to standing human
+'mean radiation temperature of an environment assumed black body related to standing human' = {
+	 discipline = 0 ;
+	 parameterCategory = 192 ;
+	 parameterNumber = 4 ;
+	}
+
+#paramId: 503356
+#Maximum 10m convective gust
+'Maximum 10m convective gust' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 205 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 10 ;
+	}
+
+#paramId: 503358
+#Standard deviation of saturation deficit
+'Standard deviation of saturation deficit' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 234 ;
+	}
+
+#paramId: 503359
+#evaporation of plants (integrated since "nightly reset")
+'evaporation of plants (integrated since "nightly reset")' = {
+	 discipline = 2 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 198 ;
+	}
+
diff --git a/definitions/grib2/localConcepts/edzw/paramId.def b/definitions/grib2/localConcepts/edzw/paramId.def
index 51b5ff4..77b996e 100755
--- a/definitions/grib2/localConcepts/edzw/paramId.def
+++ b/definitions/grib2/localConcepts/edzw/paramId.def
@@ -1,4 +1,4 @@
-# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE, do not edit! 2016-08-11 07:00
+# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE, do not edit! 2017-09-01 10:27
 #paramId: 500000
 #Pressure (S) (not reduced)
 '500000' = {
@@ -1931,7 +1931,7 @@
 	}
 
 #paramId: 500225
-#Total soil dust aerosol
+#Total soil dust aerosol (climatology)
 '500225' = {
 	 discipline = 0 ;
 	 parameterCategory = 20 ;
@@ -1940,7 +1940,7 @@
 	}
 
 #paramId: 500226
-#Total soil dust aerosol (12M)
+#Total soil dust aerosol (climatology,12M)
 '500226' = {
 	 discipline = 0 ;
 	 parameterCategory = 20 ;
@@ -11810,7 +11810,7 @@
 	}
 
 #paramId: 503274
-#Diagnostic maximum total mass concentration of volcanic ash in layer SFC-FL200
+#Diagnostic maximum total mass concentration of volcanic ash in layer SFC-FL100
 '503274' = {
 	 discipline = 0 ;
 	 parameterCategory = 20 ;
@@ -11958,3 +11958,591 @@
 	 parameterNumber = 234 ;
 	}
 
+#paramId: 503293
+#Large Scale Rain Difference
+'503293' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 77 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503294
+#Large Scale Snowfall water Equivalent Difference
+'503294' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 56 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503295
+#Convective Rain Difference
+'503295' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 76 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503296
+#Convective Snowfall Water Equivalent Difference
+'503296' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 55 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503299
+#Sky-view-factor
+'503299' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 0 ;
+	}
+
+#paramId: 503300
+#Horizon angle - topography
+'503300' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 1 ;
+	}
+
+#paramId: 503301
+#Slope aspect - topography
+'503301' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 3 ;
+	}
+
+#paramId: 503302
+#Slope angle - topography
+'503302' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 2 ;
+	}
+
+#paramId: 503303
+#Total precipitation rate
+'503303' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 52 ;
+	}
+
+#paramId: 503304
+#Horizontal moisture convergence
+'503304' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 26 ;
+	}
+
+#paramId: 503305
+#TOA downward solar radiation
+'503305' = {
+	 discipline = 0 ;
+	 parameterCategory = 4 ;
+	 parameterNumber = 7 ;
+	 typeOfFirstFixedSurface = 8 ;
+	}
+
+#paramId: 503306
+#Surface upward thermal radiation
+'503306' = {
+	 discipline = 0 ;
+	 parameterCategory = 5 ;
+	 parameterNumber = 4 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503307
+#Surface upward thermal radiation
+'503307' = {
+	 discipline = 0 ;
+	 parameterCategory = 5 ;
+	 parameterNumber = 4 ;
+	 typeOfStatisticalProcessing = 0 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503308
+#Specific mass of liquid water coating on hail
+'503308' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 110 ;
+	}
+
+#paramId: 503309
+#Specific mass of liquid water coating on graupel
+'503309' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 113 ;
+	}
+
+#paramId: 503310
+#Specific mass of liquid water coating on snow
+'503310' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 116 ;
+	}
+
+#paramId: 503311
+#Specific number concentration of rain
+'503311' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 100 ;
+	}
+
+#paramId: 503312
+#Number density of rain
+'503312' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 104 ;
+	}
+
+#paramId: 503313
+#Specific number concentration of snow
+'503313' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 101 ;
+	}
+
+#paramId: 503314
+#Specific number concentration of graupel
+'503314' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 102 ;
+	}
+
+#paramId: 503315
+#Specific number concentration of hail
+'503315' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 103 ;
+	}
+
+#paramId: 503316
+#Number density of snow
+'503316' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 105 ;
+	}
+
+#paramId: 503317
+#Number density of graupel
+'503317' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 106 ;
+	}
+
+#paramId: 503318
+#Number density of hail
+'503318' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 107 ;
+	}
+
+#paramId: 503319
+#Mass density of rain
+'503319' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 96 ;
+	}
+
+#paramId: 503320
+#Mass density of snow
+'503320' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 97 ;
+	}
+
+#paramId: 503321
+#Mass density of graupel
+'503321' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 98 ;
+	}
+
+#paramId: 503322
+#Mass density of cloud droplets
+'503322' = {
+	 discipline = 0 ;
+	 parameterCategory = 6 ;
+	 parameterNumber = 38 ;
+	}
+
+#paramId: 503323
+#Mass density of cloud ice
+'503323' = {
+	 discipline = 0 ;
+	 parameterCategory = 6 ;
+	 parameterNumber = 39 ;
+	}
+
+#paramId: 503324
+#Mass density of hail
+'503324' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 99 ;
+	}
+
+#paramId: 503325
+#Lightning Potential Index
+'503325' = {
+	 discipline = 0 ;
+	 parameterCategory = 17 ;
+	 parameterNumber = 1 ;
+	}
+
+#paramId: 503326
+#Diagnostic total column of activity concentration of radionuclides
+'503326' = {
+	 discipline = 0 ;
+	 parameterCategory = 18 ;
+	 parameterNumber = 17 ;
+	 typeOfFirstFixedSurface = 10 ;
+	}
+
+#paramId: 503327
+#Base for given threshold of mass density for volcanic ash cloud
+'503327' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 21 ;
+	 constituentType = 62025 ;
+	}
+
+#paramId: 503328
+#Base for given threshold of mass density for mineral dust cloud
+'503328' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 21 ;
+	 constituentType = 62001 ;
+	}
+
+#paramId: 503330
+#Top for given threshold of mass density for volcanic ash cloud
+'503330' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 22 ;
+	 constituentType = 62025 ;
+	}
+
+#paramId: 503331
+#Top for given threshold of mass density for mineral dust cloud
+'503331' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 22 ;
+	 constituentType = 62001 ;
+	}
+
+#paramId: 503332
+#Top for given threshold of air concentration of radionuclides
+'503332' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 24 ;
+	}
+
+#paramId: 503333
+#Emission rate of dust for mode 2
+'503333' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 constituentType = 62001 ;
+	 modeNumber = 2 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503334
+#Emission rate of dust for mode 3
+'503334' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 constituentType = 62001 ;
+	 modeNumber = 3 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503335
+#Emission rate of dust for mode 1
+'503335' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 constituentType = 62001 ;
+	 modeNumber = 1 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503336
+#Accumulated dust Emission for mode 2
+'503336' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 typeOfStatisticalProcessing = 1 ;
+	 constituentType = 62001 ;
+	 modeNumber = 2 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503337
+#Accumulated dust Emission for mode 1
+'503337' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 typeOfStatisticalProcessing = 1 ;
+	 constituentType = 62001 ;
+	 modeNumber = 1 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503338
+#Accumulated dust Emission for mode 3
+'503338' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 typeOfStatisticalProcessing = 1 ;
+	 constituentType = 62001 ;
+	 modeNumber = 3 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503339
+#Threshold friction velocity
+'503339' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 203 ;
+	}
+
+#paramId: 503340
+#Base for given threshold of air concentration of radionuclides
+'503340' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 23 ;
+	}
+
+#paramId: 503341
+#Maximum amplitude (positive or negative) of updraft helicity  (over given time interval)
+'503341' = {
+	 discipline = 0 ;
+	 parameterCategory = 7 ;
+	 parameterNumber = 15 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503342
+#Maximum rotation amplitude (positive or negative)  (over given time interval and column)
+'503342' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 206 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503343
+#Maximum updraft track (over given time interval and column)
+'503343' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 207 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503344
+#Maximum total-column integrated condensed water above -10 C isotherm (over given time interval)
+'503344' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 81 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfSecondFixedSurface = 8 ;
+	 typeOfFirstFixedSurface = 20 ;
+	 scaleFactorOfFirstFixedSurface = 2 ;
+	 scaledValueOfFirstFixedSurface = 26315 ;
+	}
+
+#paramId: 503345
+#Maximum total-column integrated condensed  water (over given time interval)
+'503345' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 81 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfSecondFixedSurface = 8 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503346
+#Composite reflectivity - observation
+'503346' = {
+	 discipline = 0 ;
+	 parameterCategory = 16 ;
+	 parameterNumber = 5 ;
+	 typeOfGeneratingProcess = 8 ;
+	}
+
+#paramId: 503347
+#Composite reflectivity - forecast (simulation)
+'503347' = {
+	 discipline = 0 ;
+	 parameterCategory = 16 ;
+	 parameterNumber = 5 ;
+	}
+
+#paramId: 503348
+#Maximum of Lightning Potential Index (over given time interval)
+'503348' = {
+	 discipline = 0 ;
+	 parameterCategory = 17 ;
+	 parameterNumber = 192 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503349
+#Maximum reflectivity track (over given time interval and entire atmosphere)
+'503349' = {
+	 discipline = 0 ;
+	 parameterCategory = 15 ;
+	 parameterNumber = 1 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfSecondFixedSurface = 8 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503350
+#relative vorticity
+'503350' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 12 ;
+	}
+
+#paramId: 503351
+#mean radiation temperature of an environment assumed black body related to standing human
+'503351' = {
+	 discipline = 0 ;
+	 parameterCategory = 192 ;
+	 parameterNumber = 4 ;
+	}
+
+#paramId: 503352
+#2m Temperature, restricted to land
+'503352' = {
+	 discipline = 0 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 0 ;
+	 typeOfSecondFixedSurface = 181 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 2 ;
+	}
+
+#paramId: 503353
+#2m Dew Point Temperature, restricted to land
+'503353' = {
+	 discipline = 0 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 6 ;
+	 typeOfSecondFixedSurface = 181 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 2 ;
+	}
+
+#paramId: 503354
+#2m Relative Humidity, restricted to land
+'503354' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 1 ;
+	 typeOfSecondFixedSurface = 181 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 2 ;
+	}
+
+#paramId: 503355
+#v-component of wind (gust)
+'503355' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 24 ;
+	}
+
+#paramId: 503356
+#Maximum 10m convective gust
+'503356' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 205 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 10 ;
+	}
+
+#paramId: 503357
+#Maximum 10m wind speed without  gust
+'503357' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 1 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 10 ;
+	}
+
+#paramId: 503358
+#Standard deviation of saturation deficit
+'503358' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 234 ;
+	}
+
+#paramId: 503359
+#evaporation of plants (integrated since "nightly reset")
+'503359' = {
+	 discipline = 2 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 198 ;
+	}
+
diff --git a/definitions/grib2/localConcepts/edzw/shortName.def b/definitions/grib2/localConcepts/edzw/shortName.def
index 540dd41..db8994e 100755
--- a/definitions/grib2/localConcepts/edzw/shortName.def
+++ b/definitions/grib2/localConcepts/edzw/shortName.def
@@ -1,4 +1,4 @@
-# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE, do not edit! 2016-08-11 07:00
+# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE, do not edit! 2017-09-01 10:27
 #paramId: 500000
 #Pressure (S) (not reduced)
 'PS' = {
@@ -1029,7 +1029,7 @@
 
 #paramId: 500138
 #rain amount, grid-scale plus convective
-'RR_F' = {
+'TOT_RAIN' = {
 	 discipline = 0 ;
 	 parameterCategory = 1 ;
 	 parameterNumber = 65 ;
@@ -1038,7 +1038,7 @@
 
 #paramId: 500139
 #snow amount, grid-scale plus convective
-'RR_C' = {
+'TOT_SNOW' = {
 	 discipline = 0 ;
 	 parameterCategory = 1 ;
 	 parameterNumber = 66 ;
@@ -1444,7 +1444,7 @@
 	}
 
 #paramId: 500225
-#Total soil dust aerosol
+#Total soil dust aerosol (climatology)
 'AER_DUST' = {
 	 discipline = 0 ;
 	 parameterCategory = 20 ;
@@ -1453,7 +1453,7 @@
 	}
 
 #paramId: 500226
-#Total soil dust aerosol (12M)
+#Total soil dust aerosol (climatology,12M)
 'AER_DUST12' = {
 	 discipline = 0 ;
 	 parameterCategory = 20 ;
@@ -1537,7 +1537,7 @@
 
 #paramId: 500238
 #Friction velocity
-'USTR' = {
+'USTAR' = {
 	 discipline = 0 ;
 	 parameterCategory = 2 ;
 	 parameterNumber = 30 ;
@@ -3401,7 +3401,7 @@
 
 #paramId: 500588
 #Snow melt
-'SNOW' = {
+'SNOW_MELT' = {
 	 discipline = 0 ;
 	 parameterCategory = 1 ;
 	 parameterNumber = 16 ;
@@ -6572,7 +6572,7 @@
 	}
 
 #paramId: 503274
-#Diagnostic maximum total mass concentration of volcanic ash in layer SFC-FL200
+#Diagnostic maximum total mass concentration of volcanic ash in layer SFC-FL100
 'ASH_MAX_TOTAL_MC_SFC_100' = {
 	 discipline = 0 ;
 	 parameterCategory = 20 ;
@@ -6663,6 +6663,483 @@
 	 parameterNumber = 102 ;
 	}
 
+#paramId: 503293
+#Large Scale Rain Difference
+'RAIN_GSP_D' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 77 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503294
+#Large Scale Snowfall water Equivalent Difference
+'SNOW_GSP_D' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 56 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503295
+#Convective Rain Difference
+'RAIN_CON_D' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 76 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503296
+#Convective Snowfall Water Equivalent Difference
+'SNOW_CON_D' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 55 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503303
+#Total precipitation rate
+'TOT_PR' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 52 ;
+	}
+
+#paramId: 503304
+#Horizontal moisture convergence
+'MCONV' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 26 ;
+	}
+
+#paramId: 503305
+#TOA downward solar radiation
+'SODT_RAD' = {
+	 discipline = 0 ;
+	 parameterCategory = 4 ;
+	 parameterNumber = 7 ;
+	 typeOfFirstFixedSurface = 8 ;
+	}
+
+#paramId: 503306
+#Surface upward thermal radiation
+'THUS_RAD' = {
+	 discipline = 0 ;
+	 parameterCategory = 5 ;
+	 parameterNumber = 4 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503307
+#Surface upward thermal radiation
+'ATHU_S' = {
+	 discipline = 0 ;
+	 parameterCategory = 5 ;
+	 parameterNumber = 4 ;
+	 typeOfStatisticalProcessing = 0 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503308
+#Specific mass of liquid water coating on hail
+'QH_LIQ' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 110 ;
+	}
+
+#paramId: 503309
+#Specific mass of liquid water coating on graupel
+'QG_LIQ' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 113 ;
+	}
+
+#paramId: 503310
+#Specific mass of liquid water coating on snow
+'QS_LIQ' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 116 ;
+	}
+
+#paramId: 503311
+#Specific number concentration of rain
+'NCRAIN' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 100 ;
+	}
+
+#paramId: 503312
+#Number density of rain
+'NDRAIN' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 104 ;
+	}
+
+#paramId: 503313
+#Specific number concentration of snow
+'NCSNOW' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 101 ;
+	}
+
+#paramId: 503314
+#Specific number concentration of graupel
+'NCGRAUPEL' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 102 ;
+	}
+
+#paramId: 503315
+#Specific number concentration of hail
+'NCHAIL' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 103 ;
+	}
+
+#paramId: 503316
+#Number density of snow
+'NDSNOW' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 105 ;
+	}
+
+#paramId: 503317
+#Number density of graupel
+'NDGRAUPEL' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 106 ;
+	}
+
+#paramId: 503318
+#Number density of hail
+'NDHAIL' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 107 ;
+	}
+
+#paramId: 503319
+#Mass density of rain
+'DENR' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 96 ;
+	}
+
+#paramId: 503320
+#Mass density of snow
+'DENS' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 97 ;
+	}
+
+#paramId: 503321
+#Mass density of graupel
+'DENG' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 98 ;
+	}
+
+#paramId: 503322
+#Mass density of cloud droplets
+'DENC' = {
+	 discipline = 0 ;
+	 parameterCategory = 6 ;
+	 parameterNumber = 38 ;
+	}
+
+#paramId: 503323
+#Mass density of cloud ice
+'DENI' = {
+	 discipline = 0 ;
+	 parameterCategory = 6 ;
+	 parameterNumber = 39 ;
+	}
+
+#paramId: 503324
+#Mass density of hail
+'DENH' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 99 ;
+	}
+
+#paramId: 503326
+#Diagnostic total column of activity concentration of radionuclides
+'RADIONUC_AC_VI' = {
+	 discipline = 0 ;
+	 parameterCategory = 18 ;
+	 parameterNumber = 17 ;
+	 typeOfFirstFixedSurface = 10 ;
+	}
+
+#paramId: 503327
+#Base for given threshold of mass density for volcanic ash cloud
+'HBAS_ASH_CLD' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 21 ;
+	 constituentType = 62025 ;
+	}
+
+#paramId: 503328
+#Base for given threshold of mass density for mineral dust cloud
+'HBAS_DUST_CLD' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 21 ;
+	 constituentType = 62001 ;
+	}
+
+#paramId: 503330
+#Top for given threshold of mass density for volcanic ash cloud
+'HTOP_ASH_CLD' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 22 ;
+	 constituentType = 62025 ;
+	}
+
+#paramId: 503331
+#Top for given threshold of mass density for mineral dust cloud
+'HTOP_DUST_CLD' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 22 ;
+	 constituentType = 62001 ;
+	}
+
+#paramId: 503332
+#Top for given threshold of air concentration of radionuclides
+'HTOP_RADIONUC_CLD' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 24 ;
+	}
+
+#paramId: 503333
+#Emission rate of dust for mode 2
+'EMISS_DUSTB' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 constituentType = 62001 ;
+	 modeNumber = 2 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503334
+#Emission rate of dust for mode 3
+'EMISS_DUSTC' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 constituentType = 62001 ;
+	 modeNumber = 3 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503335
+#Emission rate of dust for mode 1
+'EMISS_DUSTA' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 constituentType = 62001 ;
+	 modeNumber = 1 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503336
+#Accumulated dust Emission for mode 2
+'ACCEMISS_DUSTB' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 typeOfStatisticalProcessing = 1 ;
+	 constituentType = 62001 ;
+	 modeNumber = 2 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503337
+#Accumulated dust Emission for mode 1
+'ACCEMISS_DUSTA' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 typeOfStatisticalProcessing = 1 ;
+	 constituentType = 62001 ;
+	 modeNumber = 1 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503338
+#Accumulated dust Emission for mode 3
+'ACCEMISS_DUSTC' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 typeOfStatisticalProcessing = 1 ;
+	 constituentType = 62001 ;
+	 modeNumber = 3 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503340
+#Base for given threshold of air concentration of radionuclides
+'HBAS_RADIONUC_CLD' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 23 ;
+	}
+
+#paramId: 503341
+#Maximum amplitude (positive or negative) of updraft helicity  (over given time interval)
+'UH_MAX' = {
+	 discipline = 0 ;
+	 parameterCategory = 7 ;
+	 parameterNumber = 15 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503344
+#Maximum total-column integrated condensed water above -10 C isotherm (over given time interval)
+'TCOND10_MX' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 81 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfSecondFixedSurface = 8 ;
+	 typeOfFirstFixedSurface = 20 ;
+	 scaleFactorOfFirstFixedSurface = 2 ;
+	 scaledValueOfFirstFixedSurface = 26315 ;
+	}
+
+#paramId: 503345
+#Maximum total-column integrated condensed  water (over given time interval)
+'TCOND_MAX' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 81 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfSecondFixedSurface = 8 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503346
+#Composite reflectivity - observation
+'DBZCMP_OBS' = {
+	 discipline = 0 ;
+	 parameterCategory = 16 ;
+	 parameterNumber = 5 ;
+	 typeOfGeneratingProcess = 8 ;
+	}
+
+#paramId: 503347
+#Composite reflectivity - forecast (simulation)
+'DBZCMP_SIM' = {
+	 discipline = 0 ;
+	 parameterCategory = 16 ;
+	 parameterNumber = 5 ;
+	}
+
+#paramId: 503349
+#Maximum reflectivity track (over given time interval and entire atmosphere)
+'DBZ_CTMAX' = {
+	 discipline = 0 ;
+	 parameterCategory = 15 ;
+	 parameterNumber = 1 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfSecondFixedSurface = 8 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503350
+#relative vorticity
+'RELV' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 12 ;
+	}
+
+#paramId: 503352
+#2m Temperature, restricted to land
+'T_2M_L' = {
+	 discipline = 0 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 0 ;
+	 typeOfSecondFixedSurface = 181 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 2 ;
+	}
+
+#paramId: 503353
+#2m Dew Point Temperature, restricted to land
+'TD_2M_L' = {
+	 discipline = 0 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 6 ;
+	 typeOfSecondFixedSurface = 181 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 2 ;
+	}
+
+#paramId: 503354
+#2m Relative Humidity, restricted to land
+'RELHUM_2M_L' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 1 ;
+	 typeOfSecondFixedSurface = 181 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 2 ;
+	}
+
+#paramId: 503355
+#v-component of wind (gust)
+'VGUST_DYN_10M' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 24 ;
+	}
+
+#paramId: 503357
+#Maximum 10m wind speed without  gust
+'VABSMX_10M' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 1 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 10 ;
+	}
+
 #paramId: 500092
 #Solar radiation heating rate
 'SOHR_RAD' = {
@@ -11419,3 +11896,106 @@
 	 parameterNumber = 234 ;
 	}
 
+#paramId: 503299
+#Sky-view-factor
+'SKYVIEW' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 0 ;
+	}
+
+#paramId: 503300
+#Horizon angle - topography
+'HORIZON' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 1 ;
+	}
+
+#paramId: 503301
+#Slope aspect - topography
+'SLO_ASP' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 3 ;
+	}
+
+#paramId: 503302
+#Slope angle - topography
+'SLO_ANG' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 2 ;
+	}
+
+#paramId: 503339
+#Threshold friction velocity
+'USTAR_THRES' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 203 ;
+	}
+
+#paramId: 503342
+#Maximum rotation amplitude (positive or negative)  (over given time interval and column)
+'VORW_CTMAX' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 206 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503343
+#Maximum updraft track (over given time interval and column)
+'W_CTMAX' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 207 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503348
+#Maximum of Lightning Potential Index (over given time interval)
+'LPI_MAX' = {
+	 discipline = 0 ;
+	 parameterCategory = 17 ;
+	 parameterNumber = 192 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503351
+#mean radiation temperature of an environment assumed black body related to standing human
+'T_MRT' = {
+	 discipline = 0 ;
+	 parameterCategory = 192 ;
+	 parameterNumber = 4 ;
+	}
+
+#paramId: 503356
+#Maximum 10m convective gust
+'VGUST_CON_10M' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 205 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 10 ;
+	}
+
+#paramId: 503358
+#Standard deviation of saturation deficit
+'RCLD' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 234 ;
+	}
+
+#paramId: 503359
+#evaporation of plants (integrated since "nightly reset")
+'EVAP_PL' = {
+	 discipline = 2 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 198 ;
+	}
+
diff --git a/definitions/grib2/localConcepts/edzw/units.def b/definitions/grib2/localConcepts/edzw/units.def
index c4ac711..e2b220f 100755
--- a/definitions/grib2/localConcepts/edzw/units.def
+++ b/definitions/grib2/localConcepts/edzw/units.def
@@ -1,4 +1,4 @@
-# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE, do not edit! 2016-08-11 07:00
+# Automatically generated by get_definitions.sql from database PRJ_TDCFDOKU.GRIB_PARAMETER at MIRAKEL.DWD.DE, do not edit! 2017-09-01 10:27
 #paramId: 500000
 #Pressure (S) (not reduced)
 'Pa' = {
@@ -1201,7 +1201,7 @@
 
 #paramId: 500173
 #Base reflectivity
-'dB' = {
+'dBZ' = {
 	 discipline = 0 ;
 	 parameterCategory = 15 ;
 	 parameterNumber = 1 ;
@@ -1210,7 +1210,7 @@
 
 #paramId: 500174
 #Base reflectivity
-'dB' = {
+'dBZ' = {
 	 discipline = 0 ;
 	 parameterCategory = 15 ;
 	 parameterNumber = 1 ;
@@ -1218,7 +1218,7 @@
 
 #paramId: 500175
 #Base reflectivity (cmax)
-'dB' = {
+'dBZ' = {
 	 discipline = 0 ;
 	 parameterCategory = 15 ;
 	 parameterNumber = 1 ;
@@ -1444,7 +1444,7 @@
 	}
 
 #paramId: 500225
-#Total soil dust aerosol
+#Total soil dust aerosol (climatology)
 'Numeric' = {
 	 discipline = 0 ;
 	 parameterCategory = 20 ;
@@ -1453,7 +1453,7 @@
 	}
 
 #paramId: 500226
-#Total soil dust aerosol (12M)
+#Total soil dust aerosol (climatology,12M)
 'Numeric' = {
 	 discipline = 0 ;
 	 parameterCategory = 20 ;
@@ -5802,7 +5802,7 @@
 
 #paramId: 503109
 #Reflectivity of cloud droplets
-'dB' = {
+'dBZ' = {
 	 discipline = 0 ;
 	 parameterCategory = 15 ;
 	 parameterNumber = 9 ;
@@ -5810,7 +5810,7 @@
 
 #paramId: 503110
 #Reflectivity of  cloud ice
-'dB' = {
+'dBZ' = {
 	 discipline = 0 ;
 	 parameterCategory = 15 ;
 	 parameterNumber = 10 ;
@@ -5818,7 +5818,7 @@
 
 #paramId: 503111
 #Reflectivity of snow
-'dB' = {
+'dBZ' = {
 	 discipline = 0 ;
 	 parameterCategory = 15 ;
 	 parameterNumber = 11 ;
@@ -5826,7 +5826,7 @@
 
 #paramId: 503112
 #Reflectivity of rain
-'dB' = {
+'dBZ' = {
 	 discipline = 0 ;
 	 parameterCategory = 15 ;
 	 parameterNumber = 12 ;
@@ -5834,7 +5834,7 @@
 
 #paramId: 503113
 #Reflectivity of graupel
-'dB' = {
+'dBZ' = {
 	 discipline = 0 ;
 	 parameterCategory = 15 ;
 	 parameterNumber = 13 ;
@@ -5842,7 +5842,7 @@
 
 #paramId: 503114
 #Reflectivity of hail
-'dB' = {
+'dBZ' = {
 	 discipline = 0 ;
 	 parameterCategory = 15 ;
 	 parameterNumber = 14 ;
@@ -6572,7 +6572,7 @@
 	}
 
 #paramId: 503274
-#Diagnostic maximum total mass concentration of volcanic ash in layer SFC-FL200
+#Diagnostic maximum total mass concentration of volcanic ash in layer SFC-FL100
 'kg m-3' = {
 	 discipline = 0 ;
 	 parameterCategory = 20 ;
@@ -6663,6 +6663,483 @@
 	 parameterNumber = 102 ;
 	}
 
+#paramId: 503293
+#Large Scale Rain Difference
+'kg m-2' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 77 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503294
+#Large Scale Snowfall water Equivalent Difference
+'kg m-2' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 56 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503295
+#Convective Rain Difference
+'kg m-2' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 76 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503296
+#Convective Snowfall Water Equivalent Difference
+'kg m-2' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 55 ;
+	 typeOfStatisticalProcessing = 4 ;
+	}
+
+#paramId: 503303
+#Total precipitation rate
+'kg m-2 s-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 52 ;
+	}
+
+#paramId: 503304
+#Horizontal moisture convergence
+'kg kg-1 s-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 26 ;
+	}
+
+#paramId: 503305
+#TOA downward solar radiation
+'W m-2' = {
+	 discipline = 0 ;
+	 parameterCategory = 4 ;
+	 parameterNumber = 7 ;
+	 typeOfFirstFixedSurface = 8 ;
+	}
+
+#paramId: 503306
+#Surface upward thermal radiation
+'W m-2' = {
+	 discipline = 0 ;
+	 parameterCategory = 5 ;
+	 parameterNumber = 4 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503307
+#Surface upward thermal radiation
+'W m-2' = {
+	 discipline = 0 ;
+	 parameterCategory = 5 ;
+	 parameterNumber = 4 ;
+	 typeOfStatisticalProcessing = 0 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503308
+#Specific mass of liquid water coating on hail
+'kg kg-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 110 ;
+	}
+
+#paramId: 503309
+#Specific mass of liquid water coating on graupel
+'kg kg-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 113 ;
+	}
+
+#paramId: 503310
+#Specific mass of liquid water coating on snow
+'kg kg-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 116 ;
+	}
+
+#paramId: 503311
+#Specific number concentration of rain
+'kg-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 100 ;
+	}
+
+#paramId: 503312
+#Number density of rain
+'m-3' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 104 ;
+	}
+
+#paramId: 503313
+#Specific number concentration of snow
+'kg-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 101 ;
+	}
+
+#paramId: 503314
+#Specific number concentration of graupel
+'kg-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 102 ;
+	}
+
+#paramId: 503315
+#Specific number concentration of hail
+'kg-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 103 ;
+	}
+
+#paramId: 503316
+#Number density of snow
+'m-3' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 105 ;
+	}
+
+#paramId: 503317
+#Number density of graupel
+'m-3' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 106 ;
+	}
+
+#paramId: 503318
+#Number density of hail
+'m-3' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 107 ;
+	}
+
+#paramId: 503319
+#Mass density of rain
+'kg m-3' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 96 ;
+	}
+
+#paramId: 503320
+#Mass density of snow
+'kg m-3' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 97 ;
+	}
+
+#paramId: 503321
+#Mass density of graupel
+'kg m-3' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 98 ;
+	}
+
+#paramId: 503322
+#Mass density of cloud droplets
+'kg m-3' = {
+	 discipline = 0 ;
+	 parameterCategory = 6 ;
+	 parameterNumber = 38 ;
+	}
+
+#paramId: 503323
+#Mass density of cloud ice
+'kg m-3' = {
+	 discipline = 0 ;
+	 parameterCategory = 6 ;
+	 parameterNumber = 39 ;
+	}
+
+#paramId: 503324
+#Mass density of hail
+'kg m-3' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 99 ;
+	}
+
+#paramId: 503326
+#Diagnostic total column of activity concentration of radionuclides
+'Bq m-2' = {
+	 discipline = 0 ;
+	 parameterCategory = 18 ;
+	 parameterNumber = 17 ;
+	 typeOfFirstFixedSurface = 10 ;
+	}
+
+#paramId: 503327
+#Base for given threshold of mass density for volcanic ash cloud
+'m' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 21 ;
+	 constituentType = 62025 ;
+	}
+
+#paramId: 503328
+#Base for given threshold of mass density for mineral dust cloud
+'m' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 21 ;
+	 constituentType = 62001 ;
+	}
+
+#paramId: 503330
+#Top for given threshold of mass density for volcanic ash cloud
+'m' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 22 ;
+	 constituentType = 62025 ;
+	}
+
+#paramId: 503331
+#Top for given threshold of mass density for mineral dust cloud
+'m' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 22 ;
+	 constituentType = 62001 ;
+	}
+
+#paramId: 503332
+#Top for given threshold of air concentration of radionuclides
+'m' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 24 ;
+	}
+
+#paramId: 503333
+#Emission rate of dust for mode 2
+'kg m-2 s-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 constituentType = 62001 ;
+	 modeNumber = 2 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503334
+#Emission rate of dust for mode 3
+'kg m-2 s-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 constituentType = 62001 ;
+	 modeNumber = 3 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503335
+#Emission rate of dust for mode 1
+'kg m-2 s-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 constituentType = 62001 ;
+	 modeNumber = 1 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503336
+#Accumulated dust Emission for mode 2
+'kg m-2' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 typeOfStatisticalProcessing = 1 ;
+	 constituentType = 62001 ;
+	 modeNumber = 2 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503337
+#Accumulated dust Emission for mode 1
+'kg m-2' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 typeOfStatisticalProcessing = 1 ;
+	 constituentType = 62001 ;
+	 modeNumber = 1 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503338
+#Accumulated dust Emission for mode 3
+'kg m-2' = {
+	 discipline = 0 ;
+	 parameterCategory = 20 ;
+	 parameterNumber = 3 ;
+	 typeOfStatisticalProcessing = 1 ;
+	 constituentType = 62001 ;
+	 modeNumber = 3 ;
+	 typeOfDistributionFunction = 8 ;
+	}
+
+#paramId: 503340
+#Base for given threshold of air concentration of radionuclides
+'m' = {
+	 discipline = 0 ;
+	 parameterCategory = 3 ;
+	 parameterNumber = 6 ;
+	 typeOfFirstFixedSurface = 23 ;
+	}
+
+#paramId: 503341
+#Maximum amplitude (positive or negative) of updraft helicity  (over given time interval)
+'m2 s-2' = {
+	 discipline = 0 ;
+	 parameterCategory = 7 ;
+	 parameterNumber = 15 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503344
+#Maximum total-column integrated condensed water above -10 C isotherm (over given time interval)
+'kg m-2' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 81 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfSecondFixedSurface = 8 ;
+	 typeOfFirstFixedSurface = 20 ;
+	 scaleFactorOfFirstFixedSurface = 2 ;
+	 scaledValueOfFirstFixedSurface = 26315 ;
+	}
+
+#paramId: 503345
+#Maximum total-column integrated condensed  water (over given time interval)
+'kg m-2' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 81 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfSecondFixedSurface = 8 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503346
+#Composite reflectivity - observation
+'dBZ' = {
+	 discipline = 0 ;
+	 parameterCategory = 16 ;
+	 parameterNumber = 5 ;
+	 typeOfGeneratingProcess = 8 ;
+	}
+
+#paramId: 503347
+#Composite reflectivity - forecast (simulation)
+'dBZ' = {
+	 discipline = 0 ;
+	 parameterCategory = 16 ;
+	 parameterNumber = 5 ;
+	}
+
+#paramId: 503349
+#Maximum reflectivity track (over given time interval and entire atmosphere)
+'dBZ' = {
+	 discipline = 0 ;
+	 parameterCategory = 15 ;
+	 parameterNumber = 1 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfSecondFixedSurface = 8 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+
+#paramId: 503350
+#relative vorticity
+'s-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 12 ;
+	}
+
+#paramId: 503352
+#2m Temperature, restricted to land
+'K' = {
+	 discipline = 0 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 0 ;
+	 typeOfSecondFixedSurface = 181 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 2 ;
+	}
+
+#paramId: 503353
+#2m Dew Point Temperature, restricted to land
+'K' = {
+	 discipline = 0 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 6 ;
+	 typeOfSecondFixedSurface = 181 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 2 ;
+	}
+
+#paramId: 503354
+#2m Relative Humidity, restricted to land
+'%' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 1 ;
+	 typeOfSecondFixedSurface = 181 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 2 ;
+	}
+
+#paramId: 503355
+#v-component of wind (gust)
+'ms-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 24 ;
+	}
+
+#paramId: 503357
+#Maximum 10m wind speed without  gust
+'ms-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 1 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 10 ;
+	}
+
 #paramId: 500092
 #Solar radiation heating rate
 'K s-1' = {
@@ -11419,3 +11896,106 @@
 	 parameterNumber = 234 ;
 	}
 
+#paramId: 503299
+#Sky-view-factor
+'Numeric' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 0 ;
+	}
+
+#paramId: 503300
+#Horizon angle - topography
+'Numeric' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 1 ;
+	}
+
+#paramId: 503301
+#Slope aspect - topography
+'Numeric' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 3 ;
+	}
+
+#paramId: 503302
+#Slope angle - topography
+'Numeric' = {
+	 discipline = 0 ;
+	 parameterCategory = 199 ;
+	 parameterNumber = 2 ;
+	}
+
+#paramId: 503339
+#Threshold friction velocity
+'m s-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 203 ;
+	}
+
+#paramId: 503342
+#Maximum rotation amplitude (positive or negative)  (over given time interval and column)
+'s-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 206 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503343
+#Maximum updraft track (over given time interval and column)
+'m s-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 207 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503348
+#Maximum of Lightning Potential Index (over given time interval)
+'J kg-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 17 ;
+	 parameterNumber = 192 ;
+	 typeOfStatisticalProcessing = 2 ;
+	}
+
+#paramId: 503351
+#mean radiation temperature of an environment assumed black body related to standing human
+'K' = {
+	 discipline = 0 ;
+	 parameterCategory = 192 ;
+	 parameterNumber = 4 ;
+	}
+
+#paramId: 503356
+#Maximum 10m convective gust
+'ms-1' = {
+	 discipline = 0 ;
+	 parameterCategory = 2 ;
+	 parameterNumber = 205 ;
+	 typeOfStatisticalProcessing = 2 ;
+	 typeOfFirstFixedSurface = 103 ;
+	 scaleFactorOfFirstFixedSurface = 0 ;
+	 scaledValueOfFirstFixedSurface = 10 ;
+	}
+
+#paramId: 503358
+#Standard deviation of saturation deficit
+'Numeric' = {
+	 discipline = 0 ;
+	 parameterCategory = 1 ;
+	 parameterNumber = 234 ;
+	}
+
+#paramId: 503359
+#evaporation of plants (integrated since "nightly reset")
+'kgm-2' = {
+	 discipline = 2 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 198 ;
+	}
+
diff --git a/definitions/grib2/name.def b/definitions/grib2/name.def
index 8d7503e..5ba11f8 100644
--- a/definitions/grib2/name.def
+++ b/definitions/grib2/name.def
@@ -501,6 +501,26 @@
 	 parameterCategory = 0 ;
 	 parameterNumber = 15 ;
 	}
+#Mean discharge in the last 6 hours
+'Mean discharge in the last 6 hours' = {
+	 discipline = 1 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 7 ;
+	 lengthOfTimeRange = 6 ;
+	 typeOfFirstFixedSurface = 1 ;
+	 indicatorOfUnitForTimeRange = 1 ;
+	 typeOfStatisticalProcessing = 0 ;
+	}
+#Mean discharge in the last 24 hours
+'Mean discharge in the last 24 hours' = {
+	 discipline = 1 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 7 ;
+	 lengthOfTimeRange = 24 ;
+	 indicatorOfUnitForTimeRange = 1 ;
+	 typeOfStatisticalProcessing = 0 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
 #Snow depth at elevation bands
 'Snow depth at elevation bands' = {
 	 discipline = 2 ;
diff --git a/definitions/grib2/paramId.def b/definitions/grib2/paramId.def
index 66dad2a..3303923 100644
--- a/definitions/grib2/paramId.def
+++ b/definitions/grib2/paramId.def
@@ -501,6 +501,26 @@
 	 parameterCategory = 0 ;
 	 parameterNumber = 15 ;
 	}
+#Mean discharge in the last 6 hours
+'240023' = {
+	 discipline = 1 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 7 ;
+	 typeOfFirstFixedSurface = 1 ;
+	 typeOfStatisticalProcessing = 0 ;
+	 lengthOfTimeRange = 6 ;
+	 indicatorOfUnitForTimeRange = 1 ;
+	}
+#Mean discharge in the last 24 hours
+'240024' = {
+	 discipline = 1 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 7 ;
+	 typeOfFirstFixedSurface = 1 ;
+	 typeOfStatisticalProcessing = 0 ;
+	 lengthOfTimeRange = 24 ;
+	 indicatorOfUnitForTimeRange = 1 ;
+	}
 #Snow depth at elevation bands
 '240026' = {
 	 discipline = 2 ;
diff --git a/definitions/grib2/shortName.def b/definitions/grib2/shortName.def
index c69c1e5..4f14020 100644
--- a/definitions/grib2/shortName.def
+++ b/definitions/grib2/shortName.def
@@ -501,6 +501,26 @@
 	 parameterCategory = 0 ;
 	 parameterNumber = 15 ;
 	}
+#Mean discharge in the last 6 hours
+'dis06' = {
+	 discipline = 1 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 7 ;
+	 typeOfStatisticalProcessing = 0 ;
+	 lengthOfTimeRange = 6 ;
+	 indicatorOfUnitForTimeRange = 1 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
+#Mean discharge in the last 24 hours
+'dis24' = {
+	 discipline = 1 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 7 ;
+	 indicatorOfUnitForTimeRange = 1 ;
+	 typeOfFirstFixedSurface = 1 ;
+	 typeOfStatisticalProcessing = 0 ;
+	 lengthOfTimeRange = 24 ;
+	}
 #Snow depth at elevation bands
 'sd_elev' = {
 	 discipline = 2 ;
diff --git a/definitions/grib2/template.3.20.def b/definitions/grib2/template.3.20.def
index 5b72d75..c60c8f7 100644
--- a/definitions/grib2/template.3.20.def
+++ b/definitions/grib2/template.3.20.def
@@ -36,7 +36,6 @@ meta geography.longitudeOfFirstGridPointInDegrees scale(longitudeOfFirstGridPoin
 alias Lo1 =  longitudeOfFirstGridPoint;
 
 #  Resolution and component flag
-# NOTE 1 NOT FOUND
 flags[1] resolutionAndComponentFlags 'grib2/tables/[tablesVersion]/3.3.table' : dump;
 
 #  LaD - Latitude where Dx and Dy are specified
@@ -46,19 +45,20 @@ meta geography.LaDInDegrees scale(LaD,oneConstant,grib2divider,truncateDegrees)
 alias latitudeWhereDxAndDyAreSpecifiedInDegrees=LaDInDegrees;
 
 #  LoV - orientation of the grid
-# NOTE 2 NOT FOUND
+#  LoV is the longitude value of the meridian which is parallel to the y-axis (or columns of the grid)
+#  along which latitude increases as the y-coordinate increases
 signed[4] orientationOfTheGrid  : edition_specific;
 alias LoV =  orientationOfTheGrid ;
 meta geography.orientationOfTheGridInDegrees scale(orientationOfTheGrid,oneConstant,grib2divider,truncateDegrees) : dump;
 
 #  Dx - X-direction grid length
-# NOTE 3: Grid length is in units of 10-3 m at the latitude specified by LaD
+#  Grid length is in units of 10-3 m at the latitude specified by LaD
 unsigned[4] Dx  : edition_specific;
 meta geography.DxInMetres scale(Dx,one,thousand,truncateDegrees) : dump;
 alias xDirectionGridLength=Dx;
 
 #  Dy - Y-direction grid length
-# NOTE 3: Grid length is in units of 10-3 m at the latitude specified by LaD
+#  Grid length is in units of 10-3 m at the latitude specified by LaD
 unsigned[4] Dy  : edition_specific;
 meta geography.DyInMetres scale(Dy,one,thousand,truncateDegrees) : dump;
 alias yDirectionGridLength=Dy;
@@ -78,11 +78,14 @@ iterator polar_stereographic(numberOfPoints,missingValue,values,
           latitudeOfFirstGridPointInDegrees,longitudeOfFirstGridPointInDegrees,
           southPoleOnProjectionPlane,
           orientationOfTheGridInDegrees,
+          LaDInDegrees,
           DxInMetres,DyInMetres,
           iScansNegatively,
           jScansPositively,
           jPointsAreConsecutive,
           alternativeRowScanning);
 
+nearest polar_stereographic(values,radius,Nx,Ny);
+
 
 # END   2/template.3.20 ----------------------------------------------------------------------
diff --git a/definitions/grib2/template.3.latlon.def b/definitions/grib2/template.3.latlon.def
index 9f9ec89..2a248f5 100755
--- a/definitions/grib2/template.3.latlon.def
+++ b/definitions/grib2/template.3.latlon.def
@@ -69,7 +69,7 @@ _if ( missing(Ni) && PLPresent == 1 ) {
   iterator latlon(numberOfPoints,missingValue,values,
                   longitudeFirstInDegrees,DiInDegrees  ,
                   Ni,Nj,iScansNegatively,
-                  latitudeFirstInDegrees, DjInDegrees,jScansPositively);
+                  latitudeFirstInDegrees, DjInDegrees,jScansPositively, jPointsAreConsecutive);
   nearest regular(values,radius,Ni,Nj);
 }
 meta latLonValues latlonvalues(values);
diff --git a/definitions/grib2/template.4.67.def b/definitions/grib2/template.4.67.def
new file mode 100644
index 0000000..2eca4ab
--- /dev/null
+++ b/definitions/grib2/template.4.67.def
@@ -0,0 +1,13 @@
+# Copyright 2005-2017 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.
+#
+# TEMPLATE 4.67, Average, accumulation and/or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents based on a distribution function
+
+include "grib2/template.4.parameter_chemical_distribution.def"
+include "grib2/template.4.horizontal.def"
+include "grib2/template.4.statistical.def"
diff --git a/definitions/grib2/template.4.68.def b/definitions/grib2/template.4.68.def
new file mode 100644
index 0000000..84d665e
--- /dev/null
+++ b/definitions/grib2/template.4.68.def
@@ -0,0 +1,14 @@
+# Copyright 2005-2017 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.
+#
+# TEMPLATE 4.68, Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents based on a distribution function
+
+include "grib2/template.4.parameter_chemical_distribution.def"
+include "grib2/template.4.horizontal.def"
+include "grib2/template.4.eps.def"
+include "grib2/template.4.statistical.def"
diff --git a/definitions/grib2/template.4.horizontal.def b/definitions/grib2/template.4.horizontal.def
index 9b7ba88..a2fbd12 100755
--- a/definitions/grib2/template.4.horizontal.def
+++ b/definitions/grib2/template.4.horizontal.def
@@ -43,6 +43,10 @@ concept_nofail vertical.typeOfLevel (unknown) {
   'tropopause' = {typeOfFirstFixedSurface=7; typeOfSecondFixedSurface=255;}
   'nominalTop' = {typeOfFirstFixedSurface=8; typeOfSecondFixedSurface=255; }
   'seaBottom' = {typeOfFirstFixedSurface=9;    typeOfSecondFixedSurface=255;}
+
+  # Note: We already had 'entireAtmosphere' mapped before adding this one so had to choose another name
+  'atmosphere' = {typeOfFirstFixedSurface=10;    typeOfSecondFixedSurface=255;}
+
   'isothermal' = {typeOfFirstFixedSurface=20;   typeOfSecondFixedSurface=255;}
   'isobaricInPa' = {typeOfFirstFixedSurface=100; typeOfSecondFixedSurface=255; pressureUnits='Pa'; }
   'isobaricInhPa' = {typeOfFirstFixedSurface=100; pressureUnits='hPa'; typeOfSecondFixedSurface=255;}
diff --git a/definitions/grib2/units.def b/definitions/grib2/units.def
index e49ef62..dfba3ea 100644
--- a/definitions/grib2/units.def
+++ b/definitions/grib2/units.def
@@ -501,6 +501,26 @@
 	 parameterCategory = 0 ;
 	 parameterNumber = 15 ;
 	}
+#Mean discharge in the last 6 hours
+'m**3 s**-1' = {
+	 discipline = 1 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 7 ;
+	 lengthOfTimeRange = 6 ;
+	 typeOfFirstFixedSurface = 1 ;
+	 indicatorOfUnitForTimeRange = 1 ;
+	 typeOfStatisticalProcessing = 0 ;
+	}
+#Mean discharge in the last 24 hours
+'m**3 s**-1' = {
+	 discipline = 1 ;
+	 parameterCategory = 0 ;
+	 parameterNumber = 7 ;
+	 lengthOfTimeRange = 24 ;
+	 indicatorOfUnitForTimeRange = 1 ;
+	 typeOfStatisticalProcessing = 0 ;
+	 typeOfFirstFixedSurface = 1 ;
+	}
 #Snow depth at elevation bands
 'kg m**-2' = {
 	 discipline = 2 ;
diff --git a/definitions/grib3/template.3.20.def b/definitions/grib3/template.3.20.def
index 0404533..c1259e5 100644
--- a/definitions/grib3/template.3.20.def
+++ b/definitions/grib3/template.3.20.def
@@ -36,7 +36,6 @@ meta geography.longitudeOfFirstGridPointInDegrees scale(longitudeOfFirstGridPoin
 alias Lo1 =  longitudeOfFirstGridPoint;
 
 #  Resolution and component flag
-# NOTE 1 NOT FOUND
 flags[1] resolutionAndComponentFlags 'grib2/tables/[tablesVersion]/3.3.table' : dump;
 
 #  LaD - Latitude where Dx and Dy are specified
@@ -46,19 +45,20 @@ meta geography.LaDInDegrees scale(LaD,oneConstant,grib3divider,truncateDegrees)
 alias latitudeWhereDxAndDyAreSpecifiedInDegrees=LaDInDegrees;
 
 #  LoV - orientation of the grid
-# NOTE 2 NOT FOUND
+#  LoV is the longitude value of the meridian which is parallel to the y-axis (or columns of the grid)
+#  along which latitude increases as the y-coordinate increases
 signed[4] orientationOfTheGrid  : edition_specific;
 alias LoV =  orientationOfTheGrid ;
 meta geography.orientationOfTheGridInDegrees scale(orientationOfTheGrid,oneConstant,grib3divider,truncateDegrees) : dump;
 
 #  Dx - X-direction grid length
-# NOTE 3: Grid length is in units of 10-3 m at the latitude specified by LaD
+#  Grid length is in units of 10-3 m at the latitude specified by LaD
 unsigned[4] Dx  : edition_specific;
 meta geography.DxInMetres scale(Dx,one,thousand,truncateDegrees) : dump;
 alias xDirectionGridLength=Dx;
 
 #  Dy - Y-direction grid length
-# NOTE 3: Grid length is in units of 10-3 m at the latitude specified by LaD
+#  Grid length is in units of 10-3 m at the latitude specified by LaD
 unsigned[4] Dy  : edition_specific;
 meta geography.DyInMetres scale(Dy,one,thousand,truncateDegrees) : dump;
 alias yDirectionGridLength=Dy;
@@ -78,6 +78,7 @@ iterator polar_stereographic(numberOfPoints,missingValue,values,
           latitudeOfFirstGridPointInDegrees,longitudeOfFirstGridPointInDegrees,
           southPoleOnProjectionPlane,
           orientationOfTheGridInDegrees,
+          LaDInDegrees,
           DxInMetres,DyInMetres,
           iScansNegatively,
           jScansPositively,
diff --git a/definitions/grib3/template.component.4.1.def b/definitions/grib3/template.component.4.1.def
index f66b49b..c308129 100644
--- a/definitions/grib3/template.component.4.1.def
+++ b/definitions/grib3/template.component.4.1.def
@@ -124,7 +124,7 @@ alias DyInDegrees = jDirectionIncrementInDegrees;
 #  iterator latlon(numberOfPoints,missingValue,values,
 #                  longitudeFirstInDegrees,DiInDegrees  ,
 #                  Ni,Nj,iScansNegatively,
-#                  latitudeFirstInDegrees, DjInDegrees,jScansPositively);
+#                  latitudeFirstInDegrees, DjInDegrees,jScansPositively,jPointsAreConsecutive);
 #  nearest regular(values,radius,Ni,Nj);
 #}
 meta latLonValues latlonvalues(values);
diff --git a/examples/C/bufr_clone.c b/examples/C/bufr_clone.c
index 621bc11..e82c589 100644
--- a/examples/C/bufr_clone.c
+++ b/examples/C/bufr_clone.c
@@ -18,7 +18,7 @@
 #include <stdio.h>
 #include "eccodes.h"
 
-void usage(char *app)
+static void usage(const char *app)
 {
     fprintf(stderr,"Usage is: %s input_file ouput_file\n", app);
 }
diff --git a/examples/C/bufr_copy_data.c b/examples/C/bufr_copy_data.c
index d81cc56..f9f186e 100644
--- a/examples/C/bufr_copy_data.c
+++ b/examples/C/bufr_copy_data.c
@@ -98,7 +98,7 @@ int main(int argc, char *argv[])
             printf("Copied %s\n",keys[i]);
             free(keys[i]);
         }
-        printf("Total number of copied keys = %ld\n", nkeys);
+        printf("Total number of copied keys = %lu\n", nkeys);
         free(keys);
 
         codes_handle_delete(h);
diff --git a/examples/C/bufr_expanded.c b/examples/C/bufr_expanded.c
index be1f204..0f221c2 100644
--- a/examples/C/bufr_expanded.c
+++ b/examples/C/bufr_expanded.c
@@ -17,7 +17,7 @@
 
 #include "eccodes.h"
 
-void usage(char* prog) {
+static void usage(const char* prog) {
     printf("usage: %s infile\n",prog);
     exit(1);
 }
@@ -57,7 +57,7 @@ int main(int argc,char* argv[])
 
         /* get the size of the values array*/
         CODES_CHECK(codes_get_size(h, "numericValues", &values_len),0);
-        printf("  number of expanded values: %ld\n", values_len);
+        printf("  number of expanded values: %lu\n", values_len);
 
         /* allocate array for data values */
         values = (double*)malloc(values_len*sizeof(double));
diff --git a/examples/C/bufr_keys_iterator.c b/examples/C/bufr_keys_iterator.c
index b87fbb2..b65718e 100644
--- a/examples/C/bufr_keys_iterator.c
+++ b/examples/C/bufr_keys_iterator.c
@@ -21,7 +21,7 @@
 
 #define MAX_VAL_LEN  1024
 
-void usage(char* prog) {
+static void usage(const char* prog) {
     printf("usage: %s infile\n",prog);
     exit(1);
 }
@@ -94,7 +94,7 @@ int main(int argc,char* argv[])
             }
             else {
                 /* for arrays */
-                printf("(array of %ld)\n",klen);
+                printf("(array of %lu)\n",klen);
             }
         }
 
diff --git a/examples/C/bufr_read_header.c b/examples/C/bufr_read_header.c
index 0cbb46b..553d020 100644
--- a/examples/C/bufr_read_header.c
+++ b/examples/C/bufr_read_header.c
@@ -17,7 +17,7 @@
 
 #include "eccodes.h"
 
-void usage(char* prog) {
+static void usage(const char* prog) {
     printf("usage: %s infile\n",prog);
     exit(1);
 }
diff --git a/examples/C/bufr_read_synop.c b/examples/C/bufr_read_synop.c
index 71f0cf4..130e372 100644
--- a/examples/C/bufr_read_synop.c
+++ b/examples/C/bufr_read_synop.c
@@ -24,11 +24,6 @@
 
 #include "eccodes.h"
 
-void usage(char* prog) {
-    printf("usage: %s infile\n",prog);
-    exit(1);
-}
-
 int main(int argc,char* argv[])
 {
     FILE* in = NULL;
diff --git a/examples/C/bufr_read_temp.c b/examples/C/bufr_read_temp.c
index d108936..4511f77 100644
--- a/examples/C/bufr_read_temp.c
+++ b/examples/C/bufr_read_temp.c
@@ -78,7 +78,7 @@ int main(int argc,char* argv[])
         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);
+        printf("Number of T significant levels: %lu\n",sigt_len);
 
         /* Allocate memory for the values to be read. Each
          * parameter must have the same number of values. */
@@ -89,15 +89,13 @@ int main(int argc,char* argv[])
 
         /* 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 geopotential */
         sprintf(key_name,"/verticalSoundingSignificance=4/nonCoordinateGeopotential");
 
-        /* Check the size*/
+        /* Check the size */
         CODES_CHECK(codes_get_size(h,key_name,&len),0);
         if(len != sigt_len)
         {
@@ -109,29 +107,25 @@ int main(int argc,char* argv[])
         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)
+        if(len != sigt_len) /* Check the size */
         {
             printf("inconsistent number of temperature values found!\n");
             return 1;
         }
 
         /* Get the values */
+        sprintf(key_name,"/verticalSoundingSignificance=4/airTemperature");
         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)
+        if(len != sigt_len) /* Check the size */
         {
             printf("inconsistent number of dewpoint temperature values found!\n");
             return 1;
         }
 
         /* Get the values */
+        sprintf(key_name,"/verticalSoundingSignificance=4/dewpointTemperature");
         CODES_CHECK(codes_get_double_array(h,key_name,sigt_td,&len),0);
 
         /* Print the values */
@@ -140,7 +134,7 @@ int main(int argc,char* argv[])
 
         for(i=0; i < sigt_len; i++)
         {
-            printf("%3ld %6.0f %6.0f %.1f %.1f\n",
+            printf("%3lu %6.0f %6.0f %.1f %.1f\n",
                     i+1,sigt_pres[i],sigt_geo[i],sigt_t[i],sigt_td[i]);
         }
 
diff --git a/examples/C/bufr_set_keys.c b/examples/C/bufr_set_keys.c
index 7c91604..5c2694c 100644
--- a/examples/C/bufr_set_keys.c
+++ b/examples/C/bufr_set_keys.c
@@ -17,7 +17,7 @@
 
 #include "eccodes.h"
 
-void usage(char* prog) {
+static void usage(const char* prog) {
     printf("usage: %s infile\n",prog);
     exit(1);
 }
diff --git a/examples/C/bufr_subset.c b/examples/C/bufr_subset.c
index 7877630..f742d57 100644
--- a/examples/C/bufr_subset.c
+++ b/examples/C/bufr_subset.c
@@ -17,11 +17,6 @@
 
 #include "eccodes.h"
 
-void usage(char* prog) {
-    printf("usage: %s infile\n",prog);
-    exit(1);
-}
-
 int main(int argc,char* argv[])
 {
     char key[200]={0,};
diff --git a/examples/C/get_product_kind.c b/examples/C/get_product_kind.c
index f37a465..5c19a5e 100644
--- a/examples/C/get_product_kind.c
+++ b/examples/C/get_product_kind.c
@@ -15,7 +15,7 @@
  *              and print the kind of product (e.g. GRIB, BUFR etc)
  */
 #include "eccodes.h"
-void usage(const char *app)
+static void usage(const char *app)
 {
     fprintf(stderr,"Usage: %s file\n", app);
 }
diff --git a/examples/C/grib_clone.c b/examples/C/grib_clone.c
index 72bb2fa..7a10f55 100644
--- a/examples/C/grib_clone.c
+++ b/examples/C/grib_clone.c
@@ -18,7 +18,7 @@
 #include <stdio.h>
 #include "eccodes.h"
 
-void usage(char *app)
+static void usage(const char *app)
 {
     fprintf(stderr,"Usage is: %s input_file ouput_file\n", app);
 }
diff --git a/examples/C/grib_copy_message.c b/examples/C/grib_copy_message.c
index 64a106e..cebbf9a 100644
--- a/examples/C/grib_copy_message.c
+++ b/examples/C/grib_copy_message.c
@@ -18,9 +18,9 @@
 #include "eccodes.h"
 #include <assert.h>
 
-void usage(char *app)
+static void usage(const char *prog)
 {
-    fprintf(stderr,"Usage is: %s input_file ouput_file\n", app);
+    fprintf(stderr,"Usage is: %s input_file ouput_file\n", prog);
 }
 
 int main(int argc, char *argv[])
diff --git a/examples/C/grib_ensemble_index.c b/examples/C/grib_ensemble_index.c
index 0524671..ae71296 100644
--- a/examples/C/grib_ensemble_index.c
+++ b/examples/C/grib_ensemble_index.c
@@ -39,7 +39,7 @@ int main(int argc, char * argv[])
 
     /* get size of "paramId" list */
     CODES_CHECK(codes_index_get_size(index, "paramId", &paramIdSize),0);
-    printf("grib contains %ld different parameters\n",paramIdSize);
+    printf("grib contains %lu different parameters\n",paramIdSize);
     /* allocate memory for "paramId" list */
     paramId = (char**) malloc(paramIdSize * sizeof(char*));
     /* get list of "paramId" */
@@ -47,7 +47,7 @@ int main(int argc, char * argv[])
 
     /* get size of ensemble number list */
     CODES_CHECK(codes_index_get_size(index, "number", &numberSize),0);
-    printf("GRIB contains %ld different ensemble members\n",numberSize);
+    printf("GRIB contains %lu different ensemble members\n",numberSize);
     /* allocate memory for ensemble number list */
     number = (long*) malloc(numberSize * sizeof(long));
     /* get list of ensemble numbers */
diff --git a/examples/C/grib_index.c b/examples/C/grib_index.c
index 69b4808..1387128 100644
--- a/examples/C/grib_index.c
+++ b/examples/C/grib_index.c
@@ -17,7 +17,7 @@
 
 #include "eccodes.h"
 
-void usage(char* prog) {
+static void usage(const char* prog) {
     printf("usage: %s infile\n",prog);
     exit(1);
 }
diff --git a/examples/C/grib_iterator.c b/examples/C/grib_iterator.c
index e41e526..1e12159 100644
--- a/examples/C/grib_iterator.c
+++ b/examples/C/grib_iterator.c
@@ -21,7 +21,7 @@
 
 #include "eccodes.h"
 
-void usage(const char* prog) {
+static void usage(const char* prog) {
     printf("Usage: %s grib_file\n",prog);
     exit(1);
 }
diff --git a/examples/C/grib_iterator_bitmap.c b/examples/C/grib_iterator_bitmap.c
index 6091a37..b98c854 100644
--- a/examples/C/grib_iterator_bitmap.c
+++ b/examples/C/grib_iterator_bitmap.c
@@ -20,7 +20,7 @@
 #include <assert.h>
 #include "eccodes.h"
 
-void usage(char* prog)
+static void usage(const char* prog)
 {
     printf("Usage: %s grib_file\n",prog);
     exit(1);
@@ -58,7 +58,7 @@ int main(int argc, char** argv)
             CODES_CHECK(codes_get_size(h,"bitmap",&bmp_len),0);
             bitmap = (long*)malloc(bmp_len*sizeof(long));
             CODES_CHECK(codes_get_long_array(h,"bitmap",bitmap,&bmp_len),0);
-            printf("Bitmap is present. Num = %ld\n", bmp_len);
+            printf("Bitmap is present. Num = %lu\n", bmp_len);
         }
         /* Sanity check. Number of values must match number in bitmap */
         CODES_CHECK(codes_get_size(h,"values",&values_len),0);
diff --git a/examples/C/grib_multi_write.c b/examples/C/grib_multi_write.c
index 474a1a7..cd8e474 100644
--- a/examples/C/grib_multi_write.c
+++ b/examples/C/grib_multi_write.c
@@ -19,7 +19,7 @@
 #include <assert.h>
 #include "eccodes.h"
 
-void usage(const char* prog) {
+static void usage(const char* prog) {
     printf("usage: %s in.grib out.grib\n",prog);
     exit(1);
 }
diff --git a/examples/C/grib_nearest.c b/examples/C/grib_nearest.c
index cedc1ed..6d7fee4 100644
--- a/examples/C/grib_nearest.c
+++ b/examples/C/grib_nearest.c
@@ -20,7 +20,7 @@
 
 #include "eccodes.h"
 
-void usage(const char* prog) {
+static void usage(const char* prog) {
     printf("Usage: %s grib_file grib_file ...\n",prog);
     exit(1);
 }
diff --git a/examples/C/grib_print_data.c b/examples/C/grib_print_data.c
index 91d622e..eafd4df 100644
--- a/examples/C/grib_print_data.c
+++ b/examples/C/grib_print_data.c
@@ -19,7 +19,7 @@
 
 #include "eccodes.h"
 
-void usage(const char* prog) {
+static void usage(const char* prog) {
     printf("usage: %s filename\n",prog);
     exit(1);
 }
@@ -72,7 +72,7 @@ int main(int argc, char** argv)
 
     {
         /* Example of accessing specific elements from data values */
-        int i=0;
+        i=0;
         double vals_arr[3] = {0, 0, 0};
         const int NUM = 3;
         int index_arr[3];
diff --git a/examples/C/grib_set_data.c b/examples/C/grib_set_data.c
index a9cf47e..1d43897 100644
--- a/examples/C/grib_set_data.c
+++ b/examples/C/grib_set_data.c
@@ -21,7 +21,7 @@
 
 #include "eccodes.h"
 
-void usage(const char* prog)
+static void usage(const char* prog)
 {
     printf("usage: %s out.grib\n",prog);
     exit(1);
diff --git a/examples/C/grib_set_pv.c b/examples/C/grib_set_pv.c
index c29cc38..c84ec26 100644
--- a/examples/C/grib_set_pv.c
+++ b/examples/C/grib_set_pv.c
@@ -19,7 +19,7 @@
 #include <assert.h>
 #include "eccodes.h"
 
-void usage(const char* prog) {
+static void usage(const char* prog) {
     fprintf(stderr, "usage: %s in out\n",prog);
     exit(1);
 }
diff --git a/examples/C/multi2.c b/examples/C/multi2.c
index adc2bea..76ee692 100644
--- a/examples/C/multi2.c
+++ b/examples/C/multi2.c
@@ -21,27 +21,11 @@
 #include <stdlib.h>
 #include <assert.h>
 
-void read_data(int num_msgs);
-
 const int NUM_FIELDS = 4;
 const int COUNT = 20;
 const char* file_path = "../../data/multi_created.grib2";
 
-int main(int argc, char** argv)
-{
-    int i;
-
-    /* turn on support for multi fields messages */
-    codes_grib_multi_support_on(0);
-
-    for(i=1; i<COUNT; ++i) {
-        printf("Pass %d: \n",i);
-        read_data(NUM_FIELDS);
-    }
-    return 0;
-}
-
-void read_data(int num_msgs)
+static void read_data(int num_msgs)
 {
     int err = 0,i;
     FILE* fp = NULL;
@@ -72,3 +56,17 @@ void read_data(int num_msgs)
     codes_grib_multi_support_reset_file(codes_context_get_default(), fp);
     fclose(fp);
 }
+
+int main(int argc, char** argv)
+{
+    int i;
+
+    /* turn on support for multi fields messages */
+    codes_grib_multi_support_on(0);
+
+    for(i=1; i<COUNT; ++i) {
+        printf("Pass %d: \n",i);
+        read_data(NUM_FIELDS);
+    }
+    return 0;
+}
diff --git a/examples/C/new_sample.c b/examples/C/new_sample.c
index 239e08f..7fef43b 100644
--- a/examples/C/new_sample.c
+++ b/examples/C/new_sample.c
@@ -12,8 +12,7 @@
 
 /* This code was generated automatically */
 
-
-int main(int argc,const char** argv)
+int main(int argc, char** argv)
 {
     codes_handle *h     = NULL;
     size_t size        = 0;
diff --git a/examples/C/sections_copy.c b/examples/C/sections_copy.c
index 974ace7..f676ec7 100644
--- a/examples/C/sections_copy.c
+++ b/examples/C/sections_copy.c
@@ -10,7 +10,7 @@
 #include "eccodes.h"
 #include <ctype.h>
 
-void usage(char* prog) {
+static void usage(const char* prog) {
     printf("usage: %s in1.grib in2.grib what out.grib\n",prog);
     printf("in1.grib   The grib in whose sections we are interested, i.e. the source of the sections (read-only)\n");
     printf("in2.grib   The input grib (read-only)\n");
diff --git a/examples/F90/get_set_uuid.f90 b/examples/F90/get_set_uuid.f90
index 4e25780..e6aeae9 100644
--- a/examples/F90/get_set_uuid.f90
+++ b/examples/F90/get_set_uuid.f90
@@ -33,44 +33,44 @@ program get_set_uuid
   uuid_string_expected = '08b1e836bc6911e1951fb51b5624ad8d'
   count1 = 0
   do while (iret/=CODES_END_OF_FILE)
-     count1 = count1 + 1
-     print *, "### Record:", count1
-     call codes_get(igrib,'typeOfFirstFixedSurface',ffs)
-     print *, 'typeOfFirstFixedSurface =', ffs
-     if (ffs /= 150) then
-        print *, "Unexpected typeOfFirstFixedSurface (must be 150)."
-        stop
-     end if
+    count1 = count1 + 1
+    print *, "### Record:", count1
+    call codes_get(igrib,'typeOfFirstFixedSurface',ffs)
+    print *, 'typeOfFirstFixedSurface =', ffs
+    if (ffs /= 150) then
+      print *, "Unexpected typeOfFirstFixedSurface (must be 150)."
+      stop
+    end if
 
-     call codes_get (igrib,'numberOfVGridUsed',nvg)
-     print *, 'numberOfVGridUsed       =',nvg
+    call codes_get (igrib,'numberOfVGridUsed',nvg)
+    print *, 'numberOfVGridUsed       =',nvg
 
-!    call codes_get (igrib,'uuidOfVGrid',uuid_in)  ! Assuming length is ok.
-     call codes_get (igrib,'uuidOfVGrid',uuid_in,length=length)
-     if (length /= 16) then
-        print *, "Sorry, bad length of byte_array:", length, ". Expected: 16"
-        stop
-     end if
+    ! call codes_get (igrib,'uuidOfVGrid',uuid_in)  ! Assuming length is ok.
+    call codes_get (igrib,'uuidOfVGrid',uuid_in,length=length)
+    if (length /= 16) then
+      print *, "Sorry, bad length of byte_array:", length, ". Expected: 16"
+      stop
+    end if
 
-     ! Convert byte array to hexadecimal string for printing
-     do i = 1, size (uuid_in)
-        uuid_string(2*i-1:2*i) = byte2hex(uuid_in(i))
-     end do
-     print *, "uuidOfVGrid  (on input) = ", uuid_string
-     if (uuid_string .ne. uuid_string_expected) then
-        print *, "Sorry, bad value of byte_array. Expected: ", uuid_string_expected
-        stop
-     end if
+    ! Convert byte array to hexadecimal string for printing
+    do i = 1, size (uuid_in)
+      uuid_string(2*i-1:2*i) = byte2hex(uuid_in(i))
+    end do
+    print *, "uuidOfVGrid  (on input) = ", uuid_string
+    if (uuid_string .ne. uuid_string_expected) then
+      print *, "Sorry, bad value of byte_array. Expected: ", uuid_string_expected
+      stop
+    end if
 
-     call codes_clone (igrib,ogrib)
-     ! On output we write a modified uuid (here the input is simply reversed)
-     uuid_out(1:16) = uuid_in(16:1:-1)
-     call codes_set   (ogrib,'uuidOfVGrid',uuid_out)
-     call codes_write (ogrib,outfile)
+    call codes_clone (igrib,ogrib)
+    ! On output we write a modified uuid (here the input is simply reversed)
+    uuid_out(1:16) = uuid_in(16:1:-1)
+    call codes_set   (ogrib,'uuidOfVGrid',uuid_out)
+    call codes_write (ogrib,outfile)
 
-     call codes_release (igrib)
-     call codes_release (ogrib)
-     call codes_grib_new_from_file (infile, igrib, iret)
+    call codes_release (igrib)
+    call codes_release (ogrib)
+    call codes_grib_new_from_file (infile, igrib, iret)
   end do
 
   call codes_close_file (infile)
diff --git a/examples/F90/grib_keys_iterator.f90 b/examples/F90/grib_keys_iterator.f90
index ce8d1b3..24172bb 100644
--- a/examples/F90/grib_keys_iterator.f90
+++ b/examples/F90/grib_keys_iterator.f90
@@ -9,7 +9,7 @@
 !
 !  Description:
 !       How to use keys_iterator to get all the available
-!       keys in a message.
+!       keys in a GRIB message.
 !
 !
 !
@@ -43,7 +43,7 @@ program keys_iterator
     do
       call codes_keys_iterator_next(kiter, iret)
 
-      if (iret .ne. CODES_SUCCESS) exit
+      if (iret .ne. CODES_SUCCESS) exit !terminate the loop
 
       call codes_keys_iterator_get_name(kiter,key)
       call codes_get(igrib,trim(key),value)
@@ -61,4 +61,3 @@ program keys_iterator
   call codes_close_file(ifile)
 
 end program keys_iterator
-
diff --git a/examples/F90/new_from_file.f90 b/examples/F90/new_from_file.f90
index cb54015..4ddfb9c 100644
--- a/examples/F90/new_from_file.f90
+++ b/examples/F90/new_from_file.f90
@@ -8,8 +8,6 @@
 !
 !
 !
-!
-!
 program new_from_file
 use eccodes
   implicit none
@@ -17,15 +15,14 @@ use eccodes
   integer           :: iret
   integer           :: count1=0
 
-!     Message identifier.
+  ! Message identifier.
   integer            :: igrib
 
   ifile=5
 
   call codes_open_file(ifile,'../../data/collection.grib1','r')
 
-! Loop on all the messages in a file.
-
+  ! Loop on all the messages in a file.
   call codes_grib_new_from_file(ifile,igrib, iret)
 
   do while (iret==CODES_SUCCESS)
diff --git a/examples/F90/precision_fortran.f90 b/examples/F90/precision_fortran.f90
index 357c66a..acbfc9e 100644
--- a/examples/F90/precision_fortran.f90
+++ b/examples/F90/precision_fortran.f90
@@ -61,14 +61,14 @@ program precision
   maxv=values2(1)
   minv=maxv
   do i=1,size
-     a=abs(values2(i)-values1(i))
-     if ( values2(i) .gt. maxv ) maxv=values2(i)
-     if ( values2(i) .lt. maxv ) minv=values2(i)
-     if ( values2(i) .ne. 0 ) then
-        r=abs((values2(i)-values1(i))/values2(i))
-     endif
-     if ( a .gt. maxa ) maxa=a
-     if ( r .gt. maxr ) maxr=r
+    a=abs(values2(i)-values1(i))
+    if ( values2(i) .gt. maxv ) maxv=values2(i)
+    if ( values2(i) .lt. maxv ) minv=values2(i)
+    if ( values2(i) .ne. 0 ) then
+      r=abs((values2(i)-values1(i))/values2(i))
+    endif
+    if ( a .gt. maxa ) maxa=a
+    if ( r .gt. maxr ) maxr=r
   enddo
   write(*,*) "max absolute error = ",maxa
   write(*,*) "max relative error = ",maxr
@@ -90,4 +90,3 @@ program precision
   deallocate(values1)
   deallocate(values2)
 end program precision
-
diff --git a/examples/python/binary_message.py b/examples/python/binary_message.py
index 26d39dd..ef508c0 100644
--- a/examples/python/binary_message.py
+++ b/examples/python/binary_message.py
@@ -49,5 +49,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/bufr_attributes.py b/examples/python/bufr_attributes.py
index ba34aad..0b0febe 100644
--- a/examples/python/bufr_attributes.py
+++ b/examples/python/bufr_attributes.py
@@ -14,9 +14,9 @@
 #
 #
 
+from __future__ import print_function
 import traceback
 import sys
-
 from eccodes import *
 
 INPUT = '../../data/bufr/syno_multi.bufr'
@@ -24,7 +24,6 @@ VERBOSE = 1  # verbose error reporting
 
 
 def example():
-
     # open bufr file
     f = open(INPUT)
 
@@ -46,7 +45,7 @@ def example():
         if bufr is None:
             break
 
-        print "message: %s" % cnt
+        print("message: %s" % cnt)
 
         # we need to instruct ecCodes to expand all the descriptors
         # i.e. unpack the data values
@@ -59,9 +58,9 @@ def example():
         # get the value
         key = 'airTemperatureAt2M'
         try:
-            print '  %s: %s' % (key, codes_get(bufr, key))
+            print('  %s: %s' % (key, codes_get(bufr, key)))
         except CodesInternalError as err:
-            print 'Error with key="%s" : %s' % (key, err.msg)
+            print('Error with key="%s" : %s' % (key, err.msg))
 
         # print the values of the attributes of the key. Attributes themselves
         # are keys as well. Their name is constructed like:
@@ -69,9 +68,9 @@ def example():
         for attr in attrs:
             key = 'airTemperatureAt2M' + "->" + attr
             try:
-                print '  %s: %s' % (key, codes_get(bufr, key))
+                print('  %s: %s' % (key, codes_get(bufr, key)))
             except CodesInternalError as err:
-                print 'Error with key="%s" : %s' % (key, err.msg)
+                print('Error with key="%s" : %s' % (key, err.msg))
 
         # ------------------------------------------------------------------
         # The 2m temperature data element in this message has an associated
@@ -82,17 +81,17 @@ def example():
         # get the value
         key = 'airTemperatureAt2M->percentConfidence'
         try:
-            print '  %s: %s' % (key, codes_get(bufr, key))
+            print('  %s: %s' % (key, codes_get(bufr, key)))
         except CodesInternalError as err:
-            print 'Error with key="%s" : %s' % (key, err.msg)
+            print('Error with key="%s" : %s' % (key, err.msg))
 
         # print the values of the attributes of the key.
         for attr in attrs:
             key = 'airTemperatureAt2M->percentConfidence' + "->" + attr
             try:
-                print '  %s: %s' % (key, codes_get(bufr, key))
+                print('  %s: %s' % (key, codes_get(bufr, key)))
             except CodesInternalError as err:
-                print 'Error with key="%s" : %s' % (key, err.msg)
+                print('Error with key="%s" : %s' % (key, err.msg))
 
         cnt += 1
 
@@ -114,5 +113,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/bufr_clone.py b/examples/python/bufr_clone.py
index b2bf476..43b93da 100644
--- a/examples/python/bufr_clone.py
+++ b/examples/python/bufr_clone.py
@@ -15,6 +15,7 @@
 # an existing message.
 #
 
+from __future__ import absolute_import
 import traceback
 import sys
 
@@ -24,8 +25,8 @@ INPUT = '../../data/bufr/syno_1.bufr'
 OUTPUT = 'bufr_clone_test_p.clone.bufr'
 VERBOSE = 1  # verbose error reporting
 
-def example():
 
+def example():
     # open BUFR file
     fin = open(INPUT)
 
@@ -38,7 +39,6 @@ def example():
     # create several clones of this message and alter them
     # in different ways
     for centre in range(0, 3):
-
         # clone the message
         clone_id = codes_clone(bufr)
 
@@ -69,5 +69,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/bufr_copy_data.py b/examples/python/bufr_copy_data.py
index adf1f0b..7263e9c 100644
--- a/examples/python/bufr_copy_data.py
+++ b/examples/python/bufr_copy_data.py
@@ -13,17 +13,19 @@
 # Description: How to copy all the values in the data section that are present in the same
 #              position in the data tree and with the same number of values to the output handle
 #
+from __future__ import print_function
 import traceback
 import sys
 from eccodes import *
 
 VERBOSE = 1  # verbose error reporting
 
+
 def example(input_filename, output_filename):
     ibufr = codes_new_from_samples('BUFR3', CODES_PRODUCT_BUFR)
     f = open(input_filename)
     ibufrin = codes_bufr_new_from_file(f)
-    ivalues=(
+    ivalues = (
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
@@ -49,15 +51,15 @@ def example(input_filename, output_filename):
     codes_set(ibufr, 'numberOfSubsets', 1)
     codes_set(ibufr, 'observedData', 1)
     codes_set(ibufr, 'compressedData', 0)
-    ivalues=(
-        307011,7006,10004,222000,101023,31031,1031,1032,101023,33007,
-        225000,236000,101023,31031,1031,1032,8024,101001,225255,225000,
-        236000,101023,31031,1031,1032,8024,101001,225255,
-        1063,2001,4001,4002,4003,4004,4005,5002,
-        6002,7001,7006,11001,11016,11017,11002)
+    ivalues = (
+        307011, 7006, 10004, 222000, 101023, 31031, 1031, 1032, 101023, 33007,
+        225000, 236000, 101023, 31031, 1031, 1032, 8024, 101001, 225255, 225000,
+        236000, 101023, 31031, 1031, 1032, 8024, 101001, 225255,
+        1063, 2001, 4001, 4002, 4003, 4004, 4005, 5002,
+        6002, 7001, 7006, 11001, 11016, 11017, 11002)
     codes_set_array(ibufr, 'unexpandedDescriptors', ivalues)
     codes_set(ibufrin, 'unpack', 1)
-    codes_bufr_copy_data(ibufrin, ibufr) # Copy data across
+    codes_bufr_copy_data(ibufrin, ibufr)  # Copy data across
 
     with open(output_filename, 'w') as outfile:
         codes_write(ibufr, outfile)
@@ -67,7 +69,7 @@ def example(input_filename, output_filename):
 
 def main():
     if len(sys.argv) < 3:
-        print >>sys.stderr, 'Usage: ', sys.argv[0], ' bufr_in bufr_out'
+        print('Usage: ', sys.argv[0], ' bufr_in bufr_out', file=sys.stderr)
         sys.exit(1)
 
     input_filename = sys.argv[1]
@@ -83,5 +85,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/bufr_encode_flight.py b/examples/python/bufr_encode_flight.py
index 577b649..de9e26f 100644
--- a/examples/python/bufr_encode_flight.py
+++ b/examples/python/bufr_encode_flight.py
@@ -10,6 +10,7 @@
 
 # Description: how to encode flight dataset into BUFR
 
+from __future__ import print_function
 from datetime import datetime
 import traceback
 import numpy as np
@@ -19,15 +20,15 @@ from eccodes import *
 
 VERBOSE = 1  # verbose error reporting
 
-def example(csvfile, input_filename, output_filename):
 
+def example(csvfile, input_filename, output_filename):
     fbufrin = open(input_filename, 'rb')
     fbufrout = open(output_filename, 'wb')
 
-    print 'Using ecCodes version: ', codes_get_api_version()
+    print('Using ecCodes version: ', codes_get_api_version())
 
     # The first line in the CSV has the column names
-    print 'Reading input CSV file: ', csvfile
+    print('Reading input CSV file: ', csvfile)
     parse_date = lambda x: datetime.strptime(x, '%Y%m%d')
     parse_time = lambda x: datetime.strptime(x, '%H:%M:%S')
     data = np.genfromtxt(csvfile, delimiter=',', dtype=None, names=True,
@@ -51,7 +52,7 @@ def example(csvfile, input_filename, output_filename):
     windDirections = data['windDirection']
     temperatures = data['temperature']
 
-    print 'Reading input BUFR file: ', input_filename
+    print('Reading input BUFR file: ', input_filename)
     bufr = codes_bufr_new_from_file(fbufrin)
 
     codes_set(bufr, 'masterTablesVersionNumber', 24)
@@ -62,10 +63,10 @@ def example(csvfile, input_filename, output_filename):
     # unexpandedDescriptors and BufrTemplate can be set alternatively
     # to choose the template for the BUFR message
 
-    #unexpandedDescriptors = [301051,4006,7002,10004,12001,11001,11002,11031,11032,11033,20041]
-    #codes_set_array(bufr, 'unexpandedDescriptors', unexpandedDescriptors)
+    # unexpandedDescriptors = [301051,4006,7002,10004,12001,11001,11002,11031,11032,11033,20041]
+    # codes_set_array(bufr, 'unexpandedDescriptors', unexpandedDescriptors)
 
-    codes_set(bufr,'BufrTemplate','aircraftReportWithSecondsAndPressure')
+    codes_set(bufr, 'BufrTemplate', 'aircraftReportWithSecondsAndPressure')
 
     codes_set_array(bufr, 'year', years)
     codes_set_array(bufr, 'month', months)
@@ -84,12 +85,12 @@ def example(csvfile, input_filename, output_filename):
     codes_set(bufr, 'pack', 1)
 
     codes_write(bufr, fbufrout)
-    print 'Created output BUFR file: ', output_filename
+    print('Created output BUFR file: ', output_filename)
 
 
 def main():
     if len(sys.argv) < 4:
-        print >>sys.stderr, 'Usage: ', sys.argv[0], ' csv bufr_in bufr_out'
+        print('Usage: ', sys.argv[0], ' csv bufr_in bufr_out', file=sys.stderr)
         sys.exit(1)
 
     csv_filename = sys.argv[1]
@@ -106,5 +107,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/bufr_expanded.py b/examples/python/bufr_expanded.py
index 1e2e4c6..d318a68 100644
--- a/examples/python/bufr_expanded.py
+++ b/examples/python/bufr_expanded.py
@@ -14,6 +14,8 @@
 #
 #
 
+from __future__ import absolute_import
+from __future__ import print_function
 import traceback
 import sys
 
@@ -24,7 +26,6 @@ VERBOSE = 1  # verbose error reporting
 
 
 def example():
-
     # open bufr file
     f = open(INPUT)
 
@@ -37,7 +38,7 @@ def example():
         if bufr is None:
             break
 
-        print "message: %s" % cnt
+        print("message: %s" % cnt)
 
         # we need to instruct ecCodes to expand all the descriptors
         # i.e. unpack the data values
@@ -50,12 +51,12 @@ def example():
 
         # get size
         num = codes_get_size(bufr, key)
-        print '  size of %s is: %s' % (key, num)
+        print('  size of %s is: %s' % (key, num))
 
         # get values
         values = codes_get_array(bufr, key)
-        for i in xrange(len(values)):
-            print "   %d %.10e" % (i + 1, values[i])
+        for i in range(len(values)):
+            print("   %d %.10e" % (i + 1, values[i]))
 
         cnt += 1
 
@@ -77,5 +78,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/bufr_get_keys.py b/examples/python/bufr_get_keys.py
index 13f084c..507d66a 100644
--- a/examples/python/bufr_get_keys.py
+++ b/examples/python/bufr_get_keys.py
@@ -14,6 +14,7 @@
 #
 #
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -24,7 +25,6 @@ VERBOSE = 1  # verbose error reporting
 
 
 def example():
-
     # open bufr file
     f = open(INPUT)
 
@@ -37,7 +37,7 @@ def example():
         if bufr is None:
             break
 
-        print "message: %s" % cnt
+        print("message: %s" % cnt)
 
         # we need to instruct ecCodes to expand all the descriptors
         # i.e. unpack the data values
@@ -50,30 +50,30 @@ def example():
         key = 'blockNumber'
 
         try:
-            print '  %s: %s' % (key, codes_get(bufr, key))
+            print('  %s: %s' % (key, codes_get(bufr, key)))
         except CodesInternalError as err:
-            print 'Error with key="%s" : %s' % (key, err.msg)
+            print('Error with key="%s" : %s' % (key, err.msg))
 
         # Native type integer
         key = 'stationNumber'
         try:
-            print '  %s: %s' % (key, codes_get(bufr, key))
+            print('  %s: %s' % (key, codes_get(bufr, key)))
         except CodesInternalError as err:
-            print 'Error with key="%s" : %s' % (key, err.msg)
+            print('Error with key="%s" : %s' % (key, err.msg))
 
         # Native type float
         key = 'airTemperatureAt2M'
         try:
-            print '  %s: %s' % (key, codes_get(bufr, key))
+            print('  %s: %s' % (key, codes_get(bufr, key)))
         except CodesInternalError as err:
-            print 'Error with key="%s" : %s' % (key, err.msg)
+            print('Error with key="%s" : %s' % (key, err.msg))
 
         # Native type string
         key = 'typicalDate'
         try:
-            print '  %s: %s' % (key, codes_get(bufr, key))
+            print('  %s: %s' % (key, codes_get(bufr, key)))
         except CodesInternalError as err:
-            print 'Error with key="%s" : %s' % (key, err.msg)
+            print('Error with key="%s" : %s' % (key, err.msg))
 
         # --------------------------------
         # get values for an array
@@ -83,24 +83,24 @@ def example():
 
         # get size
         num = codes_get_size(bufr, key)
-        print '  size of %s is: %s' % (key, num)
+        print('  size of %s is: %s' % (key, num))
 
         # get values
         values = codes_get_array(bufr, key)
-        for i in xrange(len(values)):
-            print "   %d %06d" % (i + 1, values[i])
+        for i in range(len(values)):
+            print("   %d %06d" % (i + 1, values[i]))
 
         # Native type float
         key = 'numericValues'
 
         # get size
         num = codes_get_size(bufr, key)
-        print '  size of %s is: %s' % (key, num)
+        print('  size of %s is: %s' % (key, num))
 
         # get values
         values = codes_get_array(bufr, key)
-        for i in xrange(len(values)):
-            print "   %d %.10e" % (i + 1, values[i])
+        for i in range(len(values)):
+            print("   %d %.10e" % (i + 1, values[i]))
 
         cnt += 1
 
@@ -122,5 +122,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/bufr_keys_iterator.py b/examples/python/bufr_keys_iterator.py
index f7e5648..be8d00b 100644
--- a/examples/python/bufr_keys_iterator.py
+++ b/examples/python/bufr_keys_iterator.py
@@ -15,6 +15,7 @@
 #           keys in a BUFR message.
 
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -25,7 +26,6 @@ VERBOSE = 1  # verbose error reporting
 
 
 def example():
-
     # open bufr file
     f = open(INPUT)
 
@@ -38,21 +38,20 @@ def example():
         if bufr is None:
             break
 
-        print "message: %s" % cnt
+        print("message: %s" % cnt)
 
         # we need to instruct ecCodes to expand all the descriptors
         # i.e. unpack the data values
-        codes_set(bufr,'unpack',1)
+        codes_set(bufr, 'unpack', 1)
 
         # get BUFR key iterator
         iterid = codes_bufr_keys_iterator_new(bufr)
 
         # loop over the keys
         while codes_bufr_keys_iterator_next(iterid):
-
             # print key name
             keyname = codes_bufr_keys_iterator_get_name(iterid)
-            print "  %s" % keyname
+            print("  %s" % keyname)
 
         # delete the key iterator
         codes_bufr_keys_iterator_delete(iterid)
@@ -77,5 +76,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/bufr_read_header.py b/examples/python/bufr_read_header.py
index 44e30a8..0d1c434 100644
--- a/examples/python/bufr_read_header.py
+++ b/examples/python/bufr_read_header.py
@@ -15,6 +15,7 @@
 #
 #
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -25,7 +26,6 @@ VERBOSE = 1  # verbose error reporting
 
 
 def example():
-
     # open bufr file
     f = open(INPUT)
 
@@ -50,14 +50,14 @@ def example():
         if bufr is None:
             break
 
-        print "message: %s" % cnt
+        print("message: %s" % cnt)
 
         # print the values for the selected keys from the message
         for key in keys:
             try:
-                print '  %s: %s' % (key, codes_get(bufr, key))
+                print('  %s: %s' % (key, codes_get(bufr, key)))
             except CodesInternalError as err:
-                print 'Error with key="%s" : %s' % (key, err.msg)
+                print('Error with key="%s" : %s' % (key, err.msg))
 
         cnt += 1
 
@@ -79,5 +79,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/bufr_read_scatterometer.py b/examples/python/bufr_read_scatterometer.py
index 95adb15..f862127 100644
--- a/examples/python/bufr_read_scatterometer.py
+++ b/examples/python/bufr_read_scatterometer.py
@@ -19,7 +19,7 @@
 # understand the structure of these messages.
 #
 
-
+from __future__ import print_function
 import traceback
 import sys
 
@@ -30,7 +30,6 @@ VERBOSE = 1  # verbose error reporting
 
 
 def example():
-
     # open bufr file
     f = open(INPUT)
 
@@ -43,7 +42,7 @@ def example():
         if bufr is None:
             break
 
-        print "message: %s" % cnt
+        print("message: %s" % cnt)
 
         # We need to instruct ecCodes to expand all the descriptors
         # i.e. unpack the data values
@@ -60,7 +59,7 @@ def example():
         # Get the total number of subsets.
         numObs = codes_get(bufr, "numberOfSubsets")
 
-        print '  Number of values: %ld' % (numObs)
+        print('  Number of values: %ld' % numObs)
 
         # Get latitude (for all the subsets)
         lat = codes_get_array(bufr, "latitude")
@@ -74,15 +73,15 @@ def example():
 
         # Check that all arrays are same size
         if len(lat) != numObs or len(lon) != numObs or len(bscat) != numObs:
-            print 'inconsistent array dimension'
+            print('inconsistent array dimension')
             return 1
 
         # Print the values
-        print "pixel  lat    lon    backscatter"
-        print "-------------------------------"
+        print("pixel  lat    lon    backscatter")
+        print("-------------------------------")
 
-        for i in xrange(numObs):
-            print "%3d %.2f %.2f %.2f" % (i + 1, lat[i], lon[i], bscat[i])
+        for i in range(numObs):
+            print("%3d %.2f %.2f %.2f" % (i + 1, lat[i], lon[i], bscat[i]))
 
         cnt += 1
 
@@ -104,5 +103,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/bufr_read_synop.py b/examples/python/bufr_read_synop.py
index fd7bad3..116159d 100644
--- a/examples/python/bufr_read_synop.py
+++ b/examples/python/bufr_read_synop.py
@@ -18,6 +18,7 @@
 # messages than the one used in the example. It is advised to use bufr_dump to
 # understand the structure of the messages.
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -28,7 +29,6 @@ VERBOSE = 1  # verbose error reporting
 
 
 def example():
-
     # open bufr file
     f = open(INPUT)
 
@@ -67,7 +67,7 @@ def example():
         if bufr is None:
             break
 
-        print "message: %s" % cnt
+        print("message: %s" % cnt)
 
         # we need to instruct ecCodes to expand all the descriptors
         # i.e. unpack the data values
@@ -76,9 +76,9 @@ def example():
         # print the values for the selected keys from the message
         for key in keys:
             try:
-                print '  %s: %s' % (key, codes_get(bufr, key))
+                print('  %s: %s' % (key, codes_get(bufr, key)))
             except CodesInternalError as err:
-                print 'Error with key="%s" : %s' % (key, err.msg)
+                print('Error with key="%s" : %s' % (key, err.msg))
 
         cnt += 1
 
@@ -100,5 +100,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/bufr_read_temp.py b/examples/python/bufr_read_temp.py
index 7d2b9f5..2eea409 100644
--- a/examples/python/bufr_read_temp.py
+++ b/examples/python/bufr_read_temp.py
@@ -19,6 +19,7 @@
 # messages than the one used in the example. It is advised to use bufr_dump to
 # understand the structure of the messages.
 #
+from __future__ import print_function
 import traceback
 import sys
 from eccodes import *
@@ -26,6 +27,7 @@ from eccodes import *
 INPUT = '../../data/bufr/PraticaTemp.bufr'
 VERBOSE = 1  # verbose error reporting
 
+
 def example():
     # open bufr file
     f = open(INPUT)
@@ -36,7 +38,7 @@ def example():
         bufr = codes_bufr_new_from_file(f)
         if bufr is None:
             break
-        print "message: %s" % cnt
+        print("message: %s" % cnt)
         # we need to instruct ecCodes to expand all the descriptors
         # i.e. unpack the data section
         codes_set(bufr, 'unpack', 1)
@@ -53,16 +55,19 @@ def example():
         windSpeed = codes_get_array(bufr, "windSpeed")
         blockNumber = codes_get(bufr, "blockNumber")
         stationNumber = codes_get(bufr, "stationNumber")
-        print 'station %d%d' % (blockNumber,stationNumber)
-        print 'timePeriod pressure geopotentialHeight latitudeDisplacement longitudeDisplacement airTemperature windDirection windSpeed significance'
-        for i in range(0,len(windSpeed)-1):
-            print timePeriod[i],pressure[i],geopotentialHeight[i],latitudeDisplacement[i],longitudeDisplacement[i],airTemperature[i],windDirection[i],windSpeed[i],extendedVerticalSoundingSignificance[i]
+        print('station %d%d' % (blockNumber, stationNumber))
+        print(
+            'timePeriod pressure geopotentialHeight latitudeDisplacement longitudeDisplacement airTemperature windDirection windSpeed significance')
+        for i in range(0, len(windSpeed) - 1):
+            print(timePeriod[i], pressure[i], geopotentialHeight[i], latitudeDisplacement[i], longitudeDisplacement[i],
+                  airTemperature[i], windDirection[i], windSpeed[i], extendedVerticalSoundingSignificance[i])
         cnt += 1
         # delete handle
         codes_release(bufr)
     # close the file
     f.close()
 
+
 def main():
     try:
         example()
@@ -72,6 +77,7 @@ def main():
         else:
             sys.stderr.write(err.msg + '\n')
         return 1
+
+
 if __name__ == "__main__":
     sys.exit(main())
-
diff --git a/examples/python/bufr_read_tropical_cyclone.py b/examples/python/bufr_read_tropical_cyclone.py
index 8b3281b..dffcb31 100644
--- a/examples/python/bufr_read_tropical_cyclone.py
+++ b/examples/python/bufr_read_tropical_cyclone.py
@@ -11,6 +11,7 @@
 # Description: how to read data of the ECMWF EPS tropical cyclone tracks encoded in BUFR format.
 #
 
+from __future__ import print_function
 import traceback
 import sys
 import collections
@@ -20,12 +21,10 @@ from eccodes import *
 INPUT = '../../data/bufr/tropical_cyclone.bufr'
 VERBOSE = 1  # verbose error reporting
 
-
-data=collections.defaultdict(dict)
+data = collections.defaultdict(dict)
 
 
 def example():
-
     # open BUFR file
     f = open(INPUT)
 
@@ -38,148 +37,149 @@ def example():
         if bufr is None:
             break
 
-        print '**************** MESSAGE: ',cnt+1,'  *****************'
+        print('**************** MESSAGE: ', cnt + 1, '  *****************')
 
         # we need to instruct ecCodes to expand all the descriptors
         # i.e. unpack the data values
         codes_set(bufr, 'unpack', 1)
 
-        numObs= codes_get(bufr, "numberOfSubsets")
-        year  = codes_get(bufr, "year")
+        numObs = codes_get(bufr, "numberOfSubsets")
+        year = codes_get(bufr, "year")
         month = codes_get(bufr, "month")
-        day   = codes_get(bufr, "day")
-        hour  = codes_get(bufr, "hour")
-        minute= codes_get(bufr, "minute")
+        day = codes_get(bufr, "day")
+        hour = codes_get(bufr, "hour")
+        minute = codes_get(bufr, "minute")
 
-        print 'Date and time: ',  day,'.',month,'.',year,'  ',hour,':',minute
+        print('Date and time: ', day, '.', month, '.', year, '  ', hour, ':', minute)
 
-        stormIdentifier =  codes_get(bufr,"stormIdentifier")
-        print  'Storm identifier: ', stormIdentifier
+        stormIdentifier = codes_get(bufr, "stormIdentifier")
+        print('Storm identifier: ', stormIdentifier)
 
         # How many different timePeriod in the data structure?
-        numberOfPeriods=0
+        numberOfPeriods = 0
         while True:
-            numberOfPeriods=numberOfPeriods+1
+            numberOfPeriods = numberOfPeriods + 1
             try:
-                codes_get_array(bufr,"#%d#timePeriod" %numberOfPeriods)
+                codes_get_array(bufr, "#%d#timePeriod" % numberOfPeriods)
             except CodesInternalError as err:
                 break
-            #the numberOfPeriods includes the analysis (period=0)
+                # the numberOfPeriods includes the analysis (period=0)
 
         # Get ensembleMemberNumber
         memberNumber = codes_get_array(bufr, "ensembleMemberNumber")
-        memberNumberLen=len(memberNumber)
+        memberNumberLen = len(memberNumber)
 
         # Observed Storm Centre
-        significance    = codes_get(bufr,'#1#meteorologicalAttributeSignificance')
-        latitudeCentre  = codes_get(bufr,'#1#latitude')
-        longitudeCentre = codes_get(bufr,'#1#longitude')
+        significance = codes_get(bufr, '#1#meteorologicalAttributeSignificance')
+        latitudeCentre = codes_get(bufr, '#1#latitude')
+        longitudeCentre = codes_get(bufr, '#1#longitude')
 
-        if significance!=1:
-            print 'ERROR: unexpected #1#meteorologicalAttributeSignificance'
+        if significance != 1:
+            print('ERROR: unexpected #1#meteorologicalAttributeSignificance')
             return 1
 
-        if (latitudeCentre==CODES_MISSING_DOUBLE) and (longitudeCentre==CODES_MISSING_DOUBLE):
-            print 'Observed storm centre position missing'
+        if (latitudeCentre == CODES_MISSING_DOUBLE) and (longitudeCentre == CODES_MISSING_DOUBLE):
+            print('Observed storm centre position missing')
         else:
-            print 'Observed storm centre: latitude=',latitudeCentre,' longitude=',longitudeCentre
+            print('Observed storm centre: latitude=', latitudeCentre, ' longitude=', longitudeCentre)
 
         # Location of storm in perturbed analysis
-        significance = codes_get(bufr,'#2#meteorologicalAttributeSignificance')
+        significance = codes_get(bufr, '#2#meteorologicalAttributeSignificance')
 
-        if significance!=4:
-            print 'ERROR: unexpected #2#meteorologicalAttributeSignificance'
+        if significance != 4:
+            print('ERROR: unexpected #2#meteorologicalAttributeSignificance')
             return 1
 
-        latitudeAnalysis = codes_get_array(bufr,'#2#latitude')
-        longitudeAnalysis = codes_get_array(bufr,'#2#longitude')
-        pressureAnalysis = codes_get_array(bufr,'#1#pressureReducedToMeanSeaLevel')
+        latitudeAnalysis = codes_get_array(bufr, '#2#latitude')
+        longitudeAnalysis = codes_get_array(bufr, '#2#longitude')
+        pressureAnalysis = codes_get_array(bufr, '#1#pressureReducedToMeanSeaLevel')
 
         # Location of Maximum Wind
-        significance=codes_get(bufr,'#3#meteorologicalAttributeSignificance')
+        significance = codes_get(bufr, '#3#meteorologicalAttributeSignificance')
 
-        if significance!=3:
-            print 'ERROR: unexpected #3#meteorologicalAttributeSignificance=', significance
+        if significance != 3:
+            print('ERROR: unexpected #3#meteorologicalAttributeSignificance=', significance)
             return 1
 
-        latitudeMaxWind0=codes_get_array(bufr,'#3#latitude')
-        longitudeMaxWind0= codes_get_array(bufr,'#3#longitude')
-        windMaxWind0= codes_get_array(bufr,'#1#windSpeedAt10M')
+        latitudeMaxWind0 = codes_get_array(bufr, '#3#latitude')
+        longitudeMaxWind0 = codes_get_array(bufr, '#3#longitude')
+        windMaxWind0 = codes_get_array(bufr, '#1#windSpeedAt10M')
 
-        if len(latitudeAnalysis)==len(memberNumber) and len(latitudeMaxWind0)==len(memberNumber):
+        if len(latitudeAnalysis) == len(memberNumber) and len(latitudeMaxWind0) == len(memberNumber):
             for k in range(len(memberNumber)):
-                data[k][0]=[latitudeAnalysis[k],longitudeAnalysis[k],pressureAnalysis[k],latitudeMaxWind0[k],longitudeMaxWind0[k],windMaxWind0[k]]
+                data[k][0] = [latitudeAnalysis[k], longitudeAnalysis[k], pressureAnalysis[k], latitudeMaxWind0[k],
+                              longitudeMaxWind0[k], windMaxWind0[k]]
 
         else:
             for k in range(len(memberNumber)):
-                data[k][0]=[latitudeAnalysis[0],longitudeAnalysis[0],pressureAnalysis[k],latitudeMaxWind0[0],longitudeMaxWind0[0],windMaxWind0[k]]
+                data[k][0] = [latitudeAnalysis[0], longitudeAnalysis[0], pressureAnalysis[k], latitudeMaxWind0[0],
+                              longitudeMaxWind0[0], windMaxWind0[k]]
 
-
-        timePeriod=[0 for x in range(numberOfPeriods)]
-        for i in range(1,numberOfPeriods):
+        timePeriod = [0 for x in range(numberOfPeriods)]
+        for i in range(1, numberOfPeriods):
             rank1 = i * 2 + 2
             rank3 = i * 2 + 3
 
-            ivalues= codes_get_array(bufr,"#%d#timePeriod" %(i))
+            ivalues = codes_get_array(bufr, "#%d#timePeriod" % i)
 
-            if len(ivalues)==1:
-                timePeriod[i]=ivalues[0]
+            if len(ivalues) == 1:
+                timePeriod[i] = ivalues[0]
             else:
-                for j in range(len (ivalues)):
-                    if ivalues[j]!=CODES_MISSING_LONG:
-                        timePeriod[i]=ivalues[j]
+                for j in range(len(ivalues)):
+                    if ivalues[j] != CODES_MISSING_LONG:
+                        timePeriod[i] = ivalues[j]
                         break
 
             # Location of the storm
             values = codes_get_array(bufr, "#%d#meteorologicalAttributeSignificance" % rank1)
-            if len(values)==1:
-                significance=values[0]
+            if len(values) == 1:
+                significance = values[0]
             else:
-                for j in range(len (values)):
-                    if values[j]!=CODES_MISSING_LONG:
-                        significance=values[j]
+                for j in range(len(values)):
+                    if values[j] != CODES_MISSING_LONG:
+                        significance = values[j]
                         break
 
-            if significance==1:
+            if significance == 1:
                 lat = codes_get_array(bufr, "#%d#latitude" % rank1)
                 lon = codes_get_array(bufr, "#%d#longitude" % rank1)
                 press = codes_get_array(bufr, "#%d#pressureReducedToMeanSeaLevel" % (i + 1))
             else:
-                print 'ERROR: unexpected meteorologicalAttributeSignificance=',significance
+                print('ERROR: unexpected meteorologicalAttributeSignificance=', significance)
 
             # Location of maximum wind
             values = codes_get_array(bufr, "#%d#meteorologicalAttributeSignificance" % rank3)
-            if len(values)==1:
-                significanceWind=values[0]
+            if len(values) == 1:
+                significanceWind = values[0]
             else:
-                for j in range(len (values)):
-                    if values[j]!=CODES_MISSING_LONG:
-                        significanceWind=values[j]
+                for j in range(len(values)):
+                    if values[j] != CODES_MISSING_LONG:
+                        significanceWind = values[j]
                         break
 
-            if significanceWind==3:
+            if significanceWind == 3:
                 latWind = codes_get_array(bufr, "#%d#latitude" % rank3)
                 lonWind = codes_get_array(bufr, "#%d#longitude" % rank3)
                 wind10m = codes_get_array(bufr, "#%d#windSpeedAt10M" % (i + 1))
             else:
-                print 'ERROR: unexpected meteorologicalAttributeSignificance=',significanceWind
+                print('ERROR: unexpected meteorologicalAttributeSignificance=', significanceWind)
 
             for k in range(len(memberNumber)):
-                data[k][i]=[lat[k],lon[k],press[k],latWind[k],lonWind[k],wind10m[k]]
+                data[k][i] = [lat[k], lon[k], press[k], latWind[k], lonWind[k], wind10m[k]]
 
 
-# ---------------------------------------- Print the values -------------
+            # ---------------------------------------- Print the values -------------
 
         for m in range(len(memberNumber)):
-            print "== Member  %d" %memberNumber[m]
-            print "step  latitude  longitude   pressure  latitude   longitude    wind"
+            print("== Member  %d" % memberNumber[m])
+            print("step  latitude  longitude   pressure  latitude   longitude    wind")
             for s in range(len(timePeriod)):
-                if data[m][s][0]!=CODES_MISSING_DOUBLE and data[m][s][1]!=CODES_MISSING_DOUBLE:
-                    print " {:>3d}{}{:>6.1f}{}{:>6.1f}{}{:>8.1f}{}{:>6.1f}{}{:>6.1f}{}{:>6.1f}".format(\
-                          timePeriod[s],'  ',data[m][s][0],'     ',data[m][s][1],'     ',data[m][s][2],'  ',
-                          data[m][s][3],'     ',data[m][s][4],'     ',data[m][s][5])
+                if data[m][s][0] != CODES_MISSING_DOUBLE and data[m][s][1] != CODES_MISSING_DOUBLE:
+                    print(" {:>3d}{}{:>6.1f}{}{:>6.1f}{}{:>8.1f}{}{:>6.1f}{}{:>6.1f}{}{:>6.1f}".format(
+                        timePeriod[s], '  ', data[m][s][0], '     ', data[m][s][1], '     ', data[m][s][2], '  ',
+                        data[m][s][3], '     ', data[m][s][4], '     ', data[m][s][5]))
 
-# -----------------------------------------------------------------------
+                # -----------------------------------------------------------------------
         cnt += 1
 
         # release the BUFR message
@@ -200,5 +200,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/bufr_set_keys.py b/examples/python/bufr_set_keys.py
index d753fc8..62b81df 100644
--- a/examples/python/bufr_set_keys.py
+++ b/examples/python/bufr_set_keys.py
@@ -14,6 +14,7 @@
 #
 #
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -25,7 +26,6 @@ VERBOSE = 1  # verbose error reporting
 
 
 def example():
-
     # open BUFR file
     fin = open(INPUT)
 
@@ -42,7 +42,7 @@ def example():
         if bufr is None:
             break
 
-        print "message: %s" % cnt
+        print("message: %s" % cnt)
 
         # we need to instruct ecCodes to expand all the descriptors
         # i.e. unpack the data values
@@ -53,16 +53,16 @@ def example():
 
         # set centre
         val = 222
-        print '  set bufrHeaderCentre to: %d' % val
+        print('  set bufrHeaderCentre to: %d' % val)
 
         key = 'bufrHeaderCentre'
         try:
-            print '  %s: %s' % (key, codes_set(bufr, key, val))
+            print('  %s: %s' % (key, codes_set(bufr, key, val)))
         except CodesInternalError as err:
-            print 'Error with key="%s" : %s' % (key, err.msg)
+            print('Error with key="%s" : %s' % (key, err.msg))
 
         # check bufrHeaderCentre's value
-        print '  %s''s new value is: %d' % (key, codes_get(bufr, key))
+        print('  %s''s new value is: %d' % (key, codes_get(bufr, key)))
 
         # write modified message to output
         codes_write(bufr, fout)
@@ -87,5 +87,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/bufr_subset.py b/examples/python/bufr_subset.py
index 7c7116b..93f5610 100644
--- a/examples/python/bufr_subset.py
+++ b/examples/python/bufr_subset.py
@@ -14,6 +14,7 @@
 #
 #
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -24,7 +25,6 @@ VERBOSE = 1  # verbose error reporting
 
 
 def example():
-
     # open bufr file
     f = open(INPUT)
 
@@ -37,7 +37,7 @@ def example():
         if bufr is None:
             break
 
-        print "message: %s" % cnt
+        print("message: %s" % cnt)
 
         # we need to instruct ecCodes to expand all the descriptors
         # i.e. unpack the data values
@@ -46,21 +46,20 @@ def example():
         # find out the number of subsets
         key = 'numberOfSubsets'
         numberOfSubsets = codes_get(bufr, 'numberOfSubsets')
-        print ' %s: %d' % (key, numberOfSubsets)
+        print(' %s: %d' % (key, numberOfSubsets))
 
         # loop over the subsets
         for i in range(1, numberOfSubsets + 1):
-
             # read and print some data values
 
             key = '/subsetNumber=%d/blockNumber' % i
-            print key
+            print(key)
             val = codes_get_long(bufr, key)
-            print '  %s= %d' % (key, val)
+            print('  %s= %d' % (key, val))
 
             key = '/subsetNumber=%d/stationNumber' % i
             val = codes_get_long(bufr, key)
-            print '  %s: %d' % (key, val)
+            print('  %s: %d' % (key, val))
 
         cnt += 1
 
@@ -82,5 +81,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/ecc-448.py b/examples/python/ecc-448.py
index d7ed84f..3a6ccd8 100644
--- a/examples/python/ecc-448.py
+++ b/examples/python/ecc-448.py
@@ -7,6 +7,7 @@
 # granted to it by virtue of its status as an intergovernmental organisation
 # nor does it submit to any jurisdiction.
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -17,7 +18,6 @@ VERBOSE = 1  # verbose error reporting
 
 
 def example():
-
     # open bufr file
     f = open(INPUT)
 
@@ -30,24 +30,23 @@ def example():
         if bufr is None:
             break
 
-        print "message: %s" % cnt
-        
+        print("message: %s" % cnt)
+
         # ECC-448: create a new BUFR handle from the message
         #          of the original
         the_message = codes_get_message(bufr)
         newbufr = codes_new_from_message(the_message)
 
-        codes_set(newbufr,'unpack',1)
+        codes_set(newbufr, 'unpack', 1)
 
         # get BUFR key iterator
         iterid = codes_bufr_keys_iterator_new(newbufr)
 
         # loop over the keys
         while codes_bufr_keys_iterator_next(iterid):
-
             # print key name
             keyname = codes_bufr_keys_iterator_get_name(iterid)
-            print "  %s" % keyname
+            print("  %s" % keyname)
 
         # delete the key iterator
         codes_bufr_keys_iterator_delete(iterid)
@@ -72,5 +71,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/get_product_kind.py b/examples/python/get_product_kind.py
index b4f64e4..f79ac93 100644
--- a/examples/python/get_product_kind.py
+++ b/examples/python/get_product_kind.py
@@ -14,7 +14,7 @@
 # Description: how to process a file containing a mix of messages
 #              and print the kind of product (e.g. GRIB, BUFR etc)
 
-
+from __future__ import print_function
 import traceback
 import sys
 from eccodes import *
@@ -24,18 +24,18 @@ VERBOSE = 1  # verbose error reporting
 
 def example():
     if len(sys.argv) < 2:
-        print >>sys.stderr, 'Usage: ', sys.argv[0], ' file'
+        print('Usage: ', sys.argv[0], ' file', file=sys.stderr)
         sys.exit(1)
 
     f = open(sys.argv[1])
     while 1:
-        id = codes_new_from_file(f, CODES_PRODUCT_ANY)
-        if id is None:
+        ident = codes_new_from_file(f, CODES_PRODUCT_ANY)
+        if ident is None:
             break
 
-        print 'product: ', codes_get(id, 'kindOfProduct', str)
+        print('product: ', codes_get(ident, 'kindOfProduct', str))
 
-        codes_release(id)
+        codes_release(ident)
 
     f.close()
 
@@ -51,5 +51,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/get_product_kind.sh b/examples/python/get_product_kind.sh
index aaec57b..48a54b1 100755
--- a/examples/python/get_product_kind.sh
+++ b/examples/python/get_product_kind.sh
@@ -11,11 +11,22 @@
 . ./include.sh
 
 label="get_product_kind_p"
-fTmp=${label}.tmp
+fTmp=${label}.tmp.data
+fOut=${label}.tmp.out
+fRef=${label}.tmp.ref
 
 # Create a file containing both GRIB and BUFR messages
 cat ${data_dir}/sample.grib2 ${data_dir}/bufr/syno_multi.bufr >$fTmp
 
-$PYTHON $examples_src/get_product_kind.py $fTmp >/dev/null 2>&1
+$PYTHON $examples_src/get_product_kind.py $fTmp >$fOut
 
-rm -f ${fTmp}
+cat > $fRef <<EOF
+product:  GRIB
+product:  BUFR
+product:  BUFR
+product:  BUFR
+EOF
+
+diff ${fRef} ${fOut}
+
+rm -f ${fTmp} ${fRef} ${fOut}
diff --git a/examples/python/grib_ccsds.py b/examples/python/grib_ccsds.py
index 7d6eb3b..1bbc35e 100644
--- a/examples/python/grib_ccsds.py
+++ b/examples/python/grib_ccsds.py
@@ -7,6 +7,7 @@
 # granted to it by virtue of its status as an intergovernmental organisation
 # nor does it submit to any jurisdiction.
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -32,9 +33,9 @@ def example():
 
         for key in keys:
             try:
-                print '  %s: %s' % (key, codes_get(gid, key))
+                print('  %s: %s' % (key, codes_get(gid, key)))
             except CodesInternalError as err:
-                print 'Error with key="%s" : %s' % (key, err.msg)
+                print('Error with key="%s" : %s' % (key, err.msg))
 
         codes_release(gid)
 
@@ -52,5 +53,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_clone.py b/examples/python/grib_clone.py
index 11585d7..bd080b9 100644
--- a/examples/python/grib_clone.py
+++ b/examples/python/grib_clone.py
@@ -59,5 +59,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_count_messages.py b/examples/python/grib_count_messages.py
index 6f46cdc..7b8cb52 100644
--- a/examples/python/grib_count_messages.py
+++ b/examples/python/grib_count_messages.py
@@ -9,6 +9,7 @@
 # nor does it submit to any jurisdiction.
 #
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -40,19 +41,19 @@ def example():
     for i in range(mcount):
         gid = gid_list[i]
 
-        print "processing message number", i + 1
+        print("processing message number", i + 1)
 
         for key in keys:
-            print '%s=%g' % (key, codes_get(gid, key))
+            print('%s=%g' % (key, codes_get(gid, key)))
 
-        print 'There are %d, average is %g, min is %g, max is %g' % (
+        print('There are %d, average is %g, min is %g, max is %g' % (
             codes_get_size(gid, 'values'),
             codes_get(gid, 'average'),
             codes_get(gid, 'min'),
             codes_get(gid, 'max')
-        )
+        ))
 
-        print '-' * 100
+        print('-' * 100)
 
         codes_release(gid)
 
@@ -68,5 +69,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_get_keys.py b/examples/python/grib_get_keys.py
index 8f402f5..bb35e21 100644
--- a/examples/python/grib_get_keys.py
+++ b/examples/python/grib_get_keys.py
@@ -7,6 +7,7 @@
 # granted to it by virtue of its status as an intergovernmental organisation
 # nor does it submit to any jurisdiction.
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -35,16 +36,16 @@ def example():
 
         for key in keys:
             try:
-                print '  %s: %s' % (key, codes_get(gid, key))
+                print('  %s: %s' % (key, codes_get(gid, key)))
             except CodesInternalError as err:
-                print 'Error with key="%s" : %s' % (key, err.msg)
+                print('Error with key="%s" : %s' % (key, err.msg))
 
-        print 'There are %d values, average is %f, min is %f, max is %f' % (
+        print('There are %d values, average is %f, min is %f, max is %f' % (
             codes_get_size(gid, 'values'),
             codes_get(gid, 'average'),
             codes_get(gid, 'min'),
             codes_get(gid, 'max')
-        )
+        ))
 
         codes_release(gid)
 
@@ -62,5 +63,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_get_keys.sh b/examples/python/grib_get_keys.sh
index 383c3cc..89051b5 100755
--- a/examples/python/grib_get_keys.sh
+++ b/examples/python/grib_get_keys.sh
@@ -2,9 +2,16 @@
 
 . ./include.sh
 
-REDIRECT=/dev/null
-$PYTHON $examples_src/grib_get_keys.py 2> $REDIRECT > $REDIRECT
+label="py_grib_get_keys"
+temp1=temp.$label.1.out
+temp2=temp.$label.2.out
+
+$PYTHON $examples_src/grib_get_keys.py > $temp1
 
 # Rerun test with no type-check decorator (See GRIB-51)
 export ECCODES_PYTHON_NO_TYPE_CHECKS=1
-$PYTHON $examples_src/grib_get_keys.py 2> $REDIRECT > $REDIRECT
+$PYTHON $examples_src/grib_get_keys.py > $temp2
+
+diff $temp1 $temp2
+
+rm -f $temp1 $temp2
diff --git a/examples/python/grib_get_message_offset.py b/examples/python/grib_get_message_offset.py
index 3cfffdb..acabcbb 100644
--- a/examples/python/grib_get_message_offset.py
+++ b/examples/python/grib_get_message_offset.py
@@ -14,6 +14,7 @@
 # Description: how to get the message offset
 #
 
+from __future__ import print_function
 import traceback
 import sys
 from eccodes import *
@@ -23,18 +24,18 @@ VERBOSE = 1  # verbose error reporting
 
 def example():
     if len(sys.argv) < 2:
-        print >>sys.stderr, 'Usage: ', sys.argv[0], ' file'
+        print('Usage: ', sys.argv[0], ' file', file=sys.stderr)
         sys.exit(1)
 
     f = open(sys.argv[1])
     while 1:
-        id = codes_grib_new_from_file(f)
-        if id is None:
+        ident = codes_grib_new_from_file(f)
+        if ident is None:
             break
 
-        print codes_get_message_offset(id)
+        print(codes_get_message_offset(ident))
 
-        codes_release(id)
+        codes_release(ident)
 
     f.close()
 
@@ -50,5 +51,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_index.py b/examples/python/grib_index.py
index 15cc7d7..4d18b1a 100644
--- a/examples/python/grib_index.py
+++ b/examples/python/grib_index.py
@@ -12,6 +12,7 @@
 # Description: How to create and use an index to access GRIB messages from
 # a file
 
+from __future__ import print_function
 import traceback
 import sys
 import os
@@ -25,7 +26,7 @@ VERBOSE = 1  # verbose error reporting
 def product(*args, **kwds):
     # product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy
     # product(range(2), repeat=3) --> 000 001 010 011 100 101 110 111
-    pools = map(tuple, args) * kwds.get('repeat', 1)
+    pools = list(map(tuple, args)) * kwds.get('repeat', 1)
     result = [[]]
     for pool in pools:
         result = [x + [y] for x in result for y in pool]
@@ -39,7 +40,7 @@ def example():
 
     iid = None
 
-    if (os.path.exists(index_file)):
+    if os.path.exists(index_file):
         iid = codes_index_read(index_file)
     else:
         iid = codes_index_new_from_file(INPUT, index_keys)
@@ -52,13 +53,13 @@ def example():
     index_vals = []
 
     for key in index_keys:
-        print "%sSize=%d" % (
+        print("%sSize=%d" % (
             key,
             codes_index_get_size(iid, key)
-        )
+        ))
 
         key_vals = codes_index_get(iid, key)
-        print " ".join(key_vals)
+        print(" ".join(key_vals))
 
         index_vals.append(key_vals)
 
@@ -70,8 +71,8 @@ def example():
             gid = codes_new_from_index(iid)
             if gid is None:
                 break
-            print " ".join(["%s=%s" % (key, codes_get(gid, key))
-                            for key in index_keys])
+            print(" ".join(["%s=%s" % (key, codes_get(gid, key))
+                            for key in index_keys]))
             codes_release(gid)
 
     codes_index_release(iid)
@@ -88,5 +89,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_iterator.py b/examples/python/grib_iterator.py
index f5c0470..7f199da 100644
--- a/examples/python/grib_iterator.py
+++ b/examples/python/grib_iterator.py
@@ -8,13 +8,15 @@
 # virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
 #
 
+from __future__ import print_function
 import traceback
 import sys
 
 from eccodes import *
 
 VERBOSE = 1  # verbose error reporting
-missingValue = 1e+20 # A value out of range
+missingValue = 1e+20  # A value out of range
+
 
 def example(INPUT):
     f = open(INPUT)
@@ -41,9 +43,9 @@ def example(INPUT):
             sys.stdout.write("- %d - lat=%.6e lon=%.6e value=" % (i, lat, lon))
 
             if value == missingValue:
-                print "missing"
+                print("missing")
             else:
-                print "%.6f" % value
+                print("%.6f" % value)
 
             i += 1
 
@@ -64,5 +66,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_iterator_bitmap.py b/examples/python/grib_iterator_bitmap.py
index a73ad85..face47b 100644
--- a/examples/python/grib_iterator_bitmap.py
+++ b/examples/python/grib_iterator_bitmap.py
@@ -12,6 +12,7 @@
 #              for missing values
 #              (rather than compare each value with the missingValue key)
 #
+from __future__ import print_function
 import traceback
 import sys
 
@@ -50,9 +51,9 @@ def example(INPUT):
 
             # Consult bitmap to see if the i'th value is missing
             if bitmapPresent and bitmap[i] == 0:
-                print "missing"
+                print("missing")
             else:
-                print "%.6f" % value
+                print("%.6f" % value)
 
             i += 1
 
@@ -73,5 +74,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_keys_iterator.py b/examples/python/grib_keys_iterator.py
index 98890ab..a6e8d6e 100644
--- a/examples/python/grib_keys_iterator.py
+++ b/examples/python/grib_keys_iterator.py
@@ -9,6 +9,7 @@
 # nor does it submit to any jurisdiction.
 #
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -39,7 +40,7 @@ def example():
         while codes_keys_iterator_next(iterid):
             keyname = codes_keys_iterator_get_name(iterid)
             keyval = codes_get_string(iterid, keyname)
-            print "%s = %s" % (keyname, keyval)
+            print("%s = %s" % (keyname, keyval))
 
         codes_keys_iterator_delete(iterid)
         codes_release(gid)
@@ -58,5 +59,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_ls_JSON.py b/examples/python/grib_ls_JSON.py
index 9b5e4f3..4a1f996 100644
--- a/examples/python/grib_ls_JSON.py
+++ b/examples/python/grib_ls_JSON.py
@@ -11,30 +11,32 @@
 # Description: how to read data of the ECMWF EPS tropical cyclone tracks encoded in BUFR format.
 #
 
+from __future__ import print_function
 import traceback
 import sys
 import os
 import getopt
 from eccodes import *
 
-VERBOSE=1 # verbose error reporting
-default_namespace='ls'
+VERBOSE = 1  # verbose error reporting
+default_namespace = 'ls'
+
 
 def do_print(namespace, INPUT):
     f = open(INPUT)
     first_time = True
 
-    print '{'
-    print '   "messages" : ['
+    print('{')
+    print('   "messages" : [')
     while 1:
         gid = codes_grib_new_from_file(f)
         if gid is None:
             break
 
         if not first_time:
-            print '      ,{'
+            print('      ,{')
         else:
-            print '      {'
+            print('      {')
             first_time = False
 
         iterid = codes_keys_iterator_new(gid, namespace)
@@ -42,31 +44,33 @@ def do_print(namespace, INPUT):
         f1 = True
         while codes_keys_iterator_next(iterid):
             keyname = codes_keys_iterator_get_name(iterid)
-            keyval = codes_get_string(iterid,keyname)
+            keyval = codes_get_string(iterid, keyname)
             if not f1:
-                print ','
+                print(',')
             else:
-                print ''
+                print('')
                 f1 = False
-            print "         \"%s\" : \"%s\"" % (keyname,keyval),
+            print("         \"%s\" : \"%s\"" % (keyname, keyval), end=' ')
 
-        print ''
-        print '      }'
+        print('')
+        print('      }')
         codes_keys_iterator_delete(iterid)
         codes_release(gid)
 
-    print '   ]'
-    print '}'
+    print('   ]')
+    print('}')
     f.close()
 
+
 def usage():
     progname = os.path.basename(sys.argv[0])
-    print "Usage: ", progname, "[options] grib_file1 grib_file2 ..."
-    print 'Options:'
-    print '\t-n namespace'
-    print '\t\tAll the keys belonging to namespace are printed.'
-    print '\t-m Mars keys are printed.'
-    print ''
+    print("Usage: ", progname, "[options] grib_file1 grib_file2 ...")
+    print('Options:')
+    print('\t-n namespace')
+    print('\t\tAll the keys belonging to namespace are printed.')
+    print('\t-m Mars keys are printed.')
+    print('')
+
 
 def main():
     if len(sys.argv) < 2:
@@ -91,16 +95,17 @@ def main():
         for arg in args:
             do_print(namespace, arg)
     except getopt.GetoptError as err:
-        print 'Error: ',err
+        print('Error: ', err)
         usage()
         return 1
     except GribInternalError as err:
         if VERBOSE:
             traceback.print_exc(file=sys.stderr)
         else:
-            print >>sys.stderr,err.msg
+            print(err.msg, file=sys.stderr)
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_multi_write.py b/examples/python/grib_multi_write.py
index 0c5e59a..d11b972 100644
--- a/examples/python/grib_multi_write.py
+++ b/examples/python/grib_multi_write.py
@@ -50,5 +50,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_nearest.py b/examples/python/grib_nearest.py
index 8c33a67..e629a14 100644
--- a/examples/python/grib_nearest.py
+++ b/examples/python/grib_nearest.py
@@ -9,6 +9,7 @@
 # nor does it submit to any jurisdiction.
 #
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -26,16 +27,16 @@ def example():
 
     for lat, lon in points:
         nearest = codes_grib_find_nearest(gid, lat, lon)[0]
-        print lat, lon
-        print nearest.lat, nearest.lon, nearest.value, nearest.distance, \
-            nearest.index
+        print(lat, lon)
+        print(nearest.lat, nearest.lon, nearest.value, nearest.distance,
+              nearest.index)
 
         four = codes_grib_find_nearest(gid, lat, lon, is_lsm=False, npoints=4)
         for i in range(len(four)):
-            print "- %d -" % i
-            print four[i]
+            print("- %d -" % i)
+            print(four[i])
 
-        print "-" * 100
+        print("-" * 100)
 
     codes_release(gid)
     f.close()
@@ -52,5 +53,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_print_data.py b/examples/python/grib_print_data.py
index 61562b6..380ab88 100644
--- a/examples/python/grib_print_data.py
+++ b/examples/python/grib_print_data.py
@@ -9,6 +9,7 @@
 # nor does it submit to any jurisdiction.
 #
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -23,13 +24,13 @@ def example():
     gid = codes_grib_new_from_file(f)
 
     values = codes_get_values(gid)
-    for i in xrange(len(values)):
-        print "%d %.10e" % (i + 1, values[i])
+    for i in range(len(values)):
+        print("%d %.10e" % (i + 1, values[i]))
 
-    print '%d values found in %s' % (len(values), INPUT)
+    print('%d values found in %s' % (len(values), INPUT))
 
     for key in ('max', 'min', 'average'):
-        print '%s=%.10e' % (key, codes_get(gid, key))
+        print('%s=%.10e' % (key, codes_get(gid, key)))
 
     codes_release(gid)
     f.close()
@@ -46,5 +47,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_samples.py b/examples/python/grib_samples.py
index 6d388c7..d744c4a 100644
--- a/examples/python/grib_samples.py
+++ b/examples/python/grib_samples.py
@@ -83,5 +83,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_set_bitmap.py b/examples/python/grib_set_bitmap.py
index d6cd27d..58f7f73 100644
--- a/examples/python/grib_set_bitmap.py
+++ b/examples/python/grib_set_bitmap.py
@@ -6,6 +6,7 @@
 # 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.
 
+from __future__ import print_function
 import traceback
 import sys
 from eccodes import *
@@ -61,9 +62,10 @@ def main():
         if VERBOSE:
             traceback.print_exc(file=sys.stderr)
         else:
-            print >> sys.stderr, err.msg
+            print(err.msg, file=sys.stderr)
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_set_keys.py b/examples/python/grib_set_keys.py
index 8f88050..20ff9c6 100644
--- a/examples/python/grib_set_keys.py
+++ b/examples/python/grib_set_keys.py
@@ -7,6 +7,7 @@
 # granted to it by virtue of its status as an intergovernmental organisation
 # nor does it submit to any jurisdiction.
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -32,33 +33,33 @@ def example():
     centreIntVal = codes_get_array(gid, 'centre', int)
     centreStrVal = codes_get_array(gid, 'centre', str)
     dateStrVal = codes_get_array(gid, 'dataDate', str)
-    assert(centreIntVal[0] == 80)
-    assert(centreStrVal[0] == 'cnmc')
-    assert(dateStrVal[0] == today)
-    print 'get centre as an integer - centre = %d' % centreIntVal[0]
-    print 'get centre as a string - centre = %s' % centreStrVal[0]
-    print 'get date as a string - date = %s' % dateStrVal[0]
+    assert (centreIntVal[0] == 80)
+    assert (centreStrVal[0] == 'cnmc')
+    assert (dateStrVal[0] == today)
+    print('get centre as an integer - centre = %d' % centreIntVal[0])
+    print('get centre as a string - centre = %s' % centreStrVal[0])
+    print('get date as a string - date = %s' % dateStrVal[0])
 
     # Now do the same but using set_key_vals, setting keys all at once
-    print 'set keys using one long comma-separated string...'
+    print('set keys using one long comma-separated string...')
     codes_set_key_vals(gid, 'level=1,centre=98')
-    assert(codes_get(gid, 'centre', str) == 'ecmf')
-    assert(codes_get(gid, 'level', int) == 1)
+    assert (codes_get(gid, 'centre', str) == 'ecmf')
+    assert (codes_get(gid, 'level', int) == 1)
 
-    print 'set keys using a list of strings...'
+    print('set keys using a list of strings...')
     codes_set_key_vals(gid, ['level=2', 'centre=kwbc'])
-    assert(codes_get(gid, 'centre', int) == 7)
-    assert(codes_get(gid, 'level', int) == 2)
+    assert (codes_get(gid, 'centre', int) == 7)
+    assert (codes_get(gid, 'level', int) == 2)
 
-    print 'set keys using a dictionary (order not as specified!)...'
+    print('set keys using a dictionary (order not as specified!)...')
     codes_set_key_vals(gid, {'level': 3, 'centre': 84})
-    assert(codes_get(gid, 'centre', str) == 'lfpw')
-    assert(codes_get(gid, 'level', int) == 3)
+    assert (codes_get(gid, 'centre', str) == 'lfpw')
+    assert (codes_get(gid, 'level', int) == 3)
 
-    print 'set keys using an ordered dictionary...'
-    codes_set_key_vals(gid, OrderedDict( [('level', 3), ('centre', 84)] ))
-    assert(codes_get(gid, 'centre', str) == 'lfpw')
-    assert(codes_get(gid, 'level', int) == 3)
+    print('set keys using an ordered dictionary...')
+    codes_set_key_vals(gid, OrderedDict([('level', 3), ('centre', 84)]))
+    assert (codes_get(gid, 'centre', str) == 'lfpw')
+    assert (codes_get(gid, 'level', int) == 3)
 
     codes_gts_header(True)
     codes_gts_header(False)
@@ -80,5 +81,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_set_missing.py b/examples/python/grib_set_missing.py
index a7cb9ef..d5988ed 100644
--- a/examples/python/grib_set_missing.py
+++ b/examples/python/grib_set_missing.py
@@ -28,7 +28,7 @@ def example():
     codes_set_long(gid, "scaledValueOfFirstFixedSurface", 15)
     codes_set_long(gid, "scaleFactorOfFirstFixedSurface", 1)
     level = codes_get_double(gid, "level")
-    assert(level == 1.5)
+    assert (level == 1.5)
 
     # set type of level to surface
     codes_set(gid, 'typeOfFirstFixedSurface', 'sfc')
@@ -53,5 +53,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/grib_set_missing.sh b/examples/python/grib_set_missing.sh
index 86d3024..0fec3a5 100755
--- a/examples/python/grib_set_missing.sh
+++ b/examples/python/grib_set_missing.sh
@@ -2,6 +2,11 @@
 
 . ./include.sh
 
+temp=out.p_set_missing.grib
+
 REDIRECT=/dev/null
 $PYTHON $examples_src/grib_set_missing.py 2> $REDIRECT > $REDIRECT
-rm -f out.p_set_missing.grib
+x=`${tools_dir}/grib_get -p scaleFactorOfFirstFixedSurface,scaledValueOfFirstFixedSurface $temp`
+[ "$x" = "MISSING MISSING" ]
+
+rm -f $temp
diff --git a/examples/python/grib_set_pv.py b/examples/python/grib_set_pv.py
index 47fb641..783d840 100644
--- a/examples/python/grib_set_pv.py
+++ b/examples/python/grib_set_pv.py
@@ -28,7 +28,7 @@ def example():
 
     numberOfLevels = 60
     numberOfCoefficients = 2 * (numberOfLevels + 1)
-    assert(len(pv) == numberOfCoefficients)
+    assert (len(pv) == numberOfCoefficients)
 
     fout = open('grib_set_pv.py.temp.grib', 'w')
     gid = codes_grib_new_from_samples('reduced_gg_sfc_grib1')
@@ -55,5 +55,6 @@ def main():
 
         return 1
 
+
 if __name__ == '__main__':
     sys.exit(main())
diff --git a/examples/python/grib_set_pv.sh b/examples/python/grib_set_pv.sh
index 4b3ccab..3870a7f 100755
--- a/examples/python/grib_set_pv.sh
+++ b/examples/python/grib_set_pv.sh
@@ -4,4 +4,8 @@
 
 OUTPUT=grib_set_pv.py.temp.grib
 $PYTHON $examples_src/grib_set_pv.py
+
+x=`${tools_dir}/grib_get -p PVPresent,level,numberOfVerticalCoordinateValues $OUTPUT`
+[ "$x" = "1 2 122" ]
+
 rm $OUTPUT
diff --git a/examples/python/gts_get_keys.py b/examples/python/gts_get_keys.py
index 5a31314..c33b076 100644
--- a/examples/python/gts_get_keys.py
+++ b/examples/python/gts_get_keys.py
@@ -14,6 +14,7 @@
 #
 #
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -24,7 +25,6 @@ VERBOSE = 1  # verbose error reporting
 
 
 def example():
-
     # open bufr file
     f = open(INPUT)
 
@@ -37,7 +37,7 @@ def example():
         if gid is None:
             break
 
-        print "message: %s" % cnt
+        print("message: %s" % cnt)
 
         # ---------------------------------------------
         # get values for keys holding a single value
@@ -46,9 +46,9 @@ def example():
 
         for key in keys:
             try:
-                print '  %s: %s' % (key, codes_get(gid, key))
+                print('  %s: %s' % (key, codes_get(gid, key)))
             except CodesInternalError as err:
-                print 'Error with key="%s" : %s' % (key, err.msg)
+                print('Error with key="%s" : %s' % (key, err.msg))
 
         cnt += 1
 
@@ -70,5 +70,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/high_level_api.py b/examples/python/high_level_api.py
index 4ac88b3..61aee82 100644
--- a/examples/python/high_level_api.py
+++ b/examples/python/high_level_api.py
@@ -136,7 +136,8 @@ KNOWN_BUFR_KEYS = ['edition', 'masterTableNumber', 'bufrHeaderSubCentre', 'bufrH
                    'typicalHour', 'typicalMinute', 'rdbType', 'newSubtype', 'rdbtimeDay', 'rdbtimeHour',
                    'rdbtimeMinute', 'rdbtimeSecond', 'rectimeDay', 'rectimeHour', 'rectimeMinute', 'rectimeSecond',
                    'correction1', 'correction1Part', 'correction2', 'correction2Part', 'correction3', 'correction3Part',
-                   'correction4', 'correction4Part', 'qualityControl', 'numberOfSubsets', 'localLatitude', 'localLongitude',
+                   'correction4', 'correction4Part', 'qualityControl', 'numberOfSubsets', 'localLatitude',
+                   'localLongitude',
                    'observedData', 'compressedData', 'unexpandedDescriptors', '#1#blockNumber',
                    '#1#blockNumber->percentConfidence', '#1#stationNumber', '#1#stationNumber->percentConfidence',
                    '#1#stationType', '#1#stationType->percentConfidence', '#1#year', '#1#year->percentConfidence',
@@ -148,7 +149,8 @@ KNOWN_BUFR_KEYS = ['edition', 'masterTableNumber', 'bufrHeaderSubCentre', 'bufrH
                    '#1#pressureReducedToMeanSeaLevel->percentConfidence', '#1#3HourPressureChange',
                    '#1#3HourPressureChange->percentConfidence', '#1#characteristicOfPressureTendency',
                    '#1#characteristicOfPressureTendency->percentConfidence', '#1#windDirectionAt10M',
-                   '#1#windDirectionAt10M->percentConfidence', '#1#windSpeedAt10M', '#1#windSpeedAt10M->percentConfidence',
+                   '#1#windDirectionAt10M->percentConfidence', '#1#windSpeedAt10M',
+                   '#1#windSpeedAt10M->percentConfidence',
                    '#1#airTemperatureAt2M', '#1#airTemperatureAt2M->percentConfidence', '#1#dewpointTemperatureAt2M',
                    '#1#dewpointTemperatureAt2M->percentConfidence', '#1#relativeHumidity',
                    '#1#relativeHumidity->percentConfidence', '#1#horizontalVisibility',
@@ -160,22 +162,32 @@ KNOWN_BUFR_KEYS = ['edition', 'masterTableNumber', 'bufrHeaderSubCentre', 'bufrH
                    '#1#cloudAmount->percentConfidence', '#1#heightOfBaseOfCloud',
                    '#1#heightOfBaseOfCloud->percentConfidence', '#1#cloudType', '#1#cloudType->percentConfidence',
                    '#2#cloudType', '#2#cloudType->percentConfidence', '#3#cloudType', '#3#cloudType->percentConfidence',
-                   '#2#verticalSignificanceSurfaceObservations', '#2#verticalSignificanceSurfaceObservations->percentConfidence',
+                   '#2#verticalSignificanceSurfaceObservations',
+                   '#2#verticalSignificanceSurfaceObservations->percentConfidence',
                    '#2#cloudAmount', '#2#cloudAmount->percentConfidence', '#4#cloudType',
-                   '#4#cloudType->percentConfidence', '#2#heightOfBaseOfCloud', '#2#heightOfBaseOfCloud->percentConfidence',
-                   '#3#verticalSignificanceSurfaceObservations', '#3#verticalSignificanceSurfaceObservations->percentConfidence',
-                   '#3#cloudAmount', '#3#cloudAmount->percentConfidence', '#5#cloudType', '#5#cloudType->percentConfidence',
-                   '#3#heightOfBaseOfCloud', '#3#heightOfBaseOfCloud->percentConfidence', '#4#verticalSignificanceSurfaceObservations',
-                   '#4#verticalSignificanceSurfaceObservations->percentConfidence', '#4#cloudAmount', '#4#cloudAmount->percentConfidence',
-                   '#6#cloudType', '#6#cloudType->percentConfidence', '#4#heightOfBaseOfCloud', '#4#heightOfBaseOfCloud->percentConfidence',
-                   '#5#verticalSignificanceSurfaceObservations', '#5#verticalSignificanceSurfaceObservations->percentConfidence', '#5#cloudAmount',
-                   '#5#cloudAmount->percentConfidence', '#7#cloudType', '#7#cloudType->percentConfidence', '#5#heightOfBaseOfCloud',
+                   '#4#cloudType->percentConfidence', '#2#heightOfBaseOfCloud',
+                   '#2#heightOfBaseOfCloud->percentConfidence',
+                   '#3#verticalSignificanceSurfaceObservations',
+                   '#3#verticalSignificanceSurfaceObservations->percentConfidence',
+                   '#3#cloudAmount', '#3#cloudAmount->percentConfidence', '#5#cloudType',
+                   '#5#cloudType->percentConfidence',
+                   '#3#heightOfBaseOfCloud', '#3#heightOfBaseOfCloud->percentConfidence',
+                   '#4#verticalSignificanceSurfaceObservations',
+                   '#4#verticalSignificanceSurfaceObservations->percentConfidence', '#4#cloudAmount',
+                   '#4#cloudAmount->percentConfidence',
+                   '#6#cloudType', '#6#cloudType->percentConfidence', '#4#heightOfBaseOfCloud',
+                   '#4#heightOfBaseOfCloud->percentConfidence',
+                   '#5#verticalSignificanceSurfaceObservations',
+                   '#5#verticalSignificanceSurfaceObservations->percentConfidence', '#5#cloudAmount',
+                   '#5#cloudAmount->percentConfidence', '#7#cloudType', '#7#cloudType->percentConfidence',
+                   '#5#heightOfBaseOfCloud',
                    '#5#heightOfBaseOfCloud->percentConfidence', '#1#totalPrecipitationPast6Hours',
-                   '#1#totalPrecipitationPast6Hours->percentConfidence', '#1#totalSnowDepth', '#1#totalSnowDepth->percentConfidence',
+                   '#1#totalPrecipitationPast6Hours->percentConfidence', '#1#totalSnowDepth',
+                   '#1#totalSnowDepth->percentConfidence',
                    '#1#centre', '#1#generatingApplication']
 
-class TestGribFile(unittest.TestCase):
 
+class TestGribFile(unittest.TestCase):
     """Test GribFile functionality."""
 
     def test_memory_management(self):
@@ -185,7 +197,7 @@ class TestGribFile(unittest.TestCase):
             for i in range(len(grib_file)):
                 msg = GribMessage(grib_file)
                 self.assertEqual(msg["shortName"], "msl")
-                self.assertEqual(msg['count'], i+1)
+                self.assertEqual(msg['count'], i + 1)
             self.assertEqual(len(grib_file.open_messages), 5)
         self.assertEqual(len(grib_file.open_messages), 0)
 
@@ -218,19 +230,18 @@ class TestGribFile(unittest.TestCase):
 
 
 class TestGribMessage(unittest.TestCase):
-
     """Test GribMessage functionality."""
 
     def test_metadata(self):
         """Metadata is read correctly from GribMessage."""
         with GribFile(TESTGRIB) as grib_file:
             msg = GribMessage(grib_file)
-            msg_keys = msg.keys()
+            msg_keys = list(msg.keys())
             for key in KNOWN_GRIB_KEYS:
                 assert key in msg_keys, "key '%s' not found" % key
             # Size of message in bytes
             self.assertEqual(msg.size(), 160219)
-            self.assertEqual(len(msg.keys()), len(msg))
+            self.assertEqual(len(list(msg.keys())), len(msg))
 
     def test_missing_message_behaviour(self):
         """Key with MISSING value."""
@@ -239,7 +250,7 @@ class TestGribMessage(unittest.TestCase):
             self.assertTrue(msg.missing("scaleFactorOfSecondFixedSurface"))
             msg["scaleFactorOfSecondFixedSurface"] = 5
             msg.set_missing("scaleFactorOfSecondFixedSurface")
-            #with self.assertRaises(KeyError):
+            # with self.assertRaises(KeyError):
             #    msg["scaleFactorOfSecondFixedSurface"]
 
     def test_value_setting(self):
@@ -248,21 +259,21 @@ class TestGribMessage(unittest.TestCase):
             msg = GribMessage(grib_file)
             msg["scaleFactorOfSecondFixedSurface"] = 5
             msg["values"] = [1, 2, 3]
-            self.assertEqual( msg['scaleFactorOfSecondFixedSurface'], 5 )
+            self.assertEqual(msg['scaleFactorOfSecondFixedSurface'], 5)
 
     def test_multi_value_setting(self):
         """Multiple keys/values can be set properly."""
         msg = GribMessage(sample='GRIB1')
-        msg[ 'paramId', 'stepType', 'edition' ] = 49, 'avg', 2
-        self.assertEqual( msg['shortName'], '10fg' )
+        msg['paramId', 'stepType', 'edition'] = 49, 'avg', 2
+        self.assertEqual(msg['shortName'], '10fg')
         # Another test
         with GribFile(TESTGRIB) as grib_file:
             msg = GribMessage(grib_file)
-            msg[ 'setLocalDefinition', 'localDefinitionNumber' ] = 1,25
-            msg[ 'typeOfFirstFixedSurface', 'typeOfSecondFixedSurface' ] = 1, 8
-            msg[ ('typeOfFirstFixedSurface','typeOfSecondFixedSurface') ] = (1, 8) #Also works
-            self.assertEqual( msg['localDefinitionNumber'], 25 )
-            self.assertEqual( msg['typeOfLevel'], 'entireAtmosphere' )
+            msg['setLocalDefinition', 'localDefinitionNumber'] = 1, 25
+            msg['typeOfFirstFixedSurface', 'typeOfSecondFixedSurface'] = 1, 8
+            msg[('typeOfFirstFixedSurface', 'typeOfSecondFixedSurface')] = (1, 8)  # Also works
+            self.assertEqual(msg['localDefinitionNumber'], 25)
+            self.assertEqual(msg['typeOfLevel'], 'entireAtmosphere')
 
     def test_serialize(self):
         """Message can be serialized to file."""
@@ -277,11 +288,10 @@ class TestGribMessage(unittest.TestCase):
         with GribFile(TESTGRIB) as grib_file:
             msg = GribMessage(grib_file)
             msg2 = GribMessage(clone=msg)
-            self.assertSequenceEqual(msg.keys(), msg2.keys())
+            self.assertSequenceEqual(list(msg.keys()), list(msg2.keys()))
 
 
 class TestGribIndex(unittest.TestCase):
-
     """Test GribIndex functionality."""
 
     def test_memory_management(self):
@@ -315,7 +325,6 @@ class TestGribIndex(unittest.TestCase):
 
 
 class TestBufrFile(unittest.TestCase):
-
     """Test BufrFile functionality."""
 
     def test_memory_management(self):
@@ -325,7 +334,7 @@ class TestBufrFile(unittest.TestCase):
             for i in range(len(bufr_file)):
                 msg = BufrMessage(bufr_file)
                 self.assertEqual(msg["bufrHeaderCentre"], 98)
-                self.assertEqual(msg['count'], i+1)
+                self.assertEqual(msg['count'], i + 1)
             self.assertEqual(len(bufr_file.open_messages), 3)
         self.assertEquals(len(bufr_file.open_messages), 0)
 
@@ -358,7 +367,6 @@ class TestBufrFile(unittest.TestCase):
 
 
 class TestBufrMessage(unittest.TestCase):
-
     """Test BufrMessage functionality"""
 
     def test_metadata(self):
@@ -366,13 +374,13 @@ class TestBufrMessage(unittest.TestCase):
         with BufrFile(TESTBUFR) as bufr_file:
             msg = BufrMessage(bufr_file)
             msg.unpack()
-            msg_keys = msg.keys()
+            msg_keys = list(msg.keys())
             self.assertEqual(len(msg_keys), 140)
             for key in KNOWN_BUFR_KEYS:
                 assert key in msg_keys
             # Size of message in bytes
             self.assertEqual(msg.size(), 220)
-            self.assertEqual(len(msg.keys()), len(msg))
+            self.assertEqual(len(list(msg.keys())), len(msg))
 
     def test_content(self):
         """Data values are read correctly from BufrMessage."""
@@ -404,14 +412,14 @@ class TestBufrMessage(unittest.TestCase):
         with BufrFile(TESTBUFR) as bufr_file:
             msg = BufrMessage(bufr_file)
             msg2 = BufrMessage(clone=msg)
-            self.assertSequenceEqual(msg.keys(), msg2.keys())
+            self.assertSequenceEqual(list(msg.keys()), list(msg2.keys()))
 
     def test_copy_data(self):
         """Can copy data section from one message to another"""
         bufr = BufrMessage(sample='BUFR3')
         with BufrFile('../../data/bufr/metar_with_2_bias.bufr') as bufr_file:
             bufrin = BufrMessage(bufr_file)
-            ivalues=(
+            ivalues = (
                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
@@ -437,12 +445,12 @@ class TestBufrMessage(unittest.TestCase):
             bufr['numberOfSubsets'] = 1
             bufr['observedData'] = 1
             bufr['compressedData'] = 0
-            ivalues=(
-                307011,7006,10004,222000,101023,31031,1031,1032,101023,33007,
-                225000,236000,101023,31031,1031,1032,8024,101001,225255,225000,
-                236000,101023,31031,1031,1032,8024,101001,225255,
-                1063,2001,4001,4002,4003,4004,4005,5002,
-                6002,7001,7006,11001,11016,11017,11002)
+            ivalues = (
+                307011, 7006, 10004, 222000, 101023, 31031, 1031, 1032, 101023, 33007,
+                225000, 236000, 101023, 31031, 1031, 1032, 8024, 101001, 225255, 225000,
+                236000, 101023, 31031, 1031, 1032, 8024, 101001, 225255,
+                1063, 2001, 4001, 4002, 4003, 4004, 4005, 5002,
+                6002, 7001, 7006, 11001, 11016, 11017, 11002)
             bufr['unexpandedDescriptors'] = ivalues
             bufrin.unpack()
             bufrin.copy_data(bufr)
@@ -451,6 +459,5 @@ class TestBufrMessage(unittest.TestCase):
             os.unlink(TEST_OUTPUT)
 
 
-
 if __name__ == "__main__":
     unittest.main()
diff --git a/examples/python/keys_iterator_gts.py b/examples/python/keys_iterator_gts.py
index 7f8f8f9..d849445 100644
--- a/examples/python/keys_iterator_gts.py
+++ b/examples/python/keys_iterator_gts.py
@@ -9,6 +9,7 @@
 # nor does it submit to any jurisdiction.
 #
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -36,7 +37,7 @@ def example():
         while codes_keys_iterator_next(iterid):
             keyname = codes_keys_iterator_get_name(iterid)
             keyval = codes_get_string(iterid, keyname)
-            print "%s = %s" % (keyname, keyval)
+            print("%s = %s" % (keyname, keyval))
 
         codes_keys_iterator_delete(iterid)
         codes_release(bid)
@@ -51,9 +52,10 @@ def main():
         if VERBOSE:
             traceback.print_exc(file=sys.stderr)
         else:
-            print >> sys.stderr, err.msg
+            print(err.msg, file=sys.stderr)
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/examples/python/metar_get_keys.py b/examples/python/metar_get_keys.py
index 8f8b0c8..751fd1a 100644
--- a/examples/python/metar_get_keys.py
+++ b/examples/python/metar_get_keys.py
@@ -14,6 +14,7 @@
 #
 #
 
+from __future__ import print_function
 import traceback
 import sys
 
@@ -24,7 +25,6 @@ VERBOSE = 1  # verbose error reporting
 
 
 def example():
-
     # open metar file
     f = open(INPUT)
 
@@ -37,7 +37,7 @@ def example():
         if gid is None:
             break
 
-        print "message: %s" % cnt
+        print("message: %s" % cnt)
 
         # ---------------------------------------------
         # get values for keys holding a single value
@@ -47,9 +47,9 @@ def example():
 
         for key in keys:
             try:
-                print '  %s: %s' % (key, codes_get(gid, key))
+                print('  %s: %s' % (key, codes_get(gid, key)))
             except CodesInternalError as err:
-                print 'Error with key="%s" : %s' % (key, err.msg)
+                print('Error with key="%s" : %s' % (key, err.msg))
 
         cnt += 1
 
@@ -71,5 +71,6 @@ def main():
 
         return 1
 
+
 if __name__ == "__main__":
     sys.exit(main())
diff --git a/fortran/create_grib_f90.sh b/fortran/create_grib_f90.sh
index 8823bf5..7384bc2 100755
--- a/fortran/create_grib_f90.sh
+++ b/fortran/create_grib_f90.sh
@@ -7,6 +7,7 @@
 # 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.
 #
+set -e
 same=`./same_int_long`
 
 if [ $same -eq 1 ]
diff --git a/fortran/eccodes_f90_tail.f90 b/fortran/eccodes_f90_tail.f90
index 8ee8b4b..b4d026e 100644
--- a/fortran/eccodes_f90_tail.f90
+++ b/fortran/eccodes_f90_tail.f90
@@ -1273,8 +1273,8 @@ end subroutine codes_keys_iterator_new
   !> @param iterid   keys iterator id created with @ref codes_keys_iterator_new
   !> @param status   CODES_SUCCESS if next iterator exists, integer value if no more elements to iterate on
 subroutine codes_keys_iterator_next ( iterid , status)
-    integer(kind=kindOfInt),          intent(in)  :: iterid
-    integer(kind=kindOfInt),optional, intent(out) :: status
+    integer(kind=kindOfInt),   intent(in)  :: iterid
+    integer(kind=kindOfInt),   intent(out) :: status
 
     call grib_keys_iterator_next ( iterid , status)
 end subroutine codes_keys_iterator_next
@@ -1361,9 +1361,9 @@ end subroutine codes_bufr_keys_iterator_new
   !> @param iterid   keys iterator id created with @ref codes_bufr_keys_iterator_new
   !> @param status   CODES_SUCCESS if next iterator exists, integer value if no more elements to iterate on
 subroutine codes_bufr_keys_iterator_next (iterid , status)
-    integer(kind=kindOfInt),          intent(in)  :: iterid
-    integer(kind=kindOfInt),optional, intent(out) :: status
-    integer(kind=kindOfInt)                       :: iret
+    integer(kind=kindOfInt), intent(in)  :: iterid
+    integer(kind=kindOfInt), intent(out) :: status
+    integer(kind=kindOfInt)              :: iret
 
     status = GRIB_SUCCESS
     iret = codes_f_bufr_keys_iterator_next( iterid )
diff --git a/fortran/grib_f90_int.f90 b/fortran/grib_f90_int.f90
index 863fa11..3ad86e1 100644
--- a/fortran/grib_f90_int.f90
+++ b/fortran/grib_f90_int.f90
@@ -87,7 +87,7 @@
   !> @see grib_new_from_file, grib_release, grib_set
   !>
   !>
-  !> @param[in] msgid      id of the loaded in memory
+  !> @param[in] msgid      id of the message loaded in memory
   !> @param[in] key        key name
   !> @param[out] value     value can be a scalar or array of integer(4),real(4),real(8),character
   !> @param[out] status    GRIB_SUCCESS if OK, integer value on error
@@ -127,7 +127,7 @@
   !> the list of number of points for each latitude in a reduced grid and the list of
   !> vertical levels. In these cases the \em value array must be allocated by the caller
   !> and their required dimension can be obtained with \ref grib_get_size. \n
-  !> The gribid references to a grib message loaded in memory.
+  !> The msgid references to a message loaded in memory.
   !>
   !> 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
diff --git a/fortran/grib_f90_long_int.f90 b/fortran/grib_f90_long_int.f90
index 8e349bb..5d789ce 100644
--- a/fortran/grib_f90_long_int.f90
+++ b/fortran/grib_f90_long_int.f90
@@ -65,9 +65,9 @@
                      grib_index_select_real8
   end interface grib_index_select
           
-  !> Get the value for a key from a grib message.
+  !> Get the value for a key from a message.
   !>
-  !> Given a \em gribid and \em key as input a \em value for the \em key is returned.
+  !> Given a \em msgid and \em key as input a \em value for the \em key is returned.
   !> In some cases the \em value can be an array rather than a scalar.
   !> As examples of array keys we have "values","pl", "pv" respectively the data values,
   !> the list of number of points for each latitude in a reduced grid and the list of
@@ -79,7 +79,7 @@
   !> Analogous conversions are always provided when possible.
   !> Illegal conversions are real to integer and character to any other type.
   !>
-  !> The \em gribid references to a grib message loaded in memory.
+  !> The \em msgid references to a message loaded in memory.
   !>
   !> 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
@@ -90,10 +90,10 @@
   !> @see grib_new_from_file, grib_release, grib_set
   !>
   !>
-  !> @param[in] gribid      id of the grib loaded in memory
-  !> @param[in] key     key name
-  !> @param[out] value       value can be a scalar or array of integer(4),real(4),real(8),character
-  !> @param[out] status      GRIB_SUCCESS if OK, integer value on error
+  !> @param[in] msgid      id of the message loaded in memory
+  !> @param[in] key        key name
+  !> @param[out] value     value can be a scalar or array of integer(4),real(4),real(8),character
+  !> @param[out] status    GRIB_SUCCESS if OK, integer value on error
   interface grib_get
     module procedure grib_get_int, &
                      grib_get_long, &
@@ -114,7 +114,7 @@
   !> exit with an error message.\n Otherwise the error message can be
   !> gathered with @ref grib_get_error_string.
   !>
-  !> @param gribid      id of the grib loaded in memory
+  !> @param msgid       id of the message loaded in memory
   !> @param key         name of the key
   !> @param size        size of the array key
   !> @param status      GRIB_SUCCESS if OK, integer value on error
@@ -123,15 +123,15 @@
                         grib_get_size_long 
   end interface grib_get_size
 
-  !> Set the value for a key in a grib message.
+  !> Set the value for a key in a message.
   !>
-  !> The given \em value is set for the \em key in the \em gribid message.
+  !> The given \em value is set for the \em key in the \em msgid message.
   !> In some cases the \em value can be an array rather than a scalar.
   !> As examples of array keys we have "values","pl", "pv" respectively the data values,
   !> the list of number of points for each latitude in a reduced grid and the list of
   !> vertical levels. In these cases the \em value array must be allocated by the caller
   !> and their required dimension can be obtained with \ref grib_get_size. \n
-  !> The gribid references to a grib message loaded in memory.
+  !> The msgid references to a message loaded in memory.
   !>
   !> 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
@@ -141,10 +141,10 @@
   !>
   !> @see grib_new_from_file, grib_release, grib_get
   !>
-  !> @param[in] gribid      id of the grib loaded in memory
-  !> @param[in] key          key name
-  !> @param[out] value       value can be a scalar or array of integer(4),real(4),real(8)
-  !> @param[out] status      GRIB_SUCCESS if OK, integer value on error
+  !> @param[in] msgid       id of the message loaded in memory
+  !> @param[in] key         key name
+  !> @param[out] value      value can be a scalar or array of integer(4),real(4),real(8)
+  !> @param[out] status     GRIB_SUCCESS if OK, integer value on error
   interface grib_set
     module procedure grib_set_int, &
                      grib_set_long, &
diff --git a/fortran/grib_fortran_prototypes.h b/fortran/grib_fortran_prototypes.h
index 7e333e1..ab5fb15 100644
--- a/fortran/grib_fortran_prototypes.h
+++ b/fortran/grib_fortran_prototypes.h
@@ -243,9 +243,11 @@ int grib_f_set_missing_(int *gid, char *key, int len);
 int grib_f_set_missing__(int *gid, char *key, int len);
 int grib_f_set_missing(int *gid, char *key, int len);
 int grib_f_is_missing_(int *gid, char *key, int *isMissing, int len);
-int grib_f_is_defined_(int *gid, char *key, int *isDefined, int len);
 int grib_f_is_missing__(int *gid, char *key, int *isMissing, int len);
 int grib_f_is_missing(int *gid, char *key, int *isMissing, int len);
+int grib_f_is_defined_(int* gid, char* key,int* isDefined,int len);
+int grib_f_is_defined__(int* gid, char* key,int* isDefined,int len);
+int grib_f_is_defined(int* gid, char* key,int* isDefined,int len);
 int grib_f_set_real4_(int *gid, char *key, float *val, int len);
 int grib_f_set_real4__(int *gid, char *key, float *val, int len);
 int grib_f_set_real4(int *gid, char *key, float *val, int len);
diff --git a/html/classeccodes.html b/html/classeccodes.html
index 93938d6..58ca9c2 100644
--- a/html/classeccodes.html
+++ b/html/classeccodes.html
@@ -888,7 +888,7 @@ Public Member Functions</h2></td></tr>
  Otherwise the error message can be gathered with <a class="el" href="classeccodes.html#a835de867b8ad79cc43f127e7048712f3">codes_get_error_string</a>.</p>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
-    <tr><td class="paramname">msgid</td><td>id of the grib loaded in memory </td></tr>
+    <tr><td class="paramname">msgid</td><td>id of the message loaded in memory </td></tr>
     <tr><td class="paramname">message</td><td>array containing the coded message to be copied </td></tr>
     <tr><td class="paramname">status</td><td>CODES_SUCCESS if OK, integer value on error </td></tr>
   </table>
@@ -1369,7 +1369,7 @@ Public Member Functions</h2></td></tr>
  Otherwise the error message can be gathered with <a class="el" href="classeccodes.html#a835de867b8ad79cc43f127e7048712f3">codes_get_error_string</a>.</p>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
-    <tr><td class="paramname">msgid</td><td>id of the grib loaded in memory </td></tr>
+    <tr><td class="paramname">msgid</td><td>id of the message loaded in memory </td></tr>
     <tr><td class="paramname">nbytes</td><td>size in bytes of the message </td></tr>
     <tr><td class="paramname">status</td><td>CODES_SUCCESS if OK, integer value on error </td></tr>
   </table>
@@ -1413,7 +1413,7 @@ Public Member Functions</h2></td></tr>
  Otherwise the error message can be gathered with <a class="el" href="classeccodes.html#a835de867b8ad79cc43f127e7048712f3">codes_get_error_string</a>.</p>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
-    <tr><td class="paramname">msgid</td><td>id of the grib loaded in memory </td></tr>
+    <tr><td class="paramname">msgid</td><td>id of the message loaded in memory </td></tr>
     <tr><td class="paramname">nbytes</td><td>size in bytes of the message </td></tr>
     <tr><td class="paramname">status</td><td>CODES_SUCCESS if OK, integer value on error </td></tr>
   </table>
@@ -1572,7 +1572,7 @@ Public Member Functions</h2></td></tr>
  Otherwise the error message can be gathered with <a class="el" href="classeccodes.html#a835de867b8ad79cc43f127e7048712f3">codes_get_error_string</a>.</p>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
-    <tr><td class="paramname">msgid</td><td>id of the grib loaded in memory </td></tr>
+    <tr><td class="paramname">msgid</td><td>id of the message loaded in memory </td></tr>
     <tr><td class="paramname">key</td><td>key name </td></tr>
     <tr><td class="paramname">kindex</td><td>integer(4) index </td></tr>
     <tr><td class="paramname">value</td><td>real(4) value </td></tr>
@@ -1630,7 +1630,7 @@ Public Member Functions</h2></td></tr>
  Otherwise the error message can be gathered with <a class="el" href="classeccodes.html#a835de867b8ad79cc43f127e7048712f3">codes_get_error_string</a>.</p>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
-    <tr><td class="paramname">msgid</td><td>id of the grib loaded in memory </td></tr>
+    <tr><td class="paramname">msgid</td><td>id of the message loaded in memory </td></tr>
     <tr><td class="paramname">key</td><td>key name </td></tr>
     <tr><td class="paramname">kindex</td><td>integer(4) array indexes </td></tr>
     <tr><td class="paramname">value</td><td>real(4) array value </td></tr>
@@ -1791,7 +1791,7 @@ Public Member Functions</h2></td></tr>
  Otherwise the error message can be gathered with <a class="el" href="classeccodes.html#a835de867b8ad79cc43f127e7048712f3">codes_get_error_string</a>.</p>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
-    <tr><td class="paramname">msgid</td><td>id of the grib loaded in memory </td></tr>
+    <tr><td class="paramname">msgid</td><td>id of the message loaded in memory </td></tr>
     <tr><td class="paramname">key</td><td>key name </td></tr>
     <tr><td class="paramname">kindex</td><td>integer(4) index </td></tr>
     <tr><td class="paramname">value</td><td>real(8) value </td></tr>
@@ -1849,7 +1849,7 @@ Public Member Functions</h2></td></tr>
  Otherwise the error message can be gathered with <a class="el" href="classeccodes.html#a835de867b8ad79cc43f127e7048712f3">codes_get_error_string</a>.</p>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
-    <tr><td class="paramname">msgid</td><td>id of the grib loaded in memory </td></tr>
+    <tr><td class="paramname">msgid</td><td>id of the message loaded in memory </td></tr>
     <tr><td class="paramname">key</td><td>key name </td></tr>
     <tr><td class="paramname">kindex</td><td>integer(4) array index </td></tr>
     <tr><td class="paramname">value</td><td>real(8) array value </td></tr>
@@ -2237,7 +2237,7 @@ Public Member Functions</h2></td></tr>
  Otherwise the error message can be gathered with <a class="el" href="classeccodes.html#a835de867b8ad79cc43f127e7048712f3">codes_get_error_string</a>.</p>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
-    <tr><td class="paramname">gribid</td><td>id of the grib loaded in memory </td></tr>
+    <tr><td class="paramname">gribid</td><td>id of the message loaded in memory </td></tr>
     <tr><td class="paramname">is_lsm</td><td>.true. if the nearest land point is required otherwise .false. </td></tr>
     <tr><td class="paramname">inlats</td><td>input real(8) array of the latitudes of the points </td></tr>
     <tr><td class="paramname">inlons</td><td>input real(8) array of the longitudes of the points </td></tr>
@@ -2330,7 +2330,7 @@ Public Member Functions</h2></td></tr>
  Otherwise the error message can be gathered with <a class="el" href="classeccodes.html#a835de867b8ad79cc43f127e7048712f3">codes_get_error_string</a>.</p>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
-    <tr><td class="paramname">gribid</td><td>id of the grib loaded in memory </td></tr>
+    <tr><td class="paramname">gribid</td><td>id of the message loaded in memory </td></tr>
     <tr><td class="paramname">is_lsm</td><td>.true. if the nearest land point is required otherwise .false. </td></tr>
     <tr><td class="paramname">inlat</td><td>latitude of the point </td></tr>
     <tr><td class="paramname">inlon</td><td>longitudes of the point </td></tr>
@@ -2394,7 +2394,7 @@ Public Member Functions</h2></td></tr>
  Otherwise the error message can be gathered with <a class="el" href="classeccodes.html#a835de867b8ad79cc43f127e7048712f3">codes_get_error_string</a>.</p>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
-    <tr><td class="paramname">gribid</td><td>id of the grib loaded in memory </td></tr>
+    <tr><td class="paramname">gribid</td><td>id of the message loaded in memory </td></tr>
     <tr><td class="paramname">lats</td><td>latitudes array with dimension "size" </td></tr>
     <tr><td class="paramname">lons</td><td>longitudes array with dimension "size" </td></tr>
     <tr><td class="paramname">values</td><td>data values array with dimension "size" </td></tr>
@@ -2452,7 +2452,7 @@ Public Member Functions</h2></td></tr>
  Otherwise the error message can be gathered with <a class="el" href="classeccodes.html#a835de867b8ad79cc43f127e7048712f3">codes_get_error_string</a>.</p>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
-    <tr><td class="paramname">gribid</td><td>id of the grib loaded in memory </td></tr>
+    <tr><td class="paramname">gribid</td><td>id of the message loaded in memory </td></tr>
     <tr><td class="paramname">lats</td><td>latitudes array </td></tr>
     <tr><td class="paramname">lons</td><td>longitudes array </td></tr>
     <tr><td class="paramname">values</td><td>data values array </td></tr>
@@ -2693,7 +2693,7 @@ Public Member Functions</h2></td></tr>
 <p><b>Examples:</b> <a href="https://software.ecmwf.int/wiki/display/ECC/grib_samples" target="_blank">grib_samples.f90</a></p>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
-    <tr><td class="paramname">gribid</td><td>id of the grib loaded in memory </td></tr>
+    <tr><td class="paramname">gribid</td><td>id of the message loaded in memory </td></tr>
     <tr><td class="paramname">samplename</td><td>name of the sample to be used </td></tr>
     <tr><td class="paramname">status</td><td>CODES_SUCCESS if OK, integer value on error </td></tr>
   </table>
@@ -5797,7 +5797,7 @@ Public Member Functions</h2></td></tr>
  Otherwise the error message can be gathered with <a class="el" href="classeccodes.html#a835de867b8ad79cc43f127e7048712f3">codes_get_error_string</a>.</p>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
-    <tr><td class="paramname">msgid</td><td>id of the grib loaded in memory </td></tr>
+    <tr><td class="paramname">msgid</td><td>id of the message loaded in memory </td></tr>
     <tr><td class="paramname">ifile</td><td>file id of a file opened with <a class="el" href="classeccodes.html#a28594e26f2f4b92b9c60e943dd8e1be3">codes_open_file</a> </td></tr>
     <tr><td class="paramname">status</td><td>CODES_SUCCESS if OK, integer value on error </td></tr>
   </table>
diff --git a/html/eccodes_8h.html b/html/eccodes_8h.html
index 49c83ef..95aa57c 100644
--- a/html/eccodes_8h.html
+++ b/html/eccodes_8h.html
@@ -375,10 +375,10 @@ Functions</h2></td></tr>
 <tr class="memitem:ga079df0c709e381812ae13af08c354032"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga079df0c709e381812ae13af08c354032">codes_handle_new_from_message_copy</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, const void *data, size_t data_len)</td></tr>
 <tr class="memdesc:ga079df0c709e381812ae13af08c354032"><td class="mdescLeft"> </td><td class="mdescRight">Create a handle from a user message.  <a href="group__codes__handle.html#ga079df0c709e381812ae13af08c354032">More...</a><br/></td></tr>
 <tr class="separator:ga079df0c709e381812ae13af08c354032"><td class="memSeparator" colspan="2"> </td></tr>
-<tr class="memitem:ga3b281a237e311c6b8fa4bd7096d7e025"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga3b281a237e311c6b8fa4bd7096d7e025">codes_grib_handle_new_from_samples</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, const char *res_name)</td></tr>
+<tr class="memitem:ga3b281a237e311c6b8fa4bd7096d7e025"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga3b281a237e311c6b8fa4bd7096d7e025">codes_grib_handle_new_from_samples</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, const char *sample_name)</td></tr>
 <tr class="memdesc:ga3b281a237e311c6b8fa4bd7096d7e025"><td class="mdescLeft"> </td><td class="mdescRight">Create a handle from a GRIB message contained in a samples directory.  <a href="group__codes__handle.html#ga3b281a237e311c6b8fa4bd7096d7e025">More...</a><br/></td></tr>
 <tr class="separator:ga3b281a237e311c6b8fa4bd7096d7e025"><td class="memSeparator" colspan="2"> </td></tr>
-<tr class="memitem:ga56d0f831e520ec7bc4a0ca334c63f557"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga56d0f831e520ec7bc4a0ca334c63f557">codes_bufr_handle_new_from_samples</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, const char *res_name)</td></tr>
+<tr class="memitem:ga56d0f831e520ec7bc4a0ca334c63f557"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga56d0f831e520ec7bc4a0ca334c63f557">codes_bufr_handle_new_from_samples</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, const char *sample_name)</td></tr>
 <tr class="memdesc:ga56d0f831e520ec7bc4a0ca334c63f557"><td class="mdescLeft"> </td><td class="mdescRight">Create a handle from a BUFR message contained in a samples directory.  <a href="group__codes__handle.html#ga56d0f831e520ec7bc4a0ca334c63f557">More...</a><br/></td></tr>
 <tr class="separator:ga56d0f831e520ec7bc4a0ca334c63f557"><td class="memSeparator" colspan="2"> </td></tr>
 <tr class="memitem:ga7b226527aa98d90f2bdb470105732878"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga7b226527aa98d90f2bdb470105732878">codes_handle_clone</a> (<a class="el" href="structcodes__handle.html">codes_handle</a> *h)</td></tr>
diff --git a/html/group__codes__handle.html b/html/group__codes__handle.html
index 022e734..9b835e3 100644
--- a/html/group__codes__handle.html
+++ b/html/group__codes__handle.html
@@ -115,10 +115,10 @@ Functions</h2></td></tr>
 <tr class="memitem:ga079df0c709e381812ae13af08c354032"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga079df0c709e381812ae13af08c354032">codes_handle_new_from_message_copy</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, const void *data, size_t data_len)</td></tr>
 <tr class="memdesc:ga079df0c709e381812ae13af08c354032"><td class="mdescLeft"> </td><td class="mdescRight">Create a handle from a user message.  <a href="#ga079df0c709e381812ae13af08c354032">More...</a><br/></td></tr>
 <tr class="separator:ga079df0c709e381812ae13af08c354032"><td class="memSeparator" colspan="2"> </td></tr>
-<tr class="memitem:ga3b281a237e311c6b8fa4bd7096d7e025"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga3b281a237e311c6b8fa4bd7096d7e025">codes_grib_handle_new_from_samples</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, const char *res_name)</td></tr>
+<tr class="memitem:ga3b281a237e311c6b8fa4bd7096d7e025"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga3b281a237e311c6b8fa4bd7096d7e025">codes_grib_handle_new_from_samples</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, const char *sample_name)</td></tr>
 <tr class="memdesc:ga3b281a237e311c6b8fa4bd7096d7e025"><td class="mdescLeft"> </td><td class="mdescRight">Create a handle from a GRIB message contained in a samples directory.  <a href="#ga3b281a237e311c6b8fa4bd7096d7e025">More...</a><br/></td></tr>
 <tr class="separator:ga3b281a237e311c6b8fa4bd7096d7e025"><td class="memSeparator" colspan="2"> </td></tr>
-<tr class="memitem:ga56d0f831e520ec7bc4a0ca334c63f557"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga56d0f831e520ec7bc4a0ca334c63f557">codes_bufr_handle_new_from_samples</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, const char *res_name)</td></tr>
+<tr class="memitem:ga56d0f831e520ec7bc4a0ca334c63f557"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga56d0f831e520ec7bc4a0ca334c63f557">codes_bufr_handle_new_from_samples</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, const char *sample_name)</td></tr>
 <tr class="memdesc:ga56d0f831e520ec7bc4a0ca334c63f557"><td class="mdescLeft"> </td><td class="mdescRight">Create a handle from a BUFR message contained in a samples directory.  <a href="#ga56d0f831e520ec7bc4a0ca334c63f557">More...</a><br/></td></tr>
 <tr class="separator:ga56d0f831e520ec7bc4a0ca334c63f557"><td class="memSeparator" colspan="2"> </td></tr>
 <tr class="memitem:ga7b226527aa98d90f2bdb470105732878"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga7b226527aa98d90f2bdb470105732878">codes_handle_clone</a> (<a class="el" href="structcodes__handle.html">codes_handle</a> *h)</td></tr>
@@ -201,7 +201,7 @@ Functions</h2></td></tr>
           <td class="paramkey"></td>
           <td></td>
           <td class="paramtype">const char * </td>
-          <td class="paramname"><em>res_name</em> </td>
+          <td class="paramname"><em>sample_name</em> </td>
         </tr>
         <tr>
           <td></td>
@@ -216,7 +216,7 @@ Functions</h2></td></tr>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
     <tr><td class="paramname">c</td><td>: the context from which the handle will be created (NULL for default context) </td></tr>
-    <tr><td class="paramname">res_name</td><td>: the resource name </td></tr>
+    <tr><td class="paramname">sample_name</td><td>: the name of the sample file (without the .tmpl extension) </td></tr>
   </table>
   </dd>
 </dl>
@@ -376,7 +376,7 @@ Functions</h2></td></tr>
           <td class="paramkey"></td>
           <td></td>
           <td class="paramtype">const char * </td>
-          <td class="paramname"><em>res_name</em> </td>
+          <td class="paramname"><em>sample_name</em> </td>
         </tr>
         <tr>
           <td></td>
@@ -391,7 +391,7 @@ Functions</h2></td></tr>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
     <tr><td class="paramname">c</td><td>: the context from which the handle will be created (NULL for default context) </td></tr>
-    <tr><td class="paramname">res_name</td><td>: the resource name </td></tr>
+    <tr><td class="paramname">sample_name</td><td>: the name of the sample file (without the .tmpl extension) </td></tr>
   </table>
   </dd>
 </dl>
diff --git a/html/interfaceeccodes_1_1codes__get.html b/html/interfaceeccodes_1_1codes__get.html
index 613b6dc..929635f 100644
--- a/html/interfaceeccodes_1_1codes__get.html
+++ b/html/interfaceeccodes_1_1codes__get.html
@@ -135,7 +135,7 @@ Public Member Functions</h2></td></tr>
 <dl class="section see"><dt>See Also</dt><dd><a class="el" href="classeccodes.html#a5533c6fb8bd7d8f622c89484b7bbdfb6" title="Load in memory a message from a file. ">codes_new_from_file</a>, <a class="el" href="classeccodes.html#a1c0ab28b0ae33f04d267d794a8bdd4b7" title="Free the memory for the message referred as msgid. ">codes_release</a>, <a class="el" href="interfaceeccodes_1_1codes__set.html" title="Set the value for a key in a grib message. ">codes_set</a></dd></dl>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
-    <tr><td class="paramdir">[in]</td><td class="paramname">gribid</td><td>id of the grib loaded in memory </td></tr>
+    <tr><td class="paramdir">[in]</td><td class="paramname">gribid</td><td>id of the message loaded in memory </td></tr>
     <tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>key name </td></tr>
     <tr><td class="paramdir">[out]</td><td class="paramname">value</td><td>value can be a scalar or array of integer(4),real(4),real(8),character </td></tr>
     <tr><td class="paramdir">[out]</td><td class="paramname">status</td><td>CODES_SUCCESS if OK, integer value on error </td></tr>
diff --git a/html/interfaceeccodes_1_1codes__set.html b/html/interfaceeccodes_1_1codes__set.html
index 6dcf4b9..fe43a7f 100644
--- a/html/interfaceeccodes_1_1codes__set.html
+++ b/html/interfaceeccodes_1_1codes__set.html
@@ -137,7 +137,7 @@ Public Member Functions</h2></td></tr>
 <dl class="section see"><dt>See Also</dt><dd><a class="el" href="classeccodes.html#a5533c6fb8bd7d8f622c89484b7bbdfb6" title="Load in memory a message from a file. ">codes_new_from_file</a>, <a class="el" href="classeccodes.html#a1c0ab28b0ae33f04d267d794a8bdd4b7" title="Free the memory for the message referred as msgid. ">codes_release</a>, <a class="el" href="interfaceeccodes_1_1codes__get.html" title="Get the value for a key from a grib message. ">codes_get</a></dd></dl>
 <dl class="params"><dt>Parameters</dt><dd>
   <table class="params">
-    <tr><td class="paramdir">[in]</td><td class="paramname">gribid</td><td>id of the grib loaded in memory </td></tr>
+    <tr><td class="paramdir">[in]</td><td class="paramname">gribid</td><td>id of the message loaded in memory </td></tr>
     <tr><td class="paramdir">[in]</td><td class="paramname">key</td><td>key name </td></tr>
     <tr><td class="paramdir">[out]</td><td class="paramname">value</td><td>value can be a scalar or array of integer(4),real(4),real(8) </td></tr>
     <tr><td class="paramdir">[out]</td><td class="paramname">status</td><td>CODES_SUCCESS if OK, integer value on error </td></tr>
diff --git a/memfs.py b/memfs.py
index 8990bdd..f3cf40f 100755
--- a/memfs.py
+++ b/memfs.py
@@ -13,6 +13,14 @@ print(dirs)
 FILES = {}
 NAMES = []
 
+# Binary to ASCII function. Different in Python 2 and 3
+try:
+    str(b'\x23\x20','ascii')
+    ascii = lambda x: str(x, 'ascii')  # Python 3
+except:
+    ascii = lambda x: str(x)           # Python 2
+
+
 # The last argument is the generated C file
 g = open(sys.argv[-1], "w")
 
@@ -49,9 +57,7 @@ for directory in dirs:
                 # Read two characters at a time and convert to C hex
                 # e.g. 23 -> 0x23
                 for n in range(0, len(fcont), 2):
-                    twoChars = fcont[n:n+2]
-                    if sys.version_info.major > 2:
-                        twoChars = str(twoChars,'ascii')
+                    twoChars = ascii(fcont[n:n+2])
                     print("0x%s," % (twoChars,), end="", file=g)
                     i += 1
                     if (i % 20) == 0:
diff --git a/memfs/CMakeLists.txt b/memfs/CMakeLists.txt
index 23a4a91..fd64e50 100644
--- a/memfs/CMakeLists.txt
+++ b/memfs/CMakeLists.txt
@@ -12,6 +12,12 @@ set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/memfs.c PROPERTIES OBJE
     # "${PROJECT_SOURCE_DIR}/memfs.py" ${definition_files}"
     )
 
+# No debug symbols on Cray (workaround for HPC-230)
+if( CMAKE_C_COMPILER_ID MATCHES Cray )
+  string( REGEX REPLACE "-g|-G[ 0-3]" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" )
+  string( REGEX REPLACE "-g|-G[ 0-3]" " " CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_CAPS} "${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}" )
+endif()
+
 if (HAVE_MEMFS)
     ecbuild_add_library(TARGET    eccodes_memfs
                         SOURCES   ${CMAKE_CURRENT_BINARY_DIR}/memfs.c
diff --git a/python/eccodes/high_level/codesfile.py b/python/eccodes/high_level/codesfile.py
index 261a097..b80f812 100644
--- a/python/eccodes/high_level/codesfile.py
+++ b/python/eccodes/high_level/codesfile.py
@@ -45,7 +45,7 @@ class CodesFile(file):
         self.open_messages = []
 
     def __exit__(self, exception_type, exception_value, traceback):
-        """Close all open messages, release GRIB file handle and close file."""
+        """Close all open messages, release file handle and close file."""
         while self.open_messages:
             self.open_messages.pop().close()
         self.file_handle.close()
diff --git a/python/gribapi/gribapi.py b/python/gribapi/gribapi.py
index a690353..5734179 100644
--- a/python/gribapi/gribapi.py
+++ b/python/gribapi/gribapi.py
@@ -996,8 +996,9 @@ def grib_get_string_array(msgid, key):
 
     GRIB_CHECK(_internal.grib_c_get_string_array(msgid, key, a, s))
 
+    newsize = s.value()
     result = list()
-    for i in range(nval):
+    for i in range(newsize):
         result.append(_internal.stringArray_getitem(a, i))
 
     _internal.delete_stringArray(a)
diff --git a/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake b/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
index a4d1813..8ad7ac8 100644
--- a/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
+++ b/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
@@ -95,6 +95,8 @@ set( EC_ATTRIBUTE_CONSTRUCTOR_INITS_ARGV 0 )
 set( EC_HAVE_PROCFS 1 )
 set( EC_HAVE_DLFCN_H 1 )
 set( EC_HAVE_DLADDR 1 )
+set( EC_HAVE_AIOCB 1 )
+set( EC_HAVE_AIOCB64 1 )
 
 # Disable relative rpaths as aprun does not respect it
 set( ENABLE_RELATIVE_RPATHS OFF CACHE STRING "Disable relative rpaths" FORCE )
@@ -112,6 +114,8 @@ CMAKE_FORCE_Fortran_COMPILER ( ftn Cray )
 set( ECBUILD_FIND_MPI OFF )
 set( ECBUILD_TRUST_FLAGS ON )
 
+set( CXX11_FLAG "-hstd=c++11" )
+
 ####################################################################
 # OpenMP FLAGS
 ####################################################################
@@ -128,10 +132,16 @@ set( OMPSTUBS_Fortran_FLAGS  "-hnoomp" )
 # LINK FLAGS
 ####################################################################
 
+if( EXISTS "$ENV{CC_X86_64}/lib/x86-64/libcray-c++-rts.so" )
+  set( LIBCRAY_CXX_RTS "$ENV{CC_X86_64}/lib/x86-64/libcray-c++-rts.so" ) 
+elseif( EXISTS "$ENV{CC_X86_64}/lib/libcray-c++-rts.so" )
+  set( LIBCRAY_CXX_RTS "$ENV{CC_X86_64}/lib/libcray-c++-rts.so" ) 
+endif()
+
 set( ECBUILD_SHARED_LINKER_FLAGS "-Wl,--eh-frame-hdr -Ktrap=fp" )
 set( ECBUILD_MODULE_LINKER_FLAGS "-Wl,--eh-frame-hdr -Ktrap=fp -Wl,-Map,loadmap" )
 set( ECBUILD_EXE_LINKER_FLAGS    "-Wl,--eh-frame-hdr -Ktrap=fp -Wl,-Map,loadmap -Wl,--as-needed" )
-set( ECBUILD_CXX_IMPLICIT_LINK_LIBRARIES "$ENV{CC_X86_64}/lib/x86-64/libcray-c++-rts.so" CACHE STRING "" )
+set( ECBUILD_CXX_IMPLICIT_LINK_LIBRARIES "${LIBCRAY_CXX_RTS}" CACHE STRING "" )
 
 ####################################################################
 # LIBRARIES
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f385bb5..bd1f22f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -287,6 +287,7 @@ list( APPEND grib_api_srcs
     grib_dumper_class_bufr_decode_filter.c
     grib_dumper_class_bufr_decode_fortran.c
     grib_dumper_class_bufr_decode_python.c
+    grib_dumper_class_bufr_simple.c
     grib_dumper_class_json.c
     grib_dumper_class_grib_encode_C.c
     grib_dumper_class_wmo.c
@@ -342,6 +343,7 @@ list( APPEND grib_api_srcs
     grib_nearest_class_latlon_reduced.c
     grib_nearest_class_sh.c
     grib_nearest_class_lambert_conformal.c
+    grib_nearest_class_polar_stereographic.c
     grib_iterator_class_polar_stereographic.c
     grib_iterator_class_lambert_azimuthal_equal_area.c
     grib_iterator_class_lambert_conformal.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 4125d7a..e3a5294 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -302,6 +302,7 @@ libeccodes_la_prototypes= \
 	grib_dumper_class_bufr_decode_filter.c \
 	grib_dumper_class_bufr_decode_fortran.c \
 	grib_dumper_class_bufr_decode_python.c \
+	grib_dumper_class_bufr_simple.c \
 	grib_dumper_class_json.c \
 	grib_dumper_class_grib_encode_C.c \
 	grib_dumper_class_wmo.c \
@@ -357,6 +358,7 @@ libeccodes_la_prototypes= \
 	grib_nearest_class_latlon_reduced.c \
 	grib_nearest_class_sh.c \
 	grib_nearest_class_lambert_conformal.c \
+	grib_nearest_class_polar_stereographic.c \
 	grib_iterator_class_polar_stereographic.c \
 	grib_iterator_class_lambert_azimuthal_equal_area.c  \
 	grib_iterator_class_lambert_conformal.c \
diff --git a/src/eccodes.c b/src/eccodes.c
index 0f67c59..a271e52 100644
--- a/src/eccodes.c
+++ b/src/eccodes.c
@@ -40,6 +40,11 @@ int codes_count_in_file(grib_context* c, FILE* f,int* n)
 {
     return grib_count_in_file(c,f,n);
 }
+int codes_count_in_filename(grib_context* c, const char* filename, int* n)
+{
+    return grib_count_in_filename(c, filename, n);
+}
+
 grib_context* codes_context_get_default(void)
 {
     return grib_context_get_default();
@@ -162,9 +167,9 @@ grib_handle* codes_handle_new_from_message_copy(grib_context* c, const void* dat
 {
     return grib_handle_new_from_message_copy(c,data,data_len);
 }
-grib_handle* codes_grib_handle_new_from_samples (grib_context* c, const char* res_name)
+grib_handle* codes_grib_handle_new_from_samples(grib_context* c, const char* sample_name)
 {
-    return grib_handle_new_from_samples(c, res_name);
+    return grib_handle_new_from_samples(c, sample_name);
 }
 grib_handle* codes_handle_clone(grib_handle* h)
 {
@@ -344,9 +349,9 @@ int codes_get_string(grib_handle* h, const char* key, char* mesg, size_t *length
 {
     return grib_get_string(h,key,mesg,length);
 }
-int codes_get_string_array(grib_handle* h, const char* name, char** val, size_t *length)
+int codes_get_string_array(grib_handle* h, const char* key, char** vals, size_t *length)
 {
-    return grib_get_string_array(h,name,val,length);
+    return grib_get_string_array(h,key,vals,length);
 }
 int codes_get_bytes(grib_handle* h, const char* key, unsigned char* bytes, size_t *length)
 {
diff --git a/src/eccodes.h b/src/eccodes.h
index 2e16d5d..3ac6145 100644
--- a/src/eccodes.h
+++ b/src/eccodes.h
@@ -356,6 +356,15 @@ The codes_handle is the structure giving access to parsed message values by keys
 */
 int codes_count_in_file(codes_context* c, FILE* f,int* n);
 
+/**
+*  Counts the messages contained in a file.
+*
+* @param c           : the context from which the handle will be created (NULL for default context)
+* @param filename    : the path to the file
+* @param n           : the number of messages in the file
+* @return            0 if OK, integer value on error
+*/
+int codes_count_in_filename(codes_context* c, const char* filename, int* n);
 
 /**
 *  Create a handle from a file resource.
@@ -449,24 +458,24 @@ codes_handle* codes_handle_new_from_message_copy(codes_context* c, const void* d
 
 
 /**
- *  Create a handle from a GRIB message contained in a samples directory.
+ *  Create a handle from a GRIB message contained in the samples directory.
  *  The message is copied at the creation of the handle
  *
  * @param c           : the context from which the handle will be created (NULL for default context)
- * @param res_name    : the resource name
+ * @param sample_name : the name of the sample file (without the .tmpl extension)
  * @return            the new handle, NULL if the resource is invalid or a problem is encountered
  */
-codes_handle* codes_grib_handle_new_from_samples (codes_context* c, const char* res_name)  ;
+codes_handle* codes_grib_handle_new_from_samples (codes_context* c, const char* sample_name);
 
 /**
  *  Create a handle from a BUFR message contained in a samples directory.
  *  The message is copied at the creation of the handle
  *
  * @param c           : the context from which the handle will be created (NULL for default context)
- * @param res_name    : the resource name
+ * @param sample_name : the name of the sample file (without the .tmpl extension)
  * @return            the new handle, NULL if the resource is invalid or a problem is encountered
  */
-codes_handle* codes_bufr_handle_new_from_samples (codes_context* c, const char* res_name)  ;
+codes_handle* codes_bufr_handle_new_from_samples (codes_context* c, const char* sample_name);
 
 
 /**
@@ -789,7 +798,17 @@ int codes_get_double_elements(codes_handle* h, const char* key, int* i, long siz
 */
 int codes_get_string(codes_handle* h, const char* key, char* mesg, size_t *length  );
 
-int codes_get_string_array(codes_handle* h, const char* name, char** val, size_t *length);
+/**
+*  Get string array values from a key. If several keys of the same name are present, the last one is returned
+* @see  codes_set_string_array
+*
+* @param h       : the handle to get the data from
+* @param key     : the key to be searched
+* @param vals    : the address of a string array where the data will be retrieved
+* @param length  : the address of a size_t that contains allocated length of the array on input, and that contains the actual length of the array on output
+* @return        0 if OK, integer value on error
+*/
+int codes_get_string_array(codes_handle* h, const char* key, char** vals, size_t *length);
 
 /**
 *  Get raw bytes values from a key. If several keys of the same name are present, the last one is returned
@@ -807,11 +826,11 @@ int codes_get_bytes(codes_handle* h, const char* key, unsigned char* bytes, size
 *  Get double array values from a key. If several keys of the same name are present, the last one is returned
 * @see  codes_set_double_array
 *
-* @param h           : the handle to get the data from
-* @param key         : the key to be searched
-* @param vals       : the address of a double array where the data will be retrieved
-* @param length      : the address of a size_t that contains allocated length of the double array on input, and that contains the actual length of the double array on output
-* @return            0 if OK, integer value on error
+* @param h        : the handle to get the data from
+* @param key      : the key to be searched
+* @param vals     : the address of a double array where the data will be retrieved
+* @param length   : the address of a size_t that contains allocated length of the double array on input, and that contains the actual length of the double array on output
+* @return         0 if OK, integer value on error
 */
 int codes_get_double_array(codes_handle* h, const char* key, double* vals, size_t *length);
 
diff --git a/src/grib_accessor.c b/src/grib_accessor.c
index 831db60..2a54618 100644
--- a/src/grib_accessor.c
+++ b/src/grib_accessor.c
@@ -732,7 +732,7 @@ const char* grib_accessor_get_name(grib_accessor* a) {
 grib_accessor* _grib_accessor_get_attribute(grib_accessor* a,const char* name,int* index)
 {
     int i=0;
-    while (a->attributes[i] && i<MAX_ACCESSOR_ATTRIBUTES) {
+    while (i<MAX_ACCESSOR_ATTRIBUTES && a->attributes[i]) {
         if (!strcmp(a->attributes[i]->name,name)) {
             *index=i;
             return a->attributes[i];
diff --git a/src/grib_accessor_class.c b/src/grib_accessor_class.c
index feb8750..b820072 100644
--- a/src/grib_accessor_class.c
+++ b/src/grib_accessor_class.c
@@ -100,12 +100,13 @@ grib_section* grib_create_root_section(const grib_context *context, grib_handle
 static GRIB_INLINE grib_accessor_class* get_class(grib_context* c,char* type)
 {
     int i;
-    const int table_count = NUMBER(table);
+    int table_count = 0;
     grib_accessor_class** the_class=NULL;
 
     if ( (the_class=(grib_accessor_class**)grib_trie_get(c->classes,type))!=NULL)
         return *(the_class);
 
+    table_count = NUMBER(table);
     for(i = 0; i < table_count ; i++) {
         if( grib_inline_strcmp(type,table[i].type) == 0 )
         {
@@ -208,7 +209,7 @@ static void link_same_attributes(grib_accessor* a,grib_accessor* b)
     int idx=0;
     grib_accessor* bAttribute=NULL;
     if (a==NULL || b==NULL) return;
-    while (a->attributes[i] && i<MAX_ACCESSOR_ATTRIBUTES) {
+    while (i<MAX_ACCESSOR_ATTRIBUTES && a->attributes[i]) {
         bAttribute=_grib_accessor_get_attribute(b,a->attributes[i]->name,&idx);
         if (bAttribute) a->attributes[i]->same=bAttribute;
         i++;
diff --git a/src/grib_accessor_class_bufr_data_array.c b/src/grib_accessor_class_bufr_data_array.c
index e1d1fe8..c7eeba8 100644
--- a/src/grib_accessor_class_bufr_data_array.c
+++ b/src/grib_accessor_class_bufr_data_array.c
@@ -912,6 +912,7 @@ static int decode_element(grib_context* c,grib_accessor_bufr_data_array* self,in
     double cdval=0,x;
     int err=0;
     bufr_descriptor* bd = descriptor==NULL ? self->expanded->v[i] : descriptor ;
+    /* Assert( b->data == data); */
 
     if (self->change_ref_value_operand > 0 && self->change_ref_value_operand != 255) {
         /* Operator 203YYY: Change Reference Values: Definition phase */
@@ -983,6 +984,9 @@ static int decode_replication(grib_context* c,grib_accessor_bufr_data_array* sel
     bufr_descriptor** descriptors=0;
     err=&ret;
     descriptors=self->expanded->v;
+
+    /* Assert(buff->data == data); */
+
     grib_context_log(c, GRIB_LOG_DEBUG,"BUFR data decoding: -%ld- \tcode=%6.6ld width=%ld ",
             i,self->expanded->v[i]->code,self->expanded->v[i]->width);
     if (self->compressedData) {
@@ -1098,6 +1102,7 @@ static int encode_new_replication(grib_context* c,grib_accessor_bufr_data_array*
     int err=0;
     unsigned long repetitions=1;
     bufr_descriptor** descriptors=self->expanded->v;
+    /* Assert( buff->data==data); */
 
     switch(descriptors[i]->code) {
     case 31000:
@@ -1154,6 +1159,7 @@ static int encode_element(grib_context* c,grib_accessor_bufr_data_array* self,in
     int idx,j;
     int err=0;
     bufr_descriptor* bd = descriptor==NULL ? self->expanded->v[i] : descriptor ;
+    /* Assert( buff->data == data); */
 
     grib_context_log(c, GRIB_LOG_DEBUG,"BUFR data encoding: -%ld- \tcode=%6.6ld width=%ld pos=%ld ulength=%ld ulength_bits=%ld",
             i,bd->code,bd->width,(long)*pos,buff->ulength,buff->ulength_bits);
@@ -1196,6 +1202,7 @@ static int encode_element(grib_context* c,grib_accessor_bufr_data_array* self,in
 static int encode_replication(grib_context* c,grib_accessor_bufr_data_array* self,int subsetIndex,
         grib_buffer* buff,unsigned char* data,long *pos,int i,long elementIndex,grib_darray* dval,long* numberOfRepetitions)
 {
+    /* Assert( buff->data == data); */
     if (self->compressedData) {
         Assert(grib_darray_used_size(self->numericValues->v[elementIndex])==1);
         *numberOfRepetitions=self->numericValues->v[elementIndex]->v[0];
@@ -2323,7 +2330,7 @@ static int process_elements(grib_accessor* a,int flag,long onlySubset,long start
     default :
         return GRIB_NOT_IMPLEMENTED;
     }
-    data=(unsigned char*)buffer->data;
+    data = buffer->data;
 
     err=get_descriptors(a);
     if (err) return err;
@@ -2404,6 +2411,8 @@ static int process_elements(grib_accessor* a,int flag,long onlySubset,long start
                 n[inr]=numberOfElementsToRepeat[inr];
                 i++;
 
+                /* ECC-517 */
+                data = buffer->data;
                 err=codec_replication(c,self,iss,buffer,data,&pos,i,elementIndex,dval,&(numberOfRepetitions[inr]));
                 if (err) return err;
 
diff --git a/src/grib_accessor_class_bufr_data_element.c b/src/grib_accessor_class_bufr_data_element.c
index b72903d..5797478 100644
--- a/src/grib_accessor_class_bufr_data_element.c
+++ b/src/grib_accessor_class_bufr_data_element.c
@@ -288,13 +288,17 @@ static int unpack_string_array (grib_accessor* a, char** val, size_t *len)
     grib_context* c=a->context;
 
     if (self->compressedData) {
+        DebugAssert(self->index < self->numericValues->n);
         idx=((int)self->numericValues->v[self->index]->v[0]/1000-1)/self->numberOfSubsets;
+        DebugAssert(idx < self->stringValues->n);
         count=grib_sarray_used_size(self->stringValues->v[idx]);
         for (i=0;i<count;i++) {
             val[i]=grib_context_strdup(c,self->stringValues->v[idx]->v[i]);
         }
         *len=count;
     } else {
+        DebugAssert(self->subsetNumber < self->numericValues->n);
+        DebugAssert(self->index < self->numericValues->v[self->subsetNumber]->n);
         idx=(int)self->numericValues->v[self->subsetNumber]->v[self->index]/1000-1;
         val[0]=grib_context_strdup(c,self->stringValues->v[idx]->v[0]);
         *len=1;
@@ -354,12 +358,15 @@ static int unpack_string (grib_accessor* a, char* val, size_t *len)
     }
 
     if (self->compressedData) {
+        DebugAssert(self->index < self->numericValues->n);
         idx=((int)self->numericValues->v[self->index]->v[0]/1000-1)/self->numberOfSubsets;
         if (idx < 0) return GRIB_INTERNAL_ERROR;
         str=grib_context_strdup(c,self->stringValues->v[idx]->v[0]);
     } else {
+        DebugAssert(self->subsetNumber < self->numericValues->n);
         idx=(int)self->numericValues->v[self->subsetNumber]->v[self->index]/1000-1;
         if (idx < 0) return GRIB_INTERNAL_ERROR;
+        DebugAssert(idx < self->stringValues->n);
         str=grib_context_strdup(c,self->stringValues->v[idx]->v[0]);
     }
 
@@ -420,11 +427,15 @@ static int unpack_long (grib_accessor* a, long* val, size_t *len)
 
     if (self->compressedData) {
         for (i=0;i<count;i++) {
+            DebugAssert(self->index < self->numericValues->n);
+            DebugAssert(i < self->numericValues->v[self->index]->n);
             val[i]= self->numericValues->v[self->index]->v[i] == GRIB_MISSING_DOUBLE ?
                     GRIB_MISSING_LONG : (long)self->numericValues->v[self->index]->v[i];
         }
         *len=count;
     } else {
+        DebugAssert(self->subsetNumber < self->numericValues->n);
+        DebugAssert(self->index < self->numericValues->v[self->subsetNumber]->n);
         val[0]= self->numericValues->v[self->subsetNumber]->v[self->index] == GRIB_MISSING_DOUBLE ?
                 GRIB_MISSING_LONG : (long)self->numericValues->v[self->subsetNumber]->v[self->index];
         *len=1;
@@ -445,10 +456,14 @@ static int unpack_double (grib_accessor* a, double* val, size_t *len)
 
     if (self->compressedData) {
         for (i=0;i<count;i++) {
+            DebugAssert(self->index < self->numericValues->n);
+            DebugAssert(i < self->numericValues->v[self->index]->n);
             val[i]=self->numericValues->v[self->index]->v[i];
         }
         *len=count;
     } else {
+        DebugAssert(self->subsetNumber < self->numericValues->n);
+        DebugAssert(self->index < self->numericValues->v[self->subsetNumber]->n);
         val[0]=self->numericValues->v[self->subsetNumber]->v[self->index];
         *len=1;
     }
@@ -526,9 +541,11 @@ static int value_count(grib_accessor* a,long* count)
     type=get_native_type(a);
 
     if (type==GRIB_TYPE_STRING) {
+        DebugAssert(self->index < self->numericValues->n);
         idx=((int)self->numericValues->v[self->index]->v[0]/1000-1)/self->numberOfSubsets;
         size=grib_sarray_used_size(self->stringValues->v[idx]);
     } else {
+        DebugAssert(self->index < self->numericValues->n);
         size=grib_darray_used_size(self->numericValues->v[self->index]);
     }
 
diff --git a/src/grib_accessor_class_codetable.c b/src/grib_accessor_class_codetable.c
index 74e9514..36639e1 100644
--- a/src/grib_accessor_class_codetable.c
+++ b/src/grib_accessor_class_codetable.c
@@ -55,6 +55,7 @@ static void thread_init()
    MEMBERS    =  const char* masterDir
    MEMBERS    =  const char* localDir
    MEMBERS    =  grib_codetable* table
+   MEMBERS    =  int table_loaded
    END_CLASS_DEF
 
  */
@@ -92,6 +93,7 @@ typedef struct grib_accessor_codetable {
 	const char* masterDir;
 	const char* localDir;
 	grib_codetable* table;
+	int table_loaded;
 } grib_accessor_codetable;
 
 extern grib_accessor_class* grib_accessor_class_unsigned;
@@ -180,12 +182,30 @@ static int grib_load_codetable(grib_context* c,const char* filename,
 static void init(grib_accessor* a, const long len, grib_arguments* params)
 {
     int n=0;
+    long new_len = len;
+    grib_handle* hand = grib_handle_of_accessor(a);
     grib_accessor_codetable* self  = (grib_accessor_codetable*)a;
     grib_action* act=(grib_action*)(a->creator);
+    DebugAssert(len == self->nbytes);
+
+    if (new_len == 0) {
+        /* ECC-485: When the codetable length is 0, it means we are passing
+         * its length as an identifier not an integer. This identifier is
+         * added to the argument list (at the beginning)
+         */
+        new_len = grib_arguments_get_long(hand,params,n++);
+        if ( new_len <= 0 ) {
+            grib_context_log(a->context,GRIB_LOG_FATAL,"%s: codetable length must be a positive integer",a->name);
+        }
+        self->nbytes = new_len;
+    }
 
-    self->tablename = grib_arguments_get_string(grib_handle_of_accessor(a),params,n++);
-    self->masterDir = grib_arguments_get_name(grib_handle_of_accessor(a),params,n++);
-    self->localDir = grib_arguments_get_name(grib_handle_of_accessor(a),params,n++);
+    self->tablename = grib_arguments_get_string(hand,params,n++);
+    if (self->tablename == NULL) {
+        grib_context_log(a->context,GRIB_LOG_FATAL,"%s: codetable table is invalid",a->name);
+    }
+    self->masterDir = grib_arguments_get_name(hand,params,n++); /* can be NULL */
+    self->localDir  = grib_arguments_get_name(hand,params,n++); /* can be NULL */
 
     /*if (a->flags & GRIB_ACCESSOR_FLAG_STRING_TYPE)
     printf("-------- %s type string (%ld)\n",a->name,a->flags);*/
@@ -195,7 +215,7 @@ static void init(grib_accessor* a, const long len, grib_arguments* params)
         if (!a->vvalue)
             a->vvalue = (grib_virtual_value*)grib_context_malloc_clear(a->context,sizeof(grib_virtual_value));
         a->vvalue->type=grib_accessor_get_native_type(a);
-        a->vvalue->length=len;
+        a->vvalue->length = new_len;
         if (act->default_value!=NULL) {
             const char* p = 0;
             size_t s_len = 1;
@@ -203,11 +223,11 @@ static void init(grib_accessor* a, const long len, grib_arguments* params)
             int ret=0;
             double d;
             char tmp[1024];
-            grib_expression* expression=grib_arguments_get_expression(grib_handle_of_accessor(a),act->default_value,0);
-            int type = grib_expression_native_type(grib_handle_of_accessor(a),expression);
+            grib_expression* expression=grib_arguments_get_expression(hand,act->default_value,0);
+            int type = grib_expression_native_type(hand,expression);
             switch(type) {
             case GRIB_TYPE_DOUBLE:
-                grib_expression_evaluate_double(grib_handle_of_accessor(a),expression,&d);
+                grib_expression_evaluate_double(hand,expression,&d);
                 grib_pack_double(a,&d,&s_len);
                 break;
 
@@ -229,13 +249,21 @@ static void init(grib_accessor* a, const long len, grib_arguments* params)
             }
         }
     } else {
-        a->length = len;
+        a->length = new_len;
     }
 }
 
+/* Note: A fast cut-down version of strcmp which does NOT return -1 */
+/* 0 means input strings are equal and 1 means not equal */
+GRIB_INLINE static int grib_inline_strcmp(const char* a,const char* b) {
+    if (*a != *b) return 1;
+    while((*a!=0 && *b!=0) &&  *(a) == *(b) ) {a++;b++;}
+    return (*a==0 && *b==0) ? 0 : 1;
+}
+
 static int str_eq(const char* a, const char* b)
 {
-    if ( a && b && (strcmp(a,b)==0) )
+    if ( a && b && (grib_inline_strcmp(a,b)==0) )
         return 1;
     return 0;
 }
@@ -297,13 +325,17 @@ static grib_codetable* load_table(grib_accessor_codetable* self)
     GRIB_MUTEX_INIT_ONCE(&once,&thread_init);
     GRIB_MUTEX_LOCK(&mutex1); /* GRIB-930 */
 
-    /*printf("%s: Looking in cache: f=%s lf=%s\n", self->att.name, filename, localFilename);*/
+    /*printf("DBG %s: Look in cache: f=%s lf=%s (recomposed=%s)\n", self->att.name, filename, localFilename,recomposed);*/
+    if (filename == NULL && localFilename == NULL) {
+        t = NULL;
+        goto the_end;
+    }
     next=c->codetable;
     while(next) {
-        if ((filename && next->filename[0] && strcmp(filename,next->filename[0]) == 0) &&
+        if ((filename && next->filename[0] && grib_inline_strcmp(filename,next->filename[0]) == 0) &&
                 ((localFilename==0 && next->filename[1]==NULL) ||
                         ((localFilename!=0 && next->filename[1]!=NULL)
-                                && strcmp(localFilename,next->filename[1]) ==0)) )
+                                && grib_inline_strcmp(localFilename,next->filename[1]) ==0)) )
         {
             t = next;
             goto the_end;
@@ -502,7 +534,10 @@ static void dump(grib_accessor* a, grib_dumper* dumper)
     size_t llen = 1;
     long value;
 
-    if(!self->table) self->table = load_table(self);
+    if (!self->table_loaded) {
+        self->table = load_table(self); /* may return NULL */
+        self->table_loaded = 1;
+    }
     table=self->table;
 
     grib_unpack_long(a, &value,&llen);
@@ -525,7 +560,7 @@ static void dump(grib_accessor* a, grib_dumper* dumper)
             else
                 sprintf(comment,"%s", table->entries[value].title);
 
-            if (table->entries[value].units!=NULL && strcmp(table->entries[value].units,"unknown")) {
+            if (table->entries[value].units!=NULL && grib_inline_strcmp(table->entries[value].units,"unknown")) {
                 strcat(comment," (");
                 strcat(comment,table->entries[value].units);
                 strcat(comment,") ");
@@ -569,7 +604,10 @@ static int unpack_string (grib_accessor* a, char* buffer, size_t *len)
     if( (err = grib_unpack_long(a,&value,&size)) != GRIB_SUCCESS)
         return err;
 
-    if(!self->table) self->table = load_table(self);
+    if (!self->table_loaded) {
+        self->table = load_table(self); /* may return NULL */
+        self->table_loaded=1;
+    }
     table=self->table;
 
     if(table && (value >= 0) && (value < table->size) && table->entries[value].abbreviation)
@@ -622,7 +660,10 @@ static int pack_string(grib_accessor* a, const char* buffer, size_t *len)
     cmpproc cmp = (a->flags & GRIB_ACCESSOR_FLAG_LOWERCASE) ? stricmp : strcmp;
 #endif
 
-    if(!self->table) self->table = load_table(self);
+    if (!self->table_loaded) {
+        self->table = load_table(self); /* may return NULL */
+        self->table_loaded=1;
+    }
     table=self->table;
 
     if(!table)
@@ -731,19 +772,24 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len)
 {
     grib_accessor_codetable* self = (grib_accessor_codetable*)a;
     long rlen = 0;
-    int err=0;
+
     unsigned long i = 0;
     long pos = a->offset*8;
     grib_handle* hand = NULL;
 
 #ifdef DEBUG
-    err=grib_value_count(a,&rlen);
-    Assert(!err);
-    Assert(rlen == 1);
+    {
+        int err = grib_value_count(a,&rlen);
+        Assert(!err);
+        Assert(rlen == 1);
+    }
 #endif
     rlen = 1; /* ECC-480 Performance: avoid func call overhead of grib_value_count */
 
-    if(!self->table) self->table = load_table(self);
+    if (!self->table_loaded) {
+        self->table = load_table(self); /* may return NULL */
+        self->table_loaded=1;
+    }
 
     if(*len < rlen)
     {
diff --git a/src/grib_accessor_class_concept.c b/src/grib_accessor_class_concept.c
index 70a8470..d2ebd96 100644
--- a/src/grib_accessor_class_concept.c
+++ b/src/grib_accessor_class_concept.c
@@ -189,7 +189,7 @@ static int concept_condition_expression_true(grib_handle* h,grib_concept_conditi
     case GRIB_TYPE_STRING:
         ok = (grib_get_string(h,c->name,buf,&len) == GRIB_SUCCESS) &&
         ((cval = grib_expression_evaluate_string(h,c->expression,tmp,&size,&err)) != NULL) &&
-        (err==0) && (strcmp(buf,cval) == 0);
+        (err==0) && (grib_inline_strcmp(buf,cval) == 0);
         break;
 
     default:
diff --git a/src/grib_accessor_class_data_2order_packing.c b/src/grib_accessor_class_data_2order_packing.c
index 07a64ce..0eb1cbb 100644
--- a/src/grib_accessor_class_data_2order_packing.c
+++ b/src/grib_accessor_class_data_2order_packing.c
@@ -9,9 +9,7 @@
  */
 
 #include "grib_api_internal.h"
-#define fortint long
-#define fortfloat double
-#define C2FORT(x) (x)
+
 /*
    This is used by make_class.pl
 
diff --git a/src/grib_accessor_class_data_2order_packing_count.c b/src/grib_accessor_class_data_2order_packing_count.c
index 5dc692c..54422db 100644
--- a/src/grib_accessor_class_data_2order_packing_count.c
+++ b/src/grib_accessor_class_data_2order_packing_count.c
@@ -146,57 +146,55 @@ static void init_class(grib_accessor_class* c)
 
 static void init(grib_accessor* a,const long v, grib_arguments* args)
 {
-  grib_accessor_data_2order_packing_count *self =(grib_accessor_data_2order_packing_count*)a;
-  int n=0;
+    grib_accessor_data_2order_packing_count *self =(grib_accessor_data_2order_packing_count*)a;
+    int n=0;
 
-  self->offsetsection = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
-  self->p1 = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
-  self->two_ordr_spd          = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
-  self->plus1_spd    = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
-  self->width_lengths = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
-  self->octet_start_group = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
-
-  a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
+    self->offsetsection = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
+    self->p1 = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
+    self->two_ordr_spd          = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
+    self->plus1_spd    = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
+    self->width_lengths = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
+    self->octet_start_group = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
 
+    a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
 }
 
-
-static int    unpack_long   (grib_accessor* a, long* val, size_t *len)
+static int unpack_long   (grib_accessor* a, long* val, size_t *len)
 {
-  int ret=0;
-  grib_accessor_data_2order_packing_count* self =  (grib_accessor_data_2order_packing_count*)a;
-  long count = 0;
-  long  two_ordr_spd = 0;
-  long  plus1_spd    = 0;
-  unsigned char* buf_size_of_groups = (unsigned char*)grib_handle_of_accessor(a)->buffer->data;
-  long octet_start_group = 0;
-  long offsetsection = 0;
-  long nbits_per_lengths = 0;
-  long pointer_of_group_size = 0;
-  long p1 = 0;
-
-  size_t i = 0;
-
-  if ((ret=grib_get_long_internal(grib_handle_of_accessor(a),self->two_ordr_spd, &two_ordr_spd))
-       !=GRIB_SUCCESS) return ret;
-  if ((ret=grib_get_long_internal(grib_handle_of_accessor(a),self->plus1_spd, &plus1_spd))
-       !=GRIB_SUCCESS) return ret;
-  if ((ret=grib_get_long_internal(grib_handle_of_accessor(a),self->width_lengths, &nbits_per_lengths))
-       !=GRIB_SUCCESS) return ret;
-  if ((ret=grib_get_long_internal(grib_handle_of_accessor(a),self->offsetsection, &offsetsection))
-       !=GRIB_SUCCESS) return ret;
-  if ((ret=grib_get_long_internal(grib_handle_of_accessor(a),self->octet_start_group, &octet_start_group))
-       !=GRIB_SUCCESS) return ret;
-  if ((ret=grib_get_long_internal(grib_handle_of_accessor(a),self->p1, &p1))
-       !=GRIB_SUCCESS) return ret;
-
-  buf_size_of_groups +=  offsetsection+(octet_start_group-1);
-  count = two_ordr_spd*2+plus1_spd;
-
-  for(i=0;i < p1;i++)
-    count +=  grib_decode_unsigned_long(buf_size_of_groups,  &pointer_of_group_size, nbits_per_lengths);
-
-  *val=count;
-  *len=1;
-  return GRIB_SUCCESS;
+    int ret=0;
+    grib_accessor_data_2order_packing_count* self =  (grib_accessor_data_2order_packing_count*)a;
+    long count = 0;
+    long  two_ordr_spd = 0;
+    long  plus1_spd    = 0;
+    unsigned char* buf_size_of_groups = (unsigned char*)grib_handle_of_accessor(a)->buffer->data;
+    long octet_start_group = 0;
+    long offsetsection = 0;
+    long nbits_per_lengths = 0;
+    long pointer_of_group_size = 0;
+    long p1 = 0;
+
+    size_t i = 0;
+
+    if ((ret=grib_get_long_internal(grib_handle_of_accessor(a),self->two_ordr_spd, &two_ordr_spd))
+            !=GRIB_SUCCESS) return ret;
+    if ((ret=grib_get_long_internal(grib_handle_of_accessor(a),self->plus1_spd, &plus1_spd))
+            !=GRIB_SUCCESS) return ret;
+    if ((ret=grib_get_long_internal(grib_handle_of_accessor(a),self->width_lengths, &nbits_per_lengths))
+            !=GRIB_SUCCESS) return ret;
+    if ((ret=grib_get_long_internal(grib_handle_of_accessor(a),self->offsetsection, &offsetsection))
+            !=GRIB_SUCCESS) return ret;
+    if ((ret=grib_get_long_internal(grib_handle_of_accessor(a),self->octet_start_group, &octet_start_group))
+            !=GRIB_SUCCESS) return ret;
+    if ((ret=grib_get_long_internal(grib_handle_of_accessor(a),self->p1, &p1))
+            !=GRIB_SUCCESS) return ret;
+
+    buf_size_of_groups +=  offsetsection+(octet_start_group-1);
+    count = two_ordr_spd*2+plus1_spd;
+
+    for(i=0;i < p1;i++)
+        count +=  grib_decode_unsigned_long(buf_size_of_groups,  &pointer_of_group_size, nbits_per_lengths);
+
+    *val=count;
+    *len=1;
+    return GRIB_SUCCESS;
 }
diff --git a/src/grib_accessor_class_data_apply_gdsnotpresent.c b/src/grib_accessor_class_data_apply_gdsnotpresent.c
index 0730d60..62766ad 100644
--- a/src/grib_accessor_class_data_apply_gdsnotpresent.c
+++ b/src/grib_accessor_class_data_apply_gdsnotpresent.c
@@ -153,161 +153,158 @@ static void init_class(grib_accessor_class* c)
 
 static void init(grib_accessor* a,const long v, grib_arguments* args)
 {
-  int n=0;
-  grib_accessor_data_apply_gdsnotpresent *self =(grib_accessor_data_apply_gdsnotpresent*)a;
-
-  self->coded_values  = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
-  self->number_of_values        = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
-  self->number_of_points = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
-  self->latitude_of_first_point = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
-  self->ni = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
-  self->missing_value = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
-  self->bitmap_present = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
-  self->bitmap = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
-
-  a->length = 0;
+    int n=0;
+    grib_accessor_data_apply_gdsnotpresent *self =(grib_accessor_data_apply_gdsnotpresent*)a;
+
+    self->coded_values  = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
+    self->number_of_values        = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
+    self->number_of_points = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
+    self->latitude_of_first_point = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
+    self->ni = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
+    self->missing_value = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
+    self->bitmap_present = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
+    self->bitmap = grib_arguments_get_name(grib_handle_of_accessor(a),args,n++);
+
+    a->length = 0;
 }
+
 static void dump(grib_accessor* a, grib_dumper* dumper)
 {
-  grib_dump_values(dumper,a);
+    grib_dump_values(dumper,a);
 }
 
-
 static int value_count(grib_accessor* a,long* number_of_points)
 {
-  int ret=0;
+    int ret=0;
 
-  grib_accessor_data_apply_gdsnotpresent *self =(grib_accessor_data_apply_gdsnotpresent*)a;
+    grib_accessor_data_apply_gdsnotpresent *self =(grib_accessor_data_apply_gdsnotpresent*)a;
 
-  *number_of_points=0;
-  if((ret = grib_get_long(grib_handle_of_accessor(a),self->number_of_points,number_of_points))
-       !=  GRIB_SUCCESS) {
-    grib_context_log(a->context, GRIB_LOG_ERROR,
-      "grib_accessor_data_apply_gdsnotpresent: value_count: unable to get number of points");
-  }
+    *number_of_points=0;
+    if((ret = grib_get_long(grib_handle_of_accessor(a),self->number_of_points,number_of_points))
+            !=  GRIB_SUCCESS) {
+        grib_context_log(a->context, GRIB_LOG_ERROR,
+                "grib_accessor_data_apply_gdsnotpresent: value_count: unable to get number of points");
+    }
 
-  return ret;
+    return ret;
 }
 
-
-static int  unpack_double(grib_accessor* a, double* val, size_t *len)
+static int unpack_double(grib_accessor* a, double* val, size_t *len)
 {
-  grib_accessor_data_apply_gdsnotpresent* self =  (grib_accessor_data_apply_gdsnotpresent*)a;
-
-  long number_of_points=0,number_of_values=0,ni=0;
-  long latitude_of_first_point=0;
-  size_t i = 0;
-  size_t  n_vals = 0;
-  long nn=0;
-  int err=0;
-  size_t size=0;
-  long missing_value;
-
-  double* coded_vals = NULL;
-
-  err=grib_value_count(a,&nn);
-  n_vals=nn;
-  if (err) return err;
-
-  if((err = grib_get_long(grib_handle_of_accessor(a),self->number_of_points,&number_of_points))
-       !=  GRIB_SUCCESS) return err;
-
-  if((err = grib_get_long(grib_handle_of_accessor(a),self->number_of_values,&number_of_values))
-       !=  GRIB_SUCCESS) return err;
-
-  if((err = grib_get_long(grib_handle_of_accessor(a),self->latitude_of_first_point,&latitude_of_first_point))
-       !=  GRIB_SUCCESS) return err;
+    grib_accessor_data_apply_gdsnotpresent* self =  (grib_accessor_data_apply_gdsnotpresent*)a;
+
+    long number_of_points=0,number_of_values=0,ni=0;
+    long latitude_of_first_point=0;
+    size_t i = 0;
+    size_t  n_vals = 0;
+    long nn=0;
+    int err=0;
+    size_t size=0;
+    long missing_value;
+
+    double* coded_vals = NULL;
+
+    err=grib_value_count(a,&nn);
+    n_vals=nn;
+    if (err) return err;
+
+    if((err = grib_get_long(grib_handle_of_accessor(a),self->number_of_points,&number_of_points))
+            !=  GRIB_SUCCESS) return err;
+
+    if((err = grib_get_long(grib_handle_of_accessor(a),self->number_of_values,&number_of_values))
+            !=  GRIB_SUCCESS) return err;
+
+    if((err = grib_get_long(grib_handle_of_accessor(a),self->latitude_of_first_point,&latitude_of_first_point))
+            !=  GRIB_SUCCESS) return err;
+
+    if((err = grib_get_long(grib_handle_of_accessor(a),self->missing_value,&missing_value))
+            !=  GRIB_SUCCESS) return err;
+
+    if((err = grib_get_long(grib_handle_of_accessor(a),self->ni,&ni))
+            !=  GRIB_SUCCESS) return err;
+
+    if(*len < number_of_points)
+    {
+        *len = n_vals;
+        return GRIB_ARRAY_TOO_SMALL;
+    }
+
+    if(number_of_values > 0){
+        coded_vals = (double*)grib_context_malloc(a->context,number_of_values*sizeof(double));
+
+        if(coded_vals == NULL)
+            return GRIB_OUT_OF_MEMORY;
+    }
+
+    size=number_of_values;
+    if((err=grib_get_double_array_internal(grib_handle_of_accessor(a),self->coded_values,coded_vals,&size))
+            != GRIB_SUCCESS)  {
+        grib_context_free(a->context,coded_vals);
+        return err;
+    }
+    if (number_of_values!=size) {
+        grib_context_log(a->context, GRIB_LOG_ERROR,
+                "grib_accessor_data_apply_gdsnotpresent : wrong numberOfValues %ld != %ld",
+                number_of_values,size);
+    }
+
+    grib_context_log(a->context, GRIB_LOG_DEBUG,
+            "grib_accessor_data_apply_gdsnotpresent : unpack_double : creating %s, %d values",
+            a->name, number_of_points);
+
+    if (latitude_of_first_point == 0) {
+        for (i=0;i < number_of_values;i++) val[i]=coded_vals[i];
+        for (i=number_of_values;i<number_of_points;i++)
+            val[i]=coded_vals[number_of_values-1];
+    } else {
+        for(i=0;i<ni-1;i++) val[i]=coded_vals[0];
+        for(i=ni-1;i<number_of_points;i++) val[i]=coded_vals[i-ni+1];
+    }
+
+    *len =  number_of_points;
 
-  if((err = grib_get_long(grib_handle_of_accessor(a),self->missing_value,&missing_value))
-       !=  GRIB_SUCCESS) return err;
-
-  if((err = grib_get_long(grib_handle_of_accessor(a),self->ni,&ni))
-       !=  GRIB_SUCCESS) return err;
-
-  if(*len < number_of_points)
-  {
-    *len = n_vals;
-    return GRIB_ARRAY_TOO_SMALL;
-  }
-
-  if(number_of_values > 0){
-    coded_vals = (double*)grib_context_malloc(a->context,number_of_values*sizeof(double));
-
-    if(coded_vals == NULL)
-      return GRIB_OUT_OF_MEMORY;
-  }
-
-  size=number_of_values;
-  if((err=grib_get_double_array_internal(grib_handle_of_accessor(a),self->coded_values,coded_vals,&size))
-    != GRIB_SUCCESS)  {
     grib_context_free(a->context,coded_vals);
     return err;
-  }
-  if (number_of_values!=size) {
-    grib_context_log(a->context, GRIB_LOG_ERROR,
-      "grib_accessor_data_apply_gdsnotpresent : wrong numberOfValues %ld != %ld",
-      number_of_values,size);
-  }
-
-  grib_context_log(a->context, GRIB_LOG_DEBUG,
-      "grib_accessor_data_apply_gdsnotpresent : unpack_double : creating %s, %d values",
-      a->name, number_of_points);
-
-  if (latitude_of_first_point == 0) {
-    for (i=0;i < number_of_values;i++) val[i]=coded_vals[i];
-    for (i=number_of_values;i<number_of_points;i++)
-      val[i]=coded_vals[number_of_values-1];
-  } else {
-    for(i=0;i<ni-1;i++) val[i]=coded_vals[0];
-    for(i=ni-1;i<number_of_points;i++) val[i]=coded_vals[i-ni+1];
-  }
-
-  *len =  number_of_points;
-
-  grib_context_free(a->context,coded_vals);
-  return err;
 }
 
-
 static int pack_double(grib_accessor* a, const double* val, size_t *len)
 {
-  int ret=GRIB_SUCCESS;
-  long bitmap_present=0;
+    int ret=GRIB_SUCCESS;
+    long bitmap_present=0;
 
-  grib_accessor_data_apply_gdsnotpresent* self =  (grib_accessor_data_apply_gdsnotpresent*)a;
+    grib_accessor_data_apply_gdsnotpresent* self =  (grib_accessor_data_apply_gdsnotpresent*)a;
 
-  if (*len ==0) return GRIB_NO_VALUES;
+    if (*len ==0) return GRIB_NO_VALUES;
 
-  ret=grib_set_long(grib_handle_of_accessor(a),self->bitmap_present,bitmap_present);
-  if(ret) {
-    grib_context_log(a->context, GRIB_LOG_ERROR,
-       "Accessor %s cannont pack value for %s error %d \n", a->name, self->bitmap_present, ret);
-    return ret;
-  }
+    ret=grib_set_long(grib_handle_of_accessor(a),self->bitmap_present,bitmap_present);
+    if(ret) {
+        grib_context_log(a->context, GRIB_LOG_ERROR,
+                "Accessor %s cannont pack value for %s error %d \n", a->name, self->bitmap_present, ret);
+        return ret;
+    }
 
 #if 0
-  if(!grib_find_accessor(grib_handle_of_accessor(a),self->bitmap)){
-    grib_context_log(a->context, GRIB_LOG_ERROR,
-       "Accessor %s cannont access bitmap \n", a->name, self->bitmap_present, ret);
-    return ret;
-  }
+    if(!grib_find_accessor(grib_handle_of_accessor(a),self->bitmap)){
+        grib_context_log(a->context, GRIB_LOG_ERROR,
+                "Accessor %s cannont access bitmap \n", a->name, self->bitmap_present, ret);
+        return ret;
+    }
 #endif
 
+    ret = grib_set_double_array_internal(grib_handle_of_accessor(a),self->coded_values,val,*len);
+    if(ret) {
+        grib_context_log(a->context, GRIB_LOG_ERROR,
+                "Accessor %s cannont pack value for %s error %d \n", a->name, self->coded_values, ret);
+        return ret;
+    }
 
-  ret = grib_set_double_array_internal(grib_handle_of_accessor(a),self->coded_values,val,*len);
-  if(ret) {
-    grib_context_log(a->context, GRIB_LOG_ERROR,
-       "Accessor %s cannont pack value for %s error %d \n", a->name, self->coded_values, ret);
     return ret;
-  }
-
-  return ret;
 }
 
-static int  get_native_type(grib_accessor* a)
+static int get_native_type(grib_accessor* a)
 {
-/*  grib_accessor_data_apply_gdsnotpresent* self =  (grib_accessor_data_apply_gdsnotpresent*)a;
+    /*  grib_accessor_data_apply_gdsnotpresent* self =  (grib_accessor_data_apply_gdsnotpresent*)a;
     return grib_accessor_get_native_type(grib_find_accessor(grib_handle_of_accessor(a),self->coded_values));*/
 
-   return GRIB_TYPE_DOUBLE;
+    return GRIB_TYPE_DOUBLE;
 }
diff --git a/src/grib_accessor_class_data_complex_packing.c b/src/grib_accessor_class_data_complex_packing.c
index 7380176..c37c1f6 100644
--- a/src/grib_accessor_class_data_complex_packing.c
+++ b/src/grib_accessor_class_data_complex_packing.c
@@ -355,7 +355,7 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
         return 0;
     }
 
-    packed_offset = grib_byte_offset(a) +  4*(sub_k+1)*(sub_k+2);
+    packed_offset = grib_byte_offset(a) +  bytes*(sub_k+1)*(sub_k+2);
 
     lpos = 8*(packed_offset-offsetdata);
 
@@ -394,8 +394,8 @@ static int unpack_double(grib_accessor* a, double* val, size_t *len)
         {
             for(hcount=0;hcount<sub_k+1;hcount++)
             {
-                val[i++] =  decode_float(grib_decode_unsigned_long(hres,&hpos,32));
-                val[i++] =  decode_float(grib_decode_unsigned_long(hres,&hpos,32));
+                val[i++] =  decode_float(grib_decode_unsigned_long(hres,&hpos,8*bytes));
+                val[i++] =  decode_float(grib_decode_unsigned_long(hres,&hpos,8*bytes));
 
                 if (GRIBEX_sh_bug_present && hcount==sub_k){
                     /*  bug in ecmwf data, last row (K+1)is scaled but should not */
@@ -691,7 +691,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len)
         grib_get_double_internal(gh,self->laplacianOperator,&laplacianOperator);
     }
 
-    hsize = 4*(sub_k+1)*(sub_k+2);
+    hsize = bytes*(sub_k+1)*(sub_k+2);
     lsize = ((n_vals - ((sub_k+1)*(sub_k+2)))*bits_per_value)/8;
 
     buflen = hsize+lsize;
@@ -813,16 +813,16 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len)
             {
                 if ( GRIBEX_sh_bug_present && hcount==sub_k ) {
                     /* _test(val[i]*d*scals[lup],1); */
-                    grib_encode_unsigned_long(hres, encode_float((val[i++]*d)*scals[lup]) , &hpos, 32);
+                    grib_encode_unsigned_long(hres, encode_float((val[i++]*d)*scals[lup]) , &hpos, 8*bytes);
                     /* _test(val[i]*d*scals[lup],1); */
-                    grib_encode_unsigned_long(hres, encode_float((val[i++]*d)*scals[lup]) , &hpos, 32);
+                    grib_encode_unsigned_long(hres, encode_float((val[i++]*d)*scals[lup]) , &hpos, 8*bytes);
                 }else{
 
                     /* _test(val[i]*d,0); */
 
-                    grib_encode_unsigned_long(hres, encode_float(val[i++]) , &hpos, 32);
+                    grib_encode_unsigned_long(hres, encode_float(val[i++]) , &hpos, 8*bytes);
                     /* _test(val[i]*d,0); */
-                    grib_encode_unsigned_long(hres, encode_float(val[i++]) , &hpos, 32);
+                    grib_encode_unsigned_long(hres, encode_float(val[i++]) , &hpos, 8*bytes);
                 }
                 lup++;
             }
diff --git a/src/grib_accessor_class_data_g22order_packing.c b/src/grib_accessor_class_data_g22order_packing.c
index 3db7d94..3423b34 100644
--- a/src/grib_accessor_class_data_g22order_packing.c
+++ b/src/grib_accessor_class_data_g22order_packing.c
@@ -9,9 +9,7 @@
  */
 
 #include "grib_api_internal.h"
-#define fortint long
-#define fortfloat double
-#define C2FORT(x) (x)
+
 /*
    This is used by make_class.pl
 
diff --git a/src/grib_accessor_class_data_g2simple_packing.c b/src/grib_accessor_class_data_g2simple_packing.c
index 83c73aa..e730035 100644
--- a/src/grib_accessor_class_data_g2simple_packing.c
+++ b/src/grib_accessor_class_data_g2simple_packing.c
@@ -149,118 +149,117 @@ static void init_class(grib_accessor_class* c)
 
 static void init(grib_accessor* a,const long v, grib_arguments* args)
 {
-	grib_accessor_data_g2simple_packing *self =(grib_accessor_data_g2simple_packing*)a;
-	a->flags |= GRIB_ACCESSOR_FLAG_DATA;
-	self->edition=2;
+    grib_accessor_data_g2simple_packing *self =(grib_accessor_data_g2simple_packing*)a;
+    a->flags |= GRIB_ACCESSOR_FLAG_DATA;
+    self->edition=2;
 }
 
 static int value_count(grib_accessor* a,long* n_vals)
 {
-	grib_accessor_data_g2simple_packing *self =(grib_accessor_data_g2simple_packing*)a;
-  *n_vals= 0;
-  return grib_get_long_internal(grib_handle_of_accessor(a),self->number_of_values,n_vals);
+    grib_accessor_data_g2simple_packing *self =(grib_accessor_data_g2simple_packing*)a;
+    *n_vals= 0;
+    return grib_get_long_internal(grib_handle_of_accessor(a),self->number_of_values,n_vals);
 }
 
 static int pack_double(grib_accessor* a, const double* cval, size_t *len)
 {
-	grib_accessor_data_g2simple_packing* self =  (grib_accessor_data_g2simple_packing*)a;
-	grib_accessor_class* super = *(a->cclass->super);
-	size_t n_vals = *len;
-	double reference_value = 0;
-	long   binary_scale_factor = 0;
-	long   bits_per_value = 0;
-	long   decimal_scale_factor = 0;
-	double decimal = 1;
-	size_t buflen = 0;
-	unsigned char*  buf = NULL;
-	unsigned char*  encoded = NULL;
-	double divisor = 1;
-	long off = 0;
-	int ret =0;
-	double units_factor=1.0;
-	double units_bias=0.0;
-	double* val=(double*)cval;
-	int i;
-
-	if(*len == 0) {
-		grib_buffer_replace(a, NULL, 0,1,1);
-		return GRIB_SUCCESS;
-	}
-
-	if(ret == GRIB_SUCCESS)
-		ret = grib_set_long_internal(grib_handle_of_accessor(a),self->number_of_values, *len);
-
-	if (ret!=GRIB_SUCCESS) return ret;
-
-	if(self->units_factor &&
-			(grib_get_double_internal(grib_handle_of_accessor(a),self->units_factor,&units_factor)== GRIB_SUCCESS)) {
-		grib_set_double_internal(grib_handle_of_accessor(a),self->units_factor,1.0);
-	}
-
-	if(self->units_bias &&
-			(grib_get_double_internal(grib_handle_of_accessor(a),self->units_bias,&units_bias)== GRIB_SUCCESS)) {
-		grib_set_double_internal(grib_handle_of_accessor(a),self->units_bias,0.0);
-	}
-
-	if (units_factor != 1.0) {
-		if (units_bias != 0.0)
-			for (i=0;i<n_vals;i++) val[i]=val[i]*units_factor+units_bias;
-		else
-			for (i=0;i<n_vals;i++) val[i]*=units_factor;
-	} else if (units_bias != 0.0)
-		for (i=0;i<n_vals;i++) val[i]+=units_bias;
-
-	ret = super->pack_double(a,val,len);
-	switch (ret) {
-	case GRIB_CONSTANT_FIELD:
-		grib_buffer_replace(a, NULL, 0,1,1);
-		return GRIB_SUCCESS;
-	case GRIB_SUCCESS:
-		break;
-	default:
-		grib_context_log(a->context,GRIB_LOG_ERROR,"unable to compute packing parameters\n");
-		return ret;
-	}
-
-	if((ret = grib_get_double_internal(grib_handle_of_accessor(a),self->reference_value, &reference_value))
-			!= GRIB_SUCCESS)
-		return ret;
-
-	if((ret = grib_get_long_internal(grib_handle_of_accessor(a),self->binary_scale_factor, &binary_scale_factor))
-			!= GRIB_SUCCESS)
-		return ret;
-
-	if((ret = grib_get_long_internal(grib_handle_of_accessor(a),self->bits_per_value,&bits_per_value)) !=
-			GRIB_SUCCESS)
-		return ret;
-
-	if((ret = grib_get_long_internal(grib_handle_of_accessor(a),self->decimal_scale_factor, &decimal_scale_factor))
-			!= GRIB_SUCCESS)
-		return ret;
-
-	decimal = grib_power(decimal_scale_factor,10) ;
-	divisor = grib_power(-binary_scale_factor,2);
-
-	buflen = (((bits_per_value*n_vals)+7)/8)*sizeof(unsigned char);
-	buf = (unsigned char*)grib_context_buffer_malloc_clear(a->context,buflen);
-	encoded = buf;
-
-	grib_encode_double_array(n_vals,val,bits_per_value,reference_value,decimal,divisor,encoded,&off);
-
-	grib_context_log(a->context, GRIB_LOG_DEBUG,
-			"grib_accessor_data_g2simple_packing : pack_double : packing %s, %d values", a->name, n_vals);
-
-	grib_buffer_replace(a, buf, buflen,1,1);
-
-	grib_context_buffer_free(a->context,buf);
-
-	return ret;
+    grib_accessor_data_g2simple_packing* self =  (grib_accessor_data_g2simple_packing*)a;
+    grib_accessor_class* super = *(a->cclass->super);
+    size_t n_vals = *len;
+    double reference_value = 0;
+    long   binary_scale_factor = 0;
+    long   bits_per_value = 0;
+    long   decimal_scale_factor = 0;
+    double decimal = 1;
+    size_t buflen = 0;
+    unsigned char*  buf = NULL;
+    unsigned char*  encoded = NULL;
+    double divisor = 1;
+    long off = 0;
+    int ret =0;
+    double units_factor=1.0;
+    double units_bias=0.0;
+    double* val=(double*)cval;
+    int i;
+
+    if(*len == 0) {
+        grib_buffer_replace(a, NULL, 0,1,1);
+        return GRIB_SUCCESS;
+    }
+
+    if(ret == GRIB_SUCCESS)
+        ret = grib_set_long_internal(grib_handle_of_accessor(a),self->number_of_values, *len);
+
+    if (ret!=GRIB_SUCCESS) return ret;
+
+    if(self->units_factor &&
+            (grib_get_double_internal(grib_handle_of_accessor(a),self->units_factor,&units_factor)== GRIB_SUCCESS)) {
+        grib_set_double_internal(grib_handle_of_accessor(a),self->units_factor,1.0);
+    }
+
+    if(self->units_bias &&
+            (grib_get_double_internal(grib_handle_of_accessor(a),self->units_bias,&units_bias)== GRIB_SUCCESS)) {
+        grib_set_double_internal(grib_handle_of_accessor(a),self->units_bias,0.0);
+    }
+
+    if (units_factor != 1.0) {
+        if (units_bias != 0.0)
+            for (i=0;i<n_vals;i++) val[i]=val[i]*units_factor+units_bias;
+        else
+            for (i=0;i<n_vals;i++) val[i]*=units_factor;
+    } else if (units_bias != 0.0)
+        for (i=0;i<n_vals;i++) val[i]+=units_bias;
+
+    ret = super->pack_double(a,val,len);
+    switch (ret) {
+    case GRIB_CONSTANT_FIELD:
+        grib_buffer_replace(a, NULL, 0,1,1);
+        return GRIB_SUCCESS;
+    case GRIB_SUCCESS:
+        break;
+    default:
+        grib_context_log(a->context,GRIB_LOG_ERROR,"unable to compute packing parameters\n");
+        return ret;
+    }
+
+    if((ret = grib_get_double_internal(grib_handle_of_accessor(a),self->reference_value, &reference_value))
+            != GRIB_SUCCESS)
+        return ret;
+
+    if((ret = grib_get_long_internal(grib_handle_of_accessor(a),self->binary_scale_factor, &binary_scale_factor))
+            != GRIB_SUCCESS)
+        return ret;
+
+    if((ret = grib_get_long_internal(grib_handle_of_accessor(a),self->bits_per_value,&bits_per_value)) !=
+            GRIB_SUCCESS)
+        return ret;
+
+    if((ret = grib_get_long_internal(grib_handle_of_accessor(a),self->decimal_scale_factor, &decimal_scale_factor))
+            != GRIB_SUCCESS)
+        return ret;
+
+    decimal = grib_power(decimal_scale_factor,10) ;
+    divisor = grib_power(-binary_scale_factor,2);
+
+    buflen = (((bits_per_value*n_vals)+7)/8)*sizeof(unsigned char);
+    buf = (unsigned char*)grib_context_buffer_malloc_clear(a->context,buflen);
+    encoded = buf;
+
+    grib_encode_double_array(n_vals,val,bits_per_value,reference_value,decimal,divisor,encoded,&off);
+
+    grib_context_log(a->context, GRIB_LOG_DEBUG,
+            "grib_accessor_data_g2simple_packing : pack_double : packing %s, %d values", a->name, n_vals);
+
+    grib_buffer_replace(a, buf, buflen,1,1);
+
+    grib_context_buffer_free(a->context,buf);
+
+    return ret;
 }
 
 static int pack_bytes(grib_accessor* a, const unsigned char* val, size_t *len)
 {
-	size_t length = *len;
-	grib_buffer_replace(a, val, length,1,1);
-	return GRIB_SUCCESS;
+    size_t length = *len;
+    grib_buffer_replace(a, val, length,1,1);
+    return GRIB_SUCCESS;
 }
-
diff --git a/src/grib_accessor_class_data_g2simple_packing_with_preprocessing.c b/src/grib_accessor_class_data_g2simple_packing_with_preprocessing.c
index cc25053..ddb4253 100644
--- a/src/grib_accessor_class_data_g2simple_packing_with_preprocessing.c
+++ b/src/grib_accessor_class_data_g2simple_packing_with_preprocessing.c
@@ -164,149 +164,143 @@ static void init_class(grib_accessor_class* c)
 
 static void init(grib_accessor* a,const long v, grib_arguments* args)
 {
-  grib_accessor_data_g2simple_packing_with_preprocessing *self =(grib_accessor_data_g2simple_packing_with_preprocessing*)a;
-  self->pre_processing = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
-  self->pre_processing_parameter = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
-  a->flags |= GRIB_ACCESSOR_FLAG_DATA;
+    grib_accessor_data_g2simple_packing_with_preprocessing *self =(grib_accessor_data_g2simple_packing_with_preprocessing*)a;
+    self->pre_processing = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
+    self->pre_processing_parameter = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
+    a->flags |= GRIB_ACCESSOR_FLAG_DATA;
 }
 
 static int value_count(grib_accessor* a,long* n_vals)
 {
-  grib_accessor_data_g2simple_packing_with_preprocessing *self =(grib_accessor_data_g2simple_packing_with_preprocessing*)a;
-  *n_vals= 0;
+    grib_accessor_data_g2simple_packing_with_preprocessing *self =(grib_accessor_data_g2simple_packing_with_preprocessing*)a;
+    *n_vals= 0;
 
-  return grib_get_long_internal(grib_handle_of_accessor(a),self->number_of_values,n_vals);
+    return grib_get_long_internal(grib_handle_of_accessor(a),self->number_of_values,n_vals);
 }
 
-static int  unpack_double(grib_accessor* a, double* val, size_t *len)
+static int unpack_double(grib_accessor* a, double* val, size_t *len)
 {
-  grib_accessor_data_g2simple_packing_with_preprocessing* self =  (grib_accessor_data_g2simple_packing_with_preprocessing*)a;
-  grib_accessor_class* super = *(a->cclass->super);
+    grib_accessor_data_g2simple_packing_with_preprocessing* self =  (grib_accessor_data_g2simple_packing_with_preprocessing*)a;
+    grib_accessor_class* super = *(a->cclass->super);
 
-  size_t n_vals = 0;
-  long nn=0;
-  int err = 0;
+    size_t n_vals = 0;
+    long nn=0;
+    int err = 0;
 
-  long    pre_processing;
-  double    pre_processing_parameter;
+    long    pre_processing;
+    double    pre_processing_parameter;
 
-  err=grib_value_count(a,&nn);
-  n_vals=nn;
-  if (err) return err;
+    err=grib_value_count(a,&nn);
+    n_vals=nn;
+    if (err) return err;
 
-  if(n_vals==0){
-    *len = 0;
-    return GRIB_SUCCESS;
-  }
+    if(n_vals==0){
+        *len = 0;
+        return GRIB_SUCCESS;
+    }
 
-  self->dirty=0;
+    self->dirty=0;
 
+    if((err = grib_get_long_internal(grib_handle_of_accessor(a),self->pre_processing, &pre_processing)) != GRIB_SUCCESS){
+        grib_context_log(a->context, GRIB_LOG_ERROR, "Accessor %s cannont gather value for %s error %d \n", a->name, self->pre_processing, err);
+        return err;
+    }
 
-  if((err = grib_get_long_internal(grib_handle_of_accessor(a),self->pre_processing, &pre_processing)) != GRIB_SUCCESS){
-    grib_context_log(a->context, GRIB_LOG_ERROR, "Accessor %s cannont gather value for %s error %d \n", a->name, self->pre_processing, err);
-    return err;
-  }
+    if((err = grib_get_double_internal(grib_handle_of_accessor(a),self->pre_processing_parameter, &pre_processing_parameter)) != GRIB_SUCCESS){
+        grib_context_log(a->context, GRIB_LOG_ERROR, "Accessor %s cannont gather value for %s error %d \n", a->name, self->pre_processing_parameter, err);
+        return err;
+    }
 
-  if((err = grib_get_double_internal(grib_handle_of_accessor(a),self->pre_processing_parameter, &pre_processing_parameter)) != GRIB_SUCCESS){
-    grib_context_log(a->context, GRIB_LOG_ERROR, "Accessor %s cannont gather value for %s error %d \n", a->name, self->pre_processing_parameter, err);
-    return err;
-  }
+    err =   super->unpack_double(a,val,&n_vals);
+    if (err!=GRIB_SUCCESS) return err;
 
-  err =   super->unpack_double(a,val,&n_vals);
-  if (err!=GRIB_SUCCESS) return err;
+    err=pre_processing_func(val,n_vals,pre_processing,&pre_processing_parameter,INVERSE);
+    if (err != GRIB_SUCCESS) return err;
 
-  err=pre_processing_func(val,n_vals,pre_processing,&pre_processing_parameter,INVERSE);
-  if (err != GRIB_SUCCESS) return err;
+    *len = (long) n_vals;
 
-  *len = (long) n_vals;
-
-  return err;
+    return err;
 }
 
 static int pack_double(grib_accessor* a, const double* val, size_t *len)
 {
-  grib_accessor_data_g2simple_packing_with_preprocessing* self =  (grib_accessor_data_g2simple_packing_with_preprocessing*)a;
-  grib_accessor_class* super = *(a->cclass->super);
+    grib_accessor_data_g2simple_packing_with_preprocessing* self =  (grib_accessor_data_g2simple_packing_with_preprocessing*)a;
+    grib_accessor_class* super = *(a->cclass->super);
 
-  size_t n_vals = *len;
-  int err = 0;
-
-  long pre_processing=0;
-  double pre_processing_parameter=0;
-
-  self->dirty=1;
-
-  if((err = grib_get_long_internal(grib_handle_of_accessor(a),self->pre_processing, &pre_processing)) != GRIB_SUCCESS)
-    return err;
+    size_t n_vals = *len;
+    int err = 0;
 
-  err=pre_processing_func((double*)val,n_vals,pre_processing,&pre_processing_parameter,DIRECT);
-  if (err != GRIB_SUCCESS) return err;
+    long pre_processing=0;
+    double pre_processing_parameter=0;
 
-  err =   super->pack_double(a,val,len);
-  if (err!=GRIB_SUCCESS) return err;
+    self->dirty=1;
 
-  if((err = grib_set_double_internal(grib_handle_of_accessor(a),self->pre_processing_parameter, pre_processing_parameter)) != GRIB_SUCCESS)
-    return err;
+    if((err = grib_get_long_internal(grib_handle_of_accessor(a),self->pre_processing, &pre_processing)) != GRIB_SUCCESS)
+        return err;
 
+    err=pre_processing_func((double*)val,n_vals,pre_processing,&pre_processing_parameter,DIRECT);
+    if (err != GRIB_SUCCESS) return err;
 
-  if((err = grib_set_long_internal(grib_handle_of_accessor(a),self->number_of_values, n_vals)) != GRIB_SUCCESS)
-    return err;
+    err =   super->pack_double(a,val,len);
+    if (err!=GRIB_SUCCESS) return err;
 
+    if((err = grib_set_double_internal(grib_handle_of_accessor(a),self->pre_processing_parameter, pre_processing_parameter)) != GRIB_SUCCESS)
+        return err;
 
-  return GRIB_SUCCESS;
+    if((err = grib_set_long_internal(grib_handle_of_accessor(a),self->number_of_values, n_vals)) != GRIB_SUCCESS)
+        return err;
 
+    return GRIB_SUCCESS;
 }
 
-
 static int pre_processing_func(double* values,long length, long pre_processing,
-                               double *pre_processing_parameter,int mode) {
-  int i;
-  int ret=0;
-  double min=values[0];
-  double next_min=values[0];
+        double *pre_processing_parameter,int mode) {
+    int i;
+    int ret=0;
+    double min=values[0];
+    double next_min=values[0];
 
-  switch (pre_processing) {
+    switch (pre_processing) {
     /* NONE */
     case 0:
-      break;
+        break;
     /* LOGARITHM */
     case 1:
-      if (mode == DIRECT) {
-        for (i=0;i<length;i++) {
-          if (values[i] < min)
-            min=values[i];
-          if (values[i] > next_min)
-            next_min=values[i];
-        }
-        for (i=0;i<length;i++) {
-          if (values[i] > min && values[i] < next_min )
-            next_min=values[i];
-        }
-        if ( min > 0 ) {
-          *pre_processing_parameter=0;
-          for (i=0;i<length;i++)
-            values[i]=log(values[i]);
-        } else {
-          *pre_processing_parameter=next_min-2*min;
-          if (next_min == min) return ret;
-          for (i=0;i<length;i++)
-            values[i]=log(values[i]+*pre_processing_parameter);
-        }
-      } else {
-        if ( *pre_processing_parameter == 0 ) {
-          for (i=0;i<length;i++)
-            values[i]=exp(values[i]);
+        if (mode == DIRECT) {
+            for (i=0;i<length;i++) {
+                if (values[i] < min)
+                    min=values[i];
+                if (values[i] > next_min)
+                    next_min=values[i];
+            }
+            for (i=0;i<length;i++) {
+                if (values[i] > min && values[i] < next_min )
+                    next_min=values[i];
+            }
+            if ( min > 0 ) {
+                *pre_processing_parameter=0;
+                for (i=0;i<length;i++)
+                    values[i]=log(values[i]);
+            } else {
+                *pre_processing_parameter=next_min-2*min;
+                if (next_min == min) return ret;
+                for (i=0;i<length;i++)
+                    values[i]=log(values[i]+*pre_processing_parameter);
+            }
         } else {
-          for (i=0;i<length;i++)
-            values[i]=exp(values[i])-*pre_processing_parameter;
+            if ( *pre_processing_parameter == 0 ) {
+                for (i=0;i<length;i++)
+                    values[i]=exp(values[i]);
+            } else {
+                for (i=0;i<length;i++)
+                    values[i]=exp(values[i])-*pre_processing_parameter;
+            }
         }
-      }
-      break;
+        break;
     default:
-      ret=GRIB_NOT_IMPLEMENTED;
-      break;
-  }
+        ret=GRIB_NOT_IMPLEMENTED;
+        break;
+    }
 
-  return ret;
+    return ret;
 }
-
diff --git a/src/grib_accessor_class_data_raw_packing.c b/src/grib_accessor_class_data_raw_packing.c
index 615bf85..eff3204 100644
--- a/src/grib_accessor_class_data_raw_packing.c
+++ b/src/grib_accessor_class_data_raw_packing.c
@@ -148,181 +148,179 @@ static void init_class(grib_accessor_class* c)
 
 static void init(grib_accessor* a,const long v, grib_arguments* args)
 {
-  grib_accessor_data_raw_packing *self =(grib_accessor_data_raw_packing*)a;
+    grib_accessor_data_raw_packing *self =(grib_accessor_data_raw_packing*)a;
 
-  self->number_of_values      = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
-  self->precision       = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
-  a->flags |= GRIB_ACCESSOR_FLAG_DATA;
+    self->number_of_values      = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
+    self->precision       = grib_arguments_get_name(grib_handle_of_accessor(a),args,self->carg++);
+    a->flags |= GRIB_ACCESSOR_FLAG_DATA;
 }
 
 static int value_count(grib_accessor* a,long* n_vals)
 {
-  grib_accessor_data_raw_packing *self =(grib_accessor_data_raw_packing*)a;
-  *n_vals= 0;
-  return grib_get_long_internal(grib_handle_of_accessor(a),self->number_of_values,n_vals);
+    grib_accessor_data_raw_packing *self =(grib_accessor_data_raw_packing*)a;
+    *n_vals= 0;
+    return grib_get_long_internal(grib_handle_of_accessor(a),self->number_of_values,n_vals);
 }
 
-static int  unpack_double(grib_accessor* a, double* val, size_t *len)
+static int unpack_double(grib_accessor* a, double* val, size_t *len)
 {
-  grib_accessor_data_raw_packing *self =(grib_accessor_data_raw_packing*)a;
-  unsigned char* buf = NULL;
-  int bytes = 0;
-  size_t nvals = 0;
-  long inlen = grib_byte_count(a);
+    grib_accessor_data_raw_packing *self =(grib_accessor_data_raw_packing*)a;
+    unsigned char* buf = NULL;
+    int bytes = 0;
+    size_t nvals = 0;
+    long inlen = grib_byte_count(a);
 
-  long precision = 0;
+    long precision = 0;
 
-  int code = GRIB_SUCCESS;
+    int code = GRIB_SUCCESS;
 
-  if((code = grib_get_long_internal(grib_handle_of_accessor(a),self->precision,&precision))
-      != GRIB_SUCCESS)
-    return code;
+    if((code = grib_get_long_internal(grib_handle_of_accessor(a),self->precision,&precision))
+            != GRIB_SUCCESS)
+        return code;
 
-  self->dirty=0;
+    self->dirty=0;
 
-  buf =  (unsigned char*)grib_handle_of_accessor(a)->buffer->data;
-  buf += grib_byte_offset(a);
+    buf =  (unsigned char*)grib_handle_of_accessor(a)->buffer->data;
+    buf += grib_byte_offset(a);
 
-  switch(precision)
-  {
+    switch(precision)
+    {
     case 1:
-      bytes = 4;
-      break;
-
+        bytes = 4;
+        break;
     case 2:
-      bytes = 8;
-      break;
-
+        bytes = 8;
+        break;
     default:
-      return GRIB_NOT_IMPLEMENTED;
-      break;
-  }
+        return GRIB_NOT_IMPLEMENTED;
+        break;
+    }
 
-  nvals = inlen / bytes;
+    nvals = inlen / bytes;
 
-  if(*len < nvals)
-    return GRIB_ARRAY_TOO_SMALL;
+    if(*len < nvals)
+        return GRIB_ARRAY_TOO_SMALL;
 
-  code=grib_ieee_decode_array(a->context,buf,nvals,bytes,val);
+    code=grib_ieee_decode_array(a->context,buf,nvals,bytes,val);
 
-  *len = nvals;
+    *len = nvals;
 
-  return code;
+    return code;
 }
 
 static int pack_double(grib_accessor* a, const double* val, size_t *len)
 {
-  grib_accessor_data_raw_packing *self =(grib_accessor_data_raw_packing*)a;
+    grib_accessor_data_raw_packing *self =(grib_accessor_data_raw_packing*)a;
 
-  int bytes = 0;
-  unsigned char* buffer = NULL;
+    int bytes = 0;
+    unsigned char* buffer = NULL;
 
-  long precision = 0;
+    long precision = 0;
 
-  double*  values = (double*)val;
-  size_t inlen = *len;
+    double*  values = (double*)val;
+    size_t inlen = *len;
 
-  int free_buffer = 0;
-  int free_values = 0;
+    int free_buffer = 0;
+    int free_values = 0;
 
-  int code = GRIB_SUCCESS;
+    int code = GRIB_SUCCESS;
 
-  size_t bufsize = 0;
+    size_t bufsize = 0;
 
-  if (*len ==0) return GRIB_NO_VALUES;
+    if (*len ==0) return GRIB_NO_VALUES;
 
-  if((code = grib_get_long_internal(grib_handle_of_accessor(a),self->precision,&precision))
-      != GRIB_SUCCESS)
-    return code;
+    if((code = grib_get_long_internal(grib_handle_of_accessor(a),self->precision,&precision))
+            != GRIB_SUCCESS)
+        return code;
 
-  self->dirty=1;
+    self->dirty=1;
 
-  switch(precision)
-  {
+    switch(precision)
+    {
     case 1:
-      bytes = 4;
-      break;
+        bytes = 4;
+        break;
 
     case 2:
-      bytes = 8;
-      break;
+        bytes = 8;
+        break;
 
     default:
-      code = GRIB_NOT_IMPLEMENTED;
-      goto clean_up;
-      break;
-  }
+        code = GRIB_NOT_IMPLEMENTED;
+        goto clean_up;
+        break;
+    }
 
-  bufsize = bytes*inlen;
+    bufsize = bytes*inlen;
 
-  buffer = (unsigned char*)grib_context_malloc(a->context, bufsize);
+    buffer = (unsigned char*)grib_context_malloc(a->context, bufsize);
 
-  if(!buffer)
-  {
-    code = GRIB_OUT_OF_MEMORY;
-    goto clean_up;
-  }
+    if(!buffer)
+    {
+        code = GRIB_OUT_OF_MEMORY;
+        goto clean_up;
+    }
 
-  code=grib_ieee_encode_array(a->context,values,inlen,bytes,buffer);
+    code=grib_ieee_encode_array(a->context,values,inlen,bytes,buffer);
 
 clean_up:
-  if(free_buffer) free(buffer);
-  if(free_values) free(values);
-
-  grib_buffer_replace(a, buffer, bufsize,1,1);
+    if(free_buffer) free(buffer);
+    if(free_values) free(values);
 
-  grib_context_buffer_free(a->context,buffer);
+    grib_buffer_replace(a, buffer, bufsize,1,1);
 
-  code = grib_set_long(grib_handle_of_accessor(a),self->number_of_values, inlen);
-  if(code==GRIB_READ_ONLY) code=0;
+    grib_context_buffer_free(a->context,buffer);
 
-  return code;
+    code = grib_set_long(grib_handle_of_accessor(a),self->number_of_values, inlen);
+    if(code==GRIB_READ_ONLY) code=0;
 
+    return code;
 }
 
-static int  unpack_double_element(grib_accessor* a, size_t idx, double* val) {
-  int ret=0;
-  grib_accessor_data_raw_packing *self =(grib_accessor_data_raw_packing*)a;
-  unsigned char* buf = NULL;
-  int bytes = 0;
-  size_t nvals = 0;
-  long inlen = grib_byte_count(a);
-  long pos;
+static int unpack_double_element(grib_accessor* a, size_t idx, double* val)
+{
+    int ret=0;
+    grib_accessor_data_raw_packing *self =(grib_accessor_data_raw_packing*)a;
+    unsigned char* buf = NULL;
+    int bytes = 0;
+    size_t nvals = 0;
+    long inlen = grib_byte_count(a);
+    long pos;
 
-  long precision = 0;
+    long precision = 0;
 
-  if((ret = grib_get_long_internal(grib_handle_of_accessor(a),self->precision,&precision))
-      != GRIB_SUCCESS)
-    return ret;
+    if((ret = grib_get_long_internal(grib_handle_of_accessor(a),self->precision,&precision))
+            != GRIB_SUCCESS)
+        return ret;
 
-  self->dirty=0;
+    self->dirty=0;
 
-  buf =  (unsigned char*)grib_handle_of_accessor(a)->buffer->data;
-  buf += grib_byte_offset(a);
+    buf =  (unsigned char*)grib_handle_of_accessor(a)->buffer->data;
+    buf += grib_byte_offset(a);
 
-  switch(precision)
-  {
+    switch(precision)
+    {
     case 1:
-      bytes = 4;
-      break;
+        bytes = 4;
+        break;
 
     case 2:
-      bytes = 8;
-      break;
+        bytes = 8;
+        break;
 
     default:
-      return GRIB_NOT_IMPLEMENTED;
-      break;
-  }
-
-  pos=bytes*idx;
-  
-  Assert(pos<=inlen);
-  
-  nvals = 1;
-  buf+=pos;
-  
-  ret=grib_ieee_decode_array(a->context,buf,nvals,bytes,val);
-
-  return ret;
+        return GRIB_NOT_IMPLEMENTED;
+        break;
+    }
+
+    pos=bytes*idx;
+
+    Assert(pos<=inlen);
+
+    nvals = 1;
+    buf+=pos;
+
+    ret=grib_ieee_decode_array(a->context,buf,nvals,bytes,val);
+
+    return ret;
 }
diff --git a/src/grib_accessor_class_data_sh_packed.c b/src/grib_accessor_class_data_sh_packed.c
index 7721285..02d5bce 100644
--- a/src/grib_accessor_class_data_sh_packed.c
+++ b/src/grib_accessor_class_data_sh_packed.c
@@ -266,6 +266,7 @@ static int  unpack_double(grib_accessor* a, double* val, size_t *len)
     long   pen_m= 0;
 
     double operat= 0;
+    int bytes;
     int err=0;
 
     decode_float_proc decode_float = NULL;
@@ -320,12 +321,15 @@ static int  unpack_double(grib_accessor* a, double* val, size_t *len)
     switch (ieee_floats) {
     case 0:
         decode_float=grib_long_to_ibm;
+        bytes=4;
         break;
     case 1:
         decode_float=grib_long_to_ieee;
+        bytes=4;
         break;
     case 2:
         decode_float=grib_long_to_ieee64;
+        bytes=8;
         break;
     default:
         return GRIB_NOT_IMPLEMENTED;
@@ -344,7 +348,7 @@ static int  unpack_double(grib_accessor* a, double* val, size_t *len)
     hres = buf;
     lres = buf;
 
-    packed_offset = offsetdata +  4*(sub_k+1)*(sub_k+2);
+    packed_offset = offsetdata +  bytes*(sub_k+1)*(sub_k+2);
 
     lpos = 8*(packed_offset-offsetdata);
 
@@ -373,8 +377,8 @@ static int  unpack_double(grib_accessor* a, double* val, size_t *len)
         {
             for(hcount=0;hcount<sub_k+1;hcount++)
             {
-                dummy =  decode_float(grib_decode_unsigned_long(hres,&hpos,32))*d;
-                dummy =  decode_float(grib_decode_unsigned_long(hres,&hpos,32))*d;
+                dummy =  decode_float(grib_decode_unsigned_long(hres,&hpos,8*bytes));
+                dummy =  decode_float(grib_decode_unsigned_long(hres,&hpos,8*bytes));
 
                 lup++;
             }
@@ -384,9 +388,9 @@ static int  unpack_double(grib_accessor* a, double* val, size_t *len)
         /* pscals=scals+lup; */
         for(lcount=hcount; lcount < maxv ; lcount++)
         {
-            val[i++] =  (double) ((grib_decode_unsigned_long(lres, &lpos,
+            val[i++] = d * (double) ((grib_decode_unsigned_long(lres, &lpos,
                     bits_per_value)*s)+reference_value);
-            val[i++] =  (double) ((grib_decode_unsigned_long(lres, &lpos,
+            val[i++] = d * (double) ((grib_decode_unsigned_long(lres, &lpos,
                     bits_per_value)*s)+reference_value);
             lup++;
         }
@@ -399,10 +403,6 @@ static int  unpack_double(grib_accessor* a, double* val, size_t *len)
     Assert(*len >= i);
     *len = n_vals;
 
-    if(d != 1) {
-        for(i=0;i<*len;i++)
-            val[i++] *= d;
-    }
 
     (void)dummy; /* suppress gcc warning */
     grib_context_free(a->context,scals);
diff --git a/src/grib_accessor_class_data_sh_unpacked.c b/src/grib_accessor_class_data_sh_unpacked.c
index 2bc66eb..8ce2ac6 100644
--- a/src/grib_accessor_class_data_sh_unpacked.c
+++ b/src/grib_accessor_class_data_sh_unpacked.c
@@ -259,6 +259,7 @@ static int  unpack_double(grib_accessor* a, double* val, size_t *len)
   long   pen_m= 0;
 
   double operat= 0;
+  int bytes;
   int err=0;
 
   decode_float_proc decode_float = NULL;
@@ -300,12 +301,15 @@ static int  unpack_double(grib_accessor* a, double* val, size_t *len)
   switch (ieee_floats) {
     case 0:
       decode_float=grib_long_to_ibm;
+      bytes=4;
       break;
     case 1:
       decode_float=grib_long_to_ieee;
+      bytes=4;
       break;
     case 2:
       decode_float=grib_long_to_ieee64;
+      bytes=8;
       break;
     default:
       return GRIB_NOT_IMPLEMENTED;
@@ -324,7 +328,7 @@ static int  unpack_double(grib_accessor* a, double* val, size_t *len)
   hres = buf;
   lres = buf;
 
-  packed_offset = offsetdata +  4*(sub_k+1)*(sub_k+2);
+  packed_offset = offsetdata +  bytes*(sub_k+1)*(sub_k+2);
 
   lpos = 8*(packed_offset-offsetdata);
 
@@ -357,8 +361,8 @@ static int  unpack_double(grib_accessor* a, double* val, size_t *len)
     {
       for(hcount=0;hcount<sub_k+1;hcount++)
       {
-        val[i++] =  decode_float(grib_decode_unsigned_long(hres,&hpos,32))*d;
-        val[i++] =  decode_float(grib_decode_unsigned_long(hres,&hpos,32))*d;
+        val[i++] =  decode_float(grib_decode_unsigned_long(hres,&hpos,8*bytes));
+        val[i++] =  decode_float(grib_decode_unsigned_long(hres,&hpos,8*bytes));
 
         if (GRIBEX_sh_bug_present && hcount==sub_k){
           /*  bug in ecmwf data, last row (K+1)is scaled but should not */
@@ -373,9 +377,9 @@ static int  unpack_double(grib_accessor* a, double* val, size_t *len)
     /* pscals=scals+lup; */
     for(lcount=hcount; lcount < maxv ; lcount++)
     {
-      dummy =  (double) ((grib_decode_unsigned_long(lres, &lpos,
+      dummy =  d * (double) ((grib_decode_unsigned_long(lres, &lpos,
                    bits_per_value)*s)+reference_value);
-      dummy =  (double) ((grib_decode_unsigned_long(lres, &lpos,
+      dummy =  d * (double) ((grib_decode_unsigned_long(lres, &lpos,
                    bits_per_value)*s)+reference_value);
       lup++;
     }
@@ -388,10 +392,6 @@ static int  unpack_double(grib_accessor* a, double* val, size_t *len)
   Assert(*len >= i);
   *len = n_vals;
 
-  if(d != 1) {
-    for(i=0;i<*len;i++)
-      val[i++] *= d;
-  }
 
   (void)dummy; /* suppress gcc warning */
   grib_context_free(a->context,scals);
diff --git a/src/grib_accessor_class_data_simple_packing.c b/src/grib_accessor_class_data_simple_packing.c
index 6a2eaa4..7d0dbcd 100644
--- a/src/grib_accessor_class_data_simple_packing.c
+++ b/src/grib_accessor_class_data_simple_packing.c
@@ -291,9 +291,7 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val)
 
         pos=idx*l;
         buf+=pos;
-        lvalue  = 0;
-        lvalue  <<= 8;
-        lvalue |= buf[octet++] ;
+        lvalue |= buf[octet++];
 
         for ( bc=1; bc<l; bc++ ) {
             lvalue <<= 8;
@@ -482,7 +480,7 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len)
     grib_accessor_data_simple_packing* self =  (grib_accessor_data_simple_packing*)a;
     grib_handle* gh = grib_handle_of_accessor(a);
 
-    size_t i = 0;
+    size_t i;
     size_t n_vals = *len;
     int err = 0;
     int last;
diff --git a/src/grib_accessor_class_g2end_step.c b/src/grib_accessor_class_g2end_step.c
index d98a0a9..e6c046a 100644
--- a/src/grib_accessor_class_g2end_step.c
+++ b/src/grib_accessor_class_g2end_step.c
@@ -172,28 +172,29 @@ static void init(grib_accessor* a,const long l, grib_arguments* c)
 {
     grib_accessor_g2end_step* self = (grib_accessor_g2end_step*)a;
     int n = 0;
+    grib_handle* h = grib_handle_of_accessor(a);
 
-    self->start_step = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->unit  = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-
-    self->year = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->month = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->day = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->hour  = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->minute  = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->second  = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-
-    self->year_of_end_of_interval = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->month_of_end_of_interval  = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->day_of_end_of_interval  = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->hour_of_end_of_interval = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->minute_of_end_of_interval = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->second_of_end_of_interval = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-
-    self->coded_unit  = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->coded_time_range  = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->typeOfTimeIncrement = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->numberOfTimeRange = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
+    self->start_step = grib_arguments_get_name(h,c,n++);
+    self->unit  = grib_arguments_get_name(h,c,n++);
+
+    self->year = grib_arguments_get_name(h,c,n++);
+    self->month = grib_arguments_get_name(h,c,n++);
+    self->day = grib_arguments_get_name(h,c,n++);
+    self->hour  = grib_arguments_get_name(h,c,n++);
+    self->minute  = grib_arguments_get_name(h,c,n++);
+    self->second  = grib_arguments_get_name(h,c,n++);
+
+    self->year_of_end_of_interval = grib_arguments_get_name(h,c,n++);
+    self->month_of_end_of_interval  = grib_arguments_get_name(h,c,n++);
+    self->day_of_end_of_interval  = grib_arguments_get_name(h,c,n++);
+    self->hour_of_end_of_interval = grib_arguments_get_name(h,c,n++);
+    self->minute_of_end_of_interval = grib_arguments_get_name(h,c,n++);
+    self->second_of_end_of_interval = grib_arguments_get_name(h,c,n++);
+
+    self->coded_unit  = grib_arguments_get_name(h,c,n++);
+    self->coded_time_range  = grib_arguments_get_name(h,c,n++);
+    self->typeOfTimeIncrement = grib_arguments_get_name(h,c,n++);
+    self->numberOfTimeRange = grib_arguments_get_name(h,c,n++);
 }
 
 static void dump(grib_accessor* a, grib_dumper* dumper)
@@ -536,16 +537,16 @@ static int pack_long(grib_accessor* a, const long* val, size_t *len)
             &minute_of_end_of_interval,&second_of_end_of_interval);
     if (err!=GRIB_SUCCESS) return err;
 
-    if((err = grib_set_long_internal(grib_handle_of_accessor(a),self->year_of_end_of_interval,  year_of_end_of_interval))) return err;
-    if((err = grib_set_long_internal(grib_handle_of_accessor(a),self->month_of_end_of_interval, month_of_end_of_interval))) return err;
-    if((err = grib_set_long_internal(grib_handle_of_accessor(a),self->day_of_end_of_interval,   day_of_end_of_interval))) return err;
-    if((err = grib_set_long_internal(grib_handle_of_accessor(a),self->hour_of_end_of_interval,  hour_of_end_of_interval))) return err;
-    if((err = grib_set_long_internal(grib_handle_of_accessor(a),self->minute_of_end_of_interval, minute_of_end_of_interval))) return err;
-    if((err = grib_set_long_internal(grib_handle_of_accessor(a),self->second_of_end_of_interval, second_of_end_of_interval))) return err;
+    if((err = grib_set_long_internal(h,self->year_of_end_of_interval,  year_of_end_of_interval))) return err;
+    if((err = grib_set_long_internal(h,self->month_of_end_of_interval, month_of_end_of_interval))) return err;
+    if((err = grib_set_long_internal(h,self->day_of_end_of_interval,   day_of_end_of_interval))) return err;
+    if((err = grib_set_long_internal(h,self->hour_of_end_of_interval,  hour_of_end_of_interval))) return err;
+    if((err = grib_set_long_internal(h,self->minute_of_end_of_interval, minute_of_end_of_interval))) return err;
+    if((err = grib_set_long_internal(h,self->second_of_end_of_interval, second_of_end_of_interval))) return err;
 
     if (time_range*u2s[unit]%u2s2[coded_unit]) {
         coded_unit=unit;
-        if((err = grib_set_long_internal(grib_handle_of_accessor(a),self->coded_unit, coded_unit))) return err;
+        if((err = grib_set_long_internal(h,self->coded_unit, coded_unit))) return err;
         coded_time_range=time_range;
     } else
         coded_time_range=(time_range*u2s[unit])/u2s2[coded_unit];
@@ -553,7 +554,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t *len)
     if (typeOfTimeIncrement != 1) {
         /* 1 means "Successive times processed have same forecast time, start time of forecast is incremented" */
         /* Note: For this case, length of timeRange is not related to step and so should NOT be used to calculate step */
-        if((err = grib_set_long_internal(grib_handle_of_accessor(a),self->coded_time_range, coded_time_range))) return err;
+        if((err = grib_set_long_internal(h,self->coded_time_range, coded_time_range))) return err;
     }
 
     return GRIB_SUCCESS;
diff --git a/src/grib_accessor_class_g2latlon.c b/src/grib_accessor_class_g2latlon.c
index bd04e7c..a80234f 100644
--- a/src/grib_accessor_class_g2latlon.c
+++ b/src/grib_accessor_class_g2latlon.c
@@ -141,100 +141,109 @@ static void init_class(grib_accessor_class* c)
 
 static void init(grib_accessor* a,const long l, grib_arguments* c)
 {
-  grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a;
-  int n = 0;
+    grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a;
+    int n = 0;
 
-  self->grid     = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-  self->index    = grib_arguments_get_long(grib_handle_of_accessor(a),c,n++);
-  self->given    = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
+    self->grid     = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
+    self->index    = grib_arguments_get_long(grib_handle_of_accessor(a),c,n++);
+    self->given    = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
 }
 
-static int unpack_double   (grib_accessor* a, double* val, size_t *len)
+static int unpack_double(grib_accessor* a, double* val, size_t *len)
 {
-  grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a;
-  int ret = 0;
+    grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a;
+    int ret = 0;
 
-  long given        = 1;
-  double grid[6];
-  size_t size = 6;
+    long given        = 1;
+    double grid[6];
+    size_t size = 6;
 
-  if(*len < 1){
-    ret = GRIB_ARRAY_TOO_SMALL;
-    return ret;
-  }
+    if(*len < 1){
+        ret = GRIB_ARRAY_TOO_SMALL;
+        return ret;
+    }
 
-  if(self->given)
-    if((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->given,&given)) != GRIB_SUCCESS)
-      return ret;
-
-  if(!given)
-  {
-    *val =  GRIB_MISSING_DOUBLE;
-    return GRIB_SUCCESS;
-  }
+    if(self->given)
+        if((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->given,&given)) != GRIB_SUCCESS)
+            return ret;
 
+    if(!given)
+    {
+        *val =  GRIB_MISSING_DOUBLE;
+        return GRIB_SUCCESS;
+    }
 
-  if((ret = grib_get_double_array_internal(grib_handle_of_accessor(a), self->grid,grid,&size)) != GRIB_SUCCESS)
-    return ret;
+    if((ret = grib_get_double_array_internal(grib_handle_of_accessor(a), self->grid,grid,&size)) != GRIB_SUCCESS)
+        return ret;
 
-  *val = grid[self->index];
+    *val = grid[self->index];
 
-  return GRIB_SUCCESS;
+    return GRIB_SUCCESS;
 }
 
+static double normalise_longitude(double a_lon)
+{
+    /* WMO regulation: The longitude values shall be limited to the range 0 to 360 degrees inclusive */
+    while (a_lon<0)   a_lon += 360;
+    while (a_lon>360) a_lon -= 360;
+    return a_lon;
+}
 
 static int pack_double(grib_accessor* a, const double* val, size_t *len)
 {
-  grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a;
-  int ret = 0;
-
-  double grid[6];
-  size_t size = 6;
-
-  if(*len < 1){
-    ret = GRIB_ARRAY_TOO_SMALL;
-    return ret;
-  }
-
-  if(self->given)
-  {
-    long given        = *val != GRIB_MISSING_DOUBLE;
-    if((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->given,given)) != GRIB_SUCCESS)
-      return ret;
-  }
-
-
-  if((ret = grib_get_double_array_internal(grib_handle_of_accessor(a), self->grid,grid,&size)) != GRIB_SUCCESS)
-    return ret;
-
-  if ( (self->index == 1 || self->index == 3) && *val < 0 ) grid[self->index] = 360+*val;
-  else grid[self->index] = *val;
-
-  return grib_set_double_array_internal(grib_handle_of_accessor(a), self->grid,grid,size);
+    grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a;
+    int ret = 0;
+
+    double grid[6];
+    size_t size = 6;
+    double new_val = *val;
+
+    if(*len < 1){
+        ret = GRIB_ARRAY_TOO_SMALL;
+        return ret;
+    }
+
+    if(self->given)
+    {
+        long given = *val != GRIB_MISSING_DOUBLE;
+        if((ret = grib_set_long_internal(grib_handle_of_accessor(a), self->given,given)) != GRIB_SUCCESS)
+            return ret;
+    }
+
+    if((ret = grib_get_double_array_internal(grib_handle_of_accessor(a), self->grid,grid,&size)) != GRIB_SUCCESS)
+        return ret;
+
+    /* index 1 is longitudeOfFirstGridPointInDegrees
+     * index 3 is longitudeOfLastGridPointInDegrees
+     */
+    if ( (self->index == 1 || self->index == 3) ) {
+        new_val = normalise_longitude(*val);
+    }
+    grid[self->index] = new_val;
+
+    return grib_set_double_array_internal(grib_handle_of_accessor(a), self->grid,grid,size);
 }
 
 static int pack_missing(grib_accessor* a)
 {
-  grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a;
-  double missing = GRIB_MISSING_DOUBLE;
-  size_t size = 1;
+    grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a;
+    double missing = GRIB_MISSING_DOUBLE;
+    size_t size = 1;
 
-  if(!self->given)
-    return GRIB_NOT_IMPLEMENTED;
+    if(!self->given)
+        return GRIB_NOT_IMPLEMENTED;
 
-  return pack_double(a,&missing,&size);
+    return pack_double(a,&missing,&size);
 }
 
 static int is_missing(grib_accessor* a)
 {
-  grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a;
-  long given        = 1;
+    grib_accessor_g2latlon* self = (grib_accessor_g2latlon*)a;
+    long given        = 1;
 
 
-  if(self->given) grib_get_long_internal(grib_handle_of_accessor(a), self->given,&given);
+    if(self->given) grib_get_long_internal(grib_handle_of_accessor(a), self->given,&given);
 
 
-  return !given;
+    return !given;
 }
-
-
diff --git a/src/grib_accessor_class_global_gaussian.c b/src/grib_accessor_class_global_gaussian.c
index 02f0daf..f2826db 100644
--- a/src/grib_accessor_class_global_gaussian.c
+++ b/src/grib_accessor_class_global_gaussian.c
@@ -231,10 +231,16 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len)
     dlonfirst=((double)lonfirst)/factor;
     dlonlast=((double)lonlast)/factor;
 
+    if (N == 0) {
+        grib_context_log(c,GRIB_LOG_ERROR,"global_gaussian unpack_long: N cannot be 0!");
+        return GRIB_WRONG_GRID;
+    }
+
     lats=(double*)grib_context_malloc(c,sizeof(double)*N*2);
     if (!lats) {
-        grib_context_log(c,GRIB_LOG_FATAL,
-                "global_gaussian: unable to allocate %d bytes",sizeof(double)*N*2);
+        grib_context_log(c, GRIB_LOG_ERROR,
+                "global_gaussian unpack_long: Memory allocation error: %d bytes",sizeof(double)*N*2);
+        return GRIB_OUT_OF_MEMORY;
     }
     if((ret = grib_get_gaussian_latitudes(N, lats)) != GRIB_SUCCESS)
         return ret;
@@ -310,7 +316,8 @@ static int pack_long(grib_accessor* a, const long* val, size_t *len)
     lats=(double*)grib_context_malloc(c,sizeof(double)*N*2);
     if (!lats) {
         grib_context_log(c,GRIB_LOG_FATAL,
-                "global_gaussian: unable to allocate %d bytes",sizeof(double)*N*2);
+                "global_gaussian pack_long: Memory allocation error: %d bytes",sizeof(double)*N*2);
+        return GRIB_OUT_OF_MEMORY;
     }
     if((ret = grib_get_gaussian_latitudes(N, lats)) != GRIB_SUCCESS)
         return ret;
diff --git a/src/grib_accessor_class_md5.c b/src/grib_accessor_class_md5.c
index 3d56f16..10bfc4c 100644
--- a/src/grib_accessor_class_md5.c
+++ b/src/grib_accessor_class_md5.c
@@ -137,37 +137,37 @@ static void init_class(grib_accessor_class* c)
 static void init(grib_accessor* a, const long len , grib_arguments* arg )
 {
     grib_accessor_md5* self = (grib_accessor_md5*)a;
-  char* b=0;
+    char* b=0;
     int n=0;
-  grib_string_list* current=0;
-  grib_context* context=a->context;
+    grib_string_list* current=0;
+    grib_context* context=a->context;
 
     self->offset = grib_arguments_get_name(grib_handle_of_accessor(a),arg,n++);
-  self->length = grib_arguments_get_expression(grib_handle_of_accessor(a),arg,n++);
-  self->blacklist=0;
-  while ( (b=(char*)grib_arguments_get_name(grib_handle_of_accessor(a),arg,n++)) !=NULL) {
-    if (! self->blacklist) {
-      self->blacklist=(grib_string_list*)grib_context_malloc_clear(context,sizeof(grib_string_list));
-      self->blacklist->value=grib_context_strdup(context,b);
-      current=self->blacklist;
-    } else {
-      current->next=(grib_string_list*)grib_context_malloc_clear(context,sizeof(grib_string_list));
-      current->next->value=grib_context_strdup(context,b);
-      current=current->next;
+    self->length = grib_arguments_get_expression(grib_handle_of_accessor(a),arg,n++);
+    self->blacklist=0;
+    while ( (b=(char*)grib_arguments_get_name(grib_handle_of_accessor(a),arg,n++)) !=NULL) {
+        if (! self->blacklist) {
+            self->blacklist=(grib_string_list*)grib_context_malloc_clear(context,sizeof(grib_string_list));
+            self->blacklist->value=grib_context_strdup(context,b);
+            current=self->blacklist;
+        } else {
+            current->next=(grib_string_list*)grib_context_malloc_clear(context,sizeof(grib_string_list));
+            current->next->value=grib_context_strdup(context,b);
+            current=current->next;
+        }
     }
-  }
     a->length = 0;
     a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
     a->flags |= GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC;
-
 }
 
-static int  get_native_type(grib_accessor* a){
-  return GRIB_TYPE_STRING;
+static int  get_native_type(grib_accessor* a)
+{
+    return GRIB_TYPE_STRING;
 }
 
-
-static int compare(grib_accessor* a, grib_accessor* b) {
+static int compare(grib_accessor* a, grib_accessor* b)
+{
     int retval=GRIB_SUCCESS;
 
     size_t alen = 0;
@@ -188,7 +188,8 @@ static int compare(grib_accessor* a, grib_accessor* b) {
     return retval;
 }
 
-static int unpack_string(grib_accessor*a , char*  v, size_t *len){
+static int unpack_string(grib_accessor*a , char*  v, size_t *len)
+{
     grib_accessor_md5* self = (grib_accessor_md5*)a;
     unsigned mess_len;
     unsigned char* mess;
@@ -208,7 +209,7 @@ static int unpack_string(grib_accessor*a , char*  v, size_t *len){
     if((ret = grib_get_long_internal(grib_handle_of_accessor(a),self->offset,&offset))
             != GRIB_SUCCESS)
         return ret;
-  if((ret = grib_expression_evaluate_long(grib_handle_of_accessor(a),self->length,&length))
+    if((ret = grib_expression_evaluate_long(grib_handle_of_accessor(a),self->length,&length))
             != GRIB_SUCCESS)
         return ret;
 
@@ -217,10 +218,10 @@ static int unpack_string(grib_accessor*a , char*  v, size_t *len){
     mess_len=length;
 
     blacklist=a->context->blacklist;
-  /* passed blacklist overrides context blacklist. 
+    /* passed blacklist overrides context blacklist.
      Consider to modify following line to extend context blacklist.
-  */
-  if (self->blacklist) blacklist=self->blacklist;
+     */
+    if (self->blacklist) blacklist=self->blacklist;
     while (blacklist && blacklist->value) {
         b=grib_find_accessor(grib_handle_of_accessor(a),blacklist->value);
         if (!b) {
diff --git a/src/grib_accessor_class_non_alpha.c b/src/grib_accessor_class_non_alpha.c
index 5fab0ec..e8c99da 100644
--- a/src/grib_accessor_class_non_alpha.c
+++ b/src/grib_accessor_class_non_alpha.c
@@ -138,158 +138,159 @@ static void init_class(grib_accessor_class* c)
 
 static void init(grib_accessor* a, const long len , grib_arguments* arg )
 {
-  grib_buffer* buffer=grib_handle_of_accessor(a)->buffer;
-  size_t i=0;
-  unsigned char* v;
-
-  v=buffer->data+a->offset;
-  i=0;
-  while (( *v<33 || *v>126) &&  i<=buffer->ulength) {
-    v++;
-    i++;
-  }
-  a->length=i;
-
-  a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
-
+    grib_buffer* buffer=grib_handle_of_accessor(a)->buffer;
+    size_t i=0;
+    unsigned char* v;
+
+    v=buffer->data+a->offset;
+    i=0;
+    while (( *v<33 || *v>126) &&  i<=buffer->ulength) {
+        v++;
+        i++;
+    }
+    a->length=i;
+
+    a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
 }
 
-static int value_count(grib_accessor* a,long* count){
-  *count=1;
-  return 0;
+static int value_count(grib_accessor* a,long* count)
+{
+    *count=1;
+    return 0;
 }
 
-static size_t string_length(grib_accessor* a){
-  return a->length;
+static size_t string_length(grib_accessor* a)
+{
+    return a->length;
 }
 
 static void dump(grib_accessor* a, grib_dumper* dumper)
 {
-  grib_dump_string(dumper,a,NULL);
+    grib_dump_string(dumper,a,NULL);
 }
 
-static int  get_native_type(grib_accessor* a){
-  return GRIB_TYPE_STRING;
+static int  get_native_type(grib_accessor* a)
+{
+    return GRIB_TYPE_STRING;
 }
 
 static int unpack_string(grib_accessor* a, char* val, size_t *len)
 {
-
-  int i = 0;
-
-  if(len[0] < (a->length+1))
-  {
-    grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%d) for %s it contains %d values ", len[0], a->name , a->length+1 );
-    len[0] = 0;
-    return GRIB_ARRAY_TOO_SMALL;
-  }
-
-  for ( i = 0; i < a->length; i++)
-    val[i] = grib_handle_of_accessor(a)->buffer->data[a->offset+i];
-  val[i] = 0;
-  len[0] = i;
-  return GRIB_SUCCESS;
+    grib_handle* hand = grib_handle_of_accessor(a);
+    int i = 0;
+
+    if (len[0] < (a->length+1))
+    {
+        grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%d) for %s it contains %d values ", len[0], a->name , a->length+1 );
+        len[0] = 0;
+        return GRIB_ARRAY_TOO_SMALL;
+    }
+
+    for (i = 0; i < a->length; i++) {
+        val[i] = hand->buffer->data[a->offset+i];
+    }
+    val[i] = 0;
+    len[0] = i;
+    return GRIB_SUCCESS;
 }
 
 static int pack_string(grib_accessor* a, const char* val, size_t *len)
 {
-
-  return GRIB_NOT_IMPLEMENTED;
+    return GRIB_NOT_IMPLEMENTED;
 }
 
-static int pack_long(grib_accessor* a, const long*  v, size_t *len){
-  grib_context_log(a->context,GRIB_LOG_ERROR, " Should not pack %s as long", a->name);
-  return GRIB_NOT_IMPLEMENTED;
+static int pack_long(grib_accessor* a, const long*  v, size_t *len)
+{
+    grib_context_log(a->context,GRIB_LOG_ERROR, " Should not pack %s as long", a->name);
+    return GRIB_NOT_IMPLEMENTED;
 }
 
-static int pack_double(grib_accessor* a, const double*v, size_t *len){
-  grib_context_log(a->context,GRIB_LOG_ERROR, " Should not pack %s  as double", a->name);
-  return GRIB_NOT_IMPLEMENTED;
+static int pack_double(grib_accessor* a, const double*v, size_t *len)
+{
+    grib_context_log(a->context,GRIB_LOG_ERROR, " Should not pack %s  as double", a->name);
+    return GRIB_NOT_IMPLEMENTED;
 }
 
+static int  unpack_long(grib_accessor* a, long*  v, size_t *len)
+{
+    char val[1024]={0,};
+    size_t l = sizeof(val);
+    size_t i =0;
+    char  *last = NULL;
+    int err=grib_unpack_string (a , val, &l);
 
-static int  unpack_long   (grib_accessor* a, long*  v, size_t *len){
-
-  char val[1024]={0,};
-  size_t l = sizeof(val);
-  size_t i =0;
-  char  *last = NULL;
-  int err=grib_unpack_string (a , val, &l);
-
-  if (err) return err;
-
-  i=0;
-  while ( val[i]==' ' && val[i]!=0  && i<l-1) i++;
+    if (err) return err;
 
-  if (val[i]==0) {
-     *v=0;
-     return 0;
-  }
-  if (val[i+1]==' ' && i<l-2)  val[i+1]=0;
+    i=0;
+    while ( i<l-1 && val[i]==' ' && val[i]!=0 ) i++;
 
-  *v = strtol(val,&last,10);
+    if (val[i]==0) {
+        *v=0;
+        return 0;
+    }
+    if (val[i+1]==' ' && i<l-2)  val[i+1]=0;
 
-  grib_context_log(a->context,GRIB_LOG_DEBUG, " Casting string %s to long", a->name);
-  return GRIB_SUCCESS;
+    *v = strtol(val,&last,10);
 
+    grib_context_log(a->context,GRIB_LOG_DEBUG, " Casting string %s to long", a->name);
+    return GRIB_SUCCESS;
 }
 
-static int unpack_double (grib_accessor* a, double*v, size_t *len){
-  char val[1024];
-  size_t l = sizeof(val);
-  char  *last = NULL;
-  grib_unpack_string (a , val, &l);
+static int unpack_double(grib_accessor* a, double*v, size_t *len)
+{
+    char val[1024];
+    size_t l = sizeof(val);
+    char  *last = NULL;
+    grib_unpack_string (a , val, &l);
 
-  *v = strtod(val,&last);
+    *v = strtod(val,&last);
 
-  if(*last == 0)
-  {
-    grib_context_log(a->context,GRIB_LOG_DEBUG, " Casting string %s to long", a->name);
-    return GRIB_SUCCESS;
-  }
+    if(*last == 0)
+    {
+        grib_context_log(a->context,GRIB_LOG_DEBUG, " Casting string %s to long", a->name);
+        return GRIB_SUCCESS;
+    }
 
-  return GRIB_NOT_IMPLEMENTED;
+    return GRIB_NOT_IMPLEMENTED;
 }
 
-
 static int compare(grib_accessor* a,grib_accessor* b)
 {
-  int retval=0;
-  char *aval=0;
-  char *bval=0;
-  int err=0;
+    int retval=0;
+    char *aval=0;
+    char *bval=0;
+    int err=0;
 
-  size_t alen = 0;
-  size_t blen = 0;
-  long count=0;
+    size_t alen = 0;
+    size_t blen = 0;
+    long count=0;
 
-  err=grib_value_count(a,&count);
-  if (err) return err;
-  alen=count;
+    err=grib_value_count(a,&count);
+    if (err) return err;
+    alen=count;
 
-  err=grib_value_count(b,&count);
-  if (err) return err;
-  blen=count;
+    err=grib_value_count(b,&count);
+    if (err) return err;
+    blen=count;
 
-  if (alen != blen) return GRIB_COUNT_MISMATCH;
+    if (alen != blen) return GRIB_COUNT_MISMATCH;
 
-  aval=(char*)grib_context_malloc(a->context,alen*sizeof(char));
-  bval=(char*)grib_context_malloc(b->context,blen*sizeof(char));
+    aval=(char*)grib_context_malloc(a->context,alen*sizeof(char));
+    bval=(char*)grib_context_malloc(b->context,blen*sizeof(char));
 
-  grib_unpack_string(a,aval,&alen);
-  grib_unpack_string(b,bval,&blen);
+    grib_unpack_string(a,aval,&alen);
+    grib_unpack_string(b,bval,&blen);
 
-  retval = GRIB_SUCCESS;
-  if (strcmp(aval,bval)) retval = GRIB_STRING_VALUE_MISMATCH;
+    retval = GRIB_SUCCESS;
+    if (strcmp(aval,bval)) retval = GRIB_STRING_VALUE_MISMATCH;
 
-  grib_context_free(a->context,aval);
-  grib_context_free(b->context,bval);
+    grib_context_free(a->context,aval);
+    grib_context_free(b->context,bval);
 
-  return retval;
+    return retval;
 }
 
 static long next_offset(grib_accessor* a)
 {
-  return a->offset+a->length;
+    return a->offset+a->length;
 }
-
diff --git a/src/grib_accessor_class_octahedral_gaussian.c b/src/grib_accessor_class_octahedral_gaussian.c
index 8a371a5..0c8f47c 100644
--- a/src/grib_accessor_class_octahedral_gaussian.c
+++ b/src/grib_accessor_class_octahedral_gaussian.c
@@ -146,31 +146,27 @@ static void init(grib_accessor* a,const long l, grib_arguments* c)
 {
     grib_accessor_octahedral_gaussian* self = (grib_accessor_octahedral_gaussian*)a;
     int n = 0;
+    grib_handle* hand = grib_handle_of_accessor(a);
 
-    self->N            = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->Ni           = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->plpresent    = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
-    self->pl           = grib_arguments_get_name(grib_handle_of_accessor(a),c,n++);
+    self->N            = grib_arguments_get_name(hand,c,n++);
+    self->Ni           = grib_arguments_get_name(hand,c,n++);
+    self->plpresent    = grib_arguments_get_name(hand,c,n++);
+    self->pl           = grib_arguments_get_name(hand,c,n++);
 }
 
-/* For an Octahedral grid, this is the number of points on the top-most latitude (near pole) */
-#define NUM_POINTS_ON_LAT_NEAR_POLE 20
-
 static int unpack_long(grib_accessor* a, long* val, size_t *len)
 {
     grib_accessor_octahedral_gaussian* self = (grib_accessor_octahedral_gaussian*)a;
     int ret = GRIB_SUCCESS;
-    long N,Ni;
+    long Ni;
     long plpresent=0;
     long* pl=NULL; /* pl array */
-    size_t plsize=0, i=0, mid=0;
+    size_t plsize=0, i=0;
+    grib_handle* hand = grib_handle_of_accessor(a);
 
     grib_context* c=a->context;
 
-    if((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->N,&N)) != GRIB_SUCCESS)
-        return ret;
-
-    if((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->Ni,&Ni)) != GRIB_SUCCESS)
+    if((ret = grib_get_long_internal(hand, self->Ni,&Ni)) != GRIB_SUCCESS)
         return ret;
 
     /* If Ni is not missing, then this is a plain gaussian grid and not reduced. */
@@ -180,36 +176,30 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len)
         return GRIB_SUCCESS;
     }
 
-    if((ret = grib_get_long_internal(grib_handle_of_accessor(a), self->plpresent,&plpresent)) != GRIB_SUCCESS)
+    if((ret = grib_get_long_internal(hand, self->plpresent,&plpresent)) != GRIB_SUCCESS)
         return ret;
     if (!plpresent) {
         *val = 0; /* Not octahedral */
         return GRIB_SUCCESS;
     }
 
-    if((ret = grib_get_size(grib_handle_of_accessor(a),self->pl,&plsize)) != GRIB_SUCCESS)
+    if((ret = grib_get_size(hand,self->pl,&plsize)) != GRIB_SUCCESS)
         return ret;
-    Assert(plsize);
-    if (plsize != 2*N) {
-        *val=0; /* Not octahedral */
-        return GRIB_SUCCESS;
-    }
+    Assert(plsize); /* pl array must have at least one element */
+
     pl=(long*)grib_context_malloc_clear(c,sizeof(long)*plsize);
     if (!pl) {
         return GRIB_OUT_OF_MEMORY;
     }
-    if ((ret = grib_get_long_array_internal(grib_handle_of_accessor(a),self->pl,pl, &plsize)) != GRIB_SUCCESS)
+    if ((ret = grib_get_long_array_internal(hand,self->pl,pl, &plsize)) != GRIB_SUCCESS)
         return ret;
-    if (pl[0] != NUM_POINTS_ON_LAT_NEAR_POLE) {
-        *val=0; /* Not octahedral */
-        grib_context_free(c, pl);
-        return GRIB_SUCCESS;
-    }
-    mid = plsize/2;
-    /* Check pl values and symmetry */
-    for(i=0; i<mid; ++i) {
-        const long expected = 4*(i+1) + 16; /* Octahedral rule */
-        if ( pl[i] != expected || (pl[i] != pl[plsize-1-i]) ) {
+
+    /* pl[0] is guaranteed to exist. Have already asserted previously */
+    for(i=1; i<plsize; ++i) {
+        const long diff = labs(pl[i] - pl[i-1]);
+        /* There are two values at the equator which are equal. */
+        /* So diff is either 4 or 0 */
+        if (diff != 4 && diff != 0) {
             *val = 0; /* Not octahedral */
             grib_context_free(c, pl);
             return GRIB_SUCCESS;
diff --git a/src/grib_accessor_factory_hash_list b/src/grib_accessor_factory_hash_list
index 9d592b1..ae6ded0 100644
--- a/src/grib_accessor_factory_hash_list
+++ b/src/grib_accessor_factory_hash_list
@@ -1,3 +1,4 @@
+/* This file is automatically generated by ./make_class.pl, do not edit */
  
 abstract_long_vector, &grib_accessor_class_abstract_long_vector
 abstract_vector, &grib_accessor_class_abstract_vector
diff --git a/src/grib_api.h b/src/grib_api.h
index df2f1b3..e1bed8b 100644
--- a/src/grib_api.h
+++ b/src/grib_api.h
@@ -403,6 +403,17 @@ The grib_handle is the structure giving access to parsed grib values by keys.
 int grib_count_in_file(grib_context* c, FILE* f,int* n);
 
 /**
+*  Counts the messages contained in a file.
+*
+* @param c           : the context from which the handle will be created (NULL for default context)
+* @param filename    : the path to the file
+* @param n           : the number of messages in the file
+* @return            0 if OK, integer value on error
+*/
+int grib_count_in_filename(grib_context* c, const char* filename, int* n);
+
+
+/**
 *  Create a handle from a file resource.
 *  The file is read until a message is found. The message is then copied.
 *  Remember always to delete the handle when it is not needed anymore to avoid
@@ -474,14 +485,14 @@ grib_handle* grib_handle_new_from_message_copy(grib_context* c, const void* data
 
 
 /**
- *  Create a handle from a message contained in a samples directory.
+ *  Create a handle from a GRIB message contained in the samples directory.
  *  The message is copied at the creation of the handle
  *
  * @param c           : the context from which the handle will be created (NULL for default context)
- * @param res_name    : the resource name
+ * @param sample_name : the name of the sample file (without the .tmpl extension)
  * @return            the new handle, NULL if the resource is invalid or a problem is encountered
  */
-grib_handle* grib_handle_new_from_samples (grib_context* c, const char* res_name)  ;
+grib_handle* grib_handle_new_from_samples (grib_context* c, const char* sample_name);
 
 
 
@@ -805,7 +816,17 @@ int grib_get_double_elements(grib_handle* h, const char* key, int* i, long size,
 */
 int grib_get_string(grib_handle* h, const char* key, char* mesg, size_t *length);
 
-int grib_get_string_array(grib_handle* h, const char* name, char** val, size_t *length);
+/**
+*  Get string array values from a key. If several keys of the same name are present, the last one is returned
+* @see  grib_set_string_array
+*
+* @param h       : the handle to get the data from
+* @param key     : the key to be searched
+* @param vals    : the address of a string array where the data will be retrieved
+* @param length  : the address of a size_t that contains allocated length of the array on input, and that contains the actual length of the array on output
+* @return        0 if OK, integer value on error
+*/
+int grib_get_string_array(grib_handle* h, const char* key, char** vals, size_t *length);
 
 /**
 *  Get raw bytes values from a key. If several keys of the same name are present, the last one is returned
@@ -1337,6 +1358,7 @@ int wmo_read_grib_from_file(FILE* f,void* buffer,size_t* len);
 int wmo_read_bufr_from_file(FILE* f,void* buffer,size_t* len);
 int wmo_read_gts_from_file(FILE* f,void* buffer,size_t* len);
 int wmo_read_any_from_stream(void *stream_data, long (*stream_proc )(void *, void *buffer, long len ), void *buffer, size_t *len);
+void* wmo_read_any_from_stream_malloc(void* stream_data,long (*stream_proc)(void*,void* buffer,long len) ,size_t *size, int* err);
 void *wmo_read_any_from_file_malloc(FILE* f,int headers_only,size_t *size,off_t *offset,int* err);
 void *wmo_read_gts_from_file_malloc(FILE* f,int headers_only,size_t *size,off_t *offset,int* err);
 void *wmo_read_bufr_from_file_malloc(FILE* f,int headers_only,size_t *size,off_t *offset,int* err);
diff --git a/src/grib_api_internal.h b/src/grib_api_internal.h
index 0d0b4c4..3d0fa99 100644
--- a/src/grib_api_internal.h
+++ b/src/grib_api_internal.h
@@ -18,42 +18,40 @@
 
 
 #ifdef __cplusplus
-extern "C" {
+ extern "C" {
 #endif
 
 /* cmake config header */
 #ifdef HAVE_ECCODES_CONFIG_H
-#include "eccodes_config.h"
+ #include "eccodes_config.h"
 #endif
 
 /* autoconf config header */
 #ifdef HAVE_CONFIG_H
-#include "config.h"
-#ifdef _LARGE_FILES
-#undef _LARGE_FILE_API
-#endif
+ #include "config.h"
+ #ifdef _LARGE_FILES
+  #undef _LARGE_FILE_API
+ #endif
 #endif
 
 #ifndef GRIB_INLINE
-#define GRIB_INLINE
+ #define GRIB_INLINE
 #endif
 
 #if IS_BIG_ENDIAN
-
-#if GRIB_MEM_ALIGN
-#define FAST_BIG_ENDIAN 0
-#else
-#define FAST_BIG_ENDIAN 1
-#endif
-
+ #if GRIB_MEM_ALIGN
+  #define FAST_BIG_ENDIAN 0
+ #else
+  #define FAST_BIG_ENDIAN 1
+ #endif
 #endif
 
 #if IEEE_BE
-#define IEEE
+ #define IEEE
 #else
-#if IEEE_LE
-#define IEEE
-#endif
+ #if IEEE_LE
+  #define IEEE
+ #endif
 #endif
 
 #include <stdio.h>
@@ -113,9 +111,9 @@ extern "C" {
 
 
 #ifdef  HAVE_STRING_H
-#include <string.h>
+ #include <string.h>
 #else
-#include <strings.h>
+ #include <strings.h>
 #endif
 
 #if GRIB_LINUX_PTHREADS
@@ -158,8 +156,8 @@ extern "C" {
 
 
 #ifndef HAVE_FSEEKO
-#define fseeko fseek
-#define ftello ftell
+ #define fseeko fseek
+ #define ftello ftell
 #endif
 
 #define Assert(a) do { if(!(a)) codes_assertion_failed(#a, __FILE__, __LINE__); } while(0)
@@ -482,10 +480,10 @@ struct grib_buffer
 {
     int              property;   /** < property parameter of buffer         */
     int              validity;   /** < validity parameter of buffer         */
-    int              growable;   /** < buffer can be grown         */
+    int              growable;   /** < buffer can be grown                  */
     size_t           length;     /** < Buffer length                        */
     size_t           ulength;    /** < length used of the buffer            */
-    size_t           ulength_bits;    /** < length used of the buffer in bits */
+    size_t           ulength_bits; /** < length used of the buffer in bits  */
     unsigned char*   data;       /** < the data byte array                  */
 };
 
@@ -510,29 +508,29 @@ struct grib_virtual_value {
 
 struct grib_accessor
 {
-  const char*            name  ;      /** < name of the accessor                       */
-  const char*            name_space;  /** < namespace to which the accessor belongs    */
+  const char*            name;       /** < name of the accessor                       */
+  const char*            name_space; /** < namespace to which the accessor belongs    */
   grib_context*          context;
   grib_handle*           h;
-  grib_action*           creator  ;   /** < action that created the accessor           */
-  long                   length ;     /** < byte length of the accessor                */
-  long                   offset ;     /** < offset of the data in the buffer           */
-  grib_section*          parent;      /** < section to which the accessor is attached  */
-  grib_accessor*         next  ;      /** < next accessor in list                      */
-  grib_accessor*         previous;    /** < next accessor in list                      */
-  grib_accessor_class*   cclass;      /** < behaviour of the accessor                  */
-  unsigned long          flags;       /** < Various flags                              */
+  grib_action*           creator;    /** < action that created the accessor           */
+  long                   length;     /** < byte length of the accessor                */
+  long                   offset;     /** < offset of the data in the buffer           */
+  grib_section*          parent;     /** < section to which the accessor is attached  */
+  grib_accessor*         next;       /** < next accessor in list                      */
+  grib_accessor*         previous;   /** < next accessor in list                      */
+  grib_accessor_class*   cclass;     /** < behaviour of the accessor                  */
+  unsigned long          flags;      /** < Various flags                              */
   grib_section*          sub_section;
 
-  const char*            all_names[MAX_ACCESSOR_NAMES]  ;   /** < name of the accessor  */
-  const char*            all_name_spaces[MAX_ACCESSOR_NAMES]; /** < namespace to which the accessor belongs    */
+  const char*            all_names[MAX_ACCESSOR_NAMES];       /** < name of the accessor */
+  const char*            all_name_spaces[MAX_ACCESSOR_NAMES]; /** < namespace to which the accessor belongs */
   int                    dirty;
 
   grib_accessor*         same;      /** < accessors with the same name */
   long                   loop;      /** < used in lists */
   long                   bufr_subset_number;    /** < bufr subset (bufr data accessors belong to different subsets)*/
   long                   bufr_group_number;     /** < used in bufr */
-  grib_virtual_value*    vvalue;    /** < virtual value used when transient flag on **/
+  grib_virtual_value*    vvalue;                /** < virtual value used when transient flag on **/
   const char*            set;
   grib_accessor*         attributes[MAX_ACCESSOR_ATTRIBUTES]; /** < attributes are accessors */
   grib_accessor*         parent_as_attribute;
@@ -593,30 +591,28 @@ struct grib_iterator_class{
 };
 
 struct grib_nearest_class{
-   grib_nearest_class**           super;
-   char* name;
-   size_t                         size;
+   grib_nearest_class**          super;
+   char*                         name;
+   size_t                        size;
 
-   int                            inited;
+   int                           inited;
    nearest_init_class_proc       init_class;
 
    nearest_init_proc             init;
    nearest_destroy_proc          destroy;
 
    nearest_find_proc             find;
-
 };
 
 struct grib_box_class{
    grib_box_class**           super;
-   char* name;
+   char*                      name;
    size_t                     size;
    int                        inited;
    box_init_class_proc        init_class;
    box_init_proc              init;
    box_destroy_proc           destroy;
    box_get_points_proc        get_points;
-
 };
 
 /* --------------- */
@@ -624,8 +620,6 @@ struct grib_box_class{
 typedef void (*search_all_callback_proc)(grib_accessor*,void* data);
 /* --------------- */
 
-
-
 typedef int  (*dumper_init_proc)        (grib_dumper*);
 typedef void (*dumper_dump_proc)        (grib_dumper*,grib_accessor*,const char* comment);
 typedef void (*dumper_dump_section_proc)(grib_dumper*,grib_accessor*,grib_block_of_accessors* block);
@@ -696,7 +690,6 @@ struct grib_box {
    grib_points*                points;
 };
 
-
 struct grib_dependency {
    grib_dependency* next;
    grib_accessor*   observed;
@@ -704,11 +697,10 @@ struct grib_dependency {
    int              run;
 };
 
-
 struct grib_block_of_accessors
 {
-    grib_accessor*    first;
-    grib_accessor*    last ;
+    grib_accessor*  first;
+    grib_accessor*  last;
 };
 
 
@@ -735,43 +727,43 @@ struct grib_oarray {
 } ;
 
 struct grib_darray {
-  double*  v;
-  size_t   size;
-  size_t   n;
-  size_t   incsize;
+  double*       v;
+  size_t        size;
+  size_t        n;
+  size_t        incsize;
   grib_context* context;
 } ;
 
 struct grib_iarray {
-  long* v;
-  size_t size;
-  size_t n;
-  size_t incsize;
-  size_t number_of_pop_front;
+  long*         v;
+  size_t        size;
+  size_t        n;
+  size_t        incsize;
+  size_t        number_of_pop_front;
   grib_context* context;
 } ;
 
 struct grib_vdarray {
   grib_darray** v;
-  size_t size;
-  size_t n;
-  size_t incsize;
+  size_t        size;
+  size_t        n;
+  size_t        incsize;
   grib_context* context;
 } ;
 
 struct grib_vsarray {
   grib_sarray** v;
-  size_t size;
-  size_t n;
-  size_t incsize;
+  size_t        size;
+  size_t        n;
+  size_t        incsize;
   grib_context* context;
 } ;
 
 struct grib_viarray {
   grib_iarray** v;
-  size_t size;
-  size_t n;
-  size_t incsize;
+  size_t        size;
+  size_t        n;
+  size_t        incsize;
   grib_context* context;
 } ;
 
@@ -794,28 +786,28 @@ struct bufr_descriptor {
   int Y;
   int type;
   /*char* name;   Not needed: All usage commented out. See ECC-489 */
-  char* shortName;
-  char* units;
-  long scale;
+  char*  shortName;
+  char*  units;
+  long   scale;
   double factor;
   double reference;
-  long width;
-  int nokey; /* set if descriptor does not have an associated key */
+  long   width;
+  int    nokey; /* set if descriptor does not have an associated key */
   grib_accessor* a;
-} ;
+};
 
 struct bufr_descriptors_array {
   bufr_descriptor** v;
-  size_t size;
-  size_t n;
-  size_t incsize;
-  size_t number_of_pop_front;
+  size_t        size;
+  size_t        n;
+  size_t        incsize;
+  size_t        number_of_pop_front;
   grib_context* context;
 } ;
 
 struct bufr_descriptors_map_list {
-  bufr_descriptors_array* unexpanded;
-  bufr_descriptors_array* expanded;
+  bufr_descriptors_array*    unexpanded;
+  bufr_descriptors_array*    expanded;
   bufr_descriptors_map_list* next;
 };
 
@@ -858,29 +850,29 @@ struct grib_handle
     int                     dont_trigger;  /** Don't notify triggers */
     int                     partial;       /** Not a complete message (just headers) */
     int                     header_mode;   /** Header not jet complete */
-    char* gts_header;
-    size_t gts_header_len;
-    int  use_trie;
-    int  trie_invalid;
-    grib_accessor* accessors[ACCESSORS_ARRAY_SIZE];
-    char* section_offset[MAX_NUM_SECTIONS];
-    char* section_length[MAX_NUM_SECTIONS];
-    int sections_count;
-    off_t offset;
-    long bufr_subset_number;   /* bufr subset number */
-    long bufr_group_number;    /* used in bufr */
+    char*                   gts_header;
+    size_t                  gts_header_len;
+    int                     use_trie;
+    int                     trie_invalid;
+    grib_accessor*          accessors[ACCESSORS_ARRAY_SIZE];
+    char*                   section_offset[MAX_NUM_SECTIONS];
+    char*                   section_length[MAX_NUM_SECTIONS];
+    int                     sections_count;
+    off_t                   offset;
+    long                    bufr_subset_number;   /* bufr subset number */
+    long                    bufr_group_number;    /* used in bufr */
     /* grib_accessor* groups[MAX_NUM_GROUPS]; */
-    long missingValueLong;
-    double missingValueDouble;
-    ProductKind product_kind;
-    grib_trie* bufr_elements_table;
+    long                    missingValueLong;
+    double                  missingValueDouble;
+    ProductKind             product_kind;
+    grib_trie*              bufr_elements_table;
 };
 
 struct grib_multi_handle {
-  grib_context*           context;       /** < context attached to this handle    */
-  grib_buffer*            buffer ;       /** < buffer attached to the handle      */
-  size_t                  offset ;
-  size_t                  length ;
+  grib_context*           context;   /** < context attached to this handle  */
+  grib_buffer*            buffer;    /** < buffer attached to the handle    */
+  size_t                  offset;
+  size_t                  length;
 };
 
 
@@ -948,46 +940,45 @@ struct grib_accessor_class
 typedef struct grib_multi_support grib_multi_support;
 
 struct grib_multi_support {
-    FILE*                           file;
-    size_t                          offset;
-    unsigned char*                  message;
-    size_t                          message_length;
-    unsigned char*                  sections[8];
-    unsigned char*                  bitmap_section;
-    size_t                          bitmap_section_length;
-    size_t                          sections_length[9];
-    int                             section_number;
-    grib_multi_support*             next;
+    FILE*                 file;
+    size_t                offset;
+    unsigned char*        message;
+    size_t                message_length;
+    unsigned char*        sections[8];
+    unsigned char*        bitmap_section;
+    size_t                bitmap_section_length;
+    size_t                sections_length[9];
+    int                   section_number;
+    grib_multi_support*   next;
 };
 
 /* Hash_array */
 typedef struct grib_hash_array_value grib_hash_array_value;
 
 struct grib_hash_array_value {
-  grib_hash_array_value*   next;
-  char*             name;
-  int               type;
-  grib_iarray*      iarray;
-  grib_darray*      darray;
-  grib_trie*        index;
+  grib_hash_array_value*  next;
+  char*                   name;
+  int                     type;
+  grib_iarray*            iarray;
+  grib_darray*            darray;
+  grib_trie*              index;
 };
 
-
 /* Concepts */
 typedef struct grib_concept_condition grib_concept_condition;
 
 struct grib_concept_condition {
   grib_concept_condition* next;
-  char*               name;
-  grib_expression*    expression;
-  grib_iarray*    iarray;
+  char*                   name;
+  grib_expression*        expression;
+  grib_iarray*            iarray;
 };
 
 typedef struct grib_concept_value_name grib_concept_value_name;
 struct grib_concept_value_name {
-  grib_concept_value_name*          next;
-  char*               name;
-} ;
+  grib_concept_value_name* next;
+  char*                    name;
+};
 
 typedef struct grib_concept_value grib_concept_value;
 
@@ -999,7 +990,6 @@ struct grib_concept_value {
 };
 
 /* ----------*/
-
 struct grib_context
 {
     int                             inited;
@@ -1079,8 +1069,8 @@ struct grib_context
 
 /* expression*/
 
-typedef int        (*expression_evaluate_long_proc)(grib_expression*,grib_handle*,long*);
-typedef int      (*expression_evaluate_double_proc)(grib_expression*,grib_handle*,double*);
+typedef int         (*expression_evaluate_long_proc)(grib_expression*,grib_handle*,long*);
+typedef int         (*expression_evaluate_double_proc)(grib_expression*,grib_handle*,double*);
 typedef const char* (*expression_evaluate_string_proc)(grib_expression*,grib_handle*,char*,size_t*,int*);
 typedef const char* (*expression_get_name_proc)(grib_expression*);
 
@@ -1100,7 +1090,6 @@ struct grib_expression {
 };
 
 struct grib_expression_class {
-
     grib_expression_class** super;
     const char*             name;
     size_t                  size;
@@ -1363,9 +1352,9 @@ typedef struct func {
 /* action file */
 struct grib_action_file
 {
-    char*             filename   ;
-    grib_action*      root       ;
-    grib_action_file* next       ;
+    char*             filename;
+    grib_action*      root;
+    grib_action_file* next;
 };
 
 struct grib_action_file_list
@@ -1377,7 +1366,7 @@ struct grib_action_file_list
 /* Common keys iterator */
 struct grib_keys_iterator{
   grib_handle     *handle;
-  unsigned long   filter_flags;     /** flags to filter out accessors */
+  unsigned long   filter_flags; /** flags to filter out accessors */
   unsigned long   accessor_flags_skip;
   grib_accessor   *current;
   char            *name_space;
@@ -1392,7 +1381,7 @@ struct grib_keys_iterator{
 /* BUFR-specific keys iterator */
 struct bufr_keys_iterator{
   grib_handle*      handle;
-  unsigned long     filter_flags;     /** flags to filter out accessors */
+  unsigned long     filter_flags; /** flags to filter out accessors */
   unsigned long     accessor_flags_skip;
   unsigned long     accessor_flags_only;
   grib_accessor*    current;
@@ -1410,8 +1399,8 @@ struct bufr_keys_iterator{
 typedef unsigned long cvs_uint32;
 
 struct cvs_MD5Context {
-  cvs_uint32 buf[4];
-  cvs_uint32 bits[2];
+  cvs_uint32    buf[4];
+  cvs_uint32    bits[2];
   unsigned char in[64];
 };
 /* --- */
@@ -1457,16 +1446,16 @@ struct grib_codetable {
 };
 
 typedef struct grib_smart_table_entry {
-  int code;
+  int   code;
   char* abbreviation;
   char* column[MAX_SMART_TABLE_COLUMNS];
 } grib_smart_table_entry;
 
 struct grib_smart_table {
-  char*             filename[3];
-  char*             recomposed_name[3];
-  grib_smart_table* next;
-  size_t            numberOfEntries;
+  char*                   filename[3];
+  char*                   recomposed_name[3];
+  grib_smart_table*       next;
+  size_t                  numberOfEntries;
   grib_smart_table_entry* entries;
 };
 
diff --git a/src/grib_api_prototypes.h b/src/grib_api_prototypes.h
index d457a90..c548f98 100644
--- a/src/grib_api_prototypes.h
+++ b/src/grib_api_prototypes.h
@@ -196,6 +196,7 @@ bufr_descriptor **grib_bufr_descriptors_array_get_array(bufr_descriptors_array *
 size_t grib_bufr_descriptors_array_used_size(bufr_descriptors_array *v);
 
 /* grib_darray.c */
+void grib_darray_print(const char* title, const grib_darray* darray);
 grib_darray *grib_darray_new_from_array(grib_context *c, double *a, size_t size);
 grib_darray *grib_darray_new(grib_context *c, size_t size, size_t incsize);
 grib_darray *grib_darray_resize(grib_context *c, grib_darray *v);
@@ -220,11 +221,12 @@ grib_oarray *grib_oarray_resize(grib_context *c, grib_oarray *v);
 grib_oarray *grib_oarray_push(grib_context *c, grib_oarray *v, void *val);
 void grib_oarray_delete(grib_context *c, grib_oarray *v);
 void grib_oarray_delete_content(grib_context *c, grib_oarray *v);
-void** grib_oarray_get_array(grib_context *c, grib_oarray *v);
+void **grib_oarray_get_array(grib_context *c, grib_oarray *v);
+void *grib_oarray_get(grib_oarray *v, int i);
 size_t grib_oarray_used_size(grib_oarray *v);
-void* grib_oarray_get(grib_oarray* v,int i);
 
 /* grib_iarray.c */
+void grib_iarray_print(const char* title, const grib_iarray* iarray);
 grib_iarray *grib_iarray_new_from_array(grib_context *c, long *a, size_t size);
 grib_iarray *grib_iarray_new(grib_context *c, size_t size, size_t incsize);
 long grib_iarray_pop(grib_iarray *a);
@@ -285,6 +287,8 @@ size_t grib_viarray_used_size(grib_viarray *v);
 
 /* grib_accessor_class_bufr_data.c */
 
+/* grib_accessor_class_bufr_clear_tables.c */
+
 /* grib_accessor_class_bufr_data_array.c */
 int accessor_bufr_data_array_create_keys(grib_accessor *a, long onlySubset, long startSubset, long endSubset);
 int accessor_bufr_data_array_process_elements(grib_accessor *a, int flag, long onlySubset, long startSubset, long endSubset);
@@ -481,6 +485,8 @@ int grib_g1_step_apply_units(long *start, long *theEnd, long *step_unit, long *P
 
 /* grib_accessor_class_julian_day.c */
 
+/* grib_accessor_class_julian_date.c */
+
 /* grib_accessor_class_latlonvalues.c */
 
 /* grib_accessor_class_latitudes.c */
@@ -495,6 +501,8 @@ int grib_g1_step_apply_units(long *start, long *theEnd, long *step_unit, long *P
 
 /* grib_accessor_class_scale.c */
 
+/* grib_accessor_class_rdbtime_guess_date.c */
+
 /* grib_accessor_class_from_scale_factor_scaled_value.c */
 
 /* grib_accessor_class_times.c */
@@ -989,6 +997,8 @@ void grib_context_set_handle_file_count(grib_context *c, int new_count);
 void grib_context_set_handle_total_count(grib_context *c, int new_count);
 void grib_context_increment_handle_file_count(grib_context *c);
 void grib_context_increment_handle_total_count(grib_context *c);
+void codes_set_codes_assertion_failed_proc(codes_assertion_failed_proc proc);
+void codes_assertion_failed(const char *message, const char *file, int line);
 
 /* grib_date.c */
 int grib_julian_to_datetime(double jd, long *year, long *month, long *day, long *hour, long *minute, long *second);
@@ -1107,6 +1117,7 @@ int wmo_read_gts_from_file(FILE *f, void *buffer, size_t *len);
 int wmo_read_taf_from_file(FILE *f, void *buffer, size_t *len);
 int wmo_read_metar_from_file(FILE *f, void *buffer, size_t *len);
 int wmo_read_any_from_stream(void *stream_data, long (*stream_proc )(void *, void *buffer, long len ), void *buffer, size_t *len);
+void* wmo_read_any_from_stream_malloc(void* stream_data,long (*stream_proc)(void*,void* buffer,long len) ,size_t *size, int* err);
 void *wmo_read_gts_from_file_malloc(FILE *f, int headers_only, size_t *size, off_t *offset, int *err);
 void *wmo_read_taf_from_file_malloc(FILE *f, int headers_only, size_t *size, off_t *offset, int *err);
 void *wmo_read_metar_from_file_malloc(FILE *f, int headers_only, size_t *size, off_t *offset, int *err);
@@ -1118,6 +1129,7 @@ int grib_read_any_from_file(grib_context *ctx, FILE *f, void *buffer, size_t *le
 int grib_read_any_from_memory_alloc(grib_context *ctx, unsigned char **data, size_t *data_length, void **buffer, size_t *length);
 int grib_read_any_from_memory(grib_context *ctx, unsigned char **data, size_t *data_length, void *buffer, size_t *len);
 int grib_count_in_file(grib_context *c, FILE *f, int *n);
+int grib_count_in_filename(grib_context *c, const char *filename, int *n);
 
 /* grib_trie.c */
 grib_trie *grib_trie_new(grib_context *c);
@@ -1134,8 +1146,7 @@ void grib_trie_with_rank_delete_container(grib_trie_with_rank *t);
 void grib_trie_with_rank_delete(grib_trie_with_rank *t);
 void grib_trie_with_rank_clear(grib_trie_with_rank *t);
 int grib_trie_with_rank_insert(grib_trie_with_rank *t, const char *key, void *data);
-void *grib_trie_with_rank_get(grib_trie_with_rank *t, const char *key,int rank);
-void *grib_trie_with_rank_get_from_list(grib_trie_with_rank_list* list,int rank);
+void *grib_trie_with_rank_get(grib_trie_with_rank *t, const char *key, int rank);
 
 /* grib_itrie.c */
 grib_itrie *grib_itrie_new(grib_context *c, int *count);
@@ -1254,7 +1265,7 @@ int grib_get_double(grib_handle *h, const char *name, double *val);
 int grib_get_double_element_internal(grib_handle *h, const char *name, int i, double *val);
 int grib_get_double_element(grib_handle *h, const char *name, int i, double *val);
 int grib_points_get_values(grib_handle *h, grib_points *points, double *val);
-int grib_get_double_elements(grib_handle *h, const char *name, int *i, long len, double *val);
+int grib_get_double_elements(grib_handle *h, const char *name, int *index_array, long len, double *val_array);
 int grib_get_string_internal(grib_handle *h, const char *name, char *val, size_t *length);
 int grib_get_string(grib_handle *h, const char *name, char *val, size_t *length);
 int grib_get_bytes_internal(grib_handle *h, const char *name, unsigned char *val, size_t *length);
@@ -1377,7 +1388,6 @@ grib_nearest *grib_nearest_factory(grib_handle *h, grib_arguments *args);
 /* grib_nearest_class_sh.c */
 
 /* grib_nearest_class_lambert_conformal.c */
-int compare_points(const void *a, const void *b);
 
 /* grib_iterator_class_polar_stereographic.c */
 
@@ -1404,12 +1414,15 @@ grib_iterator *grib_iterator_factory(grib_handle *h, grib_arguments *args, unsig
 /* grib_iterator_class_latlon_reduced.c */
 
 /* grib_iterator_class_gen.c */
+int transform_iterator_data(grib_handle *h, double *data, long iScansNegatively, long jScansPositively, long jPointsAreConsecutive, long alternativeRowScanning, size_t numPoints, long nx, long ny);
 
 /* grib_iterator_class_latlon.c */
 void unrotate(grib_handle *h, const double inlat, const double inlon, const double angleOfRot, const double southPoleLat, const double southPoleLon, double *outlat, double *outlon);
 
 /* grib_iterator_class_regular.c */
 
+/* grib_iterator_class_space_view.c */
+
 /* grib_expression.c */
 int grib_expression_native_type(grib_handle *h, grib_expression *g);
 int grib_expression_evaluate_long(grib_handle *h, grib_expression *g, long *result);
diff --git a/src/grib_api_version.c b/src/grib_api_version.c
index e09f15c..a97d2d5 100644
--- a/src/grib_api_version.c
+++ b/src/grib_api_version.c
@@ -1,3 +1,3 @@
 #include "grib_api_internal.h"
 
-const char * grib_get_git_sha1() { return "ef203a98d50eb6db1279312cd0f506803236cfa6"; }
+const char * grib_get_git_sha1() { return "a8396ccec8cb2509ae2da19907ec5a26b7c5d9b2"; }
diff --git a/src/grib_darray.c b/src/grib_darray.c
index 9f7fa47..70c9166 100644
--- a/src/grib_darray.c
+++ b/src/grib_darray.c
@@ -16,6 +16,18 @@
 
 #include "grib_api_internal.h"
 
+/* For debugging purposes */
+void grib_darray_print(const char* title, const grib_darray* darray)
+{
+    Assert(darray);
+    size_t i;
+    printf("%s: darray.n=%lu  \t", title, (unsigned long)darray->n);
+    for (i=0; i<darray->n; i++) {
+        printf("darray[%lu]=%g\t", (unsigned long)i, darray->v[i]);
+    }
+    printf("\n");
+}
+
 grib_darray* grib_darray_new_from_array(grib_context* c,double* a,size_t size)
 {
   size_t i;
diff --git a/src/grib_dumper_class.h b/src/grib_dumper_class.h
index fb95eb3..0728c73 100644
--- a/src/grib_dumper_class.h
+++ b/src/grib_dumper_class.h
@@ -7,7 +7,7 @@ extern grib_dumper_class* grib_dumper_class_bufr_encode_C;
 extern grib_dumper_class* grib_dumper_class_bufr_encode_filter;
 extern grib_dumper_class* grib_dumper_class_bufr_encode_fortran;
 extern grib_dumper_class* grib_dumper_class_bufr_encode_python;
-extern grib_dumper_class* grib_dumper_class_compare;
+extern grib_dumper_class* grib_dumper_class_bufr_simple;
 extern grib_dumper_class* grib_dumper_class_debug;
 extern grib_dumper_class* grib_dumper_class_default;
 extern grib_dumper_class* grib_dumper_class_file;
diff --git a/src/grib_dumper_class_bufr_decode_C.c b/src/grib_dumper_class_bufr_decode_C.c
index 7eb4f1d..e301d78 100644
--- a/src/grib_dumper_class_bufr_decode_C.c
+++ b/src/grib_dumper_class_bufr_decode_C.c
@@ -162,12 +162,12 @@ static void dump_values(grib_dumper* d, grib_accessor* a)
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size <= 1) {
         err=grib_unpack_double(a,&value,&size);
     }
@@ -222,18 +222,18 @@ static void dump_values(grib_dumper* d, grib_accessor* a)
 static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* prefix)
 {
     grib_dumper_bufr_decode_C *self = (grib_dumper_bufr_decode_C*)d;
-    double value; size_t size = 0;
+    double value=0; size_t size = 0;
     int err = 0;
     long count=0;
     char* sval;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size <= 1) {
         err=grib_unpack_double(a,&value,&size);
     }
@@ -287,11 +287,12 @@ static void dump_long(grib_dumper* d,grib_accessor* a, const char* comment)
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
+    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 )
+        return;
+
     grib_value_count(a,&count);
     size=count;
 
-    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0  ) return;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) {
         if (self->isLeaf==0) {
             char* prefix;
@@ -366,12 +367,12 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
     long count=0;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size <= 1) {
         err=grib_unpack_long(a,&value,&size);
     }
@@ -423,10 +424,10 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment)
     grib_handle* h=grib_handle_of_accessor(a);
     grib_context* c=h->context;
 
-    grib_unpack_double(a,&value,&size);
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
+    grib_unpack_double(a,&value,&size);
     self->empty=0;
 
     r=compute_bufr_key_rank(h,self->keys,a->name);
@@ -459,12 +460,12 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment)
 static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comment)
 {
     grib_dumper_bufr_decode_C *self = (grib_dumper_bufr_decode_C*)d;
-    char **values;
+    char **values = NULL;
     size_t size = 0;
     grib_context* c=NULL;
     int err = 0;
     long count=0;
-    int r;
+    int r=0;
     grib_handle* h=grib_handle_of_accessor(a);
 
     c=a->context;
diff --git a/src/grib_dumper_class_bufr_decode_filter.c b/src/grib_dumper_class_bufr_decode_filter.c
index 6bc8d93..42c94b3 100644
--- a/src/grib_dumper_class_bufr_decode_filter.c
+++ b/src/grib_dumper_class_bufr_decode_filter.c
@@ -145,19 +145,19 @@ static int destroy(grib_dumper* d)
 static void dump_values(grib_dumper* d, grib_accessor* a)
 {
     grib_dumper_bufr_decode_filter *self = (grib_dumper_bufr_decode_filter*)d;
-    double value; size_t size = 0;
+    double value=0; size_t size = 0;
     int err = 0;
     int r;
     long count=0;
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size<=1) {
         err=grib_unpack_double(a,&value,&size);
     }
@@ -203,17 +203,17 @@ static void dump_values(grib_dumper* d, grib_accessor* a)
 static void dump_values_attribute(grib_dumper* d,grib_accessor* a, const char* prefix)
 {
     grib_dumper_bufr_decode_filter *self = (grib_dumper_bufr_decode_filter*)d;
-    double value; size_t size = 0;
+    double value=0; size_t size = 0;
     int err = 0;
     long count=0;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size<=1) {
         err=grib_unpack_double(a,&value,&size);
     }
@@ -251,11 +251,11 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
+    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0  ) return;
+
     grib_value_count(a,&count);
     size=count;
 
-    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0  ) return;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) {
         if (self->isLeaf==0) {
             char* prefix;
@@ -346,15 +346,15 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment)
 static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment)
 {
     grib_dumper_bufr_decode_filter *self = (grib_dumper_bufr_decode_filter*)d;
-    double value; size_t size = 1;
+    double value=0; size_t size = 1;
     int r;
     grib_handle* h=grib_handle_of_accessor(a);
     grib_context* c=h->context;
 
-    grib_unpack_double(a,&value,&size);
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
+    grib_unpack_double(a,&value,&size);
     self->begin=0;
     self->empty=0;
 
diff --git a/src/grib_dumper_class_bufr_decode_fortran.c b/src/grib_dumper_class_bufr_decode_fortran.c
index bde6fa2..705a6a0 100644
--- a/src/grib_dumper_class_bufr_decode_fortran.c
+++ b/src/grib_dumper_class_bufr_decode_fortran.c
@@ -147,19 +147,19 @@ static int destroy(grib_dumper* d)
 static void dump_values(grib_dumper* d, grib_accessor* a)
 {
     grib_dumper_bufr_decode_fortran *self = (grib_dumper_bufr_decode_fortran*)d;
-    double value; size_t size = 0;
+    double value=0; size_t size = 0;
     int err = 0;
     int r=0;
     long count=0;
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size<=1) {
         err=grib_unpack_double(a,&value,&size);
     }
@@ -209,12 +209,12 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char*
     long count=0;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size <= 1) {
         err=grib_unpack_double(a,&value,&size);
     }
@@ -247,18 +247,19 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char*
 static void dump_long(grib_dumper* d,grib_accessor* a, const char* comment)
 {
     grib_dumper_bufr_decode_fortran *self = (grib_dumper_bufr_decode_fortran*)d;
-    long value; size_t size = 0;
+    long value=0; size_t size = 0;
     int err = 0;
     int r=0;
     long count=0;
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
+    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0  )
+        return;
+
     grib_value_count(a,&count);
     size=count;
 
-    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0  ) return;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) {
         if (self->isLeaf==0) {
             char* prefix;
@@ -323,17 +324,17 @@ static void dump_long(grib_dumper* d,grib_accessor* a, const char* comment)
 static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* prefix)
 {
     grib_dumper_bufr_decode_fortran *self = (grib_dumper_bufr_decode_fortran*)d;
-    long value; size_t size = 0;
+    long value=0; size_t size = 0;
     int err = 0;
     long count=0;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size <= 1) {
         err=grib_unpack_long(a,&value,&size);
     }
@@ -378,10 +379,10 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment)
     grib_handle* h=grib_handle_of_accessor(a);
     grib_context* c=h->context;
 
-    grib_unpack_double(a,&value,&size);
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
+    grib_unpack_double(a,&value,&size);
     self->empty=0;
 
     r=compute_bufr_key_rank(h,self->keys,a->name);
@@ -415,7 +416,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm
     grib_context* c=NULL;
     int err = 0;
     long count=0;
-    int r;
+    int r=0;
     grib_handle* h=grib_handle_of_accessor(a);
 
     c=a->context;
diff --git a/src/grib_dumper_class_bufr_decode_python.c b/src/grib_dumper_class_bufr_decode_python.c
index 4b113f9..c5a695e 100644
--- a/src/grib_dumper_class_bufr_decode_python.c
+++ b/src/grib_dumper_class_bufr_decode_python.c
@@ -162,12 +162,12 @@ static void dump_values(grib_dumper* d,grib_accessor* a)
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size <= 1) {
         err=grib_unpack_double(a,&value,&size);
     }
@@ -215,18 +215,18 @@ static void dump_values(grib_dumper* d,grib_accessor* a)
 static void dump_values_attribute(grib_dumper* d,grib_accessor* a, const char* prefix)
 {
     grib_dumper_bufr_decode_python *self = (grib_dumper_bufr_decode_python*)d;
-    double value; size_t size = 0;
+    double value=0; size_t size = 0;
     int err = 0;
     long count=0;
     char* sval;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size <= 1) {
         err=grib_unpack_double(a,&value,&size);
     }
@@ -272,11 +272,12 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
+    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0  )
+        return;
+
     grib_value_count(a,&count);
     size=count;
 
-    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0  ) return;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) {
         if (self->isLeaf==0) {
             char* prefix;
@@ -344,12 +345,12 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
     long count=0;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size <= 1) {
         err=grib_unpack_long(a,&value,&size);
     }
@@ -392,10 +393,10 @@ static void dump_double(grib_dumper* d,grib_accessor* a,const char* comment)
     grib_handle* h=grib_handle_of_accessor(a);
     grib_context* c=h->context;
 
-    grib_unpack_double(a,&value,&size);
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
+    grib_unpack_double(a,&value,&size);
     self->empty=0;
 
     r=compute_bufr_key_rank(h,self->keys,a->name);
diff --git a/src/grib_dumper_class_bufr_encode_C.c b/src/grib_dumper_class_bufr_encode_C.c
index 336b651..6f4efc1 100644
--- a/src/grib_dumper_class_bufr_encode_C.c
+++ b/src/grib_dumper_class_bufr_encode_C.c
@@ -154,7 +154,7 @@ static char* dval_to_string(grib_context* c, double v)
 static void dump_values(grib_dumper* d, grib_accessor* a)
 {
     grib_dumper_bufr_encode_C *self = (grib_dumper_bufr_encode_C*)d;
-    double value; size_t size = 0;
+    double value=0; size_t size = 0;
     double *values=NULL;
     int err = 0;
     int i,r,icount;
@@ -164,12 +164,12 @@ static void dump_values(grib_dumper* d, grib_accessor* a)
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(double*)grib_context_malloc_clear(c,sizeof(double)*size);
         err=grib_unpack_double(a,values,&size);
@@ -241,7 +241,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a)
 static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* prefix)
 {
     grib_dumper_bufr_encode_C *self = (grib_dumper_bufr_encode_C*)d;
-    double value; size_t size = 0;
+    double value=0; size_t size = 0;
     double *values=NULL;
     int err = 0;
     int i,icount;
@@ -250,12 +250,12 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char*
     char* sval;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(double*)grib_context_malloc_clear(c,sizeof(double)*size);
         err=grib_unpack_double(a,values,&size);
@@ -319,7 +319,7 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char*
 static void dump_long(grib_dumper* d,grib_accessor* a, const char* comment)
 {
     grib_dumper_bufr_encode_C *self = (grib_dumper_bufr_encode_C*)d;
-    long value; size_t size = 0;
+    long value=0; size_t size = 0;
     long *values=NULL;
     int err = 0;
     int i,r,icount;
@@ -328,11 +328,12 @@ static void dump_long(grib_dumper* d,grib_accessor* a, const char* comment)
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
+    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 )
+        return;
+
     grib_value_count(a,&count);
     size=count;
 
-    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0  ) return;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) {
         if (self->isLeaf==0) {
             char* prefix;
@@ -425,7 +426,7 @@ static void dump_long(grib_dumper* d,grib_accessor* a, const char* comment)
 static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* prefix)
 {
     grib_dumper_bufr_encode_C *self = (grib_dumper_bufr_encode_C*)d;
-    long value; size_t size = 0;
+    long value=0; size_t size = 0;
     long *values=NULL;
     int err = 0;
     int i,icount;
@@ -433,12 +434,12 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
     long count=0;
     grib_context* c=a->context;
 
+    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0 )
+        return;
+
     grib_value_count(a,&count);
     size=count;
 
-    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
-        return;
-
     if (size>1) {
         values=(long*)grib_context_malloc_clear(a->context,sizeof(long)*size);
         err=grib_unpack_long(a,values,&size);
@@ -498,16 +499,16 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment)
 static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment)
 {
     grib_dumper_bufr_encode_C *self = (grib_dumper_bufr_encode_C*)d;
-    double value; size_t size = 1;
+    double value=0; size_t size = 1;
     int r;
     char* sval;
     grib_handle* h=grib_handle_of_accessor(a);
     grib_context* c=h->context;
 
-    grib_unpack_double(a,&value,&size);
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
+    grib_unpack_double(a,&value,&size);
     self->empty=0;
 
     r=compute_bufr_key_rank(h,self->keys,a->name);
@@ -542,14 +543,12 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm
     grib_dumper_bufr_encode_C *self = (grib_dumper_bufr_encode_C*)d;
     char **values;
     size_t size = 0,i=0;
-    grib_context* c=NULL;
+    grib_context* c=a->context;
     int err = 0;
     long count=0;
-    int r;
+    int r=0;
     grib_handle* h=grib_handle_of_accessor(a);
 
-    c=a->context;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
@@ -574,9 +573,9 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm
 
     err = grib_unpack_string_array(a,values,&size);
     for  (i=0;i<size-1;i++) {
-        fprintf(self->dumper.out,"  svalues[%lu]=\"%s\"; \n", i, values[i]);
+        fprintf(self->dumper.out,"  svalues[%lu]=\"%s\"; \n", (unsigned long)i, values[i]);
     }
-    fprintf(self->dumper.out,"  svalues[%lu]=\"%s\";\n", i, values[i]);
+    fprintf(self->dumper.out,"  svalues[%lu]=\"%s\";\n", (unsigned long)i, values[i]);
 
     if (self->isLeaf==0) {
         if ((r=compute_bufr_key_rank(h,self->keys,a->name))!=0)
@@ -610,12 +609,11 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment)
     char *value=NULL;
     char *p = NULL;
     size_t size = 0;
-    grib_context* c=NULL;
+    grib_context* c = a->context;
     int r;
     int err = _grib_get_string_length(a,&size);
     grib_handle* h=grib_handle_of_accessor(a);
 
-    c=a->context;
     if (size==0) return;
 
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
@@ -690,11 +688,11 @@ static void _dump_long_array(grib_handle* h, FILE* f, const char* key, const cha
     grib_get_long_array(h,key,val,&size);
     for (i=0;i<size-1;i++) {
         if (icount>cols || i==0) {fprintf(f,"\n  ");icount=0;}
-        fprintf(f,"ivalues[%lu]=%ld; ", i, val[i]);
+        fprintf(f,"ivalues[%lu]=%ld; ", (unsigned long)i, val[i]);
         icount++;
     }
     if (icount>cols) {fprintf(f,"\n  ");}
-    fprintf(f,"ivalues[%lu]=%ld;\n", size-1, val[size-1]);
+    fprintf(f,"ivalues[%lu]=%ld;\n", (unsigned long)(size-1), val[size-1]);
 
     grib_context_free(h->context,val);
     fprintf(f,"  CODES_CHECK(codes_set_long_array(h, \"%s\", ivalues, size), 0);\n",print_key);
diff --git a/src/grib_dumper_class_bufr_encode_filter.c b/src/grib_dumper_class_bufr_encode_filter.c
index 31ee90e..cfbc38e 100644
--- a/src/grib_dumper_class_bufr_encode_filter.c
+++ b/src/grib_dumper_class_bufr_encode_filter.c
@@ -145,7 +145,7 @@ static int destroy(grib_dumper* d)
 static void dump_values(grib_dumper* d, grib_accessor* a)
 {
     grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
-    double value; size_t size = 0;
+    double value=0; size_t size = 0;
     double *values=NULL;
     int err = 0;
     int i,r;
@@ -154,12 +154,12 @@ static void dump_values(grib_dumper* d, grib_accessor* a)
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(double*)grib_context_malloc_clear(c,sizeof(double)*size);
         err=grib_unpack_double(a,values,&size);
@@ -225,7 +225,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a)
 static void dump_values_attribute(grib_dumper* d,grib_accessor* a, const char* prefix)
 {
     grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
-    double value; size_t size = 0;
+    double value=0; size_t size = 0;
     double *values=NULL;
     int err = 0;
     int i,icount;
@@ -233,12 +233,12 @@ static void dump_values_attribute(grib_dumper* d,grib_accessor* a, const char* p
     long count=0;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(double*)grib_context_malloc_clear(c,sizeof(double)*size);
         err=grib_unpack_double(a,values,&size);
@@ -287,7 +287,7 @@ static void dump_values_attribute(grib_dumper* d,grib_accessor* a, const char* p
 static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
 {
     grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
-    long value; size_t size = 0;
+    long value=0; size_t size = 0;
     long *values=NULL;
     int err = 0;
     int i,r,icount;
@@ -296,11 +296,12 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
+    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 )
+        return;
+
     grib_value_count(a,&count);
     size=count;
 
-    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0  ) return;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) {
         if (self->isLeaf==0) {
             char* prefix;
@@ -382,7 +383,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
 static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* prefix)
 {
     grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
-    long value; size_t size = 0;
+    long value=0; size_t size = 0;
     long *values=NULL;
     int err = 0;
     int i,icount;
@@ -390,12 +391,12 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
     long count=0;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(long*)grib_context_malloc_clear(a->context,sizeof(long)*size);
         err=grib_unpack_long(a,values,&size);
@@ -448,15 +449,15 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment)
 static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment)
 {
     grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
-    double value; size_t size = 1;
+    double value=0; size_t size = 1;
     int r;
     grib_handle* h=grib_handle_of_accessor(a);
     grib_context* c=h->context;
 
-    grib_unpack_double(a,&value,&size);
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
+    grib_unpack_double(a,&value,&size);
     self->begin=0;
     self->empty=0;
 
diff --git a/src/grib_dumper_class_bufr_encode_fortran.c b/src/grib_dumper_class_bufr_encode_fortran.c
index 55aaee3..d829fda 100644
--- a/src/grib_dumper_class_bufr_encode_fortran.c
+++ b/src/grib_dumper_class_bufr_encode_fortran.c
@@ -160,7 +160,7 @@ static char* dval_to_string(grib_context* c, double v)
 static void dump_values(grib_dumper* d, grib_accessor* a)
 {
     grib_dumper_bufr_encode_fortran *self = (grib_dumper_bufr_encode_fortran*)d;
-    double value; size_t size = 0;
+    double value=0; size_t size = 0;
     double *values=NULL;
     int err = 0;
     int i,r,icount;
@@ -170,12 +170,12 @@ static void dump_values(grib_dumper* d, grib_accessor* a)
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(double*)grib_context_malloc_clear(c,sizeof(double)*size);
         err=grib_unpack_double(a,values,&size);
@@ -249,7 +249,7 @@ static void dump_values(grib_dumper* d, grib_accessor* a)
 static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char* prefix)
 {
     grib_dumper_bufr_encode_fortran *self = (grib_dumper_bufr_encode_fortran*)d;
-    double value; size_t size = 0;
+    double value=0; size_t size = 0;
     double *values=NULL;
     int err = 0;
     int i,icount;
@@ -258,12 +258,12 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char*
     char* sval;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(double*)grib_context_malloc_clear(c,sizeof(double)*size);
         err=grib_unpack_double(a,values,&size);
@@ -327,7 +327,7 @@ static void dump_values_attribute(grib_dumper* d, grib_accessor* a, const char*
 static void dump_long(grib_dumper* d,grib_accessor* a, const char* comment)
 {
     grib_dumper_bufr_encode_fortran *self = (grib_dumper_bufr_encode_fortran*)d;
-    long value; size_t size = 0;
+    long value=0; size_t size = 0;
     long *values=NULL;
     int err = 0;
     int i,r,icount;
@@ -336,11 +336,11 @@ static void dump_long(grib_dumper* d,grib_accessor* a, const char* comment)
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
+    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0  ) return;
+
     grib_value_count(a,&count);
     size=count;
 
-    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0  ) return;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) {
         if (self->isLeaf==0) {
             char* prefix;
@@ -432,7 +432,7 @@ static void dump_long(grib_dumper* d,grib_accessor* a, const char* comment)
 static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* prefix)
 {
     grib_dumper_bufr_encode_fortran *self = (grib_dumper_bufr_encode_fortran*)d;
-    long value; size_t size = 0;
+    long value=0; size_t size = 0;
     long *values=NULL;
     int err = 0;
     int i,icount;
@@ -440,12 +440,12 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
     long count=0;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(long*)grib_context_malloc_clear(a->context,sizeof(long)*size);
         err=grib_unpack_long(a,values,&size);
@@ -504,16 +504,16 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment)
 static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment)
 {
     grib_dumper_bufr_encode_fortran *self = (grib_dumper_bufr_encode_fortran*)d;
-    double value; size_t size = 1;
+    double value=0; size_t size = 1;
     int r;
     char* sval;
     grib_handle* h=grib_handle_of_accessor(a);
     grib_context* c=h->context;
 
-    grib_unpack_double(a,&value,&size);
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
+    grib_unpack_double(a,&value,&size);
     self->empty=0;
 
     r=compute_bufr_key_rank(h,self->keys,a->name);
@@ -551,7 +551,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm
     grib_context* c=NULL;
     int err = 0;
     long count=0;
-    int r;
+    int r = 0;
     grib_handle* h=grib_handle_of_accessor(a);
 
     c=a->context;
diff --git a/src/grib_dumper_class_bufr_encode_python.c b/src/grib_dumper_class_bufr_encode_python.c
index 0c9f8b3..feba002 100644
--- a/src/grib_dumper_class_bufr_encode_python.c
+++ b/src/grib_dumper_class_bufr_encode_python.c
@@ -154,7 +154,7 @@ static char* dval_to_string(const grib_context* c,double v)
 static void dump_values(grib_dumper* d,grib_accessor* a)
 {
     grib_dumper_bufr_encode_python *self = (grib_dumper_bufr_encode_python*)d;
-    double value; size_t size = 0;
+    double value=0; size_t size = 0;
     double *values=NULL;
     int err = 0;
     int i,r,icount;
@@ -164,12 +164,12 @@ static void dump_values(grib_dumper* d,grib_accessor* a)
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(double*)grib_context_malloc_clear(c,sizeof(double)*size);
         err=grib_unpack_double(a,values,&size);
@@ -239,7 +239,7 @@ static void dump_values(grib_dumper* d,grib_accessor* a)
 static void dump_values_attribute(grib_dumper* d,grib_accessor* a, const char* prefix)
 {
     grib_dumper_bufr_encode_python *self = (grib_dumper_bufr_encode_python*)d;
-    double value; size_t size = 0;
+    double value=0; size_t size = 0;
     double *values=NULL;
     int err = 0;
     int i,icount;
@@ -248,12 +248,12 @@ static void dump_values_attribute(grib_dumper* d,grib_accessor* a, const char* p
     char* sval;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(double*)grib_context_malloc_clear(c,sizeof(double)*size);
         err=grib_unpack_double(a,values,&size);
@@ -315,7 +315,7 @@ static void dump_values_attribute(grib_dumper* d,grib_accessor* a, const char* p
 static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
 {
     grib_dumper_bufr_encode_python *self = (grib_dumper_bufr_encode_python*)d;
-    long value; size_t size = 0;
+    long value=0; size_t size = 0;
     long *values=NULL;
     int err = 0;
     int i,r,icount;
@@ -324,11 +324,11 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
+    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0  ) return;
+
     grib_value_count(a,&count);
     size=count;
 
-    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0  ) return;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) {
         if (self->isLeaf==0) {
             char* prefix;
@@ -418,7 +418,7 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
 static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* prefix)
 {
     grib_dumper_bufr_encode_python *self = (grib_dumper_bufr_encode_python*)d;
-    long value; size_t size = 0;
+    long value=0; size_t size = 0;
     long *values=NULL;
     int err = 0;
     int i,icount;
@@ -426,12 +426,12 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
     long count=0;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(long*)grib_context_malloc_clear(a->context,sizeof(long)*size);
         err=grib_unpack_long(a,values,&size);
@@ -494,10 +494,10 @@ static void dump_double(grib_dumper* d,grib_accessor* a,const char* comment)
     grib_handle* h=grib_handle_of_accessor(a);
     grib_context* c=h->context;
 
-    grib_unpack_double(a,&value,&size);
-    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
+    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0 )
         return;
 
+    grib_unpack_double(a,&value,&size);
     self->empty=0;
 
     r=compute_bufr_key_rank(h,self->keys,a->name);
@@ -540,7 +540,7 @@ static void dump_string_array(grib_dumper* d,grib_accessor* a,const char* commen
 
     c=a->context;
 
-    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
+    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0 )
         return;
 
     grib_value_count(a,&count);
diff --git a/src/grib_dumper_class_bufr_encode_filter.c b/src/grib_dumper_class_bufr_simple.c
similarity index 83%
copy from src/grib_dumper_class_bufr_encode_filter.c
copy to src/grib_dumper_class_bufr_simple.c
index 31ee90e..def5b77 100644
--- a/src/grib_dumper_class_bufr_encode_filter.c
+++ b/src/grib_dumper_class_bufr_simple.c
@@ -55,9 +55,9 @@ static void dump_values     (grib_dumper* d, grib_accessor* a);
 static void dump_label      (grib_dumper* d, grib_accessor* a,const char* comment);
 static void dump_section    (grib_dumper* d, grib_accessor* a,grib_block_of_accessors* block);
 
-typedef struct grib_dumper_bufr_encode_filter {
+typedef struct grib_dumper_bufr_simple {
     grib_dumper          dumper;  
-/* Members defined in bufr_encode_filter */
+/* Members defined in bufr_simple */
 	long section_offset;
 	long begin;
 	long empty;
@@ -65,13 +65,13 @@ typedef struct grib_dumper_bufr_encode_filter {
 	long isLeaf;
 	long isAttribute;
 	grib_string_list* keys;
-} grib_dumper_bufr_encode_filter;
+} grib_dumper_bufr_simple;
 
 
-static grib_dumper_class _grib_dumper_class_bufr_encode_filter = {
+static grib_dumper_class _grib_dumper_class_bufr_simple = {
     0,                              /* super                     */
-    "bufr_encode_filter",                              /* name                      */
-    sizeof(grib_dumper_bufr_encode_filter),     /* size                      */
+    "bufr_simple",                              /* name                      */
+    sizeof(grib_dumper_bufr_simple),     /* size                      */
     0,                                   /* inited */
     &init_class,                         /* init_class */
     &init,                               /* init                      */
@@ -89,7 +89,7 @@ static grib_dumper_class _grib_dumper_class_bufr_encode_filter = {
     0,                             /* footer   */
 };
 
-grib_dumper_class* grib_dumper_class_bufr_encode_filter = &_grib_dumper_class_bufr_encode_filter;
+grib_dumper_class* grib_dumper_class_bufr_simple = &_grib_dumper_class_bufr_simple;
 
 /* END_CLASS_IMP */
 static void dump_attributes(grib_dumper* d,grib_accessor* a, const char* prefix);
@@ -116,7 +116,7 @@ static void init_class      (grib_dumper_class* c){}
 
 static int init(grib_dumper* d)
 {
-    grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
+    grib_dumper_bufr_simple *self = (grib_dumper_bufr_simple*)d;
     grib_context* c=d->handle->context;
     self->section_offset=0;
     self->empty=1;
@@ -129,7 +129,7 @@ static int init(grib_dumper* d)
 
 static int destroy(grib_dumper* d)
 {
-    grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
+    grib_dumper_bufr_simple *self = (grib_dumper_bufr_simple*)d;
     grib_string_list* next=self->keys;
     grib_string_list* cur=self->keys;
     grib_context* c=d->handle->context;
@@ -144,8 +144,8 @@ static int destroy(grib_dumper* d)
 
 static void dump_values(grib_dumper* d, grib_accessor* a)
 {
-    grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
-    double value; size_t size = 0;
+    grib_dumper_bufr_simple *self = (grib_dumper_bufr_simple*)d;
+    double value=0; size_t size = 0;
     double *values=NULL;
     int err = 0;
     int i,r;
@@ -154,12 +154,12 @@ static void dump_values(grib_dumper* d, grib_accessor* a)
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(double*)grib_context_malloc_clear(c,sizeof(double)*size);
         err=grib_unpack_double(a,values,&size);
@@ -174,33 +174,34 @@ static void dump_values(grib_dumper* d, grib_accessor* a)
         int icount=0;
 
         if ((r=compute_bufr_key_rank(h,self->keys,a->name))!=0)
-            fprintf(self->dumper.out,"set #%d#%s=",r,a->name);
+            fprintf(self->dumper.out,"#%d#%s=",r,a->name);
         else
-            fprintf(self->dumper.out,"set %s=",a->name);
+            fprintf(self->dumper.out,"%s=",a->name);
 
         fprintf(self->dumper.out,"{");
 
         for (i=0; i<size-1; ++i) {
             if (icount>cols || i==0) {fprintf(self->dumper.out,"\n      ");icount=0;}
-            fprintf(self->dumper.out,"%.18e, ", values[i]);
+            fprintf(self->dumper.out,"%g, ", values[i]);
             icount++;
         }
         if (icount>cols || i==0) {fprintf(self->dumper.out,"\n      ");icount=0;}
-        fprintf(self->dumper.out, "%.18e",values[i]);
+        fprintf(self->dumper.out, "%g",values[i]);
 
         depth-=2;
-        fprintf(self->dumper.out,"};\n");
+        fprintf(self->dumper.out,"}\n");
         grib_context_free(c,values);
     } else {
         r=compute_bufr_key_rank(h,self->keys,a->name);
-        if( !grib_is_missing_double(a,value) ) {
-
-            if (r!=0)
-                fprintf(self->dumper.out,"set #%d#%s=",r,a->name);
-            else
-                fprintf(self->dumper.out,"set %s=",a->name);
+        if (r!=0)
+            fprintf(self->dumper.out,"#%d#%s=",r,a->name);
+        else
+            fprintf(self->dumper.out,"%s=",a->name);
 
-            fprintf(self->dumper.out,"%.18e;\n",value);
+        if (!grib_is_missing_double(a,value)) {
+            fprintf(self->dumper.out,"%g\n",value);
+        } else {
+            fprintf(self->dumper.out,"MISSING\n");
         }
     }
 
@@ -224,21 +225,21 @@ static void dump_values(grib_dumper* d, grib_accessor* a)
 
 static void dump_values_attribute(grib_dumper* d,grib_accessor* a, const char* prefix)
 {
-    grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
-    double value; size_t size = 0;
+    grib_dumper_bufr_simple *self = (grib_dumper_bufr_simple*)d;
+    double value=0; size_t size = 0;
     double *values=NULL;
     int err = 0;
     int i,icount;
-    int cols=2;
+    int cols=9;
     long count=0;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) !=0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(double*)grib_context_malloc_clear(c,sizeof(double)*size);
         err=grib_unpack_double(a,values,&size);
@@ -249,23 +250,25 @@ static void dump_values_attribute(grib_dumper* d,grib_accessor* a, const char* p
     self->empty=0;
 
     if (size>1) {
-        fprintf(self->dumper.out,"set %s->%s = {", prefix, a->name);
+        fprintf(self->dumper.out,"%s->%s = {", prefix, a->name);
         icount=0;
         for (i=0; i<size-1; ++i) {
             if (icount>cols || i==0) {fprintf(self->dumper.out,"\n      ");icount=0;}
-            fprintf(self->dumper.out,"%.18e, ", values[i]);
+            fprintf(self->dumper.out,"%g, ", values[i]);
             icount++;
         }
         if (icount>cols || i==0) {fprintf(self->dumper.out,"\n      ");icount=0;}
-        fprintf(self->dumper.out,"%.18e", values[i]);
+        fprintf(self->dumper.out,"%g", values[i]);
 
         depth-=2;
-        fprintf(self->dumper.out,"};\n");
+        fprintf(self->dumper.out,"}\n");
         grib_context_free(c,values);
     } else {
         /* int r=compute_bufr_key_rank(h,self->keys,a->name); */
         if( !grib_is_missing_double(a,value) ) {
-            fprintf(self->dumper.out,"set %s->%s = %.18e;\n", prefix, a->name, value);
+            fprintf(self->dumper.out,"%s->%s = %g\n", prefix, a->name, value);
+        } else {
+            fprintf(self->dumper.out,"%s->%s = MISSING\n", prefix, a->name);
         }
     }
 
@@ -286,8 +289,8 @@ static void dump_values_attribute(grib_dumper* d,grib_accessor* a, const char* p
 
 static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
 {
-    grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
-    long value; size_t size = 0;
+    grib_dumper_bufr_simple *self = (grib_dumper_bufr_simple*)d;
+    long value=0; size_t size = 0;
     long *values=NULL;
     int err = 0;
     int i,r,icount;
@@ -296,11 +299,12 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
     grib_context* c=a->context;
     grib_handle* h=grib_handle_of_accessor(a);
 
+    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0  )
+        return;
+
     grib_value_count(a,&count);
     size=count;
 
-    if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0  ) return;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0) {
         if (self->isLeaf==0) {
             char* prefix;
@@ -333,9 +337,9 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
     if (size>1) {
         icount=0;
         if ((r=compute_bufr_key_rank(h,self->keys,a->name))!=0)
-            fprintf(self->dumper.out,"set #%d#%s=",r,a->name);
+            fprintf(self->dumper.out,"#%d#%s=",r,a->name);
         else
-            fprintf(self->dumper.out,"set %s=",a->name);
+            fprintf(self->dumper.out,"%s=",a->name);
 
         fprintf(self->dumper.out,"{");
 
@@ -348,17 +352,19 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
         fprintf(self->dumper.out,"%ld ",values[i]);
 
         depth-=2;
-        fprintf(self->dumper.out,"};\n");
+        fprintf(self->dumper.out,"}\n");
         grib_context_free(a->context,values);
     } else {
         r=compute_bufr_key_rank(h,self->keys,a->name);
-        if( !grib_is_missing_long(a,value) ) {
-            if (r!=0)
-                fprintf(self->dumper.out,"set #%d#%s=",r,a->name);
-            else
-                fprintf(self->dumper.out,"set %s=",a->name);
+        if (r!=0)
+            fprintf(self->dumper.out,"#%d#%s=",r,a->name);
+        else
+            fprintf(self->dumper.out,"%s=",a->name);
 
-            fprintf(self->dumper.out,"%ld;\n",value);
+        if( !grib_is_missing_long(a,value) ) {
+            fprintf(self->dumper.out,"%ld\n",value);
+        } else {
+            fprintf(self->dumper.out,"MISSING\n");
         }
     }
 
@@ -381,21 +387,21 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
 
 static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* prefix)
 {
-    grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
-    long value; size_t size = 0;
+    grib_dumper_bufr_simple *self = (grib_dumper_bufr_simple*)d;
+    long value=0; size_t size = 0;
     long *values=NULL;
     int err = 0;
     int i,icount;
-    int cols=4;
+    int cols=9;
     long count=0;
     grib_context* c=a->context;
 
-    grib_value_count(a,&count);
-    size=count;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(long*)grib_context_malloc_clear(a->context,sizeof(long)*size);
         err=grib_unpack_long(a,values,&size);
@@ -406,7 +412,7 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
     self->empty=0;
 
     if (size>1) {
-        fprintf(self->dumper.out,"set %s->%s = {", prefix, a->name);
+        fprintf(self->dumper.out,"%s->%s = {", prefix, a->name);
         icount=0;
         for (i=0;i<size-1;i++) {
             if (icount>cols || i==0) {fprintf(self->dumper.out,"\n      ");icount=0;}
@@ -416,14 +422,16 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
         if (icount>cols || i==0) {fprintf(self->dumper.out,"\n      ");icount=0;}
         fprintf(self->dumper.out,"%ld ",values[i]);
         depth-=2;
-        fprintf(self->dumper.out,"};\n");
+        fprintf(self->dumper.out,"}\n");
         grib_context_free(a->context,values);
 
     } else {
         /* int r=compute_bufr_key_rank(h,self->keys,a->name); */
         if( !grib_is_missing_long(a,value) ) {
-            fprintf(self->dumper.out,"set %s->%s = ",prefix,a->name);
-            fprintf(self->dumper.out,"%ld ;\n",value);
+            fprintf(self->dumper.out,"%s->%s = ",prefix,a->name);
+            fprintf(self->dumper.out,"%ld\n",value);
+        } else {
+            fprintf(self->dumper.out,"%s->%s = MISSING\n",prefix,a->name);
         }
     }
 
@@ -447,27 +455,30 @@ static void dump_bits(grib_dumper* d, grib_accessor* a, const char* comment)
 
 static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment)
 {
-    grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
-    double value; size_t size = 1;
+    grib_dumper_bufr_simple *self = (grib_dumper_bufr_simple*)d;
+    double value=0; size_t size = 1;
     int r;
     grib_handle* h=grib_handle_of_accessor(a);
     grib_context* c=h->context;
 
-    grib_unpack_double(a,&value,&size);
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
+    grib_unpack_double(a,&value,&size);
+
     self->begin=0;
     self->empty=0;
 
     r=compute_bufr_key_rank(h,self->keys,a->name);
-    if( !grib_is_missing_double(a,value) ) {
-        if (r!=0)
-            fprintf(self->dumper.out,"set #%d#%s=",r,a->name);
-        else
-            fprintf(self->dumper.out,"set %s=",a->name);
+    if (r!=0)
+        fprintf(self->dumper.out,"#%d#%s=",r,a->name);
+    else
+        fprintf(self->dumper.out,"%s=",a->name);
 
-        fprintf(self->dumper.out,"%.18e;\n",value);
+    if( !grib_is_missing_double(a,value) ) {
+        fprintf(self->dumper.out,"%g\n",value);
+    } else {
+        fprintf(self->dumper.out,"MISSING\n");
     }
 
     if (self->isLeaf==0) {
@@ -488,17 +499,15 @@ static void dump_double(grib_dumper* d, grib_accessor* a, const char* comment)
 
 static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comment)
 {
-    grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
+    grib_dumper_bufr_simple *self = (grib_dumper_bufr_simple*)d;
     char **values=NULL;
-    size_t size = 0,i=0;
-    grib_context* c=NULL;
+    size_t size=0, i=0;
+    grib_context* c=a->context;
     int err = 0;
     long count=0;
     int r=0;
     grib_handle* h=grib_handle_of_accessor(a);
 
-    c=a->context;
-
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 || (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY) != 0)
         return;
 
@@ -514,9 +523,9 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm
     if (self->isLeaf==0) {
         depth+=2;
         if ((r=compute_bufr_key_rank(h,self->keys,a->name))!=0)
-            fprintf(self->dumper.out,"set #%d#%s=",r,a->name);
+            fprintf(self->dumper.out,"#%d#%s=",r,a->name);
         else
-            fprintf(self->dumper.out,"set %s=",a->name);
+            fprintf(self->dumper.out,"%s=",a->name);
     }
 
     self->empty=0;
@@ -538,7 +547,7 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm
 
     depth-=2;
 
-    fprintf(self->dumper.out, "};\n");
+    fprintf(self->dumper.out, "}\n");
 
     if (self->isLeaf==0) {
         char* prefix;
@@ -561,12 +570,12 @@ static void dump_string_array(grib_dumper* d, grib_accessor* a, const char* comm
 
 static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment)
 {
-    grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
+    grib_dumper_bufr_simple *self = (grib_dumper_bufr_simple*)d;
     char *value=NULL;
     char *p = NULL;
     size_t size = 0;
     grib_context* c=NULL;
-    int r;
+    int r = 0;
     int err = _grib_get_string_length(a,&size);
     grib_handle* h=grib_handle_of_accessor(a);
 
@@ -597,12 +606,11 @@ static void dump_string(grib_dumper* d, grib_accessor* a, const char* comment)
     if (self->isLeaf==0) {
         depth+=2;
         if (r!=0)
-            fprintf(self->dumper.out,"set #%d#%s=",r,a->name);
+            fprintf(self->dumper.out,"#%d#%s=",r,a->name);
         else
-            fprintf(self->dumper.out,"set %s=",a->name);
+            fprintf(self->dumper.out,"%s=",a->name);
     }
-    fprintf(self->dumper.out,"\"%s\";\n",value);
-
+    fprintf(self->dumper.out,"\"%s\"\n",value);
 
     if (self->isLeaf==0) {
         char* prefix;
@@ -641,21 +649,21 @@ static void _dump_long_array(grib_handle* h, FILE* f, const char* key, const cha
 
     val=(long*)grib_context_malloc_clear(h->context,sizeof(long)*size);
     grib_get_long_array(h,key,val,&size);
-    fprintf(f,"set %s= {",print_key);
+    fprintf(f,"%s= {",print_key);
     for (i=0;i<size-1;i++) {
         if (icount>cols || i==0) {fprintf(f,"\n      ");icount=0;}
         fprintf(f,"%ld, ",val[i]);
         icount++;
     }
     if (icount>cols) {fprintf(f,"\n      ");}
-    fprintf(f,"%ld};\n",val[size-1]);
+    fprintf(f,"%ld}\n",val[size-1]);
 
     grib_context_free(h->context,val);
 }
 
 static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accessors* block)
 {
-    grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
+    grib_dumper_bufr_simple *self = (grib_dumper_bufr_simple*)d;
     if (!grib_inline_strcmp(a->name,"BUFR") ||
             !grib_inline_strcmp(a->name,"GRIB") ||
             !grib_inline_strcmp(a->name,"META")
@@ -687,7 +695,7 @@ static void dump_section(grib_dumper* d, grib_accessor* a, grib_block_of_accesso
 static void dump_attributes(grib_dumper* d,grib_accessor* a, const char* prefix)
 {
     int i=0;
-    grib_dumper_bufr_encode_filter *self = (grib_dumper_bufr_encode_filter*)d;
+    grib_dumper_bufr_simple *self = (grib_dumper_bufr_simple*)d;
     unsigned long flags;
     while (i < MAX_ACCESSOR_ATTRIBUTES && a->attributes[i]) {
         self->isAttribute=1;
diff --git a/src/grib_dumper_class_default.c b/src/grib_dumper_class_default.c
index 2e40333..ccae720 100644
--- a/src/grib_dumper_class_default.c
+++ b/src/grib_dumper_class_default.c
@@ -139,7 +139,7 @@ static void aliases(grib_dumper* d,grib_accessor* a)
 static void dump_long(grib_dumper* d,grib_accessor* a,const char* comment)
 {
     grib_dumper_default *self = (grib_dumper_default*)d;
-    long value; size_t size = 1;
+    long value=0; size_t size = 1;
     long *values=NULL;
     int err = 0;
     int i;
@@ -209,8 +209,8 @@ static void dump_bits(grib_dumper* d,grib_accessor* a,const char* comment)
 {
     grib_dumper_default *self = (grib_dumper_default*)d;
     int i;
-    long lvalue;
-    double dvalue;
+    long lvalue = 0;
+    double dvalue = 0;
     size_t size = 1;
     int err = 0;
     int isDouble=0;
diff --git a/src/grib_dumper_class_json.c b/src/grib_dumper_class_json.c
index c908ef5..5346d75 100644
--- a/src/grib_dumper_class_json.c
+++ b/src/grib_dumper_class_json.c
@@ -124,21 +124,22 @@ static int destroy(grib_dumper* d)
 static void dump_values(grib_dumper* d,grib_accessor* a)
 {
     grib_dumper_json *self = (grib_dumper_json*)d;
-    double value; size_t size = 1;
-    double *values=NULL;
+    double value=0; size_t size = 1;
+    double *values = NULL;
     int err = 0;
     int i;
-    int cols=9;
-    long count=0;
+    int cols = 9;
+    long count = 0;
     double missing_value = GRIB_MISSING_DOUBLE;
-    grib_handle* h=grib_handle_of_accessor(a);
-
-    grib_value_count(a,&count);
-    size=count;
+    grib_handle* h = NULL;
 
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 )
         return;
 
+    h = grib_handle_of_accessor(a);
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(double*)grib_context_malloc_clear(a->context,sizeof(double)*size);
         err=grib_unpack_double(a,values,&size);
@@ -208,19 +209,20 @@ static void dump_values(grib_dumper* d,grib_accessor* a)
 static void dump_long(grib_dumper* d,grib_accessor* a,const char* comment)
 {
     grib_dumper_json *self = (grib_dumper_json*)d;
-    long value; size_t size = 1;
-    long *values=NULL;
+    long value = 0;
+    size_t size = 1;
+    long *values = NULL;
     int err = 0;
     int i;
-    int cols=9;
-    long count=0;
-
-    grib_value_count(a,&count);
-    size=count;
+    int cols = 9;
+    long count = 0;
 
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 )
         return;
 
+    grib_value_count(a,&count);
+    size=count;
+
     if (size>1) {
         values=(long*)grib_context_malloc_clear(a->context,sizeof(long)*size);
         err=grib_unpack_long(a,values,&size);
@@ -291,12 +293,14 @@ static void dump_bits(grib_dumper* d,grib_accessor* a,const char* comment)
 static void dump_double(grib_dumper* d,grib_accessor* a,const char* comment)
 {
     grib_dumper_json *self = (grib_dumper_json*)d;
-    double value; size_t size = 1;
+    double value = 0;
+    size_t size = 1;
 
-    grib_unpack_double(a,&value,&size);
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0)
         return;
 
+    grib_unpack_double(a,&value,&size);
+
     if (self->begin==0 && self->empty==0 && self->isAttribute==0) fprintf(self->dumper.out,",\n");
     else self->begin=0;
 
@@ -330,11 +334,10 @@ static void dump_string_array(grib_dumper* d,grib_accessor* a,const char* commen
 {
     grib_dumper_json *self = (grib_dumper_json*)d;
     char **values = NULL;
-    size_t size = 0,i=0;
-    grib_context* c=NULL;
+    size_t size = 0, i = 0;
+    grib_context* c = NULL;
     int err = 0;
-    long count=0;
-
+    long count = 0;
     c=a->context;
 
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 )
@@ -399,13 +402,13 @@ static void dump_string_array(grib_dumper* d,grib_accessor* a,const char* commen
 static void dump_string(grib_dumper* d,grib_accessor* a,const char* comment)
 {
     grib_dumper_json *self = (grib_dumper_json*)d;
-    char *value=NULL;
+    char *value = NULL;
     char *p = NULL;
     size_t size = 0;
-    grib_context* c=NULL;
+    grib_context* c = NULL;
     int err = _grib_get_string_length(a,&size);
 
-    c=a->context;
+    c = a->context;
     if (size==0) return;
 
     if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0)
@@ -502,7 +505,7 @@ static void dump_attributes(grib_dumper* d,grib_accessor* a)
     grib_dumper_json *self = (grib_dumper_json*)d;
     FILE* out=self->dumper.out;
     unsigned long flags;
-    while (a->attributes[i] && i < MAX_ACCESSOR_ATTRIBUTES) {
+    while (i < MAX_ACCESSOR_ATTRIBUTES && a->attributes[i]) {
         self->isAttribute=1;
         if (  (d->option_flags & GRIB_DUMP_FLAG_ALL_ATTRIBUTES ) == 0
                 && (a->attributes[i]->flags & GRIB_ACCESSOR_FLAG_DUMP)== 0 )
diff --git a/src/grib_dumper_factory.h b/src/grib_dumper_factory.h
index 42d00f5..a7373a9 100644
--- a/src/grib_dumper_factory.h
+++ b/src/grib_dumper_factory.h
@@ -7,6 +7,7 @@
 { "bufr_encode_filter", &grib_dumper_class_bufr_encode_filter, },
 { "bufr_encode_fortran", &grib_dumper_class_bufr_encode_fortran, },
 { "bufr_encode_python", &grib_dumper_class_bufr_encode_python, },
+{ "bufr_simple", &grib_dumper_class_bufr_simple, },
 { "debug", &grib_dumper_class_debug, },
 { "default", &grib_dumper_class_default, },
 { "grib_encode_C", &grib_dumper_class_grib_encode_C, },
diff --git a/src/grib_handle.c b/src/grib_handle.c
index 2661c4a..c16912f 100644
--- a/src/grib_handle.c
+++ b/src/grib_handle.c
@@ -249,7 +249,7 @@ static grib_handle* grib_handle_create ( grib_handle  *gl, grib_context* c, cons
     return gl;
 }
 
-grib_handle* grib_handle_new_from_samples ( grib_context* c, const char* name )
+grib_handle* grib_handle_new_from_samples( grib_context* c, const char* name )
 {
     grib_handle* g = 0;
     if ( c == NULL ) c = grib_context_get_default();
@@ -264,7 +264,7 @@ grib_handle* grib_handle_new_from_samples ( grib_context* c, const char* name )
         printf("ECCODES DEBUG: grib_handle_new_from_samples '%s'\n", name);
     }
 
-    g=grib_external_template ( c,name );
+    g = grib_external_template( c,name );
     if ( !g )
         grib_context_log ( c,GRIB_LOG_ERROR,"Unable to load sample file %s.tmpl\n                    in %s",
                 name, c->grib_samples_path );
diff --git a/src/grib_iarray.c b/src/grib_iarray.c
index c1202f3..6bde2f7 100644
--- a/src/grib_iarray.c
+++ b/src/grib_iarray.c
@@ -16,6 +16,18 @@
 
 #include "grib_api_internal.h"
 
+/* For debugging purposes */
+void grib_iarray_print(const char* title, const grib_iarray* iarray)
+{
+    Assert(iarray);
+    size_t i;
+    printf("%s: iarray.n=%lu  \t", title, (unsigned long)iarray->n);
+    for (i=0; i<iarray->n; i++) {
+        printf("iarray[%lu]=%ld\t", (unsigned long)i, iarray->v[i]);
+    }
+    printf("\n");
+}
+
 grib_iarray* grib_iarray_new_from_array(grib_context* c,long* a,size_t size)
 {
     size_t i;
diff --git a/src/grib_ieeefloat.c b/src/grib_ieeefloat.c
index 38e02a1..cdba4f8 100644
--- a/src/grib_ieeefloat.c
+++ b/src/grib_ieeefloat.c
@@ -206,6 +206,12 @@ double grib_long_to_ieee(unsigned long x)
 
     double val;
 
+#ifdef DEBUG
+    if ( x > 0 && x < 0x800000 ) {
+        fprintf(stderr, "grib_long_to_ieee: Invalid input %ld\n", x);
+        Assert(0);
+    }
+#endif
     init_table_if_needed();
 
     if (c == 0 && m==0) return 0;
diff --git a/src/grib_io.c b/src/grib_io.c
index 7a3dfed..187816d 100644
--- a/src/grib_io.c
+++ b/src/grib_io.c
@@ -107,14 +107,15 @@ static int read_GRIB(reader* r)
     size_t sec3len = 0;
     size_t sec4len = 0;
     unsigned long flags;
-    size_t buflen=16368;
+    size_t buflen = 32768;   /* See ECC-515: was 16368 */
     grib_context* c;
     grib_buffer* buf;
 
     /*TODO proper context*/
     c=grib_context_get_default();
     tmp=(unsigned char*)malloc(buflen);
-    Assert(tmp);
+    if (!tmp)
+        return GRIB_OUT_OF_MEMORY;
     buf=grib_new_buffer(c,tmp,buflen);
     buf->property = GRIB_MY_BUFFER;
 
@@ -267,6 +268,7 @@ static int read_GRIB(reader* r)
                     i++;
                 }
                 /* Read section 2 */
+                GROW_BUF_IF_REQUIRED(i+sec2len);
                 if((r->read(r->read_data,tmp+i,sec2len-3,&err) != sec2len-3) || err)
                     return err;
                 i += sec2len-3;
@@ -592,7 +594,8 @@ static int read_BUFR(reader *r)
     /*TODO proper context*/
     c=grib_context_get_default();
     tmp=(unsigned char*)malloc(buflen);
-    Assert(tmp);
+    if (!tmp)
+        return GRIB_OUT_OF_MEMORY;
     buf=grib_new_buffer(c,tmp,buflen);
     buf->property = GRIB_MY_BUFFER;
     r->offset=r->tell(r->read_data)-4;
@@ -1164,6 +1167,19 @@ static size_t stream_read(void* data,void* buffer,size_t len,int* err)
     return n;
 }
 
+/*================== */
+
+
+static void* allocate_buffer(void *data,size_t* length,int *err)
+{
+    alloc_buffer *u  = (alloc_buffer*)data;
+    u->buffer = malloc(*length);
+    u->size=*length;
+    if(u->buffer == NULL)
+        *err = GRIB_OUT_OF_MEMORY; /* Cannot allocate buffer */
+    return u->buffer;
+}
+
 int wmo_read_any_from_stream(void* stream_data,long (*stream_proc)(void*,void* buffer,long len) ,void* buffer,size_t* len)
 {
     int           err;
@@ -1178,6 +1194,7 @@ int wmo_read_any_from_stream(void* stream_data,long (*stream_proc)(void*,void* b
     u.buffer_size  = *len;
 
     r.message_size    = 0;
+    r.offset          = 0;
     r.read_data       = &s;
     r.read            = &stream_read;
     r.seek            = &stream_seek;
@@ -1193,18 +1210,37 @@ int wmo_read_any_from_stream(void* stream_data,long (*stream_proc)(void*,void* b
     return err;
 }
 
-/*================== */
-
-static void* allocate_buffer(void *data,size_t* length,int *err)
+void* wmo_read_any_from_stream_malloc(void* stream_data,long (*stream_proc)(void*,void* buffer,long len) ,size_t *size, int* err)
 {
-    alloc_buffer *u  = (alloc_buffer*)data;
-    u->buffer = malloc(*length);
-    u->size=*length;
-    if(u->buffer == NULL)
-        *err = GRIB_OUT_OF_MEMORY; /* Cannot allocate buffer */
-    return u->buffer;
+    alloc_buffer u;
+    u.buffer = NULL;
+
+    stream_struct s;
+    reader        r;
+
+    s.stream_data = stream_data;
+    s.stream_proc = stream_proc;
+
+    r.message_size    = 0;
+    r.offset          = 0;
+    r.read_data       = &s;
+    r.read            = &stream_read;
+    r.seek            = &stream_seek;
+    r.seek_from_start = &stream_seek;
+    r.tell            = &stream_tell;
+    r.alloc_data      = &u;
+    r.alloc           = &allocate_buffer;
+    r.headers_only    = 0;
+
+    *err           = read_any(&r, 1, 1, 1, 1);
+    *size          = r.message_size;
+
+    return u.buffer;
 }
 
+/*================== */
+
+
 void *wmo_read_gts_from_file_malloc(FILE* f,int headers_only,size_t *size,off_t *offset,int* err)
 {
     alloc_buffer u;
@@ -1528,5 +1564,19 @@ int grib_count_in_file(grib_context* c, FILE* f,int* n)
     rewind(f);
 
     return err==GRIB_END_OF_FILE ? 0 : err;
+}
 
+int grib_count_in_filename(grib_context* c, const char* filename, int* n)
+{
+    int err=0;
+    if (!c) c=grib_context_get_default();
+    FILE* fp = fopen(filename, "r");
+    if (!fp) {
+        grib_context_log(c, GRIB_LOG_ERROR,"grib_count_in_filename: Unable to read file \"%s\"", filename);
+        perror(filename);
+        return GRIB_IO_PROBLEM;
+    }
+    err = grib_count_in_file(c, fp, n);
+    fclose(fp);
+    return err;
 }
diff --git a/src/grib_iterator_class_gen.c b/src/grib_iterator_class_gen.c
index 8b5495a..81f13da 100644
--- a/src/grib_iterator_class_gen.c
+++ b/src/grib_iterator_class_gen.c
@@ -38,10 +38,10 @@ or edit "iterator.class" and rerun ./make_class.pl
 
 static void init_class              (grib_iterator_class*);
 
-static int init               (grib_iterator* i,grib_handle*,grib_arguments*);
+static int init               (grib_iterator* iter,grib_handle*,grib_arguments*);
 static int destroy            (grib_iterator* i);
-static int reset              (grib_iterator* i);
-static long has_next          (grib_iterator* i);
+static int reset              (grib_iterator* iter);
+static long has_next          (grib_iterator* iter);
 
 
 typedef struct grib_iterator_gen{
@@ -74,59 +74,143 @@ static void init_class(grib_iterator_class* c)
 }
 /* END_CLASS_IMP */
 
-static int init(grib_iterator* i,grib_handle *h, grib_arguments* args)
+/*
+ * Return pointer to data at (i,j) (Fortran convention)
+ */
+static double* pointer_to_data(unsigned int i, unsigned int j,
+        long iScansNegatively, long jScansPositively, long jPointsAreConsecutive, long alternativeRowScanning,
+        unsigned int nx, unsigned int ny, double *data)
+{
+    /* Regular grid */
+    if (nx > 0 && ny > 0) {
+        if (i >= nx || j >= ny) return NULL;
+        j = (jScansPositively) ? j : ny - 1 - j;
+        i = ((alternativeRowScanning) && (j % 2 == 1)) ?  nx - 1 - i : i;
+        i = (iScansNegatively) ? nx - 1 - i : i;
+
+        return (jPointsAreConsecutive) ?  data + j + i*ny : data + i + nx*j;
+    }
+
+    /* Reduced or other data not on a grid */
+    return NULL;
+}
+
+/* Apply the scanning mode flags which may require data array to be transformed */
+/* to standard west-to-east south-to-north mode */
+int transform_iterator_data(grib_handle* h, double* data,
+        long iScansNegatively, long jScansPositively, long jPointsAreConsecutive, long alternativeRowScanning,
+        size_t numPoints, long nx, long ny)
+{
+    double* data2;
+    double *pData0, *pData1, *pData2;
+    unsigned long ix, iy;
+
+    if ( !iScansNegatively && jScansPositively && !jPointsAreConsecutive && !alternativeRowScanning )
+    {
+        /* Already +i and +j. No need to change */
+        return GRIB_SUCCESS;
+    }
+
+    if ( !iScansNegatively && !jScansPositively && !jPointsAreConsecutive && !alternativeRowScanning &&
+         nx > 0 && ny > 0)
+    {
+        /* regular grid +i -j: convert from we:ns to we:sn */
+        size_t row_size = ((size_t) nx) * sizeof(double);
+        data2 = (double*)grib_context_malloc(h->context, row_size);
+        if (!data2) {
+            grib_context_log(h->context,GRIB_LOG_ERROR, "Unable to allocate %ld bytes", row_size);
+            return GRIB_OUT_OF_MEMORY;
+        }
+        for (iy = 0; iy < ny/2; iy++) {
+            memcpy(data2, data + ((size_t) iy) * nx, row_size);
+            memcpy(data + iy*nx, data + (ny-1-iy) * ((size_t) nx), row_size);
+            memcpy(data + (ny-1-iy) * ((size_t) nx), data2, row_size);
+        }
+        grib_context_free(h->context, data2);
+        return GRIB_SUCCESS;
+    }
+
+    if (nx < 1 || ny < 1) {
+        grib_context_log(h->context,GRIB_LOG_ERROR, "Invalid values for Nx and/or Ny");
+        return GRIB_GEOCALCULUS_PROBLEM;
+    }
+    data2 = (double*)grib_context_malloc(h->context, numPoints*sizeof(double));
+    if (!data2) {
+        grib_context_log(h->context,GRIB_LOG_ERROR, "Unable to allocate %ld bytes",numPoints*sizeof(double));
+        return GRIB_OUT_OF_MEMORY;
+    }
+    pData0 = data2;
+    for (iy = 0; iy < ny; iy++) {
+        long deltaX = 0;
+        pData1 = pointer_to_data(0, iy, iScansNegatively, jScansPositively, jPointsAreConsecutive, alternativeRowScanning, nx,ny, data);
+        if (!pData1) return GRIB_GEOCALCULUS_PROBLEM;
+        pData2 = pointer_to_data(1, iy, iScansNegatively, jScansPositively, jPointsAreConsecutive, alternativeRowScanning, nx,ny, data);
+        if (!pData2) return GRIB_GEOCALCULUS_PROBLEM;
+        deltaX = pData2 - pData1;
+        for (ix = 0; ix < nx; ix++) {
+            *pData0++ = *pData1;
+            pData1 += deltaX;
+        }
+    }
+    memcpy(data, data2, ((size_t)numPoints) * sizeof(double));
+    grib_context_free(h->context, data2);
+
+    return GRIB_SUCCESS;
+}
+
+static int init(grib_iterator* iter, grib_handle *h, grib_arguments* args)
 {
-    grib_iterator_gen* self = (grib_iterator_gen*) i;
+    grib_iterator_gen* self = (grib_iterator_gen*) iter;
     size_t dli=0;
-    int ret = GRIB_SUCCESS;
-    const char* rawdat  = NULL;
-    const char* snumberOfPoints=NULL;
+    int err = GRIB_SUCCESS;
+    const char* s_rawData  = NULL;
+    const char* s_numPoints=NULL;
     long numberOfPoints=0;
     self->carg = 1;
 
-    snumberOfPoints = grib_arguments_get_name(h,args,self->carg++);
+    s_numPoints = grib_arguments_get_name(h,args,self->carg++);
     self->missingValue  = grib_arguments_get_name(h,args,self->carg++);
-    rawdat      = grib_arguments_get_name(h,args,self->carg++);
+    s_rawData      = grib_arguments_get_name(h,args,self->carg++);
 
-    i->h    = h; /* We may not need to keep them */
-    i->args = args;
-    if( (ret =  grib_get_size(h,rawdat,&dli))!= GRIB_SUCCESS) return ret;
+    iter->h    = h; /* We may not need to keep them */
+    iter->args = args;
+    if( (err =  grib_get_size(h,s_rawData,&dli))!= GRIB_SUCCESS) return err;
 
-    if( (ret =  grib_get_long_internal(h,snumberOfPoints,&numberOfPoints))
+    if( (err =  grib_get_long_internal(h,s_numPoints,&numberOfPoints))
             != GRIB_SUCCESS)
-        return ret;
+        return err;
 
     if (numberOfPoints!=dli) {
         grib_context_log(h->context,GRIB_LOG_ERROR,"%s != size(%s) (%ld!=%ld)",
-                snumberOfPoints,rawdat,numberOfPoints,dli);
+                s_numPoints,s_rawData,numberOfPoints,dli);
         return GRIB_WRONG_GRID;
     }
-    i->nv = dli;
-    i->data = (double*)grib_context_malloc(h->context,(i->nv)*sizeof(double));
+    iter->nv = dli;
+    iter->data = (double*)grib_context_malloc(h->context,(iter->nv)*sizeof(double));
 
-    if( (ret = grib_get_double_array_internal(h,rawdat,i->data ,&(i->nv))))
-        return ret;
+    if( (err = grib_get_double_array_internal(h,s_rawData,iter->data ,&(iter->nv))))
+        return err;
 
-    i->e = -1;
+    iter->e = -1;
 
-    return ret;
+    return err;
 }
 
-static int reset(grib_iterator* i)
+static int reset(grib_iterator* iter)
 {
-    i->e = -1;
+    iter->e = -1;
     return 0;
 }
 
-static int destroy(grib_iterator* ei)
+static int destroy(grib_iterator* iter)
 {
-    const grib_context *c = ei->h->context;
-    grib_context_free(c,ei->data);
+    const grib_context *c = iter->h->context;
+    grib_context_free(c, iter->data);
     return 1;
 }
 
-static long has_next(grib_iterator* i)
+static long has_next(grib_iterator* iter)
 {
-    if(i->data == NULL) return 0;
-    return   i->nv - i->e;
+    if(iter->data == NULL) return 0;
+    return   iter->nv - iter->e;
 }
diff --git a/src/grib_iterator_class_lambert_conformal.c b/src/grib_iterator_class_lambert_conformal.c
index 7ebde39..6e3df82 100644
--- a/src/grib_iterator_class_lambert_conformal.c
+++ b/src/grib_iterator_class_lambert_conformal.c
@@ -83,17 +83,17 @@ static void init_class(grib_iterator_class* c)
 
 static int next(grib_iterator* i, double *lat, double *lon, double *val)
 {
-	grib_iterator_lambert_conformal* self = (grib_iterator_lambert_conformal*)i;
+    grib_iterator_lambert_conformal* self = (grib_iterator_lambert_conformal*)i;
 
-	if((long)i->e >= (long)(i->nv-1))
-		return 0;
-	i->e++;
+    if((long)i->e >= (long)(i->nv-1))
+        return 0;
+    i->e++;
 
-	*lat = self->lats[i->e];
-	*lon = self->lons[i->e];
-	*val = i->data[i->e];
+    *lat = self->lats[i->e];
+    *lon = self->lons[i->e];
+    *val = i->data[i->e];
 
-	return 1;
+    return 1;
 }
 
 #ifndef M_PI
@@ -111,9 +111,9 @@ static int next(grib_iterator* i, double *lat, double *lon, double *val)
 #define RAD2DEG   57.29577951308232087684  /* 180 over pi */
 #define DEG2RAD   0.01745329251994329576   /* pi over 180 */
 
-static int init(grib_iterator* iter,grib_handle* h,grib_arguments* args)
+static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
 {
-    int i, j, ret=0;
+    int i, j, err=0;
     double *lats, *lons; /* the lat/lon arrays to be populated */
     long nx,ny,iScansNegatively,jScansPositively,jPointsAreConsecutive,alternativeRowScanning;
     double LoVInDegrees,LaDInDegrees,Latin1InDegrees,Latin2InDegrees,latFirstInDegrees,
@@ -141,41 +141,41 @@ static int init(grib_iterator* iter,grib_handle* h,grib_arguments* args)
     const char* sjPointsAreConsecutive   = grib_arguments_get_name(h,args,self->carg++);
     const char* salternativeRowScanning  = grib_arguments_get_name(h,args,self->carg++);
 
-    if((ret = grib_get_long_internal(h, snx,&nx)) != GRIB_SUCCESS)
-        return ret;
-    if((ret = grib_get_long_internal(h, sny,&ny)) != GRIB_SUCCESS)
-        return ret;
+    if((err = grib_get_long_internal(h, snx,&nx)) != GRIB_SUCCESS)
+        return err;
+    if((err = grib_get_long_internal(h, sny,&ny)) != GRIB_SUCCESS)
+        return err;
 
     if (iter->nv!=nx*ny) {
         grib_context_log(h->context,GRIB_LOG_ERROR,"Wrong number of points (%ld!=%ldx%ld)",iter->nv,nx,ny);
         return GRIB_WRONG_GRID;
     }
-    if((ret = grib_get_double_internal(h, sradius,&radius)) != GRIB_SUCCESS)
-        return ret;
-    if((ret = grib_get_double_internal(h, sLoVInDegrees, &LoVInDegrees))!=GRIB_SUCCESS)
-        return ret;
-    if((ret = grib_get_double_internal(h, sLaDInDegrees, &LaDInDegrees))!=GRIB_SUCCESS)
-        return ret;
-    if((ret = grib_get_double_internal(h, sLatin1InDegrees, &Latin1InDegrees))!=GRIB_SUCCESS)
-        return ret;
-    if((ret = grib_get_double_internal(h, sLatin2InDegrees, &Latin2InDegrees))!=GRIB_SUCCESS)
-        return ret;
-    if((ret = grib_get_double_internal(h, slatFirstInDegrees,&latFirstInDegrees)) !=GRIB_SUCCESS)
-        return ret;
-    if((ret = grib_get_double_internal(h, slonFirstInDegrees,&lonFirstInDegrees)) !=GRIB_SUCCESS)
-        return ret;
-    if((ret = grib_get_double_internal(h, sDx,&Dx)) !=GRIB_SUCCESS)
-        return ret;
-    if((ret = grib_get_double_internal(h, sDy,&Dy)) !=GRIB_SUCCESS)
-        return ret;
-    if((ret = grib_get_long_internal(h, sjPointsAreConsecutive,&jPointsAreConsecutive)) !=GRIB_SUCCESS)
-        return ret;
-    if((ret = grib_get_long_internal(h, sjScansPositively,&jScansPositively)) !=GRIB_SUCCESS)
-        return ret;
-    if((ret = grib_get_long_internal(h, siScansNegatively,&iScansNegatively)) !=GRIB_SUCCESS)
-        return ret;
-    if((ret = grib_get_long_internal(h, salternativeRowScanning,&alternativeRowScanning)) !=GRIB_SUCCESS)
-        return ret;
+    if((err = grib_get_double_internal(h, sradius,&radius)) != GRIB_SUCCESS)
+        return err;
+    if((err = grib_get_double_internal(h, sLoVInDegrees, &LoVInDegrees))!=GRIB_SUCCESS)
+        return err;
+    if((err = grib_get_double_internal(h, sLaDInDegrees, &LaDInDegrees))!=GRIB_SUCCESS)
+        return err;
+    if((err = grib_get_double_internal(h, sLatin1InDegrees, &Latin1InDegrees))!=GRIB_SUCCESS)
+        return err;
+    if((err = grib_get_double_internal(h, sLatin2InDegrees, &Latin2InDegrees))!=GRIB_SUCCESS)
+        return err;
+    if((err = grib_get_double_internal(h, slatFirstInDegrees,&latFirstInDegrees)) !=GRIB_SUCCESS)
+        return err;
+    if((err = grib_get_double_internal(h, slonFirstInDegrees,&lonFirstInDegrees)) !=GRIB_SUCCESS)
+        return err;
+    if((err = grib_get_double_internal(h, sDx,&Dx)) !=GRIB_SUCCESS)
+        return err;
+    if((err = grib_get_double_internal(h, sDy,&Dy)) !=GRIB_SUCCESS)
+        return err;
+    if((err = grib_get_long_internal(h, sjPointsAreConsecutive,&jPointsAreConsecutive)) !=GRIB_SUCCESS)
+        return err;
+    if((err = grib_get_long_internal(h, sjScansPositively,&jScansPositively)) !=GRIB_SUCCESS)
+        return err;
+    if((err = grib_get_long_internal(h, siScansNegatively,&iScansNegatively)) !=GRIB_SUCCESS)
+        return err;
+    if((err = grib_get_long_internal(h, salternativeRowScanning,&alternativeRowScanning)) !=GRIB_SUCCESS)
+        return err;
 
     /* See Wolfram MathWorld: http://mathworld.wolfram.com/LambertConformalConicProjection.html */
     latFirstInRadians = latFirstInDegrees * DEG2RAD;
@@ -206,25 +206,19 @@ static int init(grib_iterator* iter,grib_handle* h,grib_arguments* args)
     angle = n * lonDiff;
     x0 = rho * sin(angle);
     y0 = rho0 - rho * cos(angle);
-    Dx = iScansNegatively == 0 ? Dx : -Dx;
+    /*Dx = iScansNegatively == 0 ? Dx : -Dx;*/
     /* GRIB-405: Don't change sign of Dy. Latitudes ALWAYS increase from latitudeOfFirstGridPoint */
     /*Dy = jScansPositively == 1 ? Dy : -Dy;*/
 
-    /* No support (yet) for jPointsAreConsecutive */
-    if (jPointsAreConsecutive) {
-        grib_context_log(h->context,GRIB_LOG_ERROR,"No support for: 'Adjacent points in j (y) direction being consecutive'");
-        Assert(0);
-    }
-
     /* Allocate latitude and longitude arrays */
     self->lats = (double*)grib_context_malloc(h->context,iter->nv*sizeof(double));
     if (!self->lats) {
-        grib_context_log(h->context,GRIB_LOG_ERROR,	"unable to allocate %ld bytes",iter->nv*sizeof(double));
+        grib_context_log(h->context,GRIB_LOG_ERROR, "Unable to allocate %ld bytes",iter->nv*sizeof(double));
         return GRIB_OUT_OF_MEMORY;
     }
     self->lons = (double*)grib_context_malloc(h->context,iter->nv*sizeof(double));
     if (!self->lats) {
-        grib_context_log(h->context,GRIB_LOG_ERROR,	"unable to allocate %ld bytes",iter->nv*sizeof(double));
+        grib_context_log(h->context,GRIB_LOG_ERROR, "Unable to allocate %ld bytes",iter->nv*sizeof(double));
         return GRIB_OUT_OF_MEMORY;
     }
     lats=self->lats;
@@ -245,7 +239,7 @@ static int init(grib_iterator* iter,grib_handle* h,grib_arguments* args)
                 x = -x;
             }
 
-            angle = atan(x / tmp);
+            angle = atan2(x, tmp); /* See ECC-524 */
             rho = sqrt(x*x + tmp2);
             if (n <= 0) rho = -rho;
             lonDeg = LoVInDegrees + (angle/n) * RAD2DEG;
@@ -254,12 +248,19 @@ static int init(grib_iterator* iter,grib_handle* h,grib_arguments* args)
             while ( lonDeg < 0.0)    lonDeg += 360.0;
             lons[index] = lonDeg;
             lats[index] = latDeg;
+            /*printf("DBK: llat[%d] = %g \t llon[%d] = %g\n", index,lats[index], index,lons[index]);*/
         }
     }
 
     iter->e = -1;
 
-    return ret;
+    /* Apply the scanning mode flags which may require data array to be transformed */
+    err = transform_iterator_data(h, iter->data,
+            iScansNegatively, jScansPositively, jPointsAreConsecutive, alternativeRowScanning,
+            iter->nv, nx, ny);
+    if (err) return err;
+
+    return err;
 }
 
 static int destroy(grib_iterator* i)
diff --git a/src/grib_iterator_class_latlon.c b/src/grib_iterator_class_latlon.c
index 3cc9baf..72de61e 100644
--- a/src/grib_iterator_class_latlon.c
+++ b/src/grib_iterator_class_latlon.c
@@ -34,8 +34,8 @@ or edit "iterator.class" and rerun ./make_class.pl
 
 static void init_class              (grib_iterator_class*);
 
-static int init               (grib_iterator* i,grib_handle*,grib_arguments*);
-static int next               (grib_iterator* i, double *lat, double *lon, double *val);
+static int init               (grib_iterator* iter,grib_handle*,grib_arguments*);
+static int next               (grib_iterator* iter, double *lat, double *lon, double *val);
 
 
 typedef struct grib_iterator_latlon{
@@ -48,11 +48,12 @@ typedef struct grib_iterator_latlon{
 	double   *los;
 	long      nap;
 	long      nam;
-	long iScansNegatively;
-	long isRotated;
-	double angleOfRotation;
-	double southPoleLat;
-	double southPoleLon;
+	long      iScansNegatively;
+	long      isRotated;
+	double    angleOfRotation;
+	double    southPoleLat;
+	double    southPoleLon;
+	long      jPointsAreConsecutive;
 /* Members defined in latlon */
 } grib_iterator_latlon;
 
@@ -142,25 +143,35 @@ void unrotate(grib_handle* h,
     *outlon = ret_lon;
 }
 
-static int next(grib_iterator* i, double *lat, double *lon, double *val)
+static int next(grib_iterator* iter, double *lat, double *lon, double *val)
 {
     /* GRIB-238: Support rotated lat/lon grids */
-
     double ret_lat, ret_lon, ret_val;
-    grib_iterator_latlon* self = (grib_iterator_latlon*)i;
+    grib_iterator_latlon* self = (grib_iterator_latlon*)iter;
 
-    if((long)i->e >= (long)(i->nv-1))  return 0;
+    if((long)iter->e >= (long)(iter->nv-1))  return 0;
 
-    i->e++;
+    iter->e++;
 
-    ret_lat = self->las[(long)floor(i->e/self->nap)];
-    ret_lon = self->los[(long)i->e%self->nap];
-    ret_val = i->data[i->e];
+    /* Assumptions:
+     *   All rows scan in the same direction (alternativeRowScanning==0)
+     */
+    if (!self->jPointsAreConsecutive) {
+        /* Adjacent points in i (x) direction are consecutive */
+        ret_lat = self->las[(long)floor(iter->e/self->nap)];
+        ret_lon = self->los[(long)iter->e%self->nap];
+        ret_val = iter->data[iter->e];
+    } else {
+        /* Adjacent points in j (y) direction is consecutive */
+        ret_lon = self->los[(long)iter->e/self->nam];
+        ret_lat = self->las[(long)floor(iter->e%self->nam)];
+        ret_val = iter->data[iter->e];
+    }
 
     if (self->isRotated)
     {
         double new_lat = 0, new_lon = 0;
-        unrotate(i->h, ret_lat, ret_lon,
+        unrotate(iter->h, ret_lat, ret_lon,
                 self->angleOfRotation, self->southPoleLat, self->southPoleLon,
                 &new_lat, &new_lon);
         ret_lat = new_lat;
@@ -173,42 +184,43 @@ static int next(grib_iterator* i, double *lat, double *lon, double *val)
     return 1;
 }
 
-static int init(grib_iterator* i,grib_handle* h,grib_arguments* args)
+static int init(grib_iterator* iter, grib_handle* h,grib_arguments* args)
 {
-    grib_iterator_latlon* self = (grib_iterator_latlon*)i;
-    int ret = GRIB_SUCCESS;
+    grib_iterator_latlon* self = (grib_iterator_latlon*)iter;
+    int err = 0;
     double jdir;
-    double laf;
+    double lat1;
     long jScansPositively;
     long lai;
 
-    const char* latofirst   = grib_arguments_get_name(h,args,self->carg++);
-    const char* jdirec      = grib_arguments_get_name(h,args,self->carg++);
-    const char* s_jScansPositively   = grib_arguments_get_name(h,args,self->carg++);
+    const char* s_lat1      = grib_arguments_get_name(h,args,self->carg++);
+    const char* s_jdir      = grib_arguments_get_name(h,args,self->carg++);
+    const char* s_jScansPos = grib_arguments_get_name(h,args,self->carg++);
+    const char* s_jPtsConsec = grib_arguments_get_name(h,args,self->carg++);
     self->angleOfRotation = 0;
     self->isRotated = 0;
     self->southPoleLat = 0;
     self->southPoleLon = 0;
 
-    if ((ret = grib_get_long(h, "is_rotated_grid", &self->isRotated))) return ret;
+    if ((err = grib_get_long(h, "is_rotated_grid", &self->isRotated))) return err;
     if (self->isRotated) {
-        if ((ret = grib_get_double_internal(h,"angleOfRotation",                  &self->angleOfRotation))) return ret;
-        if ((ret = grib_get_double_internal(h,"latitudeOfSouthernPoleInDegrees",  &self->southPoleLat))) return ret;
-        if ((ret = grib_get_double_internal(h,"longitudeOfSouthernPoleInDegrees", &self->southPoleLon))) return ret;
+        if ((err = grib_get_double_internal(h,"angleOfRotation",                  &self->angleOfRotation))) return err;
+        if ((err = grib_get_double_internal(h,"latitudeOfSouthernPoleInDegrees",  &self->southPoleLat))) return err;
+        if ((err = grib_get_double_internal(h,"longitudeOfSouthernPoleInDegrees", &self->southPoleLon))) return err;
     }
 
-    if((ret = grib_get_double_internal(h,latofirst,     &laf))) return ret;
-    if((ret = grib_get_double_internal(h,jdirec,        &jdir))) return ret;
-    if((ret = grib_get_long_internal(h,s_jScansPositively,&jScansPositively)))
-        return ret;
+    if((err = grib_get_double_internal(h, s_lat1,  &lat1))) return err;
+    if((err = grib_get_double_internal(h, s_jdir,  &jdir))) return err;
+    if((err = grib_get_long_internal(h, s_jScansPos,  &jScansPositively))) return err;
+    if((err = grib_get_long_internal(h, s_jPtsConsec, &self->jPointsAreConsecutive))) return err;
 
     if (jScansPositively) jdir=-jdir;
 
     for( lai = 0; lai <  self->nam; lai++ )  {
-        self->las[lai] = laf;
-        laf -= jdir ;
+        self->las[lai] = lat1;
+        lat1 -= jdir ;
     }
 
-    i->e = -1;
-    return ret;
+    iter->e = -1;
+    return err;
 }
diff --git a/src/grib_iterator_class_polar_stereographic.c b/src/grib_iterator_class_polar_stereographic.c
index e9e3955..702d4c5 100644
--- a/src/grib_iterator_class_polar_stereographic.c
+++ b/src/grib_iterator_class_polar_stereographic.c
@@ -96,22 +96,39 @@ static int next(grib_iterator* i, double *lat, double *lon, double *val)
     return 1;
 }
 
-#define RAD2DEG   57.29577951308232087684  /* 180 over pi */
-#define DEG2RAD   0.01745329251994329576   /* pi over 180 */
+/* Data struct for Forward and Inverse Projections */
+typedef struct proj_data_t {
+    double centre_lon;  /* central longitude */
+    double centre_lat;  /* central latitude */
+    double sign;        /* sign variable */
+    double ind;         /* flag variable */
+    double mcs;         /* small m */
+    double tcs;         /* small t */
+    double false_northing; /* y offset in meters */
+    double false_easting;  /* x offset in meters */
+} proj_data_t;
+
+#define RAD2DEG    57.29577951308232087684  /* 180 over pi */
+#define DEG2RAD    0.01745329251994329576   /* pi over 180 */
+#define PI_OVER_2  1.5707963267948966       /* half pi */
+#define EPSILON    1.0e-10
 
 static int init(grib_iterator* iter,grib_handle* h,grib_arguments* args)
 {
     int ret=0;
-    double *lats,*lons;
-    double lonFirstInDegrees,latFirstInDegrees,lonFirst,latFirst,radius=0;
-    long nx,ny,standardParallel,centralLongitude;
-    double lambda0,xFirst,yFirst,x,y,Dx,Dy;
-    double k,sinphi1,cosphi1;
-    long alternativeRowScanning,iScansNegatively;
-    long jScansPositively,jPointsAreConsecutive, southPoleOnPlane;
-    double sinphi,cosphi,cosdlambda,sindlambda;
-    double cosc,sinc;
-    long i,j;
+    double *lats, *lons; /* arrays for latitudes and longitudes */
+    double lonFirstInDegrees, latFirstInDegrees, radius;
+    double x, y, Dx, Dy;
+    long nx, ny, centralLongitudeInDegrees, centralLatitudeInDegrees;
+    long alternativeRowScanning, iScansNegatively, i, j;
+    long jScansPositively, jPointsAreConsecutive, southPoleOnPlane;
+    double centralLongitude, centralLatitude; /* in radians */
+    double con1;         /* temporary angle */
+    double ts;           /* value of small t */
+    double height;       /* height above ellipsoid */
+    double x0, y0, lonFirst, latFirst;
+    proj_data_t fwd_proj_data = {0,};
+    proj_data_t inv_proj_data = {0,};
 
     grib_iterator_polar_stereographic* self = (grib_iterator_polar_stereographic*)iter;
 
@@ -122,21 +139,17 @@ static int init(grib_iterator* iter,grib_handle* h,grib_arguments* args)
     const char* slonFirstInDegrees      = grib_arguments_get_name(h,args,self->carg++);
     const char* ssouthPoleOnPlane       = grib_arguments_get_name(h,args,self->carg++);
     const char* scentralLongitude       = grib_arguments_get_name(h,args,self->carg++);
+    const char* scentralLatitude        = grib_arguments_get_name(h,args,self->carg++);
     const char* sDx                     = grib_arguments_get_name(h,args,self->carg++);
     const char* sDy                     = grib_arguments_get_name(h,args,self->carg++);
     const char* siScansNegatively       = grib_arguments_get_name(h,args,self->carg++);
     const char* sjScansPositively       = grib_arguments_get_name(h,args,self->carg++);
     const char* sjPointsAreConsecutive  = grib_arguments_get_name(h,args,self->carg++);
     const char* salternativeRowScanning = grib_arguments_get_name(h,args,self->carg++);
-    double c,rho;
-    sinphi1 = cosphi1 = 0.0;
 
-    if((ret = grib_get_double_internal(h, sradius,&radius)) != GRIB_SUCCESS)
-        return ret;
-    if((ret = grib_get_long_internal(h, snx,&nx)) != GRIB_SUCCESS)
-        return ret;
-    if((ret = grib_get_long_internal(h, sny,&ny)) != GRIB_SUCCESS)
-        return ret;
+    if((ret = grib_get_double_internal(h, sradius,&radius)) != GRIB_SUCCESS) return ret;
+    if((ret = grib_get_long_internal(h, snx,&nx)) != GRIB_SUCCESS) return ret;
+    if((ret = grib_get_long_internal(h, sny,&ny)) != GRIB_SUCCESS) return ret;
 
     if (iter->nv!=nx*ny) {
         grib_context_log(h->context,GRIB_LOG_ERROR, "Wrong number of points (%ld!=%ldx%ld)", iter->nv,nx,ny);
@@ -148,7 +161,9 @@ static int init(grib_iterator* iter,grib_handle* h,grib_arguments* args)
         return ret;
     if((ret = grib_get_long_internal(h, ssouthPoleOnPlane,&southPoleOnPlane)) != GRIB_SUCCESS)
         return ret;
-    if((ret = grib_get_long_internal(h, scentralLongitude,&centralLongitude)) != GRIB_SUCCESS)
+    if((ret = grib_get_long_internal(h, scentralLongitude,&centralLongitudeInDegrees)) != GRIB_SUCCESS)
+        return ret;
+    if((ret = grib_get_long_internal(h, scentralLatitude,&centralLatitudeInDegrees)) != GRIB_SUCCESS)
         return ret;
     if((ret = grib_get_double_internal(h, sDx,&Dx)) != GRIB_SUCCESS)
         return ret;
@@ -163,15 +178,54 @@ static int init(grib_iterator* iter,grib_handle* h,grib_arguments* args)
     if((ret = grib_get_long_internal(h, salternativeRowScanning,&alternativeRowScanning)) != GRIB_SUCCESS)
         return ret;
 
-    standardParallel = (southPoleOnPlane == 1) ? -90 : +90;
-    sinphi1 = sin(standardParallel*DEG2RAD);
-    cosphi1 = cos(standardParallel*DEG2RAD);
-    lambda0 = centralLongitude*DEG2RAD;
-    latFirst= latFirstInDegrees*DEG2RAD;
-    lonFirst= lonFirstInDegrees*DEG2RAD;
+    centralLongitude = centralLongitudeInDegrees * DEG2RAD;
+    centralLatitude = centralLatitudeInDegrees * DEG2RAD;
+    lonFirst        = lonFirstInDegrees * DEG2RAD;
+    latFirst        = latFirstInDegrees*DEG2RAD;
+
+    /* Forward projection initialisation */
+    fwd_proj_data.false_northing = 0;
+    fwd_proj_data.false_easting = 0;
+    fwd_proj_data.centre_lon = centralLongitude;
+    fwd_proj_data.centre_lat = centralLatitude;
+    if (centralLatitude < 0) fwd_proj_data.sign = -1.0;
+    else                     fwd_proj_data.sign = +1.0;
+    fwd_proj_data.ind = 0;
+    if (fabs(fabs(centralLatitude) - PI_OVER_2) > EPSILON) {
+        /* central latitude different from 90 i.e. not north/south polar */
+        fwd_proj_data.ind = 1;
+        con1 = fwd_proj_data.sign * centralLatitude;
+        fwd_proj_data.mcs = cos(con1);
+        fwd_proj_data.tcs = tan(0.5 * (PI_OVER_2 - con1));
+    }
 
-    Dx = iScansNegatively == 0 ? Dx : -Dx;
-    Dy = jScansPositively == 1 ? Dy : -Dy;
+    /* Forward projection from initial lat,lon to initial x,y */
+    con1 = fwd_proj_data.sign * (lonFirst - fwd_proj_data.centre_lon);
+    ts = tan(0.5 * (PI_OVER_2 - fwd_proj_data.sign * latFirst));
+    if (fwd_proj_data.ind)
+        height = radius * fwd_proj_data.mcs * ts / fwd_proj_data.tcs;
+    else
+        height = 2.0 * radius * ts;
+    x0 = fwd_proj_data.sign * height * sin(con1) + fwd_proj_data.false_easting;
+    y0 = -fwd_proj_data.sign * height * cos(con1) + fwd_proj_data.false_northing;
+    
+    x0 = -x0;
+    y0 = -y0;
+
+    /* Inverse projection initialisation */
+    inv_proj_data.false_easting = x0;
+    inv_proj_data.false_northing= y0;
+    inv_proj_data.centre_lon = centralLongitude;
+    inv_proj_data.centre_lat = centralLatitude;
+    if (centralLatitude < 0) inv_proj_data.sign = -1.0;
+    else           inv_proj_data.sign = +1.0;
+    inv_proj_data.ind = 0;
+    if (fabs(fabs(centralLatitude) - PI_OVER_2) > EPSILON) {
+        inv_proj_data.ind = 1;
+        con1 = inv_proj_data.sign * inv_proj_data.centre_lat;
+        inv_proj_data.mcs = cos(con1);
+        inv_proj_data.tcs = tan(0.5 * (PI_OVER_2 - con1));
+    }
     self->lats = (double*)grib_context_malloc(h->context,iter->nv*sizeof(double));
     if (!self->lats) {
         grib_context_log(h->context,GRIB_LOG_ERROR, "unable to allocate %ld bytes",iter->nv*sizeof(double));
@@ -184,21 +238,42 @@ static int init(grib_iterator* iter,grib_handle* h,grib_arguments* args)
     }
     lats=self->lats;
     lons=self->lons;
+    Dx = iScansNegatively == 0 ? Dx : -Dx;
+    Dy = jScansPositively == 1 ? Dy : -Dy;
 
-    /* compute xFirst,yFirst in metres */
-    sinphi=sin(latFirst);
-    cosphi=cos(latFirst);
-    cosdlambda=cos(lonFirst-lambda0);
-    sindlambda=sin(lonFirst-lambda0);
-
-    k = 2.0 * radius / ( 1 + sinphi1*sinphi + cosphi1*cosphi*cosdlambda );
-    xFirst = k * cosphi * sindlambda;
-    yFirst = k * (cosphi1*sinphi - sinphi1*cosphi*cosdlambda);
-
-    /*kp=radius*2.0*tan(pi4-phi/2);
-    xFirst=kp*cosphi*sindlambda;
-    yFirst=-kp*cosphi*cosdlambda;*/
-
+    y = 0;
+    for (j=0;j<ny;j++) {
+        x = 0;
+        for (i=0;i<nx;i++) {
+            /* Inverse projection from x,y to lat,lon */
+            /* int index =i+j*nx; */
+            double _x = (x - inv_proj_data.false_easting) * inv_proj_data.sign;
+            double _y = (y - inv_proj_data.false_northing) * inv_proj_data.sign;
+            double rh = sqrt(_x * _x + _y * _y);
+            if (inv_proj_data.ind)
+                ts = rh * inv_proj_data.tcs/(radius * inv_proj_data.mcs);
+            else
+                ts = rh / (radius * 2.0);
+            *lats = inv_proj_data.sign * (PI_OVER_2 - 2 * atan(ts));
+            if (rh == 0) {
+                *lons = inv_proj_data.sign * inv_proj_data.centre_lon;
+            } else {
+                double temp = atan2(_x, -_y);
+                *lons = inv_proj_data.sign * temp + inv_proj_data.centre_lon;
+            }
+            *lats = *lats * RAD2DEG;
+            *lons = *lons * RAD2DEG;
+            while (*lons<0)   *lons += 360;
+            while (*lons>360) *lons -= 360;
+            lons++;
+            lats++;
+
+            x += Dx;
+        }
+        y += Dy;
+    }
+#if 0
+    /*standardParallel = (southPoleOnPlane == 1) ? -90 : +90;*/
     if (jPointsAreConsecutive)
     {
         x=xFirst;
@@ -234,6 +309,7 @@ static int init(grib_iterator* iter,grib_handle* h,grib_arguments* args)
         for (j=0;j<ny;j++) {
             x=xFirst;
             for (i=0;i<nx;i++) {
+                /* int index =i+j*nx; */
                 rho=sqrt(x*x+y*y);
                 if (rho == 0) {
                     /* indeterminate case */
@@ -257,6 +333,7 @@ static int init(grib_iterator* iter,grib_handle* h,grib_arguments* args)
             y+=Dy;
         }
     }
+#endif
     iter->e = -1;
 
     return ret;
diff --git a/src/grib_iterator_class_regular.c b/src/grib_iterator_class_regular.c
index b729766..8fb0b15 100644
--- a/src/grib_iterator_class_regular.c
+++ b/src/grib_iterator_class_regular.c
@@ -19,15 +19,16 @@
    SUPER      = grib_iterator_class_gen
    IMPLEMENTS = previous;next
    IMPLEMENTS = init;destroy
-   MEMBERS    =  double   *las
-   MEMBERS    =  double   *los
-   MEMBERS    =  long      nap
-   MEMBERS    =  long      nam
-   MEMBERS    =  long iScansNegatively
+   MEMBERS    = double   *las
+   MEMBERS    = double   *los
+   MEMBERS    = long      nap
+   MEMBERS    = long      nam
+   MEMBERS    = long iScansNegatively
    MEMBERS    = long isRotated
    MEMBERS    = double angleOfRotation
    MEMBERS    = double southPoleLat
    MEMBERS    = double southPoleLon
+   MEMBERS    = long jPointsAreConsecutive
    END_CLASS_DEF
 
  */
@@ -61,11 +62,12 @@ typedef struct grib_iterator_regular{
 	double   *los;
 	long      nap;
 	long      nam;
-	long iScansNegatively;
-	long isRotated;
+	long   iScansNegatively;
+	long   isRotated;
 	double angleOfRotation;
 	double southPoleLat;
 	double southPoleLon;
+	long   jPointsAreConsecutive;
 } grib_iterator_regular;
 
 extern grib_iterator_class* grib_iterator_class_gen;
@@ -134,42 +136,42 @@ static int init(grib_iterator* i,grib_handle* h,grib_arguments* args)
     grib_iterator_regular* self = (grib_iterator_regular*)i;
     int ret = GRIB_SUCCESS;
 
-    long nap; /* Number of points along a parallel = Ni */
-    long nam; /* Number of points along a meridian = Nj */
-    double idir, lof,lol;
+    long Ni; /* Number of points along a parallel = Nx */
+    long Nj; /* Number of points along a meridian = Ny */
+    double idir, lon1,lon2;
     long loi;
 
-    const char* longoffirst = grib_arguments_get_name(h,args,self->carg++);
-    const char* idirec      = grib_arguments_get_name(h,args,self->carg++);
-    const char* nalpar      = grib_arguments_get_name(h,args,self->carg++);
-    const char* nalmer      = grib_arguments_get_name(h,args,self->carg++);
-    const char* iScansNegatively  = grib_arguments_get_name(h,args,self->carg++);
-
-    if((ret = grib_get_double_internal(h,longoffirst,   &lof))) return ret;
-    if((ret = grib_get_double_internal(h,"longitudeOfLastGridPointInDegrees", &lol))) return ret;
-    if((ret = grib_get_double_internal(h,idirec,        &idir))) return ret;
-    if((ret = grib_get_long_internal(h,nalpar,          &nap))) return ret;
-    if((ret = grib_get_long_internal(h,nalmer,          &nam))) return ret;
-    if((ret = grib_get_long_internal(h,iScansNegatively,&self->iScansNegatively)))
+    const char* s_lon1 = grib_arguments_get_name(h,args,self->carg++);
+    const char* s_idir = grib_arguments_get_name(h,args,self->carg++);
+    const char* s_Ni   = grib_arguments_get_name(h,args,self->carg++);
+    const char* s_Nj   = grib_arguments_get_name(h,args,self->carg++);
+    const char* s_iScansNeg = grib_arguments_get_name(h,args,self->carg++);
+
+    if((ret = grib_get_double_internal(h, s_lon1, &lon1))) return ret;
+    if((ret = grib_get_double_internal(h, "longitudeOfLastGridPointInDegrees", &lon2))) return ret;
+    if((ret = grib_get_double_internal(h, s_idir, &idir))) return ret;
+    if((ret = grib_get_long_internal(h, s_Ni, &Ni))) return ret;
+    if((ret = grib_get_long_internal(h, s_Nj, &Nj))) return ret;
+    if((ret = grib_get_long_internal(h, s_iScansNeg, &self->iScansNegatively)))
         return ret;
 
     /* GRIB-801: Careful of case with a single point! nap==1 */
-    if (nap > 1) {
+    if (Ni > 1) {
         /* Note: If first and last longitudes are equal I assume you wanna go round the globe */
         if (self->iScansNegatively) {
-            if (lof > lol){
-                idir=(lof-lol)/(nap-1);
+            if (lon1 > lon2){
+                idir=(lon1-lon2)/(Ni-1);
             }
             else {
-                idir=(lof+360.0-lol)/(nap-1);
+                idir=(lon1+360.0-lon2)/(Ni-1);
             }
         }
         else {
-            if (lol > lof){
-                idir=(lol-lof)/(nap-1);
+            if (lon2 > lon1){
+                idir=(lon2-lon1)/(Ni-1);
             }
             else {
-                idir=(lol+360.0-lof)/(nap-1);
+                idir=(lon2+360.0-lon1)/(Ni-1);
             }
         }
     }
@@ -177,22 +179,22 @@ static int init(grib_iterator* i,grib_handle* h,grib_arguments* args)
         idir=-idir;
     } else {
         const double epsilon = 1e-6;
-        if (lof+(nap-2)*idir>360) lof-=360;
-        else if ( (lof+(nap-1)*idir)-360 > epsilon ){
+        if (lon1+(Ni-2)*idir>360) lon1-=360;
+        else if ( (lon1+(Ni-1)*idir)-360 > epsilon ){
             /*See GRIB-396*/
-            idir=360.0/(float)nap;
+            idir=360.0/(float)Ni;
         }
     }
 
-    self->nap = nap;
-    self->nam = nam;
+    self->nap = Ni;
+    self->nam = Nj;
 
-    self->las = (double*)grib_context_malloc(h->context,nam*sizeof(double));
-    self->los = (double*)grib_context_malloc(h->context,nap*sizeof(double));
+    self->las = (double*)grib_context_malloc(h->context,Nj*sizeof(double));
+    self->los = (double*)grib_context_malloc(h->context,Ni*sizeof(double));
 
-    for( loi = 0; loi < nap; loi++ )  {
-        self->los[loi] = lof;
-        lof += idir ;
+    for( loi = 0; loi < Ni; loi++ )  {
+        self->los[loi] = lon1;
+        lon1 += idir ;
     }
 
     return ret;
diff --git a/src/grib_iterator_class_space_view.c b/src/grib_iterator_class_space_view.c
index 218942f..56e7325 100644
--- a/src/grib_iterator_class_space_view.c
+++ b/src/grib_iterator_class_space_view.c
@@ -113,7 +113,7 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
     long alternativeRowScanning,iScansNegatively;
     long Xo, Yo, jScansPositively,jPointsAreConsecutive, i;
 
-    double major, minor, r_eq, r_pol, height;
+    double major=0, minor=0, r_eq, r_pol, height;
     double lap, lop, orient_angle, angular_size;
     double xp, yp, dx, dy, rx, ry, x, y;
     double cos_x, cos_y, sin_x, sin_y;
diff --git a/src/grib_loader_from_handle.c b/src/grib_loader_from_handle.c
index e6c7dd5..72623e5 100644
--- a/src/grib_loader_from_handle.c
+++ b/src/grib_loader_from_handle.c
@@ -174,8 +174,8 @@ int grib_init_accessor_from_handle(grib_loader* loader,grib_accessor* ga,grib_ar
     {
     case GRIB_TYPE_STRING:
 
-        /* len = len > 1024 ? len : 1024; */
-        _grib_get_string_length(ga,&len);
+        /*_grib_get_string_length(ga,&len);  See ECC-490 */
+        grib_get_string_length(h,name,&len);
         sval = (char*)grib_context_malloc(h->context,len);
         ret = grib_get_string_internal(h,name,sval,&len);
         if(ret == GRIB_SUCCESS)
diff --git a/src/grib_nearest_class.h b/src/grib_nearest_class.h
index 1f7d3fe..441e501 100644
--- a/src/grib_nearest_class.h
+++ b/src/grib_nearest_class.h
@@ -1,6 +1,7 @@
 /* This file is automatically generated by ./make_class.pl, do not edit */
 extern grib_nearest_class* grib_nearest_class_gen;
 extern grib_nearest_class* grib_nearest_class_lambert_conformal;
+extern grib_nearest_class* grib_nearest_class_polar_stereographic;
 extern grib_nearest_class* grib_nearest_class_latlon_reduced;
 extern grib_nearest_class* grib_nearest_class_reduced;
 extern grib_nearest_class* grib_nearest_class_regular;
diff --git a/src/grib_nearest_class_lambert_conformal.c b/src/grib_nearest_class_lambert_conformal.c
index 537dfee..4f12367 100644
--- a/src/grib_nearest_class_lambert_conformal.c
+++ b/src/grib_nearest_class_lambert_conformal.c
@@ -127,7 +127,7 @@ typedef struct PointStore {
 } PointStore ;
 
 /* Comparison function to sort points by distance */
-int compare_points(const void* a, const void* b)
+static int compare_points(const void* a, const void* b)
 {
     PointStore *pA = (PointStore*)a;
     PointStore *pB = (PointStore*)b;
diff --git a/src/grib_nearest_class_latlon_reduced.c b/src/grib_nearest_class_latlon_reduced.c
index 558cd3b..b4dc177 100644
--- a/src/grib_nearest_class_latlon_reduced.c
+++ b/src/grib_nearest_class_latlon_reduced.c
@@ -90,260 +90,260 @@ static void init_class(grib_nearest_class* c)
 
 static int init(grib_nearest* nearest,grib_handle* h,grib_arguments* args)
 {
-	grib_nearest_latlon_reduced* self = (grib_nearest_latlon_reduced*) nearest;
-	self->Nj  = grib_arguments_get_name(h,args,self->cargs++);
-	self->pl  = grib_arguments_get_name(h,args,self->cargs++);
-	self->lonFirst  = grib_arguments_get_name(h,args,self->cargs++);
-	self->lonLast  = grib_arguments_get_name(h,args,self->cargs++);
-	self->j=(int*)grib_context_malloc(h->context,2*sizeof(int));
-	if (!self->j) return GRIB_OUT_OF_MEMORY;
-	self->k=(int*)grib_context_malloc( nearest->context,4*sizeof(int));
-	if (!self->k) return GRIB_OUT_OF_MEMORY;
-
-	return 0;
+    grib_nearest_latlon_reduced* self = (grib_nearest_latlon_reduced*) nearest;
+    self->Nj  = grib_arguments_get_name(h,args,self->cargs++);
+    self->pl  = grib_arguments_get_name(h,args,self->cargs++);
+    self->lonFirst  = grib_arguments_get_name(h,args,self->cargs++);
+    self->lonLast  = grib_arguments_get_name(h,args,self->cargs++);
+    self->j=(int*)grib_context_malloc(h->context,2*sizeof(int));
+    if (!self->j) return GRIB_OUT_OF_MEMORY;
+    self->k=(int*)grib_context_malloc( nearest->context,4*sizeof(int));
+    if (!self->k) return GRIB_OUT_OF_MEMORY;
+
+    return 0;
 }
 
 static int find(grib_nearest* nearest, grib_handle* h,
-		double inlat, double inlon,unsigned long flags,
-		double* outlats,double* outlons, double *values,
-		double *distances,int *indexes, size_t *len) {
-	grib_nearest_latlon_reduced* self = (grib_nearest_latlon_reduced*) nearest;
-	int ret=0,kk=0,ii=0,jj=0;
-	int j=0;
-	long* pla=NULL;
-	long* pl=NULL;
-	size_t nvalues=0;
-	grib_iterator* iter=NULL;
-	double lat=0,lon=0;
-	long iradius;
-	double radius;
-	int ilat=0,ilon=0;
-
-	if( (ret =  grib_get_size(h,self->values_key,&nvalues))!= GRIB_SUCCESS)
-		return ret;
-	nearest->values_count = nvalues;
-
-	if (grib_is_missing(h,self->radius,&ret)) {
-		grib_context_log(h->context, GRIB_LOG_DEBUG,"Key '%s' is missing", self->radius);
-		return ret ? ret : GRIB_GEOCALCULUS_PROBLEM;
-	}
-
-	if( (ret = grib_get_long(h,self->radius,&iradius))!= GRIB_SUCCESS)
-		return ret;
-	radius=((double)iradius)/1000.0;
-
-	if (!nearest->h || (flags & GRIB_NEAREST_SAME_GRID)==0) {
-		double dummy=0;
-		double olat=1.e10;
-		long n=0;
-
-		ilat=0,ilon=0;
-		if (grib_is_missing(h,self->Nj,&ret)) {
-			grib_context_log(h->context, GRIB_LOG_DEBUG,"Key '%s' is missing", self->Nj);
-			return ret ? ret : GRIB_GEOCALCULUS_PROBLEM;
-		}
-
-		if ( (ret =  grib_get_long(h,self->Nj,&n))!= GRIB_SUCCESS)
-			return ret;
-		self->lats_count=n;
-
-		if (self->lats) grib_context_free(nearest->context,self->lats);
-    self->lats=(double*)grib_context_malloc( nearest->context,
-				self->lats_count* sizeof(double));
-		if (!self->lats) return GRIB_OUT_OF_MEMORY;
-
-		if (self->lons) grib_context_free(nearest->context,self->lons);
-    self->lons=(double*)grib_context_malloc( nearest->context,
-				nearest->values_count*sizeof(double));
-		if (!self->lons) return GRIB_OUT_OF_MEMORY;
-
-		iter=grib_iterator_new(h,0,&ret);
-    if (ret) {
-        grib_context_log(h->context,GRIB_LOG_ERROR,"unable to create iterator");
+        double inlat, double inlon,unsigned long flags,
+        double* outlats,double* outlons, double *values,
+        double *distances,int *indexes, size_t *len) {
+    grib_nearest_latlon_reduced* self = (grib_nearest_latlon_reduced*) nearest;
+    int ret=0,kk=0,ii=0,jj=0;
+    int j=0;
+    long* pla=NULL;
+    long* pl=NULL;
+    size_t nvalues=0;
+    grib_iterator* iter=NULL;
+    double lat=0,lon=0;
+    long iradius;
+    double radius;
+    int ilat=0,ilon=0;
+
+    if( (ret =  grib_get_size(h,self->values_key,&nvalues))!= GRIB_SUCCESS)
         return ret;
+    nearest->values_count = nvalues;
+
+    if (grib_is_missing(h,self->radius,&ret)) {
+        grib_context_log(h->context, GRIB_LOG_DEBUG,"Key '%s' is missing", self->radius);
+        return ret ? ret : GRIB_GEOCALCULUS_PROBLEM;
+    }
+
+    if( (ret = grib_get_long(h,self->radius,&iradius))!= GRIB_SUCCESS)
+        return ret;
+    radius=((double)iradius)/1000.0;
+
+    if (!nearest->h || (flags & GRIB_NEAREST_SAME_GRID)==0) {
+        double dummy=0;
+        double olat=1.e10;
+        long n=0;
+
+        ilat=0; ilon=0;
+        if (grib_is_missing(h,self->Nj,&ret)) {
+            grib_context_log(h->context, GRIB_LOG_DEBUG,"Key '%s' is missing", self->Nj);
+            return ret ? ret : GRIB_GEOCALCULUS_PROBLEM;
+        }
+
+        if ( (ret =  grib_get_long(h,self->Nj,&n))!= GRIB_SUCCESS)
+            return ret;
+        self->lats_count=n;
+
+        if (self->lats) grib_context_free(nearest->context,self->lats);
+        self->lats=(double*)grib_context_malloc( nearest->context,
+                self->lats_count* sizeof(double));
+        if (!self->lats) return GRIB_OUT_OF_MEMORY;
+
+        if (self->lons) grib_context_free(nearest->context,self->lons);
+        self->lons=(double*)grib_context_malloc( nearest->context,
+                nearest->values_count*sizeof(double));
+        if (!self->lons) return GRIB_OUT_OF_MEMORY;
+
+        iter=grib_iterator_new(h,0,&ret);
+        if (ret) {
+            grib_context_log(h->context,GRIB_LOG_ERROR,"unable to create iterator");
+            return ret;
+        }
+        while(grib_iterator_next(iter,&lat,&lon,&dummy)) {
+            if (olat!=lat) {
+                self->lats[ilat++]=lat;
+                olat=lat;
+            }
+            self->lons[ilon++]=lon;
+        }
+        self->lats_count=ilat;
+        grib_iterator_delete(iter);
+
     }
-		while(grib_iterator_next(iter,&lat,&lon,&dummy)) {
-			if (olat!=lat) {
-				self->lats[ilat++]=lat;
-				olat=lat;
-			}
-			self->lons[ilon++]=lon;
-		}
-		self->lats_count=ilat;
-		grib_iterator_delete(iter);
-
-	}
-	nearest->h=h;
-
-	if (!self->distances || (flags & GRIB_NEAREST_SAME_POINT)==0
-			|| (flags & GRIB_NEAREST_SAME_GRID)==0) {
-		double* lons=NULL;
-		int nlon=0;
-		size_t plsize=0;
-		long nplm1=0;
-		int nearest_lons_found=0;
-		double lon_first,lon_last;
-		int islocal=0;
-		long plmax;
-		double dimin;
-
-		if ((ret=grib_get_double(h,self->lonFirst,&lon_first))!=GRIB_SUCCESS) {
-			grib_context_log(h->context,GRIB_LOG_ERROR,
-					"grib_nearest_latlon_reduced.find(): unable to get %s %s\n",self->lonFirst,
-					grib_get_error_message(ret));
-			return ret;
-		}
-		if ((ret=grib_get_double(h,self->lonLast,&lon_last))!=GRIB_SUCCESS) {
-			grib_context_log(h->context,GRIB_LOG_ERROR,
-					"grib_nearest_latlon_reduced.find(): unable to get %s %s\n",self->lonLast,
-					grib_get_error_message(ret));
-			return ret;
-		}
-
-		plsize=self->lats_count;
-		if( (ret=grib_get_size(h,self->pl,&plsize))!= GRIB_SUCCESS)
-			return ret;
-    pla=(long*)grib_context_malloc(h->context,plsize*sizeof(long));
-		if (!pla) return GRIB_OUT_OF_MEMORY;
-		if( (ret=grib_get_long_array(h,self->pl,pla,&plsize))!= GRIB_SUCCESS)
-			return ret;
-
-		pl=pla;
-		while ((*pl)==0) {pl++;}
-
-		plmax=pla[0];
-		for (j=0;j<plsize;j++) if (plmax<pla[j]) plmax=pla[j];
-		dimin=360.0/plmax;
-
-		if ( 360-fabs(lon_last-lon_first) < 2 * dimin ) {islocal=0;}
-		else {islocal=1;}
-
-		if (islocal)
-			for (j=0;j<plsize;j++) pla[j]--;
-
-		/* printf("XXXX islocal=%d\n",islocal); */
-		while (inlon<0) inlon+=360;
-		while (inlon>360) inlon-=360;
-
-		ilat=self->lats_count;
-		if (self->lats[ilat-1] > self->lats[0]) {
-			if (inlat < self->lats[0] || inlat > self->lats[ilat-1])
-				return GRIB_OUT_OF_AREA;
-		} else {
-			if (inlat > self->lats[0] || inlat < self->lats[ilat-1])
-				return GRIB_OUT_OF_AREA;
-		}
-
-		if (!self->distances)
-			self->distances=(double*)grib_context_malloc( nearest->context,4*sizeof(double));
-		if (!self->distances) return GRIB_OUT_OF_MEMORY;
-
-		grib_binary_search(self->lats,ilat-1,inlat,
-				&(self->j[0]),&(self->j[1]));
-
-		nlon=0;
-		for (jj=0;jj<self->j[0];jj++) nlon+=pl[jj];
-		nplm1=pl[self->j[0]]-1;
-
-		lons=self->lons+nlon;
-
-		nearest_lons_found=0;
-		if (lons[nplm1]>lons[0]) {
-			if (inlon< lons[0] || inlon > lons[nplm1]) {
-				if (lons[nplm1]-lons[0]-360 <=
-						lons[nplm1]-lons[nplm1-1]) {
-					self->k[0]=0;
-					self->k[1]=nplm1;
-					nearest_lons_found=1;
-				} else return GRIB_OUT_OF_AREA;
-			}
-		} else {
-			if (inlon >lons[0] || inlon< lons[nplm1]) {
-				if (lons[0]-lons[nplm1]-360 <=
-						lons[0]-lons[1]) {
-					self->k[0]=0;
-					self->k[1]=nplm1;
-					nearest_lons_found=1;
-				} else return GRIB_OUT_OF_AREA;
-			}
-		}
-
-		if (!nearest_lons_found) {
-			grib_binary_search(lons,pl[self->j[0]]-1,inlon,
-					&(self->k[0]),&(self->k[1]));
-		}
-		self->k[0]+=nlon;
-		self->k[1]+=nlon;
-
-		nlon=0;
-		for (jj=0;jj<self->j[1];jj++) nlon+=pl[jj];
-		nplm1=pl[self->j[1]]-1;
-
-		lons=self->lons+nlon;
-
-		nearest_lons_found=0;
-		if (lons[nplm1]>lons[0]) {
-			if (inlon<lons[0] || inlon>lons[nplm1]) {
-				if (lons[nplm1]-lons[0]-360 <=
-						lons[nplm1]-lons[nplm1-1]) {
-					self->k[2]=0;
-					self->k[3]=nplm1;
-					nearest_lons_found=1;
-				} else return GRIB_OUT_OF_AREA;
-			}
-		} else {
-			if (inlon>lons[0] || inlon<lons[nplm1]) {
-				if (lons[0]-lons[nplm1]-360 <=
-						lons[0]-lons[1]) {
-					self->k[2]=0;
-					self->k[3]=nplm1;
-					nearest_lons_found=1;
-				} else return GRIB_OUT_OF_AREA;
-			}
-		}
-
-		if (!nearest_lons_found) {
-			grib_binary_search(lons,pl[self->j[1]]-1,inlon,
-					&(self->k[2]),&(self->k[3]));
-		}
-
-		self->k[2]+=nlon;
-		self->k[3]+=nlon;
-
-		kk=0;
-		for (jj=0;jj<2;jj++) {
-			for (ii=0;ii<2;ii++) {
-				self->distances[kk]=grib_nearest_distance(radius,inlon,inlat,
-						self->lons[self->k[kk]],self->lats[self->j[jj]]);
-				kk++;
-			}
-		}
-
-		grib_context_free(h->context,pla);
-	}
-
-	kk=0;
-	for (jj=0;jj<2;jj++) {
-		for (ii=0;ii<2;ii++) {
-			distances[kk]=self->distances[kk];
-			outlats[kk]=self->lats[self->j[jj]];
-			outlons[kk]=self->lons[self->k[kk]];
-			grib_get_double_element_internal(h,self->values_key,self->k[kk],&(values[kk]));
-			indexes[kk]=self->k[kk];
-			kk++;
-		}
-	}
-
-	return GRIB_SUCCESS;
+    nearest->h=h;
+
+    if (!self->distances || (flags & GRIB_NEAREST_SAME_POINT)==0
+            || (flags & GRIB_NEAREST_SAME_GRID)==0) {
+        double* lons=NULL;
+        int nlon=0;
+        size_t plsize=0;
+        long nplm1=0;
+        int nearest_lons_found=0;
+        double lon_first,lon_last;
+        int islocal=0;
+        long plmax;
+        double dimin;
+
+        if ((ret=grib_get_double(h,self->lonFirst,&lon_first))!=GRIB_SUCCESS) {
+            grib_context_log(h->context,GRIB_LOG_ERROR,
+                    "grib_nearest_latlon_reduced.find(): unable to get %s %s\n",self->lonFirst,
+                    grib_get_error_message(ret));
+            return ret;
+        }
+        if ((ret=grib_get_double(h,self->lonLast,&lon_last))!=GRIB_SUCCESS) {
+            grib_context_log(h->context,GRIB_LOG_ERROR,
+                    "grib_nearest_latlon_reduced.find(): unable to get %s %s\n",self->lonLast,
+                    grib_get_error_message(ret));
+            return ret;
+        }
+
+        plsize=self->lats_count;
+        if( (ret=grib_get_size(h,self->pl,&plsize))!= GRIB_SUCCESS)
+            return ret;
+        pla=(long*)grib_context_malloc(h->context,plsize*sizeof(long));
+        if (!pla) return GRIB_OUT_OF_MEMORY;
+        if( (ret=grib_get_long_array(h,self->pl,pla,&plsize))!= GRIB_SUCCESS)
+            return ret;
+
+        pl=pla;
+        while ((*pl)==0) {pl++;}
+
+        plmax=pla[0];
+        for (j=0;j<plsize;j++) if (plmax<pla[j]) plmax=pla[j];
+        dimin=360.0/plmax;
+
+        if ( 360-fabs(lon_last-lon_first) < 2 * dimin ) {islocal=0;}
+        else {islocal=1;}
+
+        if (islocal)
+            for (j=0;j<plsize;j++) pla[j]--;
+
+        /* printf("XXXX islocal=%d\n",islocal); */
+        while (inlon<0) inlon+=360;
+        while (inlon>360) inlon-=360;
+
+        ilat=self->lats_count;
+        if (self->lats[ilat-1] > self->lats[0]) {
+            if (inlat < self->lats[0] || inlat > self->lats[ilat-1])
+                return GRIB_OUT_OF_AREA;
+        } else {
+            if (inlat > self->lats[0] || inlat < self->lats[ilat-1])
+                return GRIB_OUT_OF_AREA;
+        }
+
+        if (!self->distances)
+            self->distances=(double*)grib_context_malloc( nearest->context,4*sizeof(double));
+        if (!self->distances) return GRIB_OUT_OF_MEMORY;
+
+        grib_binary_search(self->lats,ilat-1,inlat,
+                &(self->j[0]),&(self->j[1]));
+
+        nlon=0;
+        for (jj=0;jj<self->j[0];jj++) nlon+=pl[jj];
+        nplm1=pl[self->j[0]]-1;
+
+        lons=self->lons+nlon;
+
+        nearest_lons_found=0;
+        if (lons[nplm1]>lons[0]) {
+            if (inlon< lons[0] || inlon > lons[nplm1]) {
+                if (lons[nplm1]-lons[0]-360 <=
+                        lons[nplm1]-lons[nplm1-1]) {
+                    self->k[0]=0;
+                    self->k[1]=nplm1;
+                    nearest_lons_found=1;
+                } else return GRIB_OUT_OF_AREA;
+            }
+        } else {
+            if (inlon >lons[0] || inlon< lons[nplm1]) {
+                if (lons[0]-lons[nplm1]-360 <=
+                        lons[0]-lons[1]) {
+                    self->k[0]=0;
+                    self->k[1]=nplm1;
+                    nearest_lons_found=1;
+                } else return GRIB_OUT_OF_AREA;
+            }
+        }
+
+        if (!nearest_lons_found) {
+            grib_binary_search(lons,pl[self->j[0]]-1,inlon,
+                    &(self->k[0]),&(self->k[1]));
+        }
+        self->k[0]+=nlon;
+        self->k[1]+=nlon;
+
+        nlon=0;
+        for (jj=0;jj<self->j[1];jj++) nlon+=pl[jj];
+        nplm1=pl[self->j[1]]-1;
+
+        lons=self->lons+nlon;
+
+        nearest_lons_found=0;
+        if (lons[nplm1]>lons[0]) {
+            if (inlon<lons[0] || inlon>lons[nplm1]) {
+                if (lons[nplm1]-lons[0]-360 <=
+                        lons[nplm1]-lons[nplm1-1]) {
+                    self->k[2]=0;
+                    self->k[3]=nplm1;
+                    nearest_lons_found=1;
+                } else return GRIB_OUT_OF_AREA;
+            }
+        } else {
+            if (inlon>lons[0] || inlon<lons[nplm1]) {
+                if (lons[0]-lons[nplm1]-360 <=
+                        lons[0]-lons[1]) {
+                    self->k[2]=0;
+                    self->k[3]=nplm1;
+                    nearest_lons_found=1;
+                } else return GRIB_OUT_OF_AREA;
+            }
+        }
+
+        if (!nearest_lons_found) {
+            grib_binary_search(lons,pl[self->j[1]]-1,inlon,
+                    &(self->k[2]),&(self->k[3]));
+        }
+
+        self->k[2]+=nlon;
+        self->k[3]+=nlon;
+
+        kk=0;
+        for (jj=0;jj<2;jj++) {
+            for (ii=0;ii<2;ii++) {
+                self->distances[kk]=grib_nearest_distance(radius,inlon,inlat,
+                        self->lons[self->k[kk]],self->lats[self->j[jj]]);
+                kk++;
+            }
+        }
+
+        grib_context_free(h->context,pla);
+    }
+
+    kk=0;
+    for (jj=0;jj<2;jj++) {
+        for (ii=0;ii<2;ii++) {
+            distances[kk]=self->distances[kk];
+            outlats[kk]=self->lats[self->j[jj]];
+            outlons[kk]=self->lons[self->k[kk]];
+            grib_get_double_element_internal(h,self->values_key,self->k[kk],&(values[kk]));
+            indexes[kk]=self->k[kk];
+            kk++;
+        }
+    }
+
+    return GRIB_SUCCESS;
 }
 
 static int destroy(grib_nearest* nearest) {
-	grib_nearest_latlon_reduced* self = (grib_nearest_latlon_reduced*) nearest;
-	if (self->lats) grib_context_free(nearest->context,self->lats);
-	if (self->lons) grib_context_free(nearest->context,self->lons);
-	if (self->j) grib_context_free(nearest->context,self->j);
-	if (self->k) grib_context_free(nearest->context,self->k);
-	if (self->distances) grib_context_free(nearest->context,self->distances);
-
-	return GRIB_SUCCESS;
+    grib_nearest_latlon_reduced* self = (grib_nearest_latlon_reduced*) nearest;
+    if (self->lats) grib_context_free(nearest->context,self->lats);
+    if (self->lons) grib_context_free(nearest->context,self->lons);
+    if (self->j) grib_context_free(nearest->context,self->j);
+    if (self->k) grib_context_free(nearest->context,self->k);
+    if (self->distances) grib_context_free(nearest->context,self->distances);
+
+    return GRIB_SUCCESS;
 }
diff --git a/src/grib_nearest_class_lambert_conformal.c b/src/grib_nearest_class_polar_stereographic.c
similarity index 92%
copy from src/grib_nearest_class_lambert_conformal.c
copy to src/grib_nearest_class_polar_stereographic.c
index 537dfee..d9d9f6a 100644
--- a/src/grib_nearest_class_lambert_conformal.c
+++ b/src/grib_nearest_class_polar_stereographic.c
@@ -49,13 +49,13 @@ static int init               (grib_nearest* nearest,grib_handle* h,grib_argumen
 static int find(grib_nearest* nearest, grib_handle* h,double inlat, double inlon, unsigned long flags, double* outlats,double* outlons, double *values,double *distances, int *indexes,size_t *len);
 static int destroy            (grib_nearest* nearest);
 
-typedef struct grib_nearest_lambert_conformal{
+typedef struct grib_nearest_polar_stereographic{
   grib_nearest nearest;
 /* Members defined in gen */
 	const char* values_key;
 	const char* radius;
 	int cargs;
-/* Members defined in lambert_conformal */
+/* Members defined in polar_stereographic */
 	double* lats;
 	int  lats_count;
 	double* lons;
@@ -66,14 +66,14 @@ typedef struct grib_nearest_lambert_conformal{
 	int* j;
 	const char* Ni;
 	const char* Nj;
-} grib_nearest_lambert_conformal;
+} grib_nearest_polar_stereographic;
 
 extern grib_nearest_class* grib_nearest_class_gen;
 
-static grib_nearest_class _grib_nearest_class_lambert_conformal = {
+static grib_nearest_class _grib_nearest_class_polar_stereographic = {
     &grib_nearest_class_gen,                         /* super                     */
-    "lambert_conformal",                         /* name                      */
-    sizeof(grib_nearest_lambert_conformal),      /* size of instance          */
+    "polar_stereographic",                         /* name                      */
+    sizeof(grib_nearest_polar_stereographic),      /* size of instance          */
     0,                              /* inited */
     &init_class,                    /* init_class */
     &init,                          /* constructor               */
@@ -81,7 +81,7 @@ static grib_nearest_class _grib_nearest_class_lambert_conformal = {
     &find,                          /* find nearest              */
 };
 
-grib_nearest_class* grib_nearest_class_lambert_conformal = &_grib_nearest_class_lambert_conformal;
+grib_nearest_class* grib_nearest_class_polar_stereographic = &_grib_nearest_class_polar_stereographic;
 
 
 static void init_class(grib_nearest_class* c)
@@ -91,7 +91,7 @@ static void init_class(grib_nearest_class* c)
 
 static int init(grib_nearest* nearest,grib_handle* h,grib_arguments* args)
 {
-    grib_nearest_lambert_conformal* self = (grib_nearest_lambert_conformal*) nearest;
+    grib_nearest_polar_stereographic* self = (grib_nearest_polar_stereographic*) nearest;
     self->Ni  = grib_arguments_get_name(h,args,self->cargs++);
     self->Nj  = grib_arguments_get_name(h,args,self->cargs++);
     self->i=(int*)grib_context_malloc(h->context,2*sizeof(int));
@@ -127,7 +127,7 @@ typedef struct PointStore {
 } PointStore ;
 
 /* Comparison function to sort points by distance */
-int compare_points(const void* a, const void* b)
+static int compare_points(const void* a, const void* b)
 {
     PointStore *pA = (PointStore*)a;
     PointStore *pB = (PointStore*)b;
@@ -142,7 +142,7 @@ static int find(grib_nearest* nearest, grib_handle* h,
         double* outlats,double* outlons,
         double *values,double *distances,int* indexes, size_t *len)
 {
-    grib_nearest_lambert_conformal* self = (grib_nearest_lambert_conformal*) nearest;
+    grib_nearest_polar_stereographic* self = (grib_nearest_polar_stereographic*) nearest;
     int ret=0, i=0;
     size_t nvalues=0;
     long iradius;
@@ -292,7 +292,7 @@ static int find(grib_nearest* nearest, grib_handle* h,
 
 static int destroy(grib_nearest* nearest)
 {
-    grib_nearest_lambert_conformal* self = (grib_nearest_lambert_conformal*) nearest;
+    grib_nearest_polar_stereographic* self = (grib_nearest_polar_stereographic*) nearest;
     if (self->lats) grib_context_free(nearest->context,self->lats);
     if (self->lons) grib_context_free(nearest->context,self->lons);
     if (self->i) grib_context_free(nearest->context,self->i);
diff --git a/src/grib_nearest_class_reduced.c b/src/grib_nearest_class_reduced.c
index ac1c2ca..5390e91 100644
--- a/src/grib_nearest_class_reduced.c
+++ b/src/grib_nearest_class_reduced.c
@@ -156,7 +156,7 @@ static int find(grib_nearest* nearest, grib_handle* h,
         double olat=1.e10;
         long n=0;
 
-        ilat=0,ilon=0;
+        ilat=0; ilon=0;
         if (grib_is_missing(h,self->Nj,&ret)) {
             grib_context_log(h->context, GRIB_LOG_DEBUG,"Key '%s' is missing", self->Nj);
             return ret ? ret : GRIB_GEOCALCULUS_PROBLEM;
diff --git a/src/grib_nearest_factory.h b/src/grib_nearest_factory.h
index 288c1fa..2119699 100644
--- a/src/grib_nearest_factory.h
+++ b/src/grib_nearest_factory.h
@@ -2,6 +2,7 @@
 { "gen", &grib_nearest_class_gen, },
 { "lambert_conformal", &grib_nearest_class_lambert_conformal, },
 { "latlon_reduced", &grib_nearest_class_latlon_reduced, },
+{ "polar_stereographic", &grib_nearest_class_polar_stereographic, },
 { "reduced", &grib_nearest_class_reduced, },
 { "regular", &grib_nearest_class_regular, },
 { "sh", &grib_nearest_class_sh, },
diff --git a/src/grib_optimize_decimal_factor.h b/src/grib_optimize_decimal_factor.h
index dda744f..ac71657 100644
--- a/src/grib_optimize_decimal_factor.h
+++ b/src/grib_optimize_decimal_factor.h
@@ -1,5 +1,5 @@
-#ifndef _GRIB_OPTIMIZE_DECIMAL_FACTOR_H
-#define _GRIB_OPTIMIZE_DECIMAL_FACTOR_H
+#ifndef GRIB_OPTIMIZE_DECIMAL_FACTOR_H
+#define GRIB_OPTIMIZE_DECIMAL_FACTOR_H
 
 #include "grib_api_internal.h"
 
diff --git a/src/grib_parse_utils.c b/src/grib_parse_utils.c
index 263cf34..2979695 100644
--- a/src/grib_parse_utils.c
+++ b/src/grib_parse_utils.c
@@ -158,7 +158,7 @@ int grib_recompose_name(grib_handle* h, grib_accessor *observer, const char* una
             mode = 0;
         else {
 #if 0
-            int llen=strlen(fname);  // The strlen cost is too high
+            int llen=strlen(fname);  /* The strlen cost is too high */
             fname[llen]=uname[i];
             fname[llen+1]='\0';
 #else
diff --git a/src/grib_query.c b/src/grib_query.c
index 089a979..f82e9f2 100644
--- a/src/grib_query.c
+++ b/src/grib_query.c
@@ -234,8 +234,8 @@ static grib_accessor* search_by_rank(grib_handle* h, const char* name,int rank,c
         return _search_by_rank(data,name,rank);
     } else {
         grib_accessor* ret=NULL;
-        int rank;
-        char* str=get_rank(name,&rank);
+        int rank2;
+        char* str=get_rank(name,&rank2);
         ret=_search_and_cache(h,str,the_namespace);
         grib_context_free(h->context,str);
         return ret;
@@ -369,12 +369,12 @@ grib_accessors_list* grib_find_accessors_list(grib_handle* h,const char* name)
     } else if (name[0]=='#') {
         a=grib_find_accessor(h, name);
         if (a) {
-            char* str;
+            char* str2;
             int r;
             al=(grib_accessors_list*)grib_context_malloc_clear(h->context,sizeof(grib_accessors_list));
-            str=get_rank(name,&r);
+            str2=get_rank(name,&r);
             grib_accessors_list_push(al,a,r);
-            grib_context_free(h->context,str);
+            grib_context_free(h->context,str2);
         }
     } else {
         a=grib_find_accessor(h, name);
@@ -405,11 +405,11 @@ static grib_accessor* search_and_cache(grib_handle* h, const char* name,const ch
 static grib_accessor* _grib_find_accessor(grib_handle* h, const char* name)
 {
     grib_accessor* a = NULL;
-    char* p = (char*)name;
+    char* p = NULL;
     DebugAssert(name);
 
-    while ( *p != '.' && *p != '\0' ) p++;
-    if ( *p == '.' ) {
+    p = strchr(name, '.');
+    if ( p ) {
         int i=0,len=0;
         char name_space[MAX_NAMESPACE_LEN];
         char* basename=NULL;
@@ -436,12 +436,10 @@ static grib_accessor* _grib_find_accessor(grib_handle* h, const char* name)
 char* grib_split_name_attribute(grib_context* c,const char* name,char* attribute_name)
 {
     /*returns accessor name and attribute*/
-    char* p=0;
     size_t size=0;
     char* accessor_name=NULL;
-    p=(char*)name;
-    while ( *(p+1) != '\0' && ( *p != '-' || *(p+1)!= '>' ) ) p++;
-    if (*(p+1) == '\0') {
+    char* p = strstr(name, "->");
+    if (!p) {
         *attribute_name=0;
         return (char*)name;
     }
@@ -500,10 +498,11 @@ grib_accessor* grib_find_attribute(grib_handle* h, const char* name,const char*
 grib_accessor* grib_find_accessor_fast(grib_handle* h, const char* name)
 {
     grib_accessor* a = NULL;
-    char* p = (char*)name;
+    char* p = NULL;
+    DebugAssert(name);
 
-    while ( *p != '.' && *p != '\0' ) p++;
-    if ( *p == '.' ) {
+    p = strchr(name, '.');
+    if ( p ) {
         int i=0,len=0;
         char name_space[MAX_NAMESPACE_LEN];
         p--;
diff --git a/src/grib_trie_with_rank.c b/src/grib_trie_with_rank.c
index 6f9133e..464a79d 100644
--- a/src/grib_trie_with_rank.c
+++ b/src/grib_trie_with_rank.c
@@ -477,7 +477,7 @@ int grib_trie_with_rank_insert(grib_trie_with_rank* t,const char* key,void* data
 }
 
 /*
-void *grib_trie_with_rank_get_from_list(grib_trie_with_rank_list* list,int rank) {
+static void *grib_trie_with_rank_get_from_list(grib_trie_with_rank_list* list,int rank) {
   grib_trie_with_rank_list* next=list;
   int r=1;
 
diff --git a/src/grib_util.c b/src/grib_util.c
index 1de4220..116bf40 100644
--- a/src/grib_util.c
+++ b/src/grib_util.c
@@ -334,13 +334,17 @@ static grib_trie* init_list(const char* name)
     return 0;
 }
 
+/* For debugging purposes */
 static void print_values(grib_context* c, const grib_util_grid_spec2* spec,
-        const double* data_values, const size_t data_values_count, const grib_values *values, const int count)
+        const double* data_values, const size_t data_values_count,  /* the data pay load */
+        const grib_values *values, const size_t count)  /* keys and their values */
 {
-    int i;
-    printf("ECCODES DEBUG grib_util grib_set_values: setting %d values \n",count);
+    size_t i=0;
+    int isConstant = 1;
+    double v = 0;
+    printf("ECCODES DEBUG grib_util grib_set_values: setting %lu key/value pairs\n",(unsigned long)count);
 
-    for(i = 0; i < count ; i++)
+    for(i=0; i<count; i++)
     {
         switch(values[i].type)
         {
@@ -353,23 +357,37 @@ static void print_values(grib_context* c, const grib_util_grid_spec2* spec,
         }
     }
 
-    if(spec->bitmapPresent) {
-        int missing = 0;
-        size_t j = 0;
-        double min = 1e100;
-        for(j = 0; j < data_values_count ; j++)
-        {
-            double d = data_values[j] - spec->missingValue;
-            if(d < 0) d = -d;
-
-            if(d < min) {
-                min = d;
+    printf("ECCODES DEBUG grib_util: data_values_count=%lu;\n", (unsigned long)data_values_count);
+    for (i=0; i<data_values_count; i++) {
+        if (i==0) v = data_values[i];
+        if (data_values[i] != spec->missingValue) {
+            if (v == spec->missingValue) {
+                v = data_values[i];
+            } else if (v != data_values[i]) {
+                isConstant=0;
+                break;
             }
-
-            if(data_values[j] == spec->missingValue)
-                missing++;
         }
     }
+    if (isConstant) printf("ECCODES DEBUG grib_util: data_values are CONSTANT;\n");
+
+#if 0
+        if (spec->bitmapPresent) {
+            int missing = 0;
+            size_t j = 0;
+            double min = 1e100;
+            for(j = 0; j < data_values_count ; j++)
+            {
+                double d = data_values[j] - spec->missingValue;
+                if(d < 0) d = -d;
+                if(d < min) {
+                    min = d;
+                }
+                if(data_values[j] == spec->missingValue)
+                    missing++;
+            }
+        }
+#endif
 }
 
 static int DBL_EQUAL(double d1, double d2, double tolerance)
@@ -688,11 +706,7 @@ grib_handle* grib_util_set_spec2(grib_handle* h,
     }
 
     if (packing_spec->deleteLocalDefinition) {
-        /* TODO: We need two calls because of grib1/grib2 issues re removing local defs! */
-        if (editionNumber==1){
-            SET_LONG_VALUE("deleteLocalDefinition",1);
-        }
-        SET_LONG_VALUE("setLocalDefinition", 0);
+        SET_LONG_VALUE("deleteLocalDefinition",1);
     }
 
     len=100;
@@ -1203,15 +1217,15 @@ grib_handle* grib_util_set_spec2(grib_handle* h,
     if((*err = grib_set_double_array(outh,"values",data_values,data_values_count)) != 0)
     {
         FILE* ferror;
-        long i,lcount;
+        size_t ii,lcount;
         grib_context* c=grib_context_get_default();
 
         ferror=fopen("error.data","w");
         lcount=0;
         fprintf(ferror,"# data_values_count=%ld\n",(long)data_values_count);
         fprintf(ferror,"set values={ ");
-        for (i=0;i<data_values_count-1;i++) {
-            fprintf(ferror,"%g, ",data_values[i]);
+        for (ii=0;ii<data_values_count-1;ii++) {
+            fprintf(ferror,"%g, ",data_values[ii]);
             if (lcount>10) {fprintf(ferror,"\n");lcount=0;}
             lcount++;
         }
@@ -1313,8 +1327,6 @@ grib_handle* grib_util_set_spec2(grib_handle* h,
     }
 
     if (packing_spec->deleteLocalDefinition) {
-        /* TODO: We need two calls because of grib1/grib2 issues re removing local defs! */
-        grib_set_long(outh,"setLocalDefinition", 0);
         grib_set_long(outh,"deleteLocalDefinition", 1);
     }
 
@@ -1640,33 +1652,32 @@ char* codes_getenv(const char* name)
 {
     /* Look for the new ecCodes environment variable names */
     /* if not found, then look for old grib_api ones for backward compatibility */
-    const char* old_name = name;
-    char* result = NULL;
-
-    /* Test the most commonly used variables first */
-    if      (STR_EQ(name, "ECCODES_SAMPLES_PATH")) old_name="GRIB_SAMPLES_PATH";
-    else if (STR_EQ(name, "ECCODES_DEFINITION_PATH")) old_name="GRIB_DEFINITION_PATH";
-    else if (STR_EQ(name, "ECCODES_DEBUG")) old_name="GRIB_API_DEBUG";
-
-    else if (STR_EQ(name, "ECCODES_FAIL_IF_LOG_MESSAGE")) old_name="GRIB_API_FAIL_IF_LOG_MESSAGE";
-    else if (STR_EQ(name, "ECCODES_GRIB_WRITE_ON_FAIL")) old_name="GRIB_API_WRITE_ON_FAIL";
-    else if (STR_EQ(name, "ECCODES_GRIB_LARGE_CONSTANT_FIELDS")) old_name="GRIB_API_LARGE_CONSTANT_FIELDS";
-    else if (STR_EQ(name, "ECCODES_NO_ABORT")) old_name="GRIB_API_NO_ABORT";
-    else if (STR_EQ(name, "ECCODES_GRIBEX_MODE_ON")) old_name="GRIB_GRIBEX_MODE_ON";
-    else if (STR_EQ(name, "ECCODES_GRIB_IEEE_PACKING")) old_name="GRIB_IEEE_PACKING";
-    else if (STR_EQ(name, "ECCODES_IO_BUFFER_SIZE")) old_name="GRIB_API_IO_BUFFER_SIZE";
-    else if (STR_EQ(name, "ECCODES_LOG_STREAM")) old_name="GRIB_API_LOG_STREAM";
-    else if (STR_EQ(name, "ECCODES_GRIB_NO_BIG_GROUP_SPLIT")) old_name="GRIB_API_NO_BIG_GROUP_SPLIT";
-    else if (STR_EQ(name, "ECCODES_GRIB_NO_SPD")) old_name="GRIB_API_NO_SPD";
-    else if (STR_EQ(name, "ECCODES_GRIB_KEEP_MATRIX")) old_name="GRIB_API_KEEP_MATRIX";
-    else if (STR_EQ(name, "_ECCODES_ECMWF_TEST_DEFINITION_PATH")) old_name="_GRIB_API_ECMWF_TEST_DEFINITION_PATH";
-    else if (STR_EQ(name, "_ECCODES_ECMWF_TEST_SAMPLES_PATH")) old_name="_GRIB_API_ECMWF_TEST_SAMPLES_PATH";
-    else if (STR_EQ(name, "ECCODES_GRIB_JPEG")) old_name="GRIB_JPEG";
-    else if (STR_EQ(name, "ECCODES_GRIB_DUMP_JPG_FILE")) old_name="GRIB_DUMP_JPG_FILE";
-    else if (STR_EQ(name, "ECCODES_PRINT_MISSING")) old_name="GRIB_PRINT_MISSING";
-
-    result = getenv(name);
+    char* result = getenv(name);
     if (result == NULL) {
+        const char* old_name = name;
+
+        /* Test the most commonly used variables first */
+        if      (STR_EQ(name, "ECCODES_SAMPLES_PATH")) old_name="GRIB_SAMPLES_PATH";
+        else if (STR_EQ(name, "ECCODES_DEFINITION_PATH")) old_name="GRIB_DEFINITION_PATH";
+        else if (STR_EQ(name, "ECCODES_DEBUG")) old_name="GRIB_API_DEBUG";
+
+        else if (STR_EQ(name, "ECCODES_FAIL_IF_LOG_MESSAGE")) old_name="GRIB_API_FAIL_IF_LOG_MESSAGE";
+        else if (STR_EQ(name, "ECCODES_GRIB_WRITE_ON_FAIL")) old_name="GRIB_API_WRITE_ON_FAIL";
+        else if (STR_EQ(name, "ECCODES_GRIB_LARGE_CONSTANT_FIELDS")) old_name="GRIB_API_LARGE_CONSTANT_FIELDS";
+        else if (STR_EQ(name, "ECCODES_NO_ABORT")) old_name="GRIB_API_NO_ABORT";
+        else if (STR_EQ(name, "ECCODES_GRIBEX_MODE_ON")) old_name="GRIB_GRIBEX_MODE_ON";
+        else if (STR_EQ(name, "ECCODES_GRIB_IEEE_PACKING")) old_name="GRIB_IEEE_PACKING";
+        else if (STR_EQ(name, "ECCODES_IO_BUFFER_SIZE")) old_name="GRIB_API_IO_BUFFER_SIZE";
+        else if (STR_EQ(name, "ECCODES_LOG_STREAM")) old_name="GRIB_API_LOG_STREAM";
+        else if (STR_EQ(name, "ECCODES_GRIB_NO_BIG_GROUP_SPLIT")) old_name="GRIB_API_NO_BIG_GROUP_SPLIT";
+        else if (STR_EQ(name, "ECCODES_GRIB_NO_SPD")) old_name="GRIB_API_NO_SPD";
+        else if (STR_EQ(name, "ECCODES_GRIB_KEEP_MATRIX")) old_name="GRIB_API_KEEP_MATRIX";
+        else if (STR_EQ(name, "_ECCODES_ECMWF_TEST_DEFINITION_PATH")) old_name="_GRIB_API_ECMWF_TEST_DEFINITION_PATH";
+        else if (STR_EQ(name, "_ECCODES_ECMWF_TEST_SAMPLES_PATH")) old_name="_GRIB_API_ECMWF_TEST_SAMPLES_PATH";
+        else if (STR_EQ(name, "ECCODES_GRIB_JPEG")) old_name="GRIB_JPEG";
+        else if (STR_EQ(name, "ECCODES_GRIB_DUMP_JPG_FILE")) old_name="GRIB_DUMP_JPG_FILE";
+        else if (STR_EQ(name, "ECCODES_PRINT_MISSING")) old_name="GRIB_PRINT_MISSING";
+
         result = getenv(old_name);
     }
     return result;
diff --git a/src/grib_yacc.c b/src/grib_yacc.c
index 6bf85dc..9c433b8 100644
--- a/src/grib_yacc.c
+++ b/src/grib_yacc.c
@@ -653,16 +653,16 @@ union grib_yyalloc
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  214
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   1684
+#define YYLAST   1892
 
 /* YYNTOKENS -- Number of terminals.  */
 #define YYNTOKENS  144
 /* YYNNTS -- Number of nonterminals.  */
 #define YYNNTS  50
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  266
+#define YYNRULES  267
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  897
+#define YYNSTATES  903
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
@@ -725,28 +725,28 @@ static const grib_yytype_uint16 grib_yyprhs[] =
       49,    52,    55,    57,    59,    61,    63,    65,    67,    69,
       71,    73,    76,    78,    80,    82,    86,    88,    96,   107,
      115,   126,   134,   139,   147,   155,   163,   171,   176,   184,
-     192,   203,   211,   219,   230,   238,   249,   258,   271,   282,
-     290,   299,   308,   317,   328,   337,   347,   355,   358,   361,
-     366,   371,   376,   381,   386,   391,   396,   401,   406,   411,
-     416,   421,   426,   431,   436,   444,   451,   459,   462,   468,
-     474,   482,   487,   494,   502,   505,   512,   521,   530,   534,
-     540,   546,   552,   558,   565,   569,   573,   577,   581,   587,
-     590,   598,   603,   612,   623,   629,   635,   641,   647,   650,
-     657,   662,   666,   671,   676,   683,   690,   695,   698,   700,
-     706,   711,   714,   716,   722,   727,   732,   735,   741,   747,
-     749,   757,   769,   777,   789,   796,   804,   816,   821,   826,
-     829,   833,   835,   838,   840,   843,   845,   849,   851,   853,
-     855,   857,   859,   861,   863,   865,   867,   869,   871,   873,
-     875,   877,   886,   894,   902,   909,   919,   932,   947,   958,
-     973,   986,   995,  1007,  1014,  1024,  1037,  1048,  1063,  1076,
-    1085,  1097,  1099,  1102,  1104,  1107,  1114,  1127,  1129,  1132,
-    1137,  1148,  1158,  1166,  1172,  1178,  1184,  1190,  1192,  1195,
-    1200,  1207,  1213,  1219,  1228,  1230,  1239,  1241,  1243,  1245,
-    1247,  1249,  1251,  1255,  1258,  1262,  1267,  1271,  1273,  1277,
-    1281,  1285,  1289,  1293,  1295,  1300,  1307,  1314,  1321,  1330,
-    1335,  1339,  1343,  1345,  1349,  1353,  1357,  1361,  1365,  1369,
-    1373,  1376,  1378,  1382,  1384,  1388,  1390,  1392,  1394,  1396,
-    1401,  1404,  1406,  1409,  1411,  1419,  1421
+     192,   203,   211,   219,   230,   238,   249,   258,   267,   280,
+     291,   299,   308,   317,   326,   337,   346,   356,   364,   367,
+     370,   375,   380,   385,   390,   395,   400,   405,   410,   415,
+     420,   425,   430,   435,   440,   445,   453,   460,   468,   471,
+     477,   483,   491,   496,   503,   511,   514,   521,   530,   539,
+     543,   549,   555,   561,   567,   574,   578,   582,   586,   590,
+     596,   599,   607,   612,   621,   632,   638,   644,   650,   656,
+     659,   666,   671,   675,   680,   685,   692,   699,   704,   707,
+     709,   715,   720,   723,   725,   731,   736,   741,   744,   750,
+     756,   758,   766,   778,   786,   798,   805,   813,   825,   830,
+     835,   838,   842,   844,   847,   849,   852,   854,   858,   860,
+     862,   864,   866,   868,   870,   872,   874,   876,   878,   880,
+     882,   884,   886,   895,   903,   911,   918,   928,   941,   956,
+     967,   982,   995,  1004,  1016,  1023,  1033,  1046,  1057,  1072,
+    1085,  1094,  1106,  1108,  1111,  1113,  1116,  1123,  1136,  1138,
+    1141,  1146,  1157,  1167,  1175,  1181,  1187,  1193,  1199,  1201,
+    1204,  1209,  1216,  1222,  1228,  1237,  1239,  1248,  1250,  1252,
+    1254,  1256,  1258,  1260,  1264,  1267,  1271,  1276,  1280,  1282,
+    1286,  1290,  1294,  1298,  1302,  1304,  1309,  1316,  1323,  1330,
+    1339,  1344,  1348,  1352,  1354,  1358,  1362,  1366,  1370,  1374,
+    1378,  1382,  1385,  1387,  1391,  1393,  1397,  1399,  1401,  1403,
+    1405,  1410,  1413,  1415,  1418,  1420,  1428,  1430
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
@@ -778,123 +778,124 @@ static const grib_yytype_int16 grib_yyrhs[] =
       27,   131,   125,   132,   123,   161,   162,    -1,    27,   131,
      125,   132,   123,   129,   153,   130,   161,   162,    -1,    44,
      129,   125,   130,   123,   155,   161,   162,    -1,    44,   129,
-     125,   130,   123,   155,   161,    80,   131,   123,   132,   162,
-      -1,    44,   129,   125,   130,   123,   131,   153,   132,   161,
-     162,    -1,    45,   123,   131,   153,   132,   161,   162,    -1,
-     123,   133,    46,   131,   153,   132,   161,   162,    -1,   123,
-     133,    57,   131,   153,   132,   161,   162,    -1,    47,   129,
-     125,   130,   123,   155,   161,   162,    -1,    47,   129,   125,
-     130,   123,   131,   153,   132,   161,   162,    -1,   101,   129,
-     125,   130,   123,   155,   161,   162,    -1,    48,   129,   125,
-     130,   123,   131,   153,   132,   162,    -1,    55,   123,   131,
-     153,   132,   161,   162,    -1,    17,   123,    -1,    17,   124,
-      -1,    26,   123,   161,   162,    -1,    29,   123,   161,   162,
-      -1,    28,   123,   161,   162,    -1,    31,   123,   161,   162,
-      -1,    30,   123,   161,   162,    -1,    33,   123,   161,   162,
-      -1,    32,   123,   161,   162,    -1,    35,   123,   161,   162,
-      -1,    34,   123,   161,   162,    -1,    37,   123,   161,   162,
-      -1,    36,   123,   161,   162,    -1,    39,   123,   161,   162,
-      -1,    38,   123,   161,   162,    -1,    41,   123,   161,   162,
-      -1,    40,   123,   161,   162,    -1,    42,   123,   129,   153,
-     130,   161,   162,    -1,    26,   123,   134,   123,   161,   162,
-      -1,    26,   123,   129,   155,   130,   161,   162,    -1,    52,
-     123,    -1,    53,   123,   133,   155,   162,    -1,    54,   123,
-     133,   155,   162,    -1,    54,   123,   133,   135,   147,   136,
-     162,    -1,   126,   123,   161,   162,    -1,   126,   123,   134,
-     123,   161,   162,    -1,   126,   123,   129,   155,   130,   161,
-     162,    -1,    96,   123,    -1,    99,   129,   125,   130,   123,
-     161,    -1,    97,   129,   125,   130,   123,   131,   153,   132,
-      -1,    98,   129,   125,   130,   123,   131,   153,   132,    -1,
-     105,   123,   155,    -1,    89,   123,   131,   153,   132,    -1,
-      93,   123,   131,   153,   132,    -1,    94,   123,   131,   153,
-     132,    -1,    95,   123,   131,   153,   132,    -1,    91,   129,
-     125,   130,   123,   162,    -1,    92,   123,   162,    -1,    90,
-     123,   162,    -1,    10,   123,   124,    -1,    11,   123,   124,
-      -1,    49,   123,   133,   123,   162,    -1,    50,   123,    -1,
-      49,   123,   134,   123,   133,   123,   162,    -1,    50,   123,
-     134,   123,    -1,    51,   123,   123,   131,   153,   132,   161,
-     162,    -1,    51,   123,   134,   123,   123,   131,   153,   132,
-     161,   162,    -1,   102,   123,   131,   153,   132,    -1,   103,
-     123,   131,   153,   132,    -1,   104,   123,   131,   153,   132,
-      -1,    85,   123,   131,   153,   132,    -1,    86,   153,    -1,
-      87,   131,   123,   127,   123,   132,    -1,   106,   131,   187,
-     132,    -1,    62,   123,   162,    -1,    80,   123,   133,    76,
-      -1,    80,   123,   133,   187,    -1,    80,   123,   133,   135,
-     147,   136,    -1,    80,   123,   133,   135,   148,   136,    -1,
-      81,   123,   133,   187,    -1,    82,   124,    -1,    82,    -1,
-      82,   131,   125,   132,   124,    -1,    82,   131,   125,   132,
-      -1,    83,   124,    -1,    83,    -1,    83,   131,   125,   132,
-     124,    -1,    83,   131,   125,   132,    -1,     8,   131,   123,
-     132,    -1,    84,   124,    -1,    84,   131,   124,   132,   124,
-      -1,    84,   131,   123,   132,   124,    -1,    84,    -1,     4,
-     131,   187,   132,   135,   150,   136,    -1,     4,   131,   187,
-     132,   135,   150,   136,     6,   135,   150,   136,    -1,     5,
-     131,   187,   132,   135,   150,   136,    -1,     5,   131,   187,
-     132,   135,   150,   136,     6,   135,   150,   136,    -1,    79,
-     131,   187,   132,   159,   152,    -1,    79,   131,   187,   132,
-     135,   160,   136,    -1,    79,   131,   187,   132,   135,   160,
-     136,     6,   135,   160,   136,    -1,    80,   123,   133,   187,
-      -1,    81,   123,   133,   187,    -1,   159,   152,    -1,   160,
-     159,   152,    -1,   146,    -1,   133,   153,    -1,   146,    -1,
-     137,   163,    -1,   164,    -1,   163,   127,   164,    -1,    63,
-      -1,     3,    -1,    68,    -1,    67,    -1,    71,    -1,    74,
-      -1,    72,    -1,    75,    -1,    77,    -1,    78,    -1,    54,
-      -1,    64,    -1,    65,    -1,    66,    -1,   123,    18,   131,
-     187,   132,   135,   150,   136,    -1,    25,   131,   187,   132,
-     135,   150,   136,    -1,    12,   131,   153,   132,   135,   150,
-     136,    -1,    56,   123,   135,   169,   136,   162,    -1,    56,
-     123,   131,   123,   132,   135,   169,   136,   162,    -1,    56,
+     123,   130,   123,   155,   161,   162,    -1,    44,   129,   125,
+     130,   123,   155,   161,    80,   131,   123,   132,   162,    -1,
+      44,   129,   125,   130,   123,   131,   153,   132,   161,   162,
+      -1,    45,   123,   131,   153,   132,   161,   162,    -1,   123,
+     133,    46,   131,   153,   132,   161,   162,    -1,   123,   133,
+      57,   131,   153,   132,   161,   162,    -1,    47,   129,   125,
+     130,   123,   155,   161,   162,    -1,    47,   129,   125,   130,
+     123,   131,   153,   132,   161,   162,    -1,   101,   129,   125,
+     130,   123,   155,   161,   162,    -1,    48,   129,   125,   130,
+     123,   131,   153,   132,   162,    -1,    55,   123,   131,   153,
+     132,   161,   162,    -1,    17,   123,    -1,    17,   124,    -1,
+      26,   123,   161,   162,    -1,    29,   123,   161,   162,    -1,
+      28,   123,   161,   162,    -1,    31,   123,   161,   162,    -1,
+      30,   123,   161,   162,    -1,    33,   123,   161,   162,    -1,
+      32,   123,   161,   162,    -1,    35,   123,   161,   162,    -1,
+      34,   123,   161,   162,    -1,    37,   123,   161,   162,    -1,
+      36,   123,   161,   162,    -1,    39,   123,   161,   162,    -1,
+      38,   123,   161,   162,    -1,    41,   123,   161,   162,    -1,
+      40,   123,   161,   162,    -1,    42,   123,   129,   153,   130,
+     161,   162,    -1,    26,   123,   134,   123,   161,   162,    -1,
+      26,   123,   129,   155,   130,   161,   162,    -1,    52,   123,
+      -1,    53,   123,   133,   155,   162,    -1,    54,   123,   133,
+     155,   162,    -1,    54,   123,   133,   135,   147,   136,   162,
+      -1,   126,   123,   161,   162,    -1,   126,   123,   134,   123,
+     161,   162,    -1,   126,   123,   129,   155,   130,   161,   162,
+      -1,    96,   123,    -1,    99,   129,   125,   130,   123,   161,
+      -1,    97,   129,   125,   130,   123,   131,   153,   132,    -1,
+      98,   129,   125,   130,   123,   131,   153,   132,    -1,   105,
+     123,   155,    -1,    89,   123,   131,   153,   132,    -1,    93,
+     123,   131,   153,   132,    -1,    94,   123,   131,   153,   132,
+      -1,    95,   123,   131,   153,   132,    -1,    91,   129,   125,
+     130,   123,   162,    -1,    92,   123,   162,    -1,    90,   123,
+     162,    -1,    10,   123,   124,    -1,    11,   123,   124,    -1,
+      49,   123,   133,   123,   162,    -1,    50,   123,    -1,    49,
+     123,   134,   123,   133,   123,   162,    -1,    50,   123,   134,
+     123,    -1,    51,   123,   123,   131,   153,   132,   161,   162,
+      -1,    51,   123,   134,   123,   123,   131,   153,   132,   161,
+     162,    -1,   102,   123,   131,   153,   132,    -1,   103,   123,
+     131,   153,   132,    -1,   104,   123,   131,   153,   132,    -1,
+      85,   123,   131,   153,   132,    -1,    86,   153,    -1,    87,
+     131,   123,   127,   123,   132,    -1,   106,   131,   187,   132,
+      -1,    62,   123,   162,    -1,    80,   123,   133,    76,    -1,
+      80,   123,   133,   187,    -1,    80,   123,   133,   135,   147,
+     136,    -1,    80,   123,   133,   135,   148,   136,    -1,    81,
+     123,   133,   187,    -1,    82,   124,    -1,    82,    -1,    82,
+     131,   125,   132,   124,    -1,    82,   131,   125,   132,    -1,
+      83,   124,    -1,    83,    -1,    83,   131,   125,   132,   124,
+      -1,    83,   131,   125,   132,    -1,     8,   131,   123,   132,
+      -1,    84,   124,    -1,    84,   131,   124,   132,   124,    -1,
+      84,   131,   123,   132,   124,    -1,    84,    -1,     4,   131,
+     187,   132,   135,   150,   136,    -1,     4,   131,   187,   132,
+     135,   150,   136,     6,   135,   150,   136,    -1,     5,   131,
+     187,   132,   135,   150,   136,    -1,     5,   131,   187,   132,
+     135,   150,   136,     6,   135,   150,   136,    -1,    79,   131,
+     187,   132,   159,   152,    -1,    79,   131,   187,   132,   135,
+     160,   136,    -1,    79,   131,   187,   132,   135,   160,   136,
+       6,   135,   160,   136,    -1,    80,   123,   133,   187,    -1,
+      81,   123,   133,   187,    -1,   159,   152,    -1,   160,   159,
+     152,    -1,   146,    -1,   133,   153,    -1,   146,    -1,   137,
+     163,    -1,   164,    -1,   163,   127,   164,    -1,    63,    -1,
+       3,    -1,    68,    -1,    67,    -1,    71,    -1,    74,    -1,
+      72,    -1,    75,    -1,    77,    -1,    78,    -1,    54,    -1,
+      64,    -1,    65,    -1,    66,    -1,   123,    18,   131,   187,
+     132,   135,   150,   136,    -1,    25,   131,   187,   132,   135,
+     150,   136,    -1,    12,   131,   153,   132,   135,   150,   136,
+      -1,    56,   123,   135,   169,   136,   162,    -1,    56,   123,
+     131,   123,   132,   135,   169,   136,   162,    -1,    56,   123,
+     131,   123,   127,   124,   127,   123,   127,   123,   132,   162,
+      -1,    56,   123,   131,   123,   127,   124,   127,   123,   127,
+     123,   127,   123,   132,   162,    -1,    56,   123,   131,   123,
+     127,   124,   127,   123,   132,   162,    -1,    56,   123,   134,
      123,   131,   123,   127,   124,   127,   123,   127,   123,   132,
-     162,    -1,    56,   123,   131,   123,   127,   124,   127,   123,
-     127,   123,   127,   123,   132,   162,    -1,    56,   123,   131,
-     123,   127,   124,   127,   123,   132,   162,    -1,    56,   123,
-     134,   123,   131,   123,   127,   124,   127,   123,   127,   123,
-     132,   162,    -1,    56,   123,   134,   123,   131,   123,   127,
-     124,   127,   123,   132,   162,    -1,    56,   123,   134,   123,
-     135,   169,   136,   162,    -1,    56,   123,   134,   123,   131,
-     123,   132,   135,   169,   136,   162,    -1,    59,   123,   135,
-     169,   136,   162,    -1,    59,   123,   131,   123,   132,   135,
-     169,   136,   162,    -1,    59,   123,   131,   123,   127,   124,
-     127,   123,   127,   123,   132,   162,    -1,    59,   123,   131,
-     123,   127,   124,   127,   123,   132,   162,    -1,    59,   123,
-     134,   123,   131,   123,   127,   124,   127,   123,   127,   123,
-     132,   162,    -1,    59,   123,   134,   123,   131,   123,   127,
-     124,   127,   123,   132,   162,    -1,    59,   123,   134,   123,
-     135,   169,   136,   162,    -1,    59,   123,   134,   123,   131,
-     123,   132,   135,   169,   136,   162,    -1,   175,    -1,   169,
-     175,    -1,   178,    -1,   170,   178,    -1,    58,   123,   135,
-     170,   136,   162,    -1,    58,   123,   131,   123,   127,   124,
-     127,   123,   127,   123,   132,   162,    -1,   173,    -1,   172,
-     173,    -1,   108,   154,   137,   150,    -1,   109,   131,   153,
-     132,   135,   172,   110,   137,   150,   136,    -1,   109,   131,
-     153,   132,   135,   172,   110,   137,   136,    -1,   109,   131,
-     153,   132,   135,   172,   136,    -1,   124,   133,   135,   176,
-     136,    -1,   123,   133,   135,   176,   136,    -1,   125,   133,
-     135,   176,   136,    -1,   126,   133,   135,   176,   136,    -1,
-     177,    -1,   177,   176,    -1,   123,   133,   187,   128,    -1,
-     123,   133,   129,   149,   130,   128,    -1,   124,   133,   129,
-     149,   130,    -1,   123,   133,   129,   149,   130,    -1,   107,
-     131,   123,   127,   125,   127,   125,   132,    -1,   123,    -1,
-     107,   131,   124,   127,   125,   127,   125,   132,    -1,   124,
-      -1,   179,    -1,   125,    -1,   126,    -1,    60,    -1,    61,
-      -1,   131,   187,   132,    -1,   138,   180,    -1,   123,   131,
-     132,    -1,   123,   131,   153,   132,    -1,   180,   139,   181,
-      -1,   180,    -1,   182,   140,   181,    -1,   182,   141,   181,
-      -1,   182,   142,   181,    -1,   182,   117,   181,    -1,   182,
-     118,   181,    -1,   181,    -1,   100,   131,   123,   132,    -1,
-      19,   131,   123,   127,   124,   132,    -1,    20,   131,   123,
-     127,   124,   132,    -1,    21,   131,   123,   127,   125,   132,
-      -1,    21,   131,   123,   127,   125,   127,   125,   132,    -1,
-      21,   131,   123,   132,    -1,   183,   143,   182,    -1,   183,
-     138,   182,    -1,   182,    -1,   184,   116,   183,    -1,   184,
-     111,   183,    -1,   184,   115,   183,    -1,   184,   113,   183,
-      -1,   184,   114,   183,    -1,   184,   112,   183,    -1,   179,
-     122,   179,    -1,   121,   184,    -1,   183,    -1,   185,   119,
-     184,    -1,   184,    -1,   186,   120,   185,    -1,   185,    -1,
-     186,    -1,   191,    -1,   192,    -1,   123,   133,   187,   128,
-      -1,    88,   128,    -1,   189,    -1,   189,   190,    -1,   189,
-      -1,     4,   131,   187,   132,   135,   190,   136,    -1,   188,
-      -1,   188,   193,    -1
+     162,    -1,    56,   123,   134,   123,   131,   123,   127,   124,
+     127,   123,   132,   162,    -1,    56,   123,   134,   123,   135,
+     169,   136,   162,    -1,    56,   123,   134,   123,   131,   123,
+     132,   135,   169,   136,   162,    -1,    59,   123,   135,   169,
+     136,   162,    -1,    59,   123,   131,   123,   132,   135,   169,
+     136,   162,    -1,    59,   123,   131,   123,   127,   124,   127,
+     123,   127,   123,   132,   162,    -1,    59,   123,   131,   123,
+     127,   124,   127,   123,   132,   162,    -1,    59,   123,   134,
+     123,   131,   123,   127,   124,   127,   123,   127,   123,   132,
+     162,    -1,    59,   123,   134,   123,   131,   123,   127,   124,
+     127,   123,   132,   162,    -1,    59,   123,   134,   123,   135,
+     169,   136,   162,    -1,    59,   123,   134,   123,   131,   123,
+     132,   135,   169,   136,   162,    -1,   175,    -1,   169,   175,
+      -1,   178,    -1,   170,   178,    -1,    58,   123,   135,   170,
+     136,   162,    -1,    58,   123,   131,   123,   127,   124,   127,
+     123,   127,   123,   132,   162,    -1,   173,    -1,   172,   173,
+      -1,   108,   154,   137,   150,    -1,   109,   131,   153,   132,
+     135,   172,   110,   137,   150,   136,    -1,   109,   131,   153,
+     132,   135,   172,   110,   137,   136,    -1,   109,   131,   153,
+     132,   135,   172,   136,    -1,   124,   133,   135,   176,   136,
+      -1,   123,   133,   135,   176,   136,    -1,   125,   133,   135,
+     176,   136,    -1,   126,   133,   135,   176,   136,    -1,   177,
+      -1,   177,   176,    -1,   123,   133,   187,   128,    -1,   123,
+     133,   129,   149,   130,   128,    -1,   124,   133,   129,   149,
+     130,    -1,   123,   133,   129,   149,   130,    -1,   107,   131,
+     123,   127,   125,   127,   125,   132,    -1,   123,    -1,   107,
+     131,   124,   127,   125,   127,   125,   132,    -1,   124,    -1,
+     179,    -1,   125,    -1,   126,    -1,    60,    -1,    61,    -1,
+     131,   187,   132,    -1,   138,   180,    -1,   123,   131,   132,
+      -1,   123,   131,   153,   132,    -1,   180,   139,   181,    -1,
+     180,    -1,   182,   140,   181,    -1,   182,   141,   181,    -1,
+     182,   142,   181,    -1,   182,   117,   181,    -1,   182,   118,
+     181,    -1,   181,    -1,   100,   131,   123,   132,    -1,    19,
+     131,   123,   127,   124,   132,    -1,    20,   131,   123,   127,
+     124,   132,    -1,    21,   131,   123,   127,   125,   132,    -1,
+      21,   131,   123,   127,   125,   127,   125,   132,    -1,    21,
+     131,   123,   132,    -1,   183,   143,   182,    -1,   183,   138,
+     182,    -1,   182,    -1,   184,   116,   183,    -1,   184,   111,
+     183,    -1,   184,   115,   183,    -1,   184,   113,   183,    -1,
+     184,   114,   183,    -1,   184,   112,   183,    -1,   179,   122,
+     179,    -1,   121,   184,    -1,   183,    -1,   185,   119,   184,
+      -1,   184,    -1,   186,   120,   185,    -1,   185,    -1,   186,
+      -1,   191,    -1,   192,    -1,   123,   133,   187,   128,    -1,
+      88,   128,    -1,   189,    -1,   189,   190,    -1,   189,    -1,
+       4,   131,   187,   132,   135,   190,   136,    -1,   188,    -1,
+     188,   193,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
@@ -905,28 +906,28 @@ static const grib_yytype_uint16 grib_yyrline[] =
      294,   297,   298,   299,   300,   301,   302,   303,   304,   305,
      309,   310,   313,   314,   317,   318,   321,   325,   328,   331,
      334,   337,   340,   343,   346,   349,   352,   355,   359,   362,
-     365,   368,   371,   374,   377,   380,   383,   386,   390,   393,
-     396,   399,   402,   405,   408,   411,   414,   417,   420,   423,
-     427,   430,   433,   436,   439,   442,   445,   448,   451,   454,
-     457,   460,   463,   466,   469,   473,   476,   479,   482,   485,
-     487,   490,   493,   496,   499,   502,   505,   508,   511,   514,
-     517,   520,   523,   526,   529,   532,   534,   536,   539,   542,
-     545,   549,   553,   556,   559,   571,   583,   595,   598,   601,
-     603,   606,   609,   610,   611,   612,   614,   617,   618,   619,
-     620,   621,   622,   623,   624,   626,   627,   628,   629,   630,
-     634,   635,   636,   637,   641,   642,   643,   646,   647,   650,
-     651,   655,   656,   659,   660,   663,   664,   667,   668,   669,
-     670,   671,   672,   673,   674,   675,   676,   677,   678,   679,
-     680,   683,   686,   689,   692,   693,   694,   695,   696,   697,
-     698,   699,   700,   701,   702,   703,   704,   705,   706,   707,
-     708,   712,   713,   716,   717,   720,   721,   724,   725,   728,
-     732,   733,   734,   737,   739,   741,   743,   747,   748,   751,
-     752,   756,   758,   762,   763,   764,   765,   768,   769,   770,
-     772,   773,   774,   775,   776,   777,   781,   782,   785,   786,
-     787,   788,   789,   790,   791,   792,   793,   794,   795,   796,
-     799,   800,   801,   804,   806,   807,   808,   809,   810,   811,
-     816,   817,   820,   821,   824,   825,   828,   834,   835,   838,
-     839,   842,   843,   846,   850,   853,   854
+     365,   368,   371,   374,   377,   380,   383,   386,   397,   401,
+     404,   407,   410,   413,   416,   419,   422,   425,   428,   431,
+     434,   438,   441,   444,   447,   450,   453,   456,   459,   462,
+     465,   468,   471,   474,   477,   480,   484,   487,   490,   493,
+     496,   498,   501,   504,   507,   510,   513,   516,   519,   522,
+     525,   528,   531,   534,   537,   540,   543,   545,   547,   550,
+     553,   556,   560,   564,   567,   570,   582,   594,   606,   609,
+     612,   614,   617,   620,   621,   622,   623,   625,   628,   629,
+     630,   631,   632,   633,   634,   635,   637,   638,   639,   640,
+     641,   645,   646,   647,   648,   652,   653,   654,   657,   658,
+     661,   662,   666,   667,   670,   671,   674,   675,   678,   679,
+     680,   681,   682,   683,   684,   685,   686,   687,   688,   689,
+     690,   691,   694,   697,   700,   703,   704,   705,   706,   707,
+     708,   709,   710,   711,   712,   713,   714,   715,   716,   717,
+     718,   719,   723,   724,   727,   728,   731,   732,   735,   736,
+     739,   743,   744,   745,   748,   750,   752,   754,   758,   759,
+     762,   763,   767,   769,   773,   774,   775,   776,   779,   780,
+     781,   783,   784,   785,   786,   787,   788,   792,   793,   796,
+     797,   798,   799,   800,   801,   802,   803,   804,   805,   806,
+     807,   810,   811,   812,   815,   817,   818,   819,   820,   821,
+     822,   827,   828,   831,   832,   835,   836,   839,   845,   846,
+     849,   850,   853,   854,   857,   861,   864,   865
 };
 #endif
 
@@ -1011,19 +1012,19 @@ static const grib_yytype_uint8 grib_yyr1[] =
      156,   156,   156,   156,   156,   156,   156,   156,   156,   156,
      156,   156,   156,   156,   156,   156,   156,   156,   156,   156,
      156,   156,   156,   156,   156,   156,   156,   156,   156,   156,
-     157,   157,   157,   157,   158,   158,   158,   159,   159,   160,
-     160,   161,   161,   162,   162,   163,   163,   164,   164,   164,
+     156,   157,   157,   157,   157,   158,   158,   158,   159,   159,
+     160,   160,   161,   161,   162,   162,   163,   163,   164,   164,
      164,   164,   164,   164,   164,   164,   164,   164,   164,   164,
-     164,   165,   166,   167,   168,   168,   168,   168,   168,   168,
+     164,   164,   165,   166,   167,   168,   168,   168,   168,   168,
      168,   168,   168,   168,   168,   168,   168,   168,   168,   168,
-     168,   169,   169,   170,   170,   171,   171,   172,   172,   173,
-     174,   174,   174,   175,   175,   175,   175,   176,   176,   177,
-     177,   178,   178,   179,   179,   179,   179,   180,   180,   180,
-     180,   180,   180,   180,   180,   180,   181,   181,   182,   182,
+     168,   168,   169,   169,   170,   170,   171,   171,   172,   172,
+     173,   174,   174,   174,   175,   175,   175,   175,   176,   176,
+     177,   177,   178,   178,   179,   179,   179,   179,   180,   180,
+     180,   180,   180,   180,   180,   180,   180,   181,   181,   182,
      182,   182,   182,   182,   182,   182,   182,   182,   182,   182,
-     183,   183,   183,   184,   184,   184,   184,   184,   184,   184,
-     184,   184,   185,   185,   186,   186,   187,   188,   188,   189,
-     189,   190,   190,   191,   192,   193,   193
+     182,   183,   183,   183,   184,   184,   184,   184,   184,   184,
+     184,   184,   184,   185,   185,   186,   186,   187,   188,   188,
+     189,   189,   190,   190,   191,   192,   193,   193
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
@@ -1034,28 +1035,28 @@ static const grib_yytype_uint8 grib_yyr2[] =
        2,     2,     1,     1,     1,     1,     1,     1,     1,     1,
        1,     2,     1,     1,     1,     3,     1,     7,    10,     7,
       10,     7,     4,     7,     7,     7,     7,     4,     7,     7,
-      10,     7,     7,    10,     7,    10,     8,    12,    10,     7,
-       8,     8,     8,    10,     8,     9,     7,     2,     2,     4,
+      10,     7,     7,    10,     7,    10,     8,     8,    12,    10,
+       7,     8,     8,     8,    10,     8,     9,     7,     2,     2,
        4,     4,     4,     4,     4,     4,     4,     4,     4,     4,
-       4,     4,     4,     4,     7,     6,     7,     2,     5,     5,
-       7,     4,     6,     7,     2,     6,     8,     8,     3,     5,
-       5,     5,     5,     6,     3,     3,     3,     3,     5,     2,
-       7,     4,     8,    10,     5,     5,     5,     5,     2,     6,
-       4,     3,     4,     4,     6,     6,     4,     2,     1,     5,
-       4,     2,     1,     5,     4,     4,     2,     5,     5,     1,
-       7,    11,     7,    11,     6,     7,    11,     4,     4,     2,
-       3,     1,     2,     1,     2,     1,     3,     1,     1,     1,
+       4,     4,     4,     4,     4,     7,     6,     7,     2,     5,
+       5,     7,     4,     6,     7,     2,     6,     8,     8,     3,
+       5,     5,     5,     5,     6,     3,     3,     3,     3,     5,
+       2,     7,     4,     8,    10,     5,     5,     5,     5,     2,
+       6,     4,     3,     4,     4,     6,     6,     4,     2,     1,
+       5,     4,     2,     1,     5,     4,     4,     2,     5,     5,
+       1,     7,    11,     7,    11,     6,     7,    11,     4,     4,
+       2,     3,     1,     2,     1,     2,     1,     3,     1,     1,
        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     8,     7,     7,     6,     9,    12,    14,    10,    14,
-      12,     8,    11,     6,     9,    12,    10,    14,    12,     8,
-      11,     1,     2,     1,     2,     6,    12,     1,     2,     4,
-      10,     9,     7,     5,     5,     5,     5,     1,     2,     4,
-       6,     5,     5,     8,     1,     8,     1,     1,     1,     1,
-       1,     1,     3,     2,     3,     4,     3,     1,     3,     3,
-       3,     3,     3,     1,     4,     6,     6,     6,     8,     4,
-       3,     3,     1,     3,     3,     3,     3,     3,     3,     3,
-       2,     1,     3,     1,     3,     1,     1,     1,     1,     4,
-       2,     1,     2,     1,     7,     1,     2
+       1,     1,     8,     7,     7,     6,     9,    12,    14,    10,
+      14,    12,     8,    11,     6,     9,    12,    10,    14,    12,
+       8,    11,     1,     2,     1,     2,     6,    12,     1,     2,
+       4,    10,     9,     7,     5,     5,     5,     5,     1,     2,
+       4,     6,     5,     5,     8,     1,     8,     1,     1,     1,
+       1,     1,     1,     3,     2,     3,     4,     3,     1,     3,
+       3,     3,     3,     3,     1,     4,     6,     6,     6,     8,
+       4,     3,     3,     1,     3,     3,     3,     3,     3,     3,
+       3,     2,     1,     3,     1,     3,     1,     1,     1,     1,
+       4,     2,     1,     2,     1,     7,     1,     2
 };
 
 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
@@ -1068,208 +1069,210 @@ static const grib_yytype_uint16 grib_yydefact[] =
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,   128,   132,   139,     0,     8,     0,     0,     0,     0,
+       0,   129,   133,   140,     0,     8,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     2,     5,    17,     0,    22,    28,    23,    24,    25,
-      26,     3,     4,    27,    29,   191,   193,   265,   263,   257,
-     258,     6,     0,     0,     0,     0,     0,     0,     0,     8,
-       0,     8,     8,     0,    67,    68,     0,     8,     0,     0,
+      26,     3,     4,    27,    29,   192,   194,   266,   264,   258,
+     259,     6,     0,     0,     0,     0,     0,     0,     0,     8,
+       0,     8,     8,     0,    68,    69,     0,     8,     0,     0,
        8,     8,     8,     8,     8,     8,     8,     8,     8,     8,
        8,     8,     8,     8,     0,     0,     0,     0,     0,     0,
-       0,   109,     0,    87,     0,     0,     0,     0,     0,     0,
-       8,     0,     0,     0,   127,     0,   131,     0,   136,     0,
-       0,     0,     0,     0,   220,   221,     0,     0,     0,   214,
-     216,   218,   219,     0,     0,    32,   118,    33,    34,   217,
-     227,   233,   242,   251,   253,   255,   256,    36,     0,   260,
-       0,     8,     0,     8,     0,     0,     0,    94,     0,     0,
+       0,   110,     0,    88,     0,     0,     0,     0,     0,     0,
+       8,     0,     0,     0,   128,     0,   132,     0,   137,     0,
+       0,     0,     0,     0,   221,   222,     0,     0,     0,   215,
+     217,   219,   220,     0,     0,    32,   119,    33,    34,   218,
+     228,   234,   243,   252,   254,   256,   257,    36,     0,   261,
+       0,     8,     0,     8,     0,     0,     0,    95,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     8,     0,     0,
        0,     0,     8,     0,     1,     0,     0,     0,    20,    18,
-      21,     0,     0,     0,   192,     0,     0,   194,     0,     0,
-     266,     0,     0,     0,     0,     0,   106,   107,     0,     0,
-       8,     8,   151,     8,     8,     0,     0,     0,     0,     8,
+      21,     0,     0,     0,   193,     0,     0,   195,     0,     0,
+     267,     0,     0,     0,     0,     0,   107,   108,     0,     0,
+       8,     8,   152,     8,     8,     0,     0,     0,     0,     8,
        0,     0,     8,     8,     8,     8,     8,     8,     8,     8,
-       8,     8,     8,     8,     8,     8,     8,     0,     0,     8,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     8,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,   153,
-     121,     0,     0,     0,     0,     0,     0,     0,     8,     0,
-       0,     0,     0,     0,   250,     0,     0,   217,   223,     0,
+       8,     8,     8,     8,     8,     8,     8,     0,     0,     0,
+       8,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       8,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     154,   122,     0,     0,     0,     0,     0,     0,     0,     8,
+       0,     0,     0,     0,     0,   251,     0,     0,   218,   224,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     8,   105,
-       0,   104,     8,     8,     8,     0,     0,     0,     0,     8,
-       8,     8,    98,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     8,
-       0,     0,     0,    19,     0,     0,     0,     0,     0,     0,
-       0,     0,   135,     0,     0,     0,     0,     0,   152,    42,
-      47,     0,     0,     0,     8,    69,     0,     0,    71,    70,
-      73,    72,    75,    74,    77,    76,    79,    78,    81,    80,
-      83,    82,     0,     0,     0,     0,     0,     0,     8,     0,
-     111,     8,     0,     8,     0,     8,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,   158,   167,   157,   168,   169,
-     170,   160,   159,   161,   163,   162,   164,   165,   166,   154,
-     155,     0,   122,     0,   123,   126,   130,   134,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,   224,     0,   222,
-      35,   214,   249,   226,   231,   232,   228,   229,   230,   241,
-     240,   244,   248,   246,   247,   245,   243,   252,   254,     0,
+     106,     0,   105,     8,     8,     8,     0,     0,     0,     0,
+       8,     8,     8,    99,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,   120,     0,     0,     8,     8,     8,     8,     8,
-      15,     0,     0,     0,   207,   259,     0,     0,     0,     0,
-       8,    91,     0,     0,     0,     0,     0,     8,     8,     0,
-       8,     8,     8,     8,     0,     8,     8,     8,     8,     8,
-       8,     0,     8,     0,     0,   108,     0,     0,     0,    88,
-      11,     9,     0,    89,     8,     0,     0,     0,     0,     8,
-       0,     8,     0,     0,     0,     0,     8,     0,     0,     0,
-       0,     0,    13,     0,     0,   129,   133,   138,   137,   117,
-       0,     0,     0,   239,   234,     0,     0,   225,     0,    99,
-       8,   100,   101,   102,     0,     0,     8,     0,   114,   115,
-     116,     0,     0,     0,     0,     0,     0,     0,     0,   212,
-       0,   204,   208,   211,   203,   205,     8,     8,   206,     0,
-       0,     0,     0,   261,     0,     0,     8,     8,     8,     8,
-       0,     8,     8,     8,     8,     0,     8,    85,     8,     8,
-       8,     8,     8,     8,     8,     8,     8,     8,     8,     8,
-       8,     8,     8,     8,     0,     8,     8,     0,     0,     0,
-       0,   174,     0,   195,     0,     0,     0,     0,   183,   156,
-       0,     0,     0,     0,    30,   144,   124,     0,   125,     0,
-       0,     0,     0,     0,   119,   103,     8,     8,    95,     8,
-       0,     0,   197,     0,     8,     8,     8,     8,     8,    16,
-       0,     0,     8,    92,     0,     0,     0,   140,   262,   264,
-     142,     0,    37,     0,    39,   173,    41,    48,    43,    51,
-     172,    86,     0,    52,     0,    54,    84,     0,    49,     0,
-      36,     8,    59,     0,     8,     0,   110,     8,     0,    12,
-      10,    90,    66,     0,     0,     0,     0,     8,     0,     0,
-       0,     0,     0,     8,     0,     0,   149,   145,     0,    31,
-      14,   235,   236,     0,   237,     0,     0,     0,     0,     8,
-       0,     0,   202,   198,     0,    44,    46,    45,     8,     8,
-       0,   209,    93,     0,     0,     8,     8,     8,     8,     8,
-       8,     0,    56,     8,    62,     8,   112,     8,     0,     8,
-       0,     0,   181,     0,     0,     8,     0,     0,   189,   147,
-     148,     0,   150,     0,     0,     0,    96,    97,    64,     0,
-       0,   171,    60,    61,     0,     0,     0,     8,     8,     8,
-       8,     8,     8,     0,     8,    65,     8,     0,     8,   175,
-       0,     0,     0,     0,     8,   184,     0,     0,     0,   238,
-     213,   215,   199,   201,     0,   210,     0,     0,    38,    40,
-      53,    55,    50,    58,     0,    63,   113,     0,   178,     0,
-       8,     0,     0,   186,     0,     8,     0,   200,   141,   143,
-       8,     0,     8,     0,     8,   182,     8,     8,     0,     8,
-     190,   146,    57,     0,   176,     0,   180,   196,   185,     0,
-     188,     8,     8,     8,   177,   179,   187
+       8,     0,     0,     0,    19,     0,     0,     0,     0,     0,
+       0,     0,     0,   136,     0,     0,     0,     0,     0,   153,
+      42,    47,     0,     0,     0,     8,    70,     0,     0,    72,
+      71,    74,    73,    76,    75,    78,    77,    80,    79,    82,
+      81,    84,    83,     0,     0,     0,     0,     0,     0,     0,
+       8,     0,   112,     8,     0,     8,     0,     8,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   159,   168,   158,
+     169,   170,   171,   161,   160,   162,   164,   163,   165,   166,
+     167,   155,   156,     0,   123,     0,   124,   127,   131,   135,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   225,
+       0,   223,    35,   215,   250,   227,   232,   233,   229,   230,
+     231,   242,   241,   245,   249,   247,   248,   246,   244,   253,
+     255,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,   121,     0,     0,     8,     8,     8,
+       8,     8,    15,     0,     0,     0,   208,   260,     0,     0,
+       0,     0,     8,    92,     0,     0,     0,     0,     0,     8,
+       8,     0,     8,     8,     8,     8,     0,     8,     8,     8,
+       8,     8,     8,     0,     0,     8,     0,     0,   109,     0,
+       0,     0,    89,    11,     9,     0,    90,     8,     0,     0,
+       0,     0,     8,     0,     8,     0,     0,     0,     0,     8,
+       0,     0,     0,     0,     0,    13,     0,     0,   130,   134,
+     139,   138,   118,     0,     0,     0,   240,   235,     0,     0,
+     226,     0,   100,     8,   101,   102,   103,     0,     0,     8,
+       0,   115,   116,   117,     0,     0,     0,     0,     0,     0,
+       0,     0,   213,     0,   205,   209,   212,   204,   206,     8,
+       8,   207,     0,     0,     0,     0,   262,     0,     0,     8,
+       8,     8,     8,     0,     8,     8,     8,     8,     0,     8,
+      86,     8,     8,     8,     8,     8,     8,     8,     8,     8,
+       8,     8,     8,     8,     8,     8,     8,     8,     0,     8,
+       8,     0,     0,     0,     0,   175,     0,   196,     0,     0,
+       0,     0,   184,   157,     0,     0,     0,     0,    30,   145,
+     125,     0,   126,     0,     0,     0,     0,     0,   120,   104,
+       8,     8,    96,     8,     0,     0,   198,     0,     8,     8,
+       8,     8,     8,    16,     0,     0,     8,    93,     0,     0,
+       0,   141,   263,   265,   143,     0,    37,     0,    39,   174,
+      41,    48,    43,    51,   173,    87,     0,    52,     0,    54,
+      85,     0,    49,     8,     0,    36,     8,    60,     0,     8,
+       0,   111,     8,     0,    12,    10,    91,    67,     0,     0,
+       0,     0,     8,     0,     0,     0,     0,     0,     8,     0,
+       0,   150,   146,     0,    31,    14,   236,   237,     0,   238,
+       0,     0,     0,     0,     8,     0,     0,   203,   199,     0,
+      44,    46,    45,     8,     8,     0,   210,    94,     0,     0,
+       8,     8,     8,     8,     8,    57,     8,     0,    56,     8,
+      63,     8,   113,     8,     0,     8,     0,     0,   182,     0,
+       0,     8,     0,     0,   190,   148,   149,     0,   151,     0,
+       0,     0,    97,    98,    65,     0,     0,   172,    61,    62,
+       0,     0,     0,     8,     8,     8,     8,     8,     8,     0,
+       8,    66,     8,     0,     8,   176,     0,     0,     0,     0,
+       8,   185,     0,     0,     0,   239,   214,   216,   200,   202,
+       0,   211,     0,     0,    38,    40,    53,    55,    50,    59,
+       0,    64,   114,     0,   179,     0,     8,     0,     0,   187,
+       0,     8,     0,   201,   142,   144,     8,     0,     8,     0,
+       8,   183,     8,     8,     0,     8,   191,   147,    58,     0,
+     177,     0,   181,   197,   186,     0,   189,     8,     8,     8,
+     178,   180,   188
 };
 
 /* YYDEFGOTO[NTERM-NUM].  */
 static const grib_yytype_int16 grib_yydefgoto[] =
 {
-      -1,    80,   289,   542,   564,   501,   612,    83,   665,   176,
-     177,   178,    84,    85,    86,   662,   663,   243,   290,   439,
-     440,    87,    88,    89,    90,    91,    92,    93,   681,   682,
-      94,    95,   503,   504,    96,   179,   180,   181,   182,   183,
-     184,   185,   186,   187,    97,   613,   614,    99,   100,   101
+      -1,    80,   290,   545,   567,   503,   615,    83,   669,   176,
+     177,   178,    84,    85,    86,   666,   667,   243,   291,   441,
+     442,    87,    88,    89,    90,    91,    92,    93,   685,   686,
+      94,    95,   505,   506,    96,   179,   180,   181,   182,   183,
+     184,   185,   186,   187,    97,   616,   617,    99,   100,   101
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -651
+#define YYPACT_NINF -654
 static const grib_yytype_int16 grib_yypact[] =
 {
-    1124,  -651,  -109,   -76,   -70,    52,   -14,    40,    59,    81,
-      96,   101,   132,   -54,   103,   146,   268,   158,   166,   171,
-     183,   193,   200,   218,   249,   278,   286,   297,   299,   300,
-     302,   304,   301,   306,   314,   313,   321,   328,   331,   339,
-     340,   342,   343,   344,   345,   346,   350,   351,   347,   352,
-     353,   -18,   -12,    56,   354,   780,   348,   -36,   357,   358,
-     359,   364,   366,   367,   368,   369,   365,   370,   376,   377,
-     372,   373,   375,   384,   362,   378,     7,   381,   388,   -75,
-     508,  -651,  -651,  1227,   382,  -651,  -651,  -651,  -651,  -651,
-    -651,   227,    78,  -651,  -651,  -651,  -651,    16,  -651,  -651,
-    -651,  -651,   780,   780,   406,   411,   413,   407,   415,   780,
-     416,   269,   409,   418,  -651,  -651,   780,    92,   419,   420,
-     409,   409,   409,   409,   409,   409,   409,   409,   409,   409,
-     409,   409,   409,   409,   417,   423,   427,   424,   429,   431,
-     222,   425,  -104,  -651,   428,   430,   426,    57,   -40,   178,
-     403,   780,   432,   434,  -651,   439,  -651,   443,  -651,   267,
-     440,   442,   447,   448,  -651,  -651,   449,   450,   780,   452,
-    -651,  -651,  -651,   780,   -45,  -651,  -651,  -651,   457,   463,
-     453,  -651,    44,   -86,    39,   468,   473,  -651,   465,  -651,
-     464,   403,   445,   403,   466,   469,   470,  -651,   471,   477,
-     479,   481,   476,   478,   482,   780,   780,   780,   483,   176,
-    -108,   459,   110,   475,  -651,   485,     8,   489,  1455,  -651,
-    -651,   486,   491,   493,  -651,   495,   496,  -651,   487,   499,
-    -651,   502,   504,   505,   509,   517,  -651,  -651,   518,   521,
-     780,   780,  -651,   403,   403,   523,   525,   780,   532,   403,
-     528,   527,   403,   403,   403,   403,   403,   403,   403,   403,
-     403,   403,   403,   403,   403,   403,   780,   530,   535,   780,
-     536,   537,   539,   545,   546,   540,   547,   780,   451,   780,
-     549,   550,   227,   551,    78,   552,   553,   227,  1521,  -651,
-    -651,   563,   696,   780,   564,   565,   567,   568,   780,   555,
-     556,   578,   579,   281,    39,    82,   571,  -651,  -651,   780,
-     -60,   -45,   -45,   -45,   -45,   -45,   -45,  1546,  1546,  1546,
-    1546,  1546,  1546,  1546,  1546,   780,   780,   577,   780,  -651,
-     575,  -651,   780,   780,   780,   576,   580,   581,   583,   780,
-     780,   780,  -651,   582,   586,   780,   588,   589,   590,   592,
-     594,   584,   585,   480,   584,   585,   585,   780,   607,   403,
-     585,   780,    43,  -651,   572,   597,   604,   606,   780,   780,
-     605,   609,  -651,   618,   622,   612,   284,   616,  -651,  -651,
-    -651,   629,   619,   623,   409,  -651,   632,   635,  -651,  -651,
-    -651,  -651,  -651,  -651,  -651,  -651,  -651,  -651,  -651,  -651,
-    -651,  -651,   630,   636,   638,   631,   639,   641,   403,   637,
-    -651,   780,   645,   403,   287,   403,   642,    77,   -20,    23,
-     644,   -49,    84,   -11,   106,  -651,  -651,  -651,  -651,  -651,
-    -651,  -651,  -651,  -651,  -651,  -651,  -651,  -651,  -651,   646,
-    -651,   -27,  -651,   259,  -651,  -651,   651,   652,   653,   654,
-     647,   666,   667,   108,   663,   671,   675,  -651,   672,  -651,
-    -651,  -651,  -651,  -651,  -651,  -651,  -651,  -651,  -651,    44,
-      44,   -86,   -86,   -86,   -86,   -86,   -86,    39,   468,   682,
-     676,   688,   680,   681,   686,   691,   700,   701,   702,   698,
-     703,   704,  -651,   634,   705,   780,   780,   780,   780,   780,
-    -651,    -9,   695,   697,   585,  -651,   111,   707,   708,   709,
-     409,  -651,   711,   706,   713,  1352,  1455,   -61,   175,  1455,
-     409,   409,   409,   409,  1455,   409,   403,   189,   196,   409,
-     214,  1502,   409,  1511,   718,  -651,   727,   719,   721,  -651,
-    -651,  -651,   -42,  -651,   409,   736,   726,   739,   227,   403,
-     741,   403,   742,   728,   745,   227,   403,  1521,   753,   755,
-     334,   751,  -651,   -39,   -37,  -651,  -651,  -651,  -651,  -651,
-     758,   759,   760,  -651,  -651,   761,   763,  -651,   757,  -651,
-     403,  -651,  -651,  -651,   762,   766,   409,   780,  -651,  -651,
-    -651,   783,   764,   770,   775,   776,   777,   778,   773,  -651,
-     746,  -651,  -651,  -651,  -651,  -651,   409,   403,  -651,   779,
-     781,    27,   784,   -64,   785,   792,   780,   403,   780,   403,
-     794,   403,   403,   403,   403,   796,   403,  -651,   780,   403,
-     780,   403,   403,   780,   403,   780,   409,   403,   780,   409,
-     780,   403,   409,   780,   293,   403,   403,   786,   227,   120,
-     134,  -651,   788,  -651,   790,   227,   122,   139,  -651,  -651,
-     801,   803,   751,   -63,  -651,   791,  -651,   813,  -651,   806,
-     808,   123,   814,   816,  -651,  -651,   780,   780,  -651,   409,
-     780,   -26,  -651,  1455,   403,   403,   403,   409,   409,  -651,
-     584,   817,   403,  -651,  1455,   -64,   835,   906,  -651,  -651,
-     938,   818,  -651,   819,  -651,  -651,  -651,  -651,  -651,  -651,
-    -651,  -651,   820,  -651,   821,  -651,  -651,   822,  -651,   815,
-     571,   -66,  -651,   823,   403,   825,  -651,   403,   830,  -651,
-    -651,  -651,  -651,   831,   154,   829,   811,   403,   840,   841,
-     252,   843,   833,   403,   780,   780,   791,   963,   751,  -651,
-    -651,  -651,  -651,   846,  -651,   847,   849,   844,   848,   403,
-     850,   851,  -651,  -651,   842,  -651,  -651,  -651,   403,   403,
-     244,  -651,  -651,   854,   855,   409,   409,   409,   409,   409,
-     409,   852,  -651,   409,  -651,   403,  -651,   409,   140,   403,
-     858,   227,  -651,   859,   141,   403,   864,   227,  -651,  -651,
-    -651,   857,   791,   861,   862,   863,  -651,  -651,  -651,  1455,
-     995,  -651,  -651,  -651,   873,  1455,  1455,   403,   403,   403,
-     403,   403,   403,   879,   403,  -651,   403,   890,   403,  -651,
-     891,   256,   892,   893,   403,  -651,   894,   270,   334,  -651,
-    -651,  -651,  -651,  -651,   882,  -651,   883,   905,  -651,  -651,
-    -651,  -651,  -651,  -651,   920,  -651,  -651,   155,  -651,   159,
-     403,   923,   924,  -651,   161,   403,   -31,  -651,  -651,  -651,
-     403,   935,   403,   936,   403,  -651,   403,   403,   937,   403,
-    -651,  -651,  -651,   929,  -651,   930,  -651,  -651,  -651,   931,
-    -651,   403,   403,   403,  -651,  -651,  -651
+    1435,  -654,   -24,   -10,     8,    65,   -67,   115,   162,   147,
+     186,   202,   204,    64,   200,   213,    82,   245,   249,   253,
+     264,   277,   281,   282,   284,   285,   287,   288,   289,   290,
+     291,   292,   293,   295,   294,   300,   303,   296,   297,   298,
+     308,   311,   312,   315,   316,   318,   319,   320,   258,   321,
+     322,   -16,   -12,    61,   323,   847,   305,   324,   325,   327,
+     326,   328,   333,   334,   335,   337,   332,   347,   348,   349,
+     356,   357,   358,   361,   354,   355,     7,   283,   314,   -79,
+     487,  -654,  -654,  1538,   360,  -654,  -654,  -654,  -654,  -654,
+    -654,   256,   128,  -654,  -654,  -654,  -654,    18,  -654,  -654,
+    -654,  -654,   847,   847,   366,   365,   367,   369,   370,   847,
+     371,   157,   362,   372,  -654,  -654,   847,    38,   373,   374,
+     362,   362,   362,   362,   362,   362,   362,   362,   362,   362,
+     362,   362,   362,   362,   380,   375,   187,   379,   376,   386,
+     221,   381,   -47,  -654,   383,   387,   382,   193,   -94,   195,
+     377,   847,   390,   398,  -654,   394,  -654,   413,  -654,   251,
+     411,   414,   418,   419,  -654,  -654,   420,   422,   847,   423,
+    -654,  -654,  -654,   847,   109,  -654,  -654,  -654,   364,   433,
+     405,  -654,   -75,   -20,   149,   437,   441,  -654,   434,  -654,
+     431,   377,   438,   377,   435,   436,   442,  -654,   439,   443,
+     444,   449,   447,   448,   450,   847,   847,   847,   454,   235,
+     -76,   445,    66,   451,  -654,   459,     9,   468,  1766,  -654,
+    -654,   460,   462,   463,  -654,   464,   469,  -654,   461,   470,
+    -654,   473,   474,   481,   471,   485,  -654,  -654,   491,   500,
+     847,   847,  -654,   377,   377,   501,   502,   847,   509,   377,
+     503,   505,   377,   377,   377,   377,   377,   377,   377,   377,
+     377,   377,   377,   377,   377,   377,   847,   510,   512,   527,
+     847,   528,   529,   538,   543,   546,   504,   548,   847,   539,
+     847,   549,   550,   256,   553,   128,   555,   556,   256,   544,
+    -654,  -654,   535,   302,   847,   551,   552,   558,   563,   847,
+     557,   559,   575,   578,   260,   149,   568,   570,  -654,  -654,
+     847,   -84,   109,   109,   109,   109,   109,   109,    84,    84,
+      84,    84,    84,    84,    84,    84,   847,   847,   554,   847,
+    -654,   574,  -654,   847,   847,   847,   577,   579,   580,   595,
+     847,   847,   847,  -654,   573,   594,   847,   596,   597,   598,
+     599,   600,   607,   610,   606,   607,   610,   610,   847,   612,
+     377,   610,   847,    11,  -654,   601,   602,   615,   616,   847,
+     847,   611,   614,  -654,   624,   627,   617,   262,   619,  -654,
+    -654,  -654,   630,   620,   626,   362,  -654,   634,   635,  -654,
+    -654,  -654,  -654,  -654,  -654,  -654,  -654,  -654,  -654,  -654,
+    -654,  -654,  -654,   629,   637,   638,   640,   633,   643,   644,
+     377,   639,  -654,   847,   645,   377,   266,   377,   641,    41,
+     -11,   -78,   647,   -54,    87,    55,   -74,  -654,  -654,  -654,
+    -654,  -654,  -654,  -654,  -654,  -654,  -654,  -654,  -654,  -654,
+    -654,   648,  -654,   -49,  -654,   -36,  -654,  -654,   646,   652,
+     653,   654,   649,   655,   656,    94,   658,   657,   665,  -654,
+     663,  -654,  -654,  -654,  -654,  -654,  -654,  -654,  -654,  -654,
+    -654,   -75,   -75,   -20,   -20,   -20,   -20,   -20,   -20,   149,
+     437,   673,   667,   674,   668,   669,   670,   681,   682,   683,
+     687,   679,   680,   685,  -654,   636,   686,   847,   847,   847,
+     847,   847,  -654,   -56,   690,   677,   610,  -654,    93,   678,
+     688,   650,   362,  -654,   689,   694,   695,  1663,  1766,   108,
+     215,  1766,   362,   362,   362,   362,  1766,   362,   377,   224,
+     236,   362,   238,   847,   946,   362,  1036,   697,  -654,   696,
+     699,   698,  -654,  -654,  -654,   -52,  -654,   362,   709,   703,
+     717,   256,   377,   719,   377,   722,   706,   727,   256,   377,
+     544,   729,   730,   313,   651,  -654,   -35,   -34,  -654,  -654,
+    -654,  -654,  -654,   732,   733,   737,  -654,  -654,   739,   740,
+    -654,   726,  -654,   377,  -654,  -654,  -654,   723,   738,   362,
+     847,  -654,  -654,  -654,   762,   736,   742,   744,   745,   747,
+     748,   757,  -654,   788,  -654,  -654,  -654,  -654,  -654,   362,
+     377,  -654,   750,   752,    10,   754,   -62,   755,   756,   847,
+     377,   847,   377,   758,   377,   377,   377,   377,   760,   377,
+    -654,   847,   377,   847,   377,   377,   847,   377,   362,   847,
+     362,   377,   847,   362,   847,   377,   362,   847,   271,   377,
+     377,   766,   256,    97,   -45,  -654,   770,  -654,   774,   256,
+     104,   -27,  -654,  -654,   769,   771,   651,   -63,  -654,   775,
+    -654,   759,  -654,   773,   778,   117,   789,   791,  -654,  -654,
+     847,   847,  -654,   362,   847,   -72,  -654,  1766,   377,   377,
+     377,   362,   362,  -654,   607,   787,   377,  -654,  1766,   -62,
+     182,   866,  -654,  -654,   914,   794,  -654,   795,  -654,  -654,
+    -654,  -654,  -654,  -654,  -654,  -654,   797,  -654,   798,  -654,
+    -654,   799,  -654,   377,   800,   570,   -65,  -654,   802,   377,
+     803,  -654,   377,   805,  -654,  -654,  -654,  -654,   807,    39,
+     814,   786,   377,   808,   817,    53,   819,   806,   377,   847,
+     847,   775,   938,   651,  -654,  -654,  -654,  -654,   820,  -654,
+     821,   823,   818,   824,   377,   812,   816,  -654,  -654,   815,
+    -654,  -654,  -654,   377,   377,   100,  -654,  -654,   822,   825,
+     362,   362,   362,   362,   362,  -654,   362,   828,  -654,   362,
+    -654,   377,  -654,   362,   121,   377,   834,   256,  -654,   835,
+     145,   377,   836,   256,  -654,  -654,  -654,   829,   775,   837,
+     843,   845,  -654,  -654,  -654,  1766,  1306,  -654,  -654,  -654,
+     827,  1766,  1766,   377,   377,   377,   377,   377,   377,   856,
+     377,  -654,   377,   857,   377,  -654,   858,    57,   859,   863,
+     377,  -654,   864,   144,   313,  -654,  -654,  -654,  -654,  -654,
+     852,  -654,   853,   854,  -654,  -654,  -654,  -654,  -654,  -654,
+     860,  -654,  -654,   151,  -654,   152,   377,   861,   862,  -654,
+     159,   377,   -51,  -654,  -654,  -654,   377,   868,   377,   872,
+     377,  -654,   377,   377,   873,   377,  -654,  -654,  -654,   865,
+    -654,   867,  -654,  -654,  -654,   870,  -654,   377,   377,   377,
+    -654,  -654,  -654
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const grib_yytype_int16 grib_yypgoto[] =
 {
-    -651,  -651,     5,   621,  -651,  -348,     0,  -651,  -650,   -13,
-    -307,  -201,  -651,  -651,  -651,  -440,   228,   -89,   105,  -651,
-     510,  -651,  -651,  -651,  -651,  -231,   787,  -651,  -651,   387,
-    -651,   -88,  -347,  -651,   -81,  -145,   895,   133,   135,   137,
-    -161,   744,  -651,    42,  -651,    10,   460,  -651,  -651,   968
+    -654,  -654,     5,   564,  -654,  -351,     0,  -654,  -653,   242,
+    -307,  -184,  -654,  -654,  -654,  -442,   154,   591,   210,  -654,
+     440,  -654,  -654,  -654,  -654,  -264,   718,  -654,  -654,   329,
+    -654,   -89,  -345,  -654,   -82,  -165,   830,   -15,    80,    -6,
+    -160,   691,  -654,   -96,  -654,    14,   392,  -654,  -654,   913
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
@@ -1278,354 +1281,396 @@ static const grib_yytype_int16 grib_yypgoto[] =
 #define YYTABLE_NINF -9
 static const grib_yytype_int16 grib_yytable[] =
 {
-      82,   561,   460,   224,   342,    81,   506,   304,   507,   508,
-      98,   227,   746,   512,   781,   164,   165,   558,   559,   275,
-     228,   354,   102,   244,    57,   208,   208,   355,   249,   307,
-     276,   252,   253,   254,   255,   256,   257,   258,   259,   260,
-     261,   262,   263,   264,   265,   208,   383,   167,   212,   558,
-     559,   419,   317,   558,   559,   103,   424,   318,   213,   229,
-     175,   104,   167,   461,   170,   346,   347,   348,   616,   114,
-     115,   288,   241,   747,   225,   226,   413,   415,   169,   170,
-     171,   172,   680,   219,   761,   644,   173,   551,   644,   349,
-     667,   283,   189,   174,   645,   284,   238,   666,   802,   668,
-     350,   161,   162,   163,    57,   881,   154,    98,   560,   107,
-     762,   547,   156,   155,   175,   548,   242,   242,   598,   157,
-     554,   599,   242,   359,   555,   242,   242,   242,   242,   242,
-     242,   242,   242,   242,   242,   242,   242,   242,   242,   229,
-     209,   362,   164,   165,   231,   232,   221,   222,    78,   223,
-     319,   320,   321,   322,   323,   324,   509,   602,   246,   549,
-     696,   312,   313,   108,   477,   462,   307,   307,   307,   307,
-     307,   307,   307,   307,   307,   307,   307,   307,   307,   307,
-     158,   105,   166,   106,   314,   315,   316,   159,   280,   167,
-     109,   281,   282,   291,   344,   161,   162,   163,   346,   347,
-     348,   225,   226,   168,   545,   169,   170,   171,   172,   546,
-     110,   552,   175,   173,   457,   306,   553,   242,   363,   111,
-     174,   247,   349,   748,   112,   241,   248,   377,   378,   221,
-     222,    78,   223,   350,   116,   572,   164,   165,   598,   357,
-     573,   603,   556,   241,   358,   175,   175,   735,   343,   741,
-     753,   353,   736,   402,   742,   754,   405,   221,   222,    78,
-     223,   113,   221,   222,    78,   223,   416,   827,   833,   117,
-     737,   175,   828,   834,   175,   743,   166,   221,   222,    78,
-     223,   120,   871,   167,   175,   450,   873,   872,   878,   121,
-     789,   874,   458,   879,   122,   526,   329,   168,   331,   169,
-     170,   171,   172,   175,   618,   351,   123,   173,   241,   285,
-     175,   352,   286,   287,   174,   480,   124,   650,   628,   482,
-     483,   484,   241,   125,   657,   630,   489,   490,   491,   241,
-     636,   224,   639,   175,   444,   445,   224,   175,   175,   175,
-     227,   126,   770,   633,   175,   175,   175,   241,   379,   380,
-     221,   222,    78,   223,   385,   272,   273,   388,   389,   390,
-     391,   392,   393,   394,   395,   396,   397,   398,   399,   400,
-     401,   598,   127,   760,   814,   221,   222,    78,   223,   221,
-     222,    78,   223,   562,   540,   541,   679,   494,   795,   242,
-     296,   297,   860,   221,   222,    78,   223,   118,   537,   119,
-     240,   128,   241,   513,   455,   456,   865,   520,   521,   129,
-     514,   353,   540,   541,   558,   559,   175,   734,   729,   730,
-     130,   607,   131,   132,   740,   133,   748,   134,   617,   619,
-     135,   621,   622,   623,   624,   136,   626,   137,   629,   631,
-     632,   634,   138,   637,   463,   464,   465,   466,   467,   468,
-     139,   140,   469,   470,   141,   646,   471,   472,   473,   474,
-     475,   476,   142,   143,   511,   144,   145,   146,   147,   148,
-     161,   162,   163,   149,   150,   152,   153,   160,   151,   188,
-     190,   191,   593,   594,   595,   596,   597,   193,   192,   194,
-     195,   196,   197,   206,   198,   202,   203,   678,   204,   199,
-     175,   175,   175,   175,   175,   200,   201,   205,   214,   207,
-     220,   164,   165,   535,   210,   242,   615,   692,   539,   620,
-     543,   211,   242,   242,   625,   242,   242,   242,   242,   233,
-     242,   236,   242,   242,   242,   242,   234,   242,   235,   237,
-     288,   239,   241,   245,   250,   251,   266,   721,   267,   242,
-     724,   166,   268,   727,   270,   269,   271,   279,   167,   274,
-     831,   277,   224,   278,   294,   292,   837,   293,   295,   224,
-     330,   298,   168,   299,   169,   170,   171,   172,   300,   301,
-     302,   303,   173,   305,   309,   310,   414,   325,   327,   174,
-     759,   242,   311,   326,   356,   328,   335,   332,   768,   769,
-     333,   334,   336,   701,   337,   703,   338,   339,   505,   340,
-     360,   242,   212,   341,   345,   712,   361,   714,   368,   364,
-     717,   175,   719,   175,   365,   723,   213,   725,   366,   367,
-     728,   627,   369,   175,   370,   175,   371,   372,   175,   373,
-     175,   242,   691,   175,   242,   175,   224,   242,   175,   374,
-     375,   376,   224,   381,   651,   384,   653,   382,   386,   387,
-     403,   658,   408,   757,   758,   404,   406,   407,   409,   410,
-     412,   411,   417,   418,   420,   422,   423,   720,   451,   452,
-     720,   175,   175,   764,   242,   675,   817,   818,   819,   820,
-     821,   822,   242,   242,   824,   441,   446,   447,   826,   448,
-     449,   453,   454,   459,   479,   481,   485,   352,   502,   500,
-     486,   487,   693,   488,   492,   161,   162,   163,   493,   495,
-     496,   497,   702,   498,   704,   499,   706,   707,   708,   709,
-     510,   711,   355,   351,   713,   354,   715,   716,   353,   718,
-     515,   517,   722,   224,   516,   518,   726,   519,   522,   224,
-     731,   732,   523,   525,   524,   527,   164,   165,   528,   530,
-     529,   531,   533,   532,   534,   161,   162,   163,   538,   591,
-     536,   550,   442,   557,   544,   565,   566,   567,   568,   569,
-     242,   242,   242,   242,   242,   242,   799,   800,   242,   765,
-     766,   767,   242,   570,   571,   574,   166,   772,   575,   161,
-     162,   163,   576,   167,   577,   578,   164,   165,   579,   842,
-     844,   580,   581,   582,   584,   846,   847,   168,   583,   169,
-     170,   171,   172,   585,   586,   587,   782,   173,   600,   784,
-     588,   443,   786,   601,   174,   589,   590,   592,   609,   606,
-     164,   165,   792,   604,   605,   610,   166,   608,   798,   640,
-     641,   642,   643,   167,   161,   162,   163,   346,   347,   348,
-     647,   648,   649,   655,   808,   652,   654,   168,   656,   169,
-     170,   171,   172,   812,   813,   690,   660,   173,   661,   664,
-     166,   349,   669,   670,   174,   671,   672,   167,   673,   674,
-     825,   680,   350,   676,   829,   164,   165,   677,   689,   683,
-     835,   168,   684,   169,   170,   171,   172,   685,   686,   687,
-     688,   173,   773,   733,   694,   738,   695,   739,   174,   749,
-     697,   699,   848,   849,   850,   851,   852,   853,   700,   855,
-     705,   856,   710,   858,   744,   166,   745,   750,   751,   863,
-     752,   755,   167,   756,   774,   771,   791,   780,   775,   776,
-     777,   778,   779,   790,   788,   783,   168,   785,   169,   170,
-     171,   172,   787,   793,   794,   875,   173,   796,   797,   801,
-     880,   803,   804,   174,   805,   882,   806,   884,   811,   886,
-     807,   887,   888,   823,   890,   830,   832,   809,   810,   815,
-     816,   836,   838,   839,   840,   841,   894,   895,   896,   215,
-       3,   845,   854,     4,     5,     6,     7,     8,     9,    10,
-      11,    12,    13,   857,   859,   861,   862,   864,   867,   868,
-      14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
-      24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
-      34,   869,    35,    36,    37,    38,    39,    40,    41,    42,
-      43,    44,   870,    45,    46,   876,   877,    47,   883,   885,
-     889,   891,   892,   893,   563,   230,   866,   659,   763,   308,
-     478,   421,     0,   698,    48,    49,    50,    51,    52,    53,
-      54,    55,    56,     0,    58,    59,    60,    61,    62,    63,
-      64,    65,    66,    67,    68,     0,    69,    70,    71,    72,
-      73,    74,     0,     0,    75,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,   216,     0,
-       0,   217,     0,     0,    -8,     1,     0,     0,     2,     3,
-       0,   843,     4,     5,     6,     7,     8,     9,    10,    11,
-      12,    13,     0,     0,     0,     0,     0,     0,     0,    14,
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
-       0,    35,    36,    37,    38,    39,    40,    41,    42,    43,
-      44,     0,    45,    46,     0,     0,    47,     0,     0,     0,
+      82,   564,   224,   462,   508,    81,   231,   232,   305,   308,
+     227,   509,   510,   751,    98,   787,   514,   561,   562,   421,
+     246,   343,   228,   167,   426,   208,    57,   208,   208,   561,
+     562,   561,   562,   347,   348,   349,   684,   284,   766,   463,
+     170,   285,   313,   314,   212,   221,   222,    78,   223,   221,
+     222,    78,   223,   355,   213,   292,   107,   350,   552,   356,
+     175,   229,   559,   384,   767,   315,   316,   317,   351,   225,
+     226,   601,   289,   752,   602,   648,   276,   307,   221,   222,
+      78,   223,   554,   219,   649,   887,   563,   277,   565,   543,
+     544,   742,   648,   671,   415,   417,   221,   222,    78,   223,
+     808,   670,   672,   161,   162,   163,    57,   102,   154,   748,
+     344,    98,   156,   354,   175,   155,   242,   242,   318,   157,
+     550,   103,   242,   319,   551,   242,   242,   242,   242,   242,
+     242,   242,   242,   242,   242,   242,   242,   242,   242,   104,
+     209,   229,   363,   700,   164,   165,   464,   308,   308,   308,
+     308,   308,   308,   308,   308,   308,   308,   308,   308,   308,
+     308,   605,   221,   222,    78,   223,   479,   247,   548,   164,
+     165,   241,   248,   549,   511,   795,   221,   222,    78,   223,
+     221,   222,    78,   223,   166,   158,   557,   114,   115,   801,
+     558,   167,   159,   866,   105,   358,   106,   446,   447,   241,
+     359,   161,   162,   163,   347,   348,   349,   169,   170,   171,
+     172,   118,   175,   119,   555,   173,   167,   242,   364,   556,
+     601,   575,   174,   606,   740,   753,   576,   601,   350,   741,
+     820,   746,   169,   170,   171,   172,   747,   619,   108,   351,
+     173,   241,   164,   165,   758,   175,   175,   174,   833,   759,
+     496,   225,   226,   834,   161,   162,   163,   347,   348,   349,
+     320,   321,   322,   323,   324,   325,   515,   221,   222,    78,
+     223,   175,   839,   516,   354,   175,   110,   840,   877,   879,
+     871,   350,   166,   878,   880,   175,   884,   654,   240,   167,
+     241,   885,   351,   109,   661,   164,   165,   465,   466,   467,
+     468,   469,   470,   168,   175,   169,   170,   171,   172,   111,
+     268,   175,   269,   173,   473,   474,   475,   476,   477,   478,
+     174,   161,   162,   163,   281,   112,   286,   282,   283,   287,
+     288,   116,   224,   113,   175,   166,   117,   224,   175,   175,
+     175,   227,   167,   775,   621,   175,   175,   175,   241,   638,
+     640,   238,   643,   631,   273,   274,   168,   241,   169,   170,
+     171,   172,   164,   165,   352,   633,   173,   636,   120,   241,
+     353,   241,   121,   174,   297,   298,   122,   765,   444,   221,
+     222,    78,   223,   457,   458,   522,   523,   123,   739,   151,
+     242,   543,   544,   561,   562,   745,   734,   735,   471,   472,
+     124,   330,   166,   332,   125,   126,   683,   127,   128,   167,
+     129,   130,   131,   132,   133,   134,   210,   137,   175,   140,
+     141,   142,   135,   168,   136,   169,   170,   171,   172,   138,
+     753,   143,   139,   173,   144,   145,   188,   445,   146,   147,
+     174,   148,   149,   150,   152,   153,   160,   211,   190,   345,
+     191,   193,   189,   380,   381,   192,   194,   195,   196,   386,
+     197,   198,   389,   390,   391,   392,   393,   394,   395,   396,
+     397,   398,   399,   400,   401,   402,   199,   200,   201,   202,
+     203,   204,   378,   379,   205,   206,   207,   214,   220,   233,
+     234,   310,   235,   236,   237,   241,   239,   245,   250,   251,
+     267,   271,   175,   175,   175,   175,   175,   695,   403,   266,
+     270,   272,   407,   280,   289,   275,   278,   242,   618,   295,
+     279,   623,   418,   293,   242,   242,   628,   242,   242,   242,
+     242,   294,   242,   837,   242,   242,   242,   242,   296,   843,
+     242,   452,   299,   725,   312,   300,   725,   427,   460,   301,
+     302,   303,   242,   304,   306,   311,   326,   328,   161,   162,
+     163,   327,   329,   331,   336,   224,   333,   334,   337,   338,
+     513,   482,   224,   335,   339,   484,   485,   486,   340,   341,
+     357,   342,   491,   492,   493,   346,   361,   161,   162,   163,
+     362,   212,   369,   365,   242,   366,   213,   367,   428,   164,
+     165,   374,   368,   370,   354,   371,   372,   429,   430,   431,
+     432,   433,   434,   373,   242,   435,   436,   375,   437,   438,
+     538,   439,   440,   376,   175,   542,   175,   546,   164,   165,
+     377,   382,   385,   387,   383,   413,   175,   388,   175,   166,
+     404,   175,   405,   242,   175,   242,   167,   175,   242,   175,
+     224,   242,   175,   805,   806,   540,   224,   406,   408,   409,
+     168,   410,   169,   170,   171,   172,   411,   443,   166,   412,
+     173,   414,   419,   420,   416,   167,   422,   174,   424,   425,
+     453,   481,   454,   448,   449,   175,   175,   769,   242,   168,
+     450,   169,   170,   171,   172,   451,   242,   242,   455,   173,
+     459,   456,   461,   244,   483,   494,   174,   487,   249,   488,
+     489,   252,   253,   254,   255,   256,   257,   258,   259,   260,
+     261,   262,   263,   264,   265,   490,   495,   497,   498,   499,
+     500,   501,   502,   504,   507,   512,   353,   356,   630,   596,
+     597,   598,   599,   600,   352,   355,   517,   519,   224,   518,
+     520,   524,   521,   525,   224,   526,   527,   529,   530,   531,
+     532,   533,   655,   534,   657,   535,   536,   537,   541,   662,
+     568,   594,   539,   547,   553,   560,   569,   570,   571,   668,
+     609,   572,   573,   574,   578,   242,   242,   242,   242,   242,
+     577,   242,   579,   679,   242,   580,   581,   583,   242,   582,
+     584,   585,   586,   360,   587,   588,   589,   161,   162,   163,
+     590,   591,   592,   604,   607,   848,   850,   593,   595,   645,
+     697,   852,   853,   603,   608,   611,   612,   613,   644,   647,
+     706,   646,   708,   651,   710,   711,   712,   713,   652,   715,
+     653,   659,   717,   656,   719,   720,   658,   722,   164,   165,
+     660,   727,   664,   665,   680,   731,   673,   674,   678,   736,
+     737,   705,   675,   707,   676,   677,   161,   162,   163,   681,
+     684,   687,   778,   716,   688,   718,   689,   690,   721,   691,
+     692,   724,   693,   755,   728,   698,   730,   699,   166,   733,
+     701,   703,   704,   738,   709,   167,   714,   743,   770,   771,
+     772,   744,   749,   754,   750,   756,   777,   164,   165,   168,
+     757,   169,   170,   171,   172,   776,   760,   694,   761,   173,
+     779,   797,   762,   763,   780,   781,   174,   782,   783,   784,
+     794,   799,   786,   785,   789,   791,   788,   793,   796,   790,
+     800,   803,   792,   802,   807,   809,   810,   166,   811,   815,
+     812,   817,   798,   816,   167,   851,   813,   821,   804,   829,
+     822,   836,   838,   842,   844,   161,   162,   163,   168,   845,
+     169,   170,   171,   172,   814,   846,   528,   847,   173,   860,
+     863,   865,   867,   818,   819,   174,   868,   870,   873,   874,
+     875,   889,   876,   882,   883,   891,   895,   897,   872,   898,
+     663,   831,   899,   423,   309,   835,   164,   165,   702,   566,
+     230,   841,     0,     0,   768,     0,     0,     0,   480,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,    48,    49,    50,    51,    52,    53,    54,
-      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
-      65,    66,    67,    68,     0,    69,    70,    71,    72,    73,
-      74,   215,     3,    75,     0,     4,     5,     6,     7,     8,
-       9,    10,    11,    12,    13,     0,     0,    76,    77,    78,
-      79,     0,    14,    15,    16,    17,    18,    19,    20,    21,
-      22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
-      32,    33,    34,     0,    35,    36,    37,    38,    39,    40,
-      41,    42,    43,    44,     0,    45,    46,     0,     0,    47,
+       0,     0,     0,   854,   855,   856,   857,   858,   859,     0,
+     861,     0,   862,     0,   864,     0,   166,     0,     0,     0,
+     869,     0,     0,   167,     0,   161,   162,   163,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   168,     0,   169,
+     170,   171,   172,     0,     0,     0,   881,   639,     0,     0,
+       0,   886,     0,     0,   174,     0,   888,     0,   890,     0,
+     892,     0,   893,   894,     0,   896,   164,   165,     0,     0,
+       0,     0,     0,   610,     0,     0,     0,   900,   901,   902,
+     620,   622,     0,   624,   625,   626,   627,     0,   629,     0,
+     632,   634,   635,   637,     0,     0,   641,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,   166,     0,   650,     0,
+       0,     0,     0,   167,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   168,     0,   169,
+     170,   171,   172,     0,     0,     0,     0,   642,     0,     0,
+       0,     0,     0,     0,   174,     0,     0,     0,     0,     0,
+     682,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     696,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   723,
+       0,   726,     0,     0,   729,     0,     0,   732,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,    48,    49,    50,    51,
-      52,    53,    54,    55,    56,     0,    58,    59,    60,    61,
-      62,    63,    64,    65,    66,    67,    68,     0,    69,    70,
-      71,    72,    73,    74,     0,     0,    75,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-     216,     0,     0,   217,     0,   218,   215,     3,     0,     0,
-       4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
-       0,     0,     0,     0,     0,     0,     0,    14,    15,    16,
-      17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
-      27,    28,    29,    30,    31,    32,    33,    34,     0,    35,
-      36,    37,    38,    39,    40,    41,    42,    43,    44,     0,
-      45,    46,     0,     0,    47,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,    48,    49,    50,    51,    52,    53,    54,    55,    56,
-      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
-      67,    68,     0,    69,    70,    71,    72,    73,    74,   215,
-       3,    75,     0,     4,     5,     6,     7,     8,     9,    10,
-      11,    12,    13,     0,     0,   611,     0,     0,   217,     0,
+       0,     0,     0,     0,   764,     0,     0,     0,     0,     0,
+       0,     0,   773,   774,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     215,     3,     0,     0,     4,     5,     6,     7,     8,     9,
+      10,    11,    12,    13,     0,     0,     0,     0,     0,     0,
+       0,    14,    15,    16,    17,    18,    19,    20,    21,    22,
+      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
+      33,    34,     0,    35,    36,    37,    38,    39,    40,    41,
+      42,    43,    44,     0,    45,    46,     0,     0,    47,     0,
+       0,   823,   824,   825,   826,   827,     0,   828,     0,     0,
+     830,     0,     0,     0,   832,    48,    49,    50,    51,    52,
+      53,    54,    55,    56,     0,    58,    59,    60,    61,    62,
+      63,    64,    65,    66,    67,    68,     0,    69,    70,    71,
+      72,    73,    74,     0,     0,    75,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   216,
+       0,     0,   217,     0,     0,    -8,     1,     0,     0,     2,
+       3,     0,   849,     4,     5,     6,     7,     8,     9,    10,
+      11,    12,    13,     0,     0,     0,     0,     0,     0,     0,
       14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
       24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
       34,     0,    35,    36,    37,    38,    39,    40,    41,    42,
       43,    44,     0,    45,    46,     0,     0,    47,     0,     0,
-       0,   161,   162,   163,   425,     0,     0,     0,     0,     0,
-     161,   162,   163,     0,    48,    49,    50,    51,    52,    53,
-      54,    55,    56,     0,    58,    59,    60,    61,    62,    63,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,    48,    49,    50,    51,    52,    53,
+      54,    55,    56,    57,    58,    59,    60,    61,    62,    63,
       64,    65,    66,    67,    68,     0,    69,    70,    71,    72,
-      73,    74,   164,   165,    75,   161,   162,   163,     0,     0,
-       0,   164,   165,     0,     0,   426,     0,     0,   216,     0,
-       0,   217,     0,     0,   427,   428,   429,   430,   431,   432,
-       0,     0,   433,   434,     0,   435,   436,     0,   437,   438,
-       0,     0,   166,     0,     0,     0,   164,   165,     0,   167,
-       0,   166,     0,     0,     0,     0,     0,     0,   167,     0,
-       0,     0,     0,   168,     0,   169,   170,   171,   172,     0,
-       0,     0,   168,   635,   169,   170,   171,   172,     0,     0,
-     174,     0,   638,     0,     0,     0,   166,     0,     0,   174,
-       0,     0,     0,   167,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,   169,
-     170,   171,   172,     0,     0,     0,     0,   173,     0,     0,
-       0,     0,     0,     0,   174
+      73,    74,   215,     3,    75,     0,     4,     5,     6,     7,
+       8,     9,    10,    11,    12,    13,     0,     0,    76,    77,
+      78,    79,     0,    14,    15,    16,    17,    18,    19,    20,
+      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
+      31,    32,    33,    34,     0,    35,    36,    37,    38,    39,
+      40,    41,    42,    43,    44,     0,    45,    46,     0,     0,
+      47,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,    48,    49,    50,
+      51,    52,    53,    54,    55,    56,     0,    58,    59,    60,
+      61,    62,    63,    64,    65,    66,    67,    68,     0,    69,
+      70,    71,    72,    73,    74,     0,     0,    75,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,   216,     0,     0,   217,     0,   218,   215,     3,     0,
+       0,     4,     5,     6,     7,     8,     9,    10,    11,    12,
+      13,     0,     0,     0,     0,     0,     0,     0,    14,    15,
+      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+      26,    27,    28,    29,    30,    31,    32,    33,    34,     0,
+      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
+       0,    45,    46,     0,     0,    47,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,    48,    49,    50,    51,    52,    53,    54,    55,
+      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
+      66,    67,    68,     0,    69,    70,    71,    72,    73,    74,
+     215,     3,    75,     0,     4,     5,     6,     7,     8,     9,
+      10,    11,    12,    13,     0,     0,   614,     0,     0,   217,
+       0,    14,    15,    16,    17,    18,    19,    20,    21,    22,
+      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
+      33,    34,     0,    35,    36,    37,    38,    39,    40,    41,
+      42,    43,    44,     0,    45,    46,     0,     0,    47,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,    48,    49,    50,    51,    52,
+      53,    54,    55,    56,     0,    58,    59,    60,    61,    62,
+      63,    64,    65,    66,    67,    68,     0,    69,    70,    71,
+      72,    73,    74,     0,     0,    75,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   216,
+       0,     0,   217
 };
 
 #define grib_yypact_value_is_default(Yystate) \
-  (!!((Yystate) == (-651)))
+  (!!((Yystate) == (-654)))
 
 #define grib_yytable_value_is_error(Yytable_value) \
   YYID (0)
 
 static const grib_yytype_int16 grib_yycheck[] =
 {
-       0,   441,   309,    91,   205,     0,   354,   168,   355,   356,
-       0,    92,   662,   360,    80,    60,    61,    80,    81,   123,
-       4,   129,   131,   112,    88,    18,    18,   135,   117,   174,
-     134,   120,   121,   122,   123,   124,   125,   126,   127,   128,
-     129,   130,   131,   132,   133,    18,   247,   107,   123,    80,
-      81,   282,   138,    80,    81,   131,   287,   143,   133,   123,
-      55,   131,   107,   123,   124,    22,    23,    24,   129,   123,
-     124,   137,   133,   136,   123,   124,   277,   278,   123,   124,
-     125,   126,   108,    83,   110,   127,   131,   136,   127,    46,
-     127,   131,   128,   138,   136,   135,   109,   136,   748,   136,
-      57,    19,    20,    21,    88,   136,   124,    97,   135,   123,
-     136,   131,   124,   131,   109,   135,   111,   112,   127,   131,
-     131,   130,   117,   212,   135,   120,   121,   122,   123,   124,
-     125,   126,   127,   128,   129,   130,   131,   132,   133,   123,
-     133,   133,    60,    61,   102,   103,   123,   124,   125,   126,
-     111,   112,   113,   114,   115,   116,   357,   504,   116,   136,
-     133,   117,   118,   123,   325,   310,   311,   312,   313,   314,
+       0,   443,    91,   310,   355,     0,   102,   103,   168,   174,
+      92,   356,   357,   666,     0,    80,   361,    80,    81,   283,
+     116,   205,     4,   107,   288,    18,    88,    18,    18,    80,
+      81,    80,    81,    22,    23,    24,   108,   131,   110,   123,
+     124,   135,   117,   118,   123,   123,   124,   125,   126,   123,
+     124,   125,   126,   129,   133,   151,   123,    46,   136,   135,
+      55,   123,   136,   247,   136,   140,   141,   142,    57,   123,
+     124,   127,   137,   136,   130,   127,   123,   173,   123,   124,
+     125,   126,   136,    83,   136,   136,   135,   134,   124,   125,
+     126,   136,   127,   127,   278,   279,   123,   124,   125,   126,
+     753,   136,   136,    19,    20,    21,    88,   131,   124,   136,
+     206,    97,   124,   209,   109,   131,   111,   112,   138,   131,
+     131,   131,   117,   143,   135,   120,   121,   122,   123,   124,
+     125,   126,   127,   128,   129,   130,   131,   132,   133,   131,
+     133,   123,   133,   133,    60,    61,   311,   312,   313,   314,
      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
-     124,   129,   100,   131,   140,   141,   142,   131,   131,   107,
-     131,   134,   135,   151,   207,    19,    20,    21,    22,    23,
-      24,   123,   124,   121,   127,   123,   124,   125,   126,   132,
-     129,   127,   207,   131,   132,   173,   132,   212,   218,   123,
-     138,   129,    46,   663,   123,   133,   134,   240,   241,   123,
-     124,   125,   126,    57,   131,   127,    60,    61,   127,   129,
-     132,   130,   136,   133,   134,   240,   241,   127,   206,   127,
-     127,   209,   132,   266,   132,   132,   269,   123,   124,   125,
-     126,   129,   123,   124,   125,   126,   279,   127,   127,   123,
-     136,   266,   132,   132,   269,   136,   100,   123,   124,   125,
-     126,   123,   127,   107,   279,   298,   127,   132,   127,   123,
-     136,   132,   305,   132,   123,   384,   191,   121,   193,   123,
-     124,   125,   126,   298,   129,   129,   123,   131,   133,   131,
-     305,   135,   134,   135,   138,   328,   123,   548,   129,   332,
-     333,   334,   133,   123,   555,   129,   339,   340,   341,   133,
-     531,   419,   533,   328,   292,   293,   424,   332,   333,   334,
-     421,   123,   690,   129,   339,   340,   341,   133,   243,   244,
-     123,   124,   125,   126,   249,   133,   134,   252,   253,   254,
-     255,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-     265,   127,   123,   680,   130,   123,   124,   125,   126,   123,
-     124,   125,   126,   124,   125,   126,   587,   345,   136,   384,
-     123,   124,   136,   123,   124,   125,   126,   129,   411,   131,
-     131,   123,   133,   361,   123,   124,   136,   123,   124,   123,
-     368,   369,   125,   126,    80,    81,   411,   648,   125,   126,
-     123,   510,   123,   123,   655,   123,   866,   123,   517,   518,
-     129,   520,   521,   522,   523,   129,   525,   123,   527,   528,
-     529,   530,   129,   532,   311,   312,   313,   314,   315,   316,
-     129,   123,   317,   318,   123,   544,   319,   320,   321,   322,
-     323,   324,   123,   123,   359,   123,   123,   123,   123,   123,
-      19,    20,    21,   123,   123,   123,   123,   123,   131,   131,
-     123,   123,   495,   496,   497,   498,   499,   123,   129,   123,
-     123,   123,   123,   131,   129,   123,   123,   586,   123,   129,
-     495,   496,   497,   498,   499,   129,   129,   123,     0,   131,
-     128,    60,    61,   408,   133,   510,   516,   606,   413,   519,
-     415,   133,   517,   518,   524,   520,   521,   522,   523,   123,
-     525,   124,   527,   528,   529,   530,   125,   532,   125,   124,
-     137,   125,   133,   125,   125,   125,   129,   636,   125,   544,
-     639,   100,   125,   642,   125,   131,   125,   131,   107,   134,
-     791,   133,   650,   133,   125,   133,   797,   133,   125,   657,
-     125,   131,   121,   131,   123,   124,   125,   126,   131,   131,
-     131,   131,   131,   131,   127,   122,   135,   119,   123,   138,
-     679,   586,   139,   120,   135,   131,   125,   131,   687,   688,
-     131,   131,   125,   616,   125,   618,   125,   131,   128,   131,
-     135,   606,   123,   131,   131,   628,   131,   630,   131,   133,
-     633,   616,   635,   618,   133,   638,   133,   640,   133,   133,
-     643,   526,   133,   628,   132,   630,   132,   132,   633,   130,
-     635,   636,   600,   638,   639,   640,   734,   642,   643,   132,
-     132,   130,   740,   130,   549,   123,   551,   132,   130,   132,
-     130,   556,   123,   676,   677,   130,   130,   130,   123,   123,
-     123,   131,   123,   123,   123,   123,   123,   635,   123,   123,
-     638,   676,   677,   683,   679,   580,   775,   776,   777,   778,
-     779,   780,   687,   688,   783,   132,   132,   132,   787,   132,
-     132,   123,   123,   132,   127,   130,   130,   135,   123,   125,
-     130,   130,   607,   130,   132,    19,    20,    21,   132,   131,
-     131,   131,   617,   131,   619,   131,   621,   622,   623,   624,
-     123,   626,   135,   129,   629,   129,   631,   632,   696,   634,
-     135,   123,   637,   831,   135,   123,   641,   135,   132,   837,
-     645,   646,   123,   130,   135,   123,    60,    61,   123,   123,
-     130,   123,   123,   132,   123,    19,    20,    21,   123,   135,
-     133,   127,    76,   127,   132,   124,   124,   124,   124,   132,
-     775,   776,   777,   778,   779,   780,   744,   745,   783,   684,
-     685,   686,   787,   127,   127,   132,   100,   692,   127,    19,
-      20,    21,   127,   107,   132,   123,    60,    61,   132,   809,
-     810,   123,   132,   132,   123,   815,   816,   121,   132,   123,
-     124,   125,   126,   123,   123,   123,   721,   131,   133,   724,
-     132,   135,   727,   136,   138,   132,   132,   132,   132,   130,
-      60,    61,   737,   136,   136,   132,   100,   136,   743,   131,
-     123,   132,   131,   107,    19,    20,    21,    22,    23,    24,
-     124,   135,   123,   135,   759,   124,   124,   121,   123,   123,
-     124,   125,   126,   768,   769,   129,   123,   131,   123,   128,
-     100,    46,   124,   124,   138,   125,   125,   107,   125,   132,
-     785,   108,    57,   131,   789,    60,    61,   131,   125,   135,
-     795,   121,   132,   123,   124,   125,   126,   132,   132,   132,
-     132,   131,     6,   127,   135,   127,   135,   127,   138,   128,
-     136,   136,   817,   818,   819,   820,   821,   822,   136,   824,
-     136,   826,   136,   828,   133,   100,   133,   124,   132,   834,
-     132,   127,   107,   127,     6,   128,   135,   132,   130,   130,
-     130,   130,   130,   124,   123,   132,   121,   132,   123,   124,
-     125,   126,   132,   123,   123,   860,   131,   124,   135,     6,
-     865,   125,   125,   138,   125,   870,   132,   872,   136,   874,
-     132,   876,   877,   131,   879,   127,   127,   137,   137,   135,
-     135,   127,   135,   132,   132,   132,   891,   892,   893,     4,
-       5,   128,   123,     8,     9,    10,    11,    12,    13,    14,
-      15,    16,    17,   123,   123,   123,   123,   123,   136,   136,
-      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
-      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
-      45,   136,    47,    48,    49,    50,    51,    52,    53,    54,
-      55,    56,   132,    58,    59,   132,   132,    62,   123,   123,
-     123,   132,   132,   132,   443,    97,   838,   557,   681,   174,
-     326,   284,    -1,   613,    79,    80,    81,    82,    83,    84,
-      85,    86,    87,    -1,    89,    90,    91,    92,    93,    94,
-      95,    96,    97,    98,    99,    -1,   101,   102,   103,   104,
-     105,   106,    -1,    -1,   109,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   123,    -1,
-      -1,   126,    -1,    -1,     0,     1,    -1,    -1,     4,     5,
-      -1,   136,     8,     9,    10,    11,    12,    13,    14,    15,
-      16,    17,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    25,
-      26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
-      36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
-      -1,    47,    48,    49,    50,    51,    52,    53,    54,    55,
-      56,    -1,    58,    59,    -1,    -1,    62,    -1,    -1,    -1,
+     325,   506,   123,   124,   125,   126,   326,   129,   127,    60,
+      61,   133,   134,   132,   358,   136,   123,   124,   125,   126,
+     123,   124,   125,   126,   100,   124,   131,   123,   124,   136,
+     135,   107,   131,   136,   129,   129,   131,   293,   294,   133,
+     134,    19,    20,    21,    22,    23,    24,   123,   124,   125,
+     126,   129,   207,   131,   127,   131,   107,   212,   218,   132,
+     127,   127,   138,   130,   127,   667,   132,   127,    46,   132,
+     130,   127,   123,   124,   125,   126,   132,   129,   123,    57,
+     131,   133,    60,    61,   127,   240,   241,   138,   127,   132,
+     346,   123,   124,   132,    19,    20,    21,    22,    23,    24,
+     111,   112,   113,   114,   115,   116,   362,   123,   124,   125,
+     126,   266,   127,   369,   370,   270,   129,   132,   127,   127,
+     136,    46,   100,   132,   132,   280,   127,   551,   131,   107,
+     133,   132,    57,   131,   558,    60,    61,   312,   313,   314,
+     315,   316,   317,   121,   299,   123,   124,   125,   126,   123,
+     123,   306,   125,   131,   320,   321,   322,   323,   324,   325,
+     138,    19,    20,    21,   131,   123,   131,   134,   135,   134,
+     135,   131,   421,   129,   329,   100,   123,   426,   333,   334,
+     335,   423,   107,   694,   129,   340,   341,   342,   133,   533,
+     534,   109,   536,   129,   133,   134,   121,   133,   123,   124,
+     125,   126,    60,    61,   129,   129,   131,   129,   123,   133,
+     135,   133,   123,   138,   123,   124,   123,   684,    76,   123,
+     124,   125,   126,   123,   124,   123,   124,   123,   652,   131,
+     385,   125,   126,    80,    81,   659,   125,   126,   318,   319,
+     123,   191,   100,   193,   123,   123,   590,   123,   123,   107,
+     123,   123,   123,   123,   123,   123,   133,   123,   413,   123,
+     123,   123,   129,   121,   129,   123,   124,   125,   126,   129,
+     872,   123,   129,   131,   123,   123,   131,   135,   123,   123,
+     138,   123,   123,   123,   123,   123,   123,   133,   123,   207,
+     123,   123,   128,   243,   244,   129,   123,   123,   123,   249,
+     123,   129,   252,   253,   254,   255,   256,   257,   258,   259,
+     260,   261,   262,   263,   264,   265,   129,   129,   129,   123,
+     123,   123,   240,   241,   123,   131,   131,     0,   128,   123,
+     125,   127,   125,   124,   124,   133,   125,   125,   125,   125,
+     125,   125,   497,   498,   499,   500,   501,   603,   266,   129,
+     131,   125,   270,   131,   137,   134,   133,   512,   518,   125,
+     133,   521,   280,   133,   519,   520,   526,   522,   523,   524,
+     525,   133,   527,   797,   529,   530,   531,   532,   125,   803,
+     535,   299,   131,   639,   139,   131,   642,     3,   306,   131,
+     131,   131,   547,   131,   131,   122,   119,   123,    19,    20,
+      21,   120,   131,   125,   125,   654,   131,   131,   125,   125,
+     360,   329,   661,   131,   125,   333,   334,   335,   131,   131,
+     135,   131,   340,   341,   342,   131,   135,    19,    20,    21,
+     131,   123,   131,   133,   589,   133,   133,   133,    54,    60,
+      61,   130,   133,   133,   700,   132,   132,    63,    64,    65,
+      66,    67,    68,   132,   609,    71,    72,   132,    74,    75,
+     410,    77,    78,   132,   619,   415,   621,   417,    60,    61,
+     130,   130,   123,   130,   132,   131,   631,   132,   633,   100,
+     130,   636,   130,   638,   639,   640,   107,   642,   643,   644,
+     739,   646,   647,   749,   750,   413,   745,   130,   130,   130,
+     121,   123,   123,   124,   125,   126,   123,   132,   100,   123,
+     131,   123,   123,   123,   135,   107,   123,   138,   123,   123,
+     123,   127,   123,   132,   132,   680,   681,   687,   683,   121,
+     132,   123,   124,   125,   126,   132,   691,   692,   123,   131,
+     132,   123,   132,   112,   130,   132,   138,   130,   117,   130,
+     130,   120,   121,   122,   123,   124,   125,   126,   127,   128,
+     129,   130,   131,   132,   133,   130,   132,   131,   131,   131,
+     131,   131,   125,   123,   128,   123,   135,   135,   528,   497,
+     498,   499,   500,   501,   129,   129,   135,   123,   837,   135,
+     123,   132,   135,   123,   843,   135,   130,   123,   123,   130,
+     123,   123,   552,   123,   554,   132,   123,   123,   123,   559,
+     124,   135,   133,   132,   127,   127,   124,   124,   124,   128,
+     130,   132,   127,   127,   127,   780,   781,   782,   783,   784,
+     132,   786,   127,   583,   789,   132,   123,   123,   793,   132,
+     132,   132,   132,   212,   123,   123,   123,    19,    20,    21,
+     123,   132,   132,   136,   136,   815,   816,   132,   132,   123,
+     610,   821,   822,   133,   136,   136,   132,   132,   131,   131,
+     620,   132,   622,   124,   624,   625,   626,   627,   135,   629,
+     123,   135,   632,   124,   634,   635,   124,   637,    60,    61,
+     123,   641,   123,   123,   131,   645,   124,   124,   132,   649,
+     650,   619,   125,   621,   125,   125,    19,    20,    21,   131,
+     108,   135,     6,   631,   132,   633,   132,   132,   636,   132,
+     132,   639,   125,   124,   642,   135,   644,   135,   100,   647,
+     136,   136,   136,   127,   136,   107,   136,   127,   688,   689,
+     690,   127,   133,   128,   133,   132,   696,    60,    61,   121,
+     132,   123,   124,   125,   126,   128,   127,   129,   127,   131,
+       6,   135,   680,   681,   130,   130,   138,   130,   130,   130,
+     123,   123,   132,   723,   132,   132,   726,   132,   124,   729,
+     123,   135,   732,   124,     6,   125,   125,   100,   125,   137,
+     132,   136,   742,   137,   107,   128,   132,   135,   748,   131,
+     135,   127,   127,   127,   135,    19,    20,    21,   121,   132,
+     123,   124,   125,   126,   764,   132,   385,   132,   131,   123,
+     123,   123,   123,   773,   774,   138,   123,   123,   136,   136,
+     136,   123,   132,   132,   132,   123,   123,   132,   844,   132,
+     560,   791,   132,   285,   174,   795,    60,    61,   616,   445,
+      97,   801,    -1,    -1,   685,    -1,    -1,    -1,   327,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,   823,   824,   825,   826,   827,   828,    -1,
+     830,    -1,   832,    -1,   834,    -1,   100,    -1,    -1,    -1,
+     840,    -1,    -1,   107,    -1,    19,    20,    21,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,   121,    -1,   123,
+     124,   125,   126,    -1,    -1,    -1,   866,   131,    -1,    -1,
+      -1,   871,    -1,    -1,   138,    -1,   876,    -1,   878,    -1,
+     880,    -1,   882,   883,    -1,   885,    60,    61,    -1,    -1,
+      -1,    -1,    -1,   512,    -1,    -1,    -1,   897,   898,   899,
+     519,   520,    -1,   522,   523,   524,   525,    -1,   527,    -1,
+     529,   530,   531,   532,    -1,    -1,   535,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,   100,    -1,   547,    -1,
+      -1,    -1,    -1,   107,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,   121,    -1,   123,
+     124,   125,   126,    -1,    -1,    -1,    -1,   131,    -1,    -1,
+      -1,    -1,    -1,    -1,   138,    -1,    -1,    -1,    -1,    -1,
+     589,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+     609,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   638,
+      -1,   640,    -1,    -1,   643,    -1,    -1,   646,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    79,    80,    81,    82,    83,    84,    85,
-      86,    87,    88,    89,    90,    91,    92,    93,    94,    95,
-      96,    97,    98,    99,    -1,   101,   102,   103,   104,   105,
-     106,     4,     5,   109,    -1,     8,     9,    10,    11,    12,
-      13,    14,    15,    16,    17,    -1,    -1,   123,   124,   125,
-     126,    -1,    25,    26,    27,    28,    29,    30,    31,    32,
-      33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
-      43,    44,    45,    -1,    47,    48,    49,    50,    51,    52,
-      53,    54,    55,    56,    -1,    58,    59,    -1,    -1,    62,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    79,    80,    81,    82,
-      83,    84,    85,    86,    87,    -1,    89,    90,    91,    92,
-      93,    94,    95,    96,    97,    98,    99,    -1,   101,   102,
-     103,   104,   105,   106,    -1,    -1,   109,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-     123,    -1,    -1,   126,    -1,   128,     4,     5,    -1,    -1,
-       8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    25,    26,    27,
-      28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
-      38,    39,    40,    41,    42,    43,    44,    45,    -1,    47,
-      48,    49,    50,    51,    52,    53,    54,    55,    56,    -1,
-      58,    59,    -1,    -1,    62,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   683,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,   691,   692,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    79,    80,    81,    82,    83,    84,    85,    86,    87,
-      88,    89,    90,    91,    92,    93,    94,    95,    96,    97,
-      98,    99,    -1,   101,   102,   103,   104,   105,   106,     4,
-       5,   109,    -1,     8,     9,    10,    11,    12,    13,    14,
-      15,    16,    17,    -1,    -1,   123,    -1,    -1,   126,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       4,     5,    -1,    -1,     8,     9,    10,    11,    12,    13,
+      14,    15,    16,    17,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    25,    26,    27,    28,    29,    30,    31,    32,    33,
+      34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
+      44,    45,    -1,    47,    48,    49,    50,    51,    52,    53,
+      54,    55,    56,    -1,    58,    59,    -1,    -1,    62,    -1,
+      -1,   780,   781,   782,   783,   784,    -1,   786,    -1,    -1,
+     789,    -1,    -1,    -1,   793,    79,    80,    81,    82,    83,
+      84,    85,    86,    87,    -1,    89,    90,    91,    92,    93,
+      94,    95,    96,    97,    98,    99,    -1,   101,   102,   103,
+     104,   105,   106,    -1,    -1,   109,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   123,
+      -1,    -1,   126,    -1,    -1,     0,     1,    -1,    -1,     4,
+       5,    -1,   136,     8,     9,    10,    11,    12,    13,    14,
+      15,    16,    17,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
       45,    -1,    47,    48,    49,    50,    51,    52,    53,    54,
       55,    56,    -1,    58,    59,    -1,    -1,    62,    -1,    -1,
-      -1,    19,    20,    21,     3,    -1,    -1,    -1,    -1,    -1,
-      19,    20,    21,    -1,    79,    80,    81,    82,    83,    84,
-      85,    86,    87,    -1,    89,    90,    91,    92,    93,    94,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    79,    80,    81,    82,    83,    84,
+      85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
       95,    96,    97,    98,    99,    -1,   101,   102,   103,   104,
-     105,   106,    60,    61,   109,    19,    20,    21,    -1,    -1,
-      -1,    60,    61,    -1,    -1,    54,    -1,    -1,   123,    -1,
-      -1,   126,    -1,    -1,    63,    64,    65,    66,    67,    68,
-      -1,    -1,    71,    72,    -1,    74,    75,    -1,    77,    78,
-      -1,    -1,   100,    -1,    -1,    -1,    60,    61,    -1,   107,
-      -1,   100,    -1,    -1,    -1,    -1,    -1,    -1,   107,    -1,
-      -1,    -1,    -1,   121,    -1,   123,   124,   125,   126,    -1,
-      -1,    -1,   121,   131,   123,   124,   125,   126,    -1,    -1,
-     138,    -1,   131,    -1,    -1,    -1,   100,    -1,    -1,   138,
-      -1,    -1,    -1,   107,    -1,    -1,    -1,    -1,    -1,    -1,
+     105,   106,     4,     5,   109,    -1,     8,     9,    10,    11,
+      12,    13,    14,    15,    16,    17,    -1,    -1,   123,   124,
+     125,   126,    -1,    25,    26,    27,    28,    29,    30,    31,
+      32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
+      42,    43,    44,    45,    -1,    47,    48,    49,    50,    51,
+      52,    53,    54,    55,    56,    -1,    58,    59,    -1,    -1,
+      62,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    79,    80,    81,
+      82,    83,    84,    85,    86,    87,    -1,    89,    90,    91,
+      92,    93,    94,    95,    96,    97,    98,    99,    -1,   101,
+     102,   103,   104,   105,   106,    -1,    -1,   109,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,   123,    -1,    -1,   126,    -1,   128,     4,     5,    -1,
+      -1,     8,     9,    10,    11,    12,    13,    14,    15,    16,
+      17,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    25,    26,
+      27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
+      37,    38,    39,    40,    41,    42,    43,    44,    45,    -1,
+      47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
+      -1,    58,    59,    -1,    -1,    62,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    79,    80,    81,    82,    83,    84,    85,    86,
+      87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
+      97,    98,    99,    -1,   101,   102,   103,   104,   105,   106,
+       4,     5,   109,    -1,     8,     9,    10,    11,    12,    13,
+      14,    15,    16,    17,    -1,    -1,   123,    -1,    -1,   126,
+      -1,    25,    26,    27,    28,    29,    30,    31,    32,    33,
+      34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
+      44,    45,    -1,    47,    48,    49,    50,    51,    52,    53,
+      54,    55,    56,    -1,    58,    59,    -1,    -1,    62,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    79,    80,    81,    82,    83,
+      84,    85,    86,    87,    -1,    89,    90,    91,    92,    93,
+      94,    95,    96,    97,    98,    99,    -1,   101,   102,   103,
+     104,   105,   106,    -1,    -1,   109,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   123,
-     124,   125,   126,    -1,    -1,    -1,    -1,   131,    -1,    -1,
-      -1,    -1,    -1,    -1,   138
+      -1,    -1,   126
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -1658,70 +1703,71 @@ static const grib_yytype_uint8 grib_yystos[] =
      193,   187,   187,   123,   125,   125,   124,   124,   153,   125,
      131,   133,   146,   161,   161,   125,   187,   129,   134,   161,
      125,   125,   161,   161,   161,   161,   161,   161,   161,   161,
-     161,   161,   161,   161,   161,   161,   129,   125,   125,   131,
-     125,   125,   133,   134,   134,   123,   134,   133,   133,   131,
-     131,   134,   135,   131,   135,   131,   134,   135,   137,   146,
-     162,   187,   133,   133,   125,   125,   123,   124,   131,   131,
-     131,   131,   131,   131,   184,   131,   187,   179,   180,   127,
-     122,   139,   117,   118,   140,   141,   142,   138,   143,   111,
-     112,   113,   114,   115,   116,   119,   120,   123,   131,   162,
-     125,   162,   131,   131,   131,   125,   125,   125,   125,   131,
-     131,   131,   155,   187,   153,   131,    22,    23,    24,    46,
-      57,   129,   135,   187,   129,   135,   135,   129,   134,   161,
-     135,   131,   133,   150,   133,   133,   133,   133,   131,   133,
-     132,   132,   132,   130,   132,   132,   130,   153,   153,   162,
-     162,   130,   132,   155,   123,   162,   130,   132,   162,   162,
+     161,   161,   161,   161,   161,   161,   129,   125,   123,   125,
+     131,   125,   125,   133,   134,   134,   123,   134,   133,   133,
+     131,   131,   134,   135,   131,   135,   131,   134,   135,   137,
+     146,   162,   187,   133,   133,   125,   125,   123,   124,   131,
+     131,   131,   131,   131,   131,   184,   131,   187,   179,   180,
+     127,   122,   139,   117,   118,   140,   141,   142,   138,   143,
+     111,   112,   113,   114,   115,   116,   119,   120,   123,   131,
+     162,   125,   162,   131,   131,   131,   125,   125,   125,   125,
+     131,   131,   131,   155,   187,   153,   131,    22,    23,    24,
+      46,    57,   129,   135,   187,   129,   135,   135,   129,   134,
+     161,   135,   131,   133,   150,   133,   133,   133,   133,   131,
+     133,   132,   132,   132,   130,   132,   132,   130,   153,   153,
+     162,   162,   130,   132,   155,   123,   162,   130,   132,   162,
      162,   162,   162,   162,   162,   162,   162,   162,   162,   162,
-     162,   162,   153,   130,   130,   153,   130,   130,   123,   123,
-     123,   131,   123,   155,   135,   155,   153,   123,   123,   169,
-     123,   170,   123,   123,   169,     3,    54,    63,    64,    65,
-      66,    67,    68,    71,    72,    74,    75,    77,    78,   163,
-     164,   132,    76,   135,   187,   187,   132,   132,   132,   132,
-     153,   123,   123,   123,   123,   123,   124,   132,   153,   132,
-     154,   123,   179,   181,   181,   181,   181,   181,   181,   182,
-     182,   183,   183,   183,   183,   183,   183,   184,   185,   127,
-     153,   130,   153,   153,   153,   130,   130,   130,   130,   153,
-     153,   153,   132,   132,   187,   131,   131,   131,   131,   131,
-     125,   149,   123,   176,   177,   128,   149,   176,   176,   155,
-     123,   162,   176,   187,   187,   135,   135,   123,   123,   135,
-     123,   124,   132,   123,   135,   130,   161,   123,   123,   130,
-     123,   123,   132,   123,   123,   162,   133,   153,   123,   162,
-     125,   126,   147,   162,   132,   127,   132,   131,   135,   136,
-     127,   136,   127,   132,   131,   135,   136,   127,    80,    81,
-     135,   159,   124,   147,   148,   124,   124,   124,   124,   132,
-     127,   127,   127,   132,   132,   127,   127,   132,   123,   132,
-     123,   132,   132,   132,   123,   123,   123,   123,   132,   132,
-     132,   135,   132,   153,   153,   153,   153,   153,   127,   130,
-     133,   136,   176,   130,   136,   136,   130,   161,   136,   132,
-     132,   123,   150,   189,   190,   150,   129,   161,   129,   161,
-     150,   161,   161,   161,   161,   150,   161,   162,   129,   161,
-     129,   161,   161,   129,   161,   131,   155,   161,   131,   155,
-     131,   123,   132,   131,   127,   136,   161,   124,   135,   123,
-     169,   162,   124,   162,   124,   135,   123,   169,   162,   164,
-     123,   123,   159,   160,   128,   152,   136,   127,   136,   124,
-     124,   125,   125,   125,   132,   162,   131,   131,   161,   155,
-     108,   172,   173,   135,   132,   132,   132,   132,   132,   125,
-     129,   187,   161,   162,   135,   135,   133,   136,   190,   136,
-     136,   153,   162,   153,   162,   136,   162,   162,   162,   162,
-     136,   162,   153,   162,   153,   162,   162,   153,   162,   153,
-     187,   161,   162,   153,   161,   153,   162,   161,   153,   125,
-     126,   162,   162,   127,   169,   127,   132,   136,   127,   127,
-     169,   127,   132,   136,   133,   133,   152,   136,   159,   128,
-     124,   132,   132,   127,   132,   127,   127,   153,   153,   161,
-     154,   110,   136,   173,   150,   162,   162,   162,   161,   161,
-     149,   128,   162,     6,     6,   130,   130,   130,   130,   130,
-     132,    80,   162,   132,   162,   132,   162,   132,   123,   136,
-     124,   135,   162,   123,   123,   136,   124,   135,   162,   187,
-     187,     6,   152,   125,   125,   125,   132,   132,   162,   137,
-     137,   136,   162,   162,   130,   135,   135,   161,   161,   161,
-     161,   161,   161,   131,   161,   162,   161,   127,   132,   162,
-     127,   169,   127,   127,   132,   162,   127,   169,   135,   132,
-     132,   132,   150,   136,   150,   128,   150,   150,   162,   162,
-     162,   162,   162,   162,   123,   162,   162,   123,   162,   123,
-     136,   123,   123,   162,   123,   136,   160,   136,   136,   136,
-     132,   127,   132,   127,   132,   162,   132,   132,   127,   132,
-     162,   136,   162,   123,   162,   123,   162,   162,   162,   123,
-     162,   132,   132,   132,   162,   162,   162
+     162,   162,   162,   153,   130,   130,   130,   153,   130,   130,
+     123,   123,   123,   131,   123,   155,   135,   155,   153,   123,
+     123,   169,   123,   170,   123,   123,   169,     3,    54,    63,
+      64,    65,    66,    67,    68,    71,    72,    74,    75,    77,
+      78,   163,   164,   132,    76,   135,   187,   187,   132,   132,
+     132,   132,   153,   123,   123,   123,   123,   123,   124,   132,
+     153,   132,   154,   123,   179,   181,   181,   181,   181,   181,
+     181,   182,   182,   183,   183,   183,   183,   183,   183,   184,
+     185,   127,   153,   130,   153,   153,   153,   130,   130,   130,
+     130,   153,   153,   153,   132,   132,   187,   131,   131,   131,
+     131,   131,   125,   149,   123,   176,   177,   128,   149,   176,
+     176,   155,   123,   162,   176,   187,   187,   135,   135,   123,
+     123,   135,   123,   124,   132,   123,   135,   130,   161,   123,
+     123,   130,   123,   123,   123,   132,   123,   123,   162,   133,
+     153,   123,   162,   125,   126,   147,   162,   132,   127,   132,
+     131,   135,   136,   127,   136,   127,   132,   131,   135,   136,
+     127,    80,    81,   135,   159,   124,   147,   148,   124,   124,
+     124,   124,   132,   127,   127,   127,   132,   132,   127,   127,
+     132,   123,   132,   123,   132,   132,   132,   123,   123,   123,
+     123,   132,   132,   132,   135,   132,   153,   153,   153,   153,
+     153,   127,   130,   133,   136,   176,   130,   136,   136,   130,
+     161,   136,   132,   132,   123,   150,   189,   190,   150,   129,
+     161,   129,   161,   150,   161,   161,   161,   161,   150,   161,
+     162,   129,   161,   129,   161,   161,   129,   161,   155,   131,
+     155,   161,   131,   155,   131,   123,   132,   131,   127,   136,
+     161,   124,   135,   123,   169,   162,   124,   162,   124,   135,
+     123,   169,   162,   164,   123,   123,   159,   160,   128,   152,
+     136,   127,   136,   124,   124,   125,   125,   125,   132,   162,
+     131,   131,   161,   155,   108,   172,   173,   135,   132,   132,
+     132,   132,   132,   125,   129,   187,   161,   162,   135,   135,
+     133,   136,   190,   136,   136,   153,   162,   153,   162,   136,
+     162,   162,   162,   162,   136,   162,   153,   162,   153,   162,
+     162,   153,   162,   161,   153,   187,   161,   162,   153,   161,
+     153,   162,   161,   153,   125,   126,   162,   162,   127,   169,
+     127,   132,   136,   127,   127,   169,   127,   132,   136,   133,
+     133,   152,   136,   159,   128,   124,   132,   132,   127,   132,
+     127,   127,   153,   153,   161,   154,   110,   136,   173,   150,
+     162,   162,   162,   161,   161,   149,   128,   162,     6,     6,
+     130,   130,   130,   130,   130,   162,   132,    80,   162,   132,
+     162,   132,   162,   132,   123,   136,   124,   135,   162,   123,
+     123,   136,   124,   135,   162,   187,   187,     6,   152,   125,
+     125,   125,   132,   132,   162,   137,   137,   136,   162,   162,
+     130,   135,   135,   161,   161,   161,   161,   161,   161,   131,
+     161,   162,   161,   127,   132,   162,   127,   169,   127,   127,
+     132,   162,   127,   169,   135,   132,   132,   132,   150,   136,
+     150,   128,   150,   150,   162,   162,   162,   162,   162,   162,
+     123,   162,   162,   123,   162,   123,   136,   123,   123,   162,
+     123,   136,   160,   136,   136,   136,   132,   127,   132,   127,
+     132,   162,   132,   132,   127,   132,   162,   136,   162,   123,
+     162,   123,   162,   162,   162,   123,   162,   132,   132,   132,
+     162,   162,   162
 };
 
 #define grib_yyerrok		(grib_yyerrstatus = 0)
@@ -2766,353 +2812,367 @@ grib_yyreduce:
   case 57:
 /* Line 1792 of yacc.c  */
 #line 387 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (12)].str),"codetable",(grib_yyvsp[(3) - (12)].lval), (grib_yyvsp[(6) - (12)].explist),(grib_yyvsp[(7) - (12)].explist),(grib_yyvsp[(12) - (12)].lval),NULL,(grib_yyvsp[(10) - (12)].str));
-					free((grib_yyvsp[(5) - (12)].str));free((grib_yyvsp[(10) - (12)].str)); }
+    {
+      /* ECC-485: Set length to 0 and prepend the new argument */
+      grib_arguments* a = grib_arguments_new(grib_parser_context, new_accessor_expression(grib_parser_context,(grib_yyvsp[(3) - (8)].str),0,0),NULL);
+      a->next = (grib_yyvsp[(6) - (8)].explist);
+      (grib_yyval.act) = grib_action_create_gen(grib_parser_context, (grib_yyvsp[(5) - (8)].str), "codetable",
+                                  0, a, /* length=0 and additional argument */
+                                  (grib_yyvsp[(7) - (8)].explist), (grib_yyvsp[(8) - (8)].lval), NULL, NULL);
+      free((grib_yyvsp[(5) - (8)].str));
+    }
     break;
 
   case 58:
 /* Line 1792 of yacc.c  */
-#line 391 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (10)].str),"codetable",(grib_yyvsp[(3) - (10)].lval), (grib_yyvsp[(7) - (10)].explist),(grib_yyvsp[(9) - (10)].explist),(grib_yyvsp[(10) - (10)].lval),NULL,NULL);    free((grib_yyvsp[(5) - (10)].str)); }
+#line 398 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (12)].str),"codetable",(grib_yyvsp[(3) - (12)].lval), (grib_yyvsp[(6) - (12)].explist),(grib_yyvsp[(7) - (12)].explist),(grib_yyvsp[(12) - (12)].lval),NULL,(grib_yyvsp[(10) - (12)].str));
+           free((grib_yyvsp[(5) - (12)].str));free((grib_yyvsp[(10) - (12)].str)); }
     break;
 
   case 59:
 /* Line 1792 of yacc.c  */
-#line 394 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (7)].str),"smart_table",0,(grib_yyvsp[(4) - (7)].explist),(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL);    free((grib_yyvsp[(2) - (7)].str)); }
+#line 402 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (10)].str),"codetable",(grib_yyvsp[(3) - (10)].lval), (grib_yyvsp[(7) - (10)].explist),(grib_yyvsp[(9) - (10)].explist),(grib_yyvsp[(10) - (10)].lval),NULL,NULL);    free((grib_yyvsp[(5) - (10)].str)); }
     break;
 
   case 60:
 /* Line 1792 of yacc.c  */
-#line 397 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(1) - (8)].str),"dictionary",0,(grib_yyvsp[(5) - (8)].explist),(grib_yyvsp[(7) - (8)].explist),(grib_yyvsp[(8) - (8)].lval),NULL,NULL);    free((grib_yyvsp[(1) - (8)].str)); }
+#line 405 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (7)].str),"smart_table",0,(grib_yyvsp[(4) - (7)].explist),(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL);    free((grib_yyvsp[(2) - (7)].str)); }
     break;
 
   case 61:
 /* Line 1792 of yacc.c  */
-#line 400 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(1) - (8)].str),"getenv",0,(grib_yyvsp[(5) - (8)].explist),(grib_yyvsp[(7) - (8)].explist),(grib_yyvsp[(8) - (8)].lval),NULL,NULL);    free((grib_yyvsp[(1) - (8)].str)); }
+#line 408 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(1) - (8)].str),"dictionary",0,(grib_yyvsp[(5) - (8)].explist),(grib_yyvsp[(7) - (8)].explist),(grib_yyvsp[(8) - (8)].lval),NULL,NULL);    free((grib_yyvsp[(1) - (8)].str)); }
     break;
 
   case 62:
 /* Line 1792 of yacc.c  */
-#line 403 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (8)].str),"complex_codetable",(grib_yyvsp[(3) - (8)].lval), (grib_yyvsp[(6) - (8)].explist),(grib_yyvsp[(7) - (8)].explist),(grib_yyvsp[(8) - (8)].lval),NULL,NULL);    free((grib_yyvsp[(5) - (8)].str)); }
+#line 411 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(1) - (8)].str),"getenv",0,(grib_yyvsp[(5) - (8)].explist),(grib_yyvsp[(7) - (8)].explist),(grib_yyvsp[(8) - (8)].lval),NULL,NULL);    free((grib_yyvsp[(1) - (8)].str)); }
     break;
 
   case 63:
 /* Line 1792 of yacc.c  */
-#line 406 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (10)].str),"complex_codetable",(grib_yyvsp[(3) - (10)].lval), (grib_yyvsp[(7) - (10)].explist),(grib_yyvsp[(9) - (10)].explist),(grib_yyvsp[(10) - (10)].lval),NULL,NULL);    free((grib_yyvsp[(5) - (10)].str)); }
+#line 414 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (8)].str),"complex_codetable",(grib_yyvsp[(3) - (8)].lval), (grib_yyvsp[(6) - (8)].explist),(grib_yyvsp[(7) - (8)].explist),(grib_yyvsp[(8) - (8)].lval),NULL,NULL);    free((grib_yyvsp[(5) - (8)].str)); }
     break;
 
   case 64:
 /* Line 1792 of yacc.c  */
-#line 409 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (8)].str),"codeflag",(grib_yyvsp[(3) - (8)].lval), (grib_yyvsp[(6) - (8)].explist),(grib_yyvsp[(7) - (8)].explist),(grib_yyvsp[(8) - (8)].lval),NULL,NULL);  free((grib_yyvsp[(5) - (8)].str)); }
+#line 417 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (10)].str),"complex_codetable",(grib_yyvsp[(3) - (10)].lval), (grib_yyvsp[(7) - (10)].explist),(grib_yyvsp[(9) - (10)].explist),(grib_yyvsp[(10) - (10)].lval),NULL,NULL);    free((grib_yyvsp[(5) - (10)].str)); }
     break;
 
   case 65:
 /* Line 1792 of yacc.c  */
-#line 412 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (9)].str),"lookup",(grib_yyvsp[(3) - (9)].lval),(grib_yyvsp[(7) - (9)].explist),NULL,(grib_yyvsp[(9) - (9)].lval),NULL,NULL); free((grib_yyvsp[(5) - (9)].str)); }
+#line 420 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (8)].str),"codeflag",(grib_yyvsp[(3) - (8)].lval), (grib_yyvsp[(6) - (8)].explist),(grib_yyvsp[(7) - (8)].explist),(grib_yyvsp[(8) - (8)].lval),NULL,NULL);  free((grib_yyvsp[(5) - (8)].str)); }
     break;
 
   case 66:
 /* Line 1792 of yacc.c  */
-#line 415 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (7)].str),"bit",0,(grib_yyvsp[(4) - (7)].explist),(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL); free((grib_yyvsp[(2) - (7)].str)); }
+#line 423 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (9)].str),"lookup",(grib_yyvsp[(3) - (9)].lval),(grib_yyvsp[(7) - (9)].explist),NULL,(grib_yyvsp[(9) - (9)].lval),NULL,NULL); free((grib_yyvsp[(5) - (9)].str)); }
     break;
 
   case 67:
 /* Line 1792 of yacc.c  */
-#line 418 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (2)].str),"label",0,NULL,NULL,0,NULL,NULL);   free((grib_yyvsp[(2) - (2)].str));  }
+#line 426 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (7)].str),"bit",0,(grib_yyvsp[(4) - (7)].explist),(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL); free((grib_yyvsp[(2) - (7)].str)); }
     break;
 
   case 68:
 /* Line 1792 of yacc.c  */
-#line 421 "griby.y"
+#line 429 "griby.y"
     { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (2)].str),"label",0,NULL,NULL,0,NULL,NULL);   free((grib_yyvsp[(2) - (2)].str));  }
     break;
 
   case 69:
 /* Line 1792 of yacc.c  */
-#line 424 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"ibmfloat",4,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
+#line 432 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (2)].str),"label",0,NULL,NULL,0,NULL,NULL);   free((grib_yyvsp[(2) - (2)].str));  }
     break;
 
   case 70:
 /* Line 1792 of yacc.c  */
-#line 428 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"int8",1,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
+#line 435 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"ibmfloat",4,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 71:
 /* Line 1792 of yacc.c  */
-#line 431 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"uint8",1,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
+#line 439 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"int8",1,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 72:
 /* Line 1792 of yacc.c  */
-#line 434 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"int16",2,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
+#line 442 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"uint8",1,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 73:
 /* Line 1792 of yacc.c  */
-#line 437 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"uint16",2,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
+#line 445 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"int16",2,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 74:
 /* Line 1792 of yacc.c  */
-#line 440 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"int16_little_endian",2,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
+#line 448 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"uint16",2,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 75:
 /* Line 1792 of yacc.c  */
-#line 443 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"uint16_little_endian",2,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
+#line 451 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"int16_little_endian",2,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 76:
 /* Line 1792 of yacc.c  */
-#line 446 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"int32",4,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
+#line 454 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"uint16_little_endian",2,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 77:
 /* Line 1792 of yacc.c  */
-#line 449 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"uint32",4,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
+#line 457 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"int32",4,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 78:
 /* Line 1792 of yacc.c  */
-#line 452 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"int32_little_endian",4,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
+#line 460 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"uint32",4,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 79:
 /* Line 1792 of yacc.c  */
-#line 455 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"uint32_little_endian",4,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
+#line 463 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"int32_little_endian",4,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 80:
 /* Line 1792 of yacc.c  */
-#line 458 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"int64",8,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
+#line 466 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"uint32_little_endian",4,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 81:
 /* Line 1792 of yacc.c  */
-#line 461 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"uint64",8,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
+#line 469 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"int64",8,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 82:
 /* Line 1792 of yacc.c  */
-#line 464 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"int64_little_endian",8,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
+#line 472 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"uint64",8,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 83:
 /* Line 1792 of yacc.c  */
-#line 467 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"uint64_little_endian",8,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
+#line 475 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"int64_little_endian",8,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 84:
 /* Line 1792 of yacc.c  */
-#line 470 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (7)].str),"blob",0,(grib_yyvsp[(4) - (7)].explist),(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL);        free((grib_yyvsp[(2) - (7)].str));  }
+#line 478 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"uint64_little_endian",8,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 85:
 /* Line 1792 of yacc.c  */
-#line 474 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(4) - (6)].str),"ibmfloat",4,NULL,(grib_yyvsp[(5) - (6)].explist),(grib_yyvsp[(6) - (6)].lval),(grib_yyvsp[(2) - (6)].str),NULL);free((grib_yyvsp[(4) - (6)].str)); free((grib_yyvsp[(2) - (6)].str)); }
+#line 481 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (7)].str),"blob",0,(grib_yyvsp[(4) - (7)].explist),(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL);        free((grib_yyvsp[(2) - (7)].str));  }
     break;
 
   case 86:
 /* Line 1792 of yacc.c  */
-#line 477 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (7)].str),"ibmfloat",4,(grib_yyvsp[(4) - (7)].explist),(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL);free((grib_yyvsp[(2) - (7)].str));  }
+#line 485 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(4) - (6)].str),"ibmfloat",4,NULL,(grib_yyvsp[(5) - (6)].explist),(grib_yyvsp[(6) - (6)].lval),(grib_yyvsp[(2) - (6)].str),NULL);free((grib_yyvsp[(4) - (6)].str)); free((grib_yyvsp[(2) - (6)].str)); }
     break;
 
   case 87:
 /* Line 1792 of yacc.c  */
-#line 480 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (2)].str),"position",0,NULL,NULL,0,NULL,NULL);     free((grib_yyvsp[(2) - (2)].str));  }
+#line 488 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (7)].str),"ibmfloat",4,(grib_yyvsp[(4) - (7)].explist),(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL);free((grib_yyvsp[(2) - (7)].str));  }
     break;
 
   case 88:
 /* Line 1792 of yacc.c  */
-#line 483 "griby.y"
-    { (grib_yyval.act) = grib_action_create_variable(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"constant",0,(grib_yyvsp[(4) - (5)].explist),NULL,(grib_yyvsp[(5) - (5)].lval),NULL);free((grib_yyvsp[(2) - (5)].str)); }
+#line 491 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (2)].str),"position",0,NULL,NULL,0,NULL,NULL);     free((grib_yyvsp[(2) - (2)].str));  }
     break;
 
   case 89:
 /* Line 1792 of yacc.c  */
-#line 486 "griby.y"
-    { (grib_yyval.act) = grib_action_create_variable(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"transient",0,(grib_yyvsp[(4) - (5)].explist),(grib_yyvsp[(4) - (5)].explist),(grib_yyvsp[(5) - (5)].lval),NULL);   free((grib_yyvsp[(2) - (5)].str)); }
+#line 494 "griby.y"
+    { (grib_yyval.act) = grib_action_create_variable(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"constant",0,(grib_yyvsp[(4) - (5)].explist),NULL,(grib_yyvsp[(5) - (5)].lval),NULL);free((grib_yyvsp[(2) - (5)].str)); }
     break;
 
   case 90:
 /* Line 1792 of yacc.c  */
-#line 488 "griby.y"
-    { (grib_yyval.act) = grib_action_create_transient_darray(grib_parser_context,(grib_yyvsp[(2) - (7)].str),(grib_yyvsp[(5) - (7)].dvalue),(grib_yyvsp[(7) - (7)].lval)); free((grib_yyvsp[(2) - (7)].str)); }
+#line 497 "griby.y"
+    { (grib_yyval.act) = grib_action_create_variable(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"transient",0,(grib_yyvsp[(4) - (5)].explist),(grib_yyvsp[(4) - (5)].explist),(grib_yyvsp[(5) - (5)].lval),NULL);   free((grib_yyvsp[(2) - (5)].str)); }
     break;
 
   case 91:
 /* Line 1792 of yacc.c  */
-#line 491 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"ieeefloat",4,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);   free((grib_yyvsp[(2) - (4)].str));  }
+#line 499 "griby.y"
+    { (grib_yyval.act) = grib_action_create_transient_darray(grib_parser_context,(grib_yyvsp[(2) - (7)].str),(grib_yyvsp[(5) - (7)].dvalue),(grib_yyvsp[(7) - (7)].lval)); free((grib_yyvsp[(2) - (7)].str)); }
     break;
 
   case 92:
 /* Line 1792 of yacc.c  */
-#line 494 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(4) - (6)].str),"ieeefloat",4,NULL,(grib_yyvsp[(5) - (6)].explist),(grib_yyvsp[(6) - (6)].lval),(grib_yyvsp[(2) - (6)].str),NULL);  free((grib_yyvsp[(4) - (6)].str));free((grib_yyvsp[(2) - (6)].str));}
+#line 502 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (4)].str),"ieeefloat",4,NULL,(grib_yyvsp[(3) - (4)].explist),(grib_yyvsp[(4) - (4)].lval),NULL,NULL);   free((grib_yyvsp[(2) - (4)].str));  }
     break;
 
   case 93:
 /* Line 1792 of yacc.c  */
-#line 497 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (7)].str),"ieeefloat",4,(grib_yyvsp[(4) - (7)].explist),(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL);free((grib_yyvsp[(2) - (7)].str));  }
+#line 505 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(4) - (6)].str),"ieeefloat",4,NULL,(grib_yyvsp[(5) - (6)].explist),(grib_yyvsp[(6) - (6)].lval),(grib_yyvsp[(2) - (6)].str),NULL);  free((grib_yyvsp[(4) - (6)].str));free((grib_yyvsp[(2) - (6)].str));}
     break;
 
   case 94:
 /* Line 1792 of yacc.c  */
-#line 500 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (2)].str),"g1_half_byte_codeflag",0,NULL,NULL,0,NULL,NULL);free((grib_yyvsp[(2) - (2)].str));  }
+#line 508 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (7)].str),"ieeefloat",4,(grib_yyvsp[(4) - (7)].explist),(grib_yyvsp[(6) - (7)].explist),(grib_yyvsp[(7) - (7)].lval),NULL,NULL);free((grib_yyvsp[(2) - (7)].str));  }
     break;
 
   case 95:
 /* Line 1792 of yacc.c  */
-#line 503 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (6)].str),"section_length",(grib_yyvsp[(3) - (6)].lval),NULL,(grib_yyvsp[(6) - (6)].explist),0,NULL,NULL);free((grib_yyvsp[(5) - (6)].str));  }
+#line 511 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (2)].str),"g1_half_byte_codeflag",0,NULL,NULL,0,NULL,NULL);free((grib_yyvsp[(2) - (2)].str));  }
     break;
 
   case 96:
 /* Line 1792 of yacc.c  */
-#line 506 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (8)].str),"g1_message_length",(grib_yyvsp[(3) - (8)].lval),(grib_yyvsp[(7) - (8)].explist),NULL,0,NULL,NULL);free((grib_yyvsp[(5) - (8)].str));  }
+#line 514 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (6)].str),"section_length",(grib_yyvsp[(3) - (6)].lval),NULL,(grib_yyvsp[(6) - (6)].explist),0,NULL,NULL);free((grib_yyvsp[(5) - (6)].str));  }
     break;
 
   case 97:
 /* Line 1792 of yacc.c  */
-#line 509 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (8)].str),"g1_section4_length",(grib_yyvsp[(3) - (8)].lval),(grib_yyvsp[(7) - (8)].explist),NULL,0,NULL,NULL);free((grib_yyvsp[(5) - (8)].str));  }
+#line 517 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (8)].str),"g1_message_length",(grib_yyvsp[(3) - (8)].lval),(grib_yyvsp[(7) - (8)].explist),NULL,0,NULL,NULL);free((grib_yyvsp[(5) - (8)].str));  }
     break;
 
   case 98:
 /* Line 1792 of yacc.c  */
-#line 512 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (3)].str),"ksec",0,(grib_yyvsp[(3) - (3)].explist),NULL,0,NULL,NULL);free((grib_yyvsp[(2) - (3)].str)); }
+#line 520 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (8)].str),"g1_section4_length",(grib_yyvsp[(3) - (8)].lval),(grib_yyvsp[(7) - (8)].explist),NULL,0,NULL,NULL);free((grib_yyvsp[(5) - (8)].str));  }
     break;
 
   case 99:
 /* Line 1792 of yacc.c  */
-#line 515 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"pad",0,(grib_yyvsp[(4) - (5)].explist),0,0,NULL,NULL);   free((grib_yyvsp[(2) - (5)].str)); }
+#line 523 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (3)].str),"ksec",0,(grib_yyvsp[(3) - (3)].explist),NULL,0,NULL,NULL);free((grib_yyvsp[(2) - (3)].str)); }
     break;
 
   case 100:
 /* Line 1792 of yacc.c  */
-#line 518 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"padto",0,(grib_yyvsp[(4) - (5)].explist),0,0,NULL,NULL);   free((grib_yyvsp[(2) - (5)].str)); }
+#line 526 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"pad",0,(grib_yyvsp[(4) - (5)].explist),0,0,NULL,NULL);   free((grib_yyvsp[(2) - (5)].str)); }
     break;
 
   case 101:
 /* Line 1792 of yacc.c  */
-#line 521 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"padtoeven",0,(grib_yyvsp[(4) - (5)].explist),0,0,NULL,NULL);   free((grib_yyvsp[(2) - (5)].str)); }
+#line 529 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"padto",0,(grib_yyvsp[(4) - (5)].explist),0,0,NULL,NULL);   free((grib_yyvsp[(2) - (5)].str)); }
     break;
 
   case 102:
 /* Line 1792 of yacc.c  */
-#line 524 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"padtomultiple",0,(grib_yyvsp[(4) - (5)].explist),0,0,NULL,NULL);   free((grib_yyvsp[(2) - (5)].str)); }
+#line 532 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"padtoeven",0,(grib_yyvsp[(4) - (5)].explist),0,0,NULL,NULL);   free((grib_yyvsp[(2) - (5)].str)); }
     break;
 
   case 103:
 /* Line 1792 of yacc.c  */
-#line 527 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (6)].str),"message",(grib_yyvsp[(3) - (6)].lval),0,0,(grib_yyvsp[(6) - (6)].lval),NULL,NULL);   free((grib_yyvsp[(5) - (6)].str));  }
+#line 535 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (5)].str),"padtomultiple",0,(grib_yyvsp[(4) - (5)].explist),0,0,NULL,NULL);   free((grib_yyvsp[(2) - (5)].str)); }
     break;
 
   case 104:
 /* Line 1792 of yacc.c  */
-#line 530 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (3)].str),"message_copy",0,0,0,(grib_yyvsp[(3) - (3)].lval),NULL,NULL);   free((grib_yyvsp[(2) - (3)].str));  }
+#line 538 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(5) - (6)].str),"message",(grib_yyvsp[(3) - (6)].lval),0,0,(grib_yyvsp[(6) - (6)].lval),NULL,NULL);   free((grib_yyvsp[(5) - (6)].str));  }
     break;
 
   case 105:
 /* Line 1792 of yacc.c  */
-#line 533 "griby.y"
-    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (3)].str),"section_padding",0,0,0,(grib_yyvsp[(3) - (3)].lval),NULL,NULL);   free((grib_yyvsp[(2) - (3)].str));  }
+#line 541 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (3)].str),"message_copy",0,0,0,(grib_yyvsp[(3) - (3)].lval),NULL,NULL);   free((grib_yyvsp[(2) - (3)].str));  }
     break;
 
   case 106:
 /* Line 1792 of yacc.c  */
-#line 535 "griby.y"
-    { (grib_yyval.act) = grib_action_create_template(grib_parser_context,0,(grib_yyvsp[(2) - (3)].str),(grib_yyvsp[(3) - (3)].str)); free((grib_yyvsp[(2) - (3)].str)); free((grib_yyvsp[(3) - (3)].str));}
+#line 544 "griby.y"
+    { (grib_yyval.act) = grib_action_create_gen(grib_parser_context,(grib_yyvsp[(2) - (3)].str),"section_padding",0,0,0,(grib_yyvsp[(3) - (3)].lval),NULL,NULL);   free((grib_yyvsp[(2) - (3)].str));  }
     break;
 
   case 107:
 /* Line 1792 of yacc.c  */
-#line 537 "griby.y"
-    { (grib_yyval.act) = grib_action_create_template(grib_parser_context,1,(grib_yyvsp[(2) - (3)].str),(grib_yyvsp[(3) - (3)].str)); free((grib_yyvsp[(2) - (3)].str)); free((grib_yyvsp[(3) - (3)].str));}
+#line 546 "griby.y"
+    { (grib_yyval.act) = grib_action_create_template(grib_parser_context,0,(grib_yyvsp[(2) - (3)].str),(grib_yyvsp[(3) - (3)].str)); free((grib_yyvsp[(2) - (3)].str)); free((grib_yyvsp[(3) - (3)].str));}
     break;
 
   case 108:
 /* Line 1792 of yacc.c  */
-#line 540 "griby.y"
-    { (grib_yyval.act) = grib_action_create_alias(grib_parser_context,(grib_yyvsp[(2) - (5)].str),(grib_yyvsp[(4) - (5)].str),NULL,(grib_yyvsp[(5) - (5)].lval));  free((grib_yyvsp[(2) - (5)].str)); free((grib_yyvsp[(4) - (5)].str)); }
+#line 548 "griby.y"
+    { (grib_yyval.act) = grib_action_create_template(grib_parser_context,1,(grib_yyvsp[(2) - (3)].str),(grib_yyvsp[(3) - (3)].str)); free((grib_yyvsp[(2) - (3)].str)); free((grib_yyvsp[(3) - (3)].str));}
     break;
 
   case 109:
 /* Line 1792 of yacc.c  */
-#line 543 "griby.y"
-    { (grib_yyval.act) = grib_action_create_alias(grib_parser_context,(grib_yyvsp[(2) - (2)].str),NULL,NULL,0);  free((grib_yyvsp[(2) - (2)].str)); }
+#line 551 "griby.y"
+    { (grib_yyval.act) = grib_action_create_alias(grib_parser_context,(grib_yyvsp[(2) - (5)].str),(grib_yyvsp[(4) - (5)].str),NULL,(grib_yyvsp[(5) - (5)].lval));  free((grib_yyvsp[(2) - (5)].str)); free((grib_yyvsp[(4) - (5)].str)); }
     break;
 
   case 110:
 /* Line 1792 of yacc.c  */
-#line 546 "griby.y"
+#line 554 "griby.y"
+    { (grib_yyval.act) = grib_action_create_alias(grib_parser_context,(grib_yyvsp[(2) - (2)].str),NULL,NULL,0);  free((grib_yyvsp[(2) - (2)].str)); }
+    break;
+
+  case 111:
+/* Line 1792 of yacc.c  */
+#line 557 "griby.y"
     {
          (grib_yyval.act) = grib_action_create_alias(grib_parser_context,(grib_yyvsp[(4) - (7)].str),(grib_yyvsp[(6) - (7)].str),(grib_yyvsp[(2) - (7)].str),(grib_yyvsp[(7) - (7)].lval));  free((grib_yyvsp[(2) - (7)].str)); free((grib_yyvsp[(4) - (7)].str)); free((grib_yyvsp[(6) - (7)].str));
     }
     break;
 
-  case 111:
+  case 112:
 /* Line 1792 of yacc.c  */
-#line 550 "griby.y"
+#line 561 "griby.y"
     {
          (grib_yyval.act) = grib_action_create_alias(grib_parser_context,(grib_yyvsp[(4) - (4)].str),NULL,(grib_yyvsp[(2) - (4)].str),0);  free((grib_yyvsp[(2) - (4)].str)); free((grib_yyvsp[(4) - (4)].str)); 
     }
     break;
 
-  case 112:
+  case 113:
 /* Line 1792 of yacc.c  */
-#line 554 "griby.y"
+#line 565 "griby.y"
     { (grib_yyval.act) = grib_action_create_meta(grib_parser_context,(grib_yyvsp[(2) - (8)].str),(grib_yyvsp[(3) - (8)].str),(grib_yyvsp[(5) - (8)].explist),(grib_yyvsp[(7) - (8)].explist),(grib_yyvsp[(8) - (8)].lval),NULL); free((grib_yyvsp[(2) - (8)].str));free((grib_yyvsp[(3) - (8)].str));}
     break;
 
-  case 113:
+  case 114:
 /* Line 1792 of yacc.c  */
-#line 557 "griby.y"
+#line 568 "griby.y"
     { (grib_yyval.act) = grib_action_create_meta(grib_parser_context,(grib_yyvsp[(4) - (10)].str),(grib_yyvsp[(5) - (10)].str),(grib_yyvsp[(7) - (10)].explist),(grib_yyvsp[(9) - (10)].explist),(grib_yyvsp[(10) - (10)].lval),(grib_yyvsp[(2) - (10)].str)); free((grib_yyvsp[(4) - (10)].str));free((grib_yyvsp[(5) - (10)].str));free((grib_yyvsp[(2) - (10)].str));}
     break;
 
-  case 114:
+  case 115:
 /* Line 1792 of yacc.c  */
-#line 560 "griby.y"
+#line 571 "griby.y"
     {
       grib_arguments* a = grib_arguments_new(
         grib_parser_context,
@@ -3126,9 +3186,9 @@ grib_yyreduce:
     }
     break;
 
-  case 115:
+  case 116:
 /* Line 1792 of yacc.c  */
-#line 572 "griby.y"
+#line 583 "griby.y"
     {
       grib_arguments* a = grib_arguments_new(
         grib_parser_context,
@@ -3142,9 +3202,9 @@ grib_yyreduce:
     }
     break;
 
-  case 116:
+  case 117:
 /* Line 1792 of yacc.c  */
-#line 584 "griby.y"
+#line 595 "griby.y"
     {
       grib_arguments* a = grib_arguments_new(
         grib_parser_context,
@@ -3158,807 +3218,807 @@ grib_yyreduce:
     }
     break;
 
-  case 117:
+  case 118:
 /* Line 1792 of yacc.c  */
-#line 596 "griby.y"
+#line 607 "griby.y"
     { (grib_yyval.act) = grib_action_create_put(grib_parser_context,(grib_yyvsp[(2) - (5)].str),(grib_yyvsp[(4) - (5)].explist));free((grib_yyvsp[(2) - (5)].str));}
     break;
 
-  case 118:
+  case 119:
 /* Line 1792 of yacc.c  */
-#line 599 "griby.y"
+#line 610 "griby.y"
     { (grib_yyval.act) = grib_action_create_remove(grib_parser_context,(grib_yyvsp[(2) - (2)].explist));}
     break;
 
-  case 119:
+  case 120:
 /* Line 1792 of yacc.c  */
-#line 601 "griby.y"
+#line 612 "griby.y"
     { (grib_yyval.act) = grib_action_create_rename(grib_parser_context,(grib_yyvsp[(3) - (6)].str),(grib_yyvsp[(5) - (6)].str));free((grib_yyvsp[(3) - (6)].str));free((grib_yyvsp[(5) - (6)].str));}
     break;
 
-  case 120:
+  case 121:
 /* Line 1792 of yacc.c  */
-#line 604 "griby.y"
+#line 615 "griby.y"
     { (grib_yyval.act) = grib_action_create_assert(grib_parser_context,(grib_yyvsp[(3) - (4)].exp));}
     break;
 
-  case 121:
+  case 122:
 /* Line 1792 of yacc.c  */
-#line 607 "griby.y"
+#line 618 "griby.y"
     { (grib_yyval.act) = grib_action_create_modify(grib_parser_context,(grib_yyvsp[(2) - (3)].str),(grib_yyvsp[(3) - (3)].lval)); free((grib_yyvsp[(2) - (3)].str));}
     break;
 
-  case 122:
+  case 123:
 /* Line 1792 of yacc.c  */
-#line 609 "griby.y"
+#line 620 "griby.y"
     { (grib_yyval.act) = grib_action_create_set_missing(grib_parser_context,(grib_yyvsp[(2) - (4)].str)); free((grib_yyvsp[(2) - (4)].str)); }
     break;
 
-  case 123:
+  case 124:
 /* Line 1792 of yacc.c  */
-#line 610 "griby.y"
+#line 621 "griby.y"
     { (grib_yyval.act) = grib_action_create_set(grib_parser_context,(grib_yyvsp[(2) - (4)].str),(grib_yyvsp[(4) - (4)].exp),0); free((grib_yyvsp[(2) - (4)].str)); }
     break;
 
-  case 124:
+  case 125:
 /* Line 1792 of yacc.c  */
-#line 611 "griby.y"
+#line 622 "griby.y"
     { (grib_yyval.act) = grib_action_create_set_darray(grib_parser_context,(grib_yyvsp[(2) - (6)].str),(grib_yyvsp[(5) - (6)].dvalue)); free((grib_yyvsp[(2) - (6)].str)); }
     break;
 
-  case 125:
+  case 126:
 /* Line 1792 of yacc.c  */
-#line 612 "griby.y"
+#line 623 "griby.y"
     { (grib_yyval.act) = grib_action_create_set_sarray(grib_parser_context,(grib_yyvsp[(2) - (6)].str),(grib_yyvsp[(5) - (6)].svalue)); free((grib_yyvsp[(2) - (6)].str)); }
     break;
 
-  case 126:
+  case 127:
 /* Line 1792 of yacc.c  */
-#line 614 "griby.y"
+#line 625 "griby.y"
     { (grib_yyval.act) = grib_action_create_set(grib_parser_context,(grib_yyvsp[(2) - (4)].str),(grib_yyvsp[(4) - (4)].exp),1); free((grib_yyvsp[(2) - (4)].str)); }
     break;
 
-  case 127:
+  case 128:
 /* Line 1792 of yacc.c  */
-#line 617 "griby.y"
+#line 628 "griby.y"
     { (grib_yyval.act) = grib_action_create_write(grib_parser_context,(grib_yyvsp[(2) - (2)].str),0,0); free((grib_yyvsp[(2) - (2)].str));}
     break;
 
-  case 128:
+  case 129:
 /* Line 1792 of yacc.c  */
-#line 618 "griby.y"
+#line 629 "griby.y"
     { (grib_yyval.act) = grib_action_create_write(grib_parser_context,"",0,0); }
     break;
 
-  case 129:
+  case 130:
 /* Line 1792 of yacc.c  */
-#line 619 "griby.y"
+#line 630 "griby.y"
     { (grib_yyval.act) = grib_action_create_write(grib_parser_context,(grib_yyvsp[(5) - (5)].str),0,(grib_yyvsp[(3) - (5)].lval)); free((grib_yyvsp[(5) - (5)].str));}
     break;
 
-  case 130:
+  case 131:
 /* Line 1792 of yacc.c  */
-#line 620 "griby.y"
+#line 631 "griby.y"
     { (grib_yyval.act) = grib_action_create_write(grib_parser_context,"",0,(grib_yyvsp[(3) - (4)].lval)); }
     break;
 
-  case 131:
+  case 132:
 /* Line 1792 of yacc.c  */
-#line 621 "griby.y"
+#line 632 "griby.y"
     { (grib_yyval.act) = grib_action_create_write(grib_parser_context,(grib_yyvsp[(2) - (2)].str),1,0); free((grib_yyvsp[(2) - (2)].str));}
     break;
 
-  case 132:
+  case 133:
 /* Line 1792 of yacc.c  */
-#line 622 "griby.y"
+#line 633 "griby.y"
     { (grib_yyval.act) = grib_action_create_write(grib_parser_context,"",1,0); }
     break;
 
-  case 133:
+  case 134:
 /* Line 1792 of yacc.c  */
-#line 623 "griby.y"
+#line 634 "griby.y"
     { (grib_yyval.act) = grib_action_create_write(grib_parser_context,(grib_yyvsp[(5) - (5)].str),1,(grib_yyvsp[(3) - (5)].lval)); free((grib_yyvsp[(5) - (5)].str));}
     break;
 
-  case 134:
+  case 135:
 /* Line 1792 of yacc.c  */
-#line 624 "griby.y"
+#line 635 "griby.y"
     { (grib_yyval.act) = grib_action_create_write(grib_parser_context,"",1,(grib_yyvsp[(3) - (4)].lval)); }
     break;
 
-  case 135:
+  case 136:
 /* Line 1792 of yacc.c  */
-#line 626 "griby.y"
+#line 637 "griby.y"
     { (grib_yyval.act) = grib_action_create_close(grib_parser_context,(grib_yyvsp[(3) - (4)].str)); free((grib_yyvsp[(3) - (4)].str));}
     break;
 
-  case 136:
+  case 137:
 /* Line 1792 of yacc.c  */
-#line 627 "griby.y"
+#line 638 "griby.y"
     { (grib_yyval.act) = grib_action_create_print(grib_parser_context,(grib_yyvsp[(2) - (2)].str),0); free((grib_yyvsp[(2) - (2)].str)); }
     break;
 
-  case 137:
+  case 138:
 /* Line 1792 of yacc.c  */
-#line 628 "griby.y"
+#line 639 "griby.y"
     { (grib_yyval.act) = grib_action_create_print(grib_parser_context,(grib_yyvsp[(5) - (5)].str),(grib_yyvsp[(3) - (5)].str)); free((grib_yyvsp[(5) - (5)].str)); free((grib_yyvsp[(3) - (5)].str));}
     break;
 
-  case 138:
+  case 139:
 /* Line 1792 of yacc.c  */
-#line 629 "griby.y"
+#line 640 "griby.y"
     { (grib_yyval.act) = grib_action_create_print(grib_parser_context,(grib_yyvsp[(5) - (5)].str),(grib_yyvsp[(3) - (5)].str)); free((grib_yyvsp[(5) - (5)].str)); free((grib_yyvsp[(3) - (5)].str));}
     break;
 
-  case 139:
+  case 140:
 /* Line 1792 of yacc.c  */
-#line 630 "griby.y"
+#line 641 "griby.y"
     { (grib_yyval.act) = grib_action_create_print(grib_parser_context,"",0);  }
     break;
 
-  case 140:
+  case 141:
 /* Line 1792 of yacc.c  */
-#line 634 "griby.y"
+#line 645 "griby.y"
     { (grib_yyval.act) = grib_action_create_if(grib_parser_context,(grib_yyvsp[(3) - (7)].exp),(grib_yyvsp[(6) - (7)].act),0,0,grib_yylineno,file_being_parsed()); }
     break;
 
-  case 141:
+  case 142:
 /* Line 1792 of yacc.c  */
-#line 635 "griby.y"
+#line 646 "griby.y"
     { (grib_yyval.act) = grib_action_create_if(grib_parser_context,(grib_yyvsp[(3) - (11)].exp),(grib_yyvsp[(6) - (11)].act),(grib_yyvsp[(10) - (11)].act),0,grib_yylineno,file_being_parsed()); }
     break;
 
-  case 142:
+  case 143:
 /* Line 1792 of yacc.c  */
-#line 636 "griby.y"
+#line 647 "griby.y"
     { (grib_yyval.act) = grib_action_create_if(grib_parser_context,(grib_yyvsp[(3) - (7)].exp),(grib_yyvsp[(6) - (7)].act),0,1,grib_yylineno,file_being_parsed()); }
     break;
 
-  case 143:
+  case 144:
 /* Line 1792 of yacc.c  */
-#line 637 "griby.y"
+#line 648 "griby.y"
     { (grib_yyval.act) = grib_action_create_if(grib_parser_context,(grib_yyvsp[(3) - (11)].exp),(grib_yyvsp[(6) - (11)].act),(grib_yyvsp[(10) - (11)].act),1,grib_yylineno,file_being_parsed()); }
     break;
 
-  case 144:
+  case 145:
 /* Line 1792 of yacc.c  */
-#line 641 "griby.y"
+#line 652 "griby.y"
     { (grib_yyval.act) = grib_action_create_when(grib_parser_context,(grib_yyvsp[(3) - (6)].exp),(grib_yyvsp[(5) - (6)].act),NULL); }
     break;
 
-  case 145:
+  case 146:
 /* Line 1792 of yacc.c  */
-#line 642 "griby.y"
+#line 653 "griby.y"
     { (grib_yyval.act) = grib_action_create_when(grib_parser_context,(grib_yyvsp[(3) - (7)].exp),(grib_yyvsp[(6) - (7)].act),NULL); }
     break;
 
-  case 146:
+  case 147:
 /* Line 1792 of yacc.c  */
-#line 643 "griby.y"
+#line 654 "griby.y"
     { (grib_yyval.act) = grib_action_create_when(grib_parser_context,(grib_yyvsp[(3) - (11)].exp),(grib_yyvsp[(6) - (11)].act),(grib_yyvsp[(10) - (11)].act)); }
     break;
 
-  case 147:
+  case 148:
 /* Line 1792 of yacc.c  */
-#line 646 "griby.y"
+#line 657 "griby.y"
     { (grib_yyval.act) = grib_action_create_set(grib_parser_context,(grib_yyvsp[(2) - (4)].str),(grib_yyvsp[(4) - (4)].exp),0); free((grib_yyvsp[(2) - (4)].str)); }
     break;
 
-  case 148:
+  case 149:
 /* Line 1792 of yacc.c  */
-#line 647 "griby.y"
+#line 658 "griby.y"
     { (grib_yyval.act) = grib_action_create_set(grib_parser_context,(grib_yyvsp[(2) - (4)].str),(grib_yyvsp[(4) - (4)].exp),1); free((grib_yyvsp[(2) - (4)].str)); }
     break;
 
-  case 150:
+  case 151:
 /* Line 1792 of yacc.c  */
-#line 651 "griby.y"
+#line 662 "griby.y"
     { (grib_yyvsp[(1) - (3)].act)->next = (grib_yyvsp[(2) - (3)].act); (grib_yyval.act) = (grib_yyvsp[(1) - (3)].act); }
     break;
 
-  case 151:
+  case 152:
 /* Line 1792 of yacc.c  */
-#line 655 "griby.y"
+#line 666 "griby.y"
     { (grib_yyval.explist) = NULL ;}
     break;
 
-  case 152:
+  case 153:
 /* Line 1792 of yacc.c  */
-#line 656 "griby.y"
+#line 667 "griby.y"
     { (grib_yyval.explist) = (grib_yyvsp[(2) - (2)].explist) ;}
     break;
 
-  case 153:
+  case 154:
 /* Line 1792 of yacc.c  */
-#line 659 "griby.y"
+#line 670 "griby.y"
     { (grib_yyval.lval) = 0 ; }
     break;
 
-  case 154:
+  case 155:
 /* Line 1792 of yacc.c  */
-#line 660 "griby.y"
+#line 671 "griby.y"
     { (grib_yyval.lval) = (grib_yyvsp[(2) - (2)].lval); }
     break;
 
-  case 156:
+  case 157:
 /* Line 1792 of yacc.c  */
-#line 664 "griby.y"
+#line 675 "griby.y"
     { (grib_yyval.lval) = (grib_yyvsp[(1) - (3)].lval) | (grib_yyvsp[(3) - (3)].lval); }
     break;
 
-  case 157:
+  case 158:
 /* Line 1792 of yacc.c  */
-#line 667 "griby.y"
+#line 678 "griby.y"
     { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_READ_ONLY; }
     break;
 
-  case 158:
+  case 159:
 /* Line 1792 of yacc.c  */
-#line 668 "griby.y"
+#line 679 "griby.y"
     { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_LOWERCASE; }
     break;
 
-  case 159:
+  case 160:
 /* Line 1792 of yacc.c  */
-#line 669 "griby.y"
+#line 680 "griby.y"
     { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_DUMP; }
     break;
 
-  case 160:
+  case 161:
 /* Line 1792 of yacc.c  */
-#line 670 "griby.y"
+#line 681 "griby.y"
     { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_NO_COPY; }
     break;
 
-  case 161:
+  case 162:
 /* Line 1792 of yacc.c  */
-#line 671 "griby.y"
+#line 682 "griby.y"
     { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_NO_FAIL; }
     break;
 
-  case 162:
+  case 163:
 /* Line 1792 of yacc.c  */
-#line 672 "griby.y"
+#line 683 "griby.y"
     { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_HIDDEN; }
     break;
 
-  case 163:
+  case 164:
 /* Line 1792 of yacc.c  */
-#line 673 "griby.y"
+#line 684 "griby.y"
     { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_EDITION_SPECIFIC; }
     break;
 
-  case 164:
+  case 165:
 /* Line 1792 of yacc.c  */
-#line 674 "griby.y"
+#line 685 "griby.y"
     { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_CAN_BE_MISSING; }
     break;
 
-  case 165:
+  case 166:
 /* Line 1792 of yacc.c  */
-#line 675 "griby.y"
+#line 686 "griby.y"
     { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_CONSTRAINT; }
     break;
 
-  case 166:
+  case 167:
 /* Line 1792 of yacc.c  */
-#line 676 "griby.y"
+#line 687 "griby.y"
     { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_COPY_OK; }
     break;
 
-  case 167:
+  case 168:
 /* Line 1792 of yacc.c  */
-#line 677 "griby.y"
+#line 688 "griby.y"
     { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_TRANSIENT; }
     break;
 
-  case 168:
+  case 169:
 /* Line 1792 of yacc.c  */
-#line 678 "griby.y"
+#line 689 "griby.y"
     { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_STRING_TYPE; }
     break;
 
-  case 169:
+  case 170:
 /* Line 1792 of yacc.c  */
-#line 679 "griby.y"
+#line 690 "griby.y"
     { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_LONG_TYPE; }
     break;
 
-  case 170:
+  case 171:
 /* Line 1792 of yacc.c  */
-#line 680 "griby.y"
+#line 691 "griby.y"
     { (grib_yyval.lval) = GRIB_ACCESSOR_FLAG_DOUBLE_TYPE; }
     break;
 
-  case 171:
+  case 172:
 /* Line 1792 of yacc.c  */
-#line 683 "griby.y"
+#line 694 "griby.y"
     { (grib_yyval.act) = grib_action_create_list(grib_parser_context,(grib_yyvsp[(1) - (8)].str),(grib_yyvsp[(4) - (8)].exp),(grib_yyvsp[(7) - (8)].act)); free((grib_yyvsp[(1) - (8)].str)); }
     break;
 
-  case 172:
+  case 173:
 /* Line 1792 of yacc.c  */
-#line 686 "griby.y"
+#line 697 "griby.y"
     { (grib_yyval.act) = grib_action_create_while(grib_parser_context,(grib_yyvsp[(3) - (7)].exp),(grib_yyvsp[(6) - (7)].act));  }
     break;
 
-  case 173:
+  case 174:
 /* Line 1792 of yacc.c  */
-#line 689 "griby.y"
+#line 700 "griby.y"
     { (grib_yyval.act) = grib_action_create_trigger(grib_parser_context,(grib_yyvsp[(3) - (7)].explist),(grib_yyvsp[(6) - (7)].act));  }
     break;
 
-  case 174:
+  case 175:
 /* Line 1792 of yacc.c  */
-#line 692 "griby.y"
+#line 703 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (6)].str),(grib_yyvsp[(4) - (6)].concept_value),0,0,0,0,0,0,(grib_yyvsp[(6) - (6)].lval),0);  free((grib_yyvsp[(2) - (6)].str)); }
     break;
 
-  case 175:
+  case 176:
 /* Line 1792 of yacc.c  */
-#line 693 "griby.y"
+#line 704 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (9)].str),(grib_yyvsp[(7) - (9)].concept_value),0,0,(grib_yyvsp[(4) - (9)].str),0,0,0,(grib_yyvsp[(9) - (9)].lval),0);  free((grib_yyvsp[(2) - (9)].str));free((grib_yyvsp[(4) - (9)].str)); }
     break;
 
-  case 176:
+  case 177:
 /* Line 1792 of yacc.c  */
-#line 694 "griby.y"
+#line 705 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (12)].str),0,(grib_yyvsp[(6) - (12)].str),0,(grib_yyvsp[(4) - (12)].str),(grib_yyvsp[(8) - (12)].str),(grib_yyvsp[(10) - (12)].str),0,(grib_yyvsp[(12) - (12)].lval),0);  free((grib_yyvsp[(2) - (12)].str));free((grib_yyvsp[(6) - (12)].str));free((grib_yyvsp[(4) - (12)].str));free((grib_yyvsp[(8) - (12)].str));free((grib_yyvsp[(10) - (12)].str)); }
     break;
 
-  case 177:
+  case 178:
 /* Line 1792 of yacc.c  */
-#line 695 "griby.y"
+#line 706 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (14)].str),0,(grib_yyvsp[(6) - (14)].str),0,(grib_yyvsp[(4) - (14)].str),(grib_yyvsp[(8) - (14)].str),(grib_yyvsp[(10) - (14)].str),(grib_yyvsp[(12) - (14)].str),(grib_yyvsp[(14) - (14)].lval),0);  free((grib_yyvsp[(2) - (14)].str));free((grib_yyvsp[(6) - (14)].str));free((grib_yyvsp[(4) - (14)].str));free((grib_yyvsp[(8) - (14)].str));free((grib_yyvsp[(10) - (14)].str));free((grib_yyvsp[(12) - (14) [...]
     break;
 
-  case 178:
+  case 179:
 /* Line 1792 of yacc.c  */
-#line 696 "griby.y"
+#line 707 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (10)].str),0,(grib_yyvsp[(6) - (10)].str),0,(grib_yyvsp[(4) - (10)].str),(grib_yyvsp[(8) - (10)].str),0,0,(grib_yyvsp[(10) - (10)].lval),0);  free((grib_yyvsp[(2) - (10)].str));free((grib_yyvsp[(6) - (10)].str));free((grib_yyvsp[(4) - (10)].str));free((grib_yyvsp[(8) - (10)].str)); }
     break;
 
-  case 179:
+  case 180:
 /* Line 1792 of yacc.c  */
-#line 697 "griby.y"
+#line 708 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (14)].str),0,(grib_yyvsp[(8) - (14)].str),(grib_yyvsp[(2) - (14)].str),(grib_yyvsp[(6) - (14)].str),(grib_yyvsp[(10) - (14)].str),(grib_yyvsp[(12) - (14)].str),0,(grib_yyvsp[(14) - (14)].lval),0);  free((grib_yyvsp[(4) - (14)].str));free((grib_yyvsp[(8) - (14)].str));free((grib_yyvsp[(6) - (14)].str));free((grib_yyvsp[(10) - (14)].str)); free((grib_yyvsp[(12) - (14)].str)); free((grib_yyvsp[(2) - (1 [...]
     break;
 
-  case 180:
+  case 181:
 /* Line 1792 of yacc.c  */
-#line 698 "griby.y"
+#line 709 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (12)].str),0,(grib_yyvsp[(8) - (12)].str),(grib_yyvsp[(2) - (12)].str),(grib_yyvsp[(6) - (12)].str),(grib_yyvsp[(10) - (12)].str),0,0,(grib_yyvsp[(12) - (12)].lval),0);  free((grib_yyvsp[(4) - (12)].str));free((grib_yyvsp[(8) - (12)].str));free((grib_yyvsp[(6) - (12)].str));free((grib_yyvsp[(10) - (12)].str)); free((grib_yyvsp[(2) - (12)].str));}
     break;
 
-  case 181:
+  case 182:
 /* Line 1792 of yacc.c  */
-#line 699 "griby.y"
+#line 710 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (8)].str),(grib_yyvsp[(6) - (8)].concept_value),0,(grib_yyvsp[(2) - (8)].str),0,0,0,0,(grib_yyvsp[(8) - (8)].lval),0);  free((grib_yyvsp[(2) - (8)].str));free((grib_yyvsp[(4) - (8)].str)); }
     break;
 
-  case 182:
+  case 183:
 /* Line 1792 of yacc.c  */
-#line 700 "griby.y"
+#line 711 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (11)].str),(grib_yyvsp[(9) - (11)].concept_value),0,(grib_yyvsp[(2) - (11)].str),(grib_yyvsp[(6) - (11)].str),0,0,0,(grib_yyvsp[(11) - (11)].lval),0);  free((grib_yyvsp[(2) - (11)].str));free((grib_yyvsp[(4) - (11)].str));free((grib_yyvsp[(6) - (11)].str)); }
     break;
 
-  case 183:
+  case 184:
 /* Line 1792 of yacc.c  */
-#line 701 "griby.y"
+#line 712 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (6)].str),(grib_yyvsp[(4) - (6)].concept_value),0,0,0,0,0,0,(grib_yyvsp[(6) - (6)].lval),1);  free((grib_yyvsp[(2) - (6)].str)); }
     break;
 
-  case 184:
+  case 185:
 /* Line 1792 of yacc.c  */
-#line 702 "griby.y"
+#line 713 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (9)].str),(grib_yyvsp[(7) - (9)].concept_value),0,0,(grib_yyvsp[(4) - (9)].str),0,0,0,(grib_yyvsp[(9) - (9)].lval),1);  free((grib_yyvsp[(2) - (9)].str));free((grib_yyvsp[(4) - (9)].str)); }
     break;
 
-  case 185:
+  case 186:
 /* Line 1792 of yacc.c  */
-#line 703 "griby.y"
+#line 714 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (12)].str),0,(grib_yyvsp[(6) - (12)].str),0,(grib_yyvsp[(4) - (12)].str),(grib_yyvsp[(8) - (12)].str),(grib_yyvsp[(10) - (12)].str),0,(grib_yyvsp[(12) - (12)].lval),1);  free((grib_yyvsp[(2) - (12)].str));free((grib_yyvsp[(6) - (12)].str));free((grib_yyvsp[(4) - (12)].str));free((grib_yyvsp[(8) - (12)].str));free((grib_yyvsp[(10) - (12)].str)); }
     break;
 
-  case 186:
+  case 187:
 /* Line 1792 of yacc.c  */
-#line 704 "griby.y"
+#line 715 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(2) - (10)].str),0,(grib_yyvsp[(6) - (10)].str),0,(grib_yyvsp[(4) - (10)].str),(grib_yyvsp[(8) - (10)].str),0,0,(grib_yyvsp[(10) - (10)].lval),1);  free((grib_yyvsp[(2) - (10)].str));free((grib_yyvsp[(6) - (10)].str));free((grib_yyvsp[(4) - (10)].str));free((grib_yyvsp[(8) - (10)].str)); }
     break;
 
-  case 187:
+  case 188:
 /* Line 1792 of yacc.c  */
-#line 705 "griby.y"
+#line 716 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (14)].str),0,(grib_yyvsp[(8) - (14)].str),(grib_yyvsp[(2) - (14)].str),(grib_yyvsp[(6) - (14)].str),(grib_yyvsp[(10) - (14)].str),(grib_yyvsp[(12) - (14)].str),0,(grib_yyvsp[(14) - (14)].lval),1);  free((grib_yyvsp[(4) - (14)].str));free((grib_yyvsp[(8) - (14)].str));free((grib_yyvsp[(6) - (14)].str));free((grib_yyvsp[(10) - (14)].str));free((grib_yyvsp[(12) - (14)].str)); free((grib_yyvsp[(2) - (14 [...]
     break;
 
-  case 188:
+  case 189:
 /* Line 1792 of yacc.c  */
-#line 706 "griby.y"
+#line 717 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (12)].str),0,(grib_yyvsp[(8) - (12)].str),(grib_yyvsp[(2) - (12)].str),(grib_yyvsp[(6) - (12)].str),(grib_yyvsp[(10) - (12)].str),0,0,(grib_yyvsp[(12) - (12)].lval),1);  free((grib_yyvsp[(4) - (12)].str));free((grib_yyvsp[(8) - (12)].str));free((grib_yyvsp[(6) - (12)].str));free((grib_yyvsp[(10) - (12)].str)); free((grib_yyvsp[(2) - (12)].str));}
     break;
 
-  case 189:
+  case 190:
 /* Line 1792 of yacc.c  */
-#line 707 "griby.y"
+#line 718 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (8)].str),(grib_yyvsp[(6) - (8)].concept_value),0,(grib_yyvsp[(2) - (8)].str),0,0,0,0,(grib_yyvsp[(8) - (8)].lval),1);  free((grib_yyvsp[(2) - (8)].str));free((grib_yyvsp[(4) - (8)].str)); }
     break;
 
-  case 190:
+  case 191:
 /* Line 1792 of yacc.c  */
-#line 708 "griby.y"
+#line 719 "griby.y"
     { (grib_yyval.act) = grib_action_create_concept(grib_parser_context,(grib_yyvsp[(4) - (11)].str),(grib_yyvsp[(9) - (11)].concept_value),0,(grib_yyvsp[(2) - (11)].str),(grib_yyvsp[(6) - (11)].str),0,0,0,(grib_yyvsp[(11) - (11)].lval),1);  free((grib_yyvsp[(2) - (11)].str));free((grib_yyvsp[(4) - (11)].str));free((grib_yyvsp[(6) - (11)].str)); }
     break;
 
-  case 192:
+  case 193:
 /* Line 1792 of yacc.c  */
-#line 713 "griby.y"
+#line 724 "griby.y"
     { (grib_yyval.concept_value) = (grib_yyvsp[(2) - (2)].concept_value); (grib_yyvsp[(2) - (2)].concept_value)->next = (grib_yyvsp[(1) - (2)].concept_value);   }
     break;
 
-  case 194:
+  case 195:
 /* Line 1792 of yacc.c  */
-#line 717 "griby.y"
+#line 728 "griby.y"
     { (grib_yyval.hash_array_value) = (grib_yyvsp[(2) - (2)].hash_array_value); (grib_yyvsp[(2) - (2)].hash_array_value)->next = (grib_yyvsp[(1) - (2)].hash_array_value);   }
     break;
 
-  case 195:
+  case 196:
 /* Line 1792 of yacc.c  */
-#line 720 "griby.y"
+#line 731 "griby.y"
     { (grib_yyval.act) = grib_action_create_hash_array(grib_parser_context,(grib_yyvsp[(2) - (6)].str),(grib_yyvsp[(4) - (6)].hash_array_value),0,0,0,0,0,0,(grib_yyvsp[(6) - (6)].lval),0);  free((grib_yyvsp[(2) - (6)].str)); }
     break;
 
-  case 196:
+  case 197:
 /* Line 1792 of yacc.c  */
-#line 721 "griby.y"
+#line 732 "griby.y"
     { (grib_yyval.act) = grib_action_create_hash_array(grib_parser_context,(grib_yyvsp[(2) - (12)].str),0,(grib_yyvsp[(6) - (12)].str),0,(grib_yyvsp[(4) - (12)].str),(grib_yyvsp[(8) - (12)].str),(grib_yyvsp[(10) - (12)].str),0,(grib_yyvsp[(12) - (12)].lval),0);  free((grib_yyvsp[(2) - (12)].str));free((grib_yyvsp[(6) - (12)].str));free((grib_yyvsp[(4) - (12)].str));free((grib_yyvsp[(8) - (12)].str));free((grib_yyvsp[(10) - (12)].str)); }
     break;
 
-  case 198:
+  case 199:
 /* Line 1792 of yacc.c  */
-#line 725 "griby.y"
+#line 736 "griby.y"
     { (grib_yyval.case_value) = (grib_yyvsp[(2) - (2)].case_value); (grib_yyvsp[(2) - (2)].case_value)->next = (grib_yyvsp[(1) - (2)].case_value);   }
     break;
 
-  case 199:
+  case 200:
 /* Line 1792 of yacc.c  */
-#line 728 "griby.y"
+#line 739 "griby.y"
     { (grib_yyval.case_value) = grib_case_new(grib_parser_context,(grib_yyvsp[(2) - (4)].explist),(grib_yyvsp[(4) - (4)].act));  }
     break;
 
-  case 200:
+  case 201:
 /* Line 1792 of yacc.c  */
-#line 732 "griby.y"
+#line 743 "griby.y"
     { (grib_yyval.act) = grib_action_create_switch(grib_parser_context,(grib_yyvsp[(3) - (10)].explist),(grib_yyvsp[(6) - (10)].case_value),(grib_yyvsp[(9) - (10)].act)); }
     break;
 
-  case 201:
+  case 202:
 /* Line 1792 of yacc.c  */
-#line 733 "griby.y"
+#line 744 "griby.y"
     { (grib_yyval.act) = grib_action_create_switch(grib_parser_context,(grib_yyvsp[(3) - (9)].explist),(grib_yyvsp[(6) - (9)].case_value),grib_action_create_noop(grib_parser_context,"continue")); }
     break;
 
-  case 202:
+  case 203:
 /* Line 1792 of yacc.c  */
-#line 734 "griby.y"
+#line 745 "griby.y"
     { (grib_yyval.act) = grib_action_create_switch(grib_parser_context,(grib_yyvsp[(3) - (7)].explist),(grib_yyvsp[(6) - (7)].case_value),0); }
     break;
 
-  case 203:
+  case 204:
 /* Line 1792 of yacc.c  */
-#line 737 "griby.y"
+#line 748 "griby.y"
     {
 	  				(grib_yyval.concept_value) = grib_concept_value_new(grib_parser_context,(grib_yyvsp[(1) - (5)].str),(grib_yyvsp[(4) - (5)].concept_condition)); free((grib_yyvsp[(1) - (5)].str));}
     break;
 
-  case 204:
+  case 205:
 /* Line 1792 of yacc.c  */
-#line 739 "griby.y"
+#line 750 "griby.y"
     {
 	  				(grib_yyval.concept_value) = grib_concept_value_new(grib_parser_context,(grib_yyvsp[(1) - (5)].str),(grib_yyvsp[(4) - (5)].concept_condition)); free((grib_yyvsp[(1) - (5)].str));}
     break;
 
-  case 205:
+  case 206:
 /* Line 1792 of yacc.c  */
-#line 741 "griby.y"
+#line 752 "griby.y"
     {
 					char buf[80]; sprintf(buf,"%ld",(long)(grib_yyvsp[(1) - (5)].lval)); (grib_yyval.concept_value) = grib_concept_value_new(grib_parser_context,buf,(grib_yyvsp[(4) - (5)].concept_condition));}
     break;
 
-  case 206:
+  case 207:
 /* Line 1792 of yacc.c  */
-#line 743 "griby.y"
+#line 754 "griby.y"
     {
 					char buf[80]; sprintf(buf,"%g",(double)(grib_yyvsp[(1) - (5)].dval)); (grib_yyval.concept_value) = grib_concept_value_new(grib_parser_context,buf,(grib_yyvsp[(4) - (5)].concept_condition));}
     break;
 
-  case 208:
+  case 209:
 /* Line 1792 of yacc.c  */
-#line 748 "griby.y"
+#line 759 "griby.y"
     { (grib_yyvsp[(1) - (2)].concept_condition)->next = (grib_yyvsp[(2) - (2)].concept_condition); (grib_yyval.concept_condition) = (grib_yyvsp[(1) - (2)].concept_condition); }
     break;
 
-  case 209:
+  case 210:
 /* Line 1792 of yacc.c  */
-#line 751 "griby.y"
+#line 762 "griby.y"
     { (grib_yyval.concept_condition) = grib_concept_condition_new(grib_parser_context,(grib_yyvsp[(1) - (4)].str),(grib_yyvsp[(3) - (4)].exp),0); free((grib_yyvsp[(1) - (4)].str)); }
     break;
 
-  case 210:
+  case 211:
 /* Line 1792 of yacc.c  */
-#line 752 "griby.y"
+#line 763 "griby.y"
     { (grib_yyval.concept_condition) = grib_concept_condition_new(grib_parser_context,(grib_yyvsp[(1) - (6)].str),0,(grib_yyvsp[(4) - (6)].ivalue)); free((grib_yyvsp[(1) - (6)].str)); }
     break;
 
-  case 211:
+  case 212:
 /* Line 1792 of yacc.c  */
-#line 756 "griby.y"
+#line 767 "griby.y"
     {
 	  				(grib_yyval.hash_array_value) = grib_integer_hash_array_value_new(grib_parser_context,(grib_yyvsp[(1) - (5)].str),(grib_yyvsp[(4) - (5)].ivalue)); free((grib_yyvsp[(1) - (5)].str));}
     break;
 
-  case 212:
+  case 213:
 /* Line 1792 of yacc.c  */
-#line 758 "griby.y"
+#line 769 "griby.y"
     {
 	  				(grib_yyval.hash_array_value) = grib_integer_hash_array_value_new(grib_parser_context,(grib_yyvsp[(1) - (5)].str),(grib_yyvsp[(4) - (5)].ivalue)); free((grib_yyvsp[(1) - (5)].str));}
     break;
 
-  case 213:
+  case 214:
 /* Line 1792 of yacc.c  */
-#line 762 "griby.y"
+#line 773 "griby.y"
     { (grib_yyval.exp) = new_accessor_expression(grib_parser_context,(grib_yyvsp[(3) - (8)].str),(grib_yyvsp[(5) - (8)].lval),(grib_yyvsp[(7) - (8)].lval));  free((grib_yyvsp[(3) - (8)].str)); }
     break;
 
-  case 214:
+  case 215:
 /* Line 1792 of yacc.c  */
-#line 763 "griby.y"
+#line 774 "griby.y"
     { (grib_yyval.exp) = new_accessor_expression(grib_parser_context,(grib_yyvsp[(1) - (1)].str),0,0); free((grib_yyvsp[(1) - (1)].str)); }
     break;
 
-  case 215:
+  case 216:
 /* Line 1792 of yacc.c  */
-#line 764 "griby.y"
+#line 775 "griby.y"
     { (grib_yyval.exp) = new_sub_string_expression(grib_parser_context,(grib_yyvsp[(3) - (8)].str),(grib_yyvsp[(5) - (8)].lval),(grib_yyvsp[(7) - (8)].lval));  free((grib_yyvsp[(3) - (8)].str)); }
     break;
 
-  case 216:
+  case 217:
 /* Line 1792 of yacc.c  */
-#line 765 "griby.y"
+#line 776 "griby.y"
     { (grib_yyval.exp) = new_string_expression(grib_parser_context,(grib_yyvsp[(1) - (1)].str));  free((grib_yyvsp[(1) - (1)].str)); }
     break;
 
-  case 218:
+  case 219:
 /* Line 1792 of yacc.c  */
-#line 769 "griby.y"
+#line 780 "griby.y"
     { (grib_yyval.exp) = new_long_expression(grib_parser_context,(grib_yyvsp[(1) - (1)].lval));  }
     break;
 
-  case 219:
+  case 220:
 /* Line 1792 of yacc.c  */
-#line 770 "griby.y"
+#line 781 "griby.y"
     { (grib_yyval.exp) = new_double_expression(grib_parser_context,(grib_yyvsp[(1) - (1)].dval));  /* TODO: change to new_float_expression*/}
     break;
 
-  case 220:
+  case 221:
 /* Line 1792 of yacc.c  */
-#line 772 "griby.y"
+#line 783 "griby.y"
     { (grib_yyval.exp) = NULL; }
     break;
 
-  case 221:
+  case 222:
 /* Line 1792 of yacc.c  */
-#line 773 "griby.y"
+#line 784 "griby.y"
     { (grib_yyval.exp) = new_true_expression(grib_parser_context); }
     break;
 
-  case 222:
+  case 223:
 /* Line 1792 of yacc.c  */
-#line 774 "griby.y"
+#line 785 "griby.y"
     { (grib_yyval.exp) = (grib_yyvsp[(2) - (3)].exp); }
     break;
 
-  case 223:
+  case 224:
 /* Line 1792 of yacc.c  */
-#line 775 "griby.y"
+#line 786 "griby.y"
     { (grib_yyval.exp) = new_unop_expression(grib_parser_context,&grib_op_neg,&grib_op_neg_d,(grib_yyvsp[(2) - (2)].exp)); }
     break;
 
-  case 224:
+  case 225:
 /* Line 1792 of yacc.c  */
-#line 776 "griby.y"
+#line 787 "griby.y"
     { (grib_yyval.exp) = new_func_expression(grib_parser_context,(grib_yyvsp[(1) - (3)].str),NULL); free((grib_yyvsp[(1) - (3)].str));}
     break;
 
-  case 225:
+  case 226:
 /* Line 1792 of yacc.c  */
-#line 777 "griby.y"
+#line 788 "griby.y"
     { (grib_yyval.exp) = new_func_expression(grib_parser_context,(grib_yyvsp[(1) - (4)].str),(grib_yyvsp[(3) - (4)].explist)); free((grib_yyvsp[(1) - (4)].str));}
     break;
 
-  case 226:
+  case 227:
 /* Line 1792 of yacc.c  */
-#line 781 "griby.y"
+#line 792 "griby.y"
     { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_pow,NULL,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 228:
+  case 229:
 /* Line 1792 of yacc.c  */
-#line 785 "griby.y"
+#line 796 "griby.y"
     { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_mul,&grib_op_mul_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 229:
+  case 230:
 /* Line 1792 of yacc.c  */
-#line 786 "griby.y"
+#line 797 "griby.y"
     { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_div,&grib_op_div_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 230:
+  case 231:
 /* Line 1792 of yacc.c  */
-#line 787 "griby.y"
+#line 798 "griby.y"
     { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_modulo,NULL,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 231:
+  case 232:
 /* Line 1792 of yacc.c  */
-#line 788 "griby.y"
+#line 799 "griby.y"
     { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_bit,NULL,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 232:
+  case 233:
 /* Line 1792 of yacc.c  */
-#line 789 "griby.y"
+#line 800 "griby.y"
     { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_bitoff,NULL,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 234:
+  case 235:
 /* Line 1792 of yacc.c  */
-#line 791 "griby.y"
+#line 802 "griby.y"
     { (grib_yyval.exp) = new_length_expression(grib_parser_context,(grib_yyvsp[(3) - (4)].str)); free((grib_yyvsp[(3) - (4)].str));}
     break;
 
-  case 235:
+  case 236:
 /* Line 1792 of yacc.c  */
-#line 792 "griby.y"
+#line 803 "griby.y"
     { (grib_yyval.exp) = new_is_in_list_expression(grib_parser_context,(grib_yyvsp[(3) - (6)].str),(grib_yyvsp[(5) - (6)].str)); free((grib_yyvsp[(3) - (6)].str));free((grib_yyvsp[(5) - (6)].str));}
     break;
 
-  case 236:
+  case 237:
 /* Line 1792 of yacc.c  */
-#line 793 "griby.y"
+#line 804 "griby.y"
     { (grib_yyval.exp) = new_is_in_dict_expression(grib_parser_context,(grib_yyvsp[(3) - (6)].str),(grib_yyvsp[(5) - (6)].str)); free((grib_yyvsp[(3) - (6)].str));free((grib_yyvsp[(5) - (6)].str));}
     break;
 
-  case 237:
+  case 238:
 /* Line 1792 of yacc.c  */
-#line 794 "griby.y"
+#line 805 "griby.y"
     { (grib_yyval.exp) = new_is_integer_expression(grib_parser_context,(grib_yyvsp[(3) - (6)].str),(grib_yyvsp[(5) - (6)].lval),0); free((grib_yyvsp[(3) - (6)].str));}
     break;
 
-  case 238:
+  case 239:
 /* Line 1792 of yacc.c  */
-#line 795 "griby.y"
+#line 806 "griby.y"
     { (grib_yyval.exp) = new_is_integer_expression(grib_parser_context,(grib_yyvsp[(3) - (8)].str),(grib_yyvsp[(5) - (8)].lval),(grib_yyvsp[(7) - (8)].lval)); free((grib_yyvsp[(3) - (8)].str));}
     break;
 
-  case 239:
+  case 240:
 /* Line 1792 of yacc.c  */
-#line 796 "griby.y"
+#line 807 "griby.y"
     { (grib_yyval.exp) = new_is_integer_expression(grib_parser_context,(grib_yyvsp[(3) - (4)].str),0,0); free((grib_yyvsp[(3) - (4)].str));}
     break;
 
-  case 240:
+  case 241:
 /* Line 1792 of yacc.c  */
-#line 799 "griby.y"
+#line 810 "griby.y"
     { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_add,&grib_op_add_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 241:
+  case 242:
 /* Line 1792 of yacc.c  */
-#line 800 "griby.y"
+#line 811 "griby.y"
     { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_sub,&grib_op_sub_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 243:
+  case 244:
 /* Line 1792 of yacc.c  */
-#line 804 "griby.y"
+#line 815 "griby.y"
     { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_gt,&grib_op_gt_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 244:
+  case 245:
 /* Line 1792 of yacc.c  */
-#line 806 "griby.y"
+#line 817 "griby.y"
     { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_eq,&grib_op_eq_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 245:
+  case 246:
 /* Line 1792 of yacc.c  */
-#line 807 "griby.y"
+#line 818 "griby.y"
     { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_lt,&grib_op_lt_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 246:
+  case 247:
 /* Line 1792 of yacc.c  */
-#line 808 "griby.y"
+#line 819 "griby.y"
     { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_ge,&grib_op_ge_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 247:
+  case 248:
 /* Line 1792 of yacc.c  */
-#line 809 "griby.y"
+#line 820 "griby.y"
     { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_le,&grib_op_le_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 248:
+  case 249:
 /* Line 1792 of yacc.c  */
-#line 810 "griby.y"
+#line 821 "griby.y"
     { (grib_yyval.exp) = new_binop_expression(grib_parser_context,&grib_op_ne,&grib_op_ne_d,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 249:
+  case 250:
 /* Line 1792 of yacc.c  */
-#line 811 "griby.y"
+#line 822 "griby.y"
     { (grib_yyval.exp) = new_string_compare_expression(grib_parser_context,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 250:
+  case 251:
 /* Line 1792 of yacc.c  */
-#line 816 "griby.y"
+#line 827 "griby.y"
     { (grib_yyval.exp) = new_unop_expression(grib_parser_context,&grib_op_not,NULL,(grib_yyvsp[(2) - (2)].exp)); }
     break;
 
-  case 252:
+  case 253:
 /* Line 1792 of yacc.c  */
-#line 820 "griby.y"
+#line 831 "griby.y"
     { (grib_yyval.exp) = new_logical_and_expression(grib_parser_context,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp)); }
     break;
 
-  case 254:
+  case 255:
 /* Line 1792 of yacc.c  */
-#line 824 "griby.y"
+#line 835 "griby.y"
     { (grib_yyval.exp) = new_logical_or_expression(grib_parser_context,(grib_yyvsp[(1) - (3)].exp),(grib_yyvsp[(3) - (3)].exp));}
     break;
 
-  case 259:
+  case 260:
 /* Line 1792 of yacc.c  */
-#line 838 "griby.y"
+#line 849 "griby.y"
     { (grib_yyval.rule_entry) = grib_new_rule_entry(grib_parser_context,(grib_yyvsp[(1) - (4)].str),(grib_yyvsp[(3) - (4)].exp)); free((grib_yyvsp[(1) - (4)].str)); }
     break;
 
-  case 260:
+  case 261:
 /* Line 1792 of yacc.c  */
-#line 839 "griby.y"
+#line 850 "griby.y"
     { (grib_yyval.rule_entry) = grib_new_rule_entry(grib_parser_context,"skip",0);}
     break;
 
-  case 262:
+  case 263:
 /* Line 1792 of yacc.c  */
-#line 843 "griby.y"
+#line 854 "griby.y"
     { (grib_yyvsp[(1) - (2)].rule_entry)->next = (grib_yyvsp[(2) - (2)].rule_entry); (grib_yyval.rule_entry) = (grib_yyvsp[(1) - (2)].rule_entry); }
     break;
 
-  case 263:
+  case 264:
 /* Line 1792 of yacc.c  */
-#line 846 "griby.y"
+#line 857 "griby.y"
     { (grib_yyval.rules) = grib_new_rule(grib_parser_context,NULL,(grib_yyvsp[(1) - (1)].rule_entry)); }
     break;
 
-  case 264:
+  case 265:
 /* Line 1792 of yacc.c  */
-#line 850 "griby.y"
+#line 861 "griby.y"
     { (grib_yyval.rules) = grib_new_rule(grib_parser_context,(grib_yyvsp[(3) - (7)].exp),(grib_yyvsp[(6) - (7)].rule_entry)); }
     break;
 
-  case 266:
+  case 267:
 /* Line 1792 of yacc.c  */
-#line 854 "griby.y"
+#line 865 "griby.y"
     { (grib_yyvsp[(1) - (2)].rules)->next = (grib_yyvsp[(2) - (2)].rules); (grib_yyval.rules) = (grib_yyvsp[(1) - (2)].rules); }
     break;
 
 
 /* Line 1792 of yacc.c  */
-#line 3962 "y.tab.c"
+#line 4022 "y.tab.c"
       default: break;
     }
   /* User semantic actions sometimes alter grib_yychar, and that requires
@@ -4190,7 +4250,7 @@ grib_yyreturn:
 
 
 /* Line 2055 of yacc.c  */
-#line 858 "griby.y"
+#line 869 "griby.y"
 
 
 static grib_concept_value *_reverse_concept(grib_concept_value *r,grib_concept_value *s)
diff --git a/src/griby.y b/src/griby.y
index 1be6f85..f5f1423 100644
--- a/src/griby.y
+++ b/src/griby.y
@@ -381,11 +381,22 @@ simple : UNSIGNED '[' INTEGER ']'   IDENT   default flags
 	{ $$ = grib_action_create_gen(grib_parser_context,$5,"signed_bits",$3,$7,$9,$10,NULL,NULL);      free($5);  }
 
     | CODETABLE '[' INTEGER ']' IDENT  argument   default flags
-	{ $$ = grib_action_create_gen(grib_parser_context,$5,"codetable",$3, $6,$7,$8,NULL,NULL);    free($5); }
+    { $$ = grib_action_create_gen(grib_parser_context,$5,"codetable",$3, $6,$7,$8,NULL,NULL);    free($5); }
+
+    | CODETABLE '[' IDENT ']' IDENT  argument   default flags
+    {
+      /* ECC-485: Set length to 0 and prepend the new argument */
+      grib_arguments* a = grib_arguments_new(grib_parser_context, new_accessor_expression(grib_parser_context,$3,0,0),NULL);
+      a->next = $6;
+      $$ = grib_action_create_gen(grib_parser_context, $5, "codetable",
+                                  0, a, /* length=0 and additional argument */
+                                  $7, $8, NULL, NULL);
+      free($5);
+    }
 
 	| CODETABLE '[' INTEGER ']' IDENT  argument   default SET '(' IDENT ')' flags
 	{ $$ = grib_action_create_gen(grib_parser_context,$5,"codetable",$3, $6,$7,$12,NULL,$10);
-					free($5);free($10); }
+           free($5);free($10); }
     
     | CODETABLE '[' INTEGER ']' IDENT  '(' argument_list ')'   default flags
 	{ $$ = grib_action_create_gen(grib_parser_context,$5,"codetable",$3, $7,$9,$10,NULL,NULL);    free($5); }
diff --git a/src/makeyacc b/src/makeyacc
index 82c4e6f..3d406fc 100755
--- a/src/makeyacc
+++ b/src/makeyacc
@@ -1,4 +1,4 @@
-set -x
+set -xe
 export LEX=flex
 export LEX_OUT=gribl.c
 $LEX -o gribl.c gribl.l
@@ -13,3 +13,5 @@ sed 's/fgetc/getc/g' < grib_yacc1.c > grib_yacc.c
 rm -f grib_yacc1.c
 sed 's/yy/grib_yy/g' < y.tab.h > grib_yacc.h
 rm -f y.tab.c y.tab.h
+echo
+echo ALL OK
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index e6ac53a..399c59f 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -25,7 +25,10 @@ list( APPEND test_bins
       optimize_scaling
       optimize_scaling_sh
       ecc-386
+      ecc-517
       bufr_get_element
+      sh_ieee64
+      ieee
 )
 
 foreach( tool ${test_bins} )
@@ -48,6 +51,7 @@ list( APPEND tests_no_data_reqd
     uerra
     grib_2nd_order_numValues
     julian
+    ecc-517
 )
 # These tests do require data downloads
 list( APPEND tests_data_reqd
@@ -76,6 +80,7 @@ list( APPEND tests_data_reqd
     ecc-379
     ecc-393
     ecc-433
+    ecc-490
     gts_get
     gts_ls
     gts_compare
@@ -85,6 +90,7 @@ list( APPEND tests_data_reqd
     metar_compare
     bufr_set
     ieee
+    sh_ieee64
     optimize_scaling
     optimize_scaling_sh
     grib1to2
@@ -195,6 +201,18 @@ ecbuild_add_test( TARGET eccodes_t_lamb_az_eq_area
 
 # These ones are conditional
 ###########################################
+if( ENABLE_EXTRA_TESTS AND HAVE_ECCODES_THREADS )
+    ecbuild_add_executable( TARGET    grib_encode_pthreads
+                            NOINSTALL
+                            SOURCES   grib_encode_pthreads.c
+                            LIBS      eccodes
+    )
+    ecbuild_add_test( TARGET eccodes_t_grib_encode_pthreads
+                      TYPE SCRIPT
+                      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/grib_encode_pthreads.sh
+    )
+endif()
+
 ecbuild_add_test( TARGET eccodes_t_grib_to_netcdf
                   TYPE SCRIPT
                   CONDITION HAVE_NETCDF
diff --git a/tests/bufr_dump_decode_C.sh b/tests/bufr_dump_decode_C.sh
index 22889cd..7c9bd03 100755
--- a/tests/bufr_dump_decode_C.sh
+++ b/tests/bufr_dump_decode_C.sh
@@ -77,8 +77,11 @@ do
 
     $COMPILER -o $tempExe $tempSrc -I${INCL_DIR1} -I${INCL_DIR2} $FLAGS_COMPILER $FLAGS_LINKER
 
-    # valgrind --error-exitcode=1  ./$tempExe
-    ./$tempExe $filePath
+    if test "x$ECCODES_TEST_WITH_VALGRIND" != "x"; then
+      valgrind --error-exitcode=1 -q ./$tempExe $filePath
+    else
+      ./$tempExe $filePath
+    fi
   fi
 
   rm -f $tempExe $tempSrc
diff --git a/tests/bufr_dump_decode_filter.sh b/tests/bufr_dump_decode_filter.sh
index d787e78..bb8b1d3 100755
--- a/tests/bufr_dump_decode_filter.sh
+++ b/tests/bufr_dump_decode_filter.sh
@@ -48,7 +48,7 @@ do
 
     ${tools_dir}/bufr_dump -Dfilter $f > $fRules
 
-    ${tools_dir}/bufr_filter $fRules $f >/dev/null
+    ${tools_dir}/codes_bufr_filter $fRules $f >/dev/null
 
     rm -f $fRules
   fi
diff --git a/tests/bufr_dump_encode_C.sh b/tests/bufr_dump_encode_C.sh
index 935dce2..e66a49f 100755
--- a/tests/bufr_dump_encode_C.sh
+++ b/tests/bufr_dump_encode_C.sh
@@ -77,8 +77,11 @@ do
     $COMPILER -o $tempExe $tempSrc -I${INCL_DIR1} -I${INCL_DIR2} $FLAGS_COMPILER $FLAGS_LINKER
 
     # The executable always creates a file called outfile.bufr
-    # valgrind --error-exitcode=1  ./$tempExe
-    ./$tempExe
+    if test "x$ECCODES_TEST_WITH_VALGRIND" != "x"; then
+      valgrind --error-exitcode=1 -q ./$tempExe
+    else
+      ./$tempExe
+    fi
     ${tools_dir}/bufr_compare ${data_dir}/bufr/$file $tempBufr
 
     TEMP_JSON1=${label}.$file.json
diff --git a/tests/bufr_dump_encode_filter.sh b/tests/bufr_dump_encode_filter.sh
index 62bc82a..3143422 100755
--- a/tests/bufr_dump_encode_filter.sh
+++ b/tests/bufr_dump_encode_filter.sh
@@ -51,7 +51,7 @@ do
 
     ${tools_dir}/bufr_dump -Efilter $f > $fRules
 
-    ${tools_dir}/bufr_filter -o $fBufrTmp $fRules $f
+    ${tools_dir}/codes_bufr_filter -o $fBufrTmp $fRules $f
     ${tools_dir}/bufr_compare $fBufrTmp $f
 
     TEMP_JSON1=${label}.$f.json
diff --git a/tests/bufr_filter.sh b/tests/bufr_filter.sh
index a32d078..37c48ab 100755
--- a/tests/bufr_filter.sh
+++ b/tests/bufr_filter.sh
@@ -45,7 +45,7 @@ bufr_files=`cat bufr_data_files.txt`
 for f in ${bufr_files} ; do
    echo "file: $f" >> $fLog
    ${tools_dir}/codes_bufr_filter $fRules $f >> $fLog
-   ${tools_dir}/bufr_filter       $fRules $f >> $fLog  # See ECC-205
+   ${tools_dir}/codes_bufr_filter       $fRules $f >> $fLog  # See ECC-205
 done
 
 #-----------------------------------------------------------
@@ -1013,7 +1013,7 @@ fOut="g2nd_208.bufr.out"
 
 echo "Test: extract subsets compressed data" >> $fLog
 echo "file: $f" >> $fLog
-${tools_dir}/bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog
+${tools_dir}/codes_bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog
 
 cat > ${fRules} <<EOF
 set unpack=1;
@@ -1025,7 +1025,7 @@ print "orbitNumber=[orbitNumber!10]";
 print "casRegistryNumber=[casRegistryNumber!10]";
 EOF
 
-${tools_dir}/bufr_filter $fRules $fOut  > ${f}.log
+${tools_dir}/codes_bufr_filter $fRules $fOut  > ${f}.log
 
 cat > ${f}.log.ref <<EOF
 === message number 1
@@ -1062,7 +1062,7 @@ f="gosat.bufr"
 
 echo "Test: firstOrderStatistics" >> $fLog
 echo "file: $f" >> $fLog
-${tools_dir}/bufr_filter $fRules $f  > ${f}.log
+${tools_dir}/codes_bufr_filter $fRules $f  > ${f}.log
 
 cat > ${f}.log.ref <<EOF
 decimalScaleOfFollowingSignificands->firstOrderStatisticalValue=-15 -15 -15 -15 -15 -15 -15 -15 -15 -15 
@@ -1109,7 +1109,7 @@ fOut="asel_139.bufr.out"
 
 echo "Test: delayed replication compressed data" >> $fLog
 echo "file: $f" >> $fLog
-${tools_dir}/bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog
+${tools_dir}/codes_bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog
 
 cat > ${fRules} <<EOF
 set unpack=1;
@@ -1120,7 +1120,7 @@ print "#3#windSpeedAt10M=[#3#windSpeedAt10M]";
 print "#5#windSpeedAt10M=[#5#windSpeedAt10M]";
 EOF
 
-${tools_dir}/bufr_filter $fRules $fOut  > ${f}.log
+${tools_dir}/codes_bufr_filter $fRules $fOut  > ${f}.log
 
 cat > ${f}.log.ref <<EOF
 delayedDescriptorReplicationFactor=5
@@ -1161,7 +1161,7 @@ fOut="out.bufr"
 
 echo "Test: create new BUFR with bitmap" >> $fLog
 echo "file: $f" >> $fLog
-${tools_dir}/bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog
+${tools_dir}/codes_bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog
 
 cat > ${fRules} <<EOF
 set unpack=1;
@@ -1170,7 +1170,7 @@ print "delayedDescriptorReplicationFactor=[delayedDescriptorReplicationFactor!20
 print "dataPresentIndicator=[dataPresentIndicator!20]";
 EOF
 
-${tools_dir}/bufr_filter $fRules $fOut  > ${f}.log
+${tools_dir}/codes_bufr_filter $fRules $fOut  > ${f}.log
 
 cat > ${f}.log.ref <<EOF
 delayedDescriptorReplicationFactor=4 1 4 15 2 2
@@ -1213,7 +1213,7 @@ f="go15_87.bufr"
 echo "Test: create new BUFR with bitmap" >> $fLog
 echo "file: $f" >> $fLog
 
-${tools_dir}/bufr_filter $fRules $f  > ${f}.log
+${tools_dir}/codes_bufr_filter $fRules $f  > ${f}.log
 
 cat > ${f}.log.ref <<EOF
 numberOfSubsets=128
@@ -1328,7 +1328,7 @@ f="metar_with_2_bias.bufr"
 echo "Test: Data with two bias correction wrong bitmap" >> $fLog
 echo "file: $f" >> $fLog
 
-${tools_dir}/bufr_filter $fRules $f  > ${f}.log
+${tools_dir}/codes_bufr_filter $fRules $f  > ${f}.log
 
 cat > ${f}.log.ref <<EOF
 70
@@ -1355,7 +1355,7 @@ f="temp-land-with-substituted-values.bufr"
 echo "Test: Data with substituted value" >> $fLog
 echo "file: $f" >> $fLog
 
-${tools_dir}/bufr_filter $fRules $f  > ${f}.log
+${tools_dir}/codes_bufr_filter $fRules $f  > ${f}.log
 
 cat > ${f}.log.ref <<EOF
 110
@@ -1382,7 +1382,7 @@ f="syno_1.bufr"
 echo "Test: Nested delayed replication" >> $fLog
 echo "file: $f" >> $fLog
 
-${tools_dir}/bufr_filter $fRules $f  > ${f}.log
+${tools_dir}/codes_bufr_filter $fRules $f  > ${f}.log
 
 cat > ${f}.log.ref <<EOF
 -1e+100 -1e+100 2 -1e+100 -1e+100 3 -1e+100 -1e+100 
@@ -1409,7 +1409,7 @@ f="imssnow.bufr"
 echo "Test: Simple thinning" >> $fLog
 echo "file: $f" >> $fLog
 
-${tools_dir}/bufr_filter -o ${f}.out $fRules $f
+${tools_dir}/codes_bufr_filter -o ${f}.out $fRules $f
 
 cat > $fRules <<EOF
 set unpack=1;
@@ -1418,7 +1418,7 @@ print "longitude=[longitude]";
 print "height=[height]";
 EOF
 
-${tools_dir}/bufr_filter $fRules ${f}.out > ${f}.log
+${tools_dir}/codes_bufr_filter $fRules ${f}.out > ${f}.log
 
 cat > ${f}.log.ref <<EOF
 latitude=4.93301 5.17216 5.40243 5.62361 7.86075
@@ -1446,7 +1446,7 @@ f="go15_87.bufr"
 echo "Test: subset extraction constant values" >> $fLog
 echo "file: $f" >> $fLog
 
-${tools_dir}/bufr_filter -o ${f}.out $fRules $f
+${tools_dir}/codes_bufr_filter -o ${f}.out $fRules $f
 
 cat > $fRules <<EOF
 set unpack=1;
@@ -1456,14 +1456,14 @@ set doExtractSubsets=1;
 write;
 EOF
 
-${tools_dir}/bufr_filter -o ${f}.out.out $fRules ${f}.out
+${tools_dir}/codes_bufr_filter -o ${f}.out.out $fRules ${f}.out
 
 cat > $fRules <<EOF
 set unpack=1;
 print "latitude=[latitude]";
 EOF
 
-${tools_dir}/bufr_filter $fRules ${f}.out.out > ${f}.log
+${tools_dir}/codes_bufr_filter $fRules ${f}.out.out > ${f}.log
 
 cat > ${f}.log.ref <<EOF
 latitude=0
@@ -1488,14 +1488,14 @@ f="amsu_55.bufr"
 echo "Test: fix for ECC-389" >> $fLog
 echo "file: $f" >> $fLog
 
-${tools_dir}/bufr_filter -o ${f}.out $fRules $f
+${tools_dir}/codes_bufr_filter -o ${f}.out $fRules $f
 
 cat > $fRules <<EOF
 set unpack=1;
 print "[#14#brightnessTemperature]";
 EOF
 
-${tools_dir}/bufr_filter $fRules ${f}.out > ${f}.log
+${tools_dir}/codes_bufr_filter $fRules ${f}.out > ${f}.log
 
 cat > ${f}.log.ref <<EOF
 266.53
@@ -1519,7 +1519,7 @@ f="bssh_176.bufr"
 
  # This should fail. Out of Range
 set +e
-${tools_dir}/bufr_filter -o ${f}.out $fRules $f
+${tools_dir}/codes_bufr_filter -o ${f}.out $fRules $f
 status=$?
 set -e
 [ $status -ne 0 ]
@@ -1534,7 +1534,7 @@ cat > $fRules <<EOF
  print "airTemperature=[airTemperature], width=[airTemperature->width]";
  write;
 EOF
-${tools_dir}/bufr_filter -o ${f}.out $fRules $f > ${f}.log
+${tools_dir}/codes_bufr_filter -o ${f}.out $fRules $f > ${f}.log
 
 cat > ${f}.log.ref <<EOF
 airTemperature=$HIGH_TEMPERATURE, width=26
@@ -1587,7 +1587,7 @@ f="syno_1.bufr"
 echo "Test: Julian Date" >> $fLog
 echo "file: $f" >> $fLog
 
-${tools_dir}/bufr_filter $fRules $f  > ${f}.log
+${tools_dir}/codes_bufr_filter $fRules $f  > ${f}.log
 
 cat > ${f}.log.ref <<EOF
 match
diff --git a/tests/bufr_filter_extract_area.sh b/tests/bufr_filter_extract_area.sh
index ecafd90..ec3ebd3 100755
--- a/tests/bufr_filter_extract_area.sh
+++ b/tests/bufr_filter_extract_area.sh
@@ -52,7 +52,7 @@ rm -f $outputFilt
 echo "Test: Area extraction" >> $fLog
 echo "file: $outputBufr" >> $fLog
 
-${tools_dir}/bufr_filter -o $outputBufr $fRules $inputBufr > $outputFilt
+${tools_dir}/codes_bufr_filter -o $outputBufr $fRules $inputBufr > $outputFilt
 [ -f $outputBufr ]
 
 cat > $fRules <<EOF
@@ -68,7 +68,7 @@ print "===========";
 print "fieldOfViewNumber=[fieldOfViewNumber!15]";
 print "===========";
 EOF
-${tools_dir}/bufr_filter $fRules $inputBufr $outputBufr  >> $outputFilt
+${tools_dir}/codes_bufr_filter $fRules $inputBufr $outputBufr  >> $outputFilt
 
 cat > $outputRef <<EOF
 extracted 14 of 128 subsets
diff --git a/tests/bufr_filter_extract_datetime.sh b/tests/bufr_filter_extract_datetime.sh
index 90e578a..b29da4a 100755
--- a/tests/bufr_filter_extract_datetime.sh
+++ b/tests/bufr_filter_extract_datetime.sh
@@ -64,7 +64,7 @@ rm -f $outputFilt
 echo "Test: Datetime extraction" >> $fLog
 echo "file: $inputBufr" >> $fLog
 
-${tools_dir}/bufr_filter -o $outputBufr $fRules $inputBufr  > $outputFilt
+${tools_dir}/codes_bufr_filter -o $outputBufr $fRules $inputBufr  > $outputFilt
 [ -f $outputBufr ]
 
 cat > $fRules <<EOF
@@ -82,7 +82,7 @@ print "===========";
 print "second=[second!15]";
 print "===========";
 EOF
-${tools_dir}/bufr_filter $fRules $inputBufr $outputBufr  >> $outputFilt
+${tools_dir}/codes_bufr_filter $fRules $inputBufr $outputBufr  >> $outputFilt
 
 cat > $outputRef <<EOF
 extracted 30 of 128 subsets
@@ -148,7 +148,7 @@ inputBufr="amsa_55.bufr"
 outputBufr=${label}.${inputBufr}.out
 
 set +e
-${tools_dir}/bufr_filter -o $outputBufr $fRules $inputBufr
+${tools_dir}/codes_bufr_filter -o $outputBufr $fRules $inputBufr
 status=$?
 set -e
 if [ $status -eq 0 ]; then
@@ -182,7 +182,7 @@ inputBufr="amsa_55.bufr"
 outputBufr=${label}.${inputBufr}.out
 
 set +e
-${tools_dir}/bufr_filter -o $outputBufr $fRules $inputBufr
+${tools_dir}/codes_bufr_filter -o $outputBufr $fRules $inputBufr
 status=$?
 set -e
 if [ $status -eq 0 ]; then
diff --git a/tests/bufr_get_element.c b/tests/bufr_get_element.c
index 9005bd7..de23e74 100644
--- a/tests/bufr_get_element.c
+++ b/tests/bufr_get_element.c
@@ -11,7 +11,7 @@
 #include "eccodes.h"
 #include <assert.h>
 
-void compare_doubles(const double d1, const double d2, const double epsilon)
+static void compare_doubles(const double d1, const double d2, const double epsilon)
 {
    assert(fabs(d1 - d2) < epsilon);
 }
diff --git a/tests/bufr_keys_iter.c b/tests/bufr_keys_iter.c
index fd34ab8..426e84e 100644
--- a/tests/bufr_keys_iter.c
+++ b/tests/bufr_keys_iter.c
@@ -11,32 +11,58 @@
 #include "eccodes.h"
 #include <assert.h>
 
-void usage(const char* prog)
+static void usage(const char* prog)
 {
-    printf("usage: %s infile\n",prog);
+    printf("usage: %s [-a|-d] infile\n",prog);
     exit(1);
 }
 
+#define ITER_ALL_KEYS  1
+#define ITER_DATA_KEYS 2
+
 int main(int argc,char* argv[])
 {
-    int err = 0;
+    int err = 0, opt = 0;
     codes_handle* h = NULL;
     codes_bufr_keys_iterator* kiter = NULL;
     char* input_filename = NULL;
+    const char* prog = argv[0];
     FILE* f = NULL;
-    /*grib_context* c = grib_context_get_default();*/
+    int iterator_mode = ITER_ALL_KEYS;
     
-    if (argc!=2) usage(argv[0]);
-    input_filename = argv[1];
+    while ((opt = getopt(argc, argv, "ad")) != -1) {
+        switch (opt) {
+            case 'a':
+                iterator_mode = ITER_ALL_KEYS;
+                break;
+            case 'd':
+                iterator_mode = ITER_DATA_KEYS;
+                break;
+            default:
+                usage(prog);
+                break;
+        }
+    }
+    /* After option processing expect just 1 file */
+    if (argc-optind != 1) usage(prog);
+
+    input_filename = argv[argc-1];
     f = fopen(input_filename, "r");
     assert(f);
     h = codes_handle_new_from_file(NULL, f, PRODUCT_BUFR, &err);
     assert(h);
 
     CODES_CHECK(codes_set_long(h,"unpack",1), 0);
+    
+    if (iterator_mode == ITER_ALL_KEYS) {
+        /*printf("Dumping ALL keys\n");*/
+        kiter = codes_bufr_keys_iterator_new(h, 0);
+    } else {
+        /*printf("Dumping only DATA SECTION keys\n");*/
+        assert(iterator_mode == ITER_DATA_KEYS);
+        kiter=codes_bufr_data_section_keys_iterator_new(h);
+    }
 
-    /*kiter=codes_bufr_data_section_keys_iterator_new(h);*/
-    kiter = codes_bufr_keys_iterator_new(h, 0);
     while(codes_bufr_keys_iterator_next(kiter))
     {
         char* kname = codes_bufr_keys_iterator_get_name(kiter);
diff --git a/tests/bufr_keys_iter.sh b/tests/bufr_keys_iter.sh
index 4cfa1a4..18ac735 100755
--- a/tests/bufr_keys_iter.sh
+++ b/tests/bufr_keys_iter.sh
@@ -14,7 +14,10 @@ tempOut=temp.bufr_keys_iter.$$.out
 tempRef=temp.bufr_keys_iter.$$.ref
 
 input=${data_dir}/bufr/aaen_55.bufr
-${test_dir}/bufr_keys_iter $input > $tempOut
+
+## Iterate over ALL keys and skip none
+# ------------------------------------
+${test_dir}/bufr_keys_iter -a $input > $tempOut
 
 # Check the output of BUFR keys iterator
 # Note: the two hidden keys 'typicalDate' and 'typicalTime' are NOT in the iterator output
@@ -225,4 +228,169 @@ EOF
 
 diff $tempRef $tempOut
 
+## Now iterate over Data Section keys and skip all others
+# ---------------------------------------------------------
+${test_dir}/bufr_keys_iter -d $input > $tempOut
+cat > $tempRef<<EOF
+#1#tovsOrAtovsProductQualifier
+#1#centre
+#1#subCentre
+#2#tovsOrAtovsProductQualifier
+#2#centre
+#2#subCentre
+#1#satelliteIdentifier
+#1#satelliteSensorIndicator
+#1#orbitNumber
+#1#satelliteAntennaCorrectionsVersionNumber
+#1#scanLineNumber
+#1#fieldOfViewNumber
+#1#majorFrameCount
+#1#scanLineStatusFlagsForAtovs
+#1#scanLineQualityFlagsForAtovs
+#1#year
+#1#month
+#1#day
+#1#hour
+#1#minute
+#1#second
+#1#latitude
+#1#longitude
+#1#heightOfStation
+#1#satelliteZenithAngle
+#1#bearingOrAzimuth
+#1#solarZenithAngle
+#1#solarAzimuth
+#1#fieldOfViewQualityFlagsForAtovs
+#1#radiometerIdentifier
+#1#instrumentTemperature
+#2#radiometerIdentifier
+#2#instrumentTemperature
+#3#radiometerIdentifier
+#3#instrumentTemperature
+#4#radiometerIdentifier
+#4#instrumentTemperature
+#1#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#1#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#1#bandwidthCorrectionCoefficient1ForAtovs
+#1#bandwidthCorrectionCoefficient2ForAtovs
+#1#channelQualityFlagsForAtovs
+#1#brightnessTemperature
+#2#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#2#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#2#bandwidthCorrectionCoefficient1ForAtovs
+#2#bandwidthCorrectionCoefficient2ForAtovs
+#2#channelQualityFlagsForAtovs
+#2#brightnessTemperature
+#3#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#3#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#3#bandwidthCorrectionCoefficient1ForAtovs
+#3#bandwidthCorrectionCoefficient2ForAtovs
+#3#channelQualityFlagsForAtovs
+#3#brightnessTemperature
+#4#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#4#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#4#bandwidthCorrectionCoefficient1ForAtovs
+#4#bandwidthCorrectionCoefficient2ForAtovs
+#4#channelQualityFlagsForAtovs
+#4#brightnessTemperature
+#5#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#5#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#5#bandwidthCorrectionCoefficient1ForAtovs
+#5#bandwidthCorrectionCoefficient2ForAtovs
+#5#channelQualityFlagsForAtovs
+#5#brightnessTemperature
+#6#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#6#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#6#bandwidthCorrectionCoefficient1ForAtovs
+#6#bandwidthCorrectionCoefficient2ForAtovs
+#6#channelQualityFlagsForAtovs
+#6#brightnessTemperature
+#7#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#7#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#7#bandwidthCorrectionCoefficient1ForAtovs
+#7#bandwidthCorrectionCoefficient2ForAtovs
+#7#channelQualityFlagsForAtovs
+#7#brightnessTemperature
+#8#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#8#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#8#bandwidthCorrectionCoefficient1ForAtovs
+#8#bandwidthCorrectionCoefficient2ForAtovs
+#8#channelQualityFlagsForAtovs
+#8#brightnessTemperature
+#9#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#9#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#9#bandwidthCorrectionCoefficient1ForAtovs
+#9#bandwidthCorrectionCoefficient2ForAtovs
+#9#channelQualityFlagsForAtovs
+#9#brightnessTemperature
+#10#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#10#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#10#bandwidthCorrectionCoefficient1ForAtovs
+#10#bandwidthCorrectionCoefficient2ForAtovs
+#10#channelQualityFlagsForAtovs
+#10#brightnessTemperature
+#11#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#11#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#11#bandwidthCorrectionCoefficient1ForAtovs
+#11#bandwidthCorrectionCoefficient2ForAtovs
+#11#channelQualityFlagsForAtovs
+#11#brightnessTemperature
+#12#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#12#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#12#bandwidthCorrectionCoefficient1ForAtovs
+#12#bandwidthCorrectionCoefficient2ForAtovs
+#12#channelQualityFlagsForAtovs
+#12#brightnessTemperature
+#13#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#13#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#13#bandwidthCorrectionCoefficient1ForAtovs
+#13#bandwidthCorrectionCoefficient2ForAtovs
+#13#channelQualityFlagsForAtovs
+#13#brightnessTemperature
+#14#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#14#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#14#bandwidthCorrectionCoefficient1ForAtovs
+#14#bandwidthCorrectionCoefficient2ForAtovs
+#14#channelQualityFlagsForAtovs
+#14#brightnessTemperature
+#15#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#15#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#15#bandwidthCorrectionCoefficient1ForAtovs
+#15#bandwidthCorrectionCoefficient2ForAtovs
+#15#channelQualityFlagsForAtovs
+#15#brightnessTemperature
+#16#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#16#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#16#bandwidthCorrectionCoefficient1ForAtovs
+#16#bandwidthCorrectionCoefficient2ForAtovs
+#16#channelQualityFlagsForAtovs
+#16#brightnessTemperature
+#17#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#17#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#17#bandwidthCorrectionCoefficient1ForAtovs
+#17#bandwidthCorrectionCoefficient2ForAtovs
+#17#channelQualityFlagsForAtovs
+#17#brightnessTemperature
+#18#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#18#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#18#bandwidthCorrectionCoefficient1ForAtovs
+#18#bandwidthCorrectionCoefficient2ForAtovs
+#18#channelQualityFlagsForAtovs
+#18#brightnessTemperature
+#19#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#19#log10OfTemperatureRadianceCentralWaveNumberForAtovs
+#19#bandwidthCorrectionCoefficient1ForAtovs
+#19#bandwidthCorrectionCoefficient2ForAtovs
+#19#channelQualityFlagsForAtovs
+#19#brightnessTemperature
+#20#tovsOrAtovsOrAvhrrInstrumentationChannelNumber
+#1#albedoRadianceSolarFilteredIrradianceForAtovs
+#1#albedoRadianceEquivalentFilterWidthForAtovs
+#20#channelQualityFlagsForAtovs
+#1#channelRadiance
+EOF
+
+diff $tempRef $tempOut
+
+
 rm -f $tempRef $tempOut
diff --git a/tests/ecc-286.sh b/tests/ecc-286.sh
index 5549f7b..9b9c3d3 100755
--- a/tests/ecc-286.sh
+++ b/tests/ecc-286.sh
@@ -29,7 +29,7 @@ cat > $tempRules <<EOF
  print "[3HourPressureChange]";
 EOF
 
-${tools_dir}/bufr_filter $tempRules $BufrFile > $tempOut
+${tools_dir}/codes_bufr_filter $tempRules $BufrFile > $tempOut
 
 cat > $tempRef <<EOF
 20
diff --git a/tests/ecc-288.sh b/tests/ecc-288.sh
index 40d2fdc..e458608 100755
--- a/tests/ecc-288.sh
+++ b/tests/ecc-288.sh
@@ -26,7 +26,7 @@ cat > $tempRules <<EOF
  write;
 EOF
 
-${tools_dir}/bufr_filter -o $tempOut $tempRules $BufrFile
+${tools_dir}/codes_bufr_filter -o $tempOut $tempRules $BufrFile
 
 # There is a difference in localLongitude, rel error=6.58627e-06
 # So this should fail
diff --git a/tests/ecc-313.sh b/tests/ecc-313.sh
index 3cd57e7..1a4502f 100755
--- a/tests/ecc-313.sh
+++ b/tests/ecc-313.sh
@@ -37,7 +37,7 @@ cat > $tempRules <<EOF
  print "h2=[heightOfBarometerAboveMeanSeaLevel]";
 EOF
 
-${tools_dir}/bufr_filter $tempRules $input > $tempOut
+${tools_dir}/codes_bufr_filter $tempRules $input > $tempOut
 
 cat > $tempRef << EOF
 h1=10 60 215 564 685 5 5 555 
diff --git a/tests/ecc-379.sh b/tests/ecc-379.sh
index b8a7d5f..77ea89b 100755
--- a/tests/ecc-379.sh
+++ b/tests/ecc-379.sh
@@ -34,13 +34,13 @@ EOF
 
 # Expect this to fail as two values are out-of-range
 set +e
-${tools_dir}/bufr_filter -o $tempOut $tempRules $BufrFile 2>/dev/null
+${tools_dir}/codes_bufr_filter -o $tempOut $tempRules $BufrFile 2>/dev/null
 status=$?
 set -e
 [ $status -ne 0 ]
 # Now set environment variable to turn out-of-range values into 'missing'
 export ECCODES_BUFR_SET_TO_MISSING_IF_OUT_OF_RANGE=1
-${tools_dir}/bufr_filter -o $tempOut $tempRules $BufrFile
+${tools_dir}/codes_bufr_filter -o $tempOut $tempRules $BufrFile
 unset ECCODES_BUFR_SET_TO_MISSING_IF_OUT_OF_RANGE
 
 #echo 'set unpack=1;print "[longitude]";' | ${tools_dir}/bufr_filter - $BufrFile
@@ -62,13 +62,13 @@ EOF
 
 # The latitude is out of range. So we expect this to fail
 set +e
-${tools_dir}/bufr_filter -o $tempOut $tempRules $BufrFile 2>/dev/null
+${tools_dir}/codes_bufr_filter -o $tempOut $tempRules $BufrFile 2>/dev/null
 status=$?
 set -e
 [ $status -ne 0 ]
 
 export ECCODES_BUFR_SET_TO_MISSING_IF_OUT_OF_RANGE=1
-${tools_dir}/bufr_filter -o $tempOut $tempRules $BufrFile
+${tools_dir}/codes_bufr_filter -o $tempOut $tempRules $BufrFile
 unset ECCODES_BUFR_SET_TO_MISSING_IF_OUT_OF_RANGE
 
 # ------------------------
diff --git a/tests/ecc-386.c b/tests/ecc-386.c
index efd6ce7..9d66aa4 100644
--- a/tests/ecc-386.c
+++ b/tests/ecc-386.c
@@ -16,7 +16,7 @@
 #include <assert.h>
 #include "grib_api_internal.h"
 
-void usage(char* prog) {
+static void usage(const char* prog) {
     printf("usage: %s filename\n",prog);
     exit(1);
 }
diff --git a/tests/ecc-393.sh b/tests/ecc-393.sh
index 6fa5513..9b667ff 100755
--- a/tests/ecc-393.sh
+++ b/tests/ecc-393.sh
@@ -31,7 +31,7 @@ cat > $tempRules <<EOF
  write;
 EOF
 
-${tools_dir}/bufr_filter -o $tempOut $tempRules $BufrFile
+${tools_dir}/codes_bufr_filter -o $tempOut $tempRules $BufrFile
 
 # There are two differences. So this should fail
 set +e
diff --git a/tests/ecc-433.sh b/tests/ecc-433.sh
index 5fff4f2..b2fb28b 100755
--- a/tests/ecc-433.sh
+++ b/tests/ecc-433.sh
@@ -33,7 +33,7 @@ cat > $tempRules <<EOF
  print "[radarBackScatter]";
 EOF
 
-${tools_dir}/bufr_filter $tempRules $input > $tempOut
+${tools_dir}/codes_bufr_filter $tempRules $input > $tempOut
 
 cat > $tempRef << EOF
 59 59 57 51 47 48 45 45 
diff --git a/tests/ecc-490.sh b/tests/ecc-490.sh
new file mode 100755
index 0000000..d904875
--- /dev/null
+++ b/tests/ecc-490.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Copyright 2005-2017 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
+set -u
+# ---------------------------------------------------------
+# This is the test for the JIRA issue ECC-490.
+# It tests changing GRIB templates
+# ---------------------------------------------------------
+label="ecc-490-test"
+tempSample=temp.${label}.sample.grib
+tempRules=temp.${label}.filter
+tempOut=temp.${label}.grib
+
+grib2_sample=$ECCODES_SAMPLES_PATH/reduced_gg_pl_128_grib2.tmpl
+${tools_dir}/grib_set -s productDefinitionTemplateNumber=11,typeOfProcessedData=pf,typeOfLevel=surface $grib2_sample $tempSample
+
+cat > $tempRules <<EOF
+    set  productDefinitionTemplateNumber=1;
+    set  typeOfFirstFixedSurface=1;
+    set  typeOfSecondFixedSurface=255;
+    set  typeOfFirstFixedSurface=100;
+    set  productDefinitionTemplateNumber=11;
+    set  typeOfFirstFixedSurface=100;
+    set  typeOfSecondFixedSurface=255;
+    write;
+EOF
+
+${tools_dir}/grib_filter -o $tempOut $tempRules $tempSample
+
+rm -f $tempSample $tempRules $tempOut
diff --git a/tests/ecc-517.c b/tests/ecc-517.c
new file mode 100644
index 0000000..02e2709
--- /dev/null
+++ b/tests/ecc-517.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2005-2017 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 "eccodes.h"
+#include <assert.h>
+
+int main(int argc, char** argv)
+{
+  size_t         size=0;
+  const void*    buffer = NULL;
+  FILE*          fout = NULL;
+  codes_handle*  h = NULL;
+  long*          ivalues = NULL;
+  char**         svalues = NULL;
+  double*        rvalues = NULL;
+  const char*    sampleName = "BUFR3_local";
+  char*          outfilename = NULL;
+
+  assert(argc == 2);
+  outfilename = argv[1];
+
+  h = codes_bufr_handle_new_from_samples(NULL, sampleName);
+  assert(h);
+
+  ivalues = (long*)malloc(1*sizeof(long));
+  if (!ivalues) { fprintf(stderr, "Failed to allocate memory (ivalues).\n"); return 1; }
+  size = 1;ivalues[0]=1;
+  CODES_CHECK(codes_set_long_array(h, "inputDelayedDescriptorReplicationFactor", ivalues, size), 0);
+  
+  ivalues = (long*)malloc(1*sizeof(long));
+  size = 1;ivalues[0]=486;
+  CODES_CHECK(codes_set_long_array(h, "inputExtendedDelayedDescriptorReplicationFactor", ivalues, size), 0);
+  
+  CODES_CHECK(codes_set_long(h, "edition", 3), 0);
+  CODES_CHECK(codes_set_long(h, "masterTableNumber", 0), 0);
+  CODES_CHECK(codes_set_long(h, "bufrHeaderSubCentre", 0), 0);
+  CODES_CHECK(codes_set_long(h, "bufrHeaderCentre", 98), 0);
+  CODES_CHECK(codes_set_long(h, "updateSequenceNumber", 0), 0);
+  CODES_CHECK(codes_set_long(h, "dataCategory", 2), 0);
+  CODES_CHECK(codes_set_long(h, "dataSubCategory", 109), 0);
+  CODES_CHECK(codes_set_long(h, "masterTablesVersionNumber", 13), 0);
+  CODES_CHECK(codes_set_long(h, "localTablesVersionNumber", 1), 0);
+  CODES_CHECK(codes_set_long(h, "typicalYearOfCentury", 17), 0);
+  CODES_CHECK(codes_set_long(h, "typicalMonth", 8), 0);
+  CODES_CHECK(codes_set_long(h, "typicalDay", 6), 0);
+  CODES_CHECK(codes_set_long(h, "typicalHour", 11), 0);
+  CODES_CHECK(codes_set_long(h, "typicalMinute", 15), 0);
+  CODES_CHECK(codes_set_long(h, "rdbType", 5), 0);
+  CODES_CHECK(codes_set_long(h, "oldSubtype", 109), 0);
+  CODES_CHECK(codes_set_long(h, "rdbtimeDay", 7), 0);
+  CODES_CHECK(codes_set_long(h, "rdbtimeHour", 11), 0);
+  CODES_CHECK(codes_set_long(h, "rdbtimeMinute", 13), 0);
+  CODES_CHECK(codes_set_long(h, "rdbtimeSecond", 46), 0);
+  CODES_CHECK(codes_set_long(h, "rectimeDay", 7), 0);
+  CODES_CHECK(codes_set_long(h, "rectimeHour", 11), 0);
+  CODES_CHECK(codes_set_long(h, "rectimeMinute", 13), 0);
+  CODES_CHECK(codes_set_long(h, "rectimeSecond", 46), 0);
+  CODES_CHECK(codes_set_long(h, "correction1", 0), 0);
+  CODES_CHECK(codes_set_long(h, "correction1Part", 0), 0);
+  CODES_CHECK(codes_set_long(h, "correction2", 0), 0);
+  CODES_CHECK(codes_set_long(h, "correction2Part", 0), 0);
+  CODES_CHECK(codes_set_long(h, "correction3", 0), 0);
+  CODES_CHECK(codes_set_long(h, "correction3Part", 0), 0);
+  CODES_CHECK(codes_set_long(h, "correction4", 0), 0);
+  CODES_CHECK(codes_set_long(h, "correction4Part", 0), 0);
+  CODES_CHECK(codes_set_long(h, "qualityControl", 70), 0);
+  CODES_CHECK(codes_set_long(h, "newSubtype", 0), 0);
+  CODES_CHECK(codes_set_long(h, "numberOfSubsets", 1), 0);
+  CODES_CHECK(codes_set_double(h, "localLatitude", 5.450296999999999770e+01), 0);
+  CODES_CHECK(codes_set_double(h, "localLongitude", -6.343119999999999870e+00), 0);
+  CODES_CHECK(codes_set_long(h, "observedData", 1), 0);
+  CODES_CHECK(codes_set_long(h, "compressedData", 0), 0);
+  free(ivalues); ivalues = NULL;
+
+  ivalues = (long*)malloc(9*sizeof(long));
+  if (!ivalues) { fprintf(stderr, "Failed to allocate memory (ivalues).\n"); return 1; }
+  size = 4;
+  ivalues[0]= 309052;
+  ivalues[1]= 5001;
+  ivalues[2]= 6001;
+  ivalues[3]= 7001;
+  CODES_CHECK(codes_set_long_array(h, "unexpandedDescriptors", ivalues, size), 0);
+
+  /* Encode the keys back in the data section */
+  CODES_CHECK(codes_set_long(h, "pack", 1), 0);
+
+  fout = fopen(outfilename, "w");
+  if (!fout) {
+    fprintf(stderr, "Failed to open (create) output file.\n");
+    return 1;
+  }
+  CODES_CHECK(codes_get_message(h,&buffer,&size),0);
+  if (fwrite(buffer,1,size,fout) != size) {
+    fprintf(stderr, "Failed to write data.\n");
+    return 1;
+  }
+  if (fclose(fout)!=0) {
+    fprintf(stderr, "Failed to close file handle.\n");
+    return 1;
+  }
+  
+  codes_handle_delete(h);
+  free(ivalues); ivalues = NULL;
+  free(rvalues); rvalues = NULL;
+  free(svalues); svalues = NULL;
+
+  return 0;
+}
diff --git a/examples/python/get_product_kind.sh b/tests/ecc-517.sh
similarity index 55%
copy from examples/python/get_product_kind.sh
copy to tests/ecc-517.sh
index aaec57b..5556432 100755
--- a/examples/python/get_product_kind.sh
+++ b/tests/ecc-517.sh
@@ -10,12 +10,16 @@
 
 . ./include.sh
 
-label="get_product_kind_p"
-fTmp=${label}.tmp
+OUTPUT=temp.ecc-517.bufr
+TEMP=temp.ecc-517.txt
 
-# Create a file containing both GRIB and BUFR messages
-cat ${data_dir}/sample.grib2 ${data_dir}/bufr/syno_multi.bufr >$fTmp
+# Run program to create output BUFR file with replication
+${test_dir}/ecc-517 $OUTPUT
 
-$PYTHON $examples_src/get_product_kind.py $fTmp >/dev/null 2>&1
+# Check file is OK and has the expected number of descriptors
+${tools_dir}/bufr_dump -jf $OUTPUT > $TEMP
+count=`grep -c extendedVerticalSoundingSignificance $TEMP`
+[ $count -eq 487 ] 
 
-rm -f ${fTmp}
+
+rm $OUTPUT $TEMP
diff --git a/tests/grib_double_cmp.c b/tests/grib_double_cmp.c
index 3568096..9091904 100644
--- a/tests/grib_double_cmp.c
+++ b/tests/grib_double_cmp.c
@@ -17,7 +17,7 @@
  */
 #include "grib_api.h"
 
-void usage(char* prog) {
+static void usage(const char* prog) {
     printf("usage: %s filename\n",prog);
     exit(1);
 }
diff --git a/tests/grib_encode_pthreads.c b/tests/grib_encode_pthreads.c
new file mode 100644
index 0000000..5c93567
--- /dev/null
+++ b/tests/grib_encode_pthreads.c
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2005-2017 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 <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <pthread.h>
+#include <string.h>
+#include <assert.h>
+#include "grib_api.h"
+
+#define NUM_THREADS 8
+#define FILES_PER_ITERATION 10
+
+char* INPUT_FILE = NULL;
+void do_stuff(void *data);
+
+void *runner(void *ptr); /* the thread function */
+
+int main(int argc, char **argv)
+{
+    long i;
+    int thread_counter = 0;
+    pthread_t workers[NUM_THREADS];
+    INPUT_FILE = argv[1];
+    
+    /* Create worker threads */
+    for (i = 0; i < NUM_THREADS; i++) {
+        /* Now we will create the thread passing it data as a paramater*/
+        pthread_create(&workers[thread_counter], NULL, runner, (void*)i);
+        thread_counter++;
+    }
+
+    /* Waiting for threads to complete */
+    for (i = 0; i < NUM_THREADS; i++) {
+       pthread_join(workers[i], NULL);
+    }
+
+    return 0;
+}
+
+void *runner(void *ptr)
+{    
+    do_stuff(ptr);
+    pthread_exit(0);
+}
+
+int encode_file(char *input_file, char *output_file)
+{
+    grib_handle *source_handle = NULL;
+    const void *buffer = NULL;
+    int err = 0;
+ 
+    FILE* in = fopen(input_file,"r");
+    FILE* out = fopen(output_file,"w");
+    assert(in);
+    assert(out);
+
+    while ((source_handle = grib_handle_new_from_file(0, in, &err))!=NULL)
+    {
+        size_t size=0, values_len=0;
+        int i;
+        double *values = NULL;
+        long count;
+        double d,e;
+
+        grib_handle *clone_handle = grib_handle_clone(source_handle);
+        assert(clone_handle);
+ 
+        GRIB_CHECK(grib_get_size(clone_handle, "values", &values_len),0);
+        values = (double*)malloc(values_len*sizeof(double));
+
+        d=10e-8;
+        e=d;
+        count=1;
+        for (i=0;i<values_len;i++) {
+            if (count>100) {e*=10; count=1;}
+            values[i]=d;
+            d+=e;
+            count++;
+        }
+        GRIB_CHECK(grib_set_long(clone_handle,"bitsPerValue",16),0);
+        GRIB_CHECK(grib_set_double_array(clone_handle,"values",values,values_len),0);
+ 
+        /* get the coded message in a buffer */
+        GRIB_CHECK(grib_get_message(clone_handle,&buffer,&size),0);
+        /* write the buffer to a file */
+        if(fwrite(buffer,1,size,out) != size) {
+            perror(output_file);
+            return 1;
+        }
+        grib_handle_delete(clone_handle);
+        grib_handle_delete(source_handle);
+        free(values);
+    }
+ 
+    fclose(out);
+    fclose(in);
+ 
+    return 0;
+}
+
+void do_stuff(void *arg)
+{
+    long number = (long)arg;
+    char output_file[50];
+    int i;
+
+    for (i=0; i<FILES_PER_ITERATION;i++) {
+        sprintf(output_file,"temp.grib_encode_pthreads.out_%d-%d.grib", (int)number, i);
+        encode_file(INPUT_FILE,output_file);
+    }
+}
diff --git a/examples/python/get_product_kind.sh b/tests/grib_encode_pthreads.sh
similarity index 62%
copy from examples/python/get_product_kind.sh
copy to tests/grib_encode_pthreads.sh
index aaec57b..3515ff8 100755
--- a/examples/python/get_product_kind.sh
+++ b/tests/grib_encode_pthreads.sh
@@ -10,12 +10,8 @@
 
 . ./include.sh
 
-label="get_product_kind_p"
-fTmp=${label}.tmp
+input=$ECCODES_SAMPLES_PATH/gg_sfc_grib2.tmpl
 
-# Create a file containing both GRIB and BUFR messages
-cat ${data_dir}/sample.grib2 ${data_dir}/bufr/syno_multi.bufr >$fTmp
+${test_dir}/grib_encode_pthreads $input
 
-$PYTHON $examples_src/get_product_kind.py $fTmp >/dev/null 2>&1
-
-rm -f ${fTmp}
+rm -f temp.grib_encode_pthreads.out_*.grib
diff --git a/tests/grib_statistics.sh b/tests/grib_statistics.sh
index 4b87d15..45390cd 100755
--- a/tests/grib_statistics.sh
+++ b/tests/grib_statistics.sh
@@ -57,4 +57,11 @@ ${tools_dir}/grib_set -s offsetValuesBy=0.5                     $input $temp1
 ${tools_dir}/grib_set -s missingValue=1.0E34,offsetValuesBy=0.5 $input $temp2
 ${tools_dir}/grib_compare $temp1 $temp2
 
+# ECC-511
+# GRIB2 message from NCEP/GFS with grid_complex_spatial_differencing and
+# missingValueManagementUsed. No bitmap but missing values embedded in data
+input=${data_dir}/gfs.complex.mvmu.grib2
+stats=`${tools_dir}/grib_get -F%.2f -p max,min,avg $input`
+[ "$stats" = "2.81 0.00 0.30" ]
+
 rm -f $temp1 $temp2
diff --git a/tests/grib_util_set_spec.c b/tests/grib_util_set_spec.c
index 2d525b1..4cabd30 100644
--- a/tests/grib_util_set_spec.c
+++ b/tests/grib_util_set_spec.c
@@ -14,7 +14,7 @@
 
 #define STR_EQUAL(s1, s2) (strcmp((s1), (s2)) == 0)
 
-int get_packing_type_code(const char* packingType)
+static int get_packing_type_code(const char* packingType)
 {
     int result = GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE;
     if (packingType==NULL)
@@ -30,7 +30,7 @@ int get_packing_type_code(const char* packingType)
     return result;
 }
 
-void test_reduced_gg(int remove_local_def, int edition, const char* packingType,
+static void test_reduced_gg(int remove_local_def, int edition, const char* packingType,
                      const char* input_filename, const char* output_filename)
 {
     /* based on copy_spec_from_ksec */
@@ -106,7 +106,7 @@ void test_reduced_gg(int remove_local_def, int edition, const char* packingType,
     fclose(out);
 }
 
-void test_regular_ll(int remove_local_def, int edition, const char* packingType,
+static void test_regular_ll(int remove_local_def, int edition, const char* packingType,
                      const char* input_filename, const char* output_filename)
 {
     /* based on copy_spec_from_ksec */
@@ -186,7 +186,96 @@ void test_regular_ll(int remove_local_def, int edition, const char* packingType,
     fclose(out);
 }
 
-void usage(const char *prog)
+#if 0
+static void test_grid_complex_spatial_differencing(int remove_local_def, int edition, const char* packingType,
+                     const char* input_filename, const char* output_filename)
+{
+    /* based on copy_spec_from_ksec */
+    int err = 0;
+    size_t slen = 34, inlen = 0, outlen = 0;
+    size_t size=0;
+    int set_spec_flags=0;
+    double* values = NULL;
+    FILE* in = NULL;
+    FILE* out = NULL;
+    const void* buffer = NULL;
+    char gridType[128] = {0,};
+    double theMax,theMin,theAverage;
+
+    codes_handle *handle = 0;
+    codes_handle *finalh = 0;
+    grib_util_grid_spec spec={0,};
+    grib_util_packing_spec packing_spec={0,};
+
+    in = fopen(input_filename,"r");     assert(in);
+    handle = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err);    assert(handle);
+
+    CODES_CHECK(grib_get_string(handle, "packingType", gridType, &slen),0);
+    if (!STR_EQUAL(gridType, "grid_complex_spatial_differencing")) {
+        grib_handle_delete(handle);
+        return;
+    }
+    out = fopen(output_filename,"w");   assert(out);
+
+    CODES_CHECK(codes_get_size(handle,"values",&inlen), 0);
+    values = (double*)malloc(sizeof(double)*inlen);
+    CODES_CHECK(codes_get_double_array(handle, "values", values,&inlen), 0);
+    
+    
+    CODES_CHECK(codes_get_double(handle, "max",    &theMax),0);
+    CODES_CHECK(codes_get_double(handle, "min",    &theMin),0);
+    CODES_CHECK(codes_get_double(handle, "average",&theAverage),0);
+    printf("inlen=%lu \t max=%g \t min=%g \t avg=%g\n", inlen, theMax, theMin, theAverage);
+
+    spec.grid_type = GRIB_UTIL_GRID_SPEC_REGULAR_LL;
+    spec.Nj = 721;
+    spec.Ni = 1440;
+    outlen = spec.Nj * spec.Ni;
+    spec.iDirectionIncrementInDegrees = 0.25;
+    spec.jDirectionIncrementInDegrees = 0.25;
+    spec.latitudeOfFirstGridPointInDegrees  = 90.0;
+    spec.longitudeOfFirstGridPointInDegrees = 0.0;
+    spec.latitudeOfLastGridPointInDegrees   = -90.0;
+    spec.longitudeOfLastGridPointInDegrees  = 359.75;
+    spec.bitmapPresent = 1; /* there are missing values inside the data section! */
+    spec.missingValue = 9999;
+
+    packing_spec.packing_type = GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE; /*Convert to Grid Simple Packing*/
+    packing_spec.bitsPerValue = 11;
+    packing_spec.accuracy=GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES;
+    /*packing_spec.packing=GRIB_UTIL_PACKING_USE_PROVIDED;*/
+
+    if (edition != 0) {
+        packing_spec.editionNumber = edition;
+    }
+    if (remove_local_def) {
+        packing_spec.deleteLocalDefinition = 1;
+    }
+
+    finalh = codes_grib_util_set_spec(
+            handle,
+            &spec,
+            &packing_spec,
+            set_spec_flags,
+            values,
+            outlen,
+            &err);
+    assert(finalh);
+    assert(err == 0);
+
+    /* Write out the message to the output file */
+    CODES_CHECK(codes_get_message(finalh, &buffer, &size),0);
+    if(fwrite(buffer,1,size,out) != size) {
+        assert(0);
+    }
+    codes_handle_delete(handle);
+    codes_handle_delete(finalh);
+    fclose(in);
+    fclose(out);
+}
+#endif
+
+static void usage(const char *prog)
 {
     fprintf(stderr, "%s: [-p packingType] [-r] [-e edition] in.grib out.grib\n", prog);
     fprintf(stderr, "-p  packingType: one of grid_jpeg, grid_second_order or grid_simple\n");
@@ -233,6 +322,7 @@ int main(int argc, char *argv[])
 
     test_regular_ll(remove_local_def, edition, packingType, infile_name, outfile_name);
     test_reduced_gg(remove_local_def, edition, packingType, infile_name, outfile_name);
+    /*test_grid_complex_spatial_differencing(remove_local_def, edition, packingType, infile_name, outfile_name);*/
 
     return 0;
 }
diff --git a/tests/ieee.c b/tests/ieee.c
index 9b52978..b4ab412 100755
--- a/tests/ieee.c
+++ b/tests/ieee.c
@@ -9,6 +9,8 @@
  */
 
 #include <stdio.h>
+#include <assert.h>
+#include <float.h>
 
 #include "grib_api_internal.h"
 
@@ -16,11 +18,22 @@ double min   = -1.0000000001;
 double max   = -1.00000000001;
 double scale ;
 
+typedef unsigned long (*ieee_to_long_proc) (double);
+typedef double        (*long_to_ieee_proc) (unsigned long);
+
+#if 0
+static void test(unsigned long input, ieee_to_long_proc ieee_to_long, long_to_ieee_proc long_to_ieee)
+{
+    double x1 = long_to_ieee(input);
+    unsigned long num2 = ieee_to_long(x1);
+    printf("\nconv input=%ld to double=%.10f (%g)    and back => %ld\n", input, x1, x1, num2);
+    if (num2!=input) printf("ERROR: input=%ld not equal!!!\n", input);
+}
+
 double p(double ref1,double ref2)
 {
 	double scale = (max-ref1) / 65535;
 
-
 	unsigned long pack = (unsigned long)(((max - ref1)/scale)+0.5);
 	double unpack      = pack*scale + ref2;
 
@@ -33,48 +46,97 @@ double p(double ref1,double ref2)
 
 	return unpack;
 }
+#endif
 
+/* generate a random floating point number from min to max */
+static double randfrom(double minimum, double maximum)
+{
+    double range = (maximum - minimum);
+    double div = RAND_MAX / range;
+    return minimum + (rand() / div);
+}
+/* Return 1 on success, 0 on failure */
+static int test_doubles(ieee_to_long_proc ieee_to_long, long_to_ieee_proc long_to_ieee)
+{
+    const double tolerance = 1e-7;
+    const double increment = 1;
+    const double max_value = 10 * 1000 * 1000;
+    const double min_value = -max_value;
+    double d = max_value;
+    int num_errors = 0;
+    int num_trials = 0;
+    double max_reldiff = -DBL_MAX;
+
+    while (d > min_value) {
+        double start    = randfrom(0.7,1) * d;
+        unsigned long a = ieee_to_long(start);
+        double end      = long_to_ieee(a);
+        num_trials++;
+        if (start != 0.0) {
+            double reldiff = fabs(end - start)/start;
+            if (reldiff > tolerance) {
+                printf("Error: %.10f (diff=%.10f)\n", start, reldiff);
+                num_errors ++;
+            } else {
+                //printf("Success: %.10f (diff=%.10f)\n", start, reldiff);
+            }
+            if (reldiff > max_reldiff) max_reldiff = reldiff;
+        }
+        d -= increment;
+    }
+    printf("trials = %d, errors = %d\n", num_trials,num_errors);
+    printf("max reldiff = %g\n", max_reldiff);
+    return num_errors==0 ? 1 : 0;
+}
 
 int main(int argc, char *argv[])
 {
 #if 1
 	unsigned long i = 0;
+	printf("Test doubles with grib_ieee_to_long/grib_long_to_ieee...\n");
+	assert( test_doubles(grib_ieee_to_long, grib_long_to_ieee)==1 );
+
+	printf("Test doubles with grib_ieee64_to_long/grib_long_to_ieee64...\n");
+	assert( test_doubles(grib_ieee64_to_long, grib_long_to_ieee64)==1 );
 
+    printf("Test integers...\n");
+	// test(3242539564, grib_ieee_to_long, grib_long_to_ieee); // This fails!
 	assert(grib_ieee_to_long(grib_long_to_ieee(i)) == i);
 
-	for(i = 1; i < 0x7fffffff; i++)
+	/* The minimum value for which we can convert a long to ieee and back is 0x800000 */
+	/* The maximum value for which we can convert a long to ieee and back is 0x7f800000 */
+	for(i = 0x800000; i < 0x7f800000; i++)
 	{
-		unsigned long  j = i | 0x80000000;
+		/*unsigned long  j = i | 0x80000000;*/
+
 		if(grib_ieee_to_long(grib_long_to_ieee(i)) != i)
 		{
 			printf("i=%ld i=%lx e=%g x=%lx\n",i,i,grib_long_to_ieee(i),grib_ieee_to_long(grib_long_to_ieee(i)));
-			assert(grib_ieee_to_long(grib_long_to_ieee(i)) == i);
+			/*assert(grib_ieee_to_long(grib_long_to_ieee(i)) == i);*/
+			assert(0);
+		}
+		/*if(grib_ieee_to_long(grib_long_to_ieee(j)) != j)
+		{
+		    printf("j=%ld i=%lx e=%g x=%lx\n",j,j,grib_long_to_ieee(j),grib_ieee_to_long(grib_long_to_ieee(j)));
 		}
-		assert(grib_ieee_to_long(grib_long_to_ieee(j)) == j);
-		if((i%100000) == 0)
-			printf("i = %08lx %08lx %g %g\n",i,j,grib_long_to_ieee(i),grib_long_to_ieee(j));
+		if ((i%1000000) == 0) {
+			printf("i = %08lx(%ld) %08lx(%ld) %g %g\n", i,i,j,j,grib_long_to_ieee(i),grib_long_to_ieee(j));
+		}*/
 	}
 
 #else
 
-
 	double ref1 = grib_long_to_ieee(grib_ieee_to_long(min));
 	double ref2 = grib_nearest_smaller_ieee_float(min);
 
-
 	double a   = p(min,ref1);
 	double b   = p(min,ref2);
 	double c   = p(ref1,ref1);
 	double d   = p(ref2,ref2);
 
-
-assert(min<max);
-
-
-	/*  */
-
+    assert(min<max);
 
 #endif
-
+    printf("ALL DONE\n");
 	return 0;
 }
diff --git a/tests/index.c b/tests/index.c
index fb41ca2..f2d0c11 100644
--- a/tests/index.c
+++ b/tests/index.c
@@ -9,7 +9,7 @@
  */
 #include "grib_api.h"
 
-void usage(char* prog) {
+static void usage(const char* prog) {
     printf("usage: %s infile\n",prog);
     exit(1);
 }
diff --git a/tests/julian.c b/tests/julian.c
index 5493345..bb6ebad 100644
--- a/tests/julian.c
+++ b/tests/julian.c
@@ -18,7 +18,7 @@
 #define TRUE  1
 #define FALSE 0
 
-BOOL Check(
+static BOOL Check(
         const long year1, const long month1, const long day1, const long hour1, const long min1, const long sec1,
         const long year2, const long month2, const long day2, const long hour2, const long min2, const long sec2)
 {
@@ -28,7 +28,7 @@ BOOL Check(
     return TRUE;
 }
 
-void TestDateTime(const long year, const long month, const long day, const long hour, const long min, const long sec)
+static void TestDateTime(const long year, const long month, const long day, const long hour, const long min, const long sec)
 {
     double jd = 0.0;
     long year1, month1, day1, hour1, min1, sec1; /*generated ones*/
@@ -59,7 +59,7 @@ void TestDateTime(const long year, const long month, const long day, const long
     }
 }
 
-void Test0()
+static void Test0()
 {
     long year, month, day, hour, min, sec;
     double jd;
@@ -87,7 +87,7 @@ void Test0()
     printf("%ld %ld %ld %ld:%ld:%ld -> %f\n",year,month,day,hour,min,sec,jd);
 }
 
-void Test1()
+static void Test1()
 {
     long year, month, day, hour, min, sec;
     double jd;
@@ -115,7 +115,7 @@ void Test1()
     printf("%ld %ld %ld %ld:%ld:%ld -> %f\n",year,month,day,hour,min,sec,jd);
 }
 
-void Test2()
+static void Test2()
 {
     long year, month, day, hour, minute, second;
     int i,last;
@@ -160,7 +160,7 @@ void Test2()
     }
 }
 
-void Test3()
+static void Test3()
 {
     long iyear, imnth, iday, ihr, imin, isec;
     printf("Test3...\n");
diff --git a/tests/multi_from_message.c b/tests/multi_from_message.c
index f40d497..e4205b5 100644
--- a/tests/multi_from_message.c
+++ b/tests/multi_from_message.c
@@ -10,9 +10,6 @@
 
 /*
  * test: reading multi fields messages from memory
- *
- *
- *
  */
 
 #include "grib_api.h"
@@ -20,7 +17,10 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-void usage(char* prog) {printf("usage: %s [-m] file.grib\n",prog);exit(1);}
+static void usage(const char* prog) {
+    printf("usage: %s [-m] file.grib\n",prog);
+    exit(1);
+}
 
 int main(int argc,char* argv[]) {
     struct stat finfo;
diff --git a/tests/read_any.c b/tests/read_any.c
index 2f1fbf1..0866312 100644
--- a/tests/read_any.c
+++ b/tests/read_any.c
@@ -9,7 +9,7 @@
  */
 #include "grib_api_internal.h"
 
-void usage(char* prog) {
+static void usage(const char* prog) {
   printf("usage: %s infile\n",prog);
   exit(1);
 }
@@ -67,7 +67,7 @@ int main(int argc,char* argv[]) {
 		  	count, edition, (long)size, totalLength, shortName, gridType, levelType, level, step);
 		  grib_handle_delete(h);
 		}
-	} else { 
+	} else {
 		printf("MESSAGE #%ld\n",count);
 	}
     size=bufsize;
diff --git a/tests/read_index.c b/tests/read_index.c
index a57eeb7..bae85a7 100644
--- a/tests/read_index.c
+++ b/tests/read_index.c
@@ -10,7 +10,7 @@
 
 #include "grib_api.h"
 
-void usage(char* prog) {
+static void usage(char* prog) {
   printf("usage: %s infile\n",prog);
   exit(1);
 }
diff --git a/tests/sh_ieee64.c b/tests/sh_ieee64.c
new file mode 100644
index 0000000..2b1886d
--- /dev/null
+++ b/tests/sh_ieee64.c
@@ -0,0 +1,276 @@
+/*
+ * Copyright 2005-2017 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 <stdlib.h>
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "grib_api.h"
+
+/*
+ * Check that encoding of sub-truncation using IEEE64 works.
+ * philippe.marguinaud at meteo.fr, 2016/02
+ */
+
+static double values[] = {
+        2.78565217180879301395e+02,      0.00000000000000000000e+00,      8.38367712240454920902e-01,      0.00000000000000000000e+00,     -7.22151022768738215518e-01,
+        0.00000000000000000000e+00,      1.54447137639483056404e+00,      0.00000000000000000000e+00,     -8.10351659720698336287e-01,      0.00000000000000000000e+00,
+        6.45930713064333694717e-01,      0.00000000000000000000e+00,     -1.73417955255619204991e-01,      0.00000000000000000000e+00,     -9.09351867483918913093e-02,
+        0.00000000000000000000e+00,     -3.00845517613623769648e-02,      0.00000000000000000000e+00,     -1.97522108657794209785e-01,      0.00000000000000000000e+00,
+        1.45006392199800160370e-01,      0.00000000000000000000e+00,     -6.92319525648382033678e-02,      0.00000000000000000000e+00,     -3.37495245995370396486e-01,
+        0.00000000000000000000e+00,      2.93969252845082296144e-01,      0.00000000000000000000e+00,      5.22791676917648828748e-02,      0.00000000000000000000e+00,
+        -4.31020055899014042922e-02,      0.00000000000000000000e+00,     -5.34277055570271386387e-02,      0.00000000000000000000e+00,      1.57725778753141337996e-01,
+        0.00000000000000000000e+00,     -1.38048966071163903280e-01,      0.00000000000000000000e+00,      7.95936533884674390915e-02,      0.00000000000000000000e+00,
+        -5.08988096408558021722e-03,      0.00000000000000000000e+00,     -3.17356690459940984916e-02,      0.00000000000000000000e+00,     -7.97854100625838141836e-02,
+        0.00000000000000000000e+00,     -1.25759522048120825355e-01,      0.00000000000000000000e+00,      1.41095505007377608475e-01,      0.00000000000000000000e+00,
+        -2.90041709701537933630e-02,      0.00000000000000000000e+00,      1.16118748810570035501e-01,      0.00000000000000000000e+00,     -1.42650207377574778089e-01,
+        0.00000000000000000000e+00,      6.63859656709936268859e-02,      0.00000000000000000000e+00,     -8.43008351127146754456e-02,      0.00000000000000000000e+00,
+        8.11805506119530340126e-02,      0.00000000000000000000e+00,     -2.92579106275835476580e+00,     -2.73257362252726822283e-02,     -2.31503061096297768628e+00,
+        2.98481883110496337697e-01,      2.32422954464165210098e+00,     -9.36624989809203695179e-02,     -1.13647173814196378316e+00,     -4.24970312443540054748e-01,
+        1.26754821773852066613e+00,     -7.20859094680278700285e-02,     -9.51306475614490221204e-01,      6.14867632012408793507e-01,     -9.85091038732955892598e-02,
+        -6.34523215803268758606e-02,     -6.78708060411115782218e-02,     -1.35311523427619539994e-01,     -9.04935301775932621204e-02,     -9.78101007785831533248e-02,
+        -9.81097374871810895547e-04,      1.80616098092357818539e-02,     -2.64791786212412172397e-02,     -4.76558495508507054539e-02,     -1.96341419265033012564e-01,
+        3.40906457596743608929e-02,     -7.81262194523913988675e-02,     -1.90201799489863598858e-01,      2.25178750048809411810e-01,      2.86704542482240504198e-03,
+        -1.19805102746233238520e-02,      1.68969022321052431135e-02,      5.64738950483129331648e-02,     -1.39757566954298140249e-01,     -7.44084433787887133960e-02,
+        -1.79448737058076172868e-02,      6.14333363921325120716e-02,      4.42090839521651901567e-02,     -1.59177621940344016238e-02,     -2.45259140787589882682e-02,
+        4.14722887926062475095e-02,     -9.08467249754976585718e-02,      7.32634132869659504550e-02,      3.98083190502361433660e-02,     -6.23330309466623433412e-02,
+        3.23061735747387016038e-02,      5.24308078374175548508e-02,     -6.52853670335678676340e-02,     -4.74582205706168894221e-02,     -2.57646217050176394581e-02,
+        4.85326601320503064896e-02,      4.57836316487753580695e-02,     -1.61395013977115135695e-02,     -4.31399408593192076888e-02,     -1.72982609465274252136e-02,
+        2.05141743795376405024e-02,      5.13479785723864323721e-02,      2.02753965345298277356e-02,     -9.62325942856205422682e-03,     -1.21013000039295196344e-03,
+        4.61377663687331032727e-02,     -6.90153405245983028390e-04,     -1.66104804699747843344e+00,      1.79666906865138087390e-01,      7.23133875761683864170e-01,
+        4.15103729262486009777e-01,     -3.04359433047895144853e-01,     -1.33601223735748869670e-01,      1.11896993727331572899e+00,     -5.97930191729183602156e-01,
+        -3.21482407719980045613e-01,     -6.44440729482515239912e-02,     -1.39643167588630684461e-01,     -7.87344252201049310536e-02,     -2.74194962741515224636e-01,
+        3.16014987883590156570e-02,      2.61916687188788577245e-01,     -2.29041295889389484586e-01,      1.37413993896893793512e-02,      1.02848928276271345261e-01,
+        -8.45943398257167356036e-02,     -8.55836430183285895579e-02,     -2.14692485939022847941e-02,     -5.00660400534810728912e-02,      4.10286932308298671335e-02,
+        5.98356967342531728682e-02,     -6.87268417209678655899e-02,     -1.00834342061879356223e-01,      2.89946855441678558174e-02,      6.84096422422015987275e-02,
+        7.90905646811665974383e-02,      1.22761627402924594632e-02,     -7.19296897992387496146e-02,     -1.19563518571031840443e-01,      3.53949764125303933948e-02,
+        3.49389806984224948749e-02,     -1.34556768717593006057e-01,      1.30036738800839157815e-01,      1.47453022488737178763e-01,     -1.75187106897877128975e-02,
+        -5.71655857598896560701e-02,     -2.22513683371899778640e-02,      5.11984135243400070858e-02,      4.32198440146361120839e-02,     -3.79006811678369512353e-02,
+        -1.61948869817943215399e-02,      5.87864730303968852088e-02,      7.56143666040565154418e-03,      3.79735451815043784096e-02,      4.88357571184367539319e-03,
+        -3.44600211423619568266e-03,      8.45175251030964858057e-03,      2.06501052974025246789e-02,     -2.27945980601942863042e-02,      7.52792623890808781928e-02,
+        -4.07335076464383702421e-02,     -1.22373247319515162691e-03,      7.12818582736400585542e-03,     -2.08797409246280901707e-02,      2.35344435031375059930e-02,
+        5.38553837448995376125e-02,      2.29385900837120154661e-01,     -3.60512186055045147359e-01,      4.09262094434219958483e-01,     -1.43204915316633707434e-01,
+        1.76661646314910159017e-01,      1.59424540157772631765e-01,      1.19996653025061628117e-01,      9.74032138671445946176e-02,      8.01756516767066496065e-02,
+        -4.22092435868048232450e-01,      3.42598707334977881089e-01,      7.26427774784764446192e-02,     -1.92869792680440410582e-04,     -9.14800737566894561770e-02,
+        1.86904852575672325576e-01,      9.03785536307215725538e-02,     -8.70628859333670845899e-02,     -1.20357023393743836626e-01,      1.30276821268167974921e-01,
+        -5.50418496727855255379e-02,     -1.39930929689677463479e-01,     -4.10997318303747902202e-02,      1.66027061444833590187e-01,     -3.31025873454900559922e-02,
+        5.45967001368218574076e-02,     -1.86051192758042188702e-01,      3.57669212138109621213e-02,      1.96823682403928168494e-01,      1.12736638944959083330e-01,
+        -1.18563060708320622272e-01,     -7.11264215849067293895e-02,     -3.33098969956449747487e-02,      4.88100702343404121986e-02,      2.04094083090545080905e-02,
+        7.78285563663724117012e-02,     -4.14113893806803898268e-02,      1.26375672481289953730e-02,      1.38745116741378599068e-01,     -8.57558938152793923115e-03,
+        -9.29289689333271246019e-02,     -8.27276771926104548260e-02,      5.84956615429012907748e-02,      2.29399633044502938156e-03,     -2.09824524198216422546e-03,
+        -2.30538708704958079931e-02,      3.77132043821169771203e-02,      6.53337758882697045015e-02,     -3.06667712165429387494e-02,     -1.14650515581519504144e-02,
+        1.46194883433694872849e-02,      3.46636747707448856712e-03,     -4.35546278336838635359e-02,      6.29051255528407793349e-02,      6.12210568933847180256e-03,
+        2.07571937975545607602e-02,      3.35768305063385619214e-01,      7.46266949448459948613e-01,     -6.72463631746016698987e-02,     -1.94536700956528363360e-01,
+        -2.75088750614828209118e-02,      1.42328699967799371384e-01,      3.35288125725375085739e-01,      1.29661987766008346412e-01,      2.90956042046801172107e-02,
+        -2.05442280573112395770e-01,     -9.57252926974513779212e-02,     -9.10355774240597659386e-02,     -1.25784172798783761005e-01,      1.12460127036075691054e-01,
+        9.44013754824246931197e-02,     -6.05135930061245497225e-02,      9.42673278665148578481e-02,      2.00615512602382500829e-01,     -5.92185875904504069323e-02,
+        -2.28592246943101873313e-01,     -1.07412950490968162054e-01,      2.20172956055192214908e-01,      3.33294698669218958376e-01,     -4.44283179185198731642e-02,
+        -1.01766394690480529994e-01,      1.17472184755037761805e-01,      1.04892483649878465179e-01,     -6.62468314716531808672e-02,     -2.45565086356498013531e-03,
+        4.79072727765457034854e-02,     -7.97766729243851169251e-04,     -2.33714338875874692858e-02,     -2.56642787088907850523e-02,     -9.62514763421860042314e-02,
+        3.99383399281938444858e-02,      2.88865653017884548015e-02,     -5.15182520475396393822e-02,      8.26498791523299636275e-02,     -2.98742841129583554249e-02,
+        -8.28182978045203938011e-02,      3.14455026979475749105e-02,     -1.53345808562610789669e-03,     -3.62400610998830294274e-02,     -2.51728077975302867719e-02,
+        -3.02379015962623703961e-02,      2.68910770206758423240e-02,     -8.22634968902352312070e-03,      3.66544933660152699728e-02,      1.32356634436242674713e-02,
+        3.21880247207419244518e-03,     -1.97571016662111687001e-02,      5.93796945717029508310e-03,     -4.31413602924163308572e-02,     -2.72339719264069676785e-02,
+        -1.87274725743593273286e-01,      1.39283127485721136551e-01,      4.74963034217010249272e-01,     -3.42073553333540392174e-01,      4.83885077044606606855e-02,
+        -2.59068005795831224347e-01,     -2.13264680765766156956e-01,     -7.36008484860203593403e-02,     -8.13152420843461926081e-02,     -1.21927665578479005326e-02,
+        1.79904544651649317411e-01,     -1.09959740517953624694e-01,     -2.22065490779929819443e-01,      7.14015849729179447047e-02,     -5.85031872787839662964e-03,
+        9.72943249874637094976e-02,      1.58464145663301525513e-01,     -6.23660570620122936547e-02,     -2.05086286960385583145e-01,     -5.07929431274403847540e-02,
+        4.21897204870116185327e-02,     -6.99935466206487028051e-02,     -6.71348953496629374804e-02,      1.65743074443523596972e-01,      8.56850642116062655163e-02,
+        -1.19953810412321809631e-01,     -7.40173516101229334030e-02,      1.18865945768013535344e-02,     -7.71584669380707965924e-02,     -6.31283399388396088137e-02,
+        -1.45882854372074655114e-01,      6.29307315713034526317e-02,      1.48912624660626508738e-02,     -6.72819324032104260080e-02,      3.22547499735358483841e-02,
+        4.97387743825052491831e-02,     -5.43073271907661761504e-02,      1.52590958854153246893e-02,      2.92721489192738311066e-03,     -1.87663839736718872364e-02,
+        -3.80050872053503069684e-03,      5.91273447672226934446e-02,     -2.83684585809016896404e-03,      1.70512827209476636181e-02,     -1.44259815516434488497e-02,
+        -8.06597987912826830392e-02,      5.19954562777717940736e-02,      1.09504480128524081528e-02,      1.26439885486616093030e-02,     -2.34593647937779382559e-03,
+        2.47413111762442641806e-02,     -6.13559850860111253429e-03,     -6.05626633742831349538e-02,     -1.98467175793774985859e-01,      3.18979113074946862838e-01,
+        6.23356771079433893967e-02,      1.30138108749532965813e-01,     -1.05230501466137910116e-01,     -6.87754575227078057686e-02,     -4.22436887367944324811e-02,
+        7.57926459563205562331e-02,      4.78504387573109452036e-02,     -2.22681497547184761854e-02,      8.46951897073950493722e-02,     -7.44317622658197293462e-03,
+        -1.89157622212636281067e-02,     -6.19719693803440774271e-02,     -8.37644347918033160827e-03,      1.32514981682897603488e-01,     -1.09126775888557903116e-01,
+        -6.47849222903969929055e-03,      4.65591560634076861991e-02,     -2.24234845462696341656e-01,      7.29582023256248463072e-02,      2.23965783883813690514e-03,
+        -5.19349169152241198211e-03,      2.25395864383192284786e-02,      9.10694488527918760701e-02,      7.36945737152017443794e-02,     -2.16337158651918673447e-02,
+        -5.35436418307164291308e-02,      2.40342905027485786995e-02,      4.81946656785084762142e-02,     -3.06521617296798450092e-02,     -4.07904977042986977009e-02,
+        6.32948267919029999851e-02,      4.53192474361057834331e-02,     -2.29008122631283589365e-02,      1.62576382380966721897e-02,      3.82842631619570161750e-02,
+        3.52346794652655739832e-02,     -3.95023093184828782976e-02,     -3.15659719925446974331e-02,      4.02431236080928178556e-02,      2.45684617558553607120e-02,
+        -1.93194945947791144047e-02,     -2.48322169406506726430e-02,     -1.13621415403786386183e-02,     -3.31487361399904478798e-02,      1.68675563537488623633e-02,
+        4.01325091519489432490e-02,      4.14338905584917469027e-02,      1.31273776950603299207e-01,      7.16276979245435152510e-03,      5.02985992698696121606e-02,
+        1.78045915098635626483e-01,     -1.86314001159308406663e-01,     -1.35151434606926579285e-01,      1.69947309928447143346e-01,     -8.37791941109623933270e-02,
+        2.41195207762586322220e-02,      1.26309574838379373718e-01,     -2.00571859613532021971e-01,     -1.63465438373802895988e-01,     -6.96363659600393730686e-02,
+        1.14524330229191645403e-01,      7.12890316169484949960e-02,      5.80381889626466196397e-03,      4.93537868059431283907e-02,     -8.44257746020753430116e-02,
+        -1.41929196365875275043e-02,      8.22387462453117029648e-02,     -8.50093260265970818157e-02,      2.71192346905003156543e-02,      9.03395551304754379496e-02,
+        -1.71516448697893314490e-02,      8.18953521749132690166e-02,      1.11511604557867297777e-02,     -4.78373059022189212053e-03,     -9.53023452930306103070e-02,
+        5.38686323249407891800e-02,     -3.84678611713600085431e-02,     -5.04713920668615947246e-03,      6.80811773653991481048e-02,     -3.33049215638338835799e-02,
+        -5.28099294606356045589e-02,     -7.54699335274512245197e-02,     -5.40781758032556764126e-03,      8.29793590010352716257e-02,     -5.97312971039127629802e-02,
+        -2.71427292677366080453e-02,     -6.36007393417800138968e-03,     -6.21102608067901958838e-03,      1.20982775517295207401e-02,     -1.17366629581995736420e-02,
+        3.79477291991657597614e-02,      4.16172556173764890408e-02,     -4.15482630953573559007e-02,     -2.10178763811884848633e-02,      2.25384141584651191692e-02,
+        3.26544906456272876483e-01,      1.14875244914279722730e-01,     -1.66631737648658934114e-01,     -6.36733988328790686401e-03,      1.05207112351735077027e-01,
+        -2.56656713269180158932e-01,      6.60485459910778310855e-02,      4.17130045127815929362e-02,     -7.37791748174861372611e-02,      7.60523512741725499220e-02,
+        -4.55959006761720783696e-02,     -2.36680526647207629953e-02,      1.10634117950077798254e-01,     -2.08651727388676766495e-02,     -7.64711683504649686327e-02,
+        8.13422913278145920390e-03,      7.93342835009738511776e-02,     -1.36145811582776665727e-01,      3.71088391279384144372e-02,      3.21562962981391253781e-02,
+        -1.14387894243613869039e-01,     -1.51631103622234392203e-03,      5.78217444722389575795e-02,     -4.71124806075210594836e-03,      1.51729749910356030707e-02,
+        9.74258177618566034717e-02,     -1.10011849267590264279e-01,     -9.55723084321756233273e-02,      5.40108889439728720450e-02,      2.20372759806924181647e-02,
+        -3.12940070328804331723e-02,      7.31829279647891323135e-02,     -5.03897879848870661190e-02,      3.56857218059479508465e-02,      2.77447201596329011408e-02,
+        -2.09552594775335998545e-02,      1.43951419283830060747e-02,      5.39902985778747748769e-02,      2.12233791683978864628e-02,     -1.06021857317053335573e-02,
+        -1.29173575974317281917e-02,      2.33645540297061204277e-03,      2.61896609343018451146e-03,     -1.14595932568608803448e-02,      3.56767949738183843926e-04,
+        2.01246788122515993247e-02,      1.99364141245472692443e-01,      1.02386975283006720350e-02,      1.46491539292862016364e-01,     -2.92173375533333390397e-01,
+        -2.79882649001711690528e-02,      7.89598614348374083782e-02,      1.73932768517874730696e-02,     -1.69430993280276553925e-01,     -3.49439319604140236075e-02,
+        -2.41776119023419042153e-02,     -1.19007451411664612329e-02,      7.52785183419538428407e-02,      8.00732324924654653708e-02,      5.80254140930885203842e-02,
+        -2.99344525092792301812e-02,      2.00701049258613407889e-02,     -4.85173141225875570459e-02,     -1.24597145763424926868e-01,     -1.51901004582441958440e-02,
+        -1.61680779553563594431e-02,      6.85542113027582250551e-02,      4.25745326736892623631e-02,     -1.06278911193231559440e-04,      9.76285197536541464458e-03,
+        3.87428701891937912749e-02,     -2.30639988244256723127e-02,      6.36890026034679732764e-03,      3.02413182033626840028e-02,      3.88836672433736253024e-03,
+        -9.08662711955680046927e-02,      4.01745378306784250988e-02,      1.03266559093635329480e-01,      2.14979137912293429002e-03,     -5.41722635351460576891e-02,
+        2.61282597269434195553e-02,     -1.88195226737477086520e-03,     -2.19435523135619973967e-02,      1.32921056129775890658e-02,     -1.39584001825611234843e-02,
+        -2.33277834487258597940e-02,      3.20387242392535485924e-03,     -2.56605748623718842027e-02,      3.00558911102263848214e-02,      3.05648112133436906934e-02,
+        -2.59104772664633942192e-03,     -3.60234150814368395133e-02,      1.89051474579463585357e-01,      7.67659810167127809599e-02,     -1.24703387595890141659e-01,
+        1.16494243349512860419e-01,     -1.23273291315800521267e-02,     -8.52472265397304362899e-02,      4.85995814815475199455e-02,     -4.91533864052588892468e-02,
+        7.09392924651690154336e-02,      3.86918200904741022006e-02,     -6.05870726251201280332e-02,      1.26662290542081668043e-01,     -1.26300238339170367574e-02,
+        -2.77371050405810226636e-02,     -5.43586513698262885352e-02,     -7.86459616541178574423e-02,      6.23528587727540037355e-02,     -4.79677851814970662714e-02,
+        -6.51687150996678454806e-04,      5.76336385114276719688e-02,      1.44542478484825671209e-02,      3.16928492510423695516e-02,      1.45017405736592441823e-02,
+        3.77649866255029068030e-02,      2.76488049642000443748e-04,     -6.60577998684190731415e-02,     -1.43760686140608738570e-02,      3.59108661833638931338e-02,
+        -1.96544252969081192917e-02,     -3.14635605928988426605e-02,      2.73136448740384021883e-02,      4.81895944089887409700e-02,     -1.41798371596522010049e-03,
+        -2.76940211432370950173e-02,     -1.79321359038478039816e-02,     -8.04857916575939247306e-03,      6.12601355103674924743e-04,     -3.04826514707566033346e-02,
+        3.97737096905840994271e-03,      2.93070515299252015717e-02,     -1.68977509366934480761e-01,      3.32231696372570911580e-03,      1.25024830498748684704e-01,
+        1.14603027997231002311e-01,     -1.00188353252315814901e-01,     -9.84663913699934667534e-03,      4.24578628782099620764e-02,     -1.37172078837733080192e-01,
+        -3.49285758694722614504e-02,      5.10266827849673310080e-02,     -8.71727496405721724582e-02,      6.53026570180906262841e-03,      8.81977524226997683376e-02,
+        -6.34979748614215300240e-02,     -6.75922576223946108831e-02,     -9.09058087393600777748e-03,      8.58354921744265697559e-02,     -3.11903783366274736655e-02,
+        2.00028673474334506288e-02,      2.51992069666158204078e-02,     -1.15065874504069552003e-02,      1.90952708533619654185e-02,     -1.42994317615683774053e-02,
+        8.38885300224805237346e-04,     -3.82027498742033497225e-02,     -3.67441895491770198490e-02,      2.50992455595355073994e-02,      7.01187400269996513602e-02,
+        -5.54375280311450654991e-02,     -4.38519736099493434578e-02,     -7.84180536804670973161e-03,      2.15733075413469983783e-02,     -1.13430180042112986952e-03,
+        1.43263625967320618049e-02,      3.38406892444173892920e-02,      2.61661740894084809961e-02,      1.89963433472952851477e-02,      4.11523810167366797808e-03,
+        -4.07083694738235874616e-03,     -2.14250124636823323365e-02,     -2.51950730394823532721e-02,      3.42343547054715646727e-02,     -1.60995215305804545425e-01,
+        1.46286861154573760713e-01,     -1.42470612032240401268e-02,     -8.74980046536548150549e-02,     -4.25453860188948623788e-02,      1.17182553786398857554e-01,
+        -1.00991016453327253632e-01,     -7.91738577441953306213e-02,      5.29573588185536445194e-02,     -2.21614298461902045623e-02,      3.58602587208211864844e-02,
+        2.52438926833398191718e-02,      9.41877819477729971709e-02,     -6.48116676539685077074e-02,     -6.92622200130770665494e-02,      3.44271533520238565140e-02,
+        -2.14712430694437191037e-02,      1.72316382693014427674e-02,     -2.66608743584075963406e-02,     -2.10082338877249467923e-02,      8.91565305172099635544e-03,
+        -1.23413533420058361967e-02,     -6.55699200671947673991e-03,     -6.50539642022832619028e-03,      1.51124007337151353147e-02,      5.20370287348198221067e-03,
+        2.44544519960917354495e-02,      8.17735780033393942767e-03,     -3.77816692303542945967e-04,     -2.75580902253722351269e-02,      1.61366174765763085996e-02,
+        -2.54225642602667507852e-02,     -5.68510449978476550825e-02,      1.03315681722852791002e-02,      5.48232041684815468024e-03,     -3.22722809472682503618e-02,
+        1.68859338049149008965e-02,      6.21665123569529881609e-02,     -1.49734091796970530952e-01,     -1.69848035269845681894e-01,      7.28166844225807269320e-02,
+        -9.38546660994197951000e-02,     -5.98972210309676594830e-02,      1.60189670628219316129e-01,      9.68228235109596380159e-02,     -1.14699218288179388692e-01,
+        5.22495478003770982833e-02,     -2.50191304829539204468e-02,      2.77221049132821764638e-02,      5.25053174572039649259e-02,      4.67049795137407172674e-02,
+        -4.25063623233455645245e-02,     -7.79015735544906322285e-03,      8.35061691171900405406e-02,     -2.77565926301914164820e-02,     -3.55176007501909543618e-02,
+        5.22884040187019810686e-02,      4.47524306813492939866e-03,      3.34858736182796073999e-02,      2.18065090398272508343e-02,      3.96249948248765804237e-02,
+        -1.75050000687652293485e-02,     -5.30639824787136182155e-03,      1.31658536276919365532e-02,     -3.54893637807925724226e-02,      1.44838563901157494143e-03,
+        2.53219139441511024990e-02,      1.51209661740110620776e-02,     -3.18928979311501516886e-03,      8.08035892351891861518e-03,      1.49482343348299774599e-02,
+        -4.67401524501743839690e-02,      8.81785937471118302922e-02,      1.09443858484468511949e-01,      9.61675669132599497679e-02,     -7.39592182705455791769e-02,
+        8.87508822651789097691e-02,     -7.91714174638406542606e-02,     -1.25898861391198962911e-01,      8.84171948090256565322e-02,      3.93482215277929509023e-02,
+        -6.26211797345710557972e-02,      3.11866892937116280127e-02,      1.54206070094080910371e-01,     -7.15962414998223273255e-02,      4.04187883182457047271e-02,
+        3.87320351160306483584e-02,     -2.13087169719965857650e-02,      2.04352330201420621936e-02,      3.60324068311299108847e-02,     -6.71927151509099790383e-02,
+        -5.86355402262732916530e-02,      1.95738272971190847838e-02,      1.19986570986449735121e-02,     -4.16517345466257682407e-02,      4.57582247311850084937e-02,
+        -5.64919874467361762815e-02,     -2.96306742467898837426e-03,      3.45918894384134034681e-02,      9.37965919443191353810e-03,     -5.31266846947417263614e-03,
+        7.44645101900219368030e-03,     -8.16779483872519251886e-03,     -1.49486275306286754694e-02,      5.40961754497425346966e-03,     -6.07743621110200162722e-03,
+        -2.86027271239626297572e-02,      9.28607307596479303324e-02,      1.15334393912762608880e-01,      2.22619048233438435180e-02,     -2.81988516854455167904e-02,
+        -3.27953711282213400402e-02,     -7.26623103447188861681e-02,     -6.21318073281297983401e-02,      8.15860644657136341307e-02,      1.79600966703069159225e-02,
+        -8.26984672948943289050e-02,      2.66922837734803533594e-02,     -5.62012642483699781382e-02,     -7.54479658771655264937e-02,      5.63921972458279810447e-02,
+        -8.88808665037604112014e-03,      4.49098738994229513752e-04,     -1.64624335502902702233e-02,      5.00902714527058645633e-02,      1.06477908341492902983e-02,
+        2.19722684831073211686e-02,      9.27897245497274342219e-03,     -1.38071463629181757221e-02,     -3.25812324194547434097e-02,     -3.02235182235052954325e-02,
+        2.70211283173303479233e-02,      1.78695725115783597692e-02,     -1.97856995310294429824e-02,      2.14583909244959528118e-02,      8.31160096115654556392e-03,
+        -7.96044059263601583298e-03,     -7.03711411983747731069e-03,     -7.52245974116911853002e-02,     -7.17896739726268801052e-02,      1.07396425196690896431e-02,
+        7.25906809169843403318e-02,     -9.45023972725838740105e-02,     -6.71199808984563744962e-02,      7.35264690791543329418e-02,      2.98610952212447697263e-02,
+        -7.52442146662268135371e-04,      9.23976694955527116937e-02,      4.60854381027500578649e-02,     -5.81010137429742931636e-02,      5.19935015121687146844e-02,
+        -4.28751313838296663206e-02,      2.68412731409498166169e-02,      9.92974085166531926505e-03,     -1.41649957602334279627e-02,      8.49484772510930227774e-03,
+        1.60608334268962397659e-03,      1.53969582107269485627e-02,      2.53654424332110106644e-02,      2.20836817019017840613e-02,     -4.96400766026642691758e-03,
+        -4.63895546537213768895e-03,     -3.69755978269468085773e-02,     -4.24220279369531480529e-02,     -2.80842055465305032516e-03,      3.43511446156298310903e-03,
+        1.50427480682660263955e-02,     -7.64781824357823984684e-03,      1.55431405065905338392e-02,     -5.28685500234718219748e-02,     -4.81425552620864186104e-02,
+        -6.98904426260522071424e-02,     -5.69063762150740712342e-02,     -2.01599484306710097226e-02,     -7.08142573082899164094e-03,      1.60387886663503793916e-02,
+        -8.26785713680359968247e-02,      2.82003440014560874394e-02,      2.73932418290509169245e-02,     -3.17992788170617102228e-02,      5.85714331111230612770e-02,
+        5.86577384557991701741e-02,     -2.75299012996250893476e-03,     -8.45195718330371027760e-03,     -1.36279044444791216234e-02,     -1.13870143130110085955e-02,
+        -9.47170994530230694886e-03,      8.38589777991547574709e-03,     -2.44907795135516845320e-02,     -1.88112311627625997112e-02,      1.66825300517051550164e-02,
+        -1.40472696715355817310e-02,      4.07602998308370448322e-02,      4.52331228574007898624e-03,     -7.41516905358174677892e-03,     -1.90839799893427405908e-02,
+        1.37235319648593090402e-01,     -5.07166887609150802974e-03,      1.66347985382777688312e-02,     -8.94058332794331472870e-02,     -9.96617048317507969735e-03,
+        -3.39998201752246195784e-02,     -2.72752305938337435975e-02,      1.41116199971288980557e-04,      1.20136294077674496417e-02,      1.21046096252801875515e-02,
+        4.67374536088999582156e-03,      1.76093997807116745338e-03,     -6.49132489663982719524e-03,      6.34253853067380107822e-02,      4.20234078454048282092e-02,
+        -3.39907942260764435460e-03,     -3.13684078013621997494e-02,     -5.59725664044557688626e-03,      1.46041344723689698465e-02,      8.15628093364801319554e-03,
+        8.81123245682426982361e-03,     -5.36576704715815769320e-02,      4.13564181087699121731e-03,      6.66570175208870251832e-03,     -3.06753731552251258582e-03,
+        3.24260047333155276839e-02,      3.78357123622976698057e-03,      1.22559252382635042178e-01,     -3.26726534731656623189e-02,     -4.57263244390499479231e-02,
+        1.23161267442891183416e-02,      5.60898223233850107272e-02,     -2.07946281596515653023e-02,      3.30973059009364162231e-02,      3.79099335956614089116e-02,
+        3.02099801034241572523e-03,     -4.11260349557933183040e-02,     -2.09662321613402133358e-02,     -1.35059512400454856396e-02,      2.11033519015176411482e-02,
+        2.49738730383721862366e-03,      1.80042474049896738739e-03,     -4.21972590754290111104e-02,      7.84304881856809008034e-03,      1.28611420258033324476e-02,
+        1.53304442551651341764e-02,      1.14809771240723442615e-02,      5.45508167269171534430e-03,      6.03486224308978115582e-03,     -6.17922023172545829134e-03,
+        -1.06402780093771354153e-01,     -1.06566854283863088337e-01,     -1.56672555450536946098e-02,     -4.17617234129553371869e-02,     -5.84327485785076233826e-02,
+        1.72707037153512245331e-02,     -4.27180361478920241763e-03,      3.83975587930814599158e-02,      7.18917519991502662613e-02,      1.73599075858622414748e-02,
+        -5.06102136889801795805e-02,     -2.28302899957008066656e-02,      4.05449577890660689539e-02,      6.05903063932164507449e-03,      1.42495320779388468663e-02,
+        -1.46505630681158707102e-02,     -5.51579872998721708333e-03,     -2.03950903125686006101e-02,      1.71600095189964607645e-02,      3.10141280680510215972e-02,
+        -6.92078952483923121042e-03,     -1.25723580586239959064e-03,      4.83571917759556130223e-02,     -1.08848884748079619000e-01,     -7.62227492845969547414e-03,
+        3.98614872899268266049e-02,      2.51496883852979809248e-02,     -7.45157236466782307849e-02,     -2.54315956467565489063e-02,      5.86785913495517369443e-02,
+        6.07261945507166309849e-03,      2.37710782485035070077e-02,      2.40958099664499367232e-03,      8.00723308014901838381e-03,      5.57202821065413758661e-02,
+        -6.18738592105032812751e-03,      1.57471692604664484198e-03,     -2.08797558382940772262e-03,     -2.73200765442419279960e-02,     -2.06208586891517380024e-02,
+        6.40309150046379439887e-04,      3.34147637908005640250e-02,     -2.31245128603038314907e-02,      3.13805487530873783442e-02,     -3.76503956682762222496e-02,
+        3.82033717675601958152e-02,      6.08549869979059313008e-02,     -1.40664950951139375995e-02,      1.20432450888018800772e-02,      4.11120541709728091334e-03,
+        -1.31431111647770104689e-02,     -2.16767866450208908369e-02,      2.36444182462271527620e-03,      4.15518391649481646372e-03,     -7.19797119986096724242e-03,
+        3.63099914737792378583e-02,     -1.71114207061806439247e-02,      9.12094809288829279359e-03,     -2.00581984724530065778e-02,      4.18093901030532240359e-03,
+        -1.54353999486445108563e-02,      3.77632145097120189292e-02,     -8.67412239218371683425e-02,      3.74024476837445662980e-02,      7.02791955646850374784e-03,
+        -3.07387087745127421390e-03,      1.26170642077405754933e-02,      7.19502473862098246987e-03,      5.00348237158451253359e-02,      6.05821676660315069918e-03,
+        2.81657375913338843543e-02,     -2.75046494305255621871e-02,     -3.32847608680125889302e-02,      4.92458523340539092161e-03,     -6.97895182233836727098e-03,
+        -1.84078432809154611538e-02,     -2.55254058040131799612e-02,      4.38596283726821068588e-03,      7.97305689082921688338e-03,     -6.65251068675700718558e-02,
+        -2.43074168732615144076e-03,     -3.21551055785660854641e-03,     -2.14057386820096506863e-02,      1.73404829493880863200e-02,     -2.21788279126988834011e-02,
+        3.67289476360874028726e-02,      2.88921423109056961509e-02,     -4.36590369050650264210e-03,     -3.38015966458028857197e-03,     -1.47872402615952351634e-02,
+        -2.67937691397940741522e-02,     -4.01628891758317591032e-02,      5.37104159736995767638e-02,      3.38881421250558784175e-02,     -1.94731556323654853013e-02,
+        6.80080451079642287447e-04,     -1.16224021866609874415e-02,     -2.84314312441163938305e-02,     -3.10403528556473483346e-02,     -1.52614844050795953750e-02,
+        1.46865039960839046523e-02,      7.74337973212646264037e-03,     -2.75213939675030445919e-02,     -3.12476741289728875139e-02,     -3.75401476285800936306e-02,
+        4.53067917901101985256e-02,      4.75497506720418041531e-03,      1.25627944556748021021e-02,      4.03046169919628882727e-02,     -3.29378978115561424356e-02,
+        -2.51499548928088654393e-03,     -1.99564144518295516484e-02,     -2.63938123636600005528e-02,     -1.84979990476826575141e-02,     -4.75891539387540141171e-02,
+        1.70189645456799328038e-02,      2.90621732209333551167e-02,      1.69695748997654785595e-02,      6.00578109434020054880e-03,      3.77405846672976205691e-02,
+        1.04426223615697640751e-02,     -7.42237607930411715310e-04,     -1.51118572042552353624e-02,      1.29952623161545995079e-03,      1.26799047323642617713e-02,
+        1.05278997248968164691e-02,      2.29682654055416574090e-02,      1.28888330591014361320e-02,     -1.03014730669756075787e-02,     -4.83421710205830541113e-03,
+        -1.90040068302814585399e-02,     -4.31802671175361696410e-03
+};
+
+#define ILCHAM 992
+#define MTRONC  30
+#define STRONC  10
+
+int main (int argc, char * argv[])
+{
+    size_t len;
+    grib_handle * h;
+    double zval[ILCHAM];
+
+    GRIB_CHECK (((h = grib_handle_new_from_samples (NULL, "sh_ml_grib2")) == NULL), 0);
+
+    /* Meteo-France settings */
+    GRIB_CHECK (grib_set_long (h, "centre", 85), 0);
+    len = strlen ("stretched_rotated_sh");
+    GRIB_CHECK (grib_set_string (h, "gridType", "stretched_rotated_sh", &len), 0);
+    GRIB_CHECK (grib_set_long (h, "pentagonalResolutionParameterJ", MTRONC), 0);
+    GRIB_CHECK (grib_set_long (h, "pentagonalResolutionParameterK", MTRONC), 0);
+    GRIB_CHECK (grib_set_long (h, "pentagonalResolutionParameterM", MTRONC), 0);
+
+    GRIB_CHECK (grib_set_double (h,"stretchingFactor", 2.40000000000000), 0);
+    GRIB_CHECK (grib_set_double (h,"latitudeOfStretchingPoleInDegrees", 46.4688478326275), 0);
+    GRIB_CHECK (grib_set_double (h,"longitudeOfStretchingPoleInDegrees", 2.57831007808864), 0);
+
+    GRIB_CHECK (grib_set_long (h, "bitsPerValue", 16), 0);
+    len = strlen ("spectral_complex");
+    GRIB_CHECK (grib_set_string (h, "packingType", "spectral_complex", &len), 0);
+
+    GRIB_CHECK (grib_set_long (h, "subSetJ", STRONC), 0);
+    GRIB_CHECK (grib_set_long (h, "subSetK", STRONC), 0);
+    GRIB_CHECK (grib_set_long (h, "subSetM", STRONC), 0);
+    GRIB_CHECK (grib_set_long (h, "unpackedSubsetPrecision", 2), 0);
+
+    GRIB_CHECK (grib_set_double_array (h, "values", values, ILCHAM), 0);
+    len = ILCHAM;
+    GRIB_CHECK (grib_get_double_array (h, "values", zval, &len), 0);
+
+    int m, n, k;
+    for (m = 0, k = 0; m < MTRONC+1; m++)
+        for (n = m; n < MTRONC+1; k++, n++)
+        {
+            /* Check sub-truncaton was fully preserved */
+            if ((m < STRONC+1) && (n < STRONC+1) && ((zval[2*k] != values[2*k]) || (zval[2*k+1] != values[2*k+1])))
+            {
+                printf ("Unpacked sub-truncation was not fully preserved; coefficients for wavenumber (m=%d,n=%d) have been modified\n", m, n);
+                return 1;
+            }
+        }
+
+    GRIB_CHECK (grib_handle_delete (h), 0);
+
+    return 0;
+}
diff --git a/version.sh b/tests/sh_ieee64.sh
old mode 100644
new mode 100755
similarity index 57%
copy from version.sh
copy to tests/sh_ieee64.sh
index 9495f0d..313c27a
--- a/version.sh
+++ b/tests/sh_ieee64.sh
@@ -1,4 +1,5 @@
-# Copyright 2005-2017 ECMWF.
+#!/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.
@@ -6,17 +7,7 @@
 # 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.
 #
-# Package name and versioning information
-#
-#
-# Package base name
-PACKAGE_NAME='eccodes'
 
-# Package version
-ECCODES_MAJOR_VERSION=2
-ECCODES_MINOR_VERSION=4
-ECCODES_REVISION_VERSION=1
+. ./include.sh
 
-ECCODES_CURRENT=1
-ECCODES_REVISION=0
-ECCODES_AGE=0
+exec $test_dir/sh_ieee64
diff --git a/tests/unit_tests.c b/tests/unit_tests.c
index f4baef4..58dfaf1 100644
--- a/tests/unit_tests.c
+++ b/tests/unit_tests.c
@@ -15,12 +15,12 @@ int assertion_caught = 0;
 
 typedef enum {IBM_FLOAT, IEEE_FLOAT} FloatRep;
 
-void compare_doubles(const double d1, const double d2, const double epsilon)
+static void compare_doubles(const double d1, const double d2, const double epsilon)
 {
    assert(fabs(d1 - d2) < epsilon);
 }
 
-void check_float_representation(const double val, const double expected, const FloatRep rep)
+static void check_float_representation(const double val, const double expected, const FloatRep rep)
 {
    double out = 0;
    const double tolerance = 1e-9;
@@ -34,7 +34,7 @@ void check_float_representation(const double val, const double expected, const F
    compare_doubles(out, expected, tolerance);
 }
 
-void test_grib_nearest_smaller_ibmfloat()
+static void test_grib_nearest_smaller_ibmfloat()
 {
     check_float_representation(-1.0, -1.0, IBM_FLOAT);
     check_float_representation(0.0,  0.0, IBM_FLOAT);
@@ -44,7 +44,7 @@ void test_grib_nearest_smaller_ibmfloat()
     check_float_representation(7.85, 7.8499994277954, IBM_FLOAT);
 }
 
-void test_grib_nearest_smaller_ieeefloat()
+static void test_grib_nearest_smaller_ieeefloat()
 {
     check_float_representation(-1.0, -1.0, IEEE_FLOAT);
     check_float_representation(0.0,  0.0, IEEE_FLOAT);
@@ -54,7 +54,7 @@ void test_grib_nearest_smaller_ieeefloat()
     check_float_representation(7.85, 7.8499999046325, IEEE_FLOAT);
 }
 
-void test_gaussian_latitudes(int order)
+static void test_gaussian_latitudes(int order)
 {
     int ret = 0;
     const int num = 2 * order;
@@ -73,1302 +73,1302 @@ void test_gaussian_latitudes(int order)
     free(lats);
 }
 
-void test_gaussian_latitude_640()
+static void test_gaussian_latitude_640()
 {
     /* Test all latitudes for one specific Gaussian number */
-	const int order = 640;
-	const int num = 2 * order;
-	int ret = 0;
-	const double tolerance = 1e-6;
-	double* lats = (double*)malloc( sizeof(double)*num );
-	ret = grib_get_gaussian_latitudes(order, lats);
-	Assert(ret == GRIB_SUCCESS);
+    const int order = 640;
+    const int num = 2 * order;
+    int ret = 0;
+    const double tolerance = 1e-6;
+    double* lats = (double*)malloc( sizeof(double)*num );
+    ret = grib_get_gaussian_latitudes(order, lats);
+    Assert(ret == GRIB_SUCCESS);
 
-	compare_doubles(lats[0], 89.892396, tolerance);
-	compare_doubles(lats[1], 89.753005, tolerance);
-	compare_doubles(lats[2], 89.612790, tolerance);
-	compare_doubles(lats[3], 89.472390, tolerance);
-	compare_doubles(lats[4], 89.331918, tolerance);
-	compare_doubles(lats[5], 89.191413, tolerance);
-	compare_doubles(lats[6], 89.050889, tolerance);
-	compare_doubles(lats[7], 88.910352, tolerance);
-	compare_doubles(lats[8], 88.769808, tolerance);
-	compare_doubles(lats[9], 88.629259, tolerance);
-	compare_doubles(lats[10], 88.488706, tolerance);
-	compare_doubles(lats[11], 88.348150, tolerance);
-	compare_doubles(lats[12], 88.207592, tolerance);
-	compare_doubles(lats[13], 88.067032, tolerance);
-	compare_doubles(lats[14], 87.926471, tolerance);
-	compare_doubles(lats[15], 87.785908, tolerance);
-	compare_doubles(lats[16], 87.645345, tolerance);
-	compare_doubles(lats[17], 87.504781, tolerance);
-	compare_doubles(lats[18], 87.364216, tolerance);
-	compare_doubles(lats[19], 87.223651, tolerance);
-	compare_doubles(lats[20], 87.083085, tolerance);
-	compare_doubles(lats[21], 86.942519, tolerance);
-	compare_doubles(lats[22], 86.801952, tolerance);
-	compare_doubles(lats[23], 86.661385, tolerance);
-	compare_doubles(lats[24], 86.520818, tolerance);
-	compare_doubles(lats[25], 86.380251, tolerance);
-	compare_doubles(lats[26], 86.239684, tolerance);
-	compare_doubles(lats[27], 86.099116, tolerance);
-	compare_doubles(lats[28], 85.958548, tolerance);
-	compare_doubles(lats[29], 85.817980, tolerance);
-	compare_doubles(lats[30], 85.677412, tolerance);
-	compare_doubles(lats[31], 85.536844, tolerance);
-	compare_doubles(lats[32], 85.396275, tolerance);
-	compare_doubles(lats[33], 85.255707, tolerance);
-	compare_doubles(lats[34], 85.115138, tolerance);
-	compare_doubles(lats[35], 84.974570, tolerance);
-	compare_doubles(lats[36], 84.834001, tolerance);
-	compare_doubles(lats[37], 84.693432, tolerance);
-	compare_doubles(lats[38], 84.552863, tolerance);
-	compare_doubles(lats[39], 84.412294, tolerance);
-	compare_doubles(lats[40], 84.271725, tolerance);
-	compare_doubles(lats[41], 84.131156, tolerance);
-	compare_doubles(lats[42], 83.990587, tolerance);
-	compare_doubles(lats[43], 83.850018, tolerance);
-	compare_doubles(lats[44], 83.709449, tolerance);
-	compare_doubles(lats[45], 83.568880, tolerance);
-	compare_doubles(lats[46], 83.428310, tolerance);
-	compare_doubles(lats[47], 83.287741, tolerance);
-	compare_doubles(lats[48], 83.147172, tolerance);
-	compare_doubles(lats[49], 83.006602, tolerance);
-	compare_doubles(lats[50], 82.866033, tolerance);
-	compare_doubles(lats[51], 82.725464, tolerance);
-	compare_doubles(lats[52], 82.584894, tolerance);
-	compare_doubles(lats[53], 82.444325, tolerance);
-	compare_doubles(lats[54], 82.303755, tolerance);
-	compare_doubles(lats[55], 82.163186, tolerance);
-	compare_doubles(lats[56], 82.022616, tolerance);
-	compare_doubles(lats[57], 81.882047, tolerance);
-	compare_doubles(lats[58], 81.741477, tolerance);
-	compare_doubles(lats[59], 81.600908, tolerance);
-	compare_doubles(lats[60], 81.460338, tolerance);
-	compare_doubles(lats[61], 81.319768, tolerance);
-	compare_doubles(lats[62], 81.179199, tolerance);
-	compare_doubles(lats[63], 81.038629, tolerance);
-	compare_doubles(lats[64], 80.898059, tolerance);
-	compare_doubles(lats[65], 80.757490, tolerance);
-	compare_doubles(lats[66], 80.616920, tolerance);
-	compare_doubles(lats[67], 80.476350, tolerance);
-	compare_doubles(lats[68], 80.335781, tolerance);
-	compare_doubles(lats[69], 80.195211, tolerance);
-	compare_doubles(lats[70], 80.054641, tolerance);
-	compare_doubles(lats[71], 79.914072, tolerance);
-	compare_doubles(lats[72], 79.773502, tolerance);
-	compare_doubles(lats[73], 79.632932, tolerance);
-	compare_doubles(lats[74], 79.492362, tolerance);
-	compare_doubles(lats[75], 79.351792, tolerance);
-	compare_doubles(lats[76], 79.211223, tolerance);
-	compare_doubles(lats[77], 79.070653, tolerance);
-	compare_doubles(lats[78], 78.930083, tolerance);
-	compare_doubles(lats[79], 78.789513, tolerance);
-	compare_doubles(lats[80], 78.648943, tolerance);
-	compare_doubles(lats[81], 78.508374, tolerance);
-	compare_doubles(lats[82], 78.367804, tolerance);
-	compare_doubles(lats[83], 78.227234, tolerance);
-	compare_doubles(lats[84], 78.086664, tolerance);
-	compare_doubles(lats[85], 77.946094, tolerance);
-	compare_doubles(lats[86], 77.805524, tolerance);
-	compare_doubles(lats[87], 77.664955, tolerance);
-	compare_doubles(lats[88], 77.524385, tolerance);
-	compare_doubles(lats[89], 77.383815, tolerance);
-	compare_doubles(lats[90], 77.243245, tolerance);
-	compare_doubles(lats[91], 77.102675, tolerance);
-	compare_doubles(lats[92], 76.962105, tolerance);
-	compare_doubles(lats[93], 76.821535, tolerance);
-	compare_doubles(lats[94], 76.680966, tolerance);
-	compare_doubles(lats[95], 76.540396, tolerance);
-	compare_doubles(lats[96], 76.399826, tolerance);
-	compare_doubles(lats[97], 76.259256, tolerance);
-	compare_doubles(lats[98], 76.118686, tolerance);
-	compare_doubles(lats[99], 75.978116, tolerance);
-	compare_doubles(lats[100], 75.837546, tolerance);
-	compare_doubles(lats[101], 75.696976, tolerance);
-	compare_doubles(lats[102], 75.556406, tolerance);
-	compare_doubles(lats[103], 75.415836, tolerance);
-	compare_doubles(lats[104], 75.275266, tolerance);
-	compare_doubles(lats[105], 75.134697, tolerance);
-	compare_doubles(lats[106], 74.994127, tolerance);
-	compare_doubles(lats[107], 74.853557, tolerance);
-	compare_doubles(lats[108], 74.712987, tolerance);
-	compare_doubles(lats[109], 74.572417, tolerance);
-	compare_doubles(lats[110], 74.431847, tolerance);
-	compare_doubles(lats[111], 74.291277, tolerance);
-	compare_doubles(lats[112], 74.150707, tolerance);
-	compare_doubles(lats[113], 74.010137, tolerance);
-	compare_doubles(lats[114], 73.869567, tolerance);
-	compare_doubles(lats[115], 73.728997, tolerance);
-	compare_doubles(lats[116], 73.588427, tolerance);
-	compare_doubles(lats[117], 73.447857, tolerance);
-	compare_doubles(lats[118], 73.307287, tolerance);
-	compare_doubles(lats[119], 73.166717, tolerance);
-	compare_doubles(lats[120], 73.026147, tolerance);
-	compare_doubles(lats[121], 72.885577, tolerance);
-	compare_doubles(lats[122], 72.745007, tolerance);
-	compare_doubles(lats[123], 72.604437, tolerance);
-	compare_doubles(lats[124], 72.463867, tolerance);
-	compare_doubles(lats[125], 72.323298, tolerance);
-	compare_doubles(lats[126], 72.182728, tolerance);
-	compare_doubles(lats[127], 72.042158, tolerance);
-	compare_doubles(lats[128], 71.901588, tolerance);
-	compare_doubles(lats[129], 71.761018, tolerance);
-	compare_doubles(lats[130], 71.620448, tolerance);
-	compare_doubles(lats[131], 71.479878, tolerance);
-	compare_doubles(lats[132], 71.339308, tolerance);
-	compare_doubles(lats[133], 71.198738, tolerance);
-	compare_doubles(lats[134], 71.058168, tolerance);
-	compare_doubles(lats[135], 70.917598, tolerance);
-	compare_doubles(lats[136], 70.777028, tolerance);
-	compare_doubles(lats[137], 70.636458, tolerance);
-	compare_doubles(lats[138], 70.495888, tolerance);
-	compare_doubles(lats[139], 70.355318, tolerance);
-	compare_doubles(lats[140], 70.214748, tolerance);
-	compare_doubles(lats[141], 70.074178, tolerance);
-	compare_doubles(lats[142], 69.933608, tolerance);
-	compare_doubles(lats[143], 69.793038, tolerance);
-	compare_doubles(lats[144], 69.652468, tolerance);
-	compare_doubles(lats[145], 69.511898, tolerance);
-	compare_doubles(lats[146], 69.371328, tolerance);
-	compare_doubles(lats[147], 69.230758, tolerance);
-	compare_doubles(lats[148], 69.090188, tolerance);
-	compare_doubles(lats[149], 68.949618, tolerance);
-	compare_doubles(lats[150], 68.809048, tolerance);
-	compare_doubles(lats[151], 68.668478, tolerance);
-	compare_doubles(lats[152], 68.527908, tolerance);
-	compare_doubles(lats[153], 68.387338, tolerance);
-	compare_doubles(lats[154], 68.246768, tolerance);
-	compare_doubles(lats[155], 68.106198, tolerance);
-	compare_doubles(lats[156], 67.965628, tolerance);
-	compare_doubles(lats[157], 67.825058, tolerance);
-	compare_doubles(lats[158], 67.684488, tolerance);
-	compare_doubles(lats[159], 67.543918, tolerance);
-	compare_doubles(lats[160], 67.403348, tolerance);
-	compare_doubles(lats[161], 67.262778, tolerance);
-	compare_doubles(lats[162], 67.122208, tolerance);
-	compare_doubles(lats[163], 66.981638, tolerance);
-	compare_doubles(lats[164], 66.841067, tolerance);
-	compare_doubles(lats[165], 66.700497, tolerance);
-	compare_doubles(lats[166], 66.559927, tolerance);
-	compare_doubles(lats[167], 66.419357, tolerance);
-	compare_doubles(lats[168], 66.278787, tolerance);
-	compare_doubles(lats[169], 66.138217, tolerance);
-	compare_doubles(lats[170], 65.997647, tolerance);
-	compare_doubles(lats[171], 65.857077, tolerance);
-	compare_doubles(lats[172], 65.716507, tolerance);
-	compare_doubles(lats[173], 65.575937, tolerance);
-	compare_doubles(lats[174], 65.435367, tolerance);
-	compare_doubles(lats[175], 65.294797, tolerance);
-	compare_doubles(lats[176], 65.154227, tolerance);
-	compare_doubles(lats[177], 65.013657, tolerance);
-	compare_doubles(lats[178], 64.873087, tolerance);
-	compare_doubles(lats[179], 64.732517, tolerance);
-	compare_doubles(lats[180], 64.591947, tolerance);
-	compare_doubles(lats[181], 64.451377, tolerance);
-	compare_doubles(lats[182], 64.310807, tolerance);
-	compare_doubles(lats[183], 64.170237, tolerance);
-	compare_doubles(lats[184], 64.029667, tolerance);
-	compare_doubles(lats[185], 63.889097, tolerance);
-	compare_doubles(lats[186], 63.748527, tolerance);
-	compare_doubles(lats[187], 63.607957, tolerance);
-	compare_doubles(lats[188], 63.467387, tolerance);
-	compare_doubles(lats[189], 63.326817, tolerance);
-	compare_doubles(lats[190], 63.186247, tolerance);
-	compare_doubles(lats[191], 63.045677, tolerance);
-	compare_doubles(lats[192], 62.905107, tolerance);
-	compare_doubles(lats[193], 62.764537, tolerance);
-	compare_doubles(lats[194], 62.623967, tolerance);
-	compare_doubles(lats[195], 62.483397, tolerance);
-	compare_doubles(lats[196], 62.342826, tolerance);
-	compare_doubles(lats[197], 62.202256, tolerance);
-	compare_doubles(lats[198], 62.061686, tolerance);
-	compare_doubles(lats[199], 61.921116, tolerance);
-	compare_doubles(lats[200], 61.780546, tolerance);
-	compare_doubles(lats[201], 61.639976, tolerance);
-	compare_doubles(lats[202], 61.499406, tolerance);
-	compare_doubles(lats[203], 61.358836, tolerance);
-	compare_doubles(lats[204], 61.218266, tolerance);
-	compare_doubles(lats[205], 61.077696, tolerance);
-	compare_doubles(lats[206], 60.937126, tolerance);
-	compare_doubles(lats[207], 60.796556, tolerance);
-	compare_doubles(lats[208], 60.655986, tolerance);
-	compare_doubles(lats[209], 60.515416, tolerance);
-	compare_doubles(lats[210], 60.374846, tolerance);
-	compare_doubles(lats[211], 60.234276, tolerance);
-	compare_doubles(lats[212], 60.093706, tolerance);
-	compare_doubles(lats[213], 59.953136, tolerance);
-	compare_doubles(lats[214], 59.812566, tolerance);
-	compare_doubles(lats[215], 59.671996, tolerance);
-	compare_doubles(lats[216], 59.531426, tolerance);
-	compare_doubles(lats[217], 59.390856, tolerance);
-	compare_doubles(lats[218], 59.250286, tolerance);
-	compare_doubles(lats[219], 59.109715, tolerance);
-	compare_doubles(lats[220], 58.969145, tolerance);
-	compare_doubles(lats[221], 58.828575, tolerance);
-	compare_doubles(lats[222], 58.688005, tolerance);
-	compare_doubles(lats[223], 58.547435, tolerance);
-	compare_doubles(lats[224], 58.406865, tolerance);
-	compare_doubles(lats[225], 58.266295, tolerance);
-	compare_doubles(lats[226], 58.125725, tolerance);
-	compare_doubles(lats[227], 57.985155, tolerance);
-	compare_doubles(lats[228], 57.844585, tolerance);
-	compare_doubles(lats[229], 57.704015, tolerance);
-	compare_doubles(lats[230], 57.563445, tolerance);
-	compare_doubles(lats[231], 57.422875, tolerance);
-	compare_doubles(lats[232], 57.282305, tolerance);
-	compare_doubles(lats[233], 57.141735, tolerance);
-	compare_doubles(lats[234], 57.001165, tolerance);
-	compare_doubles(lats[235], 56.860595, tolerance);
-	compare_doubles(lats[236], 56.720025, tolerance);
-	compare_doubles(lats[237], 56.579455, tolerance);
-	compare_doubles(lats[238], 56.438884, tolerance);
-	compare_doubles(lats[239], 56.298314, tolerance);
-	compare_doubles(lats[240], 56.157744, tolerance);
-	compare_doubles(lats[241], 56.017174, tolerance);
-	compare_doubles(lats[242], 55.876604, tolerance);
-	compare_doubles(lats[243], 55.736034, tolerance);
-	compare_doubles(lats[244], 55.595464, tolerance);
-	compare_doubles(lats[245], 55.454894, tolerance);
-	compare_doubles(lats[246], 55.314324, tolerance);
-	compare_doubles(lats[247], 55.173754, tolerance);
-	compare_doubles(lats[248], 55.033184, tolerance);
-	compare_doubles(lats[249], 54.892614, tolerance);
-	compare_doubles(lats[250], 54.752044, tolerance);
-	compare_doubles(lats[251], 54.611474, tolerance);
-	compare_doubles(lats[252], 54.470904, tolerance);
-	compare_doubles(lats[253], 54.330334, tolerance);
-	compare_doubles(lats[254], 54.189764, tolerance);
-	compare_doubles(lats[255], 54.049194, tolerance);
-	compare_doubles(lats[256], 53.908623, tolerance);
-	compare_doubles(lats[257], 53.768053, tolerance);
-	compare_doubles(lats[258], 53.627483, tolerance);
-	compare_doubles(lats[259], 53.486913, tolerance);
-	compare_doubles(lats[260], 53.346343, tolerance);
-	compare_doubles(lats[261], 53.205773, tolerance);
-	compare_doubles(lats[262], 53.065203, tolerance);
-	compare_doubles(lats[263], 52.924633, tolerance);
-	compare_doubles(lats[264], 52.784063, tolerance);
-	compare_doubles(lats[265], 52.643493, tolerance);
-	compare_doubles(lats[266], 52.502923, tolerance);
-	compare_doubles(lats[267], 52.362353, tolerance);
-	compare_doubles(lats[268], 52.221783, tolerance);
-	compare_doubles(lats[269], 52.081213, tolerance);
-	compare_doubles(lats[270], 51.940643, tolerance);
-	compare_doubles(lats[271], 51.800073, tolerance);
-	compare_doubles(lats[272], 51.659502, tolerance);
-	compare_doubles(lats[273], 51.518932, tolerance);
-	compare_doubles(lats[274], 51.378362, tolerance);
-	compare_doubles(lats[275], 51.237792, tolerance);
-	compare_doubles(lats[276], 51.097222, tolerance);
-	compare_doubles(lats[277], 50.956652, tolerance);
-	compare_doubles(lats[278], 50.816082, tolerance);
-	compare_doubles(lats[279], 50.675512, tolerance);
-	compare_doubles(lats[280], 50.534942, tolerance);
-	compare_doubles(lats[281], 50.394372, tolerance);
-	compare_doubles(lats[282], 50.253802, tolerance);
-	compare_doubles(lats[283], 50.113232, tolerance);
-	compare_doubles(lats[284], 49.972662, tolerance);
-	compare_doubles(lats[285], 49.832092, tolerance);
-	compare_doubles(lats[286], 49.691522, tolerance);
-	compare_doubles(lats[287], 49.550952, tolerance);
-	compare_doubles(lats[288], 49.410381, tolerance);
-	compare_doubles(lats[289], 49.269811, tolerance);
-	compare_doubles(lats[290], 49.129241, tolerance);
-	compare_doubles(lats[291], 48.988671, tolerance);
-	compare_doubles(lats[292], 48.848101, tolerance);
-	compare_doubles(lats[293], 48.707531, tolerance);
-	compare_doubles(lats[294], 48.566961, tolerance);
-	compare_doubles(lats[295], 48.426391, tolerance);
-	compare_doubles(lats[296], 48.285821, tolerance);
-	compare_doubles(lats[297], 48.145251, tolerance);
-	compare_doubles(lats[298], 48.004681, tolerance);
-	compare_doubles(lats[299], 47.864111, tolerance);
-	compare_doubles(lats[300], 47.723541, tolerance);
-	compare_doubles(lats[301], 47.582971, tolerance);
-	compare_doubles(lats[302], 47.442401, tolerance);
-	compare_doubles(lats[303], 47.301830, tolerance);
-	compare_doubles(lats[304], 47.161260, tolerance);
-	compare_doubles(lats[305], 47.020690, tolerance);
-	compare_doubles(lats[306], 46.880120, tolerance);
-	compare_doubles(lats[307], 46.739550, tolerance);
-	compare_doubles(lats[308], 46.598980, tolerance);
-	compare_doubles(lats[309], 46.458410, tolerance);
-	compare_doubles(lats[310], 46.317840, tolerance);
-	compare_doubles(lats[311], 46.177270, tolerance);
-	compare_doubles(lats[312], 46.036700, tolerance);
-	compare_doubles(lats[313], 45.896130, tolerance);
-	compare_doubles(lats[314], 45.755560, tolerance);
-	compare_doubles(lats[315], 45.614990, tolerance);
-	compare_doubles(lats[316], 45.474420, tolerance);
-	compare_doubles(lats[317], 45.333850, tolerance);
-	compare_doubles(lats[318], 45.193279, tolerance);
-	compare_doubles(lats[319], 45.052709, tolerance);
-	compare_doubles(lats[320], 44.912139, tolerance);
-	compare_doubles(lats[321], 44.771569, tolerance);
-	compare_doubles(lats[322], 44.630999, tolerance);
-	compare_doubles(lats[323], 44.490429, tolerance);
-	compare_doubles(lats[324], 44.349859, tolerance);
-	compare_doubles(lats[325], 44.209289, tolerance);
-	compare_doubles(lats[326], 44.068719, tolerance);
-	compare_doubles(lats[327], 43.928149, tolerance);
-	compare_doubles(lats[328], 43.787579, tolerance);
-	compare_doubles(lats[329], 43.647009, tolerance);
-	compare_doubles(lats[330], 43.506439, tolerance);
-	compare_doubles(lats[331], 43.365869, tolerance);
-	compare_doubles(lats[332], 43.225299, tolerance);
-	compare_doubles(lats[333], 43.084728, tolerance);
-	compare_doubles(lats[334], 42.944158, tolerance);
-	compare_doubles(lats[335], 42.803588, tolerance);
-	compare_doubles(lats[336], 42.663018, tolerance);
-	compare_doubles(lats[337], 42.522448, tolerance);
-	compare_doubles(lats[338], 42.381878, tolerance);
-	compare_doubles(lats[339], 42.241308, tolerance);
-	compare_doubles(lats[340], 42.100738, tolerance);
-	compare_doubles(lats[341], 41.960168, tolerance);
-	compare_doubles(lats[342], 41.819598, tolerance);
-	compare_doubles(lats[343], 41.679028, tolerance);
-	compare_doubles(lats[344], 41.538458, tolerance);
-	compare_doubles(lats[345], 41.397888, tolerance);
-	compare_doubles(lats[346], 41.257318, tolerance);
-	compare_doubles(lats[347], 41.116747, tolerance);
-	compare_doubles(lats[348], 40.976177, tolerance);
-	compare_doubles(lats[349], 40.835607, tolerance);
-	compare_doubles(lats[350], 40.695037, tolerance);
-	compare_doubles(lats[351], 40.554467, tolerance);
-	compare_doubles(lats[352], 40.413897, tolerance);
-	compare_doubles(lats[353], 40.273327, tolerance);
-	compare_doubles(lats[354], 40.132757, tolerance);
-	compare_doubles(lats[355], 39.992187, tolerance);
-	compare_doubles(lats[356], 39.851617, tolerance);
-	compare_doubles(lats[357], 39.711047, tolerance);
-	compare_doubles(lats[358], 39.570477, tolerance);
-	compare_doubles(lats[359], 39.429907, tolerance);
-	compare_doubles(lats[360], 39.289337, tolerance);
-	compare_doubles(lats[361], 39.148766, tolerance);
-	compare_doubles(lats[362], 39.008196, tolerance);
-	compare_doubles(lats[363], 38.867626, tolerance);
-	compare_doubles(lats[364], 38.727056, tolerance);
-	compare_doubles(lats[365], 38.586486, tolerance);
-	compare_doubles(lats[366], 38.445916, tolerance);
-	compare_doubles(lats[367], 38.305346, tolerance);
-	compare_doubles(lats[368], 38.164776, tolerance);
-	compare_doubles(lats[369], 38.024206, tolerance);
-	compare_doubles(lats[370], 37.883636, tolerance);
-	compare_doubles(lats[371], 37.743066, tolerance);
-	compare_doubles(lats[372], 37.602496, tolerance);
-	compare_doubles(lats[373], 37.461926, tolerance);
-	compare_doubles(lats[374], 37.321356, tolerance);
-	compare_doubles(lats[375], 37.180785, tolerance);
-	compare_doubles(lats[376], 37.040215, tolerance);
-	compare_doubles(lats[377], 36.899645, tolerance);
-	compare_doubles(lats[378], 36.759075, tolerance);
-	compare_doubles(lats[379], 36.618505, tolerance);
-	compare_doubles(lats[380], 36.477935, tolerance);
-	compare_doubles(lats[381], 36.337365, tolerance);
-	compare_doubles(lats[382], 36.196795, tolerance);
-	compare_doubles(lats[383], 36.056225, tolerance);
-	compare_doubles(lats[384], 35.915655, tolerance);
-	compare_doubles(lats[385], 35.775085, tolerance);
-	compare_doubles(lats[386], 35.634515, tolerance);
-	compare_doubles(lats[387], 35.493945, tolerance);
-	compare_doubles(lats[388], 35.353374, tolerance);
-	compare_doubles(lats[389], 35.212804, tolerance);
-	compare_doubles(lats[390], 35.072234, tolerance);
-	compare_doubles(lats[391], 34.931664, tolerance);
-	compare_doubles(lats[392], 34.791094, tolerance);
-	compare_doubles(lats[393], 34.650524, tolerance);
-	compare_doubles(lats[394], 34.509954, tolerance);
-	compare_doubles(lats[395], 34.369384, tolerance);
-	compare_doubles(lats[396], 34.228814, tolerance);
-	compare_doubles(lats[397], 34.088244, tolerance);
-	compare_doubles(lats[398], 33.947674, tolerance);
-	compare_doubles(lats[399], 33.807104, tolerance);
-	compare_doubles(lats[400], 33.666534, tolerance);
-	compare_doubles(lats[401], 33.525964, tolerance);
-	compare_doubles(lats[402], 33.385393, tolerance);
-	compare_doubles(lats[403], 33.244823, tolerance);
-	compare_doubles(lats[404], 33.104253, tolerance);
-	compare_doubles(lats[405], 32.963683, tolerance);
-	compare_doubles(lats[406], 32.823113, tolerance);
-	compare_doubles(lats[407], 32.682543, tolerance);
-	compare_doubles(lats[408], 32.541973, tolerance);
-	compare_doubles(lats[409], 32.401403, tolerance);
-	compare_doubles(lats[410], 32.260833, tolerance);
-	compare_doubles(lats[411], 32.120263, tolerance);
-	compare_doubles(lats[412], 31.979693, tolerance);
-	compare_doubles(lats[413], 31.839123, tolerance);
-	compare_doubles(lats[414], 31.698553, tolerance);
-	compare_doubles(lats[415], 31.557982, tolerance);
-	compare_doubles(lats[416], 31.417412, tolerance);
-	compare_doubles(lats[417], 31.276842, tolerance);
-	compare_doubles(lats[418], 31.136272, tolerance);
-	compare_doubles(lats[419], 30.995702, tolerance);
-	compare_doubles(lats[420], 30.855132, tolerance);
-	compare_doubles(lats[421], 30.714562, tolerance);
-	compare_doubles(lats[422], 30.573992, tolerance);
-	compare_doubles(lats[423], 30.433422, tolerance);
-	compare_doubles(lats[424], 30.292852, tolerance);
-	compare_doubles(lats[425], 30.152282, tolerance);
-	compare_doubles(lats[426], 30.011712, tolerance);
-	compare_doubles(lats[427], 29.871142, tolerance);
-	compare_doubles(lats[428], 29.730572, tolerance);
-	compare_doubles(lats[429], 29.590001, tolerance);
-	compare_doubles(lats[430], 29.449431, tolerance);
-	compare_doubles(lats[431], 29.308861, tolerance);
-	compare_doubles(lats[432], 29.168291, tolerance);
-	compare_doubles(lats[433], 29.027721, tolerance);
-	compare_doubles(lats[434], 28.887151, tolerance);
-	compare_doubles(lats[435], 28.746581, tolerance);
-	compare_doubles(lats[436], 28.606011, tolerance);
-	compare_doubles(lats[437], 28.465441, tolerance);
-	compare_doubles(lats[438], 28.324871, tolerance);
-	compare_doubles(lats[439], 28.184301, tolerance);
-	compare_doubles(lats[440], 28.043731, tolerance);
-	compare_doubles(lats[441], 27.903161, tolerance);
-	compare_doubles(lats[442], 27.762590, tolerance);
-	compare_doubles(lats[443], 27.622020, tolerance);
-	compare_doubles(lats[444], 27.481450, tolerance);
-	compare_doubles(lats[445], 27.340880, tolerance);
-	compare_doubles(lats[446], 27.200310, tolerance);
-	compare_doubles(lats[447], 27.059740, tolerance);
-	compare_doubles(lats[448], 26.919170, tolerance);
-	compare_doubles(lats[449], 26.778600, tolerance);
-	compare_doubles(lats[450], 26.638030, tolerance);
-	compare_doubles(lats[451], 26.497460, tolerance);
-	compare_doubles(lats[452], 26.356890, tolerance);
-	compare_doubles(lats[453], 26.216320, tolerance);
-	compare_doubles(lats[454], 26.075750, tolerance);
-	compare_doubles(lats[455], 25.935179, tolerance);
-	compare_doubles(lats[456], 25.794609, tolerance);
-	compare_doubles(lats[457], 25.654039, tolerance);
-	compare_doubles(lats[458], 25.513469, tolerance);
-	compare_doubles(lats[459], 25.372899, tolerance);
-	compare_doubles(lats[460], 25.232329, tolerance);
-	compare_doubles(lats[461], 25.091759, tolerance);
-	compare_doubles(lats[462], 24.951189, tolerance);
-	compare_doubles(lats[463], 24.810619, tolerance);
-	compare_doubles(lats[464], 24.670049, tolerance);
-	compare_doubles(lats[465], 24.529479, tolerance);
-	compare_doubles(lats[466], 24.388909, tolerance);
-	compare_doubles(lats[467], 24.248339, tolerance);
-	compare_doubles(lats[468], 24.107768, tolerance);
-	compare_doubles(lats[469], 23.967198, tolerance);
-	compare_doubles(lats[470], 23.826628, tolerance);
-	compare_doubles(lats[471], 23.686058, tolerance);
-	compare_doubles(lats[472], 23.545488, tolerance);
-	compare_doubles(lats[473], 23.404918, tolerance);
-	compare_doubles(lats[474], 23.264348, tolerance);
-	compare_doubles(lats[475], 23.123778, tolerance);
-	compare_doubles(lats[476], 22.983208, tolerance);
-	compare_doubles(lats[477], 22.842638, tolerance);
-	compare_doubles(lats[478], 22.702068, tolerance);
-	compare_doubles(lats[479], 22.561498, tolerance);
-	compare_doubles(lats[480], 22.420928, tolerance);
-	compare_doubles(lats[481], 22.280357, tolerance);
-	compare_doubles(lats[482], 22.139787, tolerance);
-	compare_doubles(lats[483], 21.999217, tolerance);
-	compare_doubles(lats[484], 21.858647, tolerance);
-	compare_doubles(lats[485], 21.718077, tolerance);
-	compare_doubles(lats[486], 21.577507, tolerance);
-	compare_doubles(lats[487], 21.436937, tolerance);
-	compare_doubles(lats[488], 21.296367, tolerance);
-	compare_doubles(lats[489], 21.155797, tolerance);
-	compare_doubles(lats[490], 21.015227, tolerance);
-	compare_doubles(lats[491], 20.874657, tolerance);
-	compare_doubles(lats[492], 20.734087, tolerance);
-	compare_doubles(lats[493], 20.593517, tolerance);
-	compare_doubles(lats[494], 20.452946, tolerance);
-	compare_doubles(lats[495], 20.312376, tolerance);
-	compare_doubles(lats[496], 20.171806, tolerance);
-	compare_doubles(lats[497], 20.031236, tolerance);
-	compare_doubles(lats[498], 19.890666, tolerance);
-	compare_doubles(lats[499], 19.750096, tolerance);
-	compare_doubles(lats[500], 19.609526, tolerance);
-	compare_doubles(lats[501], 19.468956, tolerance);
-	compare_doubles(lats[502], 19.328386, tolerance);
-	compare_doubles(lats[503], 19.187816, tolerance);
-	compare_doubles(lats[504], 19.047246, tolerance);
-	compare_doubles(lats[505], 18.906676, tolerance);
-	compare_doubles(lats[506], 18.766106, tolerance);
-	compare_doubles(lats[507], 18.625535, tolerance);
-	compare_doubles(lats[508], 18.484965, tolerance);
-	compare_doubles(lats[509], 18.344395, tolerance);
-	compare_doubles(lats[510], 18.203825, tolerance);
-	compare_doubles(lats[511], 18.063255, tolerance);
-	compare_doubles(lats[512], 17.922685, tolerance);
-	compare_doubles(lats[513], 17.782115, tolerance);
-	compare_doubles(lats[514], 17.641545, tolerance);
-	compare_doubles(lats[515], 17.500975, tolerance);
-	compare_doubles(lats[516], 17.360405, tolerance);
-	compare_doubles(lats[517], 17.219835, tolerance);
-	compare_doubles(lats[518], 17.079265, tolerance);
-	compare_doubles(lats[519], 16.938694, tolerance);
-	compare_doubles(lats[520], 16.798124, tolerance);
-	compare_doubles(lats[521], 16.657554, tolerance);
-	compare_doubles(lats[522], 16.516984, tolerance);
-	compare_doubles(lats[523], 16.376414, tolerance);
-	compare_doubles(lats[524], 16.235844, tolerance);
-	compare_doubles(lats[525], 16.095274, tolerance);
-	compare_doubles(lats[526], 15.954704, tolerance);
-	compare_doubles(lats[527], 15.814134, tolerance);
-	compare_doubles(lats[528], 15.673564, tolerance);
-	compare_doubles(lats[529], 15.532994, tolerance);
-	compare_doubles(lats[530], 15.392424, tolerance);
-	compare_doubles(lats[531], 15.251854, tolerance);
-	compare_doubles(lats[532], 15.111283, tolerance);
-	compare_doubles(lats[533], 14.970713, tolerance);
-	compare_doubles(lats[534], 14.830143, tolerance);
-	compare_doubles(lats[535], 14.689573, tolerance);
-	compare_doubles(lats[536], 14.549003, tolerance);
-	compare_doubles(lats[537], 14.408433, tolerance);
-	compare_doubles(lats[538], 14.267863, tolerance);
-	compare_doubles(lats[539], 14.127293, tolerance);
-	compare_doubles(lats[540], 13.986723, tolerance);
-	compare_doubles(lats[541], 13.846153, tolerance);
-	compare_doubles(lats[542], 13.705583, tolerance);
-	compare_doubles(lats[543], 13.565013, tolerance);
-	compare_doubles(lats[544], 13.424443, tolerance);
-	compare_doubles(lats[545], 13.283872, tolerance);
-	compare_doubles(lats[546], 13.143302, tolerance);
-	compare_doubles(lats[547], 13.002732, tolerance);
-	compare_doubles(lats[548], 12.862162, tolerance);
-	compare_doubles(lats[549], 12.721592, tolerance);
-	compare_doubles(lats[550], 12.581022, tolerance);
-	compare_doubles(lats[551], 12.440452, tolerance);
-	compare_doubles(lats[552], 12.299882, tolerance);
-	compare_doubles(lats[553], 12.159312, tolerance);
-	compare_doubles(lats[554], 12.018742, tolerance);
-	compare_doubles(lats[555], 11.878172, tolerance);
-	compare_doubles(lats[556], 11.737602, tolerance);
-	compare_doubles(lats[557], 11.597032, tolerance);
-	compare_doubles(lats[558], 11.456461, tolerance);
-	compare_doubles(lats[559], 11.315891, tolerance);
-	compare_doubles(lats[560], 11.175321, tolerance);
-	compare_doubles(lats[561], 11.034751, tolerance);
-	compare_doubles(lats[562], 10.894181, tolerance);
-	compare_doubles(lats[563], 10.753611, tolerance);
-	compare_doubles(lats[564], 10.613041, tolerance);
-	compare_doubles(lats[565], 10.472471, tolerance);
-	compare_doubles(lats[566], 10.331901, tolerance);
-	compare_doubles(lats[567], 10.191331, tolerance);
-	compare_doubles(lats[568], 10.050761, tolerance);
-	compare_doubles(lats[569], 9.910191, tolerance);
-	compare_doubles(lats[570], 9.769620, tolerance);
-	compare_doubles(lats[571], 9.629050, tolerance);
-	compare_doubles(lats[572], 9.488480, tolerance);
-	compare_doubles(lats[573], 9.347910, tolerance);
-	compare_doubles(lats[574], 9.207340, tolerance);
-	compare_doubles(lats[575], 9.066770, tolerance);
-	compare_doubles(lats[576], 8.926200, tolerance);
-	compare_doubles(lats[577], 8.785630, tolerance);
-	compare_doubles(lats[578], 8.645060, tolerance);
-	compare_doubles(lats[579], 8.504490, tolerance);
-	compare_doubles(lats[580], 8.363920, tolerance);
-	compare_doubles(lats[581], 8.223350, tolerance);
-	compare_doubles(lats[582], 8.082780, tolerance);
-	compare_doubles(lats[583], 7.942209, tolerance);
-	compare_doubles(lats[584], 7.801639, tolerance);
-	compare_doubles(lats[585], 7.661069, tolerance);
-	compare_doubles(lats[586], 7.520499, tolerance);
-	compare_doubles(lats[587], 7.379929, tolerance);
-	compare_doubles(lats[588], 7.239359, tolerance);
-	compare_doubles(lats[589], 7.098789, tolerance);
-	compare_doubles(lats[590], 6.958219, tolerance);
-	compare_doubles(lats[591], 6.817649, tolerance);
-	compare_doubles(lats[592], 6.677079, tolerance);
-	compare_doubles(lats[593], 6.536509, tolerance);
-	compare_doubles(lats[594], 6.395939, tolerance);
-	compare_doubles(lats[595], 6.255369, tolerance);
-	compare_doubles(lats[596], 6.114798, tolerance);
-	compare_doubles(lats[597], 5.974228, tolerance);
-	compare_doubles(lats[598], 5.833658, tolerance);
-	compare_doubles(lats[599], 5.693088, tolerance);
-	compare_doubles(lats[600], 5.552518, tolerance);
-	compare_doubles(lats[601], 5.411948, tolerance);
-	compare_doubles(lats[602], 5.271378, tolerance);
-	compare_doubles(lats[603], 5.130808, tolerance);
-	compare_doubles(lats[604], 4.990238, tolerance);
-	compare_doubles(lats[605], 4.849668, tolerance);
-	compare_doubles(lats[606], 4.709098, tolerance);
-	compare_doubles(lats[607], 4.568528, tolerance);
-	compare_doubles(lats[608], 4.427957, tolerance);
-	compare_doubles(lats[609], 4.287387, tolerance);
-	compare_doubles(lats[610], 4.146817, tolerance);
-	compare_doubles(lats[611], 4.006247, tolerance);
-	compare_doubles(lats[612], 3.865677, tolerance);
-	compare_doubles(lats[613], 3.725107, tolerance);
-	compare_doubles(lats[614], 3.584537, tolerance);
-	compare_doubles(lats[615], 3.443967, tolerance);
-	compare_doubles(lats[616], 3.303397, tolerance);
-	compare_doubles(lats[617], 3.162827, tolerance);
-	compare_doubles(lats[618], 3.022257, tolerance);
-	compare_doubles(lats[619], 2.881687, tolerance);
-	compare_doubles(lats[620], 2.741117, tolerance);
-	compare_doubles(lats[621], 2.600546, tolerance);
-	compare_doubles(lats[622], 2.459976, tolerance);
-	compare_doubles(lats[623], 2.319406, tolerance);
-	compare_doubles(lats[624], 2.178836, tolerance);
-	compare_doubles(lats[625], 2.038266, tolerance);
-	compare_doubles(lats[626], 1.897696, tolerance);
-	compare_doubles(lats[627], 1.757126, tolerance);
-	compare_doubles(lats[628], 1.616556, tolerance);
-	compare_doubles(lats[629], 1.475986, tolerance);
-	compare_doubles(lats[630], 1.335416, tolerance);
-	compare_doubles(lats[631], 1.194846, tolerance);
-	compare_doubles(lats[632], 1.054276, tolerance);
-	compare_doubles(lats[633], 0.913706, tolerance);
-	compare_doubles(lats[634], 0.773135, tolerance);
-	compare_doubles(lats[635], 0.632565, tolerance);
-	compare_doubles(lats[636], 0.491995, tolerance);
-	compare_doubles(lats[637], 0.351425, tolerance);
-	compare_doubles(lats[638], 0.210855, tolerance);
-	compare_doubles(lats[639], 0.070285, tolerance);
-	compare_doubles(lats[640], -0.070285, tolerance);
-	compare_doubles(lats[641], -0.210855, tolerance);
-	compare_doubles(lats[642], -0.351425, tolerance);
-	compare_doubles(lats[643], -0.491995, tolerance);
-	compare_doubles(lats[644], -0.632565, tolerance);
-	compare_doubles(lats[645], -0.773135, tolerance);
-	compare_doubles(lats[646], -0.913706, tolerance);
-	compare_doubles(lats[647], -1.054276, tolerance);
-	compare_doubles(lats[648], -1.194846, tolerance);
-	compare_doubles(lats[649], -1.335416, tolerance);
-	compare_doubles(lats[650], -1.475986, tolerance);
-	compare_doubles(lats[651], -1.616556, tolerance);
-	compare_doubles(lats[652], -1.757126, tolerance);
-	compare_doubles(lats[653], -1.897696, tolerance);
-	compare_doubles(lats[654], -2.038266, tolerance);
-	compare_doubles(lats[655], -2.178836, tolerance);
-	compare_doubles(lats[656], -2.319406, tolerance);
-	compare_doubles(lats[657], -2.459976, tolerance);
-	compare_doubles(lats[658], -2.600546, tolerance);
-	compare_doubles(lats[659], -2.741117, tolerance);
-	compare_doubles(lats[660], -2.881687, tolerance);
-	compare_doubles(lats[661], -3.022257, tolerance);
-	compare_doubles(lats[662], -3.162827, tolerance);
-	compare_doubles(lats[663], -3.303397, tolerance);
-	compare_doubles(lats[664], -3.443967, tolerance);
-	compare_doubles(lats[665], -3.584537, tolerance);
-	compare_doubles(lats[666], -3.725107, tolerance);
-	compare_doubles(lats[667], -3.865677, tolerance);
-	compare_doubles(lats[668], -4.006247, tolerance);
-	compare_doubles(lats[669], -4.146817, tolerance);
-	compare_doubles(lats[670], -4.287387, tolerance);
-	compare_doubles(lats[671], -4.427957, tolerance);
-	compare_doubles(lats[672], -4.568528, tolerance);
-	compare_doubles(lats[673], -4.709098, tolerance);
-	compare_doubles(lats[674], -4.849668, tolerance);
-	compare_doubles(lats[675], -4.990238, tolerance);
-	compare_doubles(lats[676], -5.130808, tolerance);
-	compare_doubles(lats[677], -5.271378, tolerance);
-	compare_doubles(lats[678], -5.411948, tolerance);
-	compare_doubles(lats[679], -5.552518, tolerance);
-	compare_doubles(lats[680], -5.693088, tolerance);
-	compare_doubles(lats[681], -5.833658, tolerance);
-	compare_doubles(lats[682], -5.974228, tolerance);
-	compare_doubles(lats[683], -6.114798, tolerance);
-	compare_doubles(lats[684], -6.255369, tolerance);
-	compare_doubles(lats[685], -6.395939, tolerance);
-	compare_doubles(lats[686], -6.536509, tolerance);
-	compare_doubles(lats[687], -6.677079, tolerance);
-	compare_doubles(lats[688], -6.817649, tolerance);
-	compare_doubles(lats[689], -6.958219, tolerance);
-	compare_doubles(lats[690], -7.098789, tolerance);
-	compare_doubles(lats[691], -7.239359, tolerance);
-	compare_doubles(lats[692], -7.379929, tolerance);
-	compare_doubles(lats[693], -7.520499, tolerance);
-	compare_doubles(lats[694], -7.661069, tolerance);
-	compare_doubles(lats[695], -7.801639, tolerance);
-	compare_doubles(lats[696], -7.942209, tolerance);
-	compare_doubles(lats[697], -8.082780, tolerance);
-	compare_doubles(lats[698], -8.223350, tolerance);
-	compare_doubles(lats[699], -8.363920, tolerance);
-	compare_doubles(lats[700], -8.504490, tolerance);
-	compare_doubles(lats[701], -8.645060, tolerance);
-	compare_doubles(lats[702], -8.785630, tolerance);
-	compare_doubles(lats[703], -8.926200, tolerance);
-	compare_doubles(lats[704], -9.066770, tolerance);
-	compare_doubles(lats[705], -9.207340, tolerance);
-	compare_doubles(lats[706], -9.347910, tolerance);
-	compare_doubles(lats[707], -9.488480, tolerance);
-	compare_doubles(lats[708], -9.629050, tolerance);
-	compare_doubles(lats[709], -9.769620, tolerance);
-	compare_doubles(lats[710], -9.910191, tolerance);
-	compare_doubles(lats[711], -10.050761, tolerance);
-	compare_doubles(lats[712], -10.191331, tolerance);
-	compare_doubles(lats[713], -10.331901, tolerance);
-	compare_doubles(lats[714], -10.472471, tolerance);
-	compare_doubles(lats[715], -10.613041, tolerance);
-	compare_doubles(lats[716], -10.753611, tolerance);
-	compare_doubles(lats[717], -10.894181, tolerance);
-	compare_doubles(lats[718], -11.034751, tolerance);
-	compare_doubles(lats[719], -11.175321, tolerance);
-	compare_doubles(lats[720], -11.315891, tolerance);
-	compare_doubles(lats[721], -11.456461, tolerance);
-	compare_doubles(lats[722], -11.597032, tolerance);
-	compare_doubles(lats[723], -11.737602, tolerance);
-	compare_doubles(lats[724], -11.878172, tolerance);
-	compare_doubles(lats[725], -12.018742, tolerance);
-	compare_doubles(lats[726], -12.159312, tolerance);
-	compare_doubles(lats[727], -12.299882, tolerance);
-	compare_doubles(lats[728], -12.440452, tolerance);
-	compare_doubles(lats[729], -12.581022, tolerance);
-	compare_doubles(lats[730], -12.721592, tolerance);
-	compare_doubles(lats[731], -12.862162, tolerance);
-	compare_doubles(lats[732], -13.002732, tolerance);
-	compare_doubles(lats[733], -13.143302, tolerance);
-	compare_doubles(lats[734], -13.283872, tolerance);
-	compare_doubles(lats[735], -13.424443, tolerance);
-	compare_doubles(lats[736], -13.565013, tolerance);
-	compare_doubles(lats[737], -13.705583, tolerance);
-	compare_doubles(lats[738], -13.846153, tolerance);
-	compare_doubles(lats[739], -13.986723, tolerance);
-	compare_doubles(lats[740], -14.127293, tolerance);
-	compare_doubles(lats[741], -14.267863, tolerance);
-	compare_doubles(lats[742], -14.408433, tolerance);
-	compare_doubles(lats[743], -14.549003, tolerance);
-	compare_doubles(lats[744], -14.689573, tolerance);
-	compare_doubles(lats[745], -14.830143, tolerance);
-	compare_doubles(lats[746], -14.970713, tolerance);
-	compare_doubles(lats[747], -15.111283, tolerance);
-	compare_doubles(lats[748], -15.251854, tolerance);
-	compare_doubles(lats[749], -15.392424, tolerance);
-	compare_doubles(lats[750], -15.532994, tolerance);
-	compare_doubles(lats[751], -15.673564, tolerance);
-	compare_doubles(lats[752], -15.814134, tolerance);
-	compare_doubles(lats[753], -15.954704, tolerance);
-	compare_doubles(lats[754], -16.095274, tolerance);
-	compare_doubles(lats[755], -16.235844, tolerance);
-	compare_doubles(lats[756], -16.376414, tolerance);
-	compare_doubles(lats[757], -16.516984, tolerance);
-	compare_doubles(lats[758], -16.657554, tolerance);
-	compare_doubles(lats[759], -16.798124, tolerance);
-	compare_doubles(lats[760], -16.938694, tolerance);
-	compare_doubles(lats[761], -17.079265, tolerance);
-	compare_doubles(lats[762], -17.219835, tolerance);
-	compare_doubles(lats[763], -17.360405, tolerance);
-	compare_doubles(lats[764], -17.500975, tolerance);
-	compare_doubles(lats[765], -17.641545, tolerance);
-	compare_doubles(lats[766], -17.782115, tolerance);
-	compare_doubles(lats[767], -17.922685, tolerance);
-	compare_doubles(lats[768], -18.063255, tolerance);
-	compare_doubles(lats[769], -18.203825, tolerance);
-	compare_doubles(lats[770], -18.344395, tolerance);
-	compare_doubles(lats[771], -18.484965, tolerance);
-	compare_doubles(lats[772], -18.625535, tolerance);
-	compare_doubles(lats[773], -18.766106, tolerance);
-	compare_doubles(lats[774], -18.906676, tolerance);
-	compare_doubles(lats[775], -19.047246, tolerance);
-	compare_doubles(lats[776], -19.187816, tolerance);
-	compare_doubles(lats[777], -19.328386, tolerance);
-	compare_doubles(lats[778], -19.468956, tolerance);
-	compare_doubles(lats[779], -19.609526, tolerance);
-	compare_doubles(lats[780], -19.750096, tolerance);
-	compare_doubles(lats[781], -19.890666, tolerance);
-	compare_doubles(lats[782], -20.031236, tolerance);
-	compare_doubles(lats[783], -20.171806, tolerance);
-	compare_doubles(lats[784], -20.312376, tolerance);
-	compare_doubles(lats[785], -20.452946, tolerance);
-	compare_doubles(lats[786], -20.593517, tolerance);
-	compare_doubles(lats[787], -20.734087, tolerance);
-	compare_doubles(lats[788], -20.874657, tolerance);
-	compare_doubles(lats[789], -21.015227, tolerance);
-	compare_doubles(lats[790], -21.155797, tolerance);
-	compare_doubles(lats[791], -21.296367, tolerance);
-	compare_doubles(lats[792], -21.436937, tolerance);
-	compare_doubles(lats[793], -21.577507, tolerance);
-	compare_doubles(lats[794], -21.718077, tolerance);
-	compare_doubles(lats[795], -21.858647, tolerance);
-	compare_doubles(lats[796], -21.999217, tolerance);
-	compare_doubles(lats[797], -22.139787, tolerance);
-	compare_doubles(lats[798], -22.280357, tolerance);
-	compare_doubles(lats[799], -22.420928, tolerance);
-	compare_doubles(lats[800], -22.561498, tolerance);
-	compare_doubles(lats[801], -22.702068, tolerance);
-	compare_doubles(lats[802], -22.842638, tolerance);
-	compare_doubles(lats[803], -22.983208, tolerance);
-	compare_doubles(lats[804], -23.123778, tolerance);
-	compare_doubles(lats[805], -23.264348, tolerance);
-	compare_doubles(lats[806], -23.404918, tolerance);
-	compare_doubles(lats[807], -23.545488, tolerance);
-	compare_doubles(lats[808], -23.686058, tolerance);
-	compare_doubles(lats[809], -23.826628, tolerance);
-	compare_doubles(lats[810], -23.967198, tolerance);
-	compare_doubles(lats[811], -24.107768, tolerance);
-	compare_doubles(lats[812], -24.248339, tolerance);
-	compare_doubles(lats[813], -24.388909, tolerance);
-	compare_doubles(lats[814], -24.529479, tolerance);
-	compare_doubles(lats[815], -24.670049, tolerance);
-	compare_doubles(lats[816], -24.810619, tolerance);
-	compare_doubles(lats[817], -24.951189, tolerance);
-	compare_doubles(lats[818], -25.091759, tolerance);
-	compare_doubles(lats[819], -25.232329, tolerance);
-	compare_doubles(lats[820], -25.372899, tolerance);
-	compare_doubles(lats[821], -25.513469, tolerance);
-	compare_doubles(lats[822], -25.654039, tolerance);
-	compare_doubles(lats[823], -25.794609, tolerance);
-	compare_doubles(lats[824], -25.935179, tolerance);
-	compare_doubles(lats[825], -26.075750, tolerance);
-	compare_doubles(lats[826], -26.216320, tolerance);
-	compare_doubles(lats[827], -26.356890, tolerance);
-	compare_doubles(lats[828], -26.497460, tolerance);
-	compare_doubles(lats[829], -26.638030, tolerance);
-	compare_doubles(lats[830], -26.778600, tolerance);
-	compare_doubles(lats[831], -26.919170, tolerance);
-	compare_doubles(lats[832], -27.059740, tolerance);
-	compare_doubles(lats[833], -27.200310, tolerance);
-	compare_doubles(lats[834], -27.340880, tolerance);
-	compare_doubles(lats[835], -27.481450, tolerance);
-	compare_doubles(lats[836], -27.622020, tolerance);
-	compare_doubles(lats[837], -27.762590, tolerance);
-	compare_doubles(lats[838], -27.903161, tolerance);
-	compare_doubles(lats[839], -28.043731, tolerance);
-	compare_doubles(lats[840], -28.184301, tolerance);
-	compare_doubles(lats[841], -28.324871, tolerance);
-	compare_doubles(lats[842], -28.465441, tolerance);
-	compare_doubles(lats[843], -28.606011, tolerance);
-	compare_doubles(lats[844], -28.746581, tolerance);
-	compare_doubles(lats[845], -28.887151, tolerance);
-	compare_doubles(lats[846], -29.027721, tolerance);
-	compare_doubles(lats[847], -29.168291, tolerance);
-	compare_doubles(lats[848], -29.308861, tolerance);
-	compare_doubles(lats[849], -29.449431, tolerance);
-	compare_doubles(lats[850], -29.590001, tolerance);
-	compare_doubles(lats[851], -29.730572, tolerance);
-	compare_doubles(lats[852], -29.871142, tolerance);
-	compare_doubles(lats[853], -30.011712, tolerance);
-	compare_doubles(lats[854], -30.152282, tolerance);
-	compare_doubles(lats[855], -30.292852, tolerance);
-	compare_doubles(lats[856], -30.433422, tolerance);
-	compare_doubles(lats[857], -30.573992, tolerance);
-	compare_doubles(lats[858], -30.714562, tolerance);
-	compare_doubles(lats[859], -30.855132, tolerance);
-	compare_doubles(lats[860], -30.995702, tolerance);
-	compare_doubles(lats[861], -31.136272, tolerance);
-	compare_doubles(lats[862], -31.276842, tolerance);
-	compare_doubles(lats[863], -31.417412, tolerance);
-	compare_doubles(lats[864], -31.557982, tolerance);
-	compare_doubles(lats[865], -31.698553, tolerance);
-	compare_doubles(lats[866], -31.839123, tolerance);
-	compare_doubles(lats[867], -31.979693, tolerance);
-	compare_doubles(lats[868], -32.120263, tolerance);
-	compare_doubles(lats[869], -32.260833, tolerance);
-	compare_doubles(lats[870], -32.401403, tolerance);
-	compare_doubles(lats[871], -32.541973, tolerance);
-	compare_doubles(lats[872], -32.682543, tolerance);
-	compare_doubles(lats[873], -32.823113, tolerance);
-	compare_doubles(lats[874], -32.963683, tolerance);
-	compare_doubles(lats[875], -33.104253, tolerance);
-	compare_doubles(lats[876], -33.244823, tolerance);
-	compare_doubles(lats[877], -33.385393, tolerance);
-	compare_doubles(lats[878], -33.525964, tolerance);
-	compare_doubles(lats[879], -33.666534, tolerance);
-	compare_doubles(lats[880], -33.807104, tolerance);
-	compare_doubles(lats[881], -33.947674, tolerance);
-	compare_doubles(lats[882], -34.088244, tolerance);
-	compare_doubles(lats[883], -34.228814, tolerance);
-	compare_doubles(lats[884], -34.369384, tolerance);
-	compare_doubles(lats[885], -34.509954, tolerance);
-	compare_doubles(lats[886], -34.650524, tolerance);
-	compare_doubles(lats[887], -34.791094, tolerance);
-	compare_doubles(lats[888], -34.931664, tolerance);
-	compare_doubles(lats[889], -35.072234, tolerance);
-	compare_doubles(lats[890], -35.212804, tolerance);
-	compare_doubles(lats[891], -35.353374, tolerance);
-	compare_doubles(lats[892], -35.493945, tolerance);
-	compare_doubles(lats[893], -35.634515, tolerance);
-	compare_doubles(lats[894], -35.775085, tolerance);
-	compare_doubles(lats[895], -35.915655, tolerance);
-	compare_doubles(lats[896], -36.056225, tolerance);
-	compare_doubles(lats[897], -36.196795, tolerance);
-	compare_doubles(lats[898], -36.337365, tolerance);
-	compare_doubles(lats[899], -36.477935, tolerance);
-	compare_doubles(lats[900], -36.618505, tolerance);
-	compare_doubles(lats[901], -36.759075, tolerance);
-	compare_doubles(lats[902], -36.899645, tolerance);
-	compare_doubles(lats[903], -37.040215, tolerance);
-	compare_doubles(lats[904], -37.180785, tolerance);
-	compare_doubles(lats[905], -37.321356, tolerance);
-	compare_doubles(lats[906], -37.461926, tolerance);
-	compare_doubles(lats[907], -37.602496, tolerance);
-	compare_doubles(lats[908], -37.743066, tolerance);
-	compare_doubles(lats[909], -37.883636, tolerance);
-	compare_doubles(lats[910], -38.024206, tolerance);
-	compare_doubles(lats[911], -38.164776, tolerance);
-	compare_doubles(lats[912], -38.305346, tolerance);
-	compare_doubles(lats[913], -38.445916, tolerance);
-	compare_doubles(lats[914], -38.586486, tolerance);
-	compare_doubles(lats[915], -38.727056, tolerance);
-	compare_doubles(lats[916], -38.867626, tolerance);
-	compare_doubles(lats[917], -39.008196, tolerance);
-	compare_doubles(lats[918], -39.148766, tolerance);
-	compare_doubles(lats[919], -39.289337, tolerance);
-	compare_doubles(lats[920], -39.429907, tolerance);
-	compare_doubles(lats[921], -39.570477, tolerance);
-	compare_doubles(lats[922], -39.711047, tolerance);
-	compare_doubles(lats[923], -39.851617, tolerance);
-	compare_doubles(lats[924], -39.992187, tolerance);
-	compare_doubles(lats[925], -40.132757, tolerance);
-	compare_doubles(lats[926], -40.273327, tolerance);
-	compare_doubles(lats[927], -40.413897, tolerance);
-	compare_doubles(lats[928], -40.554467, tolerance);
-	compare_doubles(lats[929], -40.695037, tolerance);
-	compare_doubles(lats[930], -40.835607, tolerance);
-	compare_doubles(lats[931], -40.976177, tolerance);
-	compare_doubles(lats[932], -41.116747, tolerance);
-	compare_doubles(lats[933], -41.257318, tolerance);
-	compare_doubles(lats[934], -41.397888, tolerance);
-	compare_doubles(lats[935], -41.538458, tolerance);
-	compare_doubles(lats[936], -41.679028, tolerance);
-	compare_doubles(lats[937], -41.819598, tolerance);
-	compare_doubles(lats[938], -41.960168, tolerance);
-	compare_doubles(lats[939], -42.100738, tolerance);
-	compare_doubles(lats[940], -42.241308, tolerance);
-	compare_doubles(lats[941], -42.381878, tolerance);
-	compare_doubles(lats[942], -42.522448, tolerance);
-	compare_doubles(lats[943], -42.663018, tolerance);
-	compare_doubles(lats[944], -42.803588, tolerance);
-	compare_doubles(lats[945], -42.944158, tolerance);
-	compare_doubles(lats[946], -43.084728, tolerance);
-	compare_doubles(lats[947], -43.225299, tolerance);
-	compare_doubles(lats[948], -43.365869, tolerance);
-	compare_doubles(lats[949], -43.506439, tolerance);
-	compare_doubles(lats[950], -43.647009, tolerance);
-	compare_doubles(lats[951], -43.787579, tolerance);
-	compare_doubles(lats[952], -43.928149, tolerance);
-	compare_doubles(lats[953], -44.068719, tolerance);
-	compare_doubles(lats[954], -44.209289, tolerance);
-	compare_doubles(lats[955], -44.349859, tolerance);
-	compare_doubles(lats[956], -44.490429, tolerance);
-	compare_doubles(lats[957], -44.630999, tolerance);
-	compare_doubles(lats[958], -44.771569, tolerance);
-	compare_doubles(lats[959], -44.912139, tolerance);
-	compare_doubles(lats[960], -45.052709, tolerance);
-	compare_doubles(lats[961], -45.193279, tolerance);
-	compare_doubles(lats[962], -45.333850, tolerance);
-	compare_doubles(lats[963], -45.474420, tolerance);
-	compare_doubles(lats[964], -45.614990, tolerance);
-	compare_doubles(lats[965], -45.755560, tolerance);
-	compare_doubles(lats[966], -45.896130, tolerance);
-	compare_doubles(lats[967], -46.036700, tolerance);
-	compare_doubles(lats[968], -46.177270, tolerance);
-	compare_doubles(lats[969], -46.317840, tolerance);
-	compare_doubles(lats[970], -46.458410, tolerance);
-	compare_doubles(lats[971], -46.598980, tolerance);
-	compare_doubles(lats[972], -46.739550, tolerance);
-	compare_doubles(lats[973], -46.880120, tolerance);
-	compare_doubles(lats[974], -47.020690, tolerance);
-	compare_doubles(lats[975], -47.161260, tolerance);
-	compare_doubles(lats[976], -47.301830, tolerance);
-	compare_doubles(lats[977], -47.442401, tolerance);
-	compare_doubles(lats[978], -47.582971, tolerance);
-	compare_doubles(lats[979], -47.723541, tolerance);
-	compare_doubles(lats[980], -47.864111, tolerance);
-	compare_doubles(lats[981], -48.004681, tolerance);
-	compare_doubles(lats[982], -48.145251, tolerance);
-	compare_doubles(lats[983], -48.285821, tolerance);
-	compare_doubles(lats[984], -48.426391, tolerance);
-	compare_doubles(lats[985], -48.566961, tolerance);
-	compare_doubles(lats[986], -48.707531, tolerance);
-	compare_doubles(lats[987], -48.848101, tolerance);
-	compare_doubles(lats[988], -48.988671, tolerance);
-	compare_doubles(lats[989], -49.129241, tolerance);
-	compare_doubles(lats[990], -49.269811, tolerance);
-	compare_doubles(lats[991], -49.410381, tolerance);
-	compare_doubles(lats[992], -49.550952, tolerance);
-	compare_doubles(lats[993], -49.691522, tolerance);
-	compare_doubles(lats[994], -49.832092, tolerance);
-	compare_doubles(lats[995], -49.972662, tolerance);
-	compare_doubles(lats[996], -50.113232, tolerance);
-	compare_doubles(lats[997], -50.253802, tolerance);
-	compare_doubles(lats[998], -50.394372, tolerance);
-	compare_doubles(lats[999], -50.534942, tolerance);
-	compare_doubles(lats[1000], -50.675512, tolerance);
-	compare_doubles(lats[1001], -50.816082, tolerance);
-	compare_doubles(lats[1002], -50.956652, tolerance);
-	compare_doubles(lats[1003], -51.097222, tolerance);
-	compare_doubles(lats[1004], -51.237792, tolerance);
-	compare_doubles(lats[1005], -51.378362, tolerance);
-	compare_doubles(lats[1006], -51.518932, tolerance);
-	compare_doubles(lats[1007], -51.659502, tolerance);
-	compare_doubles(lats[1008], -51.800073, tolerance);
-	compare_doubles(lats[1009], -51.940643, tolerance);
-	compare_doubles(lats[1010], -52.081213, tolerance);
-	compare_doubles(lats[1011], -52.221783, tolerance);
-	compare_doubles(lats[1012], -52.362353, tolerance);
-	compare_doubles(lats[1013], -52.502923, tolerance);
-	compare_doubles(lats[1014], -52.643493, tolerance);
-	compare_doubles(lats[1015], -52.784063, tolerance);
-	compare_doubles(lats[1016], -52.924633, tolerance);
-	compare_doubles(lats[1017], -53.065203, tolerance);
-	compare_doubles(lats[1018], -53.205773, tolerance);
-	compare_doubles(lats[1019], -53.346343, tolerance);
-	compare_doubles(lats[1020], -53.486913, tolerance);
-	compare_doubles(lats[1021], -53.627483, tolerance);
-	compare_doubles(lats[1022], -53.768053, tolerance);
-	compare_doubles(lats[1023], -53.908623, tolerance);
-	compare_doubles(lats[1024], -54.049194, tolerance);
-	compare_doubles(lats[1025], -54.189764, tolerance);
-	compare_doubles(lats[1026], -54.330334, tolerance);
-	compare_doubles(lats[1027], -54.470904, tolerance);
-	compare_doubles(lats[1028], -54.611474, tolerance);
-	compare_doubles(lats[1029], -54.752044, tolerance);
-	compare_doubles(lats[1030], -54.892614, tolerance);
-	compare_doubles(lats[1031], -55.033184, tolerance);
-	compare_doubles(lats[1032], -55.173754, tolerance);
-	compare_doubles(lats[1033], -55.314324, tolerance);
-	compare_doubles(lats[1034], -55.454894, tolerance);
-	compare_doubles(lats[1035], -55.595464, tolerance);
-	compare_doubles(lats[1036], -55.736034, tolerance);
-	compare_doubles(lats[1037], -55.876604, tolerance);
-	compare_doubles(lats[1038], -56.017174, tolerance);
-	compare_doubles(lats[1039], -56.157744, tolerance);
-	compare_doubles(lats[1040], -56.298314, tolerance);
-	compare_doubles(lats[1041], -56.438884, tolerance);
-	compare_doubles(lats[1042], -56.579455, tolerance);
-	compare_doubles(lats[1043], -56.720025, tolerance);
-	compare_doubles(lats[1044], -56.860595, tolerance);
-	compare_doubles(lats[1045], -57.001165, tolerance);
-	compare_doubles(lats[1046], -57.141735, tolerance);
-	compare_doubles(lats[1047], -57.282305, tolerance);
-	compare_doubles(lats[1048], -57.422875, tolerance);
-	compare_doubles(lats[1049], -57.563445, tolerance);
-	compare_doubles(lats[1050], -57.704015, tolerance);
-	compare_doubles(lats[1051], -57.844585, tolerance);
-	compare_doubles(lats[1052], -57.985155, tolerance);
-	compare_doubles(lats[1053], -58.125725, tolerance);
-	compare_doubles(lats[1054], -58.266295, tolerance);
-	compare_doubles(lats[1055], -58.406865, tolerance);
-	compare_doubles(lats[1056], -58.547435, tolerance);
-	compare_doubles(lats[1057], -58.688005, tolerance);
-	compare_doubles(lats[1058], -58.828575, tolerance);
-	compare_doubles(lats[1059], -58.969145, tolerance);
-	compare_doubles(lats[1060], -59.109715, tolerance);
-	compare_doubles(lats[1061], -59.250286, tolerance);
-	compare_doubles(lats[1062], -59.390856, tolerance);
-	compare_doubles(lats[1063], -59.531426, tolerance);
-	compare_doubles(lats[1064], -59.671996, tolerance);
-	compare_doubles(lats[1065], -59.812566, tolerance);
-	compare_doubles(lats[1066], -59.953136, tolerance);
-	compare_doubles(lats[1067], -60.093706, tolerance);
-	compare_doubles(lats[1068], -60.234276, tolerance);
-	compare_doubles(lats[1069], -60.374846, tolerance);
-	compare_doubles(lats[1070], -60.515416, tolerance);
-	compare_doubles(lats[1071], -60.655986, tolerance);
-	compare_doubles(lats[1072], -60.796556, tolerance);
-	compare_doubles(lats[1073], -60.937126, tolerance);
-	compare_doubles(lats[1074], -61.077696, tolerance);
-	compare_doubles(lats[1075], -61.218266, tolerance);
-	compare_doubles(lats[1076], -61.358836, tolerance);
-	compare_doubles(lats[1077], -61.499406, tolerance);
-	compare_doubles(lats[1078], -61.639976, tolerance);
-	compare_doubles(lats[1079], -61.780546, tolerance);
-	compare_doubles(lats[1080], -61.921116, tolerance);
-	compare_doubles(lats[1081], -62.061686, tolerance);
-	compare_doubles(lats[1082], -62.202256, tolerance);
-	compare_doubles(lats[1083], -62.342826, tolerance);
-	compare_doubles(lats[1084], -62.483397, tolerance);
-	compare_doubles(lats[1085], -62.623967, tolerance);
-	compare_doubles(lats[1086], -62.764537, tolerance);
-	compare_doubles(lats[1087], -62.905107, tolerance);
-	compare_doubles(lats[1088], -63.045677, tolerance);
-	compare_doubles(lats[1089], -63.186247, tolerance);
-	compare_doubles(lats[1090], -63.326817, tolerance);
-	compare_doubles(lats[1091], -63.467387, tolerance);
-	compare_doubles(lats[1092], -63.607957, tolerance);
-	compare_doubles(lats[1093], -63.748527, tolerance);
-	compare_doubles(lats[1094], -63.889097, tolerance);
-	compare_doubles(lats[1095], -64.029667, tolerance);
-	compare_doubles(lats[1096], -64.170237, tolerance);
-	compare_doubles(lats[1097], -64.310807, tolerance);
-	compare_doubles(lats[1098], -64.451377, tolerance);
-	compare_doubles(lats[1099], -64.591947, tolerance);
-	compare_doubles(lats[1100], -64.732517, tolerance);
-	compare_doubles(lats[1101], -64.873087, tolerance);
-	compare_doubles(lats[1102], -65.013657, tolerance);
-	compare_doubles(lats[1103], -65.154227, tolerance);
-	compare_doubles(lats[1104], -65.294797, tolerance);
-	compare_doubles(lats[1105], -65.435367, tolerance);
-	compare_doubles(lats[1106], -65.575937, tolerance);
-	compare_doubles(lats[1107], -65.716507, tolerance);
-	compare_doubles(lats[1108], -65.857077, tolerance);
-	compare_doubles(lats[1109], -65.997647, tolerance);
-	compare_doubles(lats[1110], -66.138217, tolerance);
-	compare_doubles(lats[1111], -66.278787, tolerance);
-	compare_doubles(lats[1112], -66.419357, tolerance);
-	compare_doubles(lats[1113], -66.559927, tolerance);
-	compare_doubles(lats[1114], -66.700497, tolerance);
-	compare_doubles(lats[1115], -66.841067, tolerance);
-	compare_doubles(lats[1116], -66.981638, tolerance);
-	compare_doubles(lats[1117], -67.122208, tolerance);
-	compare_doubles(lats[1118], -67.262778, tolerance);
-	compare_doubles(lats[1119], -67.403348, tolerance);
-	compare_doubles(lats[1120], -67.543918, tolerance);
-	compare_doubles(lats[1121], -67.684488, tolerance);
-	compare_doubles(lats[1122], -67.825058, tolerance);
-	compare_doubles(lats[1123], -67.965628, tolerance);
-	compare_doubles(lats[1124], -68.106198, tolerance);
-	compare_doubles(lats[1125], -68.246768, tolerance);
-	compare_doubles(lats[1126], -68.387338, tolerance);
-	compare_doubles(lats[1127], -68.527908, tolerance);
-	compare_doubles(lats[1128], -68.668478, tolerance);
-	compare_doubles(lats[1129], -68.809048, tolerance);
-	compare_doubles(lats[1130], -68.949618, tolerance);
-	compare_doubles(lats[1131], -69.090188, tolerance);
-	compare_doubles(lats[1132], -69.230758, tolerance);
-	compare_doubles(lats[1133], -69.371328, tolerance);
-	compare_doubles(lats[1134], -69.511898, tolerance);
-	compare_doubles(lats[1135], -69.652468, tolerance);
-	compare_doubles(lats[1136], -69.793038, tolerance);
-	compare_doubles(lats[1137], -69.933608, tolerance);
-	compare_doubles(lats[1138], -70.074178, tolerance);
-	compare_doubles(lats[1139], -70.214748, tolerance);
-	compare_doubles(lats[1140], -70.355318, tolerance);
-	compare_doubles(lats[1141], -70.495888, tolerance);
-	compare_doubles(lats[1142], -70.636458, tolerance);
-	compare_doubles(lats[1143], -70.777028, tolerance);
-	compare_doubles(lats[1144], -70.917598, tolerance);
-	compare_doubles(lats[1145], -71.058168, tolerance);
-	compare_doubles(lats[1146], -71.198738, tolerance);
-	compare_doubles(lats[1147], -71.339308, tolerance);
-	compare_doubles(lats[1148], -71.479878, tolerance);
-	compare_doubles(lats[1149], -71.620448, tolerance);
-	compare_doubles(lats[1150], -71.761018, tolerance);
-	compare_doubles(lats[1151], -71.901588, tolerance);
-	compare_doubles(lats[1152], -72.042158, tolerance);
-	compare_doubles(lats[1153], -72.182728, tolerance);
-	compare_doubles(lats[1154], -72.323298, tolerance);
-	compare_doubles(lats[1155], -72.463867, tolerance);
-	compare_doubles(lats[1156], -72.604437, tolerance);
-	compare_doubles(lats[1157], -72.745007, tolerance);
-	compare_doubles(lats[1158], -72.885577, tolerance);
-	compare_doubles(lats[1159], -73.026147, tolerance);
-	compare_doubles(lats[1160], -73.166717, tolerance);
-	compare_doubles(lats[1161], -73.307287, tolerance);
-	compare_doubles(lats[1162], -73.447857, tolerance);
-	compare_doubles(lats[1163], -73.588427, tolerance);
-	compare_doubles(lats[1164], -73.728997, tolerance);
-	compare_doubles(lats[1165], -73.869567, tolerance);
-	compare_doubles(lats[1166], -74.010137, tolerance);
-	compare_doubles(lats[1167], -74.150707, tolerance);
-	compare_doubles(lats[1168], -74.291277, tolerance);
-	compare_doubles(lats[1169], -74.431847, tolerance);
-	compare_doubles(lats[1170], -74.572417, tolerance);
-	compare_doubles(lats[1171], -74.712987, tolerance);
-	compare_doubles(lats[1172], -74.853557, tolerance);
-	compare_doubles(lats[1173], -74.994127, tolerance);
-	compare_doubles(lats[1174], -75.134697, tolerance);
-	compare_doubles(lats[1175], -75.275266, tolerance);
-	compare_doubles(lats[1176], -75.415836, tolerance);
-	compare_doubles(lats[1177], -75.556406, tolerance);
-	compare_doubles(lats[1178], -75.696976, tolerance);
-	compare_doubles(lats[1179], -75.837546, tolerance);
-	compare_doubles(lats[1180], -75.978116, tolerance);
-	compare_doubles(lats[1181], -76.118686, tolerance);
-	compare_doubles(lats[1182], -76.259256, tolerance);
-	compare_doubles(lats[1183], -76.399826, tolerance);
-	compare_doubles(lats[1184], -76.540396, tolerance);
-	compare_doubles(lats[1185], -76.680966, tolerance);
-	compare_doubles(lats[1186], -76.821535, tolerance);
-	compare_doubles(lats[1187], -76.962105, tolerance);
-	compare_doubles(lats[1188], -77.102675, tolerance);
-	compare_doubles(lats[1189], -77.243245, tolerance);
-	compare_doubles(lats[1190], -77.383815, tolerance);
-	compare_doubles(lats[1191], -77.524385, tolerance);
-	compare_doubles(lats[1192], -77.664955, tolerance);
-	compare_doubles(lats[1193], -77.805524, tolerance);
-	compare_doubles(lats[1194], -77.946094, tolerance);
-	compare_doubles(lats[1195], -78.086664, tolerance);
-	compare_doubles(lats[1196], -78.227234, tolerance);
-	compare_doubles(lats[1197], -78.367804, tolerance);
-	compare_doubles(lats[1198], -78.508374, tolerance);
-	compare_doubles(lats[1199], -78.648943, tolerance);
-	compare_doubles(lats[1200], -78.789513, tolerance);
-	compare_doubles(lats[1201], -78.930083, tolerance);
-	compare_doubles(lats[1202], -79.070653, tolerance);
-	compare_doubles(lats[1203], -79.211223, tolerance);
-	compare_doubles(lats[1204], -79.351792, tolerance);
-	compare_doubles(lats[1205], -79.492362, tolerance);
-	compare_doubles(lats[1206], -79.632932, tolerance);
-	compare_doubles(lats[1207], -79.773502, tolerance);
-	compare_doubles(lats[1208], -79.914072, tolerance);
-	compare_doubles(lats[1209], -80.054641, tolerance);
-	compare_doubles(lats[1210], -80.195211, tolerance);
-	compare_doubles(lats[1211], -80.335781, tolerance);
-	compare_doubles(lats[1212], -80.476350, tolerance);
-	compare_doubles(lats[1213], -80.616920, tolerance);
-	compare_doubles(lats[1214], -80.757490, tolerance);
-	compare_doubles(lats[1215], -80.898059, tolerance);
-	compare_doubles(lats[1216], -81.038629, tolerance);
-	compare_doubles(lats[1217], -81.179199, tolerance);
-	compare_doubles(lats[1218], -81.319768, tolerance);
-	compare_doubles(lats[1219], -81.460338, tolerance);
-	compare_doubles(lats[1220], -81.600908, tolerance);
-	compare_doubles(lats[1221], -81.741477, tolerance);
-	compare_doubles(lats[1222], -81.882047, tolerance);
-	compare_doubles(lats[1223], -82.022616, tolerance);
-	compare_doubles(lats[1224], -82.163186, tolerance);
-	compare_doubles(lats[1225], -82.303755, tolerance);
-	compare_doubles(lats[1226], -82.444325, tolerance);
-	compare_doubles(lats[1227], -82.584894, tolerance);
-	compare_doubles(lats[1228], -82.725464, tolerance);
-	compare_doubles(lats[1229], -82.866033, tolerance);
-	compare_doubles(lats[1230], -83.006602, tolerance);
-	compare_doubles(lats[1231], -83.147172, tolerance);
-	compare_doubles(lats[1232], -83.287741, tolerance);
-	compare_doubles(lats[1233], -83.428310, tolerance);
-	compare_doubles(lats[1234], -83.568880, tolerance);
-	compare_doubles(lats[1235], -83.709449, tolerance);
-	compare_doubles(lats[1236], -83.850018, tolerance);
-	compare_doubles(lats[1237], -83.990587, tolerance);
-	compare_doubles(lats[1238], -84.131156, tolerance);
-	compare_doubles(lats[1239], -84.271725, tolerance);
-	compare_doubles(lats[1240], -84.412294, tolerance);
-	compare_doubles(lats[1241], -84.552863, tolerance);
-	compare_doubles(lats[1242], -84.693432, tolerance);
-	compare_doubles(lats[1243], -84.834001, tolerance);
-	compare_doubles(lats[1244], -84.974570, tolerance);
-	compare_doubles(lats[1245], -85.115138, tolerance);
-	compare_doubles(lats[1246], -85.255707, tolerance);
-	compare_doubles(lats[1247], -85.396275, tolerance);
-	compare_doubles(lats[1248], -85.536844, tolerance);
-	compare_doubles(lats[1249], -85.677412, tolerance);
-	compare_doubles(lats[1250], -85.817980, tolerance);
-	compare_doubles(lats[1251], -85.958548, tolerance);
-	compare_doubles(lats[1252], -86.099116, tolerance);
-	compare_doubles(lats[1253], -86.239684, tolerance);
-	compare_doubles(lats[1254], -86.380251, tolerance);
-	compare_doubles(lats[1255], -86.520818, tolerance);
-	compare_doubles(lats[1256], -86.661385, tolerance);
-	compare_doubles(lats[1257], -86.801952, tolerance);
-	compare_doubles(lats[1258], -86.942519, tolerance);
-	compare_doubles(lats[1259], -87.083085, tolerance);
-	compare_doubles(lats[1260], -87.223651, tolerance);
-	compare_doubles(lats[1261], -87.364216, tolerance);
-	compare_doubles(lats[1262], -87.504781, tolerance);
-	compare_doubles(lats[1263], -87.645345, tolerance);
-	compare_doubles(lats[1264], -87.785908, tolerance);
-	compare_doubles(lats[1265], -87.926471, tolerance);
-	compare_doubles(lats[1266], -88.067032, tolerance);
-	compare_doubles(lats[1267], -88.207592, tolerance);
-	compare_doubles(lats[1268], -88.348150, tolerance);
-	compare_doubles(lats[1269], -88.488706, tolerance);
-	compare_doubles(lats[1270], -88.629259, tolerance);
-	compare_doubles(lats[1271], -88.769808, tolerance);
-	compare_doubles(lats[1272], -88.910352, tolerance);
-	compare_doubles(lats[1273], -89.050889, tolerance);
-	compare_doubles(lats[1274], -89.191413, tolerance);
-	compare_doubles(lats[1275], -89.331918, tolerance);
-	compare_doubles(lats[1276], -89.472390, tolerance);
-	compare_doubles(lats[1277], -89.612790, tolerance);
-	compare_doubles(lats[1278], -89.753005, tolerance);
-	compare_doubles(lats[1279], -89.892396, tolerance);
+    compare_doubles(lats[0], 89.892396, tolerance);
+    compare_doubles(lats[1], 89.753005, tolerance);
+    compare_doubles(lats[2], 89.612790, tolerance);
+    compare_doubles(lats[3], 89.472390, tolerance);
+    compare_doubles(lats[4], 89.331918, tolerance);
+    compare_doubles(lats[5], 89.191413, tolerance);
+    compare_doubles(lats[6], 89.050889, tolerance);
+    compare_doubles(lats[7], 88.910352, tolerance);
+    compare_doubles(lats[8], 88.769808, tolerance);
+    compare_doubles(lats[9], 88.629259, tolerance);
+    compare_doubles(lats[10], 88.488706, tolerance);
+    compare_doubles(lats[11], 88.348150, tolerance);
+    compare_doubles(lats[12], 88.207592, tolerance);
+    compare_doubles(lats[13], 88.067032, tolerance);
+    compare_doubles(lats[14], 87.926471, tolerance);
+    compare_doubles(lats[15], 87.785908, tolerance);
+    compare_doubles(lats[16], 87.645345, tolerance);
+    compare_doubles(lats[17], 87.504781, tolerance);
+    compare_doubles(lats[18], 87.364216, tolerance);
+    compare_doubles(lats[19], 87.223651, tolerance);
+    compare_doubles(lats[20], 87.083085, tolerance);
+    compare_doubles(lats[21], 86.942519, tolerance);
+    compare_doubles(lats[22], 86.801952, tolerance);
+    compare_doubles(lats[23], 86.661385, tolerance);
+    compare_doubles(lats[24], 86.520818, tolerance);
+    compare_doubles(lats[25], 86.380251, tolerance);
+    compare_doubles(lats[26], 86.239684, tolerance);
+    compare_doubles(lats[27], 86.099116, tolerance);
+    compare_doubles(lats[28], 85.958548, tolerance);
+    compare_doubles(lats[29], 85.817980, tolerance);
+    compare_doubles(lats[30], 85.677412, tolerance);
+    compare_doubles(lats[31], 85.536844, tolerance);
+    compare_doubles(lats[32], 85.396275, tolerance);
+    compare_doubles(lats[33], 85.255707, tolerance);
+    compare_doubles(lats[34], 85.115138, tolerance);
+    compare_doubles(lats[35], 84.974570, tolerance);
+    compare_doubles(lats[36], 84.834001, tolerance);
+    compare_doubles(lats[37], 84.693432, tolerance);
+    compare_doubles(lats[38], 84.552863, tolerance);
+    compare_doubles(lats[39], 84.412294, tolerance);
+    compare_doubles(lats[40], 84.271725, tolerance);
+    compare_doubles(lats[41], 84.131156, tolerance);
+    compare_doubles(lats[42], 83.990587, tolerance);
+    compare_doubles(lats[43], 83.850018, tolerance);
+    compare_doubles(lats[44], 83.709449, tolerance);
+    compare_doubles(lats[45], 83.568880, tolerance);
+    compare_doubles(lats[46], 83.428310, tolerance);
+    compare_doubles(lats[47], 83.287741, tolerance);
+    compare_doubles(lats[48], 83.147172, tolerance);
+    compare_doubles(lats[49], 83.006602, tolerance);
+    compare_doubles(lats[50], 82.866033, tolerance);
+    compare_doubles(lats[51], 82.725464, tolerance);
+    compare_doubles(lats[52], 82.584894, tolerance);
+    compare_doubles(lats[53], 82.444325, tolerance);
+    compare_doubles(lats[54], 82.303755, tolerance);
+    compare_doubles(lats[55], 82.163186, tolerance);
+    compare_doubles(lats[56], 82.022616, tolerance);
+    compare_doubles(lats[57], 81.882047, tolerance);
+    compare_doubles(lats[58], 81.741477, tolerance);
+    compare_doubles(lats[59], 81.600908, tolerance);
+    compare_doubles(lats[60], 81.460338, tolerance);
+    compare_doubles(lats[61], 81.319768, tolerance);
+    compare_doubles(lats[62], 81.179199, tolerance);
+    compare_doubles(lats[63], 81.038629, tolerance);
+    compare_doubles(lats[64], 80.898059, tolerance);
+    compare_doubles(lats[65], 80.757490, tolerance);
+    compare_doubles(lats[66], 80.616920, tolerance);
+    compare_doubles(lats[67], 80.476350, tolerance);
+    compare_doubles(lats[68], 80.335781, tolerance);
+    compare_doubles(lats[69], 80.195211, tolerance);
+    compare_doubles(lats[70], 80.054641, tolerance);
+    compare_doubles(lats[71], 79.914072, tolerance);
+    compare_doubles(lats[72], 79.773502, tolerance);
+    compare_doubles(lats[73], 79.632932, tolerance);
+    compare_doubles(lats[74], 79.492362, tolerance);
+    compare_doubles(lats[75], 79.351792, tolerance);
+    compare_doubles(lats[76], 79.211223, tolerance);
+    compare_doubles(lats[77], 79.070653, tolerance);
+    compare_doubles(lats[78], 78.930083, tolerance);
+    compare_doubles(lats[79], 78.789513, tolerance);
+    compare_doubles(lats[80], 78.648943, tolerance);
+    compare_doubles(lats[81], 78.508374, tolerance);
+    compare_doubles(lats[82], 78.367804, tolerance);
+    compare_doubles(lats[83], 78.227234, tolerance);
+    compare_doubles(lats[84], 78.086664, tolerance);
+    compare_doubles(lats[85], 77.946094, tolerance);
+    compare_doubles(lats[86], 77.805524, tolerance);
+    compare_doubles(lats[87], 77.664955, tolerance);
+    compare_doubles(lats[88], 77.524385, tolerance);
+    compare_doubles(lats[89], 77.383815, tolerance);
+    compare_doubles(lats[90], 77.243245, tolerance);
+    compare_doubles(lats[91], 77.102675, tolerance);
+    compare_doubles(lats[92], 76.962105, tolerance);
+    compare_doubles(lats[93], 76.821535, tolerance);
+    compare_doubles(lats[94], 76.680966, tolerance);
+    compare_doubles(lats[95], 76.540396, tolerance);
+    compare_doubles(lats[96], 76.399826, tolerance);
+    compare_doubles(lats[97], 76.259256, tolerance);
+    compare_doubles(lats[98], 76.118686, tolerance);
+    compare_doubles(lats[99], 75.978116, tolerance);
+    compare_doubles(lats[100], 75.837546, tolerance);
+    compare_doubles(lats[101], 75.696976, tolerance);
+    compare_doubles(lats[102], 75.556406, tolerance);
+    compare_doubles(lats[103], 75.415836, tolerance);
+    compare_doubles(lats[104], 75.275266, tolerance);
+    compare_doubles(lats[105], 75.134697, tolerance);
+    compare_doubles(lats[106], 74.994127, tolerance);
+    compare_doubles(lats[107], 74.853557, tolerance);
+    compare_doubles(lats[108], 74.712987, tolerance);
+    compare_doubles(lats[109], 74.572417, tolerance);
+    compare_doubles(lats[110], 74.431847, tolerance);
+    compare_doubles(lats[111], 74.291277, tolerance);
+    compare_doubles(lats[112], 74.150707, tolerance);
+    compare_doubles(lats[113], 74.010137, tolerance);
+    compare_doubles(lats[114], 73.869567, tolerance);
+    compare_doubles(lats[115], 73.728997, tolerance);
+    compare_doubles(lats[116], 73.588427, tolerance);
+    compare_doubles(lats[117], 73.447857, tolerance);
+    compare_doubles(lats[118], 73.307287, tolerance);
+    compare_doubles(lats[119], 73.166717, tolerance);
+    compare_doubles(lats[120], 73.026147, tolerance);
+    compare_doubles(lats[121], 72.885577, tolerance);
+    compare_doubles(lats[122], 72.745007, tolerance);
+    compare_doubles(lats[123], 72.604437, tolerance);
+    compare_doubles(lats[124], 72.463867, tolerance);
+    compare_doubles(lats[125], 72.323298, tolerance);
+    compare_doubles(lats[126], 72.182728, tolerance);
+    compare_doubles(lats[127], 72.042158, tolerance);
+    compare_doubles(lats[128], 71.901588, tolerance);
+    compare_doubles(lats[129], 71.761018, tolerance);
+    compare_doubles(lats[130], 71.620448, tolerance);
+    compare_doubles(lats[131], 71.479878, tolerance);
+    compare_doubles(lats[132], 71.339308, tolerance);
+    compare_doubles(lats[133], 71.198738, tolerance);
+    compare_doubles(lats[134], 71.058168, tolerance);
+    compare_doubles(lats[135], 70.917598, tolerance);
+    compare_doubles(lats[136], 70.777028, tolerance);
+    compare_doubles(lats[137], 70.636458, tolerance);
+    compare_doubles(lats[138], 70.495888, tolerance);
+    compare_doubles(lats[139], 70.355318, tolerance);
+    compare_doubles(lats[140], 70.214748, tolerance);
+    compare_doubles(lats[141], 70.074178, tolerance);
+    compare_doubles(lats[142], 69.933608, tolerance);
+    compare_doubles(lats[143], 69.793038, tolerance);
+    compare_doubles(lats[144], 69.652468, tolerance);
+    compare_doubles(lats[145], 69.511898, tolerance);
+    compare_doubles(lats[146], 69.371328, tolerance);
+    compare_doubles(lats[147], 69.230758, tolerance);
+    compare_doubles(lats[148], 69.090188, tolerance);
+    compare_doubles(lats[149], 68.949618, tolerance);
+    compare_doubles(lats[150], 68.809048, tolerance);
+    compare_doubles(lats[151], 68.668478, tolerance);
+    compare_doubles(lats[152], 68.527908, tolerance);
+    compare_doubles(lats[153], 68.387338, tolerance);
+    compare_doubles(lats[154], 68.246768, tolerance);
+    compare_doubles(lats[155], 68.106198, tolerance);
+    compare_doubles(lats[156], 67.965628, tolerance);
+    compare_doubles(lats[157], 67.825058, tolerance);
+    compare_doubles(lats[158], 67.684488, tolerance);
+    compare_doubles(lats[159], 67.543918, tolerance);
+    compare_doubles(lats[160], 67.403348, tolerance);
+    compare_doubles(lats[161], 67.262778, tolerance);
+    compare_doubles(lats[162], 67.122208, tolerance);
+    compare_doubles(lats[163], 66.981638, tolerance);
+    compare_doubles(lats[164], 66.841067, tolerance);
+    compare_doubles(lats[165], 66.700497, tolerance);
+    compare_doubles(lats[166], 66.559927, tolerance);
+    compare_doubles(lats[167], 66.419357, tolerance);
+    compare_doubles(lats[168], 66.278787, tolerance);
+    compare_doubles(lats[169], 66.138217, tolerance);
+    compare_doubles(lats[170], 65.997647, tolerance);
+    compare_doubles(lats[171], 65.857077, tolerance);
+    compare_doubles(lats[172], 65.716507, tolerance);
+    compare_doubles(lats[173], 65.575937, tolerance);
+    compare_doubles(lats[174], 65.435367, tolerance);
+    compare_doubles(lats[175], 65.294797, tolerance);
+    compare_doubles(lats[176], 65.154227, tolerance);
+    compare_doubles(lats[177], 65.013657, tolerance);
+    compare_doubles(lats[178], 64.873087, tolerance);
+    compare_doubles(lats[179], 64.732517, tolerance);
+    compare_doubles(lats[180], 64.591947, tolerance);
+    compare_doubles(lats[181], 64.451377, tolerance);
+    compare_doubles(lats[182], 64.310807, tolerance);
+    compare_doubles(lats[183], 64.170237, tolerance);
+    compare_doubles(lats[184], 64.029667, tolerance);
+    compare_doubles(lats[185], 63.889097, tolerance);
+    compare_doubles(lats[186], 63.748527, tolerance);
+    compare_doubles(lats[187], 63.607957, tolerance);
+    compare_doubles(lats[188], 63.467387, tolerance);
+    compare_doubles(lats[189], 63.326817, tolerance);
+    compare_doubles(lats[190], 63.186247, tolerance);
+    compare_doubles(lats[191], 63.045677, tolerance);
+    compare_doubles(lats[192], 62.905107, tolerance);
+    compare_doubles(lats[193], 62.764537, tolerance);
+    compare_doubles(lats[194], 62.623967, tolerance);
+    compare_doubles(lats[195], 62.483397, tolerance);
+    compare_doubles(lats[196], 62.342826, tolerance);
+    compare_doubles(lats[197], 62.202256, tolerance);
+    compare_doubles(lats[198], 62.061686, tolerance);
+    compare_doubles(lats[199], 61.921116, tolerance);
+    compare_doubles(lats[200], 61.780546, tolerance);
+    compare_doubles(lats[201], 61.639976, tolerance);
+    compare_doubles(lats[202], 61.499406, tolerance);
+    compare_doubles(lats[203], 61.358836, tolerance);
+    compare_doubles(lats[204], 61.218266, tolerance);
+    compare_doubles(lats[205], 61.077696, tolerance);
+    compare_doubles(lats[206], 60.937126, tolerance);
+    compare_doubles(lats[207], 60.796556, tolerance);
+    compare_doubles(lats[208], 60.655986, tolerance);
+    compare_doubles(lats[209], 60.515416, tolerance);
+    compare_doubles(lats[210], 60.374846, tolerance);
+    compare_doubles(lats[211], 60.234276, tolerance);
+    compare_doubles(lats[212], 60.093706, tolerance);
+    compare_doubles(lats[213], 59.953136, tolerance);
+    compare_doubles(lats[214], 59.812566, tolerance);
+    compare_doubles(lats[215], 59.671996, tolerance);
+    compare_doubles(lats[216], 59.531426, tolerance);
+    compare_doubles(lats[217], 59.390856, tolerance);
+    compare_doubles(lats[218], 59.250286, tolerance);
+    compare_doubles(lats[219], 59.109715, tolerance);
+    compare_doubles(lats[220], 58.969145, tolerance);
+    compare_doubles(lats[221], 58.828575, tolerance);
+    compare_doubles(lats[222], 58.688005, tolerance);
+    compare_doubles(lats[223], 58.547435, tolerance);
+    compare_doubles(lats[224], 58.406865, tolerance);
+    compare_doubles(lats[225], 58.266295, tolerance);
+    compare_doubles(lats[226], 58.125725, tolerance);
+    compare_doubles(lats[227], 57.985155, tolerance);
+    compare_doubles(lats[228], 57.844585, tolerance);
+    compare_doubles(lats[229], 57.704015, tolerance);
+    compare_doubles(lats[230], 57.563445, tolerance);
+    compare_doubles(lats[231], 57.422875, tolerance);
+    compare_doubles(lats[232], 57.282305, tolerance);
+    compare_doubles(lats[233], 57.141735, tolerance);
+    compare_doubles(lats[234], 57.001165, tolerance);
+    compare_doubles(lats[235], 56.860595, tolerance);
+    compare_doubles(lats[236], 56.720025, tolerance);
+    compare_doubles(lats[237], 56.579455, tolerance);
+    compare_doubles(lats[238], 56.438884, tolerance);
+    compare_doubles(lats[239], 56.298314, tolerance);
+    compare_doubles(lats[240], 56.157744, tolerance);
+    compare_doubles(lats[241], 56.017174, tolerance);
+    compare_doubles(lats[242], 55.876604, tolerance);
+    compare_doubles(lats[243], 55.736034, tolerance);
+    compare_doubles(lats[244], 55.595464, tolerance);
+    compare_doubles(lats[245], 55.454894, tolerance);
+    compare_doubles(lats[246], 55.314324, tolerance);
+    compare_doubles(lats[247], 55.173754, tolerance);
+    compare_doubles(lats[248], 55.033184, tolerance);
+    compare_doubles(lats[249], 54.892614, tolerance);
+    compare_doubles(lats[250], 54.752044, tolerance);
+    compare_doubles(lats[251], 54.611474, tolerance);
+    compare_doubles(lats[252], 54.470904, tolerance);
+    compare_doubles(lats[253], 54.330334, tolerance);
+    compare_doubles(lats[254], 54.189764, tolerance);
+    compare_doubles(lats[255], 54.049194, tolerance);
+    compare_doubles(lats[256], 53.908623, tolerance);
+    compare_doubles(lats[257], 53.768053, tolerance);
+    compare_doubles(lats[258], 53.627483, tolerance);
+    compare_doubles(lats[259], 53.486913, tolerance);
+    compare_doubles(lats[260], 53.346343, tolerance);
+    compare_doubles(lats[261], 53.205773, tolerance);
+    compare_doubles(lats[262], 53.065203, tolerance);
+    compare_doubles(lats[263], 52.924633, tolerance);
+    compare_doubles(lats[264], 52.784063, tolerance);
+    compare_doubles(lats[265], 52.643493, tolerance);
+    compare_doubles(lats[266], 52.502923, tolerance);
+    compare_doubles(lats[267], 52.362353, tolerance);
+    compare_doubles(lats[268], 52.221783, tolerance);
+    compare_doubles(lats[269], 52.081213, tolerance);
+    compare_doubles(lats[270], 51.940643, tolerance);
+    compare_doubles(lats[271], 51.800073, tolerance);
+    compare_doubles(lats[272], 51.659502, tolerance);
+    compare_doubles(lats[273], 51.518932, tolerance);
+    compare_doubles(lats[274], 51.378362, tolerance);
+    compare_doubles(lats[275], 51.237792, tolerance);
+    compare_doubles(lats[276], 51.097222, tolerance);
+    compare_doubles(lats[277], 50.956652, tolerance);
+    compare_doubles(lats[278], 50.816082, tolerance);
+    compare_doubles(lats[279], 50.675512, tolerance);
+    compare_doubles(lats[280], 50.534942, tolerance);
+    compare_doubles(lats[281], 50.394372, tolerance);
+    compare_doubles(lats[282], 50.253802, tolerance);
+    compare_doubles(lats[283], 50.113232, tolerance);
+    compare_doubles(lats[284], 49.972662, tolerance);
+    compare_doubles(lats[285], 49.832092, tolerance);
+    compare_doubles(lats[286], 49.691522, tolerance);
+    compare_doubles(lats[287], 49.550952, tolerance);
+    compare_doubles(lats[288], 49.410381, tolerance);
+    compare_doubles(lats[289], 49.269811, tolerance);
+    compare_doubles(lats[290], 49.129241, tolerance);
+    compare_doubles(lats[291], 48.988671, tolerance);
+    compare_doubles(lats[292], 48.848101, tolerance);
+    compare_doubles(lats[293], 48.707531, tolerance);
+    compare_doubles(lats[294], 48.566961, tolerance);
+    compare_doubles(lats[295], 48.426391, tolerance);
+    compare_doubles(lats[296], 48.285821, tolerance);
+    compare_doubles(lats[297], 48.145251, tolerance);
+    compare_doubles(lats[298], 48.004681, tolerance);
+    compare_doubles(lats[299], 47.864111, tolerance);
+    compare_doubles(lats[300], 47.723541, tolerance);
+    compare_doubles(lats[301], 47.582971, tolerance);
+    compare_doubles(lats[302], 47.442401, tolerance);
+    compare_doubles(lats[303], 47.301830, tolerance);
+    compare_doubles(lats[304], 47.161260, tolerance);
+    compare_doubles(lats[305], 47.020690, tolerance);
+    compare_doubles(lats[306], 46.880120, tolerance);
+    compare_doubles(lats[307], 46.739550, tolerance);
+    compare_doubles(lats[308], 46.598980, tolerance);
+    compare_doubles(lats[309], 46.458410, tolerance);
+    compare_doubles(lats[310], 46.317840, tolerance);
+    compare_doubles(lats[311], 46.177270, tolerance);
+    compare_doubles(lats[312], 46.036700, tolerance);
+    compare_doubles(lats[313], 45.896130, tolerance);
+    compare_doubles(lats[314], 45.755560, tolerance);
+    compare_doubles(lats[315], 45.614990, tolerance);
+    compare_doubles(lats[316], 45.474420, tolerance);
+    compare_doubles(lats[317], 45.333850, tolerance);
+    compare_doubles(lats[318], 45.193279, tolerance);
+    compare_doubles(lats[319], 45.052709, tolerance);
+    compare_doubles(lats[320], 44.912139, tolerance);
+    compare_doubles(lats[321], 44.771569, tolerance);
+    compare_doubles(lats[322], 44.630999, tolerance);
+    compare_doubles(lats[323], 44.490429, tolerance);
+    compare_doubles(lats[324], 44.349859, tolerance);
+    compare_doubles(lats[325], 44.209289, tolerance);
+    compare_doubles(lats[326], 44.068719, tolerance);
+    compare_doubles(lats[327], 43.928149, tolerance);
+    compare_doubles(lats[328], 43.787579, tolerance);
+    compare_doubles(lats[329], 43.647009, tolerance);
+    compare_doubles(lats[330], 43.506439, tolerance);
+    compare_doubles(lats[331], 43.365869, tolerance);
+    compare_doubles(lats[332], 43.225299, tolerance);
+    compare_doubles(lats[333], 43.084728, tolerance);
+    compare_doubles(lats[334], 42.944158, tolerance);
+    compare_doubles(lats[335], 42.803588, tolerance);
+    compare_doubles(lats[336], 42.663018, tolerance);
+    compare_doubles(lats[337], 42.522448, tolerance);
+    compare_doubles(lats[338], 42.381878, tolerance);
+    compare_doubles(lats[339], 42.241308, tolerance);
+    compare_doubles(lats[340], 42.100738, tolerance);
+    compare_doubles(lats[341], 41.960168, tolerance);
+    compare_doubles(lats[342], 41.819598, tolerance);
+    compare_doubles(lats[343], 41.679028, tolerance);
+    compare_doubles(lats[344], 41.538458, tolerance);
+    compare_doubles(lats[345], 41.397888, tolerance);
+    compare_doubles(lats[346], 41.257318, tolerance);
+    compare_doubles(lats[347], 41.116747, tolerance);
+    compare_doubles(lats[348], 40.976177, tolerance);
+    compare_doubles(lats[349], 40.835607, tolerance);
+    compare_doubles(lats[350], 40.695037, tolerance);
+    compare_doubles(lats[351], 40.554467, tolerance);
+    compare_doubles(lats[352], 40.413897, tolerance);
+    compare_doubles(lats[353], 40.273327, tolerance);
+    compare_doubles(lats[354], 40.132757, tolerance);
+    compare_doubles(lats[355], 39.992187, tolerance);
+    compare_doubles(lats[356], 39.851617, tolerance);
+    compare_doubles(lats[357], 39.711047, tolerance);
+    compare_doubles(lats[358], 39.570477, tolerance);
+    compare_doubles(lats[359], 39.429907, tolerance);
+    compare_doubles(lats[360], 39.289337, tolerance);
+    compare_doubles(lats[361], 39.148766, tolerance);
+    compare_doubles(lats[362], 39.008196, tolerance);
+    compare_doubles(lats[363], 38.867626, tolerance);
+    compare_doubles(lats[364], 38.727056, tolerance);
+    compare_doubles(lats[365], 38.586486, tolerance);
+    compare_doubles(lats[366], 38.445916, tolerance);
+    compare_doubles(lats[367], 38.305346, tolerance);
+    compare_doubles(lats[368], 38.164776, tolerance);
+    compare_doubles(lats[369], 38.024206, tolerance);
+    compare_doubles(lats[370], 37.883636, tolerance);
+    compare_doubles(lats[371], 37.743066, tolerance);
+    compare_doubles(lats[372], 37.602496, tolerance);
+    compare_doubles(lats[373], 37.461926, tolerance);
+    compare_doubles(lats[374], 37.321356, tolerance);
+    compare_doubles(lats[375], 37.180785, tolerance);
+    compare_doubles(lats[376], 37.040215, tolerance);
+    compare_doubles(lats[377], 36.899645, tolerance);
+    compare_doubles(lats[378], 36.759075, tolerance);
+    compare_doubles(lats[379], 36.618505, tolerance);
+    compare_doubles(lats[380], 36.477935, tolerance);
+    compare_doubles(lats[381], 36.337365, tolerance);
+    compare_doubles(lats[382], 36.196795, tolerance);
+    compare_doubles(lats[383], 36.056225, tolerance);
+    compare_doubles(lats[384], 35.915655, tolerance);
+    compare_doubles(lats[385], 35.775085, tolerance);
+    compare_doubles(lats[386], 35.634515, tolerance);
+    compare_doubles(lats[387], 35.493945, tolerance);
+    compare_doubles(lats[388], 35.353374, tolerance);
+    compare_doubles(lats[389], 35.212804, tolerance);
+    compare_doubles(lats[390], 35.072234, tolerance);
+    compare_doubles(lats[391], 34.931664, tolerance);
+    compare_doubles(lats[392], 34.791094, tolerance);
+    compare_doubles(lats[393], 34.650524, tolerance);
+    compare_doubles(lats[394], 34.509954, tolerance);
+    compare_doubles(lats[395], 34.369384, tolerance);
+    compare_doubles(lats[396], 34.228814, tolerance);
+    compare_doubles(lats[397], 34.088244, tolerance);
+    compare_doubles(lats[398], 33.947674, tolerance);
+    compare_doubles(lats[399], 33.807104, tolerance);
+    compare_doubles(lats[400], 33.666534, tolerance);
+    compare_doubles(lats[401], 33.525964, tolerance);
+    compare_doubles(lats[402], 33.385393, tolerance);
+    compare_doubles(lats[403], 33.244823, tolerance);
+    compare_doubles(lats[404], 33.104253, tolerance);
+    compare_doubles(lats[405], 32.963683, tolerance);
+    compare_doubles(lats[406], 32.823113, tolerance);
+    compare_doubles(lats[407], 32.682543, tolerance);
+    compare_doubles(lats[408], 32.541973, tolerance);
+    compare_doubles(lats[409], 32.401403, tolerance);
+    compare_doubles(lats[410], 32.260833, tolerance);
+    compare_doubles(lats[411], 32.120263, tolerance);
+    compare_doubles(lats[412], 31.979693, tolerance);
+    compare_doubles(lats[413], 31.839123, tolerance);
+    compare_doubles(lats[414], 31.698553, tolerance);
+    compare_doubles(lats[415], 31.557982, tolerance);
+    compare_doubles(lats[416], 31.417412, tolerance);
+    compare_doubles(lats[417], 31.276842, tolerance);
+    compare_doubles(lats[418], 31.136272, tolerance);
+    compare_doubles(lats[419], 30.995702, tolerance);
+    compare_doubles(lats[420], 30.855132, tolerance);
+    compare_doubles(lats[421], 30.714562, tolerance);
+    compare_doubles(lats[422], 30.573992, tolerance);
+    compare_doubles(lats[423], 30.433422, tolerance);
+    compare_doubles(lats[424], 30.292852, tolerance);
+    compare_doubles(lats[425], 30.152282, tolerance);
+    compare_doubles(lats[426], 30.011712, tolerance);
+    compare_doubles(lats[427], 29.871142, tolerance);
+    compare_doubles(lats[428], 29.730572, tolerance);
+    compare_doubles(lats[429], 29.590001, tolerance);
+    compare_doubles(lats[430], 29.449431, tolerance);
+    compare_doubles(lats[431], 29.308861, tolerance);
+    compare_doubles(lats[432], 29.168291, tolerance);
+    compare_doubles(lats[433], 29.027721, tolerance);
+    compare_doubles(lats[434], 28.887151, tolerance);
+    compare_doubles(lats[435], 28.746581, tolerance);
+    compare_doubles(lats[436], 28.606011, tolerance);
+    compare_doubles(lats[437], 28.465441, tolerance);
+    compare_doubles(lats[438], 28.324871, tolerance);
+    compare_doubles(lats[439], 28.184301, tolerance);
+    compare_doubles(lats[440], 28.043731, tolerance);
+    compare_doubles(lats[441], 27.903161, tolerance);
+    compare_doubles(lats[442], 27.762590, tolerance);
+    compare_doubles(lats[443], 27.622020, tolerance);
+    compare_doubles(lats[444], 27.481450, tolerance);
+    compare_doubles(lats[445], 27.340880, tolerance);
+    compare_doubles(lats[446], 27.200310, tolerance);
+    compare_doubles(lats[447], 27.059740, tolerance);
+    compare_doubles(lats[448], 26.919170, tolerance);
+    compare_doubles(lats[449], 26.778600, tolerance);
+    compare_doubles(lats[450], 26.638030, tolerance);
+    compare_doubles(lats[451], 26.497460, tolerance);
+    compare_doubles(lats[452], 26.356890, tolerance);
+    compare_doubles(lats[453], 26.216320, tolerance);
+    compare_doubles(lats[454], 26.075750, tolerance);
+    compare_doubles(lats[455], 25.935179, tolerance);
+    compare_doubles(lats[456], 25.794609, tolerance);
+    compare_doubles(lats[457], 25.654039, tolerance);
+    compare_doubles(lats[458], 25.513469, tolerance);
+    compare_doubles(lats[459], 25.372899, tolerance);
+    compare_doubles(lats[460], 25.232329, tolerance);
+    compare_doubles(lats[461], 25.091759, tolerance);
+    compare_doubles(lats[462], 24.951189, tolerance);
+    compare_doubles(lats[463], 24.810619, tolerance);
+    compare_doubles(lats[464], 24.670049, tolerance);
+    compare_doubles(lats[465], 24.529479, tolerance);
+    compare_doubles(lats[466], 24.388909, tolerance);
+    compare_doubles(lats[467], 24.248339, tolerance);
+    compare_doubles(lats[468], 24.107768, tolerance);
+    compare_doubles(lats[469], 23.967198, tolerance);
+    compare_doubles(lats[470], 23.826628, tolerance);
+    compare_doubles(lats[471], 23.686058, tolerance);
+    compare_doubles(lats[472], 23.545488, tolerance);
+    compare_doubles(lats[473], 23.404918, tolerance);
+    compare_doubles(lats[474], 23.264348, tolerance);
+    compare_doubles(lats[475], 23.123778, tolerance);
+    compare_doubles(lats[476], 22.983208, tolerance);
+    compare_doubles(lats[477], 22.842638, tolerance);
+    compare_doubles(lats[478], 22.702068, tolerance);
+    compare_doubles(lats[479], 22.561498, tolerance);
+    compare_doubles(lats[480], 22.420928, tolerance);
+    compare_doubles(lats[481], 22.280357, tolerance);
+    compare_doubles(lats[482], 22.139787, tolerance);
+    compare_doubles(lats[483], 21.999217, tolerance);
+    compare_doubles(lats[484], 21.858647, tolerance);
+    compare_doubles(lats[485], 21.718077, tolerance);
+    compare_doubles(lats[486], 21.577507, tolerance);
+    compare_doubles(lats[487], 21.436937, tolerance);
+    compare_doubles(lats[488], 21.296367, tolerance);
+    compare_doubles(lats[489], 21.155797, tolerance);
+    compare_doubles(lats[490], 21.015227, tolerance);
+    compare_doubles(lats[491], 20.874657, tolerance);
+    compare_doubles(lats[492], 20.734087, tolerance);
+    compare_doubles(lats[493], 20.593517, tolerance);
+    compare_doubles(lats[494], 20.452946, tolerance);
+    compare_doubles(lats[495], 20.312376, tolerance);
+    compare_doubles(lats[496], 20.171806, tolerance);
+    compare_doubles(lats[497], 20.031236, tolerance);
+    compare_doubles(lats[498], 19.890666, tolerance);
+    compare_doubles(lats[499], 19.750096, tolerance);
+    compare_doubles(lats[500], 19.609526, tolerance);
+    compare_doubles(lats[501], 19.468956, tolerance);
+    compare_doubles(lats[502], 19.328386, tolerance);
+    compare_doubles(lats[503], 19.187816, tolerance);
+    compare_doubles(lats[504], 19.047246, tolerance);
+    compare_doubles(lats[505], 18.906676, tolerance);
+    compare_doubles(lats[506], 18.766106, tolerance);
+    compare_doubles(lats[507], 18.625535, tolerance);
+    compare_doubles(lats[508], 18.484965, tolerance);
+    compare_doubles(lats[509], 18.344395, tolerance);
+    compare_doubles(lats[510], 18.203825, tolerance);
+    compare_doubles(lats[511], 18.063255, tolerance);
+    compare_doubles(lats[512], 17.922685, tolerance);
+    compare_doubles(lats[513], 17.782115, tolerance);
+    compare_doubles(lats[514], 17.641545, tolerance);
+    compare_doubles(lats[515], 17.500975, tolerance);
+    compare_doubles(lats[516], 17.360405, tolerance);
+    compare_doubles(lats[517], 17.219835, tolerance);
+    compare_doubles(lats[518], 17.079265, tolerance);
+    compare_doubles(lats[519], 16.938694, tolerance);
+    compare_doubles(lats[520], 16.798124, tolerance);
+    compare_doubles(lats[521], 16.657554, tolerance);
+    compare_doubles(lats[522], 16.516984, tolerance);
+    compare_doubles(lats[523], 16.376414, tolerance);
+    compare_doubles(lats[524], 16.235844, tolerance);
+    compare_doubles(lats[525], 16.095274, tolerance);
+    compare_doubles(lats[526], 15.954704, tolerance);
+    compare_doubles(lats[527], 15.814134, tolerance);
+    compare_doubles(lats[528], 15.673564, tolerance);
+    compare_doubles(lats[529], 15.532994, tolerance);
+    compare_doubles(lats[530], 15.392424, tolerance);
+    compare_doubles(lats[531], 15.251854, tolerance);
+    compare_doubles(lats[532], 15.111283, tolerance);
+    compare_doubles(lats[533], 14.970713, tolerance);
+    compare_doubles(lats[534], 14.830143, tolerance);
+    compare_doubles(lats[535], 14.689573, tolerance);
+    compare_doubles(lats[536], 14.549003, tolerance);
+    compare_doubles(lats[537], 14.408433, tolerance);
+    compare_doubles(lats[538], 14.267863, tolerance);
+    compare_doubles(lats[539], 14.127293, tolerance);
+    compare_doubles(lats[540], 13.986723, tolerance);
+    compare_doubles(lats[541], 13.846153, tolerance);
+    compare_doubles(lats[542], 13.705583, tolerance);
+    compare_doubles(lats[543], 13.565013, tolerance);
+    compare_doubles(lats[544], 13.424443, tolerance);
+    compare_doubles(lats[545], 13.283872, tolerance);
+    compare_doubles(lats[546], 13.143302, tolerance);
+    compare_doubles(lats[547], 13.002732, tolerance);
+    compare_doubles(lats[548], 12.862162, tolerance);
+    compare_doubles(lats[549], 12.721592, tolerance);
+    compare_doubles(lats[550], 12.581022, tolerance);
+    compare_doubles(lats[551], 12.440452, tolerance);
+    compare_doubles(lats[552], 12.299882, tolerance);
+    compare_doubles(lats[553], 12.159312, tolerance);
+    compare_doubles(lats[554], 12.018742, tolerance);
+    compare_doubles(lats[555], 11.878172, tolerance);
+    compare_doubles(lats[556], 11.737602, tolerance);
+    compare_doubles(lats[557], 11.597032, tolerance);
+    compare_doubles(lats[558], 11.456461, tolerance);
+    compare_doubles(lats[559], 11.315891, tolerance);
+    compare_doubles(lats[560], 11.175321, tolerance);
+    compare_doubles(lats[561], 11.034751, tolerance);
+    compare_doubles(lats[562], 10.894181, tolerance);
+    compare_doubles(lats[563], 10.753611, tolerance);
+    compare_doubles(lats[564], 10.613041, tolerance);
+    compare_doubles(lats[565], 10.472471, tolerance);
+    compare_doubles(lats[566], 10.331901, tolerance);
+    compare_doubles(lats[567], 10.191331, tolerance);
+    compare_doubles(lats[568], 10.050761, tolerance);
+    compare_doubles(lats[569], 9.910191, tolerance);
+    compare_doubles(lats[570], 9.769620, tolerance);
+    compare_doubles(lats[571], 9.629050, tolerance);
+    compare_doubles(lats[572], 9.488480, tolerance);
+    compare_doubles(lats[573], 9.347910, tolerance);
+    compare_doubles(lats[574], 9.207340, tolerance);
+    compare_doubles(lats[575], 9.066770, tolerance);
+    compare_doubles(lats[576], 8.926200, tolerance);
+    compare_doubles(lats[577], 8.785630, tolerance);
+    compare_doubles(lats[578], 8.645060, tolerance);
+    compare_doubles(lats[579], 8.504490, tolerance);
+    compare_doubles(lats[580], 8.363920, tolerance);
+    compare_doubles(lats[581], 8.223350, tolerance);
+    compare_doubles(lats[582], 8.082780, tolerance);
+    compare_doubles(lats[583], 7.942209, tolerance);
+    compare_doubles(lats[584], 7.801639, tolerance);
+    compare_doubles(lats[585], 7.661069, tolerance);
+    compare_doubles(lats[586], 7.520499, tolerance);
+    compare_doubles(lats[587], 7.379929, tolerance);
+    compare_doubles(lats[588], 7.239359, tolerance);
+    compare_doubles(lats[589], 7.098789, tolerance);
+    compare_doubles(lats[590], 6.958219, tolerance);
+    compare_doubles(lats[591], 6.817649, tolerance);
+    compare_doubles(lats[592], 6.677079, tolerance);
+    compare_doubles(lats[593], 6.536509, tolerance);
+    compare_doubles(lats[594], 6.395939, tolerance);
+    compare_doubles(lats[595], 6.255369, tolerance);
+    compare_doubles(lats[596], 6.114798, tolerance);
+    compare_doubles(lats[597], 5.974228, tolerance);
+    compare_doubles(lats[598], 5.833658, tolerance);
+    compare_doubles(lats[599], 5.693088, tolerance);
+    compare_doubles(lats[600], 5.552518, tolerance);
+    compare_doubles(lats[601], 5.411948, tolerance);
+    compare_doubles(lats[602], 5.271378, tolerance);
+    compare_doubles(lats[603], 5.130808, tolerance);
+    compare_doubles(lats[604], 4.990238, tolerance);
+    compare_doubles(lats[605], 4.849668, tolerance);
+    compare_doubles(lats[606], 4.709098, tolerance);
+    compare_doubles(lats[607], 4.568528, tolerance);
+    compare_doubles(lats[608], 4.427957, tolerance);
+    compare_doubles(lats[609], 4.287387, tolerance);
+    compare_doubles(lats[610], 4.146817, tolerance);
+    compare_doubles(lats[611], 4.006247, tolerance);
+    compare_doubles(lats[612], 3.865677, tolerance);
+    compare_doubles(lats[613], 3.725107, tolerance);
+    compare_doubles(lats[614], 3.584537, tolerance);
+    compare_doubles(lats[615], 3.443967, tolerance);
+    compare_doubles(lats[616], 3.303397, tolerance);
+    compare_doubles(lats[617], 3.162827, tolerance);
+    compare_doubles(lats[618], 3.022257, tolerance);
+    compare_doubles(lats[619], 2.881687, tolerance);
+    compare_doubles(lats[620], 2.741117, tolerance);
+    compare_doubles(lats[621], 2.600546, tolerance);
+    compare_doubles(lats[622], 2.459976, tolerance);
+    compare_doubles(lats[623], 2.319406, tolerance);
+    compare_doubles(lats[624], 2.178836, tolerance);
+    compare_doubles(lats[625], 2.038266, tolerance);
+    compare_doubles(lats[626], 1.897696, tolerance);
+    compare_doubles(lats[627], 1.757126, tolerance);
+    compare_doubles(lats[628], 1.616556, tolerance);
+    compare_doubles(lats[629], 1.475986, tolerance);
+    compare_doubles(lats[630], 1.335416, tolerance);
+    compare_doubles(lats[631], 1.194846, tolerance);
+    compare_doubles(lats[632], 1.054276, tolerance);
+    compare_doubles(lats[633], 0.913706, tolerance);
+    compare_doubles(lats[634], 0.773135, tolerance);
+    compare_doubles(lats[635], 0.632565, tolerance);
+    compare_doubles(lats[636], 0.491995, tolerance);
+    compare_doubles(lats[637], 0.351425, tolerance);
+    compare_doubles(lats[638], 0.210855, tolerance);
+    compare_doubles(lats[639], 0.070285, tolerance);
+    compare_doubles(lats[640], -0.070285, tolerance);
+    compare_doubles(lats[641], -0.210855, tolerance);
+    compare_doubles(lats[642], -0.351425, tolerance);
+    compare_doubles(lats[643], -0.491995, tolerance);
+    compare_doubles(lats[644], -0.632565, tolerance);
+    compare_doubles(lats[645], -0.773135, tolerance);
+    compare_doubles(lats[646], -0.913706, tolerance);
+    compare_doubles(lats[647], -1.054276, tolerance);
+    compare_doubles(lats[648], -1.194846, tolerance);
+    compare_doubles(lats[649], -1.335416, tolerance);
+    compare_doubles(lats[650], -1.475986, tolerance);
+    compare_doubles(lats[651], -1.616556, tolerance);
+    compare_doubles(lats[652], -1.757126, tolerance);
+    compare_doubles(lats[653], -1.897696, tolerance);
+    compare_doubles(lats[654], -2.038266, tolerance);
+    compare_doubles(lats[655], -2.178836, tolerance);
+    compare_doubles(lats[656], -2.319406, tolerance);
+    compare_doubles(lats[657], -2.459976, tolerance);
+    compare_doubles(lats[658], -2.600546, tolerance);
+    compare_doubles(lats[659], -2.741117, tolerance);
+    compare_doubles(lats[660], -2.881687, tolerance);
+    compare_doubles(lats[661], -3.022257, tolerance);
+    compare_doubles(lats[662], -3.162827, tolerance);
+    compare_doubles(lats[663], -3.303397, tolerance);
+    compare_doubles(lats[664], -3.443967, tolerance);
+    compare_doubles(lats[665], -3.584537, tolerance);
+    compare_doubles(lats[666], -3.725107, tolerance);
+    compare_doubles(lats[667], -3.865677, tolerance);
+    compare_doubles(lats[668], -4.006247, tolerance);
+    compare_doubles(lats[669], -4.146817, tolerance);
+    compare_doubles(lats[670], -4.287387, tolerance);
+    compare_doubles(lats[671], -4.427957, tolerance);
+    compare_doubles(lats[672], -4.568528, tolerance);
+    compare_doubles(lats[673], -4.709098, tolerance);
+    compare_doubles(lats[674], -4.849668, tolerance);
+    compare_doubles(lats[675], -4.990238, tolerance);
+    compare_doubles(lats[676], -5.130808, tolerance);
+    compare_doubles(lats[677], -5.271378, tolerance);
+    compare_doubles(lats[678], -5.411948, tolerance);
+    compare_doubles(lats[679], -5.552518, tolerance);
+    compare_doubles(lats[680], -5.693088, tolerance);
+    compare_doubles(lats[681], -5.833658, tolerance);
+    compare_doubles(lats[682], -5.974228, tolerance);
+    compare_doubles(lats[683], -6.114798, tolerance);
+    compare_doubles(lats[684], -6.255369, tolerance);
+    compare_doubles(lats[685], -6.395939, tolerance);
+    compare_doubles(lats[686], -6.536509, tolerance);
+    compare_doubles(lats[687], -6.677079, tolerance);
+    compare_doubles(lats[688], -6.817649, tolerance);
+    compare_doubles(lats[689], -6.958219, tolerance);
+    compare_doubles(lats[690], -7.098789, tolerance);
+    compare_doubles(lats[691], -7.239359, tolerance);
+    compare_doubles(lats[692], -7.379929, tolerance);
+    compare_doubles(lats[693], -7.520499, tolerance);
+    compare_doubles(lats[694], -7.661069, tolerance);
+    compare_doubles(lats[695], -7.801639, tolerance);
+    compare_doubles(lats[696], -7.942209, tolerance);
+    compare_doubles(lats[697], -8.082780, tolerance);
+    compare_doubles(lats[698], -8.223350, tolerance);
+    compare_doubles(lats[699], -8.363920, tolerance);
+    compare_doubles(lats[700], -8.504490, tolerance);
+    compare_doubles(lats[701], -8.645060, tolerance);
+    compare_doubles(lats[702], -8.785630, tolerance);
+    compare_doubles(lats[703], -8.926200, tolerance);
+    compare_doubles(lats[704], -9.066770, tolerance);
+    compare_doubles(lats[705], -9.207340, tolerance);
+    compare_doubles(lats[706], -9.347910, tolerance);
+    compare_doubles(lats[707], -9.488480, tolerance);
+    compare_doubles(lats[708], -9.629050, tolerance);
+    compare_doubles(lats[709], -9.769620, tolerance);
+    compare_doubles(lats[710], -9.910191, tolerance);
+    compare_doubles(lats[711], -10.050761, tolerance);
+    compare_doubles(lats[712], -10.191331, tolerance);
+    compare_doubles(lats[713], -10.331901, tolerance);
+    compare_doubles(lats[714], -10.472471, tolerance);
+    compare_doubles(lats[715], -10.613041, tolerance);
+    compare_doubles(lats[716], -10.753611, tolerance);
+    compare_doubles(lats[717], -10.894181, tolerance);
+    compare_doubles(lats[718], -11.034751, tolerance);
+    compare_doubles(lats[719], -11.175321, tolerance);
+    compare_doubles(lats[720], -11.315891, tolerance);
+    compare_doubles(lats[721], -11.456461, tolerance);
+    compare_doubles(lats[722], -11.597032, tolerance);
+    compare_doubles(lats[723], -11.737602, tolerance);
+    compare_doubles(lats[724], -11.878172, tolerance);
+    compare_doubles(lats[725], -12.018742, tolerance);
+    compare_doubles(lats[726], -12.159312, tolerance);
+    compare_doubles(lats[727], -12.299882, tolerance);
+    compare_doubles(lats[728], -12.440452, tolerance);
+    compare_doubles(lats[729], -12.581022, tolerance);
+    compare_doubles(lats[730], -12.721592, tolerance);
+    compare_doubles(lats[731], -12.862162, tolerance);
+    compare_doubles(lats[732], -13.002732, tolerance);
+    compare_doubles(lats[733], -13.143302, tolerance);
+    compare_doubles(lats[734], -13.283872, tolerance);
+    compare_doubles(lats[735], -13.424443, tolerance);
+    compare_doubles(lats[736], -13.565013, tolerance);
+    compare_doubles(lats[737], -13.705583, tolerance);
+    compare_doubles(lats[738], -13.846153, tolerance);
+    compare_doubles(lats[739], -13.986723, tolerance);
+    compare_doubles(lats[740], -14.127293, tolerance);
+    compare_doubles(lats[741], -14.267863, tolerance);
+    compare_doubles(lats[742], -14.408433, tolerance);
+    compare_doubles(lats[743], -14.549003, tolerance);
+    compare_doubles(lats[744], -14.689573, tolerance);
+    compare_doubles(lats[745], -14.830143, tolerance);
+    compare_doubles(lats[746], -14.970713, tolerance);
+    compare_doubles(lats[747], -15.111283, tolerance);
+    compare_doubles(lats[748], -15.251854, tolerance);
+    compare_doubles(lats[749], -15.392424, tolerance);
+    compare_doubles(lats[750], -15.532994, tolerance);
+    compare_doubles(lats[751], -15.673564, tolerance);
+    compare_doubles(lats[752], -15.814134, tolerance);
+    compare_doubles(lats[753], -15.954704, tolerance);
+    compare_doubles(lats[754], -16.095274, tolerance);
+    compare_doubles(lats[755], -16.235844, tolerance);
+    compare_doubles(lats[756], -16.376414, tolerance);
+    compare_doubles(lats[757], -16.516984, tolerance);
+    compare_doubles(lats[758], -16.657554, tolerance);
+    compare_doubles(lats[759], -16.798124, tolerance);
+    compare_doubles(lats[760], -16.938694, tolerance);
+    compare_doubles(lats[761], -17.079265, tolerance);
+    compare_doubles(lats[762], -17.219835, tolerance);
+    compare_doubles(lats[763], -17.360405, tolerance);
+    compare_doubles(lats[764], -17.500975, tolerance);
+    compare_doubles(lats[765], -17.641545, tolerance);
+    compare_doubles(lats[766], -17.782115, tolerance);
+    compare_doubles(lats[767], -17.922685, tolerance);
+    compare_doubles(lats[768], -18.063255, tolerance);
+    compare_doubles(lats[769], -18.203825, tolerance);
+    compare_doubles(lats[770], -18.344395, tolerance);
+    compare_doubles(lats[771], -18.484965, tolerance);
+    compare_doubles(lats[772], -18.625535, tolerance);
+    compare_doubles(lats[773], -18.766106, tolerance);
+    compare_doubles(lats[774], -18.906676, tolerance);
+    compare_doubles(lats[775], -19.047246, tolerance);
+    compare_doubles(lats[776], -19.187816, tolerance);
+    compare_doubles(lats[777], -19.328386, tolerance);
+    compare_doubles(lats[778], -19.468956, tolerance);
+    compare_doubles(lats[779], -19.609526, tolerance);
+    compare_doubles(lats[780], -19.750096, tolerance);
+    compare_doubles(lats[781], -19.890666, tolerance);
+    compare_doubles(lats[782], -20.031236, tolerance);
+    compare_doubles(lats[783], -20.171806, tolerance);
+    compare_doubles(lats[784], -20.312376, tolerance);
+    compare_doubles(lats[785], -20.452946, tolerance);
+    compare_doubles(lats[786], -20.593517, tolerance);
+    compare_doubles(lats[787], -20.734087, tolerance);
+    compare_doubles(lats[788], -20.874657, tolerance);
+    compare_doubles(lats[789], -21.015227, tolerance);
+    compare_doubles(lats[790], -21.155797, tolerance);
+    compare_doubles(lats[791], -21.296367, tolerance);
+    compare_doubles(lats[792], -21.436937, tolerance);
+    compare_doubles(lats[793], -21.577507, tolerance);
+    compare_doubles(lats[794], -21.718077, tolerance);
+    compare_doubles(lats[795], -21.858647, tolerance);
+    compare_doubles(lats[796], -21.999217, tolerance);
+    compare_doubles(lats[797], -22.139787, tolerance);
+    compare_doubles(lats[798], -22.280357, tolerance);
+    compare_doubles(lats[799], -22.420928, tolerance);
+    compare_doubles(lats[800], -22.561498, tolerance);
+    compare_doubles(lats[801], -22.702068, tolerance);
+    compare_doubles(lats[802], -22.842638, tolerance);
+    compare_doubles(lats[803], -22.983208, tolerance);
+    compare_doubles(lats[804], -23.123778, tolerance);
+    compare_doubles(lats[805], -23.264348, tolerance);
+    compare_doubles(lats[806], -23.404918, tolerance);
+    compare_doubles(lats[807], -23.545488, tolerance);
+    compare_doubles(lats[808], -23.686058, tolerance);
+    compare_doubles(lats[809], -23.826628, tolerance);
+    compare_doubles(lats[810], -23.967198, tolerance);
+    compare_doubles(lats[811], -24.107768, tolerance);
+    compare_doubles(lats[812], -24.248339, tolerance);
+    compare_doubles(lats[813], -24.388909, tolerance);
+    compare_doubles(lats[814], -24.529479, tolerance);
+    compare_doubles(lats[815], -24.670049, tolerance);
+    compare_doubles(lats[816], -24.810619, tolerance);
+    compare_doubles(lats[817], -24.951189, tolerance);
+    compare_doubles(lats[818], -25.091759, tolerance);
+    compare_doubles(lats[819], -25.232329, tolerance);
+    compare_doubles(lats[820], -25.372899, tolerance);
+    compare_doubles(lats[821], -25.513469, tolerance);
+    compare_doubles(lats[822], -25.654039, tolerance);
+    compare_doubles(lats[823], -25.794609, tolerance);
+    compare_doubles(lats[824], -25.935179, tolerance);
+    compare_doubles(lats[825], -26.075750, tolerance);
+    compare_doubles(lats[826], -26.216320, tolerance);
+    compare_doubles(lats[827], -26.356890, tolerance);
+    compare_doubles(lats[828], -26.497460, tolerance);
+    compare_doubles(lats[829], -26.638030, tolerance);
+    compare_doubles(lats[830], -26.778600, tolerance);
+    compare_doubles(lats[831], -26.919170, tolerance);
+    compare_doubles(lats[832], -27.059740, tolerance);
+    compare_doubles(lats[833], -27.200310, tolerance);
+    compare_doubles(lats[834], -27.340880, tolerance);
+    compare_doubles(lats[835], -27.481450, tolerance);
+    compare_doubles(lats[836], -27.622020, tolerance);
+    compare_doubles(lats[837], -27.762590, tolerance);
+    compare_doubles(lats[838], -27.903161, tolerance);
+    compare_doubles(lats[839], -28.043731, tolerance);
+    compare_doubles(lats[840], -28.184301, tolerance);
+    compare_doubles(lats[841], -28.324871, tolerance);
+    compare_doubles(lats[842], -28.465441, tolerance);
+    compare_doubles(lats[843], -28.606011, tolerance);
+    compare_doubles(lats[844], -28.746581, tolerance);
+    compare_doubles(lats[845], -28.887151, tolerance);
+    compare_doubles(lats[846], -29.027721, tolerance);
+    compare_doubles(lats[847], -29.168291, tolerance);
+    compare_doubles(lats[848], -29.308861, tolerance);
+    compare_doubles(lats[849], -29.449431, tolerance);
+    compare_doubles(lats[850], -29.590001, tolerance);
+    compare_doubles(lats[851], -29.730572, tolerance);
+    compare_doubles(lats[852], -29.871142, tolerance);
+    compare_doubles(lats[853], -30.011712, tolerance);
+    compare_doubles(lats[854], -30.152282, tolerance);
+    compare_doubles(lats[855], -30.292852, tolerance);
+    compare_doubles(lats[856], -30.433422, tolerance);
+    compare_doubles(lats[857], -30.573992, tolerance);
+    compare_doubles(lats[858], -30.714562, tolerance);
+    compare_doubles(lats[859], -30.855132, tolerance);
+    compare_doubles(lats[860], -30.995702, tolerance);
+    compare_doubles(lats[861], -31.136272, tolerance);
+    compare_doubles(lats[862], -31.276842, tolerance);
+    compare_doubles(lats[863], -31.417412, tolerance);
+    compare_doubles(lats[864], -31.557982, tolerance);
+    compare_doubles(lats[865], -31.698553, tolerance);
+    compare_doubles(lats[866], -31.839123, tolerance);
+    compare_doubles(lats[867], -31.979693, tolerance);
+    compare_doubles(lats[868], -32.120263, tolerance);
+    compare_doubles(lats[869], -32.260833, tolerance);
+    compare_doubles(lats[870], -32.401403, tolerance);
+    compare_doubles(lats[871], -32.541973, tolerance);
+    compare_doubles(lats[872], -32.682543, tolerance);
+    compare_doubles(lats[873], -32.823113, tolerance);
+    compare_doubles(lats[874], -32.963683, tolerance);
+    compare_doubles(lats[875], -33.104253, tolerance);
+    compare_doubles(lats[876], -33.244823, tolerance);
+    compare_doubles(lats[877], -33.385393, tolerance);
+    compare_doubles(lats[878], -33.525964, tolerance);
+    compare_doubles(lats[879], -33.666534, tolerance);
+    compare_doubles(lats[880], -33.807104, tolerance);
+    compare_doubles(lats[881], -33.947674, tolerance);
+    compare_doubles(lats[882], -34.088244, tolerance);
+    compare_doubles(lats[883], -34.228814, tolerance);
+    compare_doubles(lats[884], -34.369384, tolerance);
+    compare_doubles(lats[885], -34.509954, tolerance);
+    compare_doubles(lats[886], -34.650524, tolerance);
+    compare_doubles(lats[887], -34.791094, tolerance);
+    compare_doubles(lats[888], -34.931664, tolerance);
+    compare_doubles(lats[889], -35.072234, tolerance);
+    compare_doubles(lats[890], -35.212804, tolerance);
+    compare_doubles(lats[891], -35.353374, tolerance);
+    compare_doubles(lats[892], -35.493945, tolerance);
+    compare_doubles(lats[893], -35.634515, tolerance);
+    compare_doubles(lats[894], -35.775085, tolerance);
+    compare_doubles(lats[895], -35.915655, tolerance);
+    compare_doubles(lats[896], -36.056225, tolerance);
+    compare_doubles(lats[897], -36.196795, tolerance);
+    compare_doubles(lats[898], -36.337365, tolerance);
+    compare_doubles(lats[899], -36.477935, tolerance);
+    compare_doubles(lats[900], -36.618505, tolerance);
+    compare_doubles(lats[901], -36.759075, tolerance);
+    compare_doubles(lats[902], -36.899645, tolerance);
+    compare_doubles(lats[903], -37.040215, tolerance);
+    compare_doubles(lats[904], -37.180785, tolerance);
+    compare_doubles(lats[905], -37.321356, tolerance);
+    compare_doubles(lats[906], -37.461926, tolerance);
+    compare_doubles(lats[907], -37.602496, tolerance);
+    compare_doubles(lats[908], -37.743066, tolerance);
+    compare_doubles(lats[909], -37.883636, tolerance);
+    compare_doubles(lats[910], -38.024206, tolerance);
+    compare_doubles(lats[911], -38.164776, tolerance);
+    compare_doubles(lats[912], -38.305346, tolerance);
+    compare_doubles(lats[913], -38.445916, tolerance);
+    compare_doubles(lats[914], -38.586486, tolerance);
+    compare_doubles(lats[915], -38.727056, tolerance);
+    compare_doubles(lats[916], -38.867626, tolerance);
+    compare_doubles(lats[917], -39.008196, tolerance);
+    compare_doubles(lats[918], -39.148766, tolerance);
+    compare_doubles(lats[919], -39.289337, tolerance);
+    compare_doubles(lats[920], -39.429907, tolerance);
+    compare_doubles(lats[921], -39.570477, tolerance);
+    compare_doubles(lats[922], -39.711047, tolerance);
+    compare_doubles(lats[923], -39.851617, tolerance);
+    compare_doubles(lats[924], -39.992187, tolerance);
+    compare_doubles(lats[925], -40.132757, tolerance);
+    compare_doubles(lats[926], -40.273327, tolerance);
+    compare_doubles(lats[927], -40.413897, tolerance);
+    compare_doubles(lats[928], -40.554467, tolerance);
+    compare_doubles(lats[929], -40.695037, tolerance);
+    compare_doubles(lats[930], -40.835607, tolerance);
+    compare_doubles(lats[931], -40.976177, tolerance);
+    compare_doubles(lats[932], -41.116747, tolerance);
+    compare_doubles(lats[933], -41.257318, tolerance);
+    compare_doubles(lats[934], -41.397888, tolerance);
+    compare_doubles(lats[935], -41.538458, tolerance);
+    compare_doubles(lats[936], -41.679028, tolerance);
+    compare_doubles(lats[937], -41.819598, tolerance);
+    compare_doubles(lats[938], -41.960168, tolerance);
+    compare_doubles(lats[939], -42.100738, tolerance);
+    compare_doubles(lats[940], -42.241308, tolerance);
+    compare_doubles(lats[941], -42.381878, tolerance);
+    compare_doubles(lats[942], -42.522448, tolerance);
+    compare_doubles(lats[943], -42.663018, tolerance);
+    compare_doubles(lats[944], -42.803588, tolerance);
+    compare_doubles(lats[945], -42.944158, tolerance);
+    compare_doubles(lats[946], -43.084728, tolerance);
+    compare_doubles(lats[947], -43.225299, tolerance);
+    compare_doubles(lats[948], -43.365869, tolerance);
+    compare_doubles(lats[949], -43.506439, tolerance);
+    compare_doubles(lats[950], -43.647009, tolerance);
+    compare_doubles(lats[951], -43.787579, tolerance);
+    compare_doubles(lats[952], -43.928149, tolerance);
+    compare_doubles(lats[953], -44.068719, tolerance);
+    compare_doubles(lats[954], -44.209289, tolerance);
+    compare_doubles(lats[955], -44.349859, tolerance);
+    compare_doubles(lats[956], -44.490429, tolerance);
+    compare_doubles(lats[957], -44.630999, tolerance);
+    compare_doubles(lats[958], -44.771569, tolerance);
+    compare_doubles(lats[959], -44.912139, tolerance);
+    compare_doubles(lats[960], -45.052709, tolerance);
+    compare_doubles(lats[961], -45.193279, tolerance);
+    compare_doubles(lats[962], -45.333850, tolerance);
+    compare_doubles(lats[963], -45.474420, tolerance);
+    compare_doubles(lats[964], -45.614990, tolerance);
+    compare_doubles(lats[965], -45.755560, tolerance);
+    compare_doubles(lats[966], -45.896130, tolerance);
+    compare_doubles(lats[967], -46.036700, tolerance);
+    compare_doubles(lats[968], -46.177270, tolerance);
+    compare_doubles(lats[969], -46.317840, tolerance);
+    compare_doubles(lats[970], -46.458410, tolerance);
+    compare_doubles(lats[971], -46.598980, tolerance);
+    compare_doubles(lats[972], -46.739550, tolerance);
+    compare_doubles(lats[973], -46.880120, tolerance);
+    compare_doubles(lats[974], -47.020690, tolerance);
+    compare_doubles(lats[975], -47.161260, tolerance);
+    compare_doubles(lats[976], -47.301830, tolerance);
+    compare_doubles(lats[977], -47.442401, tolerance);
+    compare_doubles(lats[978], -47.582971, tolerance);
+    compare_doubles(lats[979], -47.723541, tolerance);
+    compare_doubles(lats[980], -47.864111, tolerance);
+    compare_doubles(lats[981], -48.004681, tolerance);
+    compare_doubles(lats[982], -48.145251, tolerance);
+    compare_doubles(lats[983], -48.285821, tolerance);
+    compare_doubles(lats[984], -48.426391, tolerance);
+    compare_doubles(lats[985], -48.566961, tolerance);
+    compare_doubles(lats[986], -48.707531, tolerance);
+    compare_doubles(lats[987], -48.848101, tolerance);
+    compare_doubles(lats[988], -48.988671, tolerance);
+    compare_doubles(lats[989], -49.129241, tolerance);
+    compare_doubles(lats[990], -49.269811, tolerance);
+    compare_doubles(lats[991], -49.410381, tolerance);
+    compare_doubles(lats[992], -49.550952, tolerance);
+    compare_doubles(lats[993], -49.691522, tolerance);
+    compare_doubles(lats[994], -49.832092, tolerance);
+    compare_doubles(lats[995], -49.972662, tolerance);
+    compare_doubles(lats[996], -50.113232, tolerance);
+    compare_doubles(lats[997], -50.253802, tolerance);
+    compare_doubles(lats[998], -50.394372, tolerance);
+    compare_doubles(lats[999], -50.534942, tolerance);
+    compare_doubles(lats[1000], -50.675512, tolerance);
+    compare_doubles(lats[1001], -50.816082, tolerance);
+    compare_doubles(lats[1002], -50.956652, tolerance);
+    compare_doubles(lats[1003], -51.097222, tolerance);
+    compare_doubles(lats[1004], -51.237792, tolerance);
+    compare_doubles(lats[1005], -51.378362, tolerance);
+    compare_doubles(lats[1006], -51.518932, tolerance);
+    compare_doubles(lats[1007], -51.659502, tolerance);
+    compare_doubles(lats[1008], -51.800073, tolerance);
+    compare_doubles(lats[1009], -51.940643, tolerance);
+    compare_doubles(lats[1010], -52.081213, tolerance);
+    compare_doubles(lats[1011], -52.221783, tolerance);
+    compare_doubles(lats[1012], -52.362353, tolerance);
+    compare_doubles(lats[1013], -52.502923, tolerance);
+    compare_doubles(lats[1014], -52.643493, tolerance);
+    compare_doubles(lats[1015], -52.784063, tolerance);
+    compare_doubles(lats[1016], -52.924633, tolerance);
+    compare_doubles(lats[1017], -53.065203, tolerance);
+    compare_doubles(lats[1018], -53.205773, tolerance);
+    compare_doubles(lats[1019], -53.346343, tolerance);
+    compare_doubles(lats[1020], -53.486913, tolerance);
+    compare_doubles(lats[1021], -53.627483, tolerance);
+    compare_doubles(lats[1022], -53.768053, tolerance);
+    compare_doubles(lats[1023], -53.908623, tolerance);
+    compare_doubles(lats[1024], -54.049194, tolerance);
+    compare_doubles(lats[1025], -54.189764, tolerance);
+    compare_doubles(lats[1026], -54.330334, tolerance);
+    compare_doubles(lats[1027], -54.470904, tolerance);
+    compare_doubles(lats[1028], -54.611474, tolerance);
+    compare_doubles(lats[1029], -54.752044, tolerance);
+    compare_doubles(lats[1030], -54.892614, tolerance);
+    compare_doubles(lats[1031], -55.033184, tolerance);
+    compare_doubles(lats[1032], -55.173754, tolerance);
+    compare_doubles(lats[1033], -55.314324, tolerance);
+    compare_doubles(lats[1034], -55.454894, tolerance);
+    compare_doubles(lats[1035], -55.595464, tolerance);
+    compare_doubles(lats[1036], -55.736034, tolerance);
+    compare_doubles(lats[1037], -55.876604, tolerance);
+    compare_doubles(lats[1038], -56.017174, tolerance);
+    compare_doubles(lats[1039], -56.157744, tolerance);
+    compare_doubles(lats[1040], -56.298314, tolerance);
+    compare_doubles(lats[1041], -56.438884, tolerance);
+    compare_doubles(lats[1042], -56.579455, tolerance);
+    compare_doubles(lats[1043], -56.720025, tolerance);
+    compare_doubles(lats[1044], -56.860595, tolerance);
+    compare_doubles(lats[1045], -57.001165, tolerance);
+    compare_doubles(lats[1046], -57.141735, tolerance);
+    compare_doubles(lats[1047], -57.282305, tolerance);
+    compare_doubles(lats[1048], -57.422875, tolerance);
+    compare_doubles(lats[1049], -57.563445, tolerance);
+    compare_doubles(lats[1050], -57.704015, tolerance);
+    compare_doubles(lats[1051], -57.844585, tolerance);
+    compare_doubles(lats[1052], -57.985155, tolerance);
+    compare_doubles(lats[1053], -58.125725, tolerance);
+    compare_doubles(lats[1054], -58.266295, tolerance);
+    compare_doubles(lats[1055], -58.406865, tolerance);
+    compare_doubles(lats[1056], -58.547435, tolerance);
+    compare_doubles(lats[1057], -58.688005, tolerance);
+    compare_doubles(lats[1058], -58.828575, tolerance);
+    compare_doubles(lats[1059], -58.969145, tolerance);
+    compare_doubles(lats[1060], -59.109715, tolerance);
+    compare_doubles(lats[1061], -59.250286, tolerance);
+    compare_doubles(lats[1062], -59.390856, tolerance);
+    compare_doubles(lats[1063], -59.531426, tolerance);
+    compare_doubles(lats[1064], -59.671996, tolerance);
+    compare_doubles(lats[1065], -59.812566, tolerance);
+    compare_doubles(lats[1066], -59.953136, tolerance);
+    compare_doubles(lats[1067], -60.093706, tolerance);
+    compare_doubles(lats[1068], -60.234276, tolerance);
+    compare_doubles(lats[1069], -60.374846, tolerance);
+    compare_doubles(lats[1070], -60.515416, tolerance);
+    compare_doubles(lats[1071], -60.655986, tolerance);
+    compare_doubles(lats[1072], -60.796556, tolerance);
+    compare_doubles(lats[1073], -60.937126, tolerance);
+    compare_doubles(lats[1074], -61.077696, tolerance);
+    compare_doubles(lats[1075], -61.218266, tolerance);
+    compare_doubles(lats[1076], -61.358836, tolerance);
+    compare_doubles(lats[1077], -61.499406, tolerance);
+    compare_doubles(lats[1078], -61.639976, tolerance);
+    compare_doubles(lats[1079], -61.780546, tolerance);
+    compare_doubles(lats[1080], -61.921116, tolerance);
+    compare_doubles(lats[1081], -62.061686, tolerance);
+    compare_doubles(lats[1082], -62.202256, tolerance);
+    compare_doubles(lats[1083], -62.342826, tolerance);
+    compare_doubles(lats[1084], -62.483397, tolerance);
+    compare_doubles(lats[1085], -62.623967, tolerance);
+    compare_doubles(lats[1086], -62.764537, tolerance);
+    compare_doubles(lats[1087], -62.905107, tolerance);
+    compare_doubles(lats[1088], -63.045677, tolerance);
+    compare_doubles(lats[1089], -63.186247, tolerance);
+    compare_doubles(lats[1090], -63.326817, tolerance);
+    compare_doubles(lats[1091], -63.467387, tolerance);
+    compare_doubles(lats[1092], -63.607957, tolerance);
+    compare_doubles(lats[1093], -63.748527, tolerance);
+    compare_doubles(lats[1094], -63.889097, tolerance);
+    compare_doubles(lats[1095], -64.029667, tolerance);
+    compare_doubles(lats[1096], -64.170237, tolerance);
+    compare_doubles(lats[1097], -64.310807, tolerance);
+    compare_doubles(lats[1098], -64.451377, tolerance);
+    compare_doubles(lats[1099], -64.591947, tolerance);
+    compare_doubles(lats[1100], -64.732517, tolerance);
+    compare_doubles(lats[1101], -64.873087, tolerance);
+    compare_doubles(lats[1102], -65.013657, tolerance);
+    compare_doubles(lats[1103], -65.154227, tolerance);
+    compare_doubles(lats[1104], -65.294797, tolerance);
+    compare_doubles(lats[1105], -65.435367, tolerance);
+    compare_doubles(lats[1106], -65.575937, tolerance);
+    compare_doubles(lats[1107], -65.716507, tolerance);
+    compare_doubles(lats[1108], -65.857077, tolerance);
+    compare_doubles(lats[1109], -65.997647, tolerance);
+    compare_doubles(lats[1110], -66.138217, tolerance);
+    compare_doubles(lats[1111], -66.278787, tolerance);
+    compare_doubles(lats[1112], -66.419357, tolerance);
+    compare_doubles(lats[1113], -66.559927, tolerance);
+    compare_doubles(lats[1114], -66.700497, tolerance);
+    compare_doubles(lats[1115], -66.841067, tolerance);
+    compare_doubles(lats[1116], -66.981638, tolerance);
+    compare_doubles(lats[1117], -67.122208, tolerance);
+    compare_doubles(lats[1118], -67.262778, tolerance);
+    compare_doubles(lats[1119], -67.403348, tolerance);
+    compare_doubles(lats[1120], -67.543918, tolerance);
+    compare_doubles(lats[1121], -67.684488, tolerance);
+    compare_doubles(lats[1122], -67.825058, tolerance);
+    compare_doubles(lats[1123], -67.965628, tolerance);
+    compare_doubles(lats[1124], -68.106198, tolerance);
+    compare_doubles(lats[1125], -68.246768, tolerance);
+    compare_doubles(lats[1126], -68.387338, tolerance);
+    compare_doubles(lats[1127], -68.527908, tolerance);
+    compare_doubles(lats[1128], -68.668478, tolerance);
+    compare_doubles(lats[1129], -68.809048, tolerance);
+    compare_doubles(lats[1130], -68.949618, tolerance);
+    compare_doubles(lats[1131], -69.090188, tolerance);
+    compare_doubles(lats[1132], -69.230758, tolerance);
+    compare_doubles(lats[1133], -69.371328, tolerance);
+    compare_doubles(lats[1134], -69.511898, tolerance);
+    compare_doubles(lats[1135], -69.652468, tolerance);
+    compare_doubles(lats[1136], -69.793038, tolerance);
+    compare_doubles(lats[1137], -69.933608, tolerance);
+    compare_doubles(lats[1138], -70.074178, tolerance);
+    compare_doubles(lats[1139], -70.214748, tolerance);
+    compare_doubles(lats[1140], -70.355318, tolerance);
+    compare_doubles(lats[1141], -70.495888, tolerance);
+    compare_doubles(lats[1142], -70.636458, tolerance);
+    compare_doubles(lats[1143], -70.777028, tolerance);
+    compare_doubles(lats[1144], -70.917598, tolerance);
+    compare_doubles(lats[1145], -71.058168, tolerance);
+    compare_doubles(lats[1146], -71.198738, tolerance);
+    compare_doubles(lats[1147], -71.339308, tolerance);
+    compare_doubles(lats[1148], -71.479878, tolerance);
+    compare_doubles(lats[1149], -71.620448, tolerance);
+    compare_doubles(lats[1150], -71.761018, tolerance);
+    compare_doubles(lats[1151], -71.901588, tolerance);
+    compare_doubles(lats[1152], -72.042158, tolerance);
+    compare_doubles(lats[1153], -72.182728, tolerance);
+    compare_doubles(lats[1154], -72.323298, tolerance);
+    compare_doubles(lats[1155], -72.463867, tolerance);
+    compare_doubles(lats[1156], -72.604437, tolerance);
+    compare_doubles(lats[1157], -72.745007, tolerance);
+    compare_doubles(lats[1158], -72.885577, tolerance);
+    compare_doubles(lats[1159], -73.026147, tolerance);
+    compare_doubles(lats[1160], -73.166717, tolerance);
+    compare_doubles(lats[1161], -73.307287, tolerance);
+    compare_doubles(lats[1162], -73.447857, tolerance);
+    compare_doubles(lats[1163], -73.588427, tolerance);
+    compare_doubles(lats[1164], -73.728997, tolerance);
+    compare_doubles(lats[1165], -73.869567, tolerance);
+    compare_doubles(lats[1166], -74.010137, tolerance);
+    compare_doubles(lats[1167], -74.150707, tolerance);
+    compare_doubles(lats[1168], -74.291277, tolerance);
+    compare_doubles(lats[1169], -74.431847, tolerance);
+    compare_doubles(lats[1170], -74.572417, tolerance);
+    compare_doubles(lats[1171], -74.712987, tolerance);
+    compare_doubles(lats[1172], -74.853557, tolerance);
+    compare_doubles(lats[1173], -74.994127, tolerance);
+    compare_doubles(lats[1174], -75.134697, tolerance);
+    compare_doubles(lats[1175], -75.275266, tolerance);
+    compare_doubles(lats[1176], -75.415836, tolerance);
+    compare_doubles(lats[1177], -75.556406, tolerance);
+    compare_doubles(lats[1178], -75.696976, tolerance);
+    compare_doubles(lats[1179], -75.837546, tolerance);
+    compare_doubles(lats[1180], -75.978116, tolerance);
+    compare_doubles(lats[1181], -76.118686, tolerance);
+    compare_doubles(lats[1182], -76.259256, tolerance);
+    compare_doubles(lats[1183], -76.399826, tolerance);
+    compare_doubles(lats[1184], -76.540396, tolerance);
+    compare_doubles(lats[1185], -76.680966, tolerance);
+    compare_doubles(lats[1186], -76.821535, tolerance);
+    compare_doubles(lats[1187], -76.962105, tolerance);
+    compare_doubles(lats[1188], -77.102675, tolerance);
+    compare_doubles(lats[1189], -77.243245, tolerance);
+    compare_doubles(lats[1190], -77.383815, tolerance);
+    compare_doubles(lats[1191], -77.524385, tolerance);
+    compare_doubles(lats[1192], -77.664955, tolerance);
+    compare_doubles(lats[1193], -77.805524, tolerance);
+    compare_doubles(lats[1194], -77.946094, tolerance);
+    compare_doubles(lats[1195], -78.086664, tolerance);
+    compare_doubles(lats[1196], -78.227234, tolerance);
+    compare_doubles(lats[1197], -78.367804, tolerance);
+    compare_doubles(lats[1198], -78.508374, tolerance);
+    compare_doubles(lats[1199], -78.648943, tolerance);
+    compare_doubles(lats[1200], -78.789513, tolerance);
+    compare_doubles(lats[1201], -78.930083, tolerance);
+    compare_doubles(lats[1202], -79.070653, tolerance);
+    compare_doubles(lats[1203], -79.211223, tolerance);
+    compare_doubles(lats[1204], -79.351792, tolerance);
+    compare_doubles(lats[1205], -79.492362, tolerance);
+    compare_doubles(lats[1206], -79.632932, tolerance);
+    compare_doubles(lats[1207], -79.773502, tolerance);
+    compare_doubles(lats[1208], -79.914072, tolerance);
+    compare_doubles(lats[1209], -80.054641, tolerance);
+    compare_doubles(lats[1210], -80.195211, tolerance);
+    compare_doubles(lats[1211], -80.335781, tolerance);
+    compare_doubles(lats[1212], -80.476350, tolerance);
+    compare_doubles(lats[1213], -80.616920, tolerance);
+    compare_doubles(lats[1214], -80.757490, tolerance);
+    compare_doubles(lats[1215], -80.898059, tolerance);
+    compare_doubles(lats[1216], -81.038629, tolerance);
+    compare_doubles(lats[1217], -81.179199, tolerance);
+    compare_doubles(lats[1218], -81.319768, tolerance);
+    compare_doubles(lats[1219], -81.460338, tolerance);
+    compare_doubles(lats[1220], -81.600908, tolerance);
+    compare_doubles(lats[1221], -81.741477, tolerance);
+    compare_doubles(lats[1222], -81.882047, tolerance);
+    compare_doubles(lats[1223], -82.022616, tolerance);
+    compare_doubles(lats[1224], -82.163186, tolerance);
+    compare_doubles(lats[1225], -82.303755, tolerance);
+    compare_doubles(lats[1226], -82.444325, tolerance);
+    compare_doubles(lats[1227], -82.584894, tolerance);
+    compare_doubles(lats[1228], -82.725464, tolerance);
+    compare_doubles(lats[1229], -82.866033, tolerance);
+    compare_doubles(lats[1230], -83.006602, tolerance);
+    compare_doubles(lats[1231], -83.147172, tolerance);
+    compare_doubles(lats[1232], -83.287741, tolerance);
+    compare_doubles(lats[1233], -83.428310, tolerance);
+    compare_doubles(lats[1234], -83.568880, tolerance);
+    compare_doubles(lats[1235], -83.709449, tolerance);
+    compare_doubles(lats[1236], -83.850018, tolerance);
+    compare_doubles(lats[1237], -83.990587, tolerance);
+    compare_doubles(lats[1238], -84.131156, tolerance);
+    compare_doubles(lats[1239], -84.271725, tolerance);
+    compare_doubles(lats[1240], -84.412294, tolerance);
+    compare_doubles(lats[1241], -84.552863, tolerance);
+    compare_doubles(lats[1242], -84.693432, tolerance);
+    compare_doubles(lats[1243], -84.834001, tolerance);
+    compare_doubles(lats[1244], -84.974570, tolerance);
+    compare_doubles(lats[1245], -85.115138, tolerance);
+    compare_doubles(lats[1246], -85.255707, tolerance);
+    compare_doubles(lats[1247], -85.396275, tolerance);
+    compare_doubles(lats[1248], -85.536844, tolerance);
+    compare_doubles(lats[1249], -85.677412, tolerance);
+    compare_doubles(lats[1250], -85.817980, tolerance);
+    compare_doubles(lats[1251], -85.958548, tolerance);
+    compare_doubles(lats[1252], -86.099116, tolerance);
+    compare_doubles(lats[1253], -86.239684, tolerance);
+    compare_doubles(lats[1254], -86.380251, tolerance);
+    compare_doubles(lats[1255], -86.520818, tolerance);
+    compare_doubles(lats[1256], -86.661385, tolerance);
+    compare_doubles(lats[1257], -86.801952, tolerance);
+    compare_doubles(lats[1258], -86.942519, tolerance);
+    compare_doubles(lats[1259], -87.083085, tolerance);
+    compare_doubles(lats[1260], -87.223651, tolerance);
+    compare_doubles(lats[1261], -87.364216, tolerance);
+    compare_doubles(lats[1262], -87.504781, tolerance);
+    compare_doubles(lats[1263], -87.645345, tolerance);
+    compare_doubles(lats[1264], -87.785908, tolerance);
+    compare_doubles(lats[1265], -87.926471, tolerance);
+    compare_doubles(lats[1266], -88.067032, tolerance);
+    compare_doubles(lats[1267], -88.207592, tolerance);
+    compare_doubles(lats[1268], -88.348150, tolerance);
+    compare_doubles(lats[1269], -88.488706, tolerance);
+    compare_doubles(lats[1270], -88.629259, tolerance);
+    compare_doubles(lats[1271], -88.769808, tolerance);
+    compare_doubles(lats[1272], -88.910352, tolerance);
+    compare_doubles(lats[1273], -89.050889, tolerance);
+    compare_doubles(lats[1274], -89.191413, tolerance);
+    compare_doubles(lats[1275], -89.331918, tolerance);
+    compare_doubles(lats[1276], -89.472390, tolerance);
+    compare_doubles(lats[1277], -89.612790, tolerance);
+    compare_doubles(lats[1278], -89.753005, tolerance);
+    compare_doubles(lats[1279], -89.892396, tolerance);
 
-	free(lats);
+    free(lats);
 }
 
-void test_string_splitting()
+static void test_string_splitting()
 {
     int i=0;
     char input[80] = "Born|To|Be|Wild";
@@ -1406,7 +1406,7 @@ static void my_assertion_proc(const char* message)
     assertion_caught = 1;
 }
 
-void test_assertion_catching()
+static void test_assertion_catching()
 {
     assert(assertion_caught == 0);
     codes_set_codes_assertion_failed_proc(&my_assertion_proc);
diff --git a/tigge/tigge_accumulations.c b/tigge/tigge_accumulations.c
index 76de47b..55c299a 100755
--- a/tigge/tigge_accumulations.c
+++ b/tigge/tigge_accumulations.c
@@ -18,7 +18,6 @@
 #include "config.h"
 #endif
 
-
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
@@ -28,258 +27,250 @@
 #define NUMBER(x) (sizeof(x)/sizeof(x[0]))
 
 const char* checks[] = {
-	/* Section 1 */
-	"identificationOfOriginatingGeneratingCentre",
-	"identificationOfOriginatingGeneratingSubCentre",
-	"gribMasterTablesVersionNumber",
-	"versionNumberOfGribLocalTables",
-	"significanceOfReferenceTime",
-	"year",
-	"month",
-	"day",
-	"hour",
-	"minute",
-	"second",
-	"productionStatusOfProcessedData",
-	"typeOfProcessedData",
-
-	/*Section3*/
-	"sourceOfGridDefinition",
-	"numberOfDataPoints",
-	"numberOfOctetsForOptionalListOfNumbersDefiningNumberOfPoints",
-	"interpretationOfListOfNumbersDefiningNumberOfPoints",
-	"gridDefinitionTemplateNumber",
-	"shapeOfTheEarth",
-	"scaleFactorOfRadiusOfSphericalEarth",
-	"scaledValueOfRadiusOfSphericalEarth",
-	"scaleFactorOfMajorAxisOfOblateSpheroidEarth",
-	"scaledValueOfMajorAxisOfOblateSpheroidEarth",
-	"scaleFactorOfMinorAxisOfOblateSpheroidEarth",
-	"scaledValueOfMinorAxisOfOblateSpheroidEarth",
-	"numberOfPointsAlongAParallel",
-	"numberOfPointsAlongAMeridian",
-	"basicAngleOfTheInitialProductionDomain",
-	"subdivisionsOfBasicAngle",
-	"latitudeOfFirstGridPoint",
-	"longitudeOfFirstGridPoint",
-	"resolutionAndComponentFlags",
-	"latitudeOfLastGridPoint",
-	"longitudeOfLastGridPoint",
-	"iDirectionIncrement",
-	"jDirectionIncrement",
-	"scanningMode",
-
-	/*Section4*/
-
-	"numberOfSection",
-	"numberOfCoordinatesValues",
-	"productDefinitionTemplateNumber",
-	"parameterCategory",
-	"parameterNumber",
-	"typeOfGeneratingProcess",
-	"backgroundGeneratingProcessIdentifier",
-	"generatingProcessIdentifier",
-	"hoursAfterReferenceTimeOfDataCutoff",
-	"minutesAfterReferenceTimeOfDataCutoff",
-/*	"indicatorOfUnitOfTimeRange",*/
-
-	/* "forecastTime", */
-
-	"typeOfFirstFixedSurface",
-	"scaleFactorOfFirstFixedSurface",
-	"scaledValueOfFirstFixedSurface",
-	"typeOfSecondFixedSurface",
-	"scaleFactorOfSecondFixedSurface",
-	"scaledValueOfSecondFixedSurface",
-	"typeOfEnsembleForecast",
-	"perturbationNumber",
-	"numberOfForecastsInEnsemble",
-
-	/*
-	   "yearOfEndOfOverallTimeInterval",
-	   "monthOfEndOfOverallTimeInterval",
-	   "dayOfEndOfOverallTimeInterval",
-	   "hourOfEndOfOverallTimeInterval",
-	   "minuteOfEndOfOverallTimeInterval",
-	   "secondOfEndOfOverallTimeInterval",
-	 */
-
-	"numberOfTimeRangeSpecificationsDescribingTheTimeIntervalsUsedToCalculateTheStatisticallyProcessedField",
-	"totalNumberOfDataValuesMissingInStatisticalProcess",
-	"typeOfStatisticalProcessing",
-	"typeOfTimeIncrementBetweenSuccessiveFieldsUsedInTheStatisticalProcessing",
-	/* "indicatorOfUnitOfTimeForTimeRangeOverWhichStatisticalProcessingIsDone", */
-	/*
-	   "lengthOfTheTimeRangeOverWhichStatisticalProcessingIsDone",
-	 */
-	"indicatorOfUnitOfTimeForTheIncrementBetweenTheSuccessiveFieldsUsed",
-	"timeIncrementBetweenSuccessiveFields",
-
+    /* Section 1 */
+    "identificationOfOriginatingGeneratingCentre",
+    "identificationOfOriginatingGeneratingSubCentre",
+    "gribMasterTablesVersionNumber",
+    "versionNumberOfGribLocalTables",
+    "significanceOfReferenceTime",
+    "year",
+    "month",
+    "day",
+    "hour",
+    "minute",
+    "second",
+    "productionStatusOfProcessedData",
+    "typeOfProcessedData",
+
+    /*Section3*/
+    "sourceOfGridDefinition",
+    "numberOfDataPoints",
+    "numberOfOctetsForOptionalListOfNumbersDefiningNumberOfPoints",
+    "interpretationOfListOfNumbersDefiningNumberOfPoints",
+    "gridDefinitionTemplateNumber",
+    "shapeOfTheEarth",
+    "scaleFactorOfRadiusOfSphericalEarth",
+    "scaledValueOfRadiusOfSphericalEarth",
+    "scaleFactorOfMajorAxisOfOblateSpheroidEarth",
+    "scaledValueOfMajorAxisOfOblateSpheroidEarth",
+    "scaleFactorOfMinorAxisOfOblateSpheroidEarth",
+    "scaledValueOfMinorAxisOfOblateSpheroidEarth",
+    "numberOfPointsAlongAParallel",
+    "numberOfPointsAlongAMeridian",
+    "basicAngleOfTheInitialProductionDomain",
+    "subdivisionsOfBasicAngle",
+    "latitudeOfFirstGridPoint",
+    "longitudeOfFirstGridPoint",
+    "resolutionAndComponentFlags",
+    "latitudeOfLastGridPoint",
+    "longitudeOfLastGridPoint",
+    "iDirectionIncrement",
+    "jDirectionIncrement",
+    "scanningMode",
+
+    /*Section4*/
+
+    "numberOfSection",
+    "numberOfCoordinatesValues",
+    "productDefinitionTemplateNumber",
+    "parameterCategory",
+    "parameterNumber",
+    "typeOfGeneratingProcess",
+    "backgroundGeneratingProcessIdentifier",
+    "generatingProcessIdentifier",
+    "hoursAfterReferenceTimeOfDataCutoff",
+    "minutesAfterReferenceTimeOfDataCutoff",
+/*    "indicatorOfUnitOfTimeRange",*/
+
+    /* "forecastTime", */
+
+    "typeOfFirstFixedSurface",
+    "scaleFactorOfFirstFixedSurface",
+    "scaledValueOfFirstFixedSurface",
+    "typeOfSecondFixedSurface",
+    "scaleFactorOfSecondFixedSurface",
+    "scaledValueOfSecondFixedSurface",
+    "typeOfEnsembleForecast",
+    "perturbationNumber",
+    "numberOfForecastsInEnsemble",
+
+    /*
+       "yearOfEndOfOverallTimeInterval",
+       "monthOfEndOfOverallTimeInterval",
+       "dayOfEndOfOverallTimeInterval",
+       "hourOfEndOfOverallTimeInterval",
+       "minuteOfEndOfOverallTimeInterval",
+       "secondOfEndOfOverallTimeInterval",
+     */
+
+    "numberOfTimeRangeSpecificationsDescribingTheTimeIntervalsUsedToCalculateTheStatisticallyProcessedField",
+    "totalNumberOfDataValuesMissingInStatisticalProcess",
+    "typeOfStatisticalProcessing",
+    "typeOfTimeIncrementBetweenSuccessiveFieldsUsedInTheStatisticalProcessing",
+    /* "indicatorOfUnitOfTimeForTimeRangeOverWhichStatisticalProcessingIsDone", */
+    /*
+       "lengthOfTheTimeRangeOverWhichStatisticalProcessingIsDone",
+     */
+    "indicatorOfUnitOfTimeForTheIncrementBetweenTheSuccessiveFieldsUsed",
+    "timeIncrementBetweenSuccessiveFields",
 };
 
-
 long check_values[NUMBER(checks)];
 
-
-
-void usage(const char *prog)
+static void usage(const char *prog)
 {
-	fprintf(stderr,"%s:  in1 [in2 ... ]  out\n",prog);
-	exit(1);
+    fprintf(stderr,"%s:  in1 [in2 ... ]  out\n",prog);
+    exit(1);
 }
 
-
-void init_checks(grib_handle* h)
+static void init_checks(grib_handle* h)
 {
-	size_t i;
-	for(i = 0; i < NUMBER(checks); i++)
-		GRIB_CHECK(grib_get_long(h,checks[i],&check_values[i]),checks[i]);
+    size_t i;
+    for(i = 0; i < NUMBER(checks); i++) {
+        GRIB_CHECK(grib_get_long(h,checks[i],&check_values[i]),checks[i]);
+    }
 }
 
-void do_checks(grib_handle* h)
+static void do_checks(grib_handle* h)
 {
-	size_t i;
-	long val;
-	for(i = 0; i < NUMBER(checks); i++)
-	{
-		GRIB_CHECK(grib_get_long(h,checks[i],&val),checks[i]);
-		if(val != check_values[i])
-		{
-			printf("Value mismatch for %s: %ld and %ld\n",checks[i],check_values[i],val);
-			exit(1);
-		}
-	}
+    size_t i;
+    long val;
+    for(i = 0; i < NUMBER(checks); i++)
+    {
+        GRIB_CHECK(grib_get_long(h,checks[i],&val),checks[i]);
+        if(val != check_values[i])
+        {
+            printf("Value mismatch for %s: %ld and %ld\n",checks[i],check_values[i],val);
+            exit(1);
+        }
+    }
 }
 
-
-void output_field(grib_handle* h,FILE* f,long bits,double* values,size_t size,const char* out)
+static void output_field(grib_handle* h,FILE* f,long bits,double* values,size_t size,const char* out)
 {
-	const void *buffer; 
+    const void *buffer; 
 
-	GRIB_CHECK(grib_set_long(h,"numberOfBitsContainingEachPackedValue",bits),"numberOfBitsContainingEachPackedValue");
-	GRIB_CHECK(grib_set_double_array(h,"values",values,size),NULL);
-	GRIB_CHECK(grib_get_message(h,&buffer,&size),NULL);
+    GRIB_CHECK(grib_set_long(h,"numberOfBitsContainingEachPackedValue",bits),"numberOfBitsContainingEachPackedValue");
+    GRIB_CHECK(grib_set_double_array(h,"values",values,size),NULL);
+    GRIB_CHECK(grib_get_message(h,&buffer,&size),NULL);
 
-	if(fwrite(buffer,1,size,f) != size)
-	{
-		perror(out);
-		exit(1);
-	}
+    if(fwrite(buffer,1,size,f) != size)
+    {
+        perror(out);
+        exit(1);
+    }
 }
 
-int main(int argc, const char *argv[])
+int main(int argc, char *argv[])
 {
-	int i;
-	FILE *in,*out;
-	int e;
-	grib_handle *result = NULL,*h;
-	double* values = NULL;
-	double *tmp = NULL;
-	size_t size,count,j;
-
-	long step      = 0;
-	long startStep = 0;
-	long endStep   = 0;
-	long bits      = 0;
-
-	if(argc < 3) usage(argv[0]);
-
-	out = fopen(argv[argc-1],"w");
-	if(!out) {
-		perror(argv[argc-1]);
-		exit(1);
-	}
+    int i;
+    FILE *in,*out;
+    int e;
+    grib_handle *result = NULL,*h;
+    double* values = NULL;
+    double *tmp = NULL;
+    size_t size,count,j;
 
+    long step      = 0;
+    long startStep = 0;
+    long endStep   = 0;
+    long bits      = 0;
 
-	for(i = 1; i < argc-1; i++)
-	{
-		in = fopen(argv[i],"r");
-		if(!in) {
-			perror(argv[i]);
-			exit(1);
-		}
+    if(argc < 3) usage(argv[0]);
 
-		while( (h = grib_handle_new_from_file(NULL,in,&e)) != NULL )
-		{
-			long b = 0;
+    out = fopen(argv[argc-1],"w");
+    if(!out) {
+        perror(argv[argc-1]);
+        exit(1);
+    }
 
-			GRIB_CHECK(grib_get_long(h,"startStep",&startStep),"startStep");
-			GRIB_CHECK(grib_get_long(h,"endStep",&endStep),"endStep");
-			GRIB_CHECK(grib_get_long(h,"numberOfBitsContainingEachPackedValue",&b),"numberOfBitsContainingEachPackedValue");
+    for(i = 1; i < argc-1; i++)
+    {
+        in = fopen(argv[i],"r");
+        if(!in) {
+            perror(argv[i]);
+            exit(1);
+        }
 
-			if(b > bits) bits = b;
+        while( (h = grib_handle_new_from_file(NULL,in,&e)) != NULL )
+        {
+            long b = 0;
 
-			if(result == NULL)
-			{
-				grib_handle *g = grib_handle_clone(h);
-				result = h;
+            GRIB_CHECK(grib_get_long(h,"startStep",&startStep),"startStep");
+            GRIB_CHECK(grib_get_long(h,"endStep",&endStep),"endStep");
+            GRIB_CHECK(grib_get_long(h,"numberOfBitsContainingEachPackedValue",&b),"numberOfBitsContainingEachPackedValue");
 
-				assert(g);
+            if(b > bits) bits = b;
 
-				init_checks(g);
+            if(result == NULL)
+            {
+                grib_handle *g = grib_handle_clone(h);
+                result = h;
 
-				GRIB_CHECK(grib_get_size(g,"values",&size),argv[i]);
+                assert(g);
 
-				values = (double*)calloc(size,sizeof(double));
-				assert(values);
+                init_checks(g);
 
-				tmp    = (double*)calloc(size,sizeof(double));
-				assert(tmp);
+                GRIB_CHECK(grib_get_size(g,"values",&size),argv[i]);
 
+                values = (double*)calloc(size,sizeof(double));
+                assert(values);
 
-				assert(startStep == 0);
+                tmp    = (double*)calloc(size,sizeof(double));
+                assert(tmp);
 
-				GRIB_CHECK(grib_set_long(g,"startStep",0),"startStep");
-				GRIB_CHECK(grib_set_long(g,"endStep",0),"endStep");
+                assert(startStep == 0);
 
-				output_field(g,out,0,values,size,argv[argc-1]);
+                GRIB_CHECK(grib_set_long(g,"startStep",0),"startStep");
+                GRIB_CHECK(grib_set_long(g,"endStep",0),"endStep");
 
-				grib_handle_delete(g);
+                output_field(g,out,0,values,size,argv[argc-1]);
 
-			}
-			else
-				do_checks(h);
+                grib_handle_delete(g);
 
-			GRIB_CHECK(grib_get_size(h,"values",&count),argv[i]);
-			assert(count == size);
+            }
+            else
+                do_checks(h);
 
-			GRIB_CHECK(grib_get_double_array(h,"values",tmp,&count),argv[i]);
-			assert(count == size);
+            GRIB_CHECK(grib_get_size(h,"values",&count),argv[i]);
+            assert(count == size);
 
-			for(j = 0; j < count; j++)
-				values[j] += tmp[j];
+            GRIB_CHECK(grib_get_double_array(h,"values",tmp,&count),argv[i]);
+            assert(count == size);
 
+            for(j = 0; j < count; j++)
+                values[j] += tmp[j];
 
-			if(startStep != step)
-			{
-				printf("Fields not in step order: step=%ld previous=%ld\n",startStep,step);
-				exit(1);
-			}
 
-			assert(endStep - startStep == 6);
-			step = endStep;
+            if(startStep != step)
+            {
+                printf("Fields not in step order: step=%ld previous=%ld\n",startStep,step);
+                exit(1);
+            }
 
-			GRIB_CHECK(grib_set_long(result,"startStep",0), "startStep");
-			GRIB_CHECK(grib_set_long(result,"endStep",step),"endStep");
+            assert(endStep - startStep == 6);
+            step = endStep;
 
-			output_field(result,out,bits,values,size,argv[argc-1]);
+            GRIB_CHECK(grib_set_long(result,"startStep",0), "startStep");
+            GRIB_CHECK(grib_set_long(result,"endStep",step),"endStep");
 
-			if(h != result)
-				grib_handle_delete(h);
-		}
+            output_field(result,out,bits,values,size,argv[argc-1]);
 
-		GRIB_CHECK(e,argv[argc-2]);
-	}
+            if(h != result)
+                grib_handle_delete(h);
+        }
 
-	if(result)
-		grib_handle_delete(result);
+        GRIB_CHECK(e,argv[argc-2]);
+    }
 
-	if(fclose(out))
-	{
-		perror(argv[argc-1]);
-		exit(1);
-	}
+    if(result)
+        grib_handle_delete(result);
 
+    if(fclose(out))
+    {
+        perror(argv[argc-1]);
+        exit(1);
+    }
 
-	return 0;
+    return 0;
 }
diff --git a/tigge/tigge_name.c b/tigge/tigge_name.c
index 0bdffce..c24d14a 100755
--- a/tigge/tigge_name.c
+++ b/tigge/tigge_name.c
@@ -27,11 +27,9 @@
 #include <sys/types.h>
 #include <dirent.h>
 
-
 #define CHECK(a) check(#a,a)
 #define NUMBER(a) (sizeof(a)/sizeof(a[0]))
 
-
 int error = 0;
 const char* file = 0;
 int field = 0;
@@ -41,235 +39,225 @@ int compare_mode = 0;
 
 void check(const char* name,int a)
 {
-	if(!a) {
-		printf("%s, field %d [%s]: %s failed\n",file,field,param,name);
-		error++;
-	}
+    if(!a) {
+        printf("%s, field %d [%s]: %s failed\n",file,field,param,name);
+        error++;
+    }
 }
 
-
-
-
 long get(grib_handle *h,const char* what)
 {
-	int e; long val;
-	if((e = grib_get_long(h,what,&val)) != GRIB_SUCCESS)
-	{
-		printf("%s, field %d [%s]: cannot get %s: %s\n",file,field,param,what,grib_get_error_message(e));
-		error++;
-		val = -1;
-	}
-	return val;
+    int e; long val;
+    if((e = grib_get_long(h,what,&val)) != GRIB_SUCCESS)
+    {
+        printf("%s, field %d [%s]: cannot get %s: %s\n",file,field,param,what,grib_get_error_message(e));
+        error++;
+        val = -1;
+    }
+    return val;
 }
 
 char* sget(grib_handle *h,const char* what,char* val,size_t size)
 {
-	int e; 
-	if((e = grib_get_string(h,what,val,&size)) != GRIB_SUCCESS)
-	{
-		printf("%s, field %d [%s]: cannot get %s: %s\n",file,field,param,what,grib_get_error_message(e));
-		error++;
-	}
-	return val;
+    int e; 
+    if((e = grib_get_string(h,what,val,&size)) != GRIB_SUCCESS)
+    {
+        printf("%s, field %d [%s]: cannot get %s: %s\n",file,field,param,what,grib_get_error_message(e));
+        error++;
+    }
+    return val;
 }
 
 
 double dget(grib_handle *h,const char* what)
 {
-	int e; double val;
-	if((e = grib_get_double(h,what,&val)) != GRIB_SUCCESS)
-	{
-		printf("%s, field %d [%s]: cannot get %s: %s\n",file,field,param,what,grib_get_error_message(e));
-		error++;
-		val = -1;
-	}
-	return val;
+    int e; double val;
+    if((e = grib_get_double(h,what,&val)) != GRIB_SUCCESS)
+    {
+        printf("%s, field %d [%s]: cannot get %s: %s\n",file,field,param,what,grib_get_error_message(e));
+        error++;
+        val = -1;
+    }
+    return val;
 }
 
 int missing(grib_handle *h,const char* what)
 {
-	int err=0;
-	return grib_is_missing(h,what,&err);
+    int err=0;
+    return grib_is_missing(h,what,&err);
 }
 
 int eq(grib_handle *h,const char* what,long value)
 {
-	return get(h,what) == value;
+    return get(h,what) == value;
 }
 
 int ne(grib_handle *h,const char* what,long value)
 {
-	return get(h,what) != value;
+    return get(h,what) != value;
 }
 
 int ge(grib_handle *h,const char* what,long value)
 {
-	return get(h,what) >= value;
+    return get(h,what) >= value;
 }
 
-
-/* 
- */
-
 void verify(grib_handle *h,const char* full,const char* base)
 {
-	char wmo_name[1024];
-	char origin[80];
-	char model[80];
-	char expver[80];
-	char levtype[80];
-	char type[80];
-	char tigge_name[80];
-
-	long level = 0;
-	long number = 0;
-
-	sget(h,"type",type,sizeof(type));
-	sget(h,"levtype",levtype,sizeof(levtype));
-
-	if(strcmp(type,"fc") != 0) 
-		number = get(h,"number");
-
-	if(strcmp(levtype,"sfc") == 0) 
-		strcpy(levtype,"sl");
-	else
-		level = get(h,"level");
-
-	sprintf(wmo_name,"z_tigge_c_%s_%08ld%04ld00_%s_%s_%s_%s_%04ld_%03ld_%04ld_%s.grib",
-			sget(h,"origin",origin,sizeof(origin)),
-			compare_mode?0:get(h,"date"),
-			compare_mode?0:get(h,"time"),
-			sget(h,"model",model,sizeof(model)),
-			compare_mode?"xxxx":sget(h,"expver",expver,sizeof(expver)),
-			type,
-			levtype,
-			get(h,"step"),
-			number,
-			level,
-			sget(h,"tigge_short_name",tigge_name,sizeof(tigge_name))
-
-		   );
-
-
-	if(list_mode)
-	{
-		printf("%s\n",wmo_name);
-	}
-	else if(strcmp(base,wmo_name) != 0) {
+    char wmo_name[1024];
+    char origin[80];
+    char model[80];
+    char expver[80];
+    char levtype[80];
+    char type[80];
+    char tigge_name[80];
+
+    long level = 0;
+    long number = 0;
+
+    sget(h,"type",type,sizeof(type));
+    sget(h,"levtype",levtype,sizeof(levtype));
+
+    if(strcmp(type,"fc") != 0) 
+        number = get(h,"number");
+
+    if(strcmp(levtype,"sfc") == 0) 
+        strcpy(levtype,"sl");
+    else
+        level = get(h,"level");
+
+    sprintf(wmo_name,"z_tigge_c_%s_%08ld%04ld00_%s_%s_%s_%s_%04ld_%03ld_%04ld_%s.grib",
+            sget(h,"origin",origin,sizeof(origin)),
+            compare_mode?0:get(h,"date"),
+            compare_mode?0:get(h,"time"),
+            sget(h,"model",model,sizeof(model)),
+            compare_mode?"xxxx":sget(h,"expver",expver,sizeof(expver)),
+            type,
+            levtype,
+            get(h,"step"),
+            number,
+            level,
+            sget(h,"tigge_short_name",tigge_name,sizeof(tigge_name))
+
+           );
+
+
+    if(list_mode)
+    {
+        printf("%s\n",wmo_name);
+    }
+    else if(strcmp(base,wmo_name) != 0) {
         printf("WRONG FILE NAME:   %s\nCORRECT FILE NAME: %s\n\n",base,wmo_name);
-		error++;
-	}
-
+        error++;
+    }
 }
 
 void validate(const char* path)
 {
-	FILE *f = fopen(path,"r");
-	grib_handle *h = 0;
-	int err;
-	int count = 0;
-	const char* base = path;
-	const char* p    = path;
-
-	file  = path;
-	field = 0;
-
-	while(*p) {
-		if(*p == '/') base = p+1;
-		p++;
-	}
-
-	if(!f) {
-		printf("%s: %s\n",path,strerror(errno));
-		error++;
-		return;
-	}
-
-	while( (h= grib_handle_new_from_file(0,f,&err)) != NULL)
-	{
-		++field;
-		verify(h,path,base);
-		grib_handle_delete(h);
-		count++;
-		param = "unknown";
-	}
-	fclose(f);
-
-	if(err) {
-		printf("%s: grib_handle_new_from_file: %s\n",path,grib_get_error_message(err));
-		error++;
-		return;
-	}
-
-	if(count == 0) {
-		printf("%s does not contain any GRIBs\n",path);
-		error++;
-		return;
-	}
-
+    FILE *f = fopen(path,"r");
+    grib_handle *h = 0;
+    int err;
+    int count = 0;
+    const char* base = path;
+    const char* p    = path;
+
+    file  = path;
+    field = 0;
+
+    while(*p) {
+        if(*p == '/') base = p+1;
+        p++;
+    }
+
+    if(!f) {
+        printf("%s: %s\n",path,strerror(errno));
+        error++;
+        return;
+    }
+
+    while( (h= grib_handle_new_from_file(0,f,&err)) != NULL)
+    {
+        ++field;
+        verify(h,path,base);
+        grib_handle_delete(h);
+        count++;
+        param = "unknown";
+    }
+    fclose(f);
+
+    if(err) {
+        printf("%s: grib_handle_new_from_file: %s\n",path,grib_get_error_message(err));
+        error++;
+        return;
+    }
+
+    if(count == 0) {
+        printf("%s does not contain any GRIBs\n",path);
+        error++;
+        return;
+    }
 }
 
 void usage()
 {
-	printf("tigge_name [-l] [-c] files ....\n");
-	exit(1);
+    printf("tigge_name [-l] [-c] files ....\n");
+    exit(1);
 }
 
 void scan(const char* name)
 {
-	DIR *dir;
-	if((dir = opendir(name)) != NULL)
-	{
-		struct dirent* e;
-		char tmp[1024];
-		while( (e = readdir(dir)) != NULL)
-		{
-			if(e->d_name[0] == '.') continue;
-			sprintf(tmp,"%s/%s",name,e->d_name);
-			scan(tmp);
-		}
-
-		closedir(dir);
-	}
-	else
-		validate(name);
+    DIR *dir;
+    if((dir = opendir(name)) != NULL)
+    {
+        struct dirent* e;
+        char tmp[1024];
+        while( (e = readdir(dir)) != NULL)
+        {
+            if(e->d_name[0] == '.') continue;
+            sprintf(tmp,"%s/%s",name,e->d_name);
+            scan(tmp);
+        }
+
+        closedir(dir);
+    }
+    else
+        validate(name);
 }
 
-int main(int argc,const char** argv)
+int main(int argc, char** argv)
 {
-	int i = 1;
-	int err = 0;
-
-	if(argc == 1)
-		usage();
-
-	for(; i < argc; i++)
-	{
-		error = 0;
-
-		if(argv[i][0] == '-')
-		{
-			switch(argv[i][1])
-			{
-				case 'l':
-					list_mode = 1;
-					break;
-
-				case 'c':
-					list_mode = 1;
-					compare_mode = 1;
-					break;
-
-				default:
-					usage();
-					break;
-			}
-		}
-		else scan(argv[i]);
-
-		if(error) err = 1;
-	}
-
-
-	return err;
+    int i = 1;
+    int err = 0;
+
+    if(argc == 1)
+        usage();
+
+    for(; i < argc; i++)
+    {
+        error = 0;
+
+        if(argv[i][0] == '-')
+        {
+            switch(argv[i][1])
+            {
+                case 'l':
+                    list_mode = 1;
+                    break;
+
+                case 'c':
+                    list_mode = 1;
+                    compare_mode = 1;
+                    break;
+
+                default:
+                    usage();
+                    break;
+            }
+        }
+        else scan(argv[i]);
+
+        if(error) err = 1;
+    }
+
+    return err;
 }
diff --git a/tigge/tigge_split.c b/tigge/tigge_split.c
index c155ab5..e6524f3 100755
--- a/tigge/tigge_split.c
+++ b/tigge/tigge_split.c
@@ -211,7 +211,7 @@ static void usage()
     exit(1);
 }
 
-int main(int argc,const char** argv)
+int main(int argc, char** argv)
 {
     int i = 1;
 
diff --git a/tools/bufr_dump.c b/tools/bufr_dump.c
index 505ba21..31ee77f 100644
--- a/tools/bufr_dump.c
+++ b/tools/bufr_dump.c
@@ -35,8 +35,10 @@ grib_option grib_options[]={
                 "\n\t\t         C       -> C program to encode the input BUFR"
                 "\n\t\tDefault mode is filter.\n",
                 0,1,"filter"},
+
         {"S",0,0,1,0,0},
         {"O",0,"Octet mode. WMO documentation style dump.\n",0,1,0},
+        {"p",0,"Plain dump.\n",0,1,0},
         /* {"D",0,0,0,1,0},  */  /* See ECC-215 */
         {"d",0,"Print all data values.\n",1,1,0},
         {"u",0,"Print only some values.\n",0,1,0},
@@ -110,6 +112,11 @@ int grib_tool_init(grib_runtime_options* options)
                 | GRIB_DUMP_FLAG_READ_ONLY;
     }
 
+    if  (grib_options_on("p")) {
+        options->dump_mode = "bufr_simple";
+        json=0;
+    }
+
     if (grib_options_on("D:")) {
         options->dump_mode = grib_options_get_option("D:");
         json=0;
@@ -171,7 +178,7 @@ int grib_tool_new_file_action(grib_runtime_options* options,grib_tools_file* fil
     else {
         char tmp[1024];
         sprintf(tmp,"FILE: %s ",options->current_infile->name);
-        if (!grib_options_on("C"))
+        if (!grib_options_on("p"))
             fprintf(stdout,"***** %s\n",tmp);
     }
 
diff --git a/tools/bufr_index_build.c b/tools/bufr_index_build.c
index 1544b8b..72d2b28 100644
--- a/tools/bufr_index_build.c
+++ b/tools/bufr_index_build.c
@@ -106,11 +106,10 @@ void grib_tool_print_key_values(grib_runtime_options* options,grib_handle* h)
 
 int grib_tool_finalise_action(grib_runtime_options* options)
 {
-    grib_index_key* keys;
+    grib_index_key* the_keys;
     grib_string_list* values;
     int first;
 
-
     if (compress_index) {
         grib_index_compress(idx);
     }
@@ -118,18 +117,18 @@ int grib_tool_finalise_action(grib_runtime_options* options)
             grib_tool_name,options->outfile->name);
     printf("--- ");
     first=1;
-    keys=idx->keys;
-    while (keys) {
+    the_keys=idx->keys;
+    while (the_keys) {
         if (!first) printf(", ");
-        printf("%s",keys->name);
-        keys=keys->next;
+        printf("%s",the_keys->name);
+        the_keys=the_keys->next;
         first=0;
     }
     printf("\n");
-    keys=idx->keys;
-    while (keys) {
-        printf("--- %s = { ",keys->name);
-        values=keys->values;
+    the_keys=idx->keys;
+    while (the_keys) {
+        printf("--- %s = { ",the_keys->name);
+        values=the_keys->values;
         first=1;
         while (values) {
             if (!first) printf(", ");
@@ -138,7 +137,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
             values=values->next;
         }
         printf(" }\n");
-        keys=keys->next;
+        the_keys=the_keys->next;
     }
     printf("--- %d messages indexed\n",idx->count);
 
diff --git a/tools/codes_count.c b/tools/codes_count.c
index fbcdc32..f438ac4 100644
--- a/tools/codes_count.c
+++ b/tools/codes_count.c
@@ -10,7 +10,7 @@
 
 #include "grib_api_internal.h"
 
-void usage(const char* prog)
+static void usage(const char* prog)
 {
     printf("usage: %s [-v] infile1 infile2 ... \n",prog);
     exit(1);
@@ -73,7 +73,9 @@ int main(int argc,char* argv[])
         count_curr=0;
         err=count_messages(infh, message_type, &count_curr);
         if (err) {
-            fprintf(stderr,"Invalid message(s) found in %s\n", filename);
+            fprintf(stderr,"Invalid message(s) found in %s", filename);
+            if (count_curr>0) fprintf(stderr," (got as far as %lu)", count_curr);
+            fprintf(stderr,"\n");
             exit(err);
 #ifdef DONT_EXIT_ON_BAD_APPLE
             /* If we did not want to fail but warn and continue */
diff --git a/tools/codes_info.c b/tools/codes_info.c
index e8bb14f..5df1ef9 100644
--- a/tools/codes_info.c
+++ b/tools/codes_info.c
@@ -10,7 +10,10 @@
 
 #include "grib_tools.h"
 
-void usage(const char*);
+static void usage_and_exit(const char* progname) {
+    printf("\nUsage: %s [-v] [-d] [-s]\n",progname);
+    exit(1);
+}
 
 #define INFO_PRINT_ALL              0
 #define INFO_PRINT_VERSION          (1<<0)
@@ -43,12 +46,12 @@ int main( int argc,char* argv[])
             print_flags|=INFO_PRINT_SAMPLES_PATH;
             break;
         default:
-            usage(argv[0]);
+            usage_and_exit(argv[0]);
         }
     }
 
     nfiles=argc-optind;
-    if (nfiles != 0) usage(argv[0]);
+    if (nfiles != 0) usage_and_exit(argv[0]);
 
     if (print_flags ==  INFO_PRINT_ALL) {
         printf("\n");
@@ -114,8 +117,3 @@ int main( int argc,char* argv[])
 
     return 0;
 }
-
-void usage(const char* progname) {
-    printf("\nUsage: %s [-v] [-d] [-s]\n",progname);
-    exit(1);
-}
diff --git a/tools/grib2ppm.c b/tools/grib2ppm.c
index ec331d1..2bf8033 100644
--- a/tools/grib2ppm.c
+++ b/tools/grib2ppm.c
@@ -37,7 +37,7 @@ unsigned char unused(char c)
 }
 */
 
-int next(FILE *f, char *buf)
+static int next(FILE *f, char *buf)
 {
     int c;
     int i = 0;
diff --git a/tools/grib_get.c b/tools/grib_get.c
index ee69a6f..1e37581 100644
--- a/tools/grib_get.c
+++ b/tools/grib_get.c
@@ -177,7 +177,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options,grib_handle* h)
     }
 
     if (options->latlon) {
-        int err=0;
+        err=0;
         double min;
         int i;
         if (!n) n=grib_nearest_new(h,&err);
diff --git a/tools/grib_get_data.c b/tools/grib_get_data.c
index c1d137f..0df164d 100644
--- a/tools/grib_get_data.c
+++ b/tools/grib_get_data.c
@@ -70,18 +70,6 @@ int grib_tool_new_file_action(grib_runtime_options* options,grib_tools_file* fil
     return 0;
 }
 
-/* Return 1 if the GRIB message has missing values encoded in data section and not in bitmap */
-/* e.g. grid_complex_spatial_differencing with missingValueManagementUsed enabled */
-static int hasMissingValuesButNoBitmap(grib_handle* h)
-{
-    long missingValueManagementUsed = 0;
-    int err = grib_get_long(h, "missingValueManagementUsed", &missingValueManagementUsed);
-    if (!err) {
-        /* Key exists */
-        return (missingValueManagementUsed!=0);
-    }
-    return 0;
-}
 int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
 {
     int err=0;
@@ -101,10 +89,8 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
     size_t bmp_len = 0;
     double *data_values=0,*lats=0,*lons=0;
     int n = 0;
-    size_t size=0;
-    /* Cater for GRIBs which have missing values but no bitmap! */
-    /* e.g. grid_complex_spatial_differencing with 'missingValueManagementUsed' enabled */
-    const int missingValuesButNoBitmap = hasMissingValuesButNoBitmap(h);
+    size_t size=0, num_bytes=0;
+    long hasMissingValues = 0;
 
     if (grib_options_on("m:")) {
         /* User wants to see missing values */
@@ -139,10 +125,11 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
 
     iter=grib_iterator_new(h,0,&err);
 
+    num_bytes = (numberOfPoints+1)*sizeof(double);
     data_values=(double*)calloc(numberOfPoints+1, sizeof(double));
     if (!data_values) {
         fprintf(dump_file, "ERROR: failed to allocate %ld bytes for data values (number of points=%ld)\n",
-                (numberOfPoints+1)*sizeof(double), numberOfPoints);
+                (long)num_bytes, numberOfPoints);
         exit(GRIB_OUT_OF_MEMORY);
     }
 
@@ -171,6 +158,9 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
         exit(err);
     }
 
+    /* Cater for GRIBs which have missing values but no bitmap */
+    /* See ECC-511 */
+    GRIB_CHECK(grib_get_long(h,"missingValuesPresent",&hasMissingValues),0);
     GRIB_CHECK(grib_get_long(h,"bitmapPresent",&bitmapPresent),0);
     if (bitmapPresent)
     {
@@ -196,9 +186,10 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
     if (skip_missing==0){
         /* Show missing values in data */
         for (i=0;i<numberOfPoints;i++) {
-            int is_missing_val = (bitmapPresent && bitmap[i] == 0);
-            if (!bitmapPresent && missingValuesButNoBitmap) {
-                is_missing_val = (data_values[i] == missingValue);
+            int is_missing_val = 0;
+            if (hasMissingValues) {
+                if (bitmapPresent) is_missing_val = (bitmap[i] == 0);
+                else is_missing_val = (data_values[i] == missingValue);
             }
             if (iter) fprintf(dump_file,"%9.3f%9.3f ",lats[i],lons[i]);
 
@@ -216,9 +207,10 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
     } else if ( skip_missing==1 ){
         /* Skip the missing values in data */
         for (i=0;i<numberOfPoints;i++) {
-            int is_missing_val = (bitmapPresent && bitmap[i] == 0);
-            if (!bitmapPresent && missingValuesButNoBitmap) {
-                is_missing_val = (data_values[i] == missingValue);
+            int is_missing_val = 0;
+            if (hasMissingValues) {
+                if (bitmapPresent) is_missing_val = (bitmap[i] == 0);
+                else is_missing_val = (data_values[i] == missingValue);
             }
             if (!is_missing_val){
                 if (iter) fprintf(dump_file,"%9.3f%9.3f ",lats[i],lons[i]);
diff --git a/tools/grib_histogram.c b/tools/grib_histogram.c
index 07de754..7c735c9 100644
--- a/tools/grib_histogram.c
+++ b/tools/grib_histogram.c
@@ -16,7 +16,7 @@ static void usage(const char *prog)
     exit(1);
 }
 
-int main(int argc, const char *argv[])
+int main(int argc, char *argv[])
 {
     int i,j;
     FILE *in;
@@ -60,7 +60,7 @@ int main(int argc, const char *argv[])
                 values = (double*)malloc(size*sizeof(double));
                 last_size = size;
                 if (!values) {
-                    fprintf(stderr, "Failed to allocate memory for values (%ld bytes)\n", size*sizeof(double));
+                    fprintf(stderr, "Failed to allocate memory for values (%lu bytes)\n", size*sizeof(double));
                     exit(1);
                 }
             }
diff --git a/tools/grib_ls.c b/tools/grib_ls.c
index ac06c4f..00861da 100644
--- a/tools/grib_ls.c
+++ b/tools/grib_ls.c
@@ -268,7 +268,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
     }
 
     if (options->latlon) {
-        int err=0;
+        err=0;
         double min;
         if (!n) n=grib_nearest_new(h,&err);
         if (err == GRIB_NOT_IMPLEMENTED) {
diff --git a/tools/grib_merge.c b/tools/grib_merge.c
index 6e1144e..0812741 100644
--- a/tools/grib_merge.c
+++ b/tools/grib_merge.c
@@ -78,7 +78,7 @@ int grib_tool_new_file_action(grib_runtime_options* options,grib_tools_file* fil
     return 0;
 }
 
-int idx(double lat,double lon,double latFirst,double lonFirst,double latLast,double lonLast,
+static int idx(double lat,double lon,double latFirst,double lonFirst,double latLast,double lonLast,
         long Ni,double di,double dj)
 {
     long ilon,ilat;
@@ -96,7 +96,7 @@ int idx(double lat,double lon,double latFirst,double lonFirst,double latLast,dou
     return ilon+ilat*Ni;
 }
 
-grib_handle* merge(grib_handle* h1,grib_handle* h2)
+static grib_handle* merge(grib_handle* h1,grib_handle* h2)
 {
     char s1[100]={0,};
     size_t len1;
diff --git a/tools/grib_to_netcdf.c b/tools/grib_to_netcdf.c
index 964eb8b..bf4946c 100644
--- a/tools/grib_to_netcdf.c
+++ b/tools/grib_to_netcdf.c
@@ -1843,6 +1843,8 @@ typedef struct ncoptions {
     request *mars_description;
     boolean mmeans; /* Whether this dataset is Monthly Means */
     boolean climatology; /* Whether this dataset is climatology */
+    boolean shuffle;
+    long deflate;
 } ncoptions_t;
 
 ncoptions_t setup;
@@ -2044,11 +2046,15 @@ static void get_nc_options(const request *user_r)
     const char *checkvalidtime_env = NULL;
     const char *validtime = get_value(user_r, "usevalidtime", 0);
     const char *refdate = get_value(user_r, "referencedate", 0);
+    const char *shuffle = get_value(user_r, "shuffle", 0);
+    const char *deflate = get_value(user_r, "deflate", 0);
 
     const char *title = get_value(user_r, "title", 0);
     const char *history = get_value(user_r, "history", 0);
     const char *unlimited = get_value(user_r, "unlimited", 0);
 
+    setup.shuffle = shuffle ? (strcmp(shuffle, "true") == 0) : FALSE;
+    setup.deflate = deflate ? ((strcmp(deflate, "none") == 0) ? -1 : atol(deflate)) : -1;
     setup.usevalidtime = validtime ? (strcmp(validtime, "true") == 0) : FALSE;
     setup.refdate = refdate ? atol(refdate) : 19000101;
     setup.auto_refdate = refdate ? (strcmp(get_value(user_r, "referencedate", 0), "AUTOMATIC") == 0) : FALSE;
@@ -2856,10 +2862,34 @@ static int define_netcdf_dimensions(hypercube *h, fieldset *fs, int ncid, datase
     int var_id = 0; /* Variable ID */
     int dims[1024];
 
+    size_t chunks[NC_MAX_DIMS] = {0,}; /* For chunking */
+    err e = 0;
+    
+    long ni;
+    long nj;
+    
+    field *f = get_field(fs, 0, expand_mem);
+    if((e = grib_get_long(f->handle, "Ni", &ni)) != GRIB_SUCCESS) {
+        grib_context_log(ctx, GRIB_LOG_ERROR, "ecCodes: cannot get Ni %s", grib_get_error_message(e));
+        return e;
+    }
+    if ((e = grib_get_long(f->handle, "Nj", &nj)) != GRIB_SUCCESS) {
+        grib_context_log(ctx, GRIB_LOG_ERROR, "ecCodes: cannot get Nj %s", grib_get_error_message(e));
+        return e;
+    }
+    release_field(f);
+
+    /* Count dimensions per axis */
+    for(i = 0; i < naxis; ++i)
+        chunks[naxis - i - 1] = 1;
+
+    chunks[naxis] = nj; /* latitude */
+    chunks[naxis + 1] = ni; /* longitude */
+
     /* START DEFINITIONS */
 
     /* Define latitude/longitude dimensions */
-    err e = def_latlon(ncid, fs);
+    e = def_latlon(ncid, fs);
     if (e != GRIB_SUCCESS)
         return e;
 
@@ -3004,12 +3034,20 @@ static int define_netcdf_dimensions(hypercube *h, fieldset *fs, int ncid, datase
 
     for(i = 0; i < subsetcnt; ++i)
     {
-
         printf("%s: Defining variable '%s'.\n", grib_tool_name, subsets[i].att.name);
 
         stat = nc_def_var(ncid, subsets[i].att.name, subsets[i].att.nctype, n, dims, &var_id);
         check_err(stat, __LINE__, __FILE__);
 
+        if (setup.deflate > -1)
+        {
+            stat = nc_def_var_chunking(ncid, var_id, NC_CHUNKED, chunks);
+            check_err(stat, __LINE__, __FILE__);
+
+            /* Set compression settings for a variable */
+            stat = nc_def_var_deflate(ncid, var_id, setup.shuffle, 1, setup.deflate);
+            check_err(stat, __LINE__, __FILE__);
+        }
         if(subsets[i].scale)
         {
             compute_scale(&subsets[i]);
@@ -3835,6 +3873,10 @@ grib_option grib_options[] = {
                 "\n\t\t3 -> netCDF-4 file format"
                 "\n\t\t4 -> netCDF-4 classic model file format\n"
                 , 0, 1, "2" },
+        { "d:", "level",          "\n\t\tDeflate data (compression level). Only for netCDF-4 output format."
+                "\n\t\tPossible values [0,9]. Default None." 
+                "\n\t\tChunking strategy based on GRIB message.\n", 0, 1, "6" },
+        { "s", 0, "Shuffle data before deflation compression.\n", 0, 1, 0 },
         { "u:", "dimension",  "\n\t\tSet dimension to be an unlimited dimension.\n", 0, 1, "time" }
 };
 
@@ -3843,6 +3885,7 @@ static fieldset *fs = NULL;
 static request* data_r = NULL;
 request *user_r = NULL;
 static int option_kind = 2; /* By default NetCDF3, 64-bit offset */
+static int deflate_option = 0;
 
 /* Table of formats for legal -k values. Inspired by nccopy */
 struct KindValue {
@@ -3978,6 +4021,43 @@ int grib_tool_init(grib_runtime_options* options)
         }
     }
 
+    if (grib_options_on("d:"))
+    {
+        if (option_kind == 3 || option_kind == 4) { /* netCDF-4 */
+            char* theArg = grib_options_get_option("d:");
+            if (!is_number(theArg) || atol(theArg)<0 || atol(theArg)>9 ) {
+                fprintf(stderr, "Invalid deflate option: %s (must be 0 to 9)\n", theArg);
+                usage();
+                exit(1);
+            }
+            set_value(user_r, "deflate", theArg);
+            deflate_option=1;
+        } else {
+            fprintf(stderr, "Invalid deflate option for non netCDF-4 output formats\n");
+            usage();
+            exit(1);
+        }
+    }
+    else
+    {
+        set_value(user_r, "deflate", "none");
+    }
+
+    if(grib_options_on("s"))
+    {
+        if(deflate_option)
+            set_value(user_r, "shuffle", "true");
+        else
+        {
+            fprintf(stderr, "Invalid shuffle option. Deflate option needed.\n");
+            usage();
+            exit(1);
+        }
+
+    }
+    else
+        set_value(user_r, "shuffle", "false");
+
     if(grib_options_on("R:"))
     {
         char* theArg = grib_options_get_option("R:");
diff --git a/tools/grib_tools.c b/tools/grib_tools.c
index 64bda06..6b07135 100644
--- a/tools/grib_tools.c
+++ b/tools/grib_tools.c
@@ -890,9 +890,9 @@ void grib_print_key_values(grib_runtime_options* options, grib_handle* h)
     if (options->latlon) {
 
         if (options->latlon_mode==4){
-            int i=0;
-            for (i=0;i<4;i++) {
-                fprintf(dump_file,options->format,options->values[i]);
+            int ii=0;
+            for (ii=0;ii<4;ii++) {
+                fprintf(dump_file,options->format,options->values[ii]);
                 fprintf(dump_file," ");
             }
             written_to_dump=1;
diff --git a/tools/gts_compare.c b/tools/gts_compare.c
index ee967ab..50c6bce 100644
--- a/tools/gts_compare.c
+++ b/tools/gts_compare.c
@@ -262,10 +262,10 @@ static void printInfo(grib_handle* h)
     lastPrint=count;
 }
 
-static void print_index_key_values(grib_index* index,int counter,const char* error_message)
+static void print_index_key_values(grib_index* index,int cnt,const char* error_message)
 {
     grib_index_key* keys=index->keys;
-    printf("== %d == ",counter);
+    printf("== %d == ", cnt);
     if (error_message) printf("%s == ",error_message);
     while (keys) {
         printf("%s=%s ",keys->name,keys->value);
diff --git a/tools/gts_ls.c b/tools/gts_ls.c
index cf81924..6c6bf15 100644
--- a/tools/gts_ls.c
+++ b/tools/gts_ls.c
@@ -36,7 +36,7 @@ char* grib_tool_description="List content of GTS files printing values of "
         "some keys.\n\tIt does not fail when a key is not found.";
 char* grib_tool_name="gts_ls";
 char* grib_tool_usage="[options] file file ...";
-static char* new_handle="";
+/*static char* new_handle="";*/
 
 int grib_options_count=sizeof(grib_options)/sizeof(grib_option);
 int mode=0;
@@ -95,7 +95,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
         if( err != GRIB_SUCCESS && options->fail) exit(err);
     }
 
-    new_handle="\n,";
+    /*new_handle="\n,";*/
     return 0;
 }
 
diff --git a/tools/metar_ls.c b/tools/metar_ls.c
index 63c71aa..e5e145f 100644
--- a/tools/metar_ls.c
+++ b/tools/metar_ls.c
@@ -239,7 +239,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) {
   }
   
   if (options->latlon) {
-    int err=0;
+    err=0;
 	double min;
     if (!n) n=grib_nearest_new(h,&err);
     GRIB_CHECK_NOLINE(err,0);
diff --git a/version.sh b/version.sh
index 9495f0d..554b356 100644
--- a/version.sh
+++ b/version.sh
@@ -14,8 +14,8 @@ PACKAGE_NAME='eccodes'
 
 # Package version
 ECCODES_MAJOR_VERSION=2
-ECCODES_MINOR_VERSION=4
-ECCODES_REVISION_VERSION=1
+ECCODES_MINOR_VERSION=5
+ECCODES_REVISION_VERSION=0
 
 ECCODES_CURRENT=1
 ECCODES_REVISION=0
diff --git a/windows/msvc/grib_api_lib/grib_api_lib.vcproj b/windows/msvc/grib_api_lib/grib_api_lib.vcproj
index 69494c0..4908184 100644
--- a/windows/msvc/grib_api_lib/grib_api_lib.vcproj
+++ b/windows/msvc/grib_api_lib/grib_api_lib.vcproj
@@ -1685,6 +1685,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\..\src\grib_nearest_class_polar_stereographic.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\..\src\grib_nearest_class_reduced.c"
 				>
 			</File>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/eccodes.git



More information about the debian-science-commits mailing list