[magics] 59/63: new release 2.31.0

Alastair McKinstry mckinstry at moszumanska.debian.org
Fri Mar 24 10:41:55 UTC 2017


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

mckinstry pushed a commit to branch debian/master
in repository magics.

commit 227606316a5fb7f1660b0ed909d40de533da26f9
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Tue Feb 21 06:26:51 2017 +0000

    new release 2.31.0
---
 CMakeLists.txt                                   |  29 +-
 VERSION.cmake                                    |   4 +-
 cmake/FindADSM.cmake                             |   2 +-
 cmake/FindAEC.cmake                              |   2 +-
 cmake/FindAIO.cmake                              |   2 +-
 cmake/FindArmadillo.cmake                        |   2 +-
 cmake/FindCMath.cmake                            |   2 +-
 cmake/FindDl.cmake                               |   2 +-
 cmake/FindEMOS.cmake                             |   2 +-
 cmake/FindFDB.cmake                              |   2 +-
 cmake/FindFFTW.cmake                             |   2 +-
 cmake/FindGeoTIFF.cmake                          |   2 +-
 cmake/FindHPSS.cmake                             |   2 +-
 cmake/FindLEX.cmake                              |   2 +-
 cmake/FindLibGFortran.cmake                      |   2 +-
 cmake/FindLibIFort.cmake                         |   2 +-
 cmake/FindLustreAPI.cmake                        |  43 +++
 cmake/FindMKL.cmake                              |   2 +-
 cmake/FindNDBM.cmake                             |   2 +-
 cmake/FindNetCDF.cmake                           |   2 +-
 cmake/FindNetCDF3.cmake                          |   2 +-
 cmake/FindODB.cmake                              |   2 +-
 cmake/FindOpenCL.cmake                           |   2 +-
 cmake/FindOpenJPEG.cmake                         |   2 +-
 cmake/FindPGIFortran.cmake                       |   2 +-
 cmake/FindPango.cmake                            |   2 +-
 cmake/FindPangoCairo.cmake                       |   2 +-
 cmake/FindREADLINE.cmake                         |   2 +-
 cmake/FindRPCGEN.cmake                           |   2 +-
 cmake/FindRealtime.cmake                         |   2 +-
 cmake/FindSZip.cmake                             |   2 +-
 cmake/FindTrilinos.cmake                         |   2 +-
 cmake/FindViennaCL.cmake                         |   2 +-
 cmake/FindXLFortranLibs.cmake                    |   2 +-
 cmake/FindYACC.cmake                             |   2 +-
 cmake/Findgrib_api.cmake                         |   2 +-
 cmake/Findodb_api.cmake                          |   2 +-
 cmake/Findspot.cmake                             |   2 +-
 cmake/VERSION.cmake                              |   6 +-
 cmake/compiler_flags/Clang_C.cmake               |   2 +-
 cmake/compiler_flags/Clang_CXX.cmake             |   2 +-
 cmake/compiler_flags/Cray_C.cmake                |   2 +-
 cmake/compiler_flags/Cray_CXX.cmake              |   2 +-
 cmake/compiler_flags/Cray_Fortran.cmake          |   2 +-
 cmake/compiler_flags/GNU_C.cmake                 |   2 +-
 cmake/compiler_flags/GNU_CXX.cmake               |   2 +-
 cmake/compiler_flags/GNU_Fortran.cmake           |   2 +-
 cmake/compiler_flags/Intel_C.cmake               |   2 +-
 cmake/compiler_flags/Intel_CXX.cmake             |   2 +-
 cmake/compiler_flags/Intel_Fortran.cmake         |   2 +-
 cmake/compiler_flags/PGI_C.cmake                 |   2 +-
 cmake/compiler_flags/PGI_CXX.cmake               |   2 +-
 cmake/compiler_flags/PGI_Fortran.cmake           |   2 +-
 cmake/ecbuild_add_c_flags.cmake                  |   2 +-
 cmake/ecbuild_add_cxx11_flags.cmake              |   2 +-
 cmake/ecbuild_add_cxx_flags.cmake                |   2 +-
 cmake/ecbuild_add_executable.cmake               |  70 +++--
 cmake/ecbuild_add_extra_search_paths.cmake       |   2 +-
 cmake/ecbuild_add_fortran_flags.cmake            |   2 +-
 cmake/ecbuild_add_library.cmake                  | 114 +++++---
 cmake/ecbuild_add_option.cmake                   |  71 +++--
 cmake/ecbuild_add_persistent.cmake               |   2 +-
 cmake/ecbuild_add_resources.cmake                |   2 +-
 cmake/ecbuild_add_test.cmake                     |   2 +-
 cmake/ecbuild_append_to_rpath.cmake              |   2 +-
 cmake/ecbuild_bundle.cmake                       |  21 +-
 cmake/ecbuild_cache.cmake                        |   2 +-
 cmake/ecbuild_check_c_source_return.cmake        |   2 +-
 cmake/ecbuild_check_compiler.cmake               |   2 +-
 cmake/ecbuild_check_cxx11.cmake                  |   2 +-
 cmake/ecbuild_check_cxx_source_return.cmake      |   2 +-
 cmake/ecbuild_check_fortran.cmake                |   2 +-
 cmake/ecbuild_check_fortran_source_return.cmake  |   2 +-
 cmake/ecbuild_check_functions.cmake              |   2 +-
 cmake/ecbuild_check_os.cmake                     | 335 +++++++++++------------
 cmake/ecbuild_compiler_flags.cmake               |   8 +-
 cmake/ecbuild_config.h.in                        |   2 +-
 cmake/ecbuild_declare_project.cmake              |   2 +-
 cmake/ecbuild_define_build_types.cmake           |   2 +-
 cmake/ecbuild_define_libs_and_execs_target.cmake |   2 +-
 cmake/ecbuild_define_links_target.cmake          |   2 +-
 cmake/ecbuild_define_options.cmake               |   2 +-
 cmake/ecbuild_define_paths.cmake                 |   2 +-
 cmake/ecbuild_dont_pack.cmake                    |   2 +-
 cmake/ecbuild_download_resource.cmake            |  34 ++-
 cmake/ecbuild_echo_targets.cmake                 |   2 +-
 cmake/ecbuild_enable_fortran.cmake               |  10 +-
 cmake/ecbuild_features.cmake                     |  43 +--
 cmake/ecbuild_find_fortranlibs.cmake             |   2 +-
 cmake/ecbuild_find_lexyacc.cmake                 |   2 +-
 cmake/ecbuild_find_mpi.cmake                     |   2 +-
 cmake/ecbuild_find_omp.cmake                     |   2 +-
 cmake/ecbuild_find_package.cmake                 |  81 ++++--
 cmake/ecbuild_find_perl.cmake                    |   2 +-
 cmake/ecbuild_find_python.cmake                  |  55 +++-
 cmake/ecbuild_generate_config_headers.cmake      |   2 +-
 cmake/ecbuild_generate_fortran_interfaces.cmake  |   2 +-
 cmake/ecbuild_generate_rpc.cmake                 |   2 +-
 cmake/ecbuild_generate_yy.cmake                  |   2 +-
 cmake/ecbuild_get_cxx11_flags.cmake              |   2 +-
 cmake/ecbuild_get_date.cmake                     |   2 +-
 cmake/ecbuild_get_resources.cmake                |   2 +-
 cmake/ecbuild_get_test_data.cmake                |  21 +-
 cmake/ecbuild_git.cmake                          |   2 +-
 cmake/ecbuild_install_project.cmake              |  37 ++-
 cmake/ecbuild_list_add_pattern.cmake             |   2 +-
 cmake/ecbuild_list_exclude_pattern.cmake         |   2 +-
 cmake/ecbuild_list_extra_search_paths.cmake      |   2 +-
 cmake/ecbuild_list_macros.cmake                  |   2 +-
 cmake/ecbuild_log.cmake                          |  46 +---
 cmake/ecbuild_pkgconfig.cmake                    |   2 +-
 cmake/ecbuild_policies.cmake                     |   2 +-
 cmake/ecbuild_print_summary.cmake                |  18 +-
 cmake/ecbuild_project_files.cmake                |   2 +-
 cmake/ecbuild_remove_fortran_flags.cmake         |   2 +-
 cmake/ecbuild_requires_macro_version.cmake       |   2 +-
 cmake/ecbuild_separate_sources.cmake             |  26 +-
 cmake/ecbuild_source_flags.cmake                 |   2 +-
 cmake/ecbuild_system.cmake                       |  14 +-
 cmake/ecbuild_target_flags.cmake                 |   2 +-
 cmake/ecbuild_use_package.cmake                  |  57 +++-
 cmake/ecbuild_version.h.in                       |   2 +-
 cmake/ecbuild_warn_unused_files.cmake            |   2 +-
 cmake/gen_source_flags.py                        |   2 +-
 cmake/include/ecbuild/boost_test_framework.h     |   2 +-
 cmake/sg.pl                                      |   2 +-
 python/Magics/macro.py                           |   4 +-
 python/Magics/toolbox.py                         |  37 +++
 share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake   |  14 +-
 share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake    |  14 +-
 share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake  |  14 +-
 share/magics/table_128.xml                       |  36 +++
 src/common/BinaryObject.h                        |   3 +-
 src/common/LogoPlotting.cc                       |   8 +-
 src/common/Matrix.cc                             | 212 +++++---------
 src/common/Matrix.h                              |  12 +
 src/common/MatrixHandler.h                       |  61 ++++-
 src/common/PolarStereographicProjection.cc       |  21 +-
 src/common/Proj4Projection.cc                    |  28 +-
 src/common/Proj4Projection.h                     |   1 +
 src/decoders/GribRegularInterpretor.cc           |   2 +-
 src/decoders/GribSatelliteInterpretor.cc         |  37 ++-
 src/decoders/GribSatelliteInterpretor.h          |   2 +-
 src/decoders/NetcdfGeoMatrixInterpretor.cc       |  17 +-
 src/drivers/BaseDriver.cc                        |   4 +-
 src/drivers/BaseDriver.h                         |   1 +
 src/drivers/BaseDriverWind.h                     |   4 +-
 src/drivers/BinaryDriver.cc                      | 128 ++++-----
 src/drivers/CairoDriver-blur.h                   | 121 ++++++++
 src/drivers/CairoDriver.cc                       |  31 ++-
 src/drivers/CairoDriver.h                        |   5 +-
 src/drivers/PostScriptDriver.cc                  |  45 ++-
 src/drivers/SVGDriver.cc                         |   2 +-
 src/params/Bar.xml                               |   3 +
 src/params/BinaryObject.xml                      |   7 +-
 src/params/CMakeLists.txt                        |   1 -
 src/params/Contour.xml                           |   2 +-
 src/params/NetcdfInterpretor.xml                 |   2 +-
 src/params/ObsPlotting.xml                       |   3 +
 src/visualisers/AutomaticContourMethod.h         |  54 +---
 src/visualisers/Bar.cc                           | 171 +++++++++++-
 src/visualisers/Bar.h                            |   9 +
 src/visualisers/Contour.cc                       |   2 +-
 src/visualisers/EpsGraph.cc                      |   2 +-
 src/visualisers/ObsItemFamily.cc                 |  35 ++-
 src/web/WrepJSon.cc                              |  12 +-
 166 files changed, 1647 insertions(+), 871 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d58af07..6b7275c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,22 +35,32 @@ set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}
 
 include( ecbuild_system NO_POLICY_SCOPE )
 
-ecbuild_requires_macro_version( 1.9 )
+ecbuild_requires_macro_version( 2.6 )
 
 ###############################################################################
 # some variables of this project
 
 ecbuild_add_option( FEATURE ECCODES DESCRIPTION "" DEFAULT ON )
 
-if( HAVE_ECCODES )
-  ecbuild_use_package( PROJECT eccodes VERSION 0.14 REQUIRED )
+set(ECCODES_FAIL_MSG "Note: grib_api can be used instead (select with -DENABLE_ECCODES=OFF), "
+                      "but we strongly advise you to upgrade to ecCodes. "
+                      "See https://software.ecmwf.int/wiki/display/ECC/ecCodes+Home\n"
+                      )
+
+
+ecbuild_add_option( FEATURE ECCODES DESCRIPTION "Use eccodes instead of grib_api"
+                    REQUIRED_PACKAGES "PROJECT eccodes VERSION 0.14 REQUIRED FAILURE_MSG ECCODES_FAIL_MSG"
+                    DEFAULT ON )
+ 
+if( HAVE_ECCODES)
   set( GRIB_API_INCLUDE_DIRS ${ECCODES_INCLUDE_DIRS} )
   set( GRIB_API_LIBRARIES    ${ECCODES_LIBRARIES} )
   set( GRIB_API_DEFINITIONS  ${ECCODES_DEFINITIONS} )
   set( grib_api_BASE_DIR     ${eccodes_BASE_DIR} )
   set( grib_handling_pkg eccodes )
 else()
-  ecbuild_use_package(PROJECT grib_api VERSION 1.14.6 REQUIRED)
+  ecbuild_use_package( PROJECT grib_api VERSION 1.14.3 REQUIRED
+                       FAILURE_MSG "ecCodes can be used instead (enable with -DENABLE_ECCODES=ON)" )
   set( grib_handling_pkg grib_api )
 endif()
 
@@ -134,7 +144,7 @@ set( MAGICS_EXCEPTION     "ON" )
 set( MAGICS_SITE          "ecmwf" )
 set( MAGICS_INSTALL_PATH  ${CMAKE_INSTALL_PREFIX} )
 
-set( MAGICS_REFERENCE_VERSIONS            "2.29.6" )
+set( MAGICS_REFERENCE_VERSIONS            "2.30.0" )
 set( MAGICS_HTML_ROOT        "${CMAKE_BINARY_DIR}/regression/html")
 file(MAKE_DIRECTORY ${MAGICS_HTML_ROOT} )
 
@@ -149,9 +159,10 @@ set( MAG_PYTHON_PATH ${CMAKE_CURRENT_BINARY_DIR}/python )
 ecbuild_add_c_flags("-std=c99")
 
 ### Metview and Qt
+ecbuild_info("TESTING for Metview and Qt ...")
 
 if(HAVE_METVIEW AND HAVE_METVIEW_NO_QT)
-    message(FATAL_ERROR "Do not set both HAVE_METVIEW and HAVE_METVIEW_NO_QT - only set one. You may have to remove your CMakeCache.txt to clear these settings.")
+    ecbuild_critical("Do not set both HAVE_METVIEW and HAVE_METVIEW_NO_QT - only set one. You may have to remove your CMakeCache.txt to clear these settings.")
 endif()
 
 set( qt no )
@@ -164,20 +175,20 @@ endif()
 
 if( HAVE_METVIEW )
     set ( metview yes)
-    message(STATUS "TESTING for Metview ...")
+    ecbuild_info("TESTING for Metview ...")
     unset(MAGICS_ONLY)
 
     if( HAVE_QT5 )
       find_package(Qt5Widgets REQUIRED)
       if( Qt5Widgets_FOUND )
-          message(STATUS "Qt5 was found ... ${Qt5Widgets_VERSION_STRING}")
+          ecbuild_info("Qt5 was found ... ${Qt5Widgets_VERSION_STRING}")
           include_directories(${Qt5Widgets_INCLUDE_DIRS})
           set( MAGICS_QT 1)
           set( MAGICS_QT5 1)
           set( qt yes)
           add_definitions( -DMAGICS_QT5 )
       else()
-          message(FATAL_ERROR "Qt5 was NOT found ...")
+          ecbuild_critical("Qt5 was NOT found ...")
       endif()
     else()
     find_package(Qt4 4.4.3 REQUIRED QtCore QtGui QtXml )
diff --git a/VERSION.cmake b/VERSION.cmake
index 072254a..31e8637 100644
--- a/VERSION.cmake
+++ b/VERSION.cmake
@@ -6,8 +6,8 @@
 # granted to it by virtue of its status as an intergovernmental organisation nor
 # does it submit to any jurisdiction.
 
-set ( metabuilder_version 2.30.0 )
-set ( _version 2.30.0 )
+set ( metabuilder_version 2.31.0 )
+set ( _version 2.31.0 )
 
 if ( MAGICS_BUILD )
     set( ${PROJECT_NAME}_VERSION_STR  "${_version}-${MAGICS_BUILD}" )   
diff --git a/cmake/FindADSM.cmake b/cmake/FindADSM.cmake
index b46e798..daadf0e 100644
--- a/cmake/FindADSM.cmake
+++ b/cmake/FindADSM.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/FindAEC.cmake b/cmake/FindAEC.cmake
index 717b2b5..0b0f69b 100644
--- a/cmake/FindAEC.cmake
+++ b/cmake/FindAEC.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/FindAIO.cmake b/cmake/FindAIO.cmake
index 76e357a..5dd9244 100644
--- a/cmake/FindAIO.cmake
+++ b/cmake/FindAIO.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/FindArmadillo.cmake b/cmake/FindArmadillo.cmake
index 4ef1a4a..dfe77a2 100644
--- a/cmake/FindArmadillo.cmake
+++ b/cmake/FindArmadillo.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/FindCMath.cmake b/cmake/FindCMath.cmake
index b8a2a0b..741728a 100644
--- a/cmake/FindCMath.cmake
+++ b/cmake/FindCMath.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/FindDl.cmake b/cmake/FindDl.cmake
index 16463c6..31e426f 100644
--- a/cmake/FindDl.cmake
+++ b/cmake/FindDl.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2016 ECMWF.
+# © 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. 
diff --git a/cmake/FindEMOS.cmake b/cmake/FindEMOS.cmake
index c549fc2..43f896e 100644
--- a/cmake/FindEMOS.cmake
+++ b/cmake/FindEMOS.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/FindFDB.cmake b/cmake/FindFDB.cmake
index 4bcbdf3..66879c1 100644
--- a/cmake/FindFDB.cmake
+++ b/cmake/FindFDB.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/FindFFTW.cmake b/cmake/FindFFTW.cmake
index b76afa5..d57c09a 100644
--- a/cmake/FindFFTW.cmake
+++ b/cmake/FindFFTW.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/FindGeoTIFF.cmake b/cmake/FindGeoTIFF.cmake
index 126bc46..7226f61 100644
--- a/cmake/FindGeoTIFF.cmake
+++ b/cmake/FindGeoTIFF.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/FindHPSS.cmake b/cmake/FindHPSS.cmake
index b2b662b..1cc829e 100644
--- a/cmake/FindHPSS.cmake
+++ b/cmake/FindHPSS.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/FindLEX.cmake b/cmake/FindLEX.cmake
index 221868f..b6ab838 100644
--- a/cmake/FindLEX.cmake
+++ b/cmake/FindLEX.cmake
@@ -44,7 +44,7 @@
 # This file is based on the FindFLEX CMake macro, and adapted by ECMWF
 
 #=============================================================================
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/FindLibGFortran.cmake b/cmake/FindLibGFortran.cmake
index a293ea5..7f9cc64 100644
--- a/cmake/FindLibGFortran.cmake
+++ b/cmake/FindLibGFortran.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2016 ECMWF.
+# © 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.
diff --git a/cmake/FindLibIFort.cmake b/cmake/FindLibIFort.cmake
index da782a4..4c3e299 100644
--- a/cmake/FindLibIFort.cmake
+++ b/cmake/FindLibIFort.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2016 ECMWF.
+# © 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. 
diff --git a/cmake/FindLustreAPI.cmake b/cmake/FindLustreAPI.cmake
new file mode 100644
index 0000000..6db0ba2
--- /dev/null
+++ b/cmake/FindLustreAPI.cmake
@@ -0,0 +1,43 @@
+# (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
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
+
+# - Try to find lib Lustre API
+
+# usually installed on Cray systems under /opt/cray/lustre-cray_ari_s/default / create_test.c -L
+# .../include/lustre/lustreapi.h
+# .../lib64/liblustreapi.so
+
+# Once done this will define
+#  LUSTREAPI_FOUND        - System has LustreAPI
+#  LUSTREAPI_INCLUDE_DIRS - The LustreAPI include directories
+#  LUSTREAPI_LIBRARIES    - The libraries needed to use LustreAPI
+#
+# The following paths will be searched with priority if set in CMake or env
+#
+#  LUSTREAPI_DIR          - prefix path of the LustreAPI installation
+#  LUSTREAPI_PATH         - prefix path of the LustreAPI installation
+
+find_path( LUSTREAPI_INCLUDE_DIR lustre/lustreapi.h
+           PATHS ${LUSTREAPI_DIR} ${LUSTREAPI_PATH} ENV LUSTREAPI_DIR ENV LUSTREAPI_PATH
+           PATH_SUFFIXES include NO_DEFAULT_PATH )
+
+find_path( LUSTREAPI_INCLUDE_DIR lustre/lustreapi.h PATH_SUFFIXES include )
+
+find_library( LUSTREAPI_LIBRARY NAMES lustreapi
+              PATHS ${LUSTREAPI_DIR} ${LUSTREAPI_PATH} ENV LUSTREAPI_DIR ENV LUSTREAPI_PATH
+              PATH_SUFFIXES lib lib64 NO_DEFAULT_PATH )
+find_library( LUSTREAPI_LIBRARY NAMES lustreapi PATH_SUFFIXES lib lib64 )
+
+set( LUSTREAPI_LIBRARIES    ${LUSTREAPI_LIBRARY} )
+set( LUSTREAPI_INCLUDE_DIRS ${LUSTREAPI_INCLUDE_DIR} )
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(LUSTREAPI  DEFAULT_MSG LUSTREAPI_LIBRARY LUSTREAPI_INCLUDE_DIR)
+
+mark_as_advanced(LUSTREAPI_INCLUDE_DIR LUSTREAPI_LIBRARY )
diff --git a/cmake/FindMKL.cmake b/cmake/FindMKL.cmake
index 5941179..59eaa60 100644
--- a/cmake/FindMKL.cmake
+++ b/cmake/FindMKL.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/FindNDBM.cmake b/cmake/FindNDBM.cmake
index 869223f..8cd350e 100644
--- a/cmake/FindNDBM.cmake
+++ b/cmake/FindNDBM.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/FindNetCDF.cmake b/cmake/FindNetCDF.cmake
index 9084549..69b88bd 100644
--- a/cmake/FindNetCDF.cmake
+++ b/cmake/FindNetCDF.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/FindNetCDF3.cmake b/cmake/FindNetCDF3.cmake
index 5519fd6..1783a72 100644
--- a/cmake/FindNetCDF3.cmake
+++ b/cmake/FindNetCDF3.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/FindODB.cmake b/cmake/FindODB.cmake
index 1beb5c8..7c35d6e 100644
--- a/cmake/FindODB.cmake
+++ b/cmake/FindODB.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2016 ECMWF.
+# © 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.
diff --git a/cmake/FindOpenCL.cmake b/cmake/FindOpenCL.cmake
index 9b6e978..510a3a9 100644
--- a/cmake/FindOpenCL.cmake
+++ b/cmake/FindOpenCL.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/FindOpenJPEG.cmake b/cmake/FindOpenJPEG.cmake
index c660238..66d976e 100644
--- a/cmake/FindOpenJPEG.cmake
+++ b/cmake/FindOpenJPEG.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/FindPGIFortran.cmake b/cmake/FindPGIFortran.cmake
index e68bdf6..5d33239 100644
--- a/cmake/FindPGIFortran.cmake
+++ b/cmake/FindPGIFortran.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/FindPango.cmake b/cmake/FindPango.cmake
index 76e152a..f135864 100644
--- a/cmake/FindPango.cmake
+++ b/cmake/FindPango.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/FindPangoCairo.cmake b/cmake/FindPangoCairo.cmake
index 9979550..cb70737 100644
--- a/cmake/FindPangoCairo.cmake
+++ b/cmake/FindPangoCairo.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/FindREADLINE.cmake b/cmake/FindREADLINE.cmake
index 2ba08b4..a146c62 100644
--- a/cmake/FindREADLINE.cmake
+++ b/cmake/FindREADLINE.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/FindRPCGEN.cmake b/cmake/FindRPCGEN.cmake
index fd42e9f..42ed90c 100644
--- a/cmake/FindRPCGEN.cmake
+++ b/cmake/FindRPCGEN.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/FindRealtime.cmake b/cmake/FindRealtime.cmake
index 843a54f..78fa4c5 100644
--- a/cmake/FindRealtime.cmake
+++ b/cmake/FindRealtime.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/FindSZip.cmake b/cmake/FindSZip.cmake
index 925348c..f005546 100644
--- a/cmake/FindSZip.cmake
+++ b/cmake/FindSZip.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/FindTrilinos.cmake b/cmake/FindTrilinos.cmake
index 0d99b54..b1584f8 100644
--- a/cmake/FindTrilinos.cmake
+++ b/cmake/FindTrilinos.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/FindViennaCL.cmake b/cmake/FindViennaCL.cmake
index aba2980..8f442c9 100644
--- a/cmake/FindViennaCL.cmake
+++ b/cmake/FindViennaCL.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/FindXLFortranLibs.cmake b/cmake/FindXLFortranLibs.cmake
index 37800c7..80f2923 100644
--- a/cmake/FindXLFortranLibs.cmake
+++ b/cmake/FindXLFortranLibs.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2016 ECMWF.
+# © 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. 
diff --git a/cmake/FindYACC.cmake b/cmake/FindYACC.cmake
index 7b15bfe..3eb3b5c 100644
--- a/cmake/FindYACC.cmake
+++ b/cmake/FindYACC.cmake
@@ -41,7 +41,7 @@
 # This file is based on the FindFLEX CMake macro, and adapted by ECMWF
 
 #=============================================================================
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/Findgrib_api.cmake b/cmake/Findgrib_api.cmake
index ab6fc0b..c6f6421 100644
--- a/cmake/Findgrib_api.cmake
+++ b/cmake/Findgrib_api.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/Findodb_api.cmake b/cmake/Findodb_api.cmake
index 0058fbe..00f4152 100644
--- a/cmake/Findodb_api.cmake
+++ b/cmake/Findodb_api.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/Findspot.cmake b/cmake/Findspot.cmake
index 52e0fb5..d932bfe 100644
--- a/cmake/Findspot.cmake
+++ b/cmake/Findspot.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/VERSION.cmake b/cmake/VERSION.cmake
index 074b9f7..ce5f7de 100644
--- a/cmake/VERSION.cmake
+++ b/cmake/VERSION.cmake
@@ -1,7 +1,7 @@
 set( ECBUILD_MAJOR_VERSION "2" )
-set( ECBUILD_MINOR_VERSION "4" )
-set( ECBUILD_PATCH_VERSION "1" )
+set( ECBUILD_MINOR_VERSION "6" )
+set( ECBUILD_PATCH_VERSION "0" )
 
-set( ECBUILD_VERSION_STR  "2.4.1" )
+set( ECBUILD_VERSION_STR  "2.6.0" )
 
 set( ECBUILD_MACRO_VERSION "${ECBUILD_MAJOR_VERSION}.${ECBUILD_MINOR_VERSION}" )
diff --git a/cmake/compiler_flags/Clang_C.cmake b/cmake/compiler_flags/Clang_C.cmake
index bc73c69..b742a5b 100644
--- a/cmake/compiler_flags/Clang_C.cmake
+++ b/cmake/compiler_flags/Clang_C.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/compiler_flags/Clang_CXX.cmake b/cmake/compiler_flags/Clang_CXX.cmake
index 53f0f21..7570630 100644
--- a/cmake/compiler_flags/Clang_CXX.cmake
+++ b/cmake/compiler_flags/Clang_CXX.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/compiler_flags/Cray_C.cmake b/cmake/compiler_flags/Cray_C.cmake
index f487cf4..f9b6e4b 100644
--- a/cmake/compiler_flags/Cray_C.cmake
+++ b/cmake/compiler_flags/Cray_C.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/compiler_flags/Cray_CXX.cmake b/cmake/compiler_flags/Cray_CXX.cmake
index a2a6632..fdc4749 100644
--- a/cmake/compiler_flags/Cray_CXX.cmake
+++ b/cmake/compiler_flags/Cray_CXX.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/compiler_flags/Cray_Fortran.cmake b/cmake/compiler_flags/Cray_Fortran.cmake
index 34b96e4..8575bba 100644
--- a/cmake/compiler_flags/Cray_Fortran.cmake
+++ b/cmake/compiler_flags/Cray_Fortran.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/compiler_flags/GNU_C.cmake b/cmake/compiler_flags/GNU_C.cmake
index 955f527..288fc70 100644
--- a/cmake/compiler_flags/GNU_C.cmake
+++ b/cmake/compiler_flags/GNU_C.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/compiler_flags/GNU_CXX.cmake b/cmake/compiler_flags/GNU_CXX.cmake
index 0ab8c3a..1a01e2d 100644
--- a/cmake/compiler_flags/GNU_CXX.cmake
+++ b/cmake/compiler_flags/GNU_CXX.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/compiler_flags/GNU_Fortran.cmake b/cmake/compiler_flags/GNU_Fortran.cmake
index a12abec..6e28844 100644
--- a/cmake/compiler_flags/GNU_Fortran.cmake
+++ b/cmake/compiler_flags/GNU_Fortran.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/compiler_flags/Intel_C.cmake b/cmake/compiler_flags/Intel_C.cmake
index dbea59f..5736004 100644
--- a/cmake/compiler_flags/Intel_C.cmake
+++ b/cmake/compiler_flags/Intel_C.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/compiler_flags/Intel_CXX.cmake b/cmake/compiler_flags/Intel_CXX.cmake
index 5b8dc78..8e466e5 100644
--- a/cmake/compiler_flags/Intel_CXX.cmake
+++ b/cmake/compiler_flags/Intel_CXX.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/compiler_flags/Intel_Fortran.cmake b/cmake/compiler_flags/Intel_Fortran.cmake
index 86b69dc..abd85f8 100644
--- a/cmake/compiler_flags/Intel_Fortran.cmake
+++ b/cmake/compiler_flags/Intel_Fortran.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/compiler_flags/PGI_C.cmake b/cmake/compiler_flags/PGI_C.cmake
index 6784a14..1cc6485 100644
--- a/cmake/compiler_flags/PGI_C.cmake
+++ b/cmake/compiler_flags/PGI_C.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/compiler_flags/PGI_CXX.cmake b/cmake/compiler_flags/PGI_CXX.cmake
index 877ef3f..6d31cf4 100644
--- a/cmake/compiler_flags/PGI_CXX.cmake
+++ b/cmake/compiler_flags/PGI_CXX.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/compiler_flags/PGI_Fortran.cmake b/cmake/compiler_flags/PGI_Fortran.cmake
index a268cc9..86c2a35 100644
--- a/cmake/compiler_flags/PGI_Fortran.cmake
+++ b/cmake/compiler_flags/PGI_Fortran.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_add_c_flags.cmake b/cmake/ecbuild_add_c_flags.cmake
index 098c254..138e4d8 100644
--- a/cmake/ecbuild_add_c_flags.cmake
+++ b/cmake/ecbuild_add_c_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_add_cxx11_flags.cmake b/cmake/ecbuild_add_cxx11_flags.cmake
index df8cde5..6c5c861 100644
--- a/cmake/ecbuild_add_cxx11_flags.cmake
+++ b/cmake/ecbuild_add_cxx11_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_add_cxx_flags.cmake b/cmake/ecbuild_add_cxx_flags.cmake
index 5104880..699c50a 100644
--- a/cmake/ecbuild_add_cxx_flags.cmake
+++ b/cmake/ecbuild_add_cxx_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_add_executable.cmake b/cmake/ecbuild_add_executable.cmake
index 424059e..5d78348 100644
--- a/cmake/ecbuild_add_executable.cmake
+++ b/cmake/ecbuild_add_executable.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -142,6 +142,28 @@ macro( ecbuild_add_executable )
 
   if( _${_PAR_TARGET}_condition )
 
+    # insert already compiled objects (from OBJECT libraries)
+    unset( _all_objects )
+    foreach( _obj ${_PAR_OBJECTS} )
+      list( APPEND _all_objects $<TARGET_OBJECTS:${_obj}> )
+    endforeach()
+
+    list( APPEND _PAR_SOURCES ${_glob_srcs} )
+
+    if( ECBUILD_LIST_SOURCES )
+      ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): sources ${_PAR_SOURCES}")
+    endif()
+
+    # glob sources
+    unset( _glob_srcs )
+    foreach( pattern ${_PAR_SOURCES_GLOB} )
+      ecbuild_list_add_pattern( LIST _glob_srcs GLOB "${pattern}" )
+    endforeach()
+
+    foreach( pattern ${_PAR_SOURCES_EXCLUDE_REGEX} )
+      ecbuild_list_exclude_pattern( LIST _glob_srcs REGEX "${pattern}" )
+    endforeach()
+
     # add persistent layer files
     if( DEFINED _PAR_PERSISTENT )
       if( DEFINED PERSISTENT_NAMESPACE )
@@ -158,29 +180,26 @@ macro( ecbuild_add_executable )
       add_custom_target( ${_PAR_TARGET}_templates SOURCES ${_PAR_TEMPLATES} )
     endif()
 
-    # glob sources
-    unset( _glob_srcs )
-    foreach( pattern ${_PAR_SOURCES_GLOB} )
-        ecbuild_list_add_pattern( LIST _glob_srcs GLOB "${pattern}" )
-    endforeach()
-
-    foreach( pattern ${_PAR_SOURCES_EXCLUDE_REGEX} )
-        ecbuild_list_exclude_pattern( LIST _glob_srcs REGEX "${pattern}" )
-    endforeach()
-
-    # insert already compiled objects (from OBJECT libraries)
-    unset( _all_objects )
-    foreach( _obj ${_PAR_OBJECTS} )
-      list( APPEND _all_objects $<TARGET_OBJECTS:${_obj}> )
-    endforeach()
-
-    list( APPEND _PAR_SOURCES ${_glob_srcs} )
+    # Separate sources
+    if( _PAR_SOURCES )
+      ecbuild_separate_sources( TARGET ${_PAR_TARGET} SOURCES ${_PAR_SOURCES} )
+    endif()
 
-    if( ECBUILD_LIST_SOURCES )
-      ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): sources ${_PAR_SOURCES}")
+    if( ${_PAR_TARGET}_cuda_srcs )
+      if( NOT CUDA_FOUND )
+        ecbuild_error("ecbuild_add_executable(${_PAR_TARGET}): CUDA source files detected"
+                      "but CUDA was not found.")
+      endif()
+      ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): CUDA sources detected."
+                    "Building executable with ecbuild_add_executable() rather than intrinsic"
+                    "add_executable().")
     endif()
 
-    add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} ${_all_objects} )
+    if( NOT ${_PAR_TARGET}_cuda_srcs )
+      add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} ${_all_objects} )
+    else()
+      cuda_add_executable( ${_PAR_TARGET} ${_PAR_SOURCES}  ${_all_objects} )
+    endif()
 
     # ecbuild_echo_target( ${_PAR_TARGET} )
 
@@ -225,15 +244,6 @@ macro( ecbuild_add_executable )
       endforeach()
     endif()
 
-    # filter sources
-
-    ecbuild_separate_sources( TARGET ${_PAR_TARGET} SOURCES ${_PAR_SOURCES} )
-
-    #   ecbuild_debug_var( ${_PAR_TARGET}_h_srcs )
-    #   ecbuild_debug_var( ${_PAR_TARGET}_c_srcs )
-    #   ecbuild_debug_var( ${_PAR_TARGET}_cxx_srcs )
-    #   ecbuild_debug_var( ${_PAR_TARGET}_fortran_srcs )
-
     # Override compilation flags on a per source file basis
     ecbuild_target_flags( ${_PAR_TARGET} "${_PAR_CFLAGS}" "${_PAR_CXXFLAGS}" "${_PAR_FFLAGS}" )
 
diff --git a/cmake/ecbuild_add_extra_search_paths.cmake b/cmake/ecbuild_add_extra_search_paths.cmake
index 94ac85b..690cde6 100644
--- a/cmake/ecbuild_add_extra_search_paths.cmake
+++ b/cmake/ecbuild_add_extra_search_paths.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_add_fortran_flags.cmake b/cmake/ecbuild_add_fortran_flags.cmake
index 0d3b544..2ac89e8 100644
--- a/cmake/ecbuild_add_fortran_flags.cmake
+++ b/cmake/ecbuild_add_fortran_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_add_library.cmake b/cmake/ecbuild_add_library.cmake
index 2c59200..ee29008 100644
--- a/cmake/ecbuild_add_library.cmake
+++ b/cmake/ecbuild_add_library.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -36,6 +36,7 @@
 #                        [ INSTALL_HEADERS_LIST <header1> [<header2> ...] ]
 #                        [ INSTALL_HEADERS_REGEX <pattern> ]
 #                        [ VERSION <version> | AUTO_VERSION ]
+#                        [ SOVERSION <soversion> | AUTO_SOVERSION ]
 #                        [ CFLAGS <flag1> [<flag2> ...] ]
 #                        [ CXXFLAGS <flag1> [<flag2> ...] ]
 #                        [ FFLAGS <flag1> [<flag2> ...] ]
@@ -123,10 +124,16 @@
 #   regular expression to match extra headers to install
 #
 # VERSION : optional, AUTO_VERSION or LIBS_VERSION is used if not specified
-#   version to use as library version
+#   build version of the library
 #
 # AUTO_VERSION : optional, ignored if VERSION is specified
-#   automatically version the library with the package version
+#   use MAJOR.MINOR package version as build version of the library
+#
+# SOVERSION : optional, AUTO_SOVERSION or LIBS_SOVERSION is used if not specified
+#   ABI version of the library
+#
+# AUTO_SOVERSION : optional, ignored if SOVERSION is specified
+#   use MAJOR package version as ABI version of the library
 #
 # CFLAGS : optional
 #   list of C compiler flags to use for all C source files
@@ -147,8 +154,8 @@
 
 function( ecbuild_add_library_impl )
 
-  set( options NOINSTALL AUTO_VERSION )
-  set( single_value_args TARGET TYPE COMPONENT INSTALL_HEADERS INSTALL_HEADERS_REGEX LINKER_LANGUAGE HEADER_DESTINATION VERSION OUTPUT_NAME )
+  set( options NOINSTALL AUTO_VERSION AUTO_SOVERSION )
+  set( single_value_args TARGET TYPE COMPONENT INSTALL_HEADERS INSTALL_HEADERS_REGEX LINKER_LANGUAGE HEADER_DESTINATION VERSION SOVERSION OUTPUT_NAME )
   set( multi_value_args  SOURCES SOURCES_GLOB SOURCES_EXCLUDE_REGEX OBJECTS TEMPLATES LIBS INCLUDES PRIVATE_INCLUDES PUBLIC_INCLUDES DEPENDS PERSISTENT DEFINITIONS INSTALL_HEADERS_LIST CFLAGS CXXFLAGS FFLAGS GENERATED CONDITION )
 
   cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
@@ -193,6 +200,26 @@ function( ecbuild_add_library_impl )
       ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): library type is ${_PAR_TYPE}")
     endif()
 
+    # insert already compiled objects (from OBJECT libraries)
+    unset( _all_objects )
+    foreach( _obj ${_PAR_OBJECTS} )
+      list( APPEND _all_objects $<TARGET_OBJECTS:${_obj}> )
+    endforeach()
+
+    # glob sources
+    unset( _glob_srcs )
+    foreach( pattern ${_PAR_SOURCES_GLOB} )
+      ecbuild_list_add_pattern( LIST _glob_srcs GLOB "${pattern}" )
+    endforeach()
+
+    foreach( pattern ${_PAR_SOURCES_EXCLUDE_REGEX} )
+      ecbuild_list_exclude_pattern( LIST _glob_srcs REGEX "${pattern}" )
+    endforeach()
+    list( APPEND _PAR_SOURCES ${_glob_srcs} )
+
+    if( ECBUILD_LIST_SOURCES )
+      ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): sources ${_PAR_SOURCES}")
+    endif()
 
     # add persistent layer files
     if( DEFINED _PAR_PERSISTENT )
@@ -210,30 +237,30 @@ function( ecbuild_add_library_impl )
       add_custom_target( ${_PAR_TARGET}_templates SOURCES ${_PAR_TEMPLATES} )
     endif()
 
-    # glob sources
-    unset( _glob_srcs )
-    foreach( pattern ${_PAR_SOURCES_GLOB} )
-        ecbuild_list_add_pattern( LIST _glob_srcs GLOB "${pattern}" )
-    endforeach()
-
-    foreach( pattern ${_PAR_SOURCES_EXCLUDE_REGEX} )
-        ecbuild_list_exclude_pattern( LIST _glob_srcs REGEX "${pattern}" )
-    endforeach()
-
-    # insert already compiled objects (from OBJECT libraries)
-    unset( _all_objects )
-    foreach( _obj ${_PAR_OBJECTS} )
-      list( APPEND _all_objects $<TARGET_OBJECTS:${_obj}> )
-    endforeach()
-
-    list( APPEND _PAR_SOURCES ${_glob_srcs} )
-
-    if( ECBUILD_LIST_SOURCES )
-      ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): sources ${_PAR_SOURCES}")
+    # Separate sources
+    if( _PAR_SOURCES )
+      ecbuild_separate_sources( TARGET ${_PAR_TARGET} SOURCES ${_PAR_SOURCES} )
     endif()
 
-    add_library( ${_PAR_TARGET} ${_PAR_TYPE} ${_PAR_SOURCES}  ${_all_objects} )
+    if( ${_PAR_TARGET}_cuda_srcs )
+      if( NOT CUDA_FOUND )
+          ecbuild_error("ecbuild_add_library(${_PAR_TARGET}): CUDA source files detected"
+                        "but CUDA was not found.")
+      endif()
+      if( _PAR_TYPE MATCHES "OBJECT" )
+          ecbuild_error("ecbuild_add_library(${_PAR_TARGET}): CUDA source files detected"
+                        "but CMake OBJECT libraries with CUDA are not supported.")
+      endif()
+      ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): CUDA sources detected."
+                    "Building library with cuda_add_library() rather than intrinsic"
+                    "add_library().")
+    endif()
 
+    if( NOT ${_PAR_TARGET}_cuda_srcs )
+      add_library( ${_PAR_TARGET} ${_PAR_TYPE} ${_PAR_SOURCES}  ${_all_objects} )
+    else()
+      cuda_add_library( ${_PAR_TARGET} ${_PAR_TYPE} ${_PAR_SOURCES}  ${_all_objects} )
+    endif()
     # ecbuild_echo_target( ${_PAR_TARGET} )
 
     # set OUTPUT_NAME
@@ -330,30 +357,32 @@ function( ecbuild_add_library_impl )
 
     # define VERSION if requested
     if( DEFINED _PAR_VERSION )
-      ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): set version to ${_PAR_VERSION}")
+      ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): set build version to ${_PAR_VERSION}")
       set_target_properties( ${_PAR_TARGET} PROPERTIES VERSION "${_PAR_VERSION}" )
     else()
       if( _PAR_AUTO_VERSION OR LIBS_VERSION MATCHES "[Aa][Uu][Tt][Oo]")
-        ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): set version to ${${PNAME}_MAJOR_VERSION}.${${PNAME}_MINOR_VERSION} (auto)")
+        ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): set build version to ${${PNAME}_MAJOR_VERSION}.${${PNAME}_MINOR_VERSION} (auto)")
         set_target_properties( ${_PAR_TARGET} PROPERTIES VERSION "${${PNAME}_MAJOR_VERSION}.${${PNAME}_MINOR_VERSION}" )
-      endif()
-      if( LIBS_VERSION AND NOT LIBS_VERSION MATCHES "[Aa][Uu][Tt][Oo]" )
-        ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): set version to ${LIBS_VERSION}")
+      elseif( DEFINED LIBS_VERSION )
+        ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): set build version to ${LIBS_VERSION}")
         set_target_properties( ${_PAR_TARGET} PROPERTIES VERSION "${LIBS_VERSION}" )
       endif()
     endif()
 
-    # filter sources
-
-    if( _PAR_SOURCES )
-      ecbuild_separate_sources( TARGET ${_PAR_TARGET} SOURCES ${_PAR_SOURCES} )
+    # define SOVERSION if requested
+    if( DEFINED _PAR_SOVERSION )
+      ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): set ABI version to ${_PAR_SOVERSION}")
+      set_target_properties( ${_PAR_TARGET} PROPERTIES SOVERSION "${_PAR_SOVERSION}" )
+    else()
+      if( _PAR_AUTO_SOVERSION OR LIBS_SOVERSION MATCHES "[Aa][Uu][Tt][Oo]")
+        ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): set ABI version to ${${PNAME}_MAJOR_VERSION} (auto)")
+        set_target_properties( ${_PAR_TARGET} PROPERTIES SOVERSION "${${PNAME}_MAJOR_VERSION}" )
+      elseif( DEFINED LIBS_SOVERSION )
+        ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): set ABI version to ${LIBS_SOVERSION}")
+        set_target_properties( ${_PAR_TARGET} PROPERTIES SOVERSION "${LIBS_SOVERSION}" )
+      endif()
     endif()
 
-    #   ecbuild_debug_var( ${_PAR_TARGET}_h_srcs )
-    #   ecbuild_debug_var( ${_PAR_TARGET}_c_srcs )
-    #   ecbuild_debug_var( ${_PAR_TARGET}_cxx_srcs )
-    #   ecbuild_debug_var( ${_PAR_TARGET}_fortran_srcs )
-
     # Override compilation flags on a per source file basis
     ecbuild_target_flags( ${_PAR_TARGET} "${_PAR_CFLAGS}" "${_PAR_CXXFLAGS}" "${_PAR_FFLAGS}" )
 
@@ -516,7 +545,10 @@ macro( ecbuild_add_library )
         ecbuild_add_library_impl( TARGET ${_p_TARGET}        TYPE SHARED ${_p_UNPARSED_ARGUMENTS} )
         ecbuild_add_library_impl( TARGET ${_p_TARGET}-static TYPE STATIC ${_p_UNPARSED_ARGUMENTS} DEPENDS ${_p_TARGET} )
 
-        set_target_properties( ${_p_TARGET}-static PROPERTIES OUTPUT_NAME ${_p_TARGET} )
+        # If the library is built conditionally the target might not exist
+        if ( TARGET ${_p_TARGET}-static )
+          set_target_properties( ${_p_TARGET}-static PROPERTIES OUTPUT_NAME ${_p_TARGET} )
+        endif()
 
       else()
 
diff --git a/cmake/ecbuild_add_option.cmake b/cmake/ecbuild_add_option.cmake
index fd8076e..6d5363f 100644
--- a/cmake/ecbuild_add_option.cmake
+++ b/cmake/ecbuild_add_option.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -17,7 +17,6 @@
 #   ecbuild_add_option( FEATURE <name>
 #                       [ DEFAULT ON|OFF ]
 #                       [ DESCRIPTION <description> ]
-#                       [ PURPOSE <purpose> ]
 #                       [ REQUIRED_PACKAGES <package1> [<package2> ...] ]
 #                       [ CONDITION <condition> ]
 #                       [ ADVANCED ] [ NO_TPL ] )
@@ -34,12 +33,6 @@
 # DESCRIPTION : optional
 #   string describing the feature (shown in summary and stored in the cache)
 #
-# TYPE : optional, one of RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED
-#   type of dependency of the project on this package (defaults to OPTIONAL)
-#
-# PURPOSE : optional
-#   string describing which functionality this package enables in the project
-#
 # REQUIRED_PACKAGES : optional
 #   list of packages required to be found for this feature to be enabled
 #
@@ -59,6 +52,22 @@
 #   The entire specification must be enclosed in quotes and is passed on
 #   verbatim. Any options of ``ecbuild_use_package`` are supported.
 #
+#   .. note::
+#
+#     Arguments inside the package string that require quoting need to use the
+#     `bracket argument syntax`_ introduced in CMake 3.0 since
+#     regular quotes even when escaped are swallowed by the CMake parser.
+#
+#     Alternatively, the name of a CMake variable containing the string can be
+#     passed, which will be expanded by ``ecbuild_find_package``: ::
+#
+#       set( ECCODES_FAIL_MSG
+#            "grib_api can be used instead (select with -DENABLE_ECCODES=OFF)" )
+#       ecbuild_add_option( FEATURE ECCODES
+#                           DESCRIPTION "Use eccodes instead of grib_api"
+#                           REQUIRED_PACKAGES "PROJECT eccodes REQUIRED FAILURE_MSG ECCODES_FAIL_MSG"
+#                           DEFAULT ON )
+#
 # CONDITION : optional
 #   conditional expression which must evaluate to true for this option to be
 #   enabled (must be valid in a CMake ``if`` statement)
@@ -83,6 +92,8 @@
 # With an already populated cache, use ``-DENABLE_<FEATURE>=REQUIRE`` to make
 # the feature a required feature (this cannot be done via the CMake GUI).
 #
+# .. _bracket argument syntax: https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#bracket-argument
+#
 ##############################################################################
 
 macro( ecbuild_add_option )
@@ -114,8 +125,11 @@ macro( ecbuild_add_option )
   endif()
   ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): defaults to ${_p_DEFAULT}")
 
-  if( NOT _p_TYPE  )
-    set( _p_TYPE OPTIONAL )
+  if( _p_PURPOSE  )
+    ecbuild_deprecate( "ecbuild_add_option: argument PURPOSE is ignored and will be removed in a future release." )
+  endif()
+  if( _p_TYPE  )
+    ecbuild_deprecate( "ecbuild_add_option: argument TYPE is ignored and will be removed in a future release." )
   endif()
 
   # check CONDITION parameter
@@ -154,13 +168,14 @@ macro( ecbuild_add_option )
   # define the option -- for cmake GUI
 
   option( ENABLE_${_p_FEATURE} "${_p_DESCRIPTION}" ${_p_DEFAULT} )
-  ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): defining option ENABLE_${_p_FEATURE} '${_p_DESCRIPTION}' ${_p_DEFAULT}")
-  ecbuild_set_feature( ${_p_FEATURE} ENABLED ${_p_DEFAULT} )
-  set_package_properties( ${_p_FEATURE} PROPERTIES
-                          DESCRIPTION "${_p_DESCRIPTION}"
-                          TYPE ${_p_TYPE}
-                          PURPOSE "${_p_PURPOSE}" )
+  get_property( _feature_desc GLOBAL PROPERTY _CMAKE_${_p_FEATURE}_DESCRIPTION )
+  if( _feature_desc )
+    add_feature_info( ${_p_FEATURE} ENABLE_${_p_FEATURE} "${_feature_desc}, ${PROJECT_NAME}: ${_p_DESCRIPTION}" )
+  else()
+    add_feature_info( ${_p_FEATURE} ENABLE_${_p_FEATURE} "${PROJECT_NAME}: ${_p_DESCRIPTION}" )
+  endif()
 
+  ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): defining option ENABLE_${_p_FEATURE} '${_p_DESCRIPTION}' ${_p_DEFAULT}")
   ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ENABLE_${_p_FEATURE}=${ENABLE_${_p_FEATURE}}")
 
   if( ENABLE_${_p_FEATURE} )
@@ -183,6 +198,12 @@ macro( ecbuild_add_option )
         if( pkgname STREQUAL "PROJECT" )  # if 1st entry is PROJECT, then we are looking for a ecbuild project
           set( pkgproject 1 )
           list( GET pkglist 1 pkgname )
+          # Use feature description as package description if there is none
+          list( FIND pkglist DESCRIPTION __description )
+          if( __description LESS 0 )
+            ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): no description for ${pkgname}, using feature description '${_p_DESCRIPTION}'")
+            list( APPEND pkglist DESCRIPTION "${_p_DESCRIPTION}" )
+          endif()
         else()                            # else 1st entry is package name
           set( pkgproject 0 )
         endif()
@@ -209,7 +230,14 @@ macro( ecbuild_add_option )
 
           else()
 
-            if( pkgname STREQUAL "MPI" )
+            if( pkgname STREQUAL "LAPACK" )
+              ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for LAPACK - ecbuild_find_package( NAME ${pkglist} )")
+              ecbuild_find_package( NAME ${pkglist} )
+              if( HAVE_LAPACK AND TARGET lapack )
+                ecbuild_debug( "LAPACK found as CMake target lapack" )
+                set( LAPACK_LIBRARIES lapack )
+              endif()
+            elseif( pkgname STREQUAL "MPI" )
               set( _find_args ${pkglist} )
               list( REMOVE_ITEM _find_args "MPI" )
               ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for MPI - ecbuild_find_mpi( ${_find_args} )")
@@ -270,15 +298,18 @@ macro( ecbuild_add_option )
       set( HAVE_${_p_FEATURE} 0 )
     endif( _${_p_FEATURE}_condition )
 
-    ecbuild_set_feature( ${_p_FEATURE} ENABLED ${HAVE_${_p_FEATURE}} )
     # FINAL CHECK
 
     if( HAVE_${_p_FEATURE} )
 
+      ecbuild_enable_feature( ${_p_FEATURE} )
+
       ecbuild_info( "Feature ${_p_FEATURE} enabled" )
 
     else() # if user provided input and we cannot satisfy FAIL otherwise WARN
 
+      ecbuild_disable_feature( ${_p_FEATURE} )
+
       if( ${_p_FEATURE}_user_provided_input )
         if( NOT _${_p_FEATURE}_condition )
           string(REPLACE ";" " " _condition_msg "${_p_CONDITION}")
@@ -294,7 +325,7 @@ macro( ecbuild_add_option )
           ecbuild_info( "Feature ${_p_FEATURE} was not enabled (also not requested) -- following required packages weren't found: ${_failed_to_find_packages}" )
         endif()
         set( ENABLE_${_p_FEATURE} OFF )
-        ecbuild_set_feature( ${_p_FEATURE} ENABLED OFF )
+        ecbuild_disable_feature( ${_p_FEATURE} )
       endif()
 
     endif()
@@ -303,7 +334,7 @@ macro( ecbuild_add_option )
 
     ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): feature disabled")
     set( HAVE_${_p_FEATURE} 0 )
-    ecbuild_set_feature( ${_p_FEATURE} ENABLED OFF )
+    ecbuild_disable_feature( ${_p_FEATURE} )
 
   endif()
 
diff --git a/cmake/ecbuild_add_persistent.cmake b/cmake/ecbuild_add_persistent.cmake
index 42bb44b..e5a875b 100644
--- a/cmake/ecbuild_add_persistent.cmake
+++ b/cmake/ecbuild_add_persistent.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_add_resources.cmake b/cmake/ecbuild_add_resources.cmake
index cf0543b..2dfaa5e 100644
--- a/cmake/ecbuild_add_resources.cmake
+++ b/cmake/ecbuild_add_resources.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/ecbuild_add_test.cmake b/cmake/ecbuild_add_test.cmake
index 1dcf2c6..1da8568 100644
--- a/cmake/ecbuild_add_test.cmake
+++ b/cmake/ecbuild_add_test.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_append_to_rpath.cmake b/cmake/ecbuild_append_to_rpath.cmake
index 9ecde3e..895f837 100644
--- a/cmake/ecbuild_append_to_rpath.cmake
+++ b/cmake/ecbuild_append_to_rpath.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_bundle.cmake b/cmake/ecbuild_bundle.cmake
index aee900c..6a49354 100644
--- a/cmake/ecbuild_bundle.cmake
+++ b/cmake/ecbuild_bundle.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -165,13 +165,30 @@ endmacro()
 #
 #   ecbuild_bundle_finalize()
 #
+# Options
+# -------
+#
+# See documentation for ecbuild_install_project() since all arguments are
+# forwarded to an internal call to that macro.
+#
+# If no arguments are passed, then the default installation NAME is set to
+# the default project name ${CMAKE_PROJECT_NAME}
+#
 ##############################################################################
 
 macro( ecbuild_bundle_finalize )
 
   add_custom_target( update DEPENDS ${git_update_targets} )
 
-  ecbuild_install_project( NAME ${CMAKE_PROJECT_NAME} )
+  ecbuild_info("---------------------------------------------------------")
+  ecbuild_info("Bundle ${CMAKE_PROJECT_NAME}")
+  ecbuild_info("---------------------------------------------------------")
+
+  if("${ARGV1}")
+      ecbuild_install_project( ${ARGV} )
+  else()
+      ecbuild_install_project( NAME ${CMAKE_PROJECT_NAME} )
+  endif()
 
   ecbuild_print_summary()
 
diff --git a/cmake/ecbuild_cache.cmake b/cmake/ecbuild_cache.cmake
index e257b36..d45b31a 100644
--- a/cmake/ecbuild_cache.cmake
+++ b/cmake/ecbuild_cache.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/ecbuild_check_c_source_return.cmake b/cmake/ecbuild_check_c_source_return.cmake
index 18b6117..38d89f7 100644
--- a/cmake/ecbuild_check_c_source_return.cmake
+++ b/cmake/ecbuild_check_c_source_return.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/ecbuild_check_compiler.cmake b/cmake/ecbuild_check_compiler.cmake
index 437b81e..197f0b5 100644
--- a/cmake/ecbuild_check_compiler.cmake
+++ b/cmake/ecbuild_check_compiler.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_check_cxx11.cmake b/cmake/ecbuild_check_cxx11.cmake
index 9552389..d2f9629 100644
--- a/cmake/ecbuild_check_cxx11.cmake
+++ b/cmake/ecbuild_check_cxx11.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_check_cxx_source_return.cmake b/cmake/ecbuild_check_cxx_source_return.cmake
index 0868b22..7270540 100644
--- a/cmake/ecbuild_check_cxx_source_return.cmake
+++ b/cmake/ecbuild_check_cxx_source_return.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_check_fortran.cmake b/cmake/ecbuild_check_fortran.cmake
index 5612134..d7a63cf 100644
--- a/cmake/ecbuild_check_fortran.cmake
+++ b/cmake/ecbuild_check_fortran.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_check_fortran_source_return.cmake b/cmake/ecbuild_check_fortran_source_return.cmake
index 175f4ef..92168b9 100644
--- a/cmake/ecbuild_check_fortran_source_return.cmake
+++ b/cmake/ecbuild_check_fortran_source_return.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/ecbuild_check_functions.cmake b/cmake/ecbuild_check_functions.cmake
index 73f5cb5..4307429 100644
--- a/cmake/ecbuild_check_functions.cmake
+++ b/cmake/ecbuild_check_functions.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_check_os.cmake b/cmake/ecbuild_check_os.cmake
index 8d325dc..be92c87 100644
--- a/cmake/ecbuild_check_os.cmake
+++ b/cmake/ecbuild_check_os.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -42,35 +42,32 @@ endif()
 
 if( ENABLE_OS_TYPES_TEST )
 
-	set( EC_SIZEOF_PTR ${CMAKE_SIZEOF_VOID_P} )
-	ecbuild_cache_var( EC_SIZEOF_PTR )
-    ecbuild_cache_check_type_size( char           EC_SIZEOF_CHAR        )
-    ecbuild_cache_check_type_size( short          EC_SIZEOF_SHORT       )
-	ecbuild_cache_check_type_size( int            EC_SIZEOF_INT         )
-	ecbuild_cache_check_type_size( long           EC_SIZEOF_LONG        )
-	ecbuild_cache_check_type_size( "long long"    EC_SIZEOF_LONG_LONG   )
-	ecbuild_cache_check_type_size( float          EC_SIZEOF_FLOAT       )
-	ecbuild_cache_check_type_size( double         EC_SIZEOF_DOUBLE      )
-	ecbuild_cache_check_type_size( "long double"  EC_SIZEOF_LONG_DOUBLE )
-	ecbuild_cache_check_type_size( size_t         EC_SIZEOF_SIZE_T      )
-	ecbuild_cache_check_type_size( ssize_t        EC_SIZEOF_SSIZE_T     )
-	ecbuild_cache_check_type_size( off_t          EC_SIZEOF_OFF_T       )
-
-#	ecbuild_info( "sizeof void*  [${EC_SIZEOF_PTR}]" )
-#	ecbuild_info( "sizeof off_t  [${EC_SIZEOF_OFF_T}]" )
-#	ecbuild_info( "sizeof int    [${EC_SIZEOF_INT}]" )
-#	ecbuild_info( "sizeof short  [${EC_SIZEOF_SHORT}]" )
-#	ecbuild_info( "sizeof long   [${EC_SIZEOF_LONG}]" )
-#	ecbuild_info( "sizeof size_t [${EC_SIZEOF_SIZE_T}]" )
-#	ecbuild_info( "sizeof float  [${EC_SIZEOF_FLOAT}]" )
-#	ecbuild_info( "sizeof double [${EC_SIZEOF_DOUBLE}]" )
-#	ecbuild_info( "sizeof long long   [${EC_SIZEOF_LONG_LONG}]" )
-#	ecbuild_info( "sizeof long double [${EC_SIZEOF_LONG_DOUBLE}]" )
-
-#	ecbuild_info( "system sizeof :" )
-#	ecbuild_info( "  void*  [${EC_SIZEOF_PTR}]  size_t [${EC_SIZEOF_SIZE_T}]  off_t  [${EC_SIZEOF_OFF_T}]   short  [${EC_SIZEOF_SHORT}]" )
-#	ecbuild_info( "  int    [${EC_SIZEOF_INT}]  long   [${EC_SIZEOF_LONG}]  long long   [${EC_SIZEOF_LONG_LONG}]" )
-#	ecbuild_info( "  float  [${EC_SIZEOF_FLOAT}]  double [${EC_SIZEOF_DOUBLE}]  long double [${EC_SIZEOF_LONG_DOUBLE}]" )
+  set( EC_SIZEOF_PTR ${CMAKE_SIZEOF_VOID_P} )
+  ecbuild_cache_var( EC_SIZEOF_PTR )
+  ecbuild_cache_check_type_size( char           EC_SIZEOF_CHAR        )
+  ecbuild_cache_check_type_size( short          EC_SIZEOF_SHORT       )
+  ecbuild_cache_check_type_size( int            EC_SIZEOF_INT         )
+  ecbuild_cache_check_type_size( long           EC_SIZEOF_LONG        )
+  ecbuild_cache_check_type_size( "long long"    EC_SIZEOF_LONG_LONG   )
+  ecbuild_cache_check_type_size( float          EC_SIZEOF_FLOAT       )
+  ecbuild_cache_check_type_size( double         EC_SIZEOF_DOUBLE      )
+  ecbuild_cache_check_type_size( "long double"  EC_SIZEOF_LONG_DOUBLE )
+  ecbuild_cache_check_type_size( size_t         EC_SIZEOF_SIZE_T      )
+  ecbuild_cache_check_type_size( ssize_t        EC_SIZEOF_SSIZE_T     )
+  ecbuild_cache_check_type_size( off_t          EC_SIZEOF_OFF_T       )
+
+  ecbuild_debug( "sizeof void*       [${EC_SIZEOF_PTR}]" )
+  ecbuild_debug( "sizeof char        [${EC_SIZEOF_CHAR}]" )
+  ecbuild_debug( "sizeof short       [${EC_SIZEOF_SHORT}]" )
+  ecbuild_debug( "sizeof int         [${EC_SIZEOF_INT}]" )
+  ecbuild_debug( "sizeof long        [${EC_SIZEOF_LONG}]" )
+  ecbuild_debug( "sizeof long long   [${EC_SIZEOF_LONG_LONG}]" )
+  ecbuild_debug( "sizeof float       [${EC_SIZEOF_FLOAT}]" )
+  ecbuild_debug( "sizeof double      [${EC_SIZEOF_DOUBLE}]" )
+  ecbuild_debug( "sizeof long double [${EC_SIZEOF_LONG_DOUBLE}]" )
+  ecbuild_debug( "sizeof size_t      [${EC_SIZEOF_SIZE_T}]" )
+  ecbuild_debug( "sizeof ssize_t     [${EC_SIZEOF_SSIZE_T}]" )
+  ecbuild_debug( "sizeof off_t       [${EC_SIZEOF_OFF_T}]" )
 
 endif()
 
@@ -84,25 +81,25 @@ if( ENABLE_LARGE_FILE_SUPPORT )
 
   ecbuild_cache_check_type_size( off_t EC_SIZEOF_OFF_T )
 
-	if( EC_SIZEOF_OFF_T LESS "8" )
+  if( EC_SIZEOF_OFF_T LESS "8" )
 
-		if( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
-			add_definitions( -D_FILE_OFFSET_BITS=64 )
-		endif()
+    if( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
+      add_definitions( -D_FILE_OFFSET_BITS=64 )
+    endif()
 
-		if( ${CMAKE_SYSTEM_NAME} MATCHES "AIX" )
-			add_definitions( -D_LARGE_FILES=64 )
-		endif()
+    if( ${CMAKE_SYSTEM_NAME} MATCHES "AIX" )
+      add_definitions( -D_LARGE_FILES=64 )
+    endif()
 
-		get_directory_property( __compile_defs COMPILE_DEFINITIONS )
+    get_directory_property( __compile_defs COMPILE_DEFINITIONS )
 
-		if( __compile_defs )
-			foreach( def ${__compile_defs} )
-				list( APPEND CMAKE_REQUIRED_DEFINITIONS -D${def} )
-			endforeach()
-		endif()
+    if( __compile_defs )
+      foreach( def ${__compile_defs} )
+        list( APPEND CMAKE_REQUIRED_DEFINITIONS -D${def} )
+      endforeach()
+    endif()
 
-	endif()
+  endif()
 
 endif()
 
@@ -113,15 +110,15 @@ if( ENABLE_OS_ENDINESS_TEST )
 
   if( NOT DEFINED EC_BIG_ENDIAN AND NOT DEFINED EC_LITTLE_ENDIAN )
 
-  	test_big_endian( _BIG_ENDIAN )
+    test_big_endian( _BIG_ENDIAN )
 
-  	if( _BIG_ENDIAN )
+    if( _BIG_ENDIAN )
         set( EC_BIG_ENDIAN    1 )
         set( EC_LITTLE_ENDIAN 0 )
-  	else()
+    else()
         set( EC_BIG_ENDIAN    0 )
         set( EC_LITTLE_ENDIAN 1 )
-  	endif()
+    endif()
 
   endif()
 
@@ -129,35 +126,35 @@ if( ENABLE_OS_ENDINESS_TEST )
   ecbuild_cache_var( EC_LITTLE_ENDIAN )
 
   if( NOT DEFINED IEEE_BE )
-  	check_c_source_runs(
-  		 "int compare(unsigned char* a,unsigned char* b) {
-  		   while(*a != 0) if (*(b++)!=*(a++)) return 1;
-  		   return 0;
-  		 }
-  		 int main(int argc,char** argv) {
-  		   unsigned char dc[]={0x30,0x61,0xDE,0x80,0x93,0x67,0xCC,0xD9,0};
-  		   double da=1.23456789e-75;
-  		   unsigned char* ca;
+    check_c_source_runs(
+       "int compare(unsigned char* a,unsigned char* b) {
+         while(*a != 0) if (*(b++)!=*(a++)) return 1;
+         return 0;
+       }
+       int main(int argc,char** argv) {
+         unsigned char dc[]={0x30,0x61,0xDE,0x80,0x93,0x67,0xCC,0xD9,0};
+         double da=1.23456789e-75;
+         unsigned char* ca;
 
-  		   unsigned char fc[]={0x05,0x83,0x48,0x22,0};
-  		   float fa=1.23456789e-35;
+         unsigned char fc[]={0x05,0x83,0x48,0x22,0};
+         float fa=1.23456789e-35;
 
-  		   if (sizeof(double)!=8) return 1;
+         if (sizeof(double)!=8) return 1;
 
-  		   ca=(unsigned char*)&da;
-  		   if (compare(dc,ca)) return 1;
+         ca=(unsigned char*)&da;
+         if (compare(dc,ca)) return 1;
 
-  		   if (sizeof(float)!=4) return 1;
+         if (sizeof(float)!=4) return 1;
 
-  		   ca=(unsigned char*)&fa;
-  		   if (compare(fc,ca)) return 1;
+         ca=(unsigned char*)&fa;
+         if (compare(fc,ca)) return 1;
 
-  		   return 0;
-  		 }" IEEE_BE )
+         return 0;
+       }" IEEE_BE )
 
-  	if( "${IEEE_BE}" STREQUAL "" )
-  		set( IEEE_BE 0 CACHE INTERNAL "Test IEEE_BE")
-  	endif()
+    if( "${IEEE_BE}" STREQUAL "" )
+      set( IEEE_BE 0 CACHE INTERNAL "Test IEEE_BE")
+    endif()
 
   endif()
 
@@ -167,36 +164,36 @@ if( ENABLE_OS_ENDINESS_TEST )
     ecbuild_critical("Failed to sanity check on endiness: OS should be Big-Endian but compiled code runs differently -- to ignore this pass -DIEEE_BE=0 to CMake/ecBuild")
   endif()
 
-    if( NOT DEFINED IEEE_LE )
-  	check_c_source_runs(
-  		 "int compare(unsigned char* a,unsigned char* b) {
-  		   while(*a != 0) if (*(b++)!=*(a++)) return 1;
-  		   return 0;
-  		 }
-  		 int main(int argc,char** argv) {
-  		   unsigned char dc[]={0xD9,0xCC,0x67,0x93,0x80,0xDE,0x61,0x30,0};
-  		   double da=1.23456789e-75;
-  		   unsigned char* ca;
+  if( NOT DEFINED IEEE_LE )
+    check_c_source_runs(
+       "int compare(unsigned char* a,unsigned char* b) {
+         while(*a != 0) if (*(b++)!=*(a++)) return 1;
+         return 0;
+       }
+       int main(int argc,char** argv) {
+         unsigned char dc[]={0xD9,0xCC,0x67,0x93,0x80,0xDE,0x61,0x30,0};
+         double da=1.23456789e-75;
+         unsigned char* ca;
 
-  		   unsigned char fc[]={0x22,0x48,0x83,0x05,0};
-  		   float fa=1.23456789e-35;
+         unsigned char fc[]={0x22,0x48,0x83,0x05,0};
+         float fa=1.23456789e-35;
 
-  		   if (sizeof(double)!=8) return 1;
+         if (sizeof(double)!=8) return 1;
 
-  		   ca=(unsigned char*)&da;
-  		   if (compare(dc,ca)) return 1;
+         ca=(unsigned char*)&da;
+         if (compare(dc,ca)) return 1;
 
-  		   if (sizeof(float)!=4) return 1;
+         if (sizeof(float)!=4) return 1;
 
-  		   ca=(unsigned char*)&fa;
-  		   if (compare(fc,ca)) return 1;
+         ca=(unsigned char*)&fa;
+         if (compare(fc,ca)) return 1;
 
-  		   return 0;
-  		 }" IEEE_LE )
+         return 0;
+       }" IEEE_LE )
 
-  	if( "${IEEE_LE}" STREQUAL "" )
-  		set( IEEE_LE 0 CACHE INTERNAL "Test IEEE_LE")
-  	endif()
+    if( "${IEEE_LE}" STREQUAL "" )
+      set( IEEE_LE 0 CACHE INTERNAL "Test IEEE_LE")
+    endif()
   endif()
 
   ecbuild_cache_var( IEEE_LE )
@@ -281,102 +278,102 @@ if( UNIX )
 
   endif()
 
-	### Solaris ###
+  ### Solaris ###
 
-	if( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" )
-		set( EC_OS_NAME "solaris" )
-	endif()
+  if( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" )
+    set( EC_OS_NAME "solaris" )
+  endif()
 
-	### AIX ###
+  ### AIX ###
 
-	if( ${CMAKE_SYSTEM_NAME} MATCHES "AIX" )
+  if( ${CMAKE_SYSTEM_NAME} MATCHES "AIX" )
 
-		set( EC_OS_NAME "aix" )
+    set( EC_OS_NAME "aix" )
 
-		set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -bbigtoc" )
+    set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -bbigtoc" )
 
-		if( CMAKE_C_COMPILER_ID MATCHES "GNU" )
-			set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker" )
-		endif()
+    if( CMAKE_C_COMPILER_ID MATCHES "GNU" )
+      set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker" )
+    endif()
 
-		if( CMAKE_COMPILER_IS_GNUCC )
-			if( EC_OS_BITS EQUAL "64" )
-				ecbuild_add_c_flags("-maix64")
-			endif()
-			if( EC_OS_BITS EQUAL "32" )
-				ecbuild_add_c_flags("-maix32")
-			endif()
-		endif()
+    if( CMAKE_COMPILER_IS_GNUCC )
+      if( EC_OS_BITS EQUAL "64" )
+        ecbuild_add_c_flags("-maix64")
+      endif()
+      if( EC_OS_BITS EQUAL "32" )
+        ecbuild_add_c_flags("-maix32")
+      endif()
+    endif()
 
-		if( CMAKE_COMPILER_IS_GNUCXX )
-			if( EC_OS_BITS EQUAL "64" )
-				ecbuild_add_cxx_flags("-maix64")
-			endif()
-			if( EC_OS_BITS EQUAL "32" )
-				ecbuild_add_cxx_flags("-maix32")
-			endif()
-		endif()
+    if( CMAKE_COMPILER_IS_GNUCXX )
+      if( EC_OS_BITS EQUAL "64" )
+        ecbuild_add_cxx_flags("-maix64")
+      endif()
+      if( EC_OS_BITS EQUAL "32" )
+        ecbuild_add_cxx_flags("-maix32")
+      endif()
+    endif()
 
-		if( CMAKE_C_COMPILER_ID MATCHES "XL" )
+    if( CMAKE_C_COMPILER_ID MATCHES "XL" )
 
-			ecbuild_add_c_flags("-qpic=large")
+      ecbuild_add_c_flags("-qpic=large")
 #            ecbuild_add_c_flags("-qweaksymbol")
 
-			if(EC_OS_BITS EQUAL "32" )
-				ecbuild_add_c_flags("-q32")
-			endif()
+      if(EC_OS_BITS EQUAL "32" )
+        ecbuild_add_c_flags("-q32")
+      endif()
 
-			if(${CMAKE_BUILD_TYPE} MATCHES "Release" OR ${CMAKE_BUILD_TYPE} MATCHES "Production" )
-					ecbuild_add_c_flags("-qstrict")
-					ecbuild_add_c_flags("-qinline")
-			endif()
+      if(${CMAKE_BUILD_TYPE} MATCHES "Release" OR ${CMAKE_BUILD_TYPE} MATCHES "Production" )
+          ecbuild_add_c_flags("-qstrict")
+          ecbuild_add_c_flags("-qinline")
+      endif()
 
-			if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
-					ecbuild_add_c_flags("-qfullpath")
-					ecbuild_add_c_flags("-qkeepparm")
-			endif()
+      if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
+          ecbuild_add_c_flags("-qfullpath")
+          ecbuild_add_c_flags("-qkeepparm")
+      endif()
 
-		endif()
+    endif()
 
-		if( CMAKE_CXX_COMPILER_ID MATCHES "XL" )
+    if( CMAKE_CXX_COMPILER_ID MATCHES "XL" )
 
-			ecbuild_add_cxx_flags("-qpic=large")
-			ecbuild_add_cxx_flags("-bmaxdata:0x40000000")
-			ecbuild_add_cxx_flags("-qrtti")
-			ecbuild_add_cxx_flags("-qfuncsect")
+      ecbuild_add_cxx_flags("-qpic=large")
+      ecbuild_add_cxx_flags("-bmaxdata:0x40000000")
+      ecbuild_add_cxx_flags("-qrtti")
+      ecbuild_add_cxx_flags("-qfuncsect")
 
 #           ecbuild_add_cxx_flags("-qweaksymbol")
 
-			if(EC_OS_BITS EQUAL "32" )
-				ecbuild_add_cxx_flags("-q32")
-			endif()
+      if(EC_OS_BITS EQUAL "32" )
+        ecbuild_add_cxx_flags("-q32")
+      endif()
 
-			if(${CMAKE_BUILD_TYPE} MATCHES "Release" OR ${CMAKE_BUILD_TYPE} MATCHES "Production" )
-					ecbuild_add_cxx_flags("-qstrict")
-					ecbuild_add_cxx_flags("-qinline")
-			endif()
+      if(${CMAKE_BUILD_TYPE} MATCHES "Release" OR ${CMAKE_BUILD_TYPE} MATCHES "Production" )
+          ecbuild_add_cxx_flags("-qstrict")
+          ecbuild_add_cxx_flags("-qinline")
+      endif()
 
-			if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
-					ecbuild_add_cxx_flags("-qfullpath")
-					ecbuild_add_cxx_flags("-qkeepparm")
-			endif()
+      if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
+          ecbuild_add_cxx_flags("-qfullpath")
+          ecbuild_add_cxx_flags("-qkeepparm")
+      endif()
 
-		endif()
+    endif()
 
-		if( CMAKE_Fortran_COMPILER_ID MATCHES "XL" )
+    if( CMAKE_Fortran_COMPILER_ID MATCHES "XL" )
 
-			ecbuild_add_fortran_flags("-qxflag=dealloc_cfptr")
-			ecbuild_add_fortran_flags("-qextname")
-			ecbuild_add_fortran_flags("-qdpc=e")
-			ecbuild_add_fortran_flags("-bmaxdata:0x40000000")
-			ecbuild_add_fortran_flags("-bloadmap:loadmap -bmap:loadmap")
+      ecbuild_add_fortran_flags("-qxflag=dealloc_cfptr")
+      ecbuild_add_fortran_flags("-qextname")
+      ecbuild_add_fortran_flags("-qdpc=e")
+      ecbuild_add_fortran_flags("-bmaxdata:0x40000000")
+      ecbuild_add_fortran_flags("-bloadmap:loadmap -bmap:loadmap")
 
-			if(EC_OS_BITS EQUAL "32" )
-				ecbuild_add_fortran_flags("-q32")
-			endif()
-		endif()
+      if(EC_OS_BITS EQUAL "32" )
+        ecbuild_add_fortran_flags("-q32")
+      endif()
+    endif()
 
-	endif()
+  endif()
 
 endif()
 
@@ -384,8 +381,8 @@ endif()
 
 if( ${CMAKE_SYSTEM_NAME} MATCHES "CYGWIN" )
 
-	set( EC_OS_NAME "cygwin" )
-	ecbuild_warn( "Building on Cygwin should work but is untested" )
+  set( EC_OS_NAME "cygwin" )
+  ecbuild_warn( "Building on Cygwin should work but is untested" )
 
 endif()
 
@@ -393,12 +390,12 @@ endif()
 
 if( ${EC_OS_NAME} MATCHES "UNKNOWN" )
 
-	if( DISABLE_OS_CHECK )
-		ecbuild_warn( "ecBuild is untested for this operating system: [${CMAKE_SYSTEM_NAME}]"
+  if( DISABLE_OS_CHECK )
+    ecbuild_warn( "ecBuild is untested for this operating system: [${CMAKE_SYSTEM_NAME}]"
                   " -- DISABLE_OS_CHECK is ON so proceeding at your own risk ..." )
-	else()
-		ecbuild_critical( "ecBuild is untested for this operating system: [${CMAKE_SYSTEM_NAME}]"
+  else()
+    ecbuild_critical( "ecBuild is untested for this operating system: [${CMAKE_SYSTEM_NAME}]"
                       " -- refusing to continue. Disable this check with -DDISABLE_OS_CHECK=ON" )
-	endif()
+  endif()
 
 endif()
diff --git a/cmake/ecbuild_compiler_flags.cmake b/cmake/ecbuild_compiler_flags.cmake
index 0e3fe1e..a6c2944 100644
--- a/cmake/ecbuild_compiler_flags.cmake
+++ b/cmake/ecbuild_compiler_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -200,6 +200,12 @@ foreach( _lang C CXX Fortran )
 endforeach()
 
 # Apply user or toolchain specified linker flag overrides per object type (NOT written to cache)
+foreach( _obj EXE SHARED MODULE )
+  if( ECBUILD_${_obj}_LINKER_FLAGS )
+    set( CMAKE_${_obj}_LINKER_FLAGS ${ECBUILD_${_obj}_LINKER_FLAGS} )
+  endif()
+endforeach()
+
 foreach( _btype NONE DEBUG BIT PRODUCTION RELEASE RELWITHDEBINFO )
 
   foreach( _obj EXE SHARED MODULE )
diff --git a/cmake/ecbuild_config.h.in b/cmake/ecbuild_config.h.in
index df9eb91..2eed359 100644
--- a/cmake/ecbuild_config.h.in
+++ b/cmake/ecbuild_config.h.in
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 1996-2016 ECMWF.
+ * (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.
diff --git a/cmake/ecbuild_declare_project.cmake b/cmake/ecbuild_declare_project.cmake
index c95e8e3..e2f9cc8 100644
--- a/cmake/ecbuild_declare_project.cmake
+++ b/cmake/ecbuild_declare_project.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_define_build_types.cmake b/cmake/ecbuild_define_build_types.cmake
index cf92d23..7cfc591 100644
--- a/cmake/ecbuild_define_build_types.cmake
+++ b/cmake/ecbuild_define_build_types.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_define_libs_and_execs_target.cmake b/cmake/ecbuild_define_libs_and_execs_target.cmake
index 812f42c..799eb7d 100644
--- a/cmake/ecbuild_define_libs_and_execs_target.cmake
+++ b/cmake/ecbuild_define_libs_and_execs_target.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_define_links_target.cmake b/cmake/ecbuild_define_links_target.cmake
index b5f53fe..745288c 100644
--- a/cmake/ecbuild_define_links_target.cmake
+++ b/cmake/ecbuild_define_links_target.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_define_options.cmake b/cmake/ecbuild_define_options.cmake
index af40ae1..fc6376e 100644
--- a/cmake/ecbuild_define_options.cmake
+++ b/cmake/ecbuild_define_options.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_define_paths.cmake b/cmake/ecbuild_define_paths.cmake
index 6584b26..c5e4830 100644
--- a/cmake/ecbuild_define_paths.cmake
+++ b/cmake/ecbuild_define_paths.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_dont_pack.cmake b/cmake/ecbuild_dont_pack.cmake
index bc62182..9f9f4a4 100644
--- a/cmake/ecbuild_dont_pack.cmake
+++ b/cmake/ecbuild_dont_pack.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_download_resource.cmake b/cmake/ecbuild_download_resource.cmake
index 5d394f5..e1e8eff 100644
--- a/cmake/ecbuild_download_resource.cmake
+++ b/cmake/ecbuild_download_resource.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -18,25 +18,53 @@
 #
 # curl or wget is required (curl is preferred if available).
 #
+# The default timeout is 30 seconds, which can be overridden with
+# ``ECBUILD_DOWNLOAD_TIMEOUT``. Downloads are by default only tried once, use
+# ``ECBUILD_DOWNLOAD_RETRIES`` to set the number of retries.
+#
 ##############################################################################
 
 function( ecbuild_download_resource _p_OUT _p_URL )
 
+  # Do not retry downloads by default (ECBUILD-307)
+  if( NOT DEFINED ECBUILD_DOWNLOAD_RETRIES )
+    set( ECBUILD_DOWNLOAD_RETRIES 0 )
+  endif()
+  # Use default timeout of 30s if not specified (ECBUILD-307)
+  if( NOT DEFINED ECBUILD_DOWNLOAD_TIMEOUT )
+    set( ECBUILD_DOWNLOAD_TIMEOUT 30 )
+  endif()
+
   if( NOT EXISTS ${_p_OUT} )
 
     find_program( CURL_PROGRAM curl )
     mark_as_advanced(CURL_PROGRAM)
     if( CURL_PROGRAM )
-      execute_process( COMMAND ${CURL_PROGRAM} --silent --show-error --fail --output ${_p_OUT} ${_p_URL}
+
+      execute_process( COMMAND ${CURL_PROGRAM} --silent --show-error --fail
+                               --retry ${ECBUILD_DOWNLOAD_RETRIES}
+                               --connect-timeout ${ECBUILD_DOWNLOAD_TIMEOUT}
+                               --output ${_p_OUT} ${_p_URL}
                        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} RESULT_VARIABLE CMD_RESULT )
+
     else()
+
       find_program( WGET_PROGRAM wget )
+
       if( WGET_PROGRAM )
-        execute_process( COMMAND ${WGET_PROGRAM} -nv -O ${_p_OUT} ${_p_URL}
+
+        # wget takes the total number of tries, curl the number or retries
+        math( EXPR ECBUILD_DOWNLOAD_RETRIES ${ECBUILD_DOWNLOAD_RETRIES} + 1 )
+
+        execute_process( COMMAND ${WGET_PROGRAM} -nv -O ${_p_OUT}
+                                 -t ${ECBUILD_DOWNLOAD_RETRIES}
+                                 -T ${ECBUILD_DOWNLOAD_TIMEOUT} ${_p_URL}
                          WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} RESULT_VARIABLE CMD_RESULT )
+
       else()
         ecbuild_critical("Could not find curl or wget. Error downloading ${_p_URL}")
       endif()
+
     endif()
 
     if(CMD_RESULT)
diff --git a/cmake/ecbuild_echo_targets.cmake b/cmake/ecbuild_echo_targets.cmake
index 1406a1f..61250ee 100644
--- a/cmake/ecbuild_echo_targets.cmake
+++ b/cmake/ecbuild_echo_targets.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_enable_fortran.cmake b/cmake/ecbuild_enable_fortran.cmake
index c1c5503..9d86aa7 100644
--- a/cmake/ecbuild_enable_fortran.cmake
+++ b/cmake/ecbuild_enable_fortran.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -58,11 +58,19 @@ macro( ecbuild_enable_fortran )
   endif()
 
   if( CMAKE_Fortran_COMPILER_LOADED )
+
     include(CheckFortranFunctionExists)
     if( CMAKE_C_COMPILER_LOADED AND ENABLE_FORTRAN_C_INTERFACE )
       include(FortranCInterface)
     endif()
     set( EC_HAVE_FORTRAN 1 )
+
+    # see issue ECBUILD-298
+    if( CMAKE_Fortran_COMPILER_ID MATCHES PGI )
+      unset( CMAKE_Fortran_COMPILE_OPTIONS_PIE )
+      unset( CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS )
+    endif()
+
   endif()
 
   if( DEFINED _PAR_MODULE_DIRECTORY )
diff --git a/cmake/ecbuild_features.cmake b/cmake/ecbuild_features.cmake
index 6d20038..9406fd8 100644
--- a/cmake/ecbuild_features.cmake
+++ b/cmake/ecbuild_features.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -55,44 +55,3 @@ function( ecbuild_disable_feature _name )
   set_property(GLOBAL PROPERTY DISABLED_FEATURES "${_disabled_features}" )
 
 endfunction()
-
-# en/disable feature ${_name} and set its description and purpose
-function( ecbuild_set_feature _name )
-
-  set(options ) # none
-  set(oneValueArgs ENABLED )
-  set(multiValueArgs ) # none
-
-  cmake_parse_arguments( _PAR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
-
-  get_property( _feature_desc      GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION )
-  get_property( _enabled_features  GLOBAL PROPERTY ENABLED_FEATURES )
-  get_property( _disabled_features GLOBAL PROPERTY DISABLED_FEATURES )
-
-  if( DEFINED _PAR_ENABLED )
-    if( _PAR_ENABLED )
-      ecbuild_debug( "ecbuild_set_feature(${_name}): enabling feature" )
-      ecbuild_enable_feature( ${_name} )
-    else()
-      ecbuild_debug( "ecbuild_set_feature(${_name}): disabling feature" )
-      ecbuild_disable_feature( ${_name} )
-    endif()
-  endif()
-
-  ecbuild_enabled_features( _enabled_features )
-  list (FIND _enabled_features "${_name}" _index)
-  if (${_index} GREATER -1)
-    set( _feature_found 1 )
-  endif()
-
-  ecbuild_disabled_features( _disabled_features )
-  list (FIND _disabled_features "${_name}" _index)
-  if (${_index} GREATER -1)
-    set( _feature_found 1 )
-  endif()
-
-  if( NOT _feature_found )
-    ecbuild_warn( "Feature ${_name} has not yet been enabled or disabled" )
-  endif()
-
-endfunction()
diff --git a/cmake/ecbuild_find_fortranlibs.cmake b/cmake/ecbuild_find_fortranlibs.cmake
index 279833f..905d020 100644
--- a/cmake/ecbuild_find_fortranlibs.cmake
+++ b/cmake/ecbuild_find_fortranlibs.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_find_lexyacc.cmake b/cmake/ecbuild_find_lexyacc.cmake
index 5c13269..3dc8b61 100644
--- a/cmake/ecbuild_find_lexyacc.cmake
+++ b/cmake/ecbuild_find_lexyacc.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_find_mpi.cmake b/cmake/ecbuild_find_mpi.cmake
index a0c6cfa..85ae5e1 100644
--- a/cmake/ecbuild_find_mpi.cmake
+++ b/cmake/ecbuild_find_mpi.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_find_omp.cmake b/cmake/ecbuild_find_omp.cmake
index 914da24..ea9da24 100644
--- a/cmake/ecbuild_find_omp.cmake
+++ b/cmake/ecbuild_find_omp.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_find_package.cmake b/cmake/ecbuild_find_package.cmake
index f7f1a9c..71be044 100644
--- a/cmake/ecbuild_find_package.cmake
+++ b/cmake/ecbuild_find_package.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -17,6 +17,11 @@
 #   ecbuild_find_package( NAME <name>
 #                         [ VERSION <version> [ EXACT ] ]
 #                         [ COMPONENTS <component1> [ <component2> ... ] ]
+#                         [ URL <url> ]
+#                         [ DESCRIPTION <description> ]
+#                         [ TYPE <type> ]
+#                         [ PURPOSE <purpose> ]
+#                         [ FAILURE_MSG <message> ]
 #                         [ REQUIRED ]
 #                         [ QUIET ] )
 #
@@ -35,6 +40,23 @@
 # EXACT : optional, requires VERSION
 #   require the exact version rather than a minimum version
 #
+# URL : optional
+#   homepage of the package (shown in summary and stored in the cache)
+#
+# DESCRIPTION : optional
+#   literal string or name of CMake variable describing the package
+#
+# TYPE : optional, one of RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED
+#   type of dependency of the project on this package (defaults to OPTIONAL)
+#
+# PURPOSE : optional
+#   literal string or name of CMake variable describing which functionality
+#   this package enables in the project
+#
+# FAILURE_MSG : optional
+#   literal string or name of CMake variable containing a message to be
+#   appended to the failure message if the package is not found
+#
 # REQUIRED : optional
 #   fail if package cannot be found
 #
@@ -86,7 +108,7 @@
 macro( ecbuild_find_package )
 
   set( options REQUIRED QUIET EXACT )
-  set( single_value_args NAME VERSION )
+  set( single_value_args NAME VERSION URL DESCRIPTION TYPE PURPOSE FAILURE_MSG )
   set( multi_value_args COMPONENTS )
 
   cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
@@ -103,6 +125,12 @@ macro( ecbuild_find_package )
     ecbuild_critical("Call to ecbuild_find_package() requests EXACT but doesn't specify VERSION.")
   endif()
 
+  # If the package is required, set TYPE to REQUIRED
+  # Due to shortcomings in CMake's argument parser, passing TYPE REQUIRED has no effect
+  if( _PAR_REQUIRED )
+    set( _PAR_TYPE REQUIRED )
+  endif()
+
   # ecbuild_debug_var( _PAR_NAME )
 
   string( TOUPPER ${_PAR_NAME} pkgUPPER )
@@ -191,10 +219,10 @@ macro( ecbuild_find_package )
 
     if( NOT ${_PAR_NAME}_FOUND )
       if( ${_PAR_NAME}_PATH )
-        ecbuild_critical( "${_PAR_NAME}_PATH was provided by user but package ${_PAR_NAME} wasn't found" )
+        ecbuild_critical( "${_PAR_NAME}_PATH was provided by user but package ${_PAR_NAME} wasn't found at '${${_PAR_NAME}_PATH}'" )
       endif()
       if( ${pkgUPPER}_PATH )
-        ecbuild_critical( "${pkgUPPER}_PATH was provided by user but package ${_PAR_NAME} wasn't found" )
+        ecbuild_critical( "${pkgUPPER}_PATH was provided by user but package ${_PAR_NAME} wasn't found at '${${pkgUPPER}_PATH}'" )
       endif()
     endif()
 
@@ -288,20 +316,8 @@ macro( ecbuild_find_package )
 
   ### final messages
 
-  set( _failed_message
-    "\n"
-    "  ${PROJECT_NAME} FAILED to find package ${_PAR_NAME}\n"
-    "\n"
-    "    Provide location with \"-D${pkgUPPER}_PATH=/...\" or \"-D${_PAR_NAME}_DIR=/...\" \n"
-    "    You may also export environment variables ${pkgUPPER}_PATH or ${_PAR_NAME}_DIR\n"
-    "\n"
-    "  Values (note CAPITALISATION):\n"
-    "    ${pkgUPPER}_PATH should contain the path to the install prefix (as in <install>/bin <install>/lib <install>/include)\n"
-    "    ${_PAR_NAME}_DIR should be a directory containing a <package>-config.cmake file (usually <install>/share/<package>/cmake)\n"
-    "\n"
-    )
-
   if( ${_PAR_NAME}_FOUND OR ${pkgUPPER}_FOUND )
+
     if( NOT _PAR_QUIET )
       ecbuild_info( "[${_PAR_NAME}] (${${_PAR_NAME}_VERSION})" )
       foreach( var in ITEMS INCLUDE_DIR INCLUDE_DIRS DEFINITIONS LIBRARY LIBRARIES )
@@ -312,14 +328,41 @@ macro( ecbuild_find_package )
         endif()
       endforeach()
     endif()
+
+    if( DEFINED ${_PAR_DESCRIPTION} )
+      set( _PAR_DESCRIPTION ${${_PAR_DESCRIPTION}} )
+    endif()
+    if( DEFINED ${_PAR_PURPOSE} )
+      set( _PAR_PURPOSE ${${_PAR_PURPOSE}} )
+    endif()
+    set_package_properties( ${_PAR_NAME} PROPERTIES
+                            URL "${_PAR_URL}"
+                            DESCRIPTION "${_PAR_DESCRIPTION}"
+                            TYPE "${_PAR_TYPE}"
+                            PURPOSE "${_PAR_PURPOSE}" )
+
   else()
+
+    if( DEFINED ${_PAR_FAILURE_MSG} )
+      set( _PAR_FAILURE_MSG ${${_PAR_FAILURE_MSG}} )
+    endif()
+    set( _failed_message
+      "  ${PROJECT_NAME} FAILED to find package ${_PAR_NAME}\n"
+      "    Provide location with \"-D${pkgUPPER}_PATH=/...\" or \"-D${_PAR_NAME}_DIR=/...\" \n"
+      "    You may also export environment variables ${pkgUPPER}_PATH or ${_PAR_NAME}_DIR\n"
+      "  Values (note CAPITALISATION):\n"
+      "    ${pkgUPPER}_PATH should contain the path to the install prefix (as in <install>/bin <install>/lib <install>/include)\n"
+      "    ${_PAR_NAME}_DIR should be a directory containing a <package>-config.cmake file (usually <install>/share/<package>/cmake)\n"
+      )
+
     if( _PAR_REQUIRED )
-      ecbuild_critical( ${_failed_message} " !! ${PROJECT_NAME} requires package ${_PAR_NAME} !!" )
+      ecbuild_critical( "${_failed_message}!! ${PROJECT_NAME} requires package ${_PAR_NAME} !!\n${_PAR_FAILURE_MSG}" )
     else()
       if( NOT _PAR_QUIET )
-        ecbuild_warn( ${_failed_message} )
+        ecbuild_warn( "${_failed_message}\n${_PAR_FAILURE_MSG}" )
       endif()
     endif()
+
   endif()
 
 endmacro()
diff --git a/cmake/ecbuild_find_perl.cmake b/cmake/ecbuild_find_perl.cmake
index 97b22f8..b6c1825 100644
--- a/cmake/ecbuild_find_perl.cmake
+++ b/cmake/ecbuild_find_perl.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/ecbuild_find_python.cmake b/cmake/ecbuild_find_python.cmake
index d3cf377..0e9adaa 100644
--- a/cmake/ecbuild_find_python.cmake
+++ b/cmake/ecbuild_find_python.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -67,8 +67,10 @@ function( ecbuild_find_python )
       ecbuild_critical("Unknown keywords given to ecbuild_find_python(): \"${_p_UNPARSED_ARGUMENTS}\"")
     endif()
     if( _p_REQUIRED )
+      ecbuild_debug( "ecbuild_find_python: Searching for Python interpreter (required) ..." )
       set( _p_REQUIRED REQUIRED )
     else()
+      ecbuild_debug( "ecbuild_find_python: Searching for Python interpreter ..." )
       unset( _p_REQUIRED )
     endif()
 
@@ -81,7 +83,7 @@ function( ecbuild_find_python )
     # If no suitable version was found, search again with the version specified
     if( PYTHONINTERP_FOUND AND _p_VERSION )
       if( _p_VERSION VERSION_GREATER "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}" )
-        ecbuild_debug( "ecbuild_find_python: Found Python interpreter version ${PYTHON_VERSION_STRING} at ${PYTHON_EXECUTABLE}, however version ${_p_VERSION} is required. Searching again..." )
+        ecbuild_debug( "ecbuild_find_python: Found Python interpreter version '${PYTHON_VERSION_STRING}' at '${PYTHON_EXECUTABLE}', however version '${_p_VERSION}' is required. Searching again..." )
         unset( PYTHONINTERP_FOUND )
         unset( PYTHON_EXECUTABLE )
         unset( PYTHON_EXECUTABLE CACHE )
@@ -93,10 +95,14 @@ function( ecbuild_find_python )
       endif()
     endif()
 
+    set_package_properties( PythonInterp PROPERTIES
+                            URL http://python.org
+                            DESCRIPTION "Python interpreter" )
+
     set( __required_vars PYTHONINTERP_FOUND )
 
     if( PYTHONINTERP_FOUND )
-        ecbuild_debug( "ecbuild_find_python: Found Python interpreter version ${PYTHON_VERSION_STRING} at ${PYTHON_EXECUTABLE}" )
+        ecbuild_debug( "ecbuild_find_python: Found Python interpreter version '${PYTHON_VERSION_STRING}' at '${PYTHON_EXECUTABLE}'" )
 
         # find where python site-packages are ...
 
@@ -104,10 +110,15 @@ function( ecbuild_find_python )
             execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
         endif()
         ecbuild_debug( "ecbuild_find_python: PYTHON_SITE_PACKAGES=${PYTHON_SITE_PACKAGES}" )
+    else()
+        ecbuild_debug( "ecbuild_find_python: could NOT find Python interpreter!" )
     endif()
 
-    if( PYTHONINTERP_FOUND AND NOT _p_NO_LIBS )
+    if( PYTHONINTERP_FOUND AND _p_NO_LIBS )
+        ecbuild_debug( "ecbuild_find_python: NOT searching for Python libraries" )
+    elseif( PYTHONINTERP_FOUND )
         list( APPEND __required_vars PYTHONLIBS_FOUND PYTHON_LIBS_WORKING )
+        ecbuild_debug( "ecbuild_find_python: Searching for Python libraries ..." )
 
         # find python config
 
@@ -124,7 +135,7 @@ function( ecbuild_find_python )
                                 python-config )
         endif()
 
-        ecbuild_debug_var( PYTHON_CONFIG_EXECUTABLE )
+        ecbuild_debug( "ecbuild_find_python: found python-config at '${PYTHON_CONFIG_EXECUTABLE}'" )
 
         # find python libs
 
@@ -132,33 +143,39 @@ function( ecbuild_find_python )
         # that don't reliably report linking flags that will work.
 
         if( PYTHON_CONFIG_EXECUTABLE AND NOT ( PYTHON_NO_CONFIG OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" ) )
-            ecbuild_debug( "ecbuild_find_python: Searching for Python include directories and libraries using ${PYTHON_CONFIG_EXECUTABLE}" )
+            ecbuild_debug( "ecbuild_find_python: Searching for Python include directories and libraries using '${PYTHON_CONFIG_EXECUTABLE}'" )
 
-            if( NOT PYTHON_LIBRARY )
+            if( DEFINED PYTHON_LIBRARY )
+              ecbuild_debug( "ecbuild_find_python: PYTHON_LIBRARY already set to '${PYTHON_LIBRARY}'" )
+            else()
               execute_process(COMMAND "${PYTHON_CONFIG_EXECUTABLE}" --prefix
                               OUTPUT_VARIABLE PYTHON_PREFIX
                               OUTPUT_STRIP_TRAILING_WHITESPACE
                               ERROR_QUIET)
+              ecbuild_debug( "ecbuild_find_python: PYTHON_PREFIX=${PYTHON_PREFIX}" )
 
               execute_process(COMMAND "${PYTHON_CONFIG_EXECUTABLE}" --ldflags
                               OUTPUT_VARIABLE PYTHON_LIBRARY
                               OUTPUT_STRIP_TRAILING_WHITESPACE
                               ERROR_QUIET)
+              ecbuild_debug( "ecbuild_find_python: PYTHON_LIBRARY=${PYTHON_LIBRARY}" )
 
               # Prepend -L and and set the RPATH to the lib directory under the
               # Python install prefix unless it is a standard system prefix path
               if( PYTHON_LIBRARY AND PYTHON_PREFIX AND NOT CMAKE_SYSTEM_PREFIX_PATH MATCHES ${PYTHON_PREFIX} )
+                ecbuild_debug( "ecbuild_find_python: Python libraries not in CMAKE_SYSTEM_PREFIX_PATH, prepending PYTHON_PREFIX '${PYTHON_PREFIX}' to PYTHON_LIBRARY" )
                 set( PYTHON_LIBRARY "-L${PYTHON_PREFIX}/lib -Wl,-rpath,${PYTHON_PREFIX}/lib ${PYTHON_LIBRARY}" )
               endif()
-
-              set( PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}" CACHE PATH
-                   "Path to where Python.h is found" FORCE )
             endif()
 
-            if(DEFINED PYTHON_INCLUDE_PATH AND NOT DEFINED PYTHON_INCLUDE_DIR)
+            if( DEFINED PYTHON_INCLUDE_DIR )
+              ecbuild_debug( "ecbuild_find_python: PYTHON_INCLUDE_DIR already set to '${PYTHON_INCLUDE_DIR}'" )
+            elseif(DEFINED PYTHON_INCLUDE_PATH AND NOT DEFINED PYTHON_INCLUDE_DIR)
+              ecbuild_debug( "ecbuild_find_python: PYTHON_INCLUDE_PATH already set to '${PYTHON_INCLUDE_PATH}'" )
+              ecbuild_deprecate( "ecbuild_find_python: PYTHON_INCLUDE_PATH is deprecated, use PYTHON_INCLUDE_DIR instead!" )
               set( PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_PATH}" CACHE PATH
                    "Path to where Python.h is found" FORCE )
-            elseif( NOT PYTHON_INCLUDE_DIR )
+            else()
               execute_process(COMMAND "${PYTHON_CONFIG_EXECUTABLE}" --includes
                               OUTPUT_VARIABLE PYTHON_INCLUDE_DIR
                               OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -168,6 +185,7 @@ function( ecbuild_find_python )
               string(REGEX REPLACE "[ ]-I" " " PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}")
 
               separate_arguments(PYTHON_INCLUDE_DIR)
+              ecbuild_debug( "ecbuild_find_python: PYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIR}" )
               set( PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}" CACHE PATH
                    "Path to where Python.h is found" FORCE )
 
@@ -184,23 +202,34 @@ function( ecbuild_find_python )
 
             find_package( PythonLibs "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}" ${_p_REQUIRED} )
 
+            set_package_properties( PythonLibs PROPERTIES
+                                    URL http://python.org
+                                    DESCRIPTION "Python library and header" )
+
         endif()
 
         # Remove duplicate include directories
         list(REMOVE_DUPLICATES PYTHON_INCLUDE_DIRS)
 
+        ecbuild_debug( "ecbuild_find_python: PYTHON_INCLUDE_DIRS=${PYTHON_INCLUDE_DIRS}" )
+        ecbuild_debug( "ecbuild_find_python: PYTHON_LIBRARIES=${PYTHON_LIBRARIES}" )
 
         if( PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS )
+            ecbuild_debug( "ecbuild_find_python: trying to link executable with Python libraries ..." )
             # Test if we can link against the Python libraries and include Python.h
             try_compile( PYTHON_LIBS_WORKING ${CMAKE_CURRENT_BINARY_DIR}
                          ${__test_python}
                          CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${PYTHON_INCLUDE_DIRS}"
                          LINK_LIBRARIES ${PYTHON_LIBRARIES}
                          OUTPUT_VARIABLE __try_compile_output )
-            if( NOT PYTHON_LIBS_WORKING )
+            if( PYTHON_LIBS_WORKING )
+              ecbuild_debug( "ecbuild_find_python: trying to link executable with Python libraries successful" )
+            else()
               ecbuild_debug( "ecbuild_find_python: trying to link executable with Python libraries failed\n${__try_compile_output}" )
             endif()
 
+        else()
+            ecbuild_debug( "ecbuild_find_python: Python library and include diretory not found" )
         endif()
 
     endif()
diff --git a/cmake/ecbuild_generate_config_headers.cmake b/cmake/ecbuild_generate_config_headers.cmake
index 6bc8301..8f2d44e 100644
--- a/cmake/ecbuild_generate_config_headers.cmake
+++ b/cmake/ecbuild_generate_config_headers.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_generate_fortran_interfaces.cmake b/cmake/ecbuild_generate_fortran_interfaces.cmake
index 93c7414..a127315 100644
--- a/cmake/ecbuild_generate_fortran_interfaces.cmake
+++ b/cmake/ecbuild_generate_fortran_interfaces.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_generate_rpc.cmake b/cmake/ecbuild_generate_rpc.cmake
index f06624f..e475f19 100644
--- a/cmake/ecbuild_generate_rpc.cmake
+++ b/cmake/ecbuild_generate_rpc.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_generate_yy.cmake b/cmake/ecbuild_generate_yy.cmake
index 35088fb..ea7ec13 100644
--- a/cmake/ecbuild_generate_yy.cmake
+++ b/cmake/ecbuild_generate_yy.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_get_cxx11_flags.cmake b/cmake/ecbuild_get_cxx11_flags.cmake
index a97fe11..acb0b21 100644
--- a/cmake/ecbuild_get_cxx11_flags.cmake
+++ b/cmake/ecbuild_get_cxx11_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_get_date.cmake b/cmake/ecbuild_get_date.cmake
index 730ea54..0f94d7d 100644
--- a/cmake/ecbuild_get_date.cmake
+++ b/cmake/ecbuild_get_date.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/ecbuild_get_resources.cmake b/cmake/ecbuild_get_resources.cmake
index f531d82..d6c20e4 100644
--- a/cmake/ecbuild_get_resources.cmake
+++ b/cmake/ecbuild_get_resources.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_get_test_data.cmake b/cmake/ecbuild_get_test_data.cmake
index 42185f1..37ea904 100644
--- a/cmake/ecbuild_get_test_data.cmake
+++ b/cmake/ecbuild_get_test_data.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -19,6 +19,15 @@ function( _download_test_data _p_NAME _p_DIRNAME )
   #set(ENV{http_proxy} "http://proxy.ecmwf.int:3333")
   #endif()
 
+  # Do not retry downloads by default (ECBUILD-307)
+  if( NOT DEFINED ECBUILD_DOWNLOAD_RETRIES )
+    set( ECBUILD_DOWNLOAD_RETRIES 0 )
+  endif()
+  # Use default timeout of 30s if not specified (ECBUILD-307)
+  if( NOT DEFINED ECBUILD_DOWNLOAD_TIMEOUT )
+    set( ECBUILD_DOWNLOAD_TIMEOUT 30 )
+  endif()
+
   find_program( CURL_PROGRAM curl )
   mark_as_advanced(CURL_PROGRAM)
 
@@ -27,6 +36,8 @@ function( _download_test_data _p_NAME _p_DIRNAME )
     add_custom_command( OUTPUT ${_p_NAME}
       COMMENT "(curl) downloading http://download.ecmwf.org/test-data/${_p_DIRNAME}/${_p_NAME}"
       COMMAND ${CURL_PROGRAM} --silent --show-error --fail --output ${_p_NAME}
+              --retry ${ECBUILD_DOWNLOAD_RETRIES}
+              --connect-timeout ${ECBUILD_DOWNLOAD_TIMEOUT}
               http://download.ecmwf.org/test-data/${_p_DIRNAME}/${_p_NAME} )
 
   else()
@@ -35,9 +46,13 @@ function( _download_test_data _p_NAME _p_DIRNAME )
 
     if( WGET_PROGRAM )
 
+      # wget takes the total number of tries, curl the number or retries
+      math( EXPR ECBUILD_DOWNLOAD_RETRIES ${ECBUILD_DOWNLOAD_RETRIES} + 1 )
+
       add_custom_command( OUTPUT ${_p_NAME}
         COMMENT "(wget) downloading http://download.ecmwf.org/test-data/${_p_DIRNAME}/${_p_NAME}"
         COMMAND ${WGET_PROGRAM} -nv -O ${_p_NAME}
+                -t ${ECBUILD_DOWNLOAD_RETRIES} -T ${ECBUILD_DOWNLOAD_TIMEOUT}
                 http://download.ecmwf.org/test-data/${_p_DIRNAME}/${_p_NAME} )
 
     else()
@@ -105,6 +120,10 @@ endfunction()
 # given as the ``MD5`` argument or downloaded from the server otherwise. Use
 # the argument ``NOCHECK`` to disable this check.
 #
+# The default timeout is 30 seconds, which can be overridden with
+# ``ECBUILD_DOWNLOAD_TIMEOUT``. Downloads are by default only tried once, use
+# ``ECBUILD_DOWNLOAD_RETRIES`` to set the number of retries.
+#
 # Examples
 # --------
 #
diff --git a/cmake/ecbuild_git.cmake b/cmake/ecbuild_git.cmake
index 0a378a6..b2d38fa 100644
--- a/cmake/ecbuild_git.cmake
+++ b/cmake/ecbuild_git.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_install_project.cmake b/cmake/ecbuild_install_project.cmake
index 5e26bea..ddba836 100644
--- a/cmake/ecbuild_install_project.cmake
+++ b/cmake/ecbuild_install_project.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -70,6 +70,17 @@
 #
 ##############################################################################
 
+function( ecbuild_set_if_not_defined VAR VALUE )
+
+    if(NOT DEFINED ${VAR})
+        set( ${VAR} "${VALUE}" PARENT_SCOPE )
+        # ecbuild_info("Variable not defined, setting ${VAR} => ${VALUE}")
+    # else()
+        # ecbuild_info("${VAR} == ${${VAR}}")
+    endif()
+
+endfunction()
+
 macro( ecbuild_install_project )
 
     set( options )
@@ -112,36 +123,34 @@ macro( ecbuild_install_project )
 
     # name, version, etc ...
 
-    set(CPACK_PACKAGE_NAME      "${_PAR_NAME}")
-    set(CPACK_PACKAGE_VERSION   "${${PNAME}_VERSION_STR}")
-
-    set(CPACK_PACKAGE_FILE_NAME   "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
+    ecbuild_set_if_not_defined(CPACK_PACKAGE_NAME      "${_PAR_NAME}")
+    ecbuild_set_if_not_defined(CPACK_PACKAGE_VERSION   "${${PNAME}_VERSION_STR}")
 
-    set(CPACK_DEBIAN_PACKAGE_MAINTAINER "ECMWF") # required for DEB
+    ecbuild_set_if_not_defined(CPACK_PACKAGE_FILE_NAME   "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
 
+    #    set(CPACK_DEBIAN_PACKAGE_MAINTAINER "ECMWF") # required for DEB
     #    set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
     #    set(CPACK_RPM_COMPONENT_INSTALL "ON")
 
-    #    set(CPACK_GENERATOR        "TGZ;RPM;DEB")
-    set(CPACK_GENERATOR        "TGZ")
-    set(CPACK_SOURCE_GENERATOR "TGZ")
-    set(CPACK_PACKAGE_VENDOR   "ECMWF")
+    ecbuild_set_if_not_defined(CPACK_SOURCE_GENERATOR "TGZ")
+    ecbuild_set_if_not_defined(CPACK_GENERATOR "TGZ")
+    ecbuild_set_if_not_defined(CPACK_PACKAGE_VENDOR "ECMWF")
 
     # short description
 
     if( _PAR_DESCRIPTION )
-        set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${_PAR_DESCRIPTION}" )
+        ecbuild_set_if_not_defined(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${_PAR_DESCRIPTION}" )
     else()
-        set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${_PAR_NAME} misses a description" )
+        ecbuild_set_if_not_defined(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${_PAR_NAME} misses a description" )
     endif()
 
     # long description
 
     if( EXISTS ${PROJECT_SOURCE_DIR}/INSTALL )
-        set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/INSTALL")
+        ecbuild_set_if_not_defined(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/INSTALL")
     endif()
     if( EXISTS ${PROJECT_SOURCE_DIR}/LICENSE )
-        set(CPACK_RESOURCE_FILE_LICENSE    "${PROJECT_SOURCE_DIR}/LICENSE")
+        ecbuild_set_if_not_defined(CPACK_RESOURCE_FILE_LICENSE    "${PROJECT_SOURCE_DIR}/LICENSE")
     endif()
 
     # set(CPACK_PACKAGE_EXECUTABLES ${ECBUILD_ALL_EXES})
diff --git a/cmake/ecbuild_list_add_pattern.cmake b/cmake/ecbuild_list_add_pattern.cmake
index 0f68217..a0f9f34 100644
--- a/cmake/ecbuild_list_add_pattern.cmake
+++ b/cmake/ecbuild_list_add_pattern.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_list_exclude_pattern.cmake b/cmake/ecbuild_list_exclude_pattern.cmake
index 7e02f47..bfb6ee8 100644
--- a/cmake/ecbuild_list_exclude_pattern.cmake
+++ b/cmake/ecbuild_list_exclude_pattern.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_list_extra_search_paths.cmake b/cmake/ecbuild_list_extra_search_paths.cmake
index b81f062..1ba31bc 100644
--- a/cmake/ecbuild_list_extra_search_paths.cmake
+++ b/cmake/ecbuild_list_extra_search_paths.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_list_macros.cmake b/cmake/ecbuild_list_macros.cmake
index 176a161..232e5e8 100644
--- a/cmake/ecbuild_list_macros.cmake
+++ b/cmake/ecbuild_list_macros.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_log.cmake b/cmake/ecbuild_log.cmake
index 32a1398..ca058fe 100644
--- a/cmake/ecbuild_log.cmake
+++ b/cmake/ecbuild_log.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -27,9 +27,10 @@
 # Furthermore there are auxilliary functions for outputting CMake variables,
 # CMake lists and environment variables if the log level is ``DEBUG``:
 #
-# :ecbuild_debug_var:     logs given CMake variables if log level <= ``DEBUG``
-# :ecbuild_debug_list:    logs given CMake lists if log level <= ``DEBUG``
-# :ecbuild_debug_env_var: logs given environment variables if log level <= ``DEBUG``
+# :ecbuild_debug_var:      logs given CMake variables if log level <= ``DEBUG``
+# :ecbuild_debug_list:     logs given CMake lists if log level <= ``DEBUG``
+# :ecbuild_debug_env_var:  logs given environment variables if log level <= ``DEBUG``
+# :ecbuild_debug_property: logs given global CMake property if log level <= ``DEBUG``
 #
 # To log a message to the ecBuild log file only at a given log level, use ::
 #
@@ -235,31 +236,14 @@ function( ecbuild_debug_env_var )
 endfunction()
 
 ##############################################################################
-# macro for debugging a cmake variable
+# function for debugging a CMake global property
 
-macro( debug_var VAR )
-
-    message( WARNING "DEPRECATED debug_var() -- ${VAR} [${${VAR}}]" )
-
-endmacro()
-
-##############################################################################
-# macro for debugging a cmake list
-
-macro( debug_list VAR )
-
-    message( WARNING "DEPRECATED debug_list() -- ${VAR}:" )
-    foreach( _elem ${${VAR}} )
-      message( WARNING "  ${_elem}" )
-    endforeach()
-
-endmacro()
-
-##############################################################################
-# macro for debugging a environment variable within cmake
-
-macro( debug_env_var VAR )
-
-    message( WARNING "DEPRECATED debug_env_var() -- ENV ${VAR} [$ENV{${VAR}}]" )
-
-endmacro()
+function( ecbuild_debug_property )
+  foreach( VAR ${ARGV} )
+    get_property( __prop GLOBAL PROPERTY ${VAR} )
+    ecbuild_log(DEBUG "PROPERTY ${VAR} : ${__prop}")
+    if( ECBUILD_LOG_LEVEL LESS 11)
+      message(STATUS "${Blue}DEBUG - PROPERTY ${VAR} [${__prop}]${ColourReset}")
+    endif()
+  endforeach()
+endfunction()
diff --git a/cmake/ecbuild_pkgconfig.cmake b/cmake/ecbuild_pkgconfig.cmake
index d839a86..ed1076d 100644
--- a/cmake/ecbuild_pkgconfig.cmake
+++ b/cmake/ecbuild_pkgconfig.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_policies.cmake b/cmake/ecbuild_policies.cmake
index 36ab7fe..df2b40f 100644
--- a/cmake/ecbuild_policies.cmake
+++ b/cmake/ecbuild_policies.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_print_summary.cmake b/cmake/ecbuild_print_summary.cmake
index 6fc70d0..c863e60 100644
--- a/cmake/ecbuild_print_summary.cmake
+++ b/cmake/ecbuild_print_summary.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -89,17 +89,23 @@ macro( ecbuild_print_summary )
 
     ecbuild_info( "common definitions: ${defs}" )
 
-    ecbuild_info( "---------------------------------------------------------" )
-
     ### FEATURE SUMMARY
 
-    # ecbuild_debug_var( CMAKE_VERSION )
+    ecbuild_info( "---------------------------------------------------------" )
+    ecbuild_info( "Feature summary" )
+    ecbuild_info( "---------------------------------------------------------" )
+
     if( ${CMAKE_VERSION} VERSION_LESS "2.8.6" )
-      feature_summary( WHAT ALL )
+      set( __what ALL )
     else()
-      feature_summary( WHAT ALL INCLUDE_QUIET_PACKAGES )
+      set( __what ALL INCLUDE_QUIET_PACKAGES )
     endif()
 
+    # Print feature summary
+    feature_summary( WHAT ${__what} )
+    # Write feature summary to ecbuild.log
+    feature_summary( WHAT ${__what} FILENAME ${ECBUILD_LOG_FILE} APPEND )
+
     ### WARNINGS
 
     # issue warnings / errors in case there are unused project files
diff --git a/cmake/ecbuild_project_files.cmake b/cmake/ecbuild_project_files.cmake
index 3e4b3d2..12c07c2 100644
--- a/cmake/ecbuild_project_files.cmake
+++ b/cmake/ecbuild_project_files.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_remove_fortran_flags.cmake b/cmake/ecbuild_remove_fortran_flags.cmake
index 3a80316..2a41f04 100644
--- a/cmake/ecbuild_remove_fortran_flags.cmake
+++ b/cmake/ecbuild_remove_fortran_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_requires_macro_version.cmake b/cmake/ecbuild_requires_macro_version.cmake
index 1603446..8ff5617 100644
--- a/cmake/ecbuild_requires_macro_version.cmake
+++ b/cmake/ecbuild_requires_macro_version.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_separate_sources.cmake b/cmake/ecbuild_separate_sources.cmake
index 00722ae..69b6810 100644
--- a/cmake/ecbuild_separate_sources.cmake
+++ b/cmake/ecbuild_separate_sources.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -37,10 +37,11 @@
 # :<target>_cxx_srcs:     source files with extension .cc, .cxx, .cpp, .C
 # :<target>_fortran_srcs: source files with extension .f, .F, .for, f77, .f90,
 #                                                     .f95, .F77, .F90, .F95
+# :<target>_cuda_srcs:    source files with extension .cu
 #
 ##############################################################################
 
-macro( ecbuild_separate_sources )
+function( ecbuild_separate_sources )
 
 	set( options )
 	set( single_value_args TARGET  )
@@ -83,11 +84,20 @@ macro( ecbuild_separate_sources )
 			list( APPEND ${_PAR_TARGET}_fortran_srcs ${src} )
 		endif()
 	endforeach()
-	set_source_files_properties( ${${_PAR_TARGET}_fortran_srcs} PROPERTIES LANGUAGE Fortran )
 
-#    ecbuild_debug_var( ${_PAR_TARGET}_h_srcs )
-#    ecbuild_debug_var( ${_PAR_TARGET}_c_srcs )
-#    ecbuild_debug_var( ${_PAR_TARGET}_cxx_srcs )
-#    ecbuild_debug_var( ${_PAR_TARGET}_fortran_srcs )
+    foreach( src ${_PAR_SOURCES} )
+        if(${src} MATCHES "(\\.cu$)")
+            list( APPEND ${_PAR_TARGET}_cuda_srcs ${src} )
+        endif()
+    endforeach()
 
-endmacro( ecbuild_separate_sources )
+    set_source_files_properties( ${${_PAR_TARGET}_fortran_srcs} PROPERTIES LANGUAGE Fortran )
+
+    set( ${_PAR_TARGET}_h_srcs       "${${_PAR_TARGET}_h_srcs}"       PARENT_SCOPE )
+    set( ${_PAR_TARGET}_c_srcs       "${${_PAR_TARGET}_c_srcs}"       PARENT_SCOPE )
+    set( ${_PAR_TARGET}_cxx_srcs     "${${_PAR_TARGET}_cxx_srcs}"     PARENT_SCOPE )
+    set( ${_PAR_TARGET}_fortran_srcs "${${_PAR_TARGET}_fortran_srcs}" PARENT_SCOPE )
+    set( ${_PAR_TARGET}_cuda_srcs    "${${_PAR_TARGET}_cuda_srcs}"    PARENT_SCOPE )
+
+
+endfunction( ecbuild_separate_sources )
diff --git a/cmake/ecbuild_source_flags.cmake b/cmake/ecbuild_source_flags.cmake
index a281f1d..bd63258 100644
--- a/cmake/ecbuild_source_flags.cmake
+++ b/cmake/ecbuild_source_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_system.cmake b/cmake/ecbuild_system.cmake
index f02113e..10af0c8 100644
--- a/cmake/ecbuild_system.cmake
+++ b/cmake/ecbuild_system.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -62,6 +62,12 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
     # Include log macros since these are used right away
     include( ecbuild_log )
 
+    execute_process( COMMAND env OUTPUT_VARIABLE __env )
+    ecbuild_debug( "---------------------------------------------------------" )
+    ecbuild_debug( "Environment:" )
+    ecbuild_debug( "---------------------------------------------------------\n${__env}" )
+    ecbuild_debug( "---------------------------------------------------------" )
+
     ecbuild_info( "ecbuild   ${ecbuild_VERSION_STR}\t${ECBUILD_MACROS_DIR}" )
     ecbuild_info( "cmake     ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}\t${CMAKE_COMMAND}" )
 
@@ -78,7 +84,7 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
       ecbuild_info( "cache     ${ECBUILD_CACHE}" )
     endif()
 
-    message( STATUS "---------------------------------------------------------" )
+    ecbuild_info( "---------------------------------------------------------" )
 
     # clear the build dir exported targets file (only on the top project)
 
@@ -250,7 +256,7 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
         set( EC_BUILD_TIMESTAMP  "${EC_BUILD_TIMESTAMP}" CACHE INTERNAL "Build timestamp" )
     endif()
 
-    message( STATUS "---------------------------------------------------------" )
+    ecbuild_info( "---------------------------------------------------------" )
 
 else()
 
@@ -259,7 +265,7 @@ else()
     # or
     #     set( ECBUILD_CONFIG "<subproject-config>.cmake" )
     if( ECBUILD_CONFIG )
-        message( STATUS "---------------------------------------------------------" )
+        ecbuild_info( "---------------------------------------------------------" )
         ecbuild_info( "config    ${ECBUILD_CONFIG}" )
         include( ${ECBUILD_CONFIG} )
     endif()
diff --git a/cmake/ecbuild_target_flags.cmake b/cmake/ecbuild_target_flags.cmake
index 4c589af..b6527d1 100644
--- a/cmake/ecbuild_target_flags.cmake
+++ b/cmake/ecbuild_target_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/ecbuild_use_package.cmake b/cmake/ecbuild_use_package.cmake
index c88bca8..d54e459 100644
--- a/cmake/ecbuild_use_package.cmake
+++ b/cmake/ecbuild_use_package.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
@@ -16,6 +16,11 @@
 #
 #   ecbuild_use_package( PROJECT <name>
 #                        [ VERSION <version> [ EXACT ] ]
+#                        [ URL <url> ]
+#                        [ DESCRIPTION <description> ]
+#                        [ TYPE <type> ]
+#                        [ PURPOSE <purpose> ]
+#                        [ FAILURE_MSG <message> ]
 #                        [ REQUIRED ]
 #                        [ QUIET ] )
 #
@@ -31,6 +36,21 @@
 # EXACT : optional, requires VERSION
 #   require the exact version rather than a minimum version
 #
+# URL : optional
+#   homepage of the package (shown in summary and stored in the cache)
+#
+# DESCRIPTION : optional
+#   string describing the package (shown in summary and stored in the cache)
+#
+# TYPE : optional, one of RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED
+#   type of dependency of the project on this package (defaults to OPTIONAL)
+#
+# PURPOSE : optional
+#   string describing which functionality this package enables in the project
+#
+# FAILURE_MSG : optional
+#   string to be appended to the failure message if the package is not found
+#
 # REQUIRED : optional
 #   fail if package cannot be found
 #
@@ -81,7 +101,7 @@
 macro( ecbuild_use_package )
 
   set( options            REQUIRED QUIET EXACT )
-  set( single_value_args  PROJECT VERSION )
+  set( single_value_args  PROJECT VERSION URL DESCRIPTION TYPE PURPOSE FAILURE_MSG )
   set( multi_value_args )
 
   cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
@@ -98,6 +118,12 @@ macro( ecbuild_use_package )
     ecbuild_critical("Call to ecbuild_use_package() requests EXACT but doesn't specify VERSION.")
   endif()
 
+  # If the package is required, set TYPE to REQUIRED
+  # Due to shortcomings in CMake's argument parser, passing TYPE REQUIRED has no effect
+  if( _p_REQUIRED )
+    set( _p_TYPE REQUIRED )
+  endif()
+
   # try to find the package as a subproject and build it
 
   string( TOUPPER ${_p_PROJECT} pkgUPPER )
@@ -252,7 +278,16 @@ macro( ecbuild_use_package )
   # Case 4) is NOT FOUND so far, NOT as sub-project (now or before), and NOT as binary neither
   #         so try to find precompiled binaries or a build tree
 
-  if( NOT ${pkgUPPER}_FOUND )
+  if( ${pkgUPPER}_FOUND )
+    # Only set package properties if ecbuild_find_package, which itself calls
+    # set_package_properties, is not subsequently called since doing so would
+    # duplicate the purpose
+    set_package_properties( ${_p_PROJECT} PROPERTIES
+                            URL "${_p_URL}"
+                            DESCRIPTION "${_p_DESCRIPTION}"
+                            TYPE "${_p_TYPE}"
+                            PURPOSE "${_p_PURPOSE}" )
+  else()
 
     ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): 4) project has NOT been added as a subproject and is NOT already FOUND")
 
@@ -266,6 +301,22 @@ macro( ecbuild_use_package )
     if( _p_REQUIRED )
       list( APPEND _opts REQUIRED )
     endif()
+    if( _p_URL )
+      list( APPEND _opts URL ${_p_URL} )
+    endif()
+    if( _p_DESCRIPTION )
+      list( APPEND _opts DESCRIPTION "${_p_DESCRIPTION}" )
+    endif()
+    if( _p_TYPE )
+      list( APPEND _opts TYPE ${_p_TYPE} )
+    endif()
+    if( _p_PURPOSE )
+      list( APPEND _opts PURPOSE "${_p_PURPOSE}" )
+    endif()
+    if( _p_FAILURE_MSG )
+      ecbuild_debug_var( _p_FAILURE_MSG )
+      list( APPEND _opts FAILURE_MSG "${_p_FAILURE_MSG}" )
+    endif()
 
     ecbuild_find_package( NAME ${_p_PROJECT} ${_opts} )
 
diff --git a/cmake/ecbuild_version.h.in b/cmake/ecbuild_version.h.in
index 70c5f0a..89b0e33 100644
--- a/cmake/ecbuild_version.h.in
+++ b/cmake/ecbuild_version.h.in
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 1996-2016 ECMWF.
+ * (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. 
diff --git a/cmake/ecbuild_warn_unused_files.cmake b/cmake/ecbuild_warn_unused_files.cmake
index 314a006..7d330d7 100644
--- a/cmake/ecbuild_warn_unused_files.cmake
+++ b/cmake/ecbuild_warn_unused_files.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/cmake/gen_source_flags.py b/cmake/gen_source_flags.py
index b976d31..c08ad08 100644
--- a/cmake/gen_source_flags.py
+++ b/cmake/gen_source_flags.py
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2016 ECMWF.
+# (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.
diff --git a/cmake/include/ecbuild/boost_test_framework.h b/cmake/include/ecbuild/boost_test_framework.h
index f593b70..ba48689 100644
--- a/cmake/include/ecbuild/boost_test_framework.h
+++ b/cmake/include/ecbuild/boost_test_framework.h
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 1996-2016 ECMWF.
+ * (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.
diff --git a/cmake/sg.pl b/cmake/sg.pl
index 6bce843..f8c8e31 100755
--- a/cmake/sg.pl
+++ b/cmake/sg.pl
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 #!/usr/local/share/perl56
 
-# (C) Copyright 1996-2016 ECMWF.
+# (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. 
diff --git a/python/Magics/macro.py b/python/Magics/macro.py
index 9184360..845d9c5 100644
--- a/python/Magics/macro.py
+++ b/python/Magics/macro.py
@@ -489,14 +489,14 @@ class  odb_filter(object):
         file = "data%d" % numpy.random.randint(1,1000)
         odb = "%s.odb" % file 
         context.tmp.append(odb)
-        cmd = "odbsql -q \"" + self.args["query"] + "\" -i " + self.args["path"] + " -f newodb -o " + odb
+        cmd = "odb sql -q \"" + self.args["query"] + "\" -i " + self.args["path"] + " -f newodb -o " + odb
         print cmd 
         if (os.system(cmd)) :
             print "Error in filtering ODB data... Aborting"
             os.abort();
         Magics.setc('odb_filename', odb)
     def inspect(self):
-        cmd = "odbsql -q \"" + self.args["query"] + "\" -i " + self.args["path"] + " -o data.ascii"
+        cmd = "odb sql -q \"" + self.args["query"] + "\" -i " + self.args["path"] + " -o data.ascii"
         if (os.system(cmd)) :
             print "Error in filtering ODB data... Aborting"
             os.abort();
diff --git a/python/Magics/toolbox.py b/python/Magics/toolbox.py
index 5f6a4f3..28754e1 100644
--- a/python/Magics/toolbox.py
+++ b/python/Magics/toolbox.py
@@ -13,6 +13,43 @@ def substitute(default, user):
 
 
 
+def geoplot(data, contour=None, output=None, background=None, foreground=None, area=None, legend = None):
+
+
+    default = {
+       "area" : {},
+       "legend" : {},
+       "contour" : {},
+       "background" : { "map_coastline_sea_shade"         : 'on',
+                        "map_coastline_sea_shade_colour"  : 'rgb(81,81,81)',
+                        "map_coastline_land_shade"        : 'on',
+                        "map_label"                       : 'off',
+                        "map_coastline_land_shade_colour" : 'rgb(113,113,113)',
+                    },
+        "foreground" : { "map_coastline_thickness" :  2,
+                         "map_grid_line_style"     :  'dash',
+                         "map_grid_colour"         :  'rgb(143,166,183)',
+                         "map_label"               :  'off',
+                         "map_coastline_colour"    :  'rgb(143,166,183)'
+                    },
+
+    }
+
+    background= macro.mcoast( substitute(default["background"], background) )
+    foreground= macro.mcoast( substitute(default["foreground"], foreground) ) 
+
+    projection = macro.mmap( substitute(default["area"], area)
+                     )
+
+    contour = macro.mcont( substitute(default["contour"], contour) )
+    #Define the title
+    title = macro.mtext(
+                  text_font_size = 0.8,
+                  text_justification = "left"
+                )
+    legend = macro.mlegend(substitute(default["legend"], legend))
+
+    return macro.plot(output, projection, background, data, contour, foreground, title, legend)
 
 def xyplot(data, contour=None, output=None):
 
diff --git a/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake b/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
index c6947e8..e3ef29c 100644
--- a/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
+++ b/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
@@ -35,7 +35,15 @@ set( OMPSTUBS_Fortran_FLAGS  "-hnoomp" )
 # LINK FLAGS
 ####################################################################
 
-set( ECBUILD_C_LINK_FLAGS        "-Wl,-Map,loadmap -Wl,--as-needed -Wl,--eh-frame-hdr -Ktrap=fp" )
-set( ECBUILD_CXX_LINK_FLAGS      "-Wl,-Map,loadmap -Wl,--as-needed -Wl,--eh-frame-hdr -Ktrap=fp" )
-set( ECBUILD_Fortran_LINK_FLAGS  "-Wl,-Map,loadmap -Wl,--as-needed -Wl,--eh-frame-hdr -Ktrap=fp" )
+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 "" )
+
+####################################################################
+# LIBRARIES
+####################################################################
+
+# Don't search for LAPACK as it is provided by the cray-libsci module which is
+# loaded by default
+set( LAPACK_FOUND $ENV{CRAY_LIBSCI_PREFIX_DIR} )
diff --git a/share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake b/share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake
index 3ea294f..84dbd7b 100644
--- a/share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake
+++ b/share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake
@@ -39,6 +39,14 @@ set( ECBUILD_Fortran_FLAGS_DEBUG  "-ffree-line-length-none -O0 -g -fcheck=bounds
 # LINK FLAGS
 ####################################################################
 
-set( ECBUILD_C_LINK_FLAGS        "-Wl,-Map,load.map -Wl,--as-needed -Wl,--eh-frame-hdr" )
-set( ECBUILD_CXX_LINK_FLAGS      "-Wl,-Map,load.map -Wl,--as-needed -Wl,--eh-frame-hdr" )
-set( ECBUILD_Fortran_LINK_FLAGS  "-Wl,-Map,load.map -Wl,--as-needed -Wl,--eh-frame-hdr" )
+set( ECBUILD_SHARED_LINKER_FLAGS "-Wl,--eh-frame-hdr" )
+set( ECBUILD_MODULE_LINKER_FLAGS "-Wl,--eh-frame-hdr -Wl,-Map,loadmap" )
+set( ECBUILD_EXE_LINKER_FLAGS    "-Wl,--eh-frame-hdr -Wl,-Map,loadmap -Wl,--as-needed" )
+
+####################################################################
+# LIBRARIES
+####################################################################
+
+# Don't search for LAPACK as it is provided by the cray-libsci module which is
+# loaded by default
+set( LAPACK_FOUND $ENV{CRAY_LIBSCI_PREFIX_DIR} )
diff --git a/share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake b/share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake
index d5fdb32..a890886 100644
--- a/share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake
+++ b/share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake
@@ -60,6 +60,14 @@ set( ECBUILD_Fortran_FLAGS_DEBUG  "-O0 -g -traceback -warn all -heap-arrays -fpe
 # LINK FLAGS
 ####################################################################
 
-set( ECBUILD_C_LINK_FLAGS        "-Wl,-Map,load.map -Wl,--as-needed -Wl,--eh-frame-hdr" )
-set( ECBUILD_CXX_LINK_FLAGS      "-Wl,-Map,load.map -Wl,--as-needed -Wl,--eh-frame-hdr" )
-set( ECBUILD_Fortran_LINK_FLAGS  "-Wl,-Map,load.map -Wl,--as-needed -Wl,--eh-frame-hdr" )
+set( ECBUILD_SHARED_LINKER_FLAGS "-Wl,--eh-frame-hdr" )
+set( ECBUILD_MODULE_LINKER_FLAGS "-Wl,--eh-frame-hdr -Wl,-Map,loadmap" )
+set( ECBUILD_EXE_LINKER_FLAGS    "-Wl,--eh-frame-hdr -Wl,-Map,loadmap -Wl,--as-needed" )
+
+####################################################################
+# LIBRARIES
+####################################################################
+
+# Don't search for LAPACK as it is provided by the cray-libsci module which is
+# loaded by default
+set( LAPACK_FOUND $ENV{CRAY_LIBSCI_PREFIX_DIR} )
diff --git a/share/magics/table_128.xml b/share/magics/table_128.xml
index 452bfcf..4066305 100644
--- a/share/magics/table_128.xml
+++ b/share/magics/table_128.xml
@@ -163,6 +163,42 @@ does it submit to any jurisdiction.
         <param code='251' 
                original_unit='K' derived_unit='deg C' 
                scaling='1.0' offset='-273.16'/> 
+        <param code='20000' 
+               original_unit='kg m**-3' derived_unit='ng m**-3' 
+               scaling='1000000000000.0' offset='-0.0'/>
+        <param code='20001' 
+               original_unit='kg m**-2' derived_unit='ng m**-2' 
+               scaling='1000000000000.0' offset='-0.0'/>
+        <param code='20002' 
+               original_unit='kg kg**-1' derived_unit='ppt' 
+               scaling='1000000000000.0' offset='-0.0'/>
+        <param code='20052' 
+               original_unit='mol mol**-1' derived_unit='ppt' 
+               scaling='1000000000000.0' offset='-0.0'/>
+        <param code='20197' 
+               original_unit='kg m**-2' derived_unit='ng m**-2' 
+               scaling='100000000000.0' offset='-0.0'/>
+        <param code='20198' 
+               original_unit='kg m**-2' derived_unit='ng m**-2' 
+               scaling='100000000000.0' offset='-0.0'/>
+        <param code='20199' 
+               original_unit='kg m**-2 s**-1' derived_unit='ng m**-2 s**-1' 
+               scaling='1000000000000.0' offset='-0.0'/>
+        <param code='20200' 
+               original_unit='kg m**-2 s**-1' derived_unit='ng m**-2 s**-1' 
+               scaling='1000000000000.0' offset='-0.0'/>
+        <param code='20201' 
+               original_unit='kg m**-2 s**-1' derived_unit='ng m**-2 s**-1' 
+               scaling='1000000000000.0' offset='-0.0'/>
+        <param code='20202' 
+               original_unit='kg m**-2 s**-1' derived_unit='ng m**-2 s**-1' 
+               scaling='1000000000000.0' offset='-0.0'/>
+        <param code='20203' 
+               original_unit='kg m**-2 s**-1' derived_unit='ng m**-2 s**-1' 
+               scaling='1000000000000.0' offset='-0.0'/>
+        <param code='20204' 
+               original_unit='kg m**-2 s**-1' derived_unit='ng m**-2 s**-1' 
+               scaling='1000000000000.0' offset='-0.0'/>
         <param code='260510' 
                original_unit='K' derived_unit='deg c' 
                scaling='1.0' offset='-273.16'/> 
diff --git a/src/common/BinaryObject.h b/src/common/BinaryObject.h
index 53a2a19..d0b5603 100644
--- a/src/common/BinaryObject.h
+++ b/src/common/BinaryObject.h
@@ -51,7 +51,8 @@ public:
 			{ return path_; }
 
 
-	double getTransparency() const { return transparency_; }
+	double getTransparency() const { return transparency_;}
+	double getGaussianBlur() const { return mgb_blur_radius_;}
 	double getMgb_x() const { return mgb_x_; }
 	double getMgb_y() const { return mgb_y_; }
 	double getMgb_width() const { return mgb_width_; }
diff --git a/src/common/LogoPlotting.cc b/src/common/LogoPlotting.cc
index dd31704..19c53a4 100644
--- a/src/common/LogoPlotting.cc
+++ b/src/common/LogoPlotting.cc
@@ -68,11 +68,11 @@ void LogoPlotting::operator()(BasicGraphicsObjectContainer& tree) const
 
 	Symbol* symbol = new Symbol();
 
-	double x =  (0.3 * 6.75 * 100) / tree.absoluteWidth();
-	x = 90;
-    double y = (0.3/tree.absoluteHeight())*100; 	 // 0.2
+	//double x =  (0.3 * 6.75 * 100) / tree.absoluteWidth();
+	const double x = 90.;
+	const double y = (0.3/tree.absoluteHeight())*100; 	 // 0.2
 
-	(*symbol).setColour(Colour("BLUE"));
+	(*symbol).setColour(Colour("ecmwf_blue"));
 	(*symbol).setSymbol(logo);
 	(*symbol).setHeight(0.6);   // length = height * 6.75
 	(*symbol).push_back(PaperPoint(x,y));
diff --git a/src/common/Matrix.cc b/src/common/Matrix.cc
index 254acb8..d36880b 100644
--- a/src/common/Matrix.cc
+++ b/src/common/Matrix.cc
@@ -57,127 +57,7 @@ pair<int, bool> InfoIndex::index(double pos) const
 
 void ProjectedMatrix::build()
 {
-	/*
-	vector< std::pair<int, int>  > coords(4);
-	for (int r = 0; r < rows_; r++)
-		for (int c = 0; c < columns_; c++)
-			push_back(missing_);
 	
-	coords[0] = std::make_pair(0,0);
-	coords[1] = std::make_pair(0,1);
-	coords[2] = std::make_pair(1,1);
-	coords[3] = std::make_pair(1,0);
-	
-	Timer  t("GridHelper::build", "GridHelper");
-	for ( int row = 0 ; row < origRows_-1; row++)
-		for ( int column = 0 ; column < origColumns_-1; column++)
-		{
-			double xmin = origColumns_;
-			double xmax = 0;
-			double ymin = rows_;
-			double ymax = 0;
-			
-			vector<double> x, y, v;
-			vector<double> xs, ys, vs;
-			vector<Point> points;
-			bool stop = true;
-			
-			for (vector< std::pair<int, int>  >::iterator p = coords.begin(); p != coords.end(); ++p) {
-				int r = row+ p->first;
-				int c = column+ p->second;
-				double rr = rowsArray_[index(r, c)];
-				double cc = columnsArray_[index(r, c)];
-				MagLog::debug() << rr << " ? " << miny_ -  stepy_ << " " <<  maxy_ + stepy_ << endl;
-				MagLog::debug() << cc << " ? " << minx_ -  stepx_ << " " <<  maxx_ + stepx_ << endl;
-				if ( rr >= miny_ -  stepy_ && rr <= maxy_ + stepy_)
-					stop = false;
-
-				if ( cc >= minx_ -  stepx_ && cc <= maxx_ + stepx_ )
-					stop = false;
-				
-			}
-			if ( stop )
-				// Go to next cell...
-
-				continue;
-			for (vector< std::pair<int, int>  >::iterator p = coords.begin(); p != coords.end(); ++p) {
-				
-				int r = row+ p->first;
-				int c = column+ p->second;
-				double  rr = rowsArray_[index(r, c)];
-				double cc = columnsArray_[index(r, c)];
-				
-				
-
-				 x.push_back( (cc - minx_ ) / stepx_ );
-				 y.push_back( (rr - miny_ ) / stepy_);
-
-				 points.push_back(Point(x.back(), y.back()));
-				 v.push_back( values_[index(r, c)]);  						
-			}
-			points.push_back(points.front());
-			xmin = *std::min_element(x.begin(), x.end());
-			xmax = *std::max_element(x.begin(), x.end());
-			ymin = *std::min_element(y.begin(), y.end());
-			ymax = *std::max_element(y.begin(), y.end());
-
-			MagLog::debug() << "x------->" << xmin << " " << xmax << endl;
-			MagLog::debug() << "y------->" << ymin << " " << ymax << endl;
-			int ii = (xmin < 0) ? 0 : xmin;
-
-			while (ii <= xmax && ii < columns_ )
-			{
-				int jj = (ymin < 0) ? 0 : ymin;
-				while ( jj <= ymax && jj < rows_ ) {
-			
-					MagLog::debug() << "ii=" << 	ii << "  jj=" << jj <<  endl;
-					// is the point inside or oiutside .. if inside use it! 
-
-				    int i = 0;
-				    bool done = false;
-					for (vector<Point>::iterator pt = points.begin(); pt != points.end(); ++pt) {
-				    	MagLog::debug() << *pt << endl;
-						if ( *pt == Point(ii, jj) ) {
-							(*this)[(jj*columns_) + ii] = v[i];
-							done = true;
-				    		break;
-				    	}
-						i++;
-				    }
-					if (  !done && SegmentJoiner::pointInPoly(Point(ii, jj),  points) )
-					 {
-						//feed the matrix...
-						vector<double> w;
-						double total = 0.;
-						for (unsigned int i = 0; i < x.size(); i++) {
-							double val = sqrt( ((ii - x[i])*(ii-x[i]))  + ( (jj-y[i])*(jj-y[i]) ) );
-
-														w.push_back(1/ (val) ? (val*val) : 1);
-														if (v[i] != missing_)
-														    total += w[i];
-						}
-						
-						double val = 0.;
-						for (unsigned int i = 0; i < w.size(); i++) {
-							if (v[i] != missing_) 
-								val += (v[i]*w[i]/total);
-							}
-
-				     (*this)[(jj*columns_) + ii] = val;
-				     MagLog::debug() << "[" << ii << ", " << jj << "]=" << val << endl;
-				     MagLog::debug() << "[" << ii <<  "]=" << columnsAxis_[ii] << endl;
-				     MagLog::debug() << "[" << jj <<  "]=" << rowsAxis_[jj] << endl;
-					}else {
-						MagLog::debug() <<  "out[" << ii <<  "]=" << columnsAxis_[ii] << endl;
-				     MagLog::debug() << "out[" << jj <<  "]=" << rowsAxis_[jj] << endl;
-					}
-
-					jj++;
-				}
-				ii++;
-			}
-		}
-		*/
 }
 
 void ProjectedMatrix::getReady()
@@ -226,6 +106,7 @@ ProjectedMatrix::ProjectedMatrix(int rows, int columns): Matrix(rows, columns)
 	       rowsArray_.reserve(rows*columns);  
 	       columnsArray_.reserve(rows*columns);
 }
+
 RotatedMatrix::RotatedMatrix(int rows, int columns): Matrix(rows, columns)
 {
 	rowsArray_.reserve(rows*columns);
@@ -314,7 +195,7 @@ double Matrix::interpolate(double i, double j) const
 
 
 /// @brief The usual PI/180 constant
-static const double DEG_TO_RAD = 0.017453292519943295769236907684886;
+//static const double DEG_TO_RAD = 0.017453292519943295769236907684886;
 /// @brief Earth's quatratic mean radius for WGS-84
 static const double EARTH_RADIUS_IN_METERS = 6372797.560856;
 
@@ -421,24 +302,7 @@ pair<double, double> Matrix::nearest_value(double row, double column,double &row
 }
 
 
-void xx(double v)
-{
-	double offset;
-	offset = fmod(v, 360.);
-	int a = v/360;
-	cout << "-------" << endl;
-	cout << v << "--->" << offset  << "--->" << a <<  endl;
-
-	if ( offset < 0 )
-		a--;
-
-	double nv = v - (a*360);
 
-	cout << nv << "--->" << (a*360) << " " <<  nv + (a*360) << endl;
-
-
-
-}
 
 
 int Matrix::nearest_index(double row, double column,double &rowOut, double &colOut) const
@@ -681,6 +545,78 @@ MatrixHandler* RotatedMatrix::getReady(const Transformation&) const
 {
 	return new MatrixHandler(*this);
 }
+
 MatrixHandler* Matrix::getReady(const Transformation& transformation)  const{
 	return transformation.prepareData(*this);
 }
+
+MatrixHandler* Proj4Matrix::getReady(const Transformation&) const
+{
+	return new Proj4MatrixHandler(*this, proj4_);
+}
+
+
+Proj4MatrixHandler::Proj4MatrixHandler(const AbstractMatrix& matrix, const string& proj4) : MatrixHandler(matrix) 
+{
+	proj4_ = pj_init_plus(proj4.c_str());
+	latlon_ = pj_init_plus("+proj=longlat +ellps=WGS84 +datum=WGS84");
+	internal_ = false;
+}
+
+   
+       
+double Proj4MatrixHandler::interpolate(double  row, double  column) const 
+{
+	if (internal_)
+		return MatrixHandler::interpolate(row, column);
+	double x = column * DEG_TO_RAD;
+	double y = row * DEG_TO_RAD;
+
+    int error = pj_transform(latlon_, proj4_, 1, 1, &x, &y, NULL);
+    if ( error )
+    	return missing();
+
+    return MatrixHandler::interpolate(y, x);
+}
+
+double Proj4MatrixHandler::nearest(double  row, double  column) const
+{
+	if (internal_)
+		return MatrixHandler::nearest(row, column);
+	double x = column * DEG_TO_RAD;
+	double y = row * DEG_TO_RAD;
+
+    int error = pj_transform(latlon_, proj4_, 1, 1, &x, &y, NULL);
+    if ( error )
+    	return missing();
+
+    return MatrixHandler::nearest(y, x);
+}
+
+double Proj4MatrixHandler::column(int i , int j)
+{
+	double column = MatrixHandler::column(i, j);
+	double row = MatrixHandler::row(i, j);
+
+	int error = pj_transform(proj4_, latlon_, 1, 1, &column, &row, NULL);
+    if ( error )
+    	return missing();
+    return column * RAD_TO_DEG;
+	
+
+}
+
+double Proj4MatrixHandler::row(int i, int j)
+{
+	double column = MatrixHandler::column(i, j);
+	double row = MatrixHandler::row(i, j);
+
+	int error = pj_transform(proj4_, latlon_, 1, 1, &column, &row, NULL);
+    if ( error )
+    	return missing();
+    return row * RAD_TO_DEG;
+}
+    
+
+
+   
diff --git a/src/common/Matrix.h b/src/common/Matrix.h
index 6c4c7af..9a31b66 100644
--- a/src/common/Matrix.h
+++ b/src/common/Matrix.h
@@ -56,6 +56,7 @@ public :
     virtual double  width() const = 0;
     virtual double   height() const = 0;
     virtual bool akimaEnable() const { return false; }
+    virtual bool delegate() const { return false; }
 
     virtual MatrixHandler* getReady(const Transformation&) const { NOTIMP; return 0;}
 
@@ -543,6 +544,17 @@ protected:
 
 
 };
+class Proj4Matrix: public Matrix
+{
+
+public:
+        Proj4Matrix(const string& proj4) : Matrix(), proj4_(proj4) {}
+        MatrixHandler* getReady(const Transformation&) const;
+
+protected:
+        string proj4_;
+        
+};
 
 } // namespace magics
 
diff --git a/src/common/MatrixHandler.h b/src/common/MatrixHandler.h
index 2e3aea7..a3284ca 100644
--- a/src/common/MatrixHandler.h
+++ b/src/common/MatrixHandler.h
@@ -39,7 +39,7 @@ class MatrixHandler : public AbstractMatrix, public AbstractPoints
 public : 
     MatrixHandler(const AbstractMatrix& matrix) : AbstractMatrix(),
         AbstractPoints(),
-        matrix_(matrix), min_(INT_MAX), max_(-INT_MAX)  {}
+        matrix_(matrix), min_(INT_MAX), max_(-INT_MAX) {}
     MatrixHandler(const MatrixHandler& matrix) :
         AbstractMatrix(),
         AbstractPoints(),
@@ -51,7 +51,7 @@ public :
     virtual int rowIndex(double r) const     { return matrix_.rowIndex(r); } 
     virtual int columnIndex(double c) const  { return matrix_.columnIndex(c); }  
     virtual bool  akimaEnable() const  { return matrix_.akimaEnable(); }
-    
+    virtual bool  delegate() const  { return matrix_.delegate(); }
     
     virtual void boundRow(double r, 
     	double& row1, int& index1, double& row2, int& index2) const 
@@ -145,6 +145,7 @@ public :
 	
     virtual double interpolate(double  i, double  j) const 
     {
+
     	if ( columns() == 0  || rows() == 0)
     		return matrix_.missing();
 
@@ -167,10 +168,10 @@ public :
     		boundRow(i, v1, i1, v2, i2);
     		
     		if (i1 == -1) return missing(); 
-    		
+    		internal_ = true;
     	    double a = (*this).interpolate(v1, j);
             double b = (*this).interpolate(v2, j);
-          
+            internal_ = false;
             if ( same(a, missing()) || same(b, missing()) ) return missing();
             
             double da = (v2-i)/(v2-v1);
@@ -338,6 +339,7 @@ protected:
     mutable VectorOfPointers<vector<UserPoint*> >::const_iterator current_;
     mutable double min_;
     mutable double max_;
+    mutable bool internal_;
   
 };
 
@@ -486,6 +488,56 @@ protected :
    bool columnrevert_;
 };
 
+class DelegateMatrixHandler : public MatrixHandler
+{
+public :
+    DelegateMatrixHandler(const AbstractMatrix& matrix) : MatrixHandler(matrix) {}
+
+    
+    
+    double interpolate(double  row, double  column) const { matrix_.interpolate(row, column); }
+    double nearest(double  row, double  column) const { matrix_.nearest(row, column); }
+
+    double column(int i, int j) { matrix_.column(i, j); }
+    double row(int i, int j) { matrix_.row(i, j); }
+
+protected :
+
+
+
+};
+
+
+#include <proj_api.h>
+
+class Proj4MatrixHandler : public MatrixHandler
+{
+public :
+    Proj4MatrixHandler(const AbstractMatrix& matrix, const string&);
+
+    
+    
+    double interpolate(double  row, double  column) const;
+    double nearest(double  row, double  column) const;
+
+    double column(int, int);
+    double row(int, int);
+
+    bool delegate() const { return true; }
+
+   
+
+protected :
+
+   double minx_;
+   double maxx_;
+   double miny_;
+   double maxy_;
+   
+   projPJ proj4_;
+   projPJ latlon_;
+
+};
 
 
 
@@ -609,6 +661,7 @@ protected :
 };
 
 
+
 class GeoBoxMatrixHandler: public TransformMatrixHandler
 {
 public:
diff --git a/src/common/PolarStereographicProjection.cc b/src/common/PolarStereographicProjection.cc
index 6c3789c..6867041 100644
--- a/src/common/PolarStereographicProjection.cc
+++ b/src/common/PolarStereographicProjection.cc
@@ -822,14 +822,19 @@ void PolarStereographicProjection::reprojectComponents(double& x, double& y, pai
 
 void PolarStereographicProjection::reprojectSpeedDirection(const PaperPoint& point, pair<double, double>& wind) const
 {
-	double a = 90 - (wind.second); 
-	const double x = 3.14/180.;
-	a *= x;
-	double xx =0, yy=0;
-	const double speed =wind.first; 
-	wind.first = speed-1 * cos(a);
-	wind.second = speed-1 * sin(a);
-	reprojectComponents(xx, yy, wind);
+
+	double x = point.x_;
+	double y =  point.y_;
+
+	double u = x + (  sin( wind.second*DEG_TO_RAD) );
+	double v = y + (  cos( wind.second*DEG_TO_RAD) );
+
+	fast_reproject(x, y);
+	fast_reproject(u, v);
+	
+	double rotation = atan2((u - x), (v - y));
+	
+	wind.second =   (rotation*RAD_TO_DEG);
 }
 
 void PolarStereographicProjection::coastSetting(map<string, string>& setting, double abswidth, double absheight) const
diff --git a/src/common/Proj4Projection.cc b/src/common/Proj4Projection.cc
index 1668fc2..3761585 100644
--- a/src/common/Proj4Projection.cc
+++ b/src/common/Proj4Projection.cc
@@ -416,7 +416,7 @@ void Proj4Projection::conic()
 	}
 	*/
 	// top
-	add( projection_->minlon_, projection_->maxlat_);
+	add( projection_->minlon_ - vertical_longitude_, projection_->maxlat_);
 	for ( int lon = projection_->minlon_; lon <= projection_->maxlon_; lon++) {
 		add(lon, projection_->minlat_);
 	}
@@ -888,6 +888,32 @@ void Proj4Projection::reprojectComponents(double& x, double& y, pair<double, dou
 	components.second = speed * sin(rotation);
 }
 
+void myprint(double x, double y, bool next = false) 
+{
+	cout << "[" << x << ", " << y << "]";
+	if ( next )
+		cout << "--->";
+	else 
+		cout << endl;
+}
+
+void Proj4Projection::reprojectSpeedDirection(const PaperPoint& point, pair<double, double>& wind) const
+{
+	double x = point.x_;
+	double y =  point.y_;
+
+	double u = x + (  sin( wind.second*DEG_TO_RAD) );
+	double v = y + (  cos( wind.second*DEG_TO_RAD) );
+
+	fast_reproject(x, y);
+	fast_reproject(u, v);
+	
+	double rotation = atan2((u - x), (v - y));
+	
+	wind.second =   (rotation*RAD_TO_DEG);
+	
+}
+
 void Proj4Projection::revert(const vector< std::pair<double, double> > & in, vector< std::pair<double, double> > & out) const
 {
 	const_cast<Proj4Projection*>(this)->init();
diff --git a/src/common/Proj4Projection.h b/src/common/Proj4Projection.h
index 1980e9b..9dedc59 100644
--- a/src/common/Proj4Projection.h
+++ b/src/common/Proj4Projection.h
@@ -205,6 +205,7 @@ public:
 	void getNewDefinition(const UserPoint&, const UserPoint&, string&) const;
 	void setDefinition(const string&);
 	void reprojectComponents(double&, double&, pair<double, double>&) const;
+	void reprojectSpeedDirection(const PaperPoint& point, pair<double, double>&) const;
 	virtual void geoProjection(int& geo) const { geo = 1; } // Useful for Streamlines !
 protected:
      //! Method to print string about this class on to a stream of type ostream (virtual).
diff --git a/src/decoders/GribRegularInterpretor.cc b/src/decoders/GribRegularInterpretor.cc
index b4c5ea0..752e6e6 100644
--- a/src/decoders/GribRegularInterpretor.cc
+++ b/src/decoders/GribRegularInterpretor.cc
@@ -58,7 +58,7 @@ void GribInterpretor::scaling(const GribDecoder& grib, double& scaling,
 }
 
 /// @brief The usual PI/180 constant
-static const double DEG_TO_RAD = 0.017453292519943295769236907684886;
+//static const double DEG_TO_RAD = 0.017453292519943295769236907684886;
 /// @brief Earth's quatratic mean radius for WGS-84
 static const double EARTH_RADIUS_IN_METERS = 6372797.560856;
 
diff --git a/src/decoders/GribSatelliteInterpretor.cc b/src/decoders/GribSatelliteInterpretor.cc
index 8c1564b..d3b73ae 100644
--- a/src/decoders/GribSatelliteInterpretor.cc
+++ b/src/decoders/GribSatelliteInterpretor.cc
@@ -235,7 +235,7 @@ GribSatelliteInterpretor::~GribSatelliteInterpretor()
     Correct the information provided in the headers of certain satellite imagery that
     we have available. This is a very specific function.
 */
-void GribSatelliteInterpretor::AdjustBadlyEncodedGribs(int satId, int chanId, long &nx, long &ny, long &dx, long &dy, double &xp, double &yp, double &slon, long &functionCode) const
+void GribSatelliteInterpretor::AdjustBadlyEncodedGribs(int satId, int chanId, long &nx, long &ny, long &dx, long &dy, long &xp, long &yp, double &slon, long &functionCode) const
 {
     if (satId == 172 && slon == 140.0) // MTSAT-2, pre-2015 data
     {
@@ -281,18 +281,24 @@ void GribSatelliteInterpretor::interpretAsMatrix(const GribDecoder& grib, Matrix
     MagLog::dev() << "GribRegularInterpretor::interpretAsMatrix" << "\n";
 
     double altitude = grib.getDouble("NrInRadiusOfEarth");
-    if ( !altitude ) altitude =  6610839.;
+    if ( !altitude )
+        altitude =  6610839.;
+
+    // GRIB edition 1 needs to be divided by 10^6, GRIB 2 is already in the right units
+    long edition = grib.getLong("edition");
+    if (edition == 1)
         altitude *= 0.000001;
+
     long   nx   = grib.getLong("numberOfPointsAlongXAxis");
     long   ny   = grib.getLong("numberOfPointsAlongYAxis");
     long   dx   = grib.getLong("dx");
     long   dy   = grib.getLong("dy");
-    double offx = grib.getDouble("xCoordinateOfOriginOfSectorImage");
-    double offy = grib.getDouble("yCoordinateOfOriginOfSectorImage");
+    //double offx = grib.getDouble("xCoordinateOfOriginOfSectorImage");
+    //double offy = grib.getDouble("yCoordinateOfOriginOfSectorImage");
     double prj  = 2*asin(1/altitude)/dx;
     double pri  = 2*asin(1/altitude)/dy;
-    double pjs  = grib.getDouble("XpInGridLengths");
-    double pis  = grib.getDouble("YpInGridLengths");
+    long   xp   = grib.getLong("XpInGridLengths");
+    long   yp   = grib.getLong("YpInGridLengths");
 
 
     double lao  = grib.getDouble("latitudeOfSubSatellitePointInDegrees") *TeCDR;
@@ -302,7 +308,7 @@ void GribSatelliteInterpretor::interpretAsMatrix(const GribDecoder& grib, Matrix
     long   functionCode = grib.getLong("functionCode");
 
     // correct bad GRIB headers that we know exist
-    AdjustBadlyEncodedGribs(sat, chan, nx, ny, dx, dy, pjs, pis, slon, functionCode);
+    AdjustBadlyEncodedGribs(sat, chan, nx, ny, dx, dy, xp, yp, slon, functionCode);
 
     double lono = slon*TeCDR;
     double prs  = altitude * TeEARTHRADIUS;
@@ -391,21 +397,15 @@ void GribSatelliteInterpretor::interpretAsMatrix(const GribDecoder& grib, Matrix
 
 
 
-    // coff, loff, cfac and lfac are 'normalised' on the NONHRV resolution of MSG images
-    double coff, loff, cfac, lfac;
-    double scale = (double)ny / (double)3711;
-
-
-    coff = COFF_NONHRV * scale;
-    loff = LOFF_NONHRV * scale;
+    double coff = xp;
+    double loff = yp;
 
     double rx = 2 * asin(1.0/altitude) / dx;
-    cfac = (-65536.0 / (rx));
-    lfac = cfac;
+    double cfac = (-65536.0 / (rx));
+    double lfac = cfac;
 
 
     int k = 0;
-
     for (int j=0;j < nblat;j++) {
         for (int i=0;i < nblon;i++) {
             double val;
@@ -420,7 +420,7 @@ void GribSatelliteInterpretor::interpretAsMatrix(const GribDecoder& grib, Matrix
                             -lono,  // sub-satellite longitude in radians; unclear why we have to negate it
                             &srcCol, &srcRow);
 
-            if (srcCol == -999 || srcRow == -999)
+            if (srcCol < 0 || srcCol >= nx ||  srcRow < 0 || srcRow >= ny)
                 val = 65535;
             else
                 val = raster[srcRow*nx + srcCol];
@@ -429,7 +429,6 @@ void GribSatelliteInterpretor::interpretAsMatrix(const GribDecoder& grib, Matrix
         }
     }
 
-
     (*matrix)->missing(missingValue);
 
 }
diff --git a/src/decoders/GribSatelliteInterpretor.h b/src/decoders/GribSatelliteInterpretor.h
index c288f65..63ec971 100644
--- a/src/decoders/GribSatelliteInterpretor.h
+++ b/src/decoders/GribSatelliteInterpretor.h
@@ -49,7 +49,7 @@ private:
     //! Copy constructor - No copy allowed
     GribSatelliteInterpretor(const GribSatelliteInterpretor&);
     //! Overloaded << operator to copy - No copy allowed
-    void AdjustBadlyEncodedGribs(int satId, int chanId, long &nx, long &ny, long &dx, long &dy, double &xp, double &yp, double &slon, long &functionCode) const;
+    void AdjustBadlyEncodedGribs(int satId, int chanId, long &nx, long &ny, long &dx, long &dy, long &xp, long &yp, double &slon, long &functionCode) const;
 
 
 // -- Friends
diff --git a/src/decoders/NetcdfGeoMatrixInterpretor.cc b/src/decoders/NetcdfGeoMatrixInterpretor.cc
index bcf60b3..18f5f97 100644
--- a/src/decoders/NetcdfGeoMatrixInterpretor.cc
+++ b/src/decoders/NetcdfGeoMatrixInterpretor.cc
@@ -40,12 +40,23 @@ bool NetcdfGeoMatrixInterpretor::interpretAsMatrix(Matrix** data)
 {
 	if ( *data ) return false;
 	
-	matrix_ = new Matrix();
-	matrix_->akimaEnabled();
+	Netcdf netcdf(path_, dimension_method_);
+
+
+	string proj4 = netcdf.getAttribute("projection", "");
+
+	if ( proj4.empty() ) {
+		matrix_ = new Matrix();
+		matrix_->akimaEnabled();
+		
+	}
+	else {
+		matrix_ = new Proj4Matrix(proj4);
+	}
 	*data = matrix_;
 
    
-	Netcdf netcdf(path_, dimension_method_);
+	
 
 
 
diff --git a/src/drivers/BaseDriver.cc b/src/drivers/BaseDriver.cc
index 7b06fc7..1075290 100644
--- a/src/drivers/BaseDriver.cc
+++ b/src/drivers/BaseDriver.cc
@@ -54,7 +54,7 @@ BaseDriver::BaseDriver():currentPage_(-1),fileName_(""),currentLayer_(""),
 	coordRatioX_(1),coordRatioY_(1),
 //	lastAreaHeightPercentage_(0.),lastAreaWidthPercentage_(0.),
 	newPage_(true),//newLayout_(true), // external_(false),
-	disabled_(false),alphaEnabled_(false),
+	disabled_(false),alphaEnabled_(false), applyGaussianBlur_(-1.),
 	indexHatch_(0),currentShading_(M_SH_NONE),cmScale_(1.),
 	xDeviceLength_(MagTranslator<double, double>().magics("SUPER_PAGE_X_LENGTH")),
 	yDeviceLength_(MagTranslator<double, double>().magics("SUPER_PAGE_Y_LENGTH")),obs_distance_(-1.)
@@ -797,6 +797,8 @@ void BaseDriver::redisplay(const BinaryObject& binary) const
   if(in.is_open()) 
   {
     const float alpha = binary.getTransparency();
+    applyGaussianBlur_ = binary.getGaussianBlur();
+
     char mag [6];
     in.read((char *)(&mag), 6);
     if(strncmp( "MAGICS", mag,6) !=0 )
diff --git a/src/drivers/BaseDriver.h b/src/drivers/BaseDriver.h
index 0e8ba01..ed8f9fe 100644
--- a/src/drivers/BaseDriver.h
+++ b/src/drivers/BaseDriver.h
@@ -398,6 +398,7 @@ protected:
 
 	bool    disabled_;
 	bool    alphaEnabled_;
+	mutable int       applyGaussianBlur_;
 	mutable vSymbols  sym_;
 
 	virtual MAGICS_NO_EXPORT void setNewLineWidth(const MFloat w) const {currentLineWidth_ = w;}
diff --git a/src/drivers/BaseDriverWind.h b/src/drivers/BaseDriverWind.h
index fa43aa3..23b2858 100644
--- a/src/drivers/BaseDriverWind.h
+++ b/src/drivers/BaseDriverWind.h
@@ -197,8 +197,8 @@ MAGICS_NO_EXPORT void BaseDriver::renderWindFlag(const Flag &flag) const
 		const int old_currentColourIndex = currentLineStyle_;
 		currentLineStyle_ = setLineParameters(style,thickness);
 		renderPolyline2(line);
+//		currentLineStyle_ = old_currentColourIndex;
 
-		currentLineStyle_ = old_currentColourIndex;
 		MFloat barbFraction = 0.;
 		int i = 0;
 		const MFloat lengthY = setY(length * ratio);
@@ -217,6 +217,7 @@ MAGICS_NO_EXPORT void BaseDriver::renderWindFlag(const Flag &flag) const
 
 			if(!fl)
 			{
+                currentLineStyle_ = setLineParameters(style,thickness);
 				line.clear();
 				line.push_back(PaperPoint( -(length-step),0.) );
 				line.push_back(PaperPoint( -(length-step+dx),barbHeight*barbFraction) );
@@ -239,6 +240,7 @@ MAGICS_NO_EXPORT void BaseDriver::renderWindFlag(const Flag &flag) const
 			}
 			i++;
 		}// end while
+		currentLineStyle_ = old_currentColourIndex;
 		++fla;
 	}// end for
 
diff --git a/src/drivers/BinaryDriver.cc b/src/drivers/BinaryDriver.cc
index 1a15c4f..f6bf28f 100644
--- a/src/drivers/BinaryDriver.cc
+++ b/src/drivers/BinaryDriver.cc
@@ -510,70 +510,70 @@ MAGICS_NO_EXPORT void BinaryDriver::renderSimplePolygon(const int n, MFloat* x,
 */
 MAGICS_NO_EXPORT void BinaryDriver::renderText(const Text& text) const
 {
-        if(text.empty()) return;
-        const vector<NiceText>& niceT = text.getNiceText();
-        if(niceT.empty()) return;
-        vector<NiceText>::const_iterator niceText = text.textBegin();
-
-        char c = 'T';
-        out_.write(&c, 1);
-	
-	const int s = text.size();
-	out_.write((char *)(&s),sizeof(int));
-
-	MagFont magfont = (*niceText).font();
-	const Colour& colour = magfont.colour();
-	const MFloat r=colour.red();
-	const MFloat g=colour.green();
-	const MFloat b=colour.blue();
-	out_.write((char *)(&r), sizeof(MFloat));
-	out_.write((char *)(&g), sizeof(MFloat));
-	out_.write((char *)(&b), sizeof(MFloat));
-
-	const MFloat an = text.getAngle();
-	out_.write((char *)(&an),sizeof(MFloat));
-
-        bool bl = text.getBlanking();
-        out_.write((char *)(&bl),sizeof(bool));
-
-        const enum Justification horizontal = text.getJustification();
-        const enum VerticalAlign vertical   = text.getVerticalAlign();
-        out_.write((char *)(&horizontal),sizeof(enum Justification));
-        out_.write((char *)(&vertical),  sizeof(enum VerticalAlign));
-
-	const int noNT = niceT.size();
-	out_.write((char *)(&noNT),sizeof(int));
-
-	for(int ntc=0;ntc<noNT;ntc++)
-	{
-	  MagFont magfont = niceT[ntc].font();
-	  Colour colour = magfont.colour();
-	  const MFloat r=colour.red();
-	  const MFloat g=colour.green();
-	  const MFloat b=colour.blue();
-	  out_.write((char *)(&r), sizeof(MFloat));
-	  out_.write((char *)(&g), sizeof(MFloat));
-	  out_.write((char *)(&b), sizeof(MFloat));
-
-	    const MFloat sf = magfont.size();
-	    out_.write((char *)(&sf),sizeof(MFloat));
-
-            const string t=niceT[ntc].text();
-            const int len = t.length();
-            out_.write((char *)(&len),sizeof(int));
-
-            char pp[len];
-            strcpy(pp, t.c_str());
-            out_.write(pp,sizeof(char)*len);
-        }
-
-        for(int g=0;g<s;g++)
-        {
-	    const MFloat x = text[g].x();
-	    const MFloat y = text[g].y();
-	    out_.write((char *)(&x),sizeof(MFloat));
-	    out_.write((char *)(&y),sizeof(MFloat));
-        }
+    if(text.empty()) return;
+    const vector<NiceText>& niceT = text.getNiceText();
+    if(niceT.empty()) return;
+    vector<NiceText>::const_iterator niceText = text.textBegin();
+
+    char c = 'T';
+    out_.write(&c, 1);
+
+    const int s = text.size();
+    out_.write((char *)(&s),sizeof(int));
+
+    MagFont magfont = (*niceText).font();
+    const Colour& colour = magfont.colour();
+    const MFloat r=colour.red();
+    const MFloat g=colour.green();
+    const MFloat b=colour.blue();
+    out_.write((char *)(&r), sizeof(MFloat));
+    out_.write((char *)(&g), sizeof(MFloat));
+    out_.write((char *)(&b), sizeof(MFloat));
+
+    const MFloat an = text.getAngle();
+    out_.write((char *)(&an),sizeof(MFloat));
+
+    bool bl = text.getBlanking();
+    out_.write((char *)(&bl),sizeof(bool));
+
+    const enum Justification horizontal = text.getJustification();
+    const enum VerticalAlign vertical   = text.getVerticalAlign();
+    out_.write((char *)(&horizontal),sizeof(enum Justification));
+    out_.write((char *)(&vertical),  sizeof(enum VerticalAlign));
+
+    const int noNT = niceT.size();
+    out_.write((char *)(&noNT),sizeof(int));
+
+    for(int ntc=0;ntc<noNT;ntc++)
+    {
+      MagFont magfont = niceT[ntc].font();
+      Colour colour = magfont.colour();
+      const MFloat r=colour.red();
+      const MFloat g=colour.green();
+      const MFloat b=colour.blue();
+      out_.write((char *)(&r), sizeof(MFloat));
+      out_.write((char *)(&g), sizeof(MFloat));
+      out_.write((char *)(&b), sizeof(MFloat));
+
+      const MFloat sf = magfont.size();
+      out_.write((char *)(&sf),sizeof(MFloat));
+
+      const string t=niceT[ntc].text();
+      const int len = t.length();
+      out_.write((char *)(&len),sizeof(int));
+
+      char pp[len];
+      strcpy(pp, t.c_str());
+      out_.write(pp,sizeof(char)*len);
+    }
+
+    for(int g=0;g<s;g++)
+    {
+        const MFloat x = text[g].x();
+        const MFloat y = text[g].y();
+        out_.write((char *)(&x),sizeof(MFloat));
+        out_.write((char *)(&y),sizeof(MFloat));
+    }
 }
 
 /*!
diff --git a/src/drivers/CairoDriver-blur.h b/src/drivers/CairoDriver-blur.h
new file mode 100644
index 0000000..17ed36d
--- /dev/null
+++ b/src/drivers/CairoDriver-blur.h
@@ -0,0 +1,121 @@
+/*
+ * Copyright © 2008 Kristian Høgsberg
+ * Copyright © 2009 Chris Wilson
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include <math.h>
+#include <stdint.h>
+
+#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
+
+/* Performs a simple 2D Gaussian blur of radius @radius on surface @surface. */
+void
+blur_image_surface (cairo_surface_t *surface, int radius)
+{
+    int x, y, z, w;
+    uint8_t *src, *dst;
+    uint32_t *s, *d, p;
+    int i, j, k;
+    uint8_t kernel[17];
+    const int size = ARRAY_LENGTH (kernel);
+    const int half = size / 2;
+
+    if (cairo_surface_status (surface))
+    return;
+
+    int width = cairo_image_surface_get_width (surface);
+    const int height = cairo_image_surface_get_height (surface);
+
+    switch (cairo_image_surface_get_format (surface)) {
+      case CAIRO_FORMAT_A1:
+      default:
+        /* Don't even think about it! */
+        return;
+      case CAIRO_FORMAT_A8:
+        /* Handle a8 surfaces by effectively unrolling the loops by a
+         * factor of 4 - this is safe since we know that stride has to be a
+         * multiple of uint32_t. */
+        width /= 4;
+        break;
+      case CAIRO_FORMAT_RGB24:
+      case CAIRO_FORMAT_ARGB32:
+        break;
+    }
+
+    cairo_surface_t *tmp = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
+    if (cairo_surface_status (tmp))
+    return;
+
+    src = cairo_image_surface_get_data (surface);
+    const int src_stride = cairo_image_surface_get_stride (surface);
+
+    dst = cairo_image_surface_get_data (tmp);
+    const int dst_stride = cairo_image_surface_get_stride (tmp);
+
+    uint32_t a = 0;
+    for (i = 0; i < size; i++) {
+      const double f = i - half;
+      a += kernel[i] = exp (- f * f / 30.0) * 80;
+    }
+
+    /* Horizontally blur from surface -> tmp */
+    for (i = 0; i < height; i++) {
+      s = (uint32_t *) (src + i * src_stride);
+      d = (uint32_t *) (dst + i * dst_stride);
+      for (j = 0; j < width; j++) {
+
+        x = y = z = w = 0;
+        for (k = 0; k < size; k++) {
+          if (j - half + k < 0 || j - half + k >= width)
+            continue;
+          p = s[j - half + k];
+          x += ((p >> 24) & 0xff) * kernel[k];
+          y += ((p >> 16) & 0xff) * kernel[k];
+          z += ((p >>  8) & 0xff) * kernel[k];
+          w += ((p >>  0) & 0xff) * kernel[k];
+        }
+        d[j] = (x / a << 24) | (y / a << 16) | (z / a << 8) | w / a;
+      }
+    }
+
+    /* Then vertically blur from tmp -> surface */
+    for (i = 0; i < height; i++) {
+      s = (uint32_t *) (dst + i * dst_stride);
+      d = (uint32_t *) (src + i * src_stride);
+      for (j = 0; j < width; j++) {
+
+        x = y = z = w = 0;
+        for (k = 0; k < size; k++) {
+          if (i - half + k < 0 || i - half + k >= height)
+            continue;
+          s = (uint32_t *) (dst + (i - half + k) * dst_stride);
+          p = s[j];
+          x += ((p >> 24) & 0xff) * kernel[k];
+          y += ((p >> 16) & 0xff) * kernel[k];
+          z += ((p >>  8) & 0xff) * kernel[k];
+          w += ((p >>  0) & 0xff) * kernel[k];
+        }
+        d[j] = (x / a << 24) | (y / a << 16) | (z / a << 8) | w / a;
+      }
+    }
+    cairo_surface_destroy (tmp);
+    cairo_surface_mark_dirty (surface);
+}
diff --git a/src/drivers/CairoDriver.cc b/src/drivers/CairoDriver.cc
index 0a3193f..81baeaa 100644
--- a/src/drivers/CairoDriver.cc
+++ b/src/drivers/CairoDriver.cc
@@ -390,6 +390,25 @@ MAGICS_NO_EXPORT void CairoDriver::endPage() const
 	}
 }
 
+
+void CairoDriver::newLayer(Layer&) const
+{
+	cairo_save(cr_);
+}
+
+#include "CairoDriver-blur.h"
+
+void CairoDriver::closeLayer(Layer&) const
+{
+    if(applyGaussianBlur_ > 0) 
+    {
+        blur_image_surface(surface_,50);
+    }
+	cairo_restore(cr_);
+}
+
+
+
 #ifdef HAVE_GEOTIFF
 
 #include <geotiffio.h>
@@ -1540,14 +1559,14 @@ MAGICS_NO_EXPORT void CairoDriver::renderSymbols(const Symbol& symbol) const
 		if(!ret)
 		{
 			cairo_save(cr_);
-			cairo_translate (cr_, projectX(symbol[0].x()), projectY(symbol[0].y()));
-			const MFloat sizeX =  convertCM(symbol.getHeight()/2) * coordRatioX_;
-			const MFloat sizeY = -convertCM(symbol.getHeight()/2) * coordRatioY_;
+			cairo_translate (cr_, projectX(symbol[0].x()), projectY(symbol[0].y())-convertCM(symbol.getHeight()*.3));
+			const MFloat sizeY = -convertCM(symbol.getHeight() *.1) * coordRatioY_;
 			const int w = cairo_image_surface_get_width(image);
 			const int h = cairo_image_surface_get_height(image);
-//cout << ">>>>>>>>> "<<symbol.getHeight()<<" --- "<<sizeX<<"/"<< w <<endl;
-			cairo_scale (cr_, sizeX*.55/w, sizeY*.23/h);
-			cairo_set_source_surface(cr_, image, -sizeX, -sizeY*1.3);
+            const double ratio = w/h;
+            const MFloat sizeX = sizeY * ratio;
+			cairo_scale (cr_, sizeX/w, sizeY/h);
+			cairo_set_source_surface(cr_, image, 0, 0);
 			cairo_paint(cr_);
 			cairo_surface_destroy (image);
 			cairo_restore(cr_);
diff --git a/src/drivers/CairoDriver.h b/src/drivers/CairoDriver.h
index 67ea6ff..8a616d9 100644
--- a/src/drivers/CairoDriver.h
+++ b/src/drivers/CairoDriver.h
@@ -87,9 +87,11 @@ public:
 
 private:
 	MAGICS_NO_EXPORT void startPage() const;
-        MAGICS_NO_EXPORT void endPage() const;
+    MAGICS_NO_EXPORT void endPage() const;
 	MAGICS_NO_EXPORT void project(const Layout& lay) const;
 	MAGICS_NO_EXPORT void unproject() const;
+	void newLayer(Layer&) const;
+	void closeLayer(Layer&) const;
 	MAGICS_NO_EXPORT void setupNewSurface() const;
 
 	MAGICS_NO_EXPORT void setNewLineWidth(const MFloat) const;
@@ -119,6 +121,7 @@ private:
 	mutable cairo_t*	cr_;
 	mutable cairo_t*	tmp_cr_;
 	mutable cairo_surface_t* surface_;
+	//mutable cairo_surface_t* surfaceBackground_;
 	mutable cairo_surface_t* tmp_surface_;
 
 	MAGICS_NO_EXPORT MFloat projectX(const MFloat x) const {return offsetX_+(x*coordRatioX_);}
diff --git a/src/drivers/PostScriptDriver.cc b/src/drivers/PostScriptDriver.cc
index 450b460..8412b2d 100644
--- a/src/drivers/PostScriptDriver.cc
+++ b/src/drivers/PostScriptDriver.cc
@@ -1428,10 +1428,45 @@ void PostScriptDriver::print(ostream& out)  const
 */
 MAGICS_NO_EXPORT void PostScriptDriver::renderSymbols(const Symbol& symbol) const
 {
-	setNewColour(symbol.getColour());
-	writeColour();
-	currentShading_=M_SH_SOLID;
-	BaseDriver::renderSymbols(symbol);
+    setNewColour(symbol.getColour());
+    writeColour();
+    currentShading_=M_SH_SOLID;
+	const string symbolName = symbol.getSymbol();
+	const string logo = "logo_ecmwf";
+	if (symbolName.find(logo) == std::string::npos)
+	{
+	  BaseDriver::renderSymbols(symbol);
+	}
+	else
+	{
+      pFile_<< " "<<projectX(symbol[0].x())<<" "<< projectY(symbol[0].y())-convertCM(symbol.getHeight()*.3)<< " t 0.4 0.4 s"<<endl;
+      pFile_<< "gs\n" 
+            << "183.473 76.074 m 183.473 63.121 l 146.492 63.121 l 146.492 48.105 l 180.438 48.105 l 180.438 36.094 l 146.492 36.094 l 146.492 18.977 l 184.262 18.977\n"
+            << "l 184.262 6.023 l 131.086 6.023 l 131.086 76.074 l P 183.473 76.074 m fill\n"
+            << "234.574 57.387 m 233.656 58.859 232.492 60.172 231.141 61.262 c 228.277 63.559 224.711 64.805 221.039 64.793 c 217.973 64.891 214.934 64.199 212.211\n"
+            << "62.793 c 209.84 61.496 207.82 59.645 206.324 57.398 c 204.781 55.047 203.668 52.441 203.043 49.699 c 202.359 46.773 202.023 43.773 202.039 40.77 c 202.023\n"
+            << "37.875 202.359 34.992 203.043 32.18 c 203.68 29.504 204.793 26.961 206.324 24.672 c 207.832 22.441 209.855 20.605 212.219 19.316 c 214.945 17.91 217.984\n"
+            << "17.219 221.051 17.316 c 225.762 17.316 229.434 18.754 232.062 21.629 c 234.844 24.812 236.543 28.797 236.918 33.012 c 251.832 33.012 l 251.523\n"
+            << "28.91 250.508 24.895 248.828 21.141 c 247.281 17.738 245.082 14.68 242.352 12.129 c 239.625 9.621 236.422 7.688 232.934 6.445 c 229.121 5.086 225.105\n"
+            << "4.41 221.059 4.441 c 216.094 4.363 211.164 5.312 206.586 7.234 c 202.457 8.988 198.758 11.613 195.742 14.934 c 192.75 18.289 190.449 22.203 188.977\n"
+            << "26.453 c 187.379 31.043 186.582 35.871 186.625 40.73 c 186.578 45.684 187.375 50.605 188.977 55.293 c 190.449 59.605 192.746 63.586 195.742 67.016 c\n"
+            << "198.734 70.395 202.43 73.074 206.566 74.875 c 214.637 78.219 223.621 78.641 231.973 76.074 c 235.309 75.016 238.43 73.371 241.191 71.223 c 243.934\n"
+            << "69.062 246.215 66.375 247.906 63.324 c 249.742 59.988 250.883 56.316 251.262 52.531 c 236.344 52.531 l 236.098 54.254 235.492 55.906 234.574 57.387 c P 234.574 57.387 m fill\n"
+            << "279.66 76.074 m 296.047 27.906 l 296.246 27.906 l 311.742 76.074 l 333.426 76.074 l 333.426 6.004 l 319 6.004 l 319 55.664 l 318.801 55.664 l 301.633\n"
+            << " 6.023 l 289.762 6.023 l 272.594 55.176 l 272.395 55.176 l 272.395 6.023 l 257.977 6.023 l 257.977 76.074 l P 279.66 76.074 m fill\n"
+            << "394.41 6.023 m 382.586 53.703 l 382.398 53.703 l 370.715 6.023 l 355.121 6.023 l 336.578 76.098 l 351.984 76.098 l 363.066 28.418 l 363.27 28.418\n"
+            << " l 375.391 76.074 l 389.816 76.074 l 401.816 27.824 l 402.02 27.824 l 413.488 76.074 l 428.594 76.074 l 409.758 6.004 l 394.41 6.004 l P 394.41 6.023 m fill\n"
+            << "481 76.074 m 481 63.121 l 447.156 63.121 l 447.156 46.938 l 476.496 46.938 l 476.496 34.922 l 447.164 34.922 l 447.164 6.023 l 431.758 6.023 l 431.758\n"
+            << " 76.074 l 481.012 76.074 l P 481 76.074 m fill\n"
+            << "0.402 36.836 m 34.848 36.836 l 34.848 46.164 l 0.402 46.164 l -0.137 43.078 -0.137 39.922 0.402 36.836 c P 0.402 36.836 m fill\n"
+            << "115.121 33.59 m 111.5 14.293 94.715 0.258 75.078 0.117 c 69.25 0.215 63.5 1.465 58.16 3.801 c 52.703 1.328 46.773 0.086 40.781 0.156 c 21.168 0.16\n"
+            << " 4.344 14.148 0.762 33.43 c 25.875 33.43 l 28.719 27.184 34.949 23.176 41.812 23.18 c 49.266 23.312 55.867 28.02 58.422 35.023 c 60.812 28.211 67.102\n"
+            << " 23.539 74.312 23.211 c 81.527 22.883 88.215 26.965 91.215 33.531 c P 115.121 33.59 m fill\n"
+            << "115.121 49.41 m 111.496 68.73 94.676 82.77 75.02 82.883 c 69.207 82.801 63.473 81.543 58.16 79.188 c 52.715 81.699 46.777 82.961 40.781 82.883\n"
+            << "c 21.148 82.891 4.305 68.879 0.742 49.57 c 25.855 49.57 l 28.688 55.84 34.934 59.867 41.812 59.859 c 49.273 59.723 55.875 55 58.422 47.988 c 60.82 54.793\n"
+            << " 67.113 59.465 74.324 59.789 c 81.535 60.117 88.223 56.031 91.227 49.469 c P 115.121 49.41 m fill\n"
+            << "gr" <<endl;
+	}
 }
 
 
@@ -1599,7 +1634,7 @@ MAGICS_NO_EXPORT void PostScriptDriver::writePSFileHeader() const
 
 	//copyMacro(ps,"PostScriptMacro1.ps");
 	*ps << "/m {moveto} def /st {stroke} def /rl {rlineto} def /ro {rotate} def /cp {closepath} def /d { {rmoveto rlineto} repeat stroke} bind def /gr {grestore} def /gs {gsave} def /n { newpath } def\n" 
-	    << "/sa {save} def /lw {setlinewidth } def /ar {arc fill} def /arn {arcn fill} def\n"
+	    << "/sa {save} def /lw {setlinewidth } def /ar {arc fill} def /arn {arcn fill} def /l { lineto } bind def /c { curveto } bind def\n"
 	    << "/sd {setdash} def /C { setrgbcolor } def /Y { setcmykcolor } def  /B { moveto rlineto stroke } bind def /BB { moveto lineto stroke } bind def /t { translate } def /s {scale} def /K { /UY exch def /UX exch def /LY exch def \n"
 	    << "/LX exch def gsave newpath LX LY moveto UX LY lineto UX UY lineto LX UY lineto closepath newpath } def /lp { moveto rlineto } bind def /p { moveto {rlineto} repeat stroke} bind def /po { moveto {rlineto} repeat } bind def\n"
 	    << "/q {moveto rlineto stroke} bind def /f {moveto {rlineto} repeat fill} bind def /e {moveto {rlineto} repeat eofill} bind def /F {moveto {rlineto} repeat} bind def /E {eofill} bind def /P { closepath } bind def\n"
diff --git a/src/drivers/SVGDriver.cc b/src/drivers/SVGDriver.cc
index 1a2bc4d..00b164b 100644
--- a/src/drivers/SVGDriver.cc
+++ b/src/drivers/SVGDriver.cc
@@ -1093,7 +1093,7 @@ MAGICS_NO_EXPORT void SVGDriver::circle(const MFloat x, const MFloat y, const MF
 		else
 		{
 		 const short  i   = (s<4) ? 1 : 0;
-		 const double rad = s*0.7853981634;
+		 //const double rad = s*0.7853981634;
 
 		 if(s==2)      pFile_ << "<path d=\"M"<<cx<<" "<<cy-r<<" v"<<r<<" h"<<r<<" a"<<r<<","<<r<<" 0 0 0 "<< -r<<","<<-r<<"\" ";
 		 else if(s==4) pFile_ << "<path d=\"M"<<cx<<" "<<cy-r<<" v"<<2*r<<" a"<<r<<","<<r<<" 0 0 0 "<< 0<<","<<-2*r<<"\" ";
diff --git a/src/params/Bar.xml b/src/params/Bar.xml
index b707e1c..53ae0ed 100644
--- a/src/params/Bar.xml
+++ b/src/params/Bar.xml
@@ -9,6 +9,9 @@ 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.
 -->
+    <parameter xml="orientation" from="string" name="graph_bar_orientation" default="vertical" member="orientation" to="string" values='horizontal/vertical'>
+            <documentation>   Orientation of the bars : Vertical or horizontal   </documentation>
+    </parameter>
 
   	<parameter xml="width" from="float" name="graph_bar_width" default="INT_MAX" member="width" to="float">
          		<documentation> The width of a bar in a bar chart 		</documentation>
diff --git a/src/params/BinaryObject.xml b/src/params/BinaryObject.xml
index ea0d773..7cde1fb 100644
--- a/src/params/BinaryObject.xml
+++ b/src/params/BinaryObject.xml
@@ -36,9 +36,8 @@ does it submit to any jurisdiction.
 	<parameter from="float" name="mgb_height" visible="no" default="100" member="mgb_height" to="float">
   		<documentation for_docs="no">Height in percentage		</documentation>
 	</parameter>
-	<parameter from="float" name="mgb_blur_radius" visible="no" default="-1" member="mgb_blur_radius" to="float">
-  		<documentation for_docs="no"> Blur radius, Only for png output, default: -1 no blurt effect </documentation>
-	</parameter> 
-	
 
+	<parameter from="int" name="mgb_blur_radius" visible="no" default="-1" member="mgb_blur_radius" to="int">
+  		<documentation for_docs="no">Blur radius, Only for png output, default: -1 no blurt effect </documentation>
+	</parameter> 
 </class></magics>
diff --git a/src/params/CMakeLists.txt b/src/params/CMakeLists.txt
index f272776..a5661bf 100644
--- a/src/params/CMakeLists.txt
+++ b/src/params/CMakeLists.txt
@@ -159,7 +159,6 @@ Proj4Geose.xml
 
 SDWindMode.xml
 SVGDriver.xml
-SampleContourMethod.xml
 ImportObjectHandler.xml
 
 SelectionMode.xml
diff --git a/src/params/Contour.xml b/src/params/Contour.xml
index 3a01614..a82ae4a 100644
--- a/src/params/Contour.xml
+++ b/src/params/Contour.xml
@@ -30,7 +30,7 @@ does it submit to any jurisdiction.
   	<parameter member="method" to="ContourMethod" default="automatic" from="string" name="contour_method">
          		<documentation> Contouring method  		</documentation>
          		<option xml="automatic" fortran="automatic"  include="AutomaticContourMethod.h" name="AutomaticContourMethod">		</option>
-         		<option xml="sample" fortran="sample" include="AutomaticContourMethod.h" name="SampleContourMethod">		</option>		
+         				
          		<option xml="linear" fortran="linear" include="ContourMethod.h" name="ContourMethod">		</option>
          		<option xml="akima760" fortran="akima760" include="Akima760Method.h" name="Akima760Method">		</option>
          		<option xml="akima474" fortran="akima474" include="Akima474Method.h" name="Akima474Method">		</option>
diff --git a/src/params/NetcdfInterpretor.xml b/src/params/NetcdfInterpretor.xml
index 5fb21e2..7cee4e9 100644
--- a/src/params/NetcdfInterpretor.xml
+++ b/src/params/NetcdfInterpretor.xml
@@ -45,7 +45,7 @@ does it submit to any jurisdiction.
            	<parameter member="missing_attribute" to="string" default="_FillValue" from="string" name="netcdf_missing_attribute">
             		<documentation>Attribute indicating the value used to indicate a missing value in the data		</documentation>
            	</parameter>  
-            	<parameter member="reference" to="string" default="0" from="string" name="netcdf_reference_date">
+            	<parameter member="reference" to="string" default="0" from="string" name="netcdf_reference_date" visible="false">
             		<documentation>attribute indicating  the reference date		</documentation>
            	</parameter> 
            	<parameter member="suppress_below" to="float" default="-1.0e+21" from="float" name="netcdf_field_suppress_below">
diff --git a/src/params/ObsPlotting.xml b/src/params/ObsPlotting.xml
index 00ac5ac..afb9c98 100644
--- a/src/params/ObsPlotting.xml
+++ b/src/params/ObsPlotting.xml
@@ -189,5 +189,8 @@ does it submit to any jurisdiction.
  	<parameter member="wind_colour" to="Colour" default="automatic" from="string" name="obs_wind_colour">
     		<documentation> Colour used to display wind </documentation>
  	</parameter>
+    <parameter member="wind_projected" to="bool" default="on" from="string" name="obs_wind_projected">
+            <documentation> if on (default), the wind will be reprojected according to the projection used in the map. </documentation>
+    </parameter>
 </class>
 </magics>
diff --git a/src/visualisers/AutomaticContourMethod.h b/src/visualisers/AutomaticContourMethod.h
index 09a94e6..b3c937a 100644
--- a/src/visualisers/AutomaticContourMethod.h
+++ b/src/visualisers/AutomaticContourMethod.h
@@ -28,40 +28,12 @@
 #include "Akima760Method.h"
 #include "MatrixHandler.h"
 #include "BasicSceneObject.h"
-#include "SampleContourMethodAttributes.h"
 
 
 
 namespace magics {
 
 
-class SampleContourMethod: public ContourMethod, public SampleContourMethodAttributes {
-
-public:
-	SampleContourMethod() {}
-	virtual ~SampleContourMethod() {}
-	ContourMethod* clone() { return new SampleContourMethod(); }
-	virtual bool accept(const string& node) { return magCompare(node, "sample"); }
-    void set(const XmlNode& node) { SampleContourMethodAttributes::set(node); }
-    void set(const map<string, string>& map) { SampleContourMethodAttributes::set(map); }
-    virtual MatrixHandler* handler(const AbstractMatrix& matrix, const BasicGraphicsObjectContainer&)
-    {
-    	MagLog::dev() << "ThinningMatrixHandler--> " << x_ << ", " << y_ << endl;
-        return new ThinningMatrixHandler(matrix, x_, y_);
-    }
-
-protected:
-     //! Method to print string about this class on to a stream of type ostream (virtual).
-	 virtual void print(ostream& out) const { out <<  "SampleContourMethod" << "\n"; }
-
-private:
-    //! Copy constructor - No copy allowed
-	SampleContourMethod(const SampleContourMethod&);
-    //! Overloaded << operator to copy - No copy allowed
-	SampleContourMethod& operator=(const SampleContourMethod&);
-
-};
-
 
 
 
@@ -92,13 +64,17 @@ public:
         MatrixHandler data(matrix);
         MatrixHandler* pMatrixHandler;
         if ( matrix.akimaEnable() == false ) {
-        		
-                    ContourMethod * pContourMethod =new  ContourMethod();
+                    if  ( matrix.delegate() ) {
+                        return new DelegateMatrixHandler(matrix);
+                    }
+        	        ContourMethod * pContourMethod =new  ContourMethod();
 
                     pMatrixHandler = pContourMethod->handler(matrix, owner);
 
                     MagLog::debug() << "Linear contouring, "    << "\n";
                     return pMatrixHandler;
+
+                   
         }
 
         double fGeoAreaWidth;
@@ -221,24 +197,8 @@ public:
 
 
 
-        // check for the 'sampling' case where we can subsample our data by 2 or more points
-/* do not use sampling anymore!
-        if ((nSampleX > 1) && (nSampleY > 1))
-        {
-            //SampleContourMethod *am = static_cast < SampleContourMethod *> (MagTranslator<string, ContourMethod >()("sampling"));
-            SampleContourMethod *am =new  SampleContourMethod();
-
-            auto_ptr<SampleContourMethod > pSampleContourMethod(am);
-
-            pSampleContourMethod->setX (nSampleX);
-            pSampleContourMethod->setY (nSampleY);
-
-            pMatrixHandler = pSampleContourMethod->handler(matrix, owner);
+       
 
-            MagLog::debug() << "Sampling every " << nSampleX << "x" << nSampleY << "\n"
-                         << "Resolution: "    << fDataResolutionX * nSampleX << "x" << fDataResolutionY * nSampleY    << "\n";
-        }
-*/
         // Check for the linear case (contour resolution == data resolution).
         // Also need to use linear contouring if we have missing values, because Akima will
         // incorrectly interpolate them. Missing data is also handled correctly if we have high-res
diff --git a/src/visualisers/Bar.cc b/src/visualisers/Bar.cc
index faf6374..2307c69 100644
--- a/src/visualisers/Bar.cc
+++ b/src/visualisers/Bar.cc
@@ -61,20 +61,36 @@ void  Bar::visit(Transformation& transformation, Data&)
 		transformation.needTopAxis(true);
 }
 
+
+
+
 void Bar::operator()(Data& data, BasicGraphicsObjectContainer& out)
 {
 	vector<double> xpos;
-	
 	vector<double> ypos;
     
-    const Transformation& transformation= out.transformation();
-    double y = transformation.getMinY() + (transformation.getMaxY()-transformation.getMinY())*0.2;
-
+    
 	CustomisedPointsList points; 
 	std::set<string> request;
 	request.insert("bar");
-
 	data.customisedPoints(out.transformation(), request, points, true);
+
+	if ( magCompare(orientation_, "horizontal") )
+		horizontal(points, out); 
+	else 
+		vertical(points, out);
+
+
+}
+
+
+void Bar::vertical(CustomisedPointsList& points, BasicGraphicsObjectContainer& out) 
+{
+	const Transformation& transformation= out.transformation();
+    double y = transformation.getMinY() + (transformation.getMaxY()-transformation.getMinY())*0.2;
+
+
+	
 	if (points.empty()) return;
 	double previous =  (**points.begin())["x"];
 	double next =  (**points.begin())["x"];
@@ -106,12 +122,68 @@ void Bar::operator()(Data& data, BasicGraphicsObjectContainer& out)
 		else {
 			MagLog::warning() << "Coud not find the method " << bar_style_ << " to plot the bar\n"
 					<< "      Revert to default : bar " << endl;
-			fullbar(x, top, bottom, out);
+			fullbar_x(x, top, bottom, out);
 		}
 		
+		PaperPoint xy(transformation.x(x), y);
+		if ( annotation != annotation_.end() && transformation.in(xy) ) {
+			Text* annot = new Text();
+			MagFont font;
+			font.colour(*annotation_colour_);
+			font.size(annotation_size_);
+			annot->setFont(font);
+			annot->setText(*annotation);
+			annot->setVerticalAlign(MBOTTOM);
+			annot->push_back(xy);
+			texts_.push_back(annot);
+			annotation++;
+		}
+		
+
+	}
+}
+
+void Bar::horizontal(CustomisedPointsList& points, BasicGraphicsObjectContainer& out) 
+{
+	const Transformation& transformation= out.transformation();
+    double x = transformation.getMinX() + (transformation.getMaxX()-transformation.getMinX())*0.2;
 
+
+	
+	if (points.empty()) return;
+	double previous =  (**points.begin())["y"];
+	double next =  (**points.begin())["y"];
+	double y, top, bottom, left, right;
+	
+	if (width_ == INT_MAX) {
+		if ( points.size() > 1 ) 
+			width_ = abs((*points[0])["y"] - (*points[1])["y"])*0.8;
+		else 
+			width_ = abs((*points[0])["y"] - (*points[1])["y"]);
+			 
+	}
+	
+	vector<string>::iterator annotation = annotation_.begin();
+	
+	for (CustomisedPointsList::const_iterator point = points.begin(); point != points.end(); ++point)
+	{
+		
+		y = (**point)["y"];
+		next = ((point+1) != points.end() ) ? (**(point+1))["y"] : x;
+		left = (min_value_ == INT_MAX) ? (**point)["x_lower"]: min_value_;
+	    right = (**point)["x_upper"];
 		
+		map<string,  Renderer>::iterator renderer = renderers_.find(lowerCase(bar_style_) );
 
+		if ( renderer != renderers_.end() ) {
+			(this->*renderer->second)(y, right, left, out);
+		}
+		else {
+			MagLog::warning() << "Coud not find the method " << bar_style_ << " to plot the bar\n"
+					<< "      Revert to default : bar " << endl;
+			fullbar_y(y, right, left, out);
+		}
+		
 		PaperPoint xy(transformation.x(x), y);
 		if ( annotation != annotation_.end() && transformation.in(xy) ) {
 			Text* annot = new Text();
@@ -128,12 +200,62 @@ void Bar::operator()(Data& data, BasicGraphicsObjectContainer& out)
 		
 
 	}
+}
+
+void Bar::fullbar(double x, double a, double b, BasicGraphicsObjectContainer& out) 
+{
+	if ( magCompare(orientation_, "horizontal") )
+		fullbar_y(x, a, b, out); 
+	else 
+		fullbar_x(x, a, b, out); 
+}
+
+void Bar::linebar(double x, double a, double b, BasicGraphicsObjectContainer& out) 
+{
+	if ( magCompare(orientation_, "horizontal") )
+		linebar_y(x, a, b, out); 
+	else 
+		linebar_x(x, a, b, out); 
+}
+
+void Bar::fullbar_y(double y, double left, double right, BasicGraphicsObjectContainer& out)
+{
+	const Transformation& transformation= out.transformation();
+	double bottom = y - width_/2;
+	double top = y + width_/2;
+	if ( justification_ == MLEFT ) {
+		top = y-width_;
+		bottom = y;
+	}
+	if ( justification_ == MRIGHT ) {
+			top = y;
+			bottom = y+width_;
+	}
 
 
+	Polyline* box  = new Polyline();
+	box->setColour(*line_colour_);
+
+	box->setThickness(thickness_);
+	box->setLineStyle(style_);
+
+	box->push_back(transformation(UserPoint(left, bottom)));
+	box->push_back(transformation(UserPoint(left, top)));
+	box->push_back(transformation(UserPoint(right, top)));
+	box->push_back(transformation(UserPoint(right, bottom)));
+	box->push_back(transformation(UserPoint(left, bottom)));
+
+	(*shade_)(*box);
+	if (clipping_) {
+		transformation(*box, out);
+	}
+	else
+		out.push_back(box);
 
 }
 
-void Bar::fullbar(double x, double top, double bottom, BasicGraphicsObjectContainer& out)
+
+void Bar::fullbar_x(double x, double top, double bottom, BasicGraphicsObjectContainer& out)
 {
 	const Transformation& transformation= out.transformation();
 	double left = x - width_/2;
@@ -169,7 +291,7 @@ void Bar::fullbar(double x, double top, double bottom, BasicGraphicsObjectContai
 
 }
 
-void Bar::linebar(double x, double top, double bottom, BasicGraphicsObjectContainer& out)
+void Bar::linebar_x(double x, double top, double bottom, BasicGraphicsObjectContainer& out)
 {
 	const Transformation& transformation= out.transformation();
 	double left = x - width_/2;
@@ -202,6 +324,39 @@ void Bar::linebar(double x, double top, double bottom, BasicGraphicsObjectContai
 	transformation(*bottomline, out);
 }
 
+void Bar::linebar_y(double y, double left, double right, BasicGraphicsObjectContainer& out)
+{
+	const Transformation& transformation= out.transformation();
+	double bottom = y - width_/2;
+	double top = y + width_/2;
+
+	Polyline* line  = new Polyline();
+	line->setColour(*line_colour_);
+	line->setThickness(thickness_);
+	line->setLineStyle(style_);
+	line->push_back(transformation(UserPoint(left, y)));
+	line->push_back(transformation(UserPoint(right, y)));
+
+
+	Polyline* topline = new Polyline();
+	topline->setColour(*line_colour_);
+	topline->setThickness(thickness_);
+	topline->setLineStyle(style_);
+	topline->push_back(transformation(UserPoint(left, top)));
+	topline->push_back(transformation(UserPoint(right, top)));
+
+	Polyline* bottomline = new Polyline();
+	bottomline->setColour(*line_colour_);
+	bottomline->setThickness(thickness_);
+	bottomline->setLineStyle(style_);
+	bottomline->push_back(transformation(UserPoint(left, bottom)));
+	bottomline->push_back(transformation(UserPoint(right, bottom)));
+
+	transformation(*line, out);
+	transformation(*topline, out);
+	transformation(*bottomline, out);
+}
+
 void Bar::visit(LegendVisitor& legend)
 {
 	if ( !legend_) return;
diff --git a/src/visualisers/Bar.h b/src/visualisers/Bar.h
index bf28475..6364807 100644
--- a/src/visualisers/Bar.h
+++ b/src/visualisers/Bar.h
@@ -48,6 +48,9 @@ public:
 	}
     
     void operator()(Data&, BasicGraphicsObjectContainer&);
+    void horizontal(CustomisedPointsList&, BasicGraphicsObjectContainer&);
+    void vertical(CustomisedPointsList&, BasicGraphicsObjectContainer&);
+
     void visit(LegendVisitor&);
     void visit(TopAxisVisitor&);
     void visit(Transformation&, Data&);
@@ -55,6 +58,12 @@ public:
     void fullbar(double, double, double, BasicGraphicsObjectContainer&);
     void linebar(double, double, double, BasicGraphicsObjectContainer&);
 
+    void fullbar_x(double, double, double, BasicGraphicsObjectContainer&);
+    void linebar_x(double, double, double, BasicGraphicsObjectContainer&);
+    void fullbar_y(double, double, double, BasicGraphicsObjectContainer&);
+    void linebar_y(double, double, double, BasicGraphicsObjectContainer&);
+
+
 protected:
      //! Method to print string about this class on to a stream of type ostream (virtual).
 	 virtual void print(ostream&) const; 
diff --git a/src/visualisers/Contour.cc b/src/visualisers/Contour.cc
index 917c7e3..c5e3149 100644
--- a/src/visualisers/Contour.cc
+++ b/src/visualisers/Contour.cc
@@ -116,7 +116,7 @@ void Contour::operator()(Data& data, BasicGraphicsObjectContainer& parent)
 	}
 
 	matrix_ = (*this->method_).handler(*box, parent);
-
+	//matrix_ = box;
 
 	if (this->floor_ != -INT_MAX || this->ceiling_ != INT_MAX)
 		matrix_ = new MatrixTreshold(*matrix_, this->floor_, this->ceiling_);
diff --git a/src/visualisers/EpsGraph.cc b/src/visualisers/EpsGraph.cc
index bf597af..3b226b7 100644
--- a/src/visualisers/EpsGraph.cc
+++ b/src/visualisers/EpsGraph.cc
@@ -1533,7 +1533,7 @@ void EpsCloud::operator()(Data& data, BasicGraphicsObjectContainer& visitor)
 
 	map<string, float> directions;
 	
-				directions["1"] = 3.14 * 3/8;
+				directions["one"] = 3.14 * 3/8;
 				directions["2"] = 3.14 * 1/8;
 				directions["3"] =  -3.14*1/8;
 				directions["4"] = -3.14* 3/8;
diff --git a/src/visualisers/ObsItemFamily.cc b/src/visualisers/ObsItemFamily.cc
index 70365a6..551cd43 100644
--- a/src/visualisers/ObsItemFamily.cc
+++ b/src/visualisers/ObsItemFamily.cc
@@ -84,10 +84,13 @@ MagLog::debug() << "OBS ITEM - ObsWind - Lon/Lat: "<<point.longitude()<<" / "<<p
 	const Transformation& transformation = symbol.parent().transformation();
 	PaperPoint pp(point.longitude(), point.latitude());
 	std::pair<double, double> wind = std::make_pair(speed->second, direction->second);
-	transformation.reprojectSpeedDirection(pp, wind);
+	if ( owner_->wind_projected_ ) 
+		transformation.reprojectSpeedDirection(pp, wind);
+	
+	flag->speed(wind.first);
+	flag->direction(wind.second);
+
 	
-	flag->speed(speed->second);
-	flag->direction(direction->second);
 
 	if (point.latitude() <0 ) 
 		flag->setHemisphere(SOUTH);
@@ -184,14 +187,38 @@ void ObsCloudAndWind::operator()( CustomisedPoint& point, ComplexSymbol& symbol)
 	const Transformation& transformation = symbol.parent().transformation();
 	PaperPoint pp(point.longitude(), point.latitude());
 	std::pair<double, double> wind = std::make_pair(speed, direction);
-	transformation.reprojectSpeedDirection(pp, wind);
+	if ( owner_->wind_projected_ ) 
+		transformation.reprojectSpeedDirection(pp, wind);
+	
+	flag->speed(wind.first);
+	flag->direction(wind.second);
+
+	
+	if (point.latitude() <0 ) 
+		flag->setHemisphere(SOUTH);
+	symbol.add(flag);
+/*
+	flag = new FlagItem();
+	flag->setColour(Colour("red"));
+	flag->length(owner_->size_*2.5); // Size to be adjusted later!
+	flag->thickness(1.5);
+
+	flag->setOriginHeight(owner_->ring_size_ * 1.75);
+	flag->setOriginMarker(origin);
+	flag->x(0);
+	flag->y(0);
+	
+	
 	
 	flag->speed(speed);
 	flag->direction(direction);
 
+	
 	if (point.latitude() <0 ) 
 		flag->setHemisphere(SOUTH);
 	symbol.add(flag);
+*/
+
 }
 
 void ObsPressure::visit(std::set<string>& tokens)
diff --git a/src/web/WrepJSon.cc b/src/web/WrepJSon.cc
index 8ae816d..8de6b87 100644
--- a/src/web/WrepJSon.cc
+++ b/src/web/WrepJSon.cc
@@ -196,7 +196,6 @@ void WrepJSon::visit(Transformation& transformation)
 
 
 
-
 	if ( y_max_threshold_ < INT_MAX) 
 		maxy_ = (maxy_ < y_max_threshold_ )? y_max_threshold_ : maxy_; 
  
@@ -256,6 +255,7 @@ string binding(const string& version, const string& key) {
 		bindings["v0"].insert(make_pair("lon", "longitude"));
 		bindings["v0"].insert(make_pair("longitude", "lon"));
 		bindings["v0"].insert(make_pair("latitude", "lat"));
+
 		bindings["v0"].insert(make_pair("1", "one"));
 		bindings["v0"].insert(make_pair("10", "ten"));
 		bindings["v0"].insert(make_pair("99", "ninety_nine"));
@@ -281,7 +281,7 @@ string binding(const string& version, const string& key) {
 void WrepJSon::eps(Transformation& transformation)
 {
 
-	cout << "API--->" << api_ << endl;
+	
  	if ( keyword_ != "clim" ) {
 		transformation.setDataMinMaxX(minx_  * 3600, maxx_ * 3600, base_);
 
@@ -296,7 +296,7 @@ void WrepJSon::eps(Transformation& transformation)
 	    	maxs.push_back((**point)["max"]);
 	    	allvalues.push_back((**point)["seventy_five"]);
 	    	allvalues.push_back((**point)["ninety"]);
-	    	if ( (*point)->find("forecast") != (*point)->end() ) {
+	    	if ( (*point)->find("hres") != (*point)->end() ) {
 	    		allvalues.push_back((**point)["hres"]);
 	    		maxs.push_back((**point)["hres"]);
 	    	}
@@ -520,7 +520,7 @@ void WrepJSon::profile()
 
 
 		for ( map<string, vector<double>  >::iterator val = values.begin(); val != values.end(); ++val ) {
-			if ( val->first=="forecast" ) {
+			if ( val->first=="hres" ) {
 				double value =  (val->second)[i] == missing_ ? missing_ : correctDetz((val->second)[i]);
 
 				(*point)[val->first] = value;
@@ -605,9 +605,7 @@ void WrepJSon::basic()
 	        		    	    if ( method != methods_.end() ) {
 	        		    	    	   ( (this->*method->second)(entry->value_) );
 	        		    	    }  
-	        		    	    else 
-	        		    	    	cout << 	entry->name_	<< endl;
-	        			    		
+	        		    	    
 	        	  }
 	         }
 	         catch (std::exception e)

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



More information about the debian-science-commits mailing list