[metview] 01/01: metview 4.8.0-1 release

Alastair McKinstry mckinstry at moszumanska.debian.org
Thu May 25 07:53:12 UTC 2017


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

mckinstry pushed a commit to tag debian/4.8.0-1
in repository metview.

commit 24be1362c9f5d756e2cf0211ec6319eb94782002
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Fri Mar 3 14:19:48 2017 +0000

    metview 4.8.0-1 release
---
 CMakeLists.txt                                     |  204 ++--
 INSTALL                                            |    2 +-
 LICENSE                                            |    2 +-
 NOTICE                                             |    2 +-
 VERSION.cmake                                      |    4 +-
 bin/CMakeLists.txt                                 |    4 +-
 bin/ecbuild                                        |   94 +-
 cmake/CheckFortranCompilerFlag.cmake               |   37 -
 cmake/CheckFortranSourceCompiles.cmake             |   94 --
 cmake/FindADSM.cmake                               |    2 +-
 cmake/FindAEC.cmake                                |   33 +-
 cmake/FindAIO.cmake                                |    2 +-
 cmake/FindArmadillo.cmake                          |    7 +-
 cmake/FindCMath.cmake                              |   15 +-
 cmake/FindCairo.cmake                              |    5 +-
 cmake/FindDl.cmake                                 |    7 +-
 cmake/FindEMOS.cmake                               |    2 +-
 cmake/FindFDB.cmake                                |    2 +-
 cmake/FindFFTW.cmake                               |  211 ++++
 cmake/FindGeoTIFF.cmake                            |   63 +-
 cmake/FindHPSS.cmake                               |    2 +-
 cmake/FindLEX.cmake                                |    2 +-
 cmake/FindLegacyFDB.cmake                          |   35 -
 cmake/FindLibGFortran.cmake                        |   23 +-
 cmake/FindLibIFort.cmake                           |    7 +-
 cmake/FindMKL.cmake                                |    9 +-
 cmake/FindNDBM.cmake                               |    2 +-
 cmake/FindNetCDF.cmake                             |   46 +-
 cmake/FindNetCDF3.cmake                            |    7 +-
 cmake/FindODB.cmake                                |    2 +-
 cmake/FindOpenCL.cmake                             |    7 +-
 cmake/FindOpenJPEG.cmake                           |   56 +-
 cmake/FindPGIFortran.cmake                         |   11 +-
 cmake/FindPango.cmake                              |   22 +-
 cmake/FindPangoCairo.cmake                         |   32 +-
 cmake/FindProj4.cmake                              |   12 +-
 cmake/FindREADLINE.cmake                           |    6 +-
 cmake/FindRPCGEN.cmake                             |    2 +-
 cmake/FindRealtime.cmake                           |    8 +-
 cmake/FindSZip.cmake                               |    2 +-
 cmake/FindTrilinos.cmake                           |    2 +-
 cmake/FindViennaCL.cmake                           |    7 +-
 cmake/FindXLFortranLibs.cmake                      |    8 +-
 cmake/FindYACC.cmake                               |    2 +-
 cmake/Findgrib_api.cmake                           |   44 +-
 cmake/Findodb_api.cmake                            |    2 +-
 cmake/Findspot.cmake                               |    2 +-
 cmake/VERSION.cmake                                |    6 +-
 cmake/compiler_flags/Clang_C.cmake                 |   13 +
 cmake/compiler_flags/Clang_CXX.cmake               |   13 +
 cmake/compiler_flags/Cray_C.cmake                  |   13 +
 cmake/compiler_flags/Cray_CXX.cmake                |   13 +
 cmake/compiler_flags/Cray_Fortran.cmake            |   15 +
 cmake/compiler_flags/GNU_C.cmake                   |   18 +
 cmake/compiler_flags/GNU_CXX.cmake                 |   18 +
 cmake/compiler_flags/GNU_Fortran.cmake             |   21 +
 cmake/compiler_flags/Intel_C.cmake                 |   13 +
 cmake/compiler_flags/Intel_CXX.cmake               |   13 +
 cmake/compiler_flags/Intel_Fortran.cmake           |   14 +
 cmake/compiler_flags/PGI_C.cmake                   |   11 +
 cmake/compiler_flags/PGI_CXX.cmake                 |   11 +
 cmake/compiler_flags/PGI_Fortran.cmake             |   11 +
 .../CMakeCheckCompilerFlagCommonPatterns.cmake     |   33 +
 cmake/contrib/CheckFortranCompilerFlag.cmake       |   72 +-
 cmake/contrib/CheckFortranSourceCompiles.cmake     |  133 ++-
 cmake/contrib/FindFFTW.cmake                       |  152 ---
 cmake/contrib/FindNetCDF4.cmake                    |   45 +-
 cmake/contrib/GetGitRevisionDescription.cmake.in   |    6 +-
 .../contrib/GreatCMakeCookOff/AddCPP11Flags.cmake  |    5 +-
 .../GreatCMakeCookOff/CheckCXX11Features.cmake     |  125 +--
 cmake/ecbuild_add_c_flags.cmake                    |   70 +-
 cmake/ecbuild_add_cxx11_flags.cmake                |    2 +-
 cmake/ecbuild_add_cxx_flags.cmake                  |   70 +-
 cmake/ecbuild_add_executable.cmake                 |  122 ++-
 cmake/ecbuild_add_extra_search_paths.cmake         |   12 +-
 cmake/ecbuild_add_fortran_flags.cmake              |   77 +-
 cmake/ecbuild_add_library.cmake                    |  143 ++-
 cmake/ecbuild_add_option.cmake                     |  140 ++-
 cmake/ecbuild_add_persistent.cmake                 |   20 +-
 cmake/ecbuild_add_resources.cmake                  |    6 +-
 cmake/ecbuild_add_test.cmake                       |  149 ++-
 cmake/ecbuild_append_to_rpath.cmake                |    4 +-
 cmake/ecbuild_bundle.cmake                         |   50 +-
 cmake/ecbuild_cache.cmake                          |    2 +-
 cmake/ecbuild_check_c_source_return.cmake          |   12 +-
 cmake/ecbuild_check_compiler.cmake                 |    9 +-
 cmake/ecbuild_check_cxx11.cmake                    |  161 +--
 cmake/ecbuild_check_cxx_source_return.cmake        |   56 +-
 cmake/ecbuild_check_fortran.cmake                  |  126 +++
 cmake/ecbuild_check_fortran_source_return.cmake    |   25 +-
 cmake/ecbuild_check_functions.cmake                |   27 +-
 cmake/ecbuild_check_os.cmake                       |  143 ++-
 cmake/ecbuild_compiler_flags.cmake                 |  211 ++++
 cmake/ecbuild_config.h.in                          |   10 +-
 cmake/ecbuild_debug_var.cmake                      |   47 -
 cmake/ecbuild_declare_project.cmake                |   81 +-
 cmake/ecbuild_define_build_types.cmake             |   82 +-
 cmake/ecbuild_define_libs_and_execs_target.cmake   |   29 +
 ...get.cmake => ecbuild_define_links_target.cmake} |   10 +-
 cmake/ecbuild_define_options.cmake                 |   12 +-
 cmake/ecbuild_define_paths.cmake                   |   25 +-
 cmake/ecbuild_dont_pack.cmake                      |    6 +-
 cmake/ecbuild_download_resource.cmake              |    7 +-
 cmake/ecbuild_echo_targets.cmake                   |   24 +-
 cmake/ecbuild_enable_fortran.cmake                 |   15 +-
 cmake/ecbuild_features.cmake                       |   55 +-
 cmake/ecbuild_find_fortranlibs.cmake               |   14 +-
 cmake/ecbuild_find_lexyacc.cmake                   |   25 +-
 cmake/ecbuild_find_mpi.cmake                       |   14 +-
 cmake/ecbuild_find_omp.cmake                       |   15 +-
 cmake/ecbuild_find_package.cmake                   |   36 +-
 cmake/ecbuild_find_perl.cmake                      |    6 +-
 cmake/ecbuild_find_python.cmake                    |  237 +++--
 cmake/ecbuild_generate_config_headers.cmake        |    4 +-
 cmake/ecbuild_generate_fortran_interfaces.cmake    |  143 +++
 cmake/ecbuild_generate_rpc.cmake                   |   10 +-
 cmake/ecbuild_generate_yy.cmake                    |   40 +-
 cmake/ecbuild_get_cxx11_flags.cmake                |   13 +-
 cmake/ecbuild_get_date.cmake                       |    6 +-
 cmake/ecbuild_get_resources.cmake                  |   20 +-
 cmake/ecbuild_get_test_data.cmake                  |   59 +-
 cmake/ecbuild_git.cmake                            |   55 +-
 cmake/ecbuild_install_project.cmake                |  143 ++-
 cmake/ecbuild_list_add_pattern.cmake               |  102 ++
 cmake/ecbuild_list_exclude_pattern.cmake           |   88 ++
 cmake/ecbuild_list_extra_search_paths.cmake        |   12 +-
 cmake/ecbuild_list_macros.cmake                    |   40 +-
 cmake/ecbuild_log.cmake                            |  180 +++-
 cmake/ecbuild_pkgconfig.cmake                      |    8 +-
 cmake/ecbuild_policies.cmake                       |   10 +-
 cmake/ecbuild_print_summary.cmake                  |   72 +-
 cmake/ecbuild_project_files.cmake                  |   12 +-
 cmake/ecbuild_remove_fortran_flags.cmake           |   60 ++
 cmake/ecbuild_requires_macro_version.cmake         |    4 +-
 cmake/ecbuild_separate_sources.cmake               |   38 +-
 cmake/ecbuild_setup_test_framework.cmake           |   10 +-
 cmake/ecbuild_source_flags.cmake                   |   34 +
 cmake/ecbuild_system.cmake                         |   82 +-
 cmake/ecbuild_target_flags.cmake                   |   91 ++
 cmake/ecbuild_use_package.cmake                    |   40 +-
 cmake/ecbuild_version.h.in                         |    2 +-
 cmake/ecbuild_warn_unused_files.cmake              |   28 +-
 cmake/fcm-make-interfaces.cfg                      |   31 +
 cmake/fortran_features/CheckFortranFeatures.cmake  |  167 +++
 cmake/fortran_features/c_size_t.F90                |    8 +
 cmake/fortran_features/c_sizeof.F90                |    3 +
 cmake/fortran_features/derivedtype_interface.F90   |   54 +
 cmake/fortran_features/derivedtype_io.F90          |   42 +
 cmake/fortran_features/finalization.F90            |  141 +++
 cmake/fortran_features/submodules.F90              |   35 +
 cmake/gen_source_flags.py                          |   84 ++
 cmake/include/ecbuild/boost_test_framework.h       |    2 +-
 cmake/project-config.cmake.in                      |   49 +-
 cmake/sg.pl                                        |    2 +-
 debian/changelog                                   |  106 +-
 debian/compat                                      |    2 +-
 debian/control                                     |   21 +-
 debian/patches/auto-ptr.patch                      |  760 +++++++++++++
 debian/patches/cmake-fixes.patch                   |   18 +-
 debian/patches/fix-bashisms.patch                  |    6 +-
 debian/patches/fix-paths.patch                     |   15 -
 debian/patches/fix-scripts.patch                   |   42 +-
 debian/patches/fpic.patch                          |    8 +-
 debian/patches/g++-6.patch                         |   12 +-
 debian/patches/hurd.patch                          |    6 +-
 debian/patches/mv_compress.patch                   |    6 +-
 debian/patches/reproducible-build.patch            |   12 +-
 debian/patches/series                              |    2 -
 debian/rules                                       |    4 +
 debian/watch                                       |    4 +
 project_summary.cmake                              |   51 +-
 scripts/CMakeLists.txt                             |   70 +-
 scripts/MarsOdbWrapper                             |    2 +-
 scripts/MarsTiggeWrapper                           |    2 +-
 scripts/ObstatToolWrapper                          |    2 +-
 scripts/compile.in                                 |   31 +-
 scripts/compile.src                                |    2 +-
 scripts/dump                                       |    2 +-
 scripts/find_from_libs                             |    2 +-
 scripts/generate_video                             |    4 +-
 scripts/logrun                                     |    2 +-
 scripts/metgram.py                                 |  134 +++
 scripts/metview-mail                               |    2 +-
 scripts/metview_base.in                            |   68 +-
 scripts/metview_create_user_dir                    |    7 +-
 scripts/metview_help                               |    4 +
 scripts/mv_compress                                |    2 +-
 scripts/mv_dots                                    |    2 +-
 scripts/mv_flexpart_run                            |    2 +-
 scripts/mv_flextra_prep                            |    2 +-
 scripts/mv_flextra_run                             |   13 +-
 scripts/mv_grib_dump                               |    2 +-
 scripts/mv_mail                                    |    2 +-
 scripts/mv_obstat                                  |    2 +-
 scripts/mv_odbsql                                  |    2 +-
 scripts/mv_rttov_run                               |    2 +-
 scripts/mv_scm_run                                 |    2 +-
 scripts/mv_uniquename                              |    4 +-
 scripts/mv_vapor_gui                               |    2 +-
 scripts/mvrun                                      |    2 +-
 scripts/mvrun_c                                    |    2 +-
 scripts/mvrun_lnx                                  |    2 +-
 scripts/mvusage                                    |    2 +-
 scripts/select_mars_config                         |    2 +-
 scripts/set_mars_env                               |    2 +-
 share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake     |   66 +-
 share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake      |   59 +-
 share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake    |   65 +-
 share/ecbuild/toolchains/ichec-fionn-Intel.cmake   |   67 ++
 share/metview/app-defaults/CMakeLists.txt          |    2 +-
 .../app-defaults/FrameKeyProfile_default.xml       |    4 +-
 .../app-defaults/GribKeyProfile_default.xml        |    4 +-
 .../app-defaults/LayerKeyProfile_default.xml       |    5 +-
 share/metview/app-defaults/Sample_Drawers.tar.gz   |  Bin 2133 -> 5016 bytes
 share/metview/app-defaults/User_Dir_Frame.tar.gz   |  Bin 403101 -> 448836 bytes
 share/metview/etc/AnnotationViewDef                |    4 +-
 share/metview/etc/AxisDef                          |    2 +-
 share/metview/etc/BinningObjectDef                 |    2 +-
 share/metview/etc/CMakeLists.txt                   |   12 +-
 share/metview/etc/CoastDef                         |    2 +-
 share/metview/etc/ContDef                          |    2 +-
 share/metview/etc/EPSOutputDef                     |   14 -
 share/metview/etc/GeoToGribDef                     |    3 +
 share/metview/etc/GeoToGribRules                   |    3 +
 share/metview/etc/GeoViewDef                       |    2 +-
 share/metview/etc/GraphDef                         |    2 +-
 share/metview/etc/KMLOutputDef                     |   14 -
 share/metview/etc/MAXISDef                         |   27 +-
 share/metview/etc/MAXISRules                       |   13 +
 share/metview/etc/MBOXPLOTDef                      |    2 +-
 share/metview/etc/MCOASTDef                        |  178 ++--
 share/metview/etc/MCONTDef                         |    2 +-
 share/metview/etc/MGRAPHDef                        |    2 +-
 share/metview/etc/MLEGENDDef                       |    2 +-
 share/metview/etc/MSYMBDef                         |    2 +-
 share/metview/etc/MTAYLORDef                       |    2 +-
 share/metview/etc/MTEXTDef                         |    2 +-
 share/metview/etc/MTHERMOGRIDDef                   |    2 +-
 share/metview/etc/MWINDDef                         |    2 +-
 .../etc/{MagicsColors.h => MagicsColours.txt}      |    1 +
 share/metview/etc/MarsRules                        |   17 +-
 share/metview/etc/ObjectList                       |    6 +-
 share/metview/etc/ObsFilterDef                     |    7 +-
 share/metview/etc/ObsPlottingDef                   |    2 +-
 share/metview/etc/PDFOutputDef                     |   14 -
 share/metview/etc/PNGOutputDef                     |   14 -
 share/metview/etc/PSOutputDef                      |   14 -
 share/metview/etc/PageFrameDef                     |    6 +-
 share/metview/etc/PlotPageDef                      |    2 +-
 share/metview/etc/SVGOutputDef                     |   14 -
 share/metview/etc/SubpageFrameDef                  |    4 +-
 share/metview/etc/SymbDef                          |    2 +-
 share/metview/etc/TextDef                          |    2 +-
 share/metview/etc/WindDef                          |    2 +-
 share/metview/etc/ecmwf.def                        |   44 +-
 share/metview/etc/licence_for_about_box.txt        |    2 +-
 share/metview/etc/mars.chk                         |   17 +-
 share/metview/etc/tigge.def                        |   44 +-
 share/metview/icons/FLEXTRA_FILE.xpm               |    0
 share/metview/icons/FLEXTRA_PREPARE.xpm            |    0
 share/metview/icons/FLEXTRA_RUN.xpm                |    0
 share/metview/icons/FLEXTRA_VISUALISER.xpm         |    0
 share/metview/icons/INPUTVISUALISER.xpm            |    0
 share/metview/icons/NETCDFPLUS.xpm                 |    0
 share/metview/icons/ODB_DB.xpm                     |    0
 share/metview/icons/ODB_VISUALISER.xpm             |    0
 share/metview/icons/TABLEVISUALISER.xpm            |    0
 share/metview/icons/fix_last_line                  |    2 +-
 share/metview/icons/help_area.xpm                  |    0
 share/metview/icons/help_line.xpm                  |    0
 share/metview/icons/help_map.xpm                   |    0
 share/metview/icons/help_point.xpm                 |    0
 share/metview/icons/help_station.xpm               |    0
 share/metview/icons_mv5/AVERAGE.xpm                |    0
 share/metview/icons_mv5/AVERAGEVIEW.xpm            |    0
 share/metview/icons_mv5/FLEXTRA_FILE.svg           |   75 +-
 share/metview/icons_mv5/FLEXTRA_PREPARE.svg        |   63 +-
 share/metview/icons_mv5/FLEXTRA_RUN.svg            |  257 +++--
 share/metview/icons_mv5/FLEXTRA_VISUALISER.svg     |  215 ++--
 share/metview/icons_mv5/GRIBVECTORS.xpm            |    0
 share/metview/icons_mv5/GeoToKML.xpm               |    0
 share/metview/icons_mv5/HOVMOELLERDATA.xpm         |    0
 share/metview/icons_mv5/INPUTVISUALISER.svg        |    0
 share/metview/icons_mv5/Interpolation.svg          |    0
 share/metview/icons_mv5/MAGML.xpm                  |    0
 share/metview/icons_mv5/MHOVMOELLERDATA.xpm        |    0
 share/metview/icons_mv5/MHOVMOELLERVIEW.xpm        |    0
 share/metview/icons_mv5/MTHERMO.xpm                |    0
 share/metview/icons_mv5/MVPROFILE.xpm              |    0
 share/metview/icons_mv5/MVPROFILEVIEW.xpm          |    0
 share/metview/icons_mv5/MXAVERAGE.xpm              |    0
 share/metview/icons_mv5/MXAVERAGEVIEW.xpm          |    0
 share/metview/icons_mv5/MXSECTION.xpm              |    0
 share/metview/icons_mv5/MXSECTIONVIEW.xpm          |    0
 share/metview/icons_mv5/MetPlus.xpm                |    0
 share/metview/icons_mv5/NETCDFPLUS.svg             |    0
 share/metview/icons_mv5/OBSTAT.xpm                 |    0
 share/metview/icons_mv5/OBSTAT_CURVE.xpm           |    0
 share/metview/icons_mv5/OBSTAT_SCATTER.xpm         |    0
 share/metview/icons_mv5/ODB_MARS.xpm               |    0
 share/metview/icons_mv5/REPROJECTION.xpm           |    0
 share/metview/icons_mv5/TABLEVISUALISER.svg        |    0
 share/metview/icons_mv5/THERMODATA.xpm             |    0
 share/metview/icons_mv5/VPROF.xpm                  |    0
 share/metview/icons_mv5/VPROFILE.xpm               |    0
 share/metview/icons_mv5/VPROFVIEW.xpm              |    0
 share/metview/icons_mv5/WEBACCESS.xpm              |    0
 share/metview/icons_mv5/XAVERAGE.xpm               |    0
 share/metview/icons_mv5/XSECT.xpm                  |    0
 share/metview/icons_mv5/XSECTION.xpm               |    0
 share/metview/icons_mv5/XSECTVIEW.xpm              |    0
 src/AppMod/checkdisplay.cc                         |    4 +-
 src/BufrExaminer/BufrMetaData.cc                   |   67 +-
 src/CMakeLists.txt                                 |    5 +-
 src/Desktop/EditTransaction.cc                     |    3 +-
 src/Desktop/FolderInfo.cc                          |    1 -
 src/Desktop/MvQColourLine.cc                       |   15 +-
 src/Desktop/MvQDetailedFolderView.cc               |    5 +-
 src/Desktop/MvQFolderItemProperty.cc               |    7 +-
 src/Desktop/MvQFolderItemProperty.h                |    5 +-
 src/Desktop/MvQFolderModel.cc                      |   14 +-
 src/Desktop/MvQFolderViewBase.cc                   |    3 -
 src/Desktop/MvQGeoHelp.cc                          |    2 +
 src/Desktop/MvQIconFolderView.cc                   |    5 +-
 src/Desktop/MvQIconProvider.cc                     |   72 +-
 src/Desktop/MvQIconProvider.h                      |   10 +-
 src/Desktop/MvQPageView.cc                         |   25 +-
 src/Desktop/MvQRequestPanelLine.cc                 |    6 +-
 src/Desktop/Parameter.cc                           |   13 +
 src/Download/CMakeLists.txt                        |   12 +
 src/Download/DOWNLOAD.svg                          |  226 ++++
 src/Download/Download.cc                           |  208 ++++
 src/Download/DownloadDef                           |   12 +
 src/Download/ObjectSpec.Download                   |   29 +
 src/Flextra/FlextraRun.cc                          |   20 +-
 src/Flextra/ObjectSpec.Flexpart                    |    2 +-
 src/Hovmoeller/HovArea.cc                          |   22 +-
 src/Hovmoeller/HovHeight.cc                        |   17 +
 src/Hovmoeller/HovLine.cc                          |   18 +
 src/Hovmoeller/HovToolkit.cc                       |  113 +-
 src/Hovmoeller/HovToolkit.h                        |    3 +
 src/Hovmoeller/MHovmoellerDataDef                  |    4 +-
 src/Hovmoeller/MHovmoellerViewDef                  |    2 +-
 src/Macro/bufr.cc                                  |    5 +
 src/Macro/extern.cc                                |    7 +-
 src/Macro/grib.cc                                  |  190 +++-
 src/Macro/include/macro.h                          |    2 -
 src/Macro/include/value.h                          |   57 +-
 src/Macro/main.cc                                  |   51 +-
 src/Macro/misc.cc                                  |   25 +-
 src/Macro/mlist.cc                                 |  104 +-
 src/Macro/mvector.cc                               |  195 +++-
 src/Macro/request.cc                               |   22 +-
 src/Macro/value.cc                                 |    6 +-
 src/MacroEditor/FindTextDialog.cc                  |    9 +
 src/MacroEditor/FindTextDialog.h                   |    1 +
 src/MacroEditor/FindTextDialog.ui                  |    2 +-
 src/MacroEditor/MacroEdit.cc                       |   31 +-
 src/MacroEditor/MacroEdit.h                        |    5 +
 src/MacroEditor/ShellHelper.cc                     |    2 +-
 src/Meteogram/CMakeLists.txt                       |   10 -
 src/Meteogram/MetPlus.cc                           |   42 +-
 src/Meteogram/MetPlusDef                           |   12 +-
 src/Meteogram/ObjectSpec.Meteogram                 |    2 +-
 src/MvApp/geo_to_grib.cc                           |  154 ++-
 src/ObsFilter/BufrPicker.cc                        |    2 +-
 src/ObsFilter/ObsFilter.cc                         |    2 +-
 src/OdbExaminer/OdbExaminer.cc                     |    9 +-
 src/OgcClient/MvQOgcParam.h                        |    2 +
 src/OgcClient/MvQOgcRequest.h                      |    2 +
 src/OgcClient/MvQWmsClient.cc                      |   12 +-
 src/Percentile/Percentile.cc                       |    2 +-
 src/Scm/ObjectSpec.Scm                             |    3 +-
 src/Stations/CMakeLists.txt                        |    3 +-
 src/Stations/stat.fmt                              | 1118 +++++++++++---------
 src/Thermo/BufrThermo.cc                           |  107 +-
 src/Thermo/GribThermo.cc                           |   58 +-
 src/Thermo/MTHERMOGRIDDef                          |    2 +-
 src/Thermo/MThermoDef                              |    2 +-
 src/Thermo/Thermo.cc                               |   26 +
 src/Thermo/Thermo.h                                |    4 +
 src/Thermo/ThermoDataDef                           |    1 +
 src/XSection/Average.cc                            |   38 +-
 src/XSection/CrossS.cc                             |   27 +-
 src/XSection/MVProfileDef                          |    8 +-
 src/XSection/MVProfileRules                        |    6 +-
 src/XSection/MVProfileViewDef                      |   10 +-
 src/XSection/MVProfileViewRules                    |    4 +-
 src/XSection/MXAverageDef                          |    2 +-
 src/XSection/MXAverageViewDef                      |   14 +-
 src/XSection/MXSectionViewDef                      |    8 +-
 src/XSection/VertProfDef                           |    8 +-
 src/XSection/VertProfRules                         |    4 +-
 src/XSection/VertProfViewDef                       |    8 +-
 src/XSection/VertProfViewRules                     |    4 +-
 src/XSection/Vprofile.cc                           |   41 +-
 src/XSection/Xsect.cc                              |   28 +-
 src/XSection/Xsect.h                               |    4 +
 src/libFTimeUtil/CMakeLists.txt                    |    1 +
 src/libMars/CMakeLists.txt                         |    2 +-
 src/libMarsClient/CMakeLists.txt                   |   17 +-
 src/libMarsClient/dhsbase.c                        |  188 +++-
 src/libMarsClient/environ.c                        |    2 +-
 src/libMarsClient/expand.c                         |   10 +-
 src/libMarsClient/nfdbbase.c                       |   44 +-
 src/libMarsClient/request.c                        |   29 +-
 src/libMarsClient/rpcmars.x                        |    4 +-
 src/libMarsClient/tools.c                          |   19 +-
 src/libMetview/CMakeLists.txt                      |    1 +
 src/libMetview/MvFieldSet.cc                       |    2 +-
 src/libMetview/MvGrid.cc                           |    7 +-
 src/libMetview/MvGrid.h                            |    1 +
 src/libMetview/MvObs.cc                            |    1 +
 src/libMetview/MvObsSet.cc                         |  134 +--
 src/libMetview/MvRequest.cc                        |  176 ++-
 src/libMetview/MvRequest.h                         |    7 +-
 src/libMetview/MvScanFileType.cc                   |   28 +-
 src/libMvMotif/CMakeLists.txt                      |    1 +
 src/libMvNetCDF/CMakeLists.txt                     |    1 +
 src/libMvQtGui/CMakeLists.txt                      |    1 +
 src/libMvQtGui/MvQAbout.cc                         |   14 +-
 src/libMvQtGui/MvQAbout.h                          |    3 +-
 src/libMvQtGui/MvQAbstractMessageExaminer.cc       |    1 -
 src/libMvQtGui/MvQCheckBoxCombo.cc                 |    2 +-
 src/libMvQtGui/MvQFileInfoLabel.cc                 |  218 ++--
 src/libMvQtGui/MvQKeyDialog.cc                     |    4 -
 src/libMvQtGui/MvQKeyProfileTree.cc                |    2 +-
 src/libMvQtUtil/CMakeLists.txt                     |    2 +
 src/libMvQtUtil/MvQFileInfo.cc                     |   61 ++
 src/libMvQtUtil/MvQFileInfo.h                      |   33 +
 src/libUtil/CMakeLists.txt                         |    9 +-
 src/libUtil/Grib.cc                                |    4 +-
 src/libUtil/MvAlmostObsoleteRequest.cc             |   10 +-
 src/libUtil/MvFileInfo.cc                          |  113 --
 src/libUtil/MvFileInfo.h                           |   42 -
 src/libUtil/MvFlextra.cc                           |    2 +-
 src/libUtil/MvMiscelaneous.cc                      |    8 +-
 src/libUtil/MvNetwork.cc                           |  249 +++++
 src/libUtil/MvNetwork.h                            |   69 ++
 src/libUtil/MvOdb.cc                               |    1 -
 src/libUtil/MvPath.cc                              |  118 ++-
 src/libUtil/MvPath.hpp                             |    4 +-
 src/libUtil/TableReader.cc                         |   23 +-
 src/libUtil/TableReader.h                          |   22 +-
 src/libUtil/proj_braz.cc                           |   46 +-
 src/libUtil/proj_braz.hpp                          |    2 +-
 src/uPlot/AverageView.cc                           |   27 +-
 src/uPlot/AverageView.h                            |    3 +
 src/uPlot/CMakeLists.txt                           |    2 +-
 src/uPlot/CommonXSectView.cc                       |   62 +-
 src/uPlot/CommonXSectView.h                        |    5 +-
 src/uPlot/HovmoellerView.cc                        |  405 ++++---
 src/uPlot/HovmoellerView.h                         |   21 +-
 src/uPlot/MacroConverter.cc                        |   92 +-
 src/uPlot/MagPlusBatchService.cc                   |   12 +-
 src/uPlot/MagicsTranslator.cc                      |    6 +
 src/uPlot/MapView.cc                               |   16 +-
 src/uPlot/MatchingCriteria.cc                      |   34 +-
 src/uPlot/MatchingCriteria.h                       |   10 +-
 src/uPlot/MvGribDecoder.cc                         |   56 +-
 src/uPlot/MvIconDataBase.cc                        |   62 +-
 src/uPlot/MvMain.cc                                |  234 ++--
 src/uPlot/MvQLayerContentsIcon.cc                  |    2 +-
 src/uPlot/ObjectInfo.cc                            |  122 +--
 src/uPlot/ObjectList.cc                            |   50 +-
 src/uPlot/ObjectList.h                             |    2 +-
 src/uPlot/Presentable.cc                           |   45 +-
 src/uPlot/ThermoView.cc                            |   59 +-
 src/uPlot/VertProfView.cc                          |   70 +-
 src/uPlot/VertProfView.h                           |    3 +
 src/uPlot/XSectView.cc                             |   21 +-
 src/uPlot/XSectView.h                              |    4 +
 src/uPlot/uPlotBase.cc                             |   13 +-
 test/data/fc_data.grib                             |  Bin 0 -> 480 bytes
 test/data/gpt_to_grib_exp_mean_reference.grb       |  Bin 0 -> 3240 bytes
 test/data/gpt_to_grib_exp_sum_reference.grb        |  Bin 0 -> 3240 bytes
 test/data/gpt_to_grib_nearest_count_reference.grb  |  Bin 0 -> 3240 bytes
 test/data/gpt_to_grib_nearest_mean_reference.grb   |  Bin 0 -> 360 bytes
 test/data/gpt_to_grib_nearest_sum_reference.grb    |  Bin 0 -> 360 bytes
 test/data/gpt_to_grib_reciprocal_reference.grb     |  Bin 0 -> 3240 bytes
 test/data/hindcast.grib                            |  Bin 0 -> 9360 bytes
 test/data/odb_test_set.odb                         |  Bin 0 -> 13297 bytes
 test/data/t1000_LL_7x7.grb                         |  Bin 0 -> 1560 bytes
 test/macros/CMakeLists.txt                         |   29 +
 test/macros/HelloWorld.mv                          |    3 +-
 test/macros/fieldsets.mv                           |   51 +
 test/macros/gpt_to_grib_core.mv                    |   59 ++
 test/macros/gpt_to_grib_nearest.mv                 |   74 ++
 test/macros/grib_dates.mv                          |   79 ++
 test/macros/layoutx3.mv                            |    7 +-
 test/macros/lists.mv                               |   36 +
 test/macros/odb_read.mv                            |   53 +
 test/macros/plot_coast_order.mv                    |    1 -
 test/macros/set_output.mv                          |    4 +-
 test/macros/vectors.mv                             |   78 ++
 495 files changed, 11226 insertions(+), 5070 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 006d9b8..8431d1a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,7 @@
 #  -DLOG_DIR=/path/to/dir/for/module/log/files
 #  -DODB1_USE_SCRIPT_PATH=/path/to/odb1/use/script
 
-cmake_minimum_required( VERSION 2.8.4 FATAL_ERROR )
+cmake_minimum_required( VERSION 2.8.11 FATAL_ERROR )
 
 project( metview C CXX Fortran)
 
@@ -62,6 +62,7 @@ option( ENABLE_USAGE_LOG     "enable usage logging (only at ECMWF)"
 option( ENABLE_QT_DEBUG      "enable Qt debugging messages"                       OFF )
 option( ENABLE_QT5           "enable Qt5"                                         OFF )
 option( ENABLE_INPE          "enable INPE modules"                                ON )
+option( ENABLE_URL_DOWNLOAD  "enable downloading of files from URLs"              ON )
 option( ENABLE_WEATHER_ROOM  "enable Weather Room plot export (only at ECMWF)"    OFF )
 option( ENABLE_NETWORK_PROXY "enable network proxy settings for WMS"              OFF )
 option( ENABLE_EXPERIMENTAL  "enable experimental modules"                        OFF )
@@ -82,18 +83,18 @@ if(NOT METVIEW_SITE STREQUAL ecmwf)
     set( SITE_WMO_CODE "255")    # DO WE NEED AN OPTION TO ALLOW INSTALLERS TO SPECIFY THIS?
     set( MV_ENVIRON    "common")
     set( AT_ECMWF "FALSE" )
-    message("Building outside ECMWF")
+    ecbuild_info("Building outside ECMWF")
 else()
     set( SITE_WMO_CODE "098")
     set( MV_ENVIRON    "ecm_lnx64")
     set( AT_ECMWF "TRUE" )
     add_definitions( -DECMWF )
-    message("Building inside ECMWF")
+    ecbuild_info("Building inside ECMWF")
 endif()
 
 
 if(DEFINED EXTRA_CONFIG_PATH)
-    message(STATUS "Will search ${EXTRA_CONFIG_PATH} for additional config files")
+    ecbuild_info("Will search ${EXTRA_CONFIG_PATH} for additional config files")
 endif()
 
 
@@ -116,7 +117,7 @@ if(ENABLE_WEATHER_ROOM)
         find_package( Boost 1.49.0 )            # Weather Room export needs Boost
         set(MV_WEATHER_ROOM_BUILT true)
     else()
-        message(WARNING "ENABLE_WEATHER_ROOM only available when building at ECMWF")
+        ecbuild_error("ENABLE_WEATHER_ROOM only available when building at ECMWF")
     endif()
 else()
     set(MV_WEATHER_ROOM_BUILT false)
@@ -154,9 +155,9 @@ find_path( MARS_SOURCE request.c
            NO_DEFAULT_PATH )
 
 if (MARS_SOURCE)
-    message(STATUS "Found MARS source at ${MARS_SOURCE}")
+    ecbuild_info("Found MARS source at ${MARS_SOURCE}")
 else()
-    message(FATAL_ERROR "MARS source is required, but was not found in " ${MARS_SOURCE_PATHS})
+    ecbuild_critical("MARS source is required, but was not found in  ${MARS_SOURCE_PATHS}")
 endif()
 
 
@@ -176,23 +177,37 @@ if(ENABLE_MARS)
     set( MARS_ACCESS MARS_local )
     set( METVIEW_MARS 1 )
     if(DEFINED MARS_LOCAL_HOME)
-        message(STATUS "MARS_LOCAL_HOME=${MARS_LOCAL_HOME}")
+        ecbuild_info("MARS_LOCAL_HOME=${MARS_LOCAL_HOME}")
         if(NOT EXISTS ${MARS_LOCAL_HOME})
-            message(FATAL_ERROR "MARS_LOCAL_HOME (${MARS_LOCAL_HOME}) does not exist")
+            ecbuild_critical("MARS_LOCAL_HOME (${MARS_LOCAL_HOME}) does not exist")
         else()
             set(MARS_HOME ${MARS_LOCAL_HOME})
         endif()
     else()
-        message(FATAL_ERROR "If setting local MARS access, -DMARS_LOCAL_HOME=/path/to/mars/home must be provided.")
+        ecbuild_critical("If setting local MARS access, -DMARS_LOCAL_HOME=/path/to/mars/home must be provided.")
     endif()
 
+    # FDB
+    if(AT_ECMWF)
+        ecbuild_use_package( PROJECT FDB REQUIRED )
+    else()
+        ecbuild_use_package( PROJECT FDB )
+    endif()
+
+    ecbuild_debug("FDB: ${FDB_LIBRARIES}")
+
+    if( NOT FDB_FOUND )
+        ecbuild_info("NO FDB")
+    endif()
+
+
     if(ENABLE_MARS_ODB)
         set(ENABLE_ODB 1)
         set(METVIEW_MARS_ODB 1)
     endif()
 
     #find_library( FDB  REQUIRED )
-    #message(STATUS "FDB: ${FDB_LIBRARIES}" )
+    #ecbuild_debug("FDB: ${FDB_LIBRARIES}" )
 
 else()
     if(${CURL_FOUND})
@@ -200,22 +215,18 @@ else()
     else()
         set( MARS_ACCESS MARS_none )
         add_definitions(-DNOCURL)
-        message(STATUS "Could not find the Curl library - disabling Web API Mars")
+        ecbuild_warn("Could not find the Curl library - disabling Web API Mars")
     endif()
 endif()
 
 
-if(AT_ECMWF)
-    ecbuild_use_package( PROJECT FDB REQUIRED )
-else()
-    ecbuild_use_package( PROJECT FDB )
+# Network access (download via URLs)
+if(ENABLE_URL_DOWNLOAD)
+    if(NOT CURL_FOUND)
+        ecbuild_critical("URL_DOWNLOAD was enabled, but the 'curl' development package was not found.")
+    endif()
 endif()
 
-message(STATUS "FDB: ${FDB_LIBRARIES}" )
-
-if( NOT FDB_FOUND )
-    message(STATUS "NO FDB" )
-endif()
 
 
 
@@ -224,7 +235,19 @@ endif()
 
 # ecbuild_use_package( PROJECT eckit VERSION 0.3 REQUIRED )
 
-ecbuild_use_package( PROJECT grib_api VERSION 1.13.0 REQUIRED )
+ecbuild_add_option( FEATURE ECCODES DESCRIPTION "" DEFAULT ON )
+
+if( HAVE_ECCODES )
+  ecbuild_use_package( PROJECT eccodes VERSION 0.14 REQUIRED )
+  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} )
+  add_definitions(-DGRIB_HANDLING_PACKAGE=ecCodes)
+else()
+  ecbuild_use_package( PROJECT grib_api VERSION 1.13.0 REQUIRED )
+  add_definitions(-DGRIB_HANDLING_PACKAGE=GRIB_API)
+endif()
 
 
 if(ENABLE_ODB)
@@ -259,8 +282,7 @@ if(ENABLE_ODB)
                                          ${ECKIT_INCLUDE_DIRS}) 
     else()
         if(ENABLE_MARS_ODB)
-            message(FATAL_ERROR "ENABLE_ODB was set, but ODB not found")
-#            message(FATAL_ERROR "ENABLE_MARS_ODB was set, but ODB not found")
+            ecbuild_critical("ENABLE_ODB was set, but ODB not found")
             set(ENABLE_MARS_ODB 0)
             set(METVIEW_MARS_ODB 0)
         endif()
@@ -293,13 +315,13 @@ if(ENABLE_ODB)
                 endif()
 
             else()
-                message(WARNING "ODB-1 support is DISABLED - No odbsql script found in ${ODB_PATH}/bin")
+                ecbuild_warn("ODB-1 support is DISABLED - No odbsql script found in ${ODB_PATH}/bin")
             endif()
         else()
-            message(WARNING "ODB-1 found, but no bin directory in ${ODB_PATH}")
+            ecbuild_warn("ODB-1 found, but no bin directory in ${ODB_PATH}")
         endif()
     else()
-        message(WARNING "ODB-1 not found!")
+        ecbuild_warn("ODB-1 not found!")
     endif()
 endif()
 
@@ -307,43 +329,47 @@ endif()
 ecbuild_use_package( PROJECT libemos VERSION 4.0.5 REQUIRED )
 
 if(ENABLE_PLOTTING)
-    ecbuild_use_package( PROJECT magics VERSION 2.24.3)
+    ecbuild_use_package( PROJECT magics VERSION 2.24.4)
     if( MAGICS_FOUND )
 
         set(MAGICS_LIB_DIR "${magics_BASE_DIR}/lib")
 
-        if(NOT MAGICS_HAVE_METVIEW)
-            message(FATAL_ERROR "Magics must be built with Metview support!")
+        if(ENABLE_UI AND (NOT MAGICS_HAVE_METVIEW))
+            ecbuild_critical("Magics must be built with Metview and Qt support!")
+        endif()
+
+        if((NOT ENABLE_UI) AND (NOT MAGICS_HAVE_METVIEW_NO_QT))
+            ecbuild_critical("No UI: Magics must be built with Metview but no Qt support!")
         endif()
 
         if(NOT MAGICS_HAVE_NETCDF)
-            message(FATAL_ERROR "Magics must be built with netCDF support!")
+            ecbuild_critical("Magics must be built with netCDF support!")
         endif()
 
         if(MAGICS_HAVE_ODB)
             add_definitions(-DMETVIEW_ODB_PLOT)
         else()
             if(ENABLE_ODB)
-                message(STATUS "ODB plotting is disabled, because Magics was built without ODB support! Please, rebuild Magics with ODB support to enable ODB plotting!")  #xxx should be at end
+                ecbuild_warn("ODB plotting is disabled, because Magics was built without ODB support! Please, rebuild Magics with ODB support to enable ODB plotting!")  #xxx should be at end
             endif()
         endif()
 
         if(NOT MAGICS_HAVE_CAIRO)
-            message(STATUS "NO PNG and PDF plotting support (disabled in Magics)")  #xxx should be at end
+            ecbuild_warn("NO PNG and PDF plotting support (disabled in Magics)")  #xxx should be at end
         endif()
 
         if(NOT MAGICS_HAVE_BUFR)
-            message(STATUS "NO BUFR plotting support (disabled in Magics)")  #xxx should be at end
+            ecbuild_warn("NO BUFR plotting support (disabled in Magics)")  #xxx should be at end
         endif()
 
     else()
-        message(FATAL_ERROR "Magics was not found, and it is required if ENABLE_PLOTTING=ON. Please supply MAGICS_PATH if necessary.")
+        ecbuild_critical("Magics was not found, and it is required if ENABLE_PLOTTING=ON. Please supply MAGICS_PATH if necessary.")
     endif()
 endif()
 
 
 ecbuild_declare_project()
-message(STATUS "VERSION: ${METVIEW_VERSION_STR}")
+ecbuild_debug("VERSION: ${METVIEW_VERSION_STR}")
 
 ###############################################################################
 # Find external dependencies
@@ -362,7 +388,7 @@ message(STATUS "VERSION: ${METVIEW_VERSION_STR}")
 if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
     find_library(QUADMATH_LIB quadmath)
     if(QUADMATH_LIB)
-        message(STATUS "quadmath found: ${QUADMATH_LIB}")
+        ecbuild_debug("quadmath found: ${QUADMATH_LIB}")
         list( APPEND METVIEW_EXTRA_LIBRARIES ${QUADMATH_LIB} )
     else()
         # sometimes CMake does not properly detect libquadmath
@@ -376,9 +402,9 @@ endif()
 
 find_library(PTHREAD_LIB pthread)
 if(PTHREAD_LIB)
-    message(STATUS "pthread found: ${PTHREAD_LIB}")
+    ecbuild_debug("pthread found: ${PTHREAD_LIB}")
 else()
-    message(FATAL_ERROR "library pthread not found")
+    ecbuild_critical("library pthread not found")
 endif()
 
 
@@ -389,14 +415,14 @@ if(NOT (ENABLE_OPERA_RADAR STREQUAL "OFF"))
 
     if(NOT DEFINED PROJ4_FOUND)
         if(ENABLE_OPERA_RADAR STREQUAL "ON") # user wanted library, but it could not be found
-            message(FATAL_ERROR "proj4 library not found - it is required for OPERA radar support (or set ENABLE_OPERA_RADAR=OFF)")
+            ecbuild_critical("proj4 library not found - it is required for OPERA radar support (or set ENABLE_OPERA_RADAR=OFF)")
         else()
             set(ENABLE_OPERA_RADAR "OFF")    # not found, but setting=AUTO so just set it to OFF
         endif()
     else()
         set(ENABLE_OPERA_RADAR "ON")
-        message(STATUS "OPERA Radar enabled - proj 4 include: ${PROJ4_INCLUDE_DIRS}")
-        message(STATUS "OPERA Radar enabled - proj 4 lib:     ${PROJ4_LIBRARIES}")
+        ecbuild_debug("OPERA Radar enabled - proj 4 include: ${PROJ4_INCLUDE_DIRS}")
+        ecbuild_debug("OPERA Radar enabled - proj 4 lib:     ${PROJ4_LIBRARIES}")
     endif()
 
 endif()
@@ -408,7 +434,7 @@ if(DEFINED FLEXTRA_PATH)
     if(EXISTS ${FLEXTRA_PATH})
         set(MV_FLEXTRA_PATH_SET "MV_FLEXTRA_EXE=${FLEXTRA_PATH}")
     else()
-        message(FATAL_ERROR "FLEXTRA_PATH: (${FLEXTRA_PATH}) does not exist")
+        ecbuild_critical("FLEXTRA_PATH: (${FLEXTRA_PATH}) does not exist")
     endif()
 endif()
 
@@ -418,15 +444,15 @@ endif()
 
 if(ENABLE_NETWORK_PROXY)
     if(NOT DEFINED PROXY_URL)
-        message(FATAL_ERROR "ENABLE_NETWORK_PROXY is ON but PROXY_URL is not defined")
+        ecbuild_critical("ENABLE_NETWORK_PROXY is ON but PROXY_URL is not defined")
     endif()
 
     if(NOT DEFINED PROXY_PORT)
-        message(FATAL_ERROR "ENABLE_NETWORK_PROXY is ON but PROXY_PORT is not defined")
+        ecbuild_critical("ENABLE_NETWORK_PROXY is ON but PROXY_PORT is not defined")
     endif()
 
     if(NOT DEFINED NO_PROXY_FOR)
-        message(FATAL_ERROR "ENABLE_NETWORK_PROXY is ON but NO_PROXY_FOR is not defined")
+        ecbuild_critical("ENABLE_NETWORK_PROXY is ON but NO_PROXY_FOR is not defined")
     endif()
 
     set(USE_NETWORK_PROXY YES)
@@ -452,15 +478,18 @@ find_package( NetCDF 4 COMPONENTS CXX)
 if( NETCDF_FOUND )
     list( APPEND METVIEW_TPLS  NetCDF )
 else()
-    message(FATAL_ERROR "NetCDF was not found")
+    ecbuild_critical("NetCDF was not found")
 endif()
 
 
 find_library(GDBM_LIB gdbm )
-if(GDBM_LIB)
-    message(STATUS "gdbm found: ${GDBM_LIB}")
+find_path( GDBM_INCLUDE gdbm.h )
+if(GDBM_LIB AND GDBM_INCLUDE)
+    ecbuild_debug("gdbm found")
+    ecbuild_debug("  library: ${GDBM_LIB}")
+    ecbuild_debug("  include: ${GDBM_INCLUDE}")
 else()
-    message(FATAL_ERROR "library gdbm not found")
+    ecbuild_critical("library gdbm not found")
 endif()
 
 
@@ -469,15 +498,16 @@ if( ENABLE_UI )
  if( ENABLE_QT5 )
 
       if( ENABLE_MOTIF )
-        message(FATAL_ERROR "Metview does not support the Motif user interface with Qt5. Please set ENABLE_MOTIF=OFF in the CMake arguments")
+        ecbuild_critical("Metview does not support the Motif user interface with Qt5. Please set ENABLE_MOTIF=OFF in the CMake arguments")
       endif()
 
-      find_package(Qt5Widgets REQUIRED)
-      find_package(Qt5Gui REQUIRED)
-      find_package(Qt5Network REQUIRED)
-      find_package(Qt5Xml REQUIRED)
-      find_package(Qt5XmlPatterns REQUIRED)
+      find_package(Qt5Widgets      REQUIRED)
+      find_package(Qt5Gui          REQUIRED)
+      find_package(Qt5Network      REQUIRED)
+      find_package(Qt5Xml          REQUIRED)
+      find_package(Qt5XmlPatterns  REQUIRED)
       find_package(Qt5PrintSupport REQUIRED)
+      find_package(Qt5Svg          REQUIRED)
 
       #if( ENABLE_MOTIF )
         #find_package(Qt5X11Extras REQUIRED)
@@ -487,21 +517,21 @@ if( ENABLE_UI )
       #endif()
 
       if( Qt5Widgets_FOUND )
-          message(STATUS "Qt5 version ${Qt5Widgets_VERSION_STRING} was found")
+          ecbuild_debug("Qt5 version ${Qt5Widgets_VERSION_STRING} was found")
           include_directories(${Qt5Widgets_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS} ${Qt5XmlPatterns_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ${Qt5PrintSupport_INCLUDE_DIRS})
           set( METVIEW_QT 1)
           set( METVIEW_QT5 true)
           add_definitions( -DMETVIEW_QT5 )
       else()
-          message(FATAL_ERROR "Qt5 was NOT found ...")
+          ecbuild_critical("Qt5 was NOT found ...")
       endif()
   else( ENABLE_QT5 )
-    find_package(Qt4 4.6.2 REQUIRED QtCore QtNetwork QtGui QtXml QtXmlPatterns) #  QtWebKit QtHelp
+    find_package(Qt4 4.6.2 REQUIRED QtCore QtNetwork QtGui QtXml QtXmlPatterns QtSvg) #  QtWebKit QtHelp
     if( QT_FOUND )
         include( ${QT_USE_FILE} )
         set( METVIEW_QT 1)
     else()
-        message(FATAL_ERROR "Qt not found - this is required for the user interface")
+        ecbuild_critical("Qt not found - this is required for the user interface")
     endif()
   endif( ENABLE_QT5 )
 
@@ -509,8 +539,8 @@ if( ENABLE_UI )
     if( ENABLE_MOTIF )
       find_package(Motif REQUIRED)
       if(MOTIF_FOUND)
-        message(STATUS "MOTIF_INCLUDE_DIR: " ${MOTIF_INCLUDE_DIR})
-        message(STATUS "MOTIF_LIBRARIES: "   ${MOTIF_LIBRARIES})
+        ecbuild_debug("MOTIF_INCLUDE_DIR:  ${MOTIF_INCLUDE_DIR}")
+        ecbuild_debug("MOTIF_LIBRARIES:    ${MOTIF_LIBRARIES}")
       endif()
       add_definitions( -DMETVIEW_MOTIF )
     endif()
@@ -518,39 +548,39 @@ if( ENABLE_UI )
     find_package(X11 REQUIRED)
     if(X11_FOUND)
         # hack? we want to use the R6 version if available
-        message(STATUS "X11_INCLUDE_DIR: " ${X11_INCLUDE_DIR})
+        ecbuild_debug("X11_INCLUDE_DIR:  ${X11_INCLUDE_DIR}")
         set(X11_INCLUDE_DIR "/usr/X11R6/include;\;${X11_INCLUDE_DIR}")
-        message(STATUS "X11_INCLUDE_DIR: " ${X11_INCLUDE_DIR})
-        message(STATUS "X11_LIBRARIES: "   ${X11_LIBRARIES})
+        ecbuild_debug("X11_INCLUDE_DIR:  ${X11_INCLUDE_DIR}")
+        ecbuild_debug("X11_LIBRARIES:    ${X11_LIBRARIES}")
         if(X11_Xpm_FOUND)
-            message(STATUS "  X11_Xpm_INCLUDE_PATH: " ${X11_Xpm_INCLUDE_PATH})
-            message(STATUS "  X11_Xpm_LIB: "          ${X11_Xpm_LIB} " (adding to X11_LIBRARIES)")
+            ecbuild_debug("  X11_Xpm_INCLUDE_PATH:  ${X11_Xpm_INCLUDE_PATH}")
+            ecbuild_debug("  X11_Xpm_LIB:           ${X11_Xpm_LIB}  (adding to X11_LIBRARIES)")
             list(APPEND X11_INCLUDE_DIR ${X11_Xpm_INCLUDE_PATH})
             list(APPEND X11_LIBRARIES   ${X11_Xpm_LIB})
         endif()
 
         # some platforms (e.g. openSUSE 13.1) also require libXt in the link command
         if(X11_Xt_FOUND)
-            message(STATUS "  X11_Xt_INCLUDE_PATH: " ${X11_Xt_INCLUDE_PATH})
-            message(STATUS "  X11_Xt_LIB: "          ${X11_Xt_LIB} " (adding to X11_LIBRARIES)")
+            ecbuild_debug("  X11_Xt_INCLUDE_PATH:  ${X11_Xt_INCLUDE_PATH}")
+            ecbuild_debug("  X11_Xt_LIB:           ${X11_Xt_LIB}  (adding to X11_LIBRARIES)")
             list(APPEND X11_INCLUDE_DIR ${X11_Xt_INCLUDE_PATH})
             list(APPEND X11_LIBRARIES   ${X11_Xt_LIB})
         else()
-            message(STATUS "NO X11 Xt found!!!!!!!")
+            ecbuild_warn("NO X11 Xt found!!!!!!!")
         endif()
    
         # some platforms (e.g. openSUSE 13.1) also require libXmu in the link command
         if(X11_Xmu_FOUND)
-            message(STATUS "  X11_Xmu_INCLUDE_PATH: " ${X11_Xmu_INCLUDE_PATH})
-            message(STATUS "  X11_Xmu_LIB: "          ${X11_Xmu_LIB} " (adding to X11_LIBRARIES)")
+            ecbuild_debug("  X11_Xmu_INCLUDE_PATH:  ${X11_Xmu_INCLUDE_PATH}")
+            ecbuild_debug("  X11_Xmu_LIB:           ${X11_Xmu_LIB}  (adding to X11_LIBRARIES)")
             list(APPEND X11_INCLUDE_DIR ${X11_Xmu_INCLUDE_PATH})
             list(APPEND X11_LIBRARIES   ${X11_Xmu_LIB})
         else()
-            message(STATUS "NO X11 Xmu found!!!!!!!")
+            ecbuild_warn("NO X11 Xmu found!!!!!!!")
         endif()
 
     else()
-        message(STATUS "X11 NOT FOUND")
+        ecbuild_warn("X11 NOT FOUND")
     endif()
 
     set( METVIEW_GUI_BUILT true )
@@ -608,7 +638,7 @@ foreach( _tpl ${METVIEW_TPLS} )
     list( APPEND METVIEW_EXTRA_DEFINITIONS   ${${TPL}_DEFINITIONS}  )
     list( APPEND METVIEW_EXTRA_INCLUDE_DIRS  ${${TPL}_INCLUDE_DIRS} )
     list( APPEND METVIEW_EXTRA_LIBRARIES     ${${TPL}_LIBRARIES} )
-    message(STATUS "xTPL_LIBRARIES: ${TPL}_LIBRARIES")
+    ecbuild_debug("xTPL_LIBRARIES: ${TPL}_LIBRARIES")
 endforeach()
 
 
@@ -625,11 +655,11 @@ endif()
 endif()
 
 
-message(STATUS "METVIEW_EXTRA_DEFINITIONS  => ${METVIEW_EXTRA_DEFINITIONS}")
-message(STATUS "METVIEW_EXTRA_INCLUDE_DIRS => ${METVIEW_EXTRA_INCLUDE_DIRS}")
-message(STATUS "METVIEW_EXTRA_LIBRARIES    => ${METVIEW_EXTRA_LIBRARIES}")
-message(STATUS "STANDARD_METVIEW_LIBS      => ${STANDARD_METVIEW_LIBS}")
-message(STATUS "LIBEMOS_LIBRARIES          => ${LIBEMOS_LIBRARIES}")
+ecbuild_info("METVIEW_EXTRA_DEFINITIONS  => ${METVIEW_EXTRA_DEFINITIONS}")
+ecbuild_info("METVIEW_EXTRA_INCLUDE_DIRS => ${METVIEW_EXTRA_INCLUDE_DIRS}")
+ecbuild_info("METVIEW_EXTRA_LIBRARIES    => ${METVIEW_EXTRA_LIBRARIES}")
+ecbuild_info("STANDARD_METVIEW_LIBS      => ${STANDARD_METVIEW_LIBS}")
+ecbuild_info("LIBEMOS_LIBRARIES          => ${LIBEMOS_LIBRARIES}")
 
 
 ###get_directory_property( MAGICS_DEFINITIONS COMPILE_DEFINITIONS )
@@ -640,7 +670,7 @@ message(STATUS "LIBEMOS_LIBRARIES          => ${LIBEMOS_LIBRARIES}")
 ###include_directories( ${METVIEW_INCLUDE_DIRS} ${METVIEW_EXTRA_INCLUDE_DIRS} )
 set(METVIEW_STANDARD_INCLUDES ${METVIEW_STANDARD_INCLUDE_DIRS} ${METVIEW_EXTRA_INCLUDE_DIRS} )
 link_directories( ${CMAKE_CURRENT_SOURCE_DIR}/lib )
-message(STATUS "METVIEW_STANDARD_INCLUDE_DIRS  => ${METVIEW_STANDARD_INCLUDES}")
+ecbuild_info("METVIEW_STANDARD_INCLUDE_DIRS  => ${METVIEW_STANDARD_INCLUDES}")
 
 
 set(  __metview_inc_tmp ${METVIEW_EXTRA_INCLUDE_DIRS} )
@@ -718,9 +748,7 @@ macro(metview_module_files)
     set(multi_value_args ETC_FILES XPM_FILES SVG_FILES)
     cmake_parse_arguments( PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
 
-    #message(STATUS "bbb ${PAR_ETC_FILES} ccc")
     foreach( etc ${PAR_ETC_FILES} )
-        #message(STATUS "a ${etc}")
         # copy to the build 'etc' directory
         configure_file(${etc} ${CMAKE_BINARY_DIR}/share/metview/etc/ COPYONLY)
 
@@ -736,18 +764,14 @@ macro(metview_module_files)
         if(${etc} MATCHES ObjectSpec*)
             set(ModuleObjectSpecFiles ${ModuleObjectSpecFiles} ${CMAKE_BINARY_DIR}/share/metview/etc/${etc})
             set(ModuleObjectSpecFiles ${ModuleObjectSpecFiles} PARENT_SCOPE) # make it visible outside
-            #message(STATUS "MOSF: ${ModuleObjectSpecFiles} ${etc}")
         endif()
 
     endforeach()
 
-    #message(STATUS "eeee ${PAR_XPM_FILES} ffff")
     foreach( xpm ${PAR_XPM_FILES} )
-        #message(STATUS "g ${xpm}")
         # copy to the build 'etc' directory
         set(ModuleXpmFiles ${ModuleXpmFiles} ${CMAKE_CURRENT_SOURCE_DIR}/${xpm})
         set(ModuleXpmFiles ${ModuleXpmFiles}  PARENT_SCOPE)
-        #message(STATUS "xpm: ${xpm}")
 
         #configure_file(${xpm} ${CMAKE_BINARY_DIR}/share/metview/icons/ COPYONLY)
 
@@ -794,7 +818,7 @@ macro(metview_script_files)
                          ${CMAKE_SOURCE_DIR}/../metview-ecmwf-configs )
 
         if( NOT SCRIPT_${script} )
-          message( FATAL_ERROR "Could not find script ${script}. Specify the path to the script with -DEXTRA_CONFIG_PATH=..." )
+          ecbuild_critical( "Could not find script ${script}. Specify the path to the script with -DEXTRA_CONFIG_PATH=...")
         else()
           ecbuild_debug("metview_script_files: found ${script} at ${SCRIPT_${script}}")
         endif()
@@ -910,7 +934,7 @@ ecbuild_dont_pack(FILES "share/metview/grib_seed" )
 #list( APPEND ECBUILD_DONT_PACK_FILES "${CMAKE_SOURCE_DIR}/src/Traj" )
 #list( APPEND ECBUILD_DONT_PACK_FILES "${CMAKE_SOURCE_DIR}/share/metview/grib_seed" )
 
-#message(STATUS "NOPACK: ${ECBUILD_DONT_PACK_FILES}")
+#ecbuild_debug("NOPACK: ${ECBUILD_DONT_PACK_FILES}")
 
 #CPACK_SOURCE_IGNORE_FILES
 
@@ -923,7 +947,7 @@ ecbuild_dont_pack(FILES "share/metview/grib_seed" )
 # print all variables
 #get_cmake_property(_variableNames VARIABLES)
 #foreach (_variableName ${_variableNames})
-#    message(STATUS "${_variableName}=${${_variableName}}")
+#    ecbuild_debug("${_variableName}=${${_variableName}}")
 #endforeach()
 
 
diff --git a/INSTALL b/INSTALL
index ab6b82e..5b193bd 100644
--- a/INSTALL
+++ b/INSTALL
@@ -4,7 +4,7 @@ Metview - ECMWF meteorological workstation software
 
 Installation and usage instructions can be found at:
 
-https://software.ecmwf.int/metview/Installation
+https://software.ecmwf.int/metview/Installation+Guide
 
 =============
 QUICK INSTALL
diff --git a/LICENSE b/LICENSE
index 99a1252..cddea2c 100644
--- a/LICENSE
+++ b/LICENSE
@@ -186,7 +186,7 @@
       same "printed page" as the copyright notice for easier
       identification within third-party archives.
 
-   Copyright 2007-2012 European Centre for Medium-Range Weather Forecasts (ECMWF)
+   Copyright 2007-2016 European Centre for Medium-Range Weather Forecasts (ECMWF)
    and Brazil's Instituto Nacional de Pesquisas Espaciais (INPE)
 
    Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/NOTICE b/NOTICE
index 352227e..df7294e 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,7 +1,7 @@
 Metview
 =======
 
-Copyright 2007-2015 ECMWF and INPE
+Copyright 2007-2016 ECMWF and INPE
 
 This product mainly includes software developed by the
 Development Section at the 
diff --git a/VERSION.cmake b/VERSION.cmake
index 05233b2..71e10d3 100644
--- a/VERSION.cmake
+++ b/VERSION.cmake
@@ -1,5 +1,5 @@
 set(${PROJECT_NAME}_MAJOR_VERSION_STR    "4")
-set(${PROJECT_NAME}_MINOR_VERSION_STR    "6")
-set(${PROJECT_NAME}_REVISION_VERSION_STR "1")
+set(${PROJECT_NAME}_MINOR_VERSION_STR    "8")
+set(${PROJECT_NAME}_REVISION_VERSION_STR "0")
 
 set(${PROJECT_NAME}_VERSION_STR  "${${PROJECT_NAME}_MAJOR_VERSION_STR}.${${PROJECT_NAME}_MINOR_VERSION_STR}.${${PROJECT_NAME}_REVISION_VERSION_STR}")
diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt
index 24a12cf..93cef4e 100644
--- a/bin/CMakeLists.txt
+++ b/bin/CMakeLists.txt
@@ -1,3 +1 @@
-if( ENABLE_INSTALL )
-	install( PROGRAMS ecbuild DESTINATION ${INSTALL_BIN_DIR} )
-endif()
+install( PROGRAMS ecbuild DESTINATION ${INSTALL_BIN_DIR} )
diff --git a/bin/ecbuild b/bin/ecbuild
index b327cde..da2d7b9 100755
--- a/bin/ecbuild
+++ b/bin/ecbuild
@@ -2,8 +2,8 @@
 
 set -eua
 
-CMAKE_MIN_REQUIRED=2.8.10
-CMAKE_BUILD_VERSION=3.2.3
+CMAKE_MIN_REQUIRED=2.8.11
+CMAKE_BUILD_VERSION=3.5.2
 
 usage()
 {
@@ -70,13 +70,13 @@ Available values for "option":
           Build static libraries.
           Equivalent to "-DBUILD_SHARED_LIBS=OFF"
 
-    --dynamic
+    --dynamic, --shared
           Build dynamic libraries (usually the default).
           Equivalent to "-DBUILD_SHARED_LIBS=ON"
 
-    --shared     (same option as --dynamic)
-          Build dynamic libraries (usually the default).
-          Equivalent to "-DBUILD_SHARED_LIBS=ON"
+    --config=<config>
+          Configuration file using CMake syntax that gets included
+          Equivalent to cmake argument "-DECBUILD_CONFIG=<config-file>"
 
     --toolchain=<toolchain>
           Use a platform specific toolchain, containing settings such
@@ -93,10 +93,10 @@ Available values for "option":
           that this is only accelerating fresh builds, as cmake internally
           caches also. Therefore this option is *not* recommended.
 
-    --build-cmake
-          Automatically download and build CMake version $CMAKE_BUILD_VERSION if the CMake
-          version found does not meet the minimum requirements (version $CMAKE_MIN_REQUIRED
-          is required). Requires an internet connection and may take a while.
+    --build-cmake[=<prefix>]
+          Automatically download and build CMake version $CMAKE_BUILD_VERSION.
+          Requires an internet connection and may take a while. If no prefix
+          is given, install into $PWD.
 
     --dryrun
           Don't actually execute the cmake call, just print what would have
@@ -188,7 +188,7 @@ version()
 
 log()
 {
-  log_level=$(sed 's/.*/\U&/' <<< "$1")
+  log_level=$(tr "[a-z]" "[A-Z]" <<< "$1")
   ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DECBUILD_LOG_LEVEL=${log_level}"
 }
 
@@ -213,6 +213,20 @@ prefix()
   ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DCMAKE_INSTALL_PREFIX=${1/#\~\//$HOME/}"
 }
 
+config()
+{
+  arg=${1/#\~\//$HOME/}
+  if [ -f $arg ]; then
+    config_file=$arg
+    config_file="$( cd $( dirname "${config_file}" ) && pwd -P )/$( basename ${config_file} )"
+  else
+    echo "Error:"
+    echo "   Config file [$arg] is not found or is not a file."
+    exit 1
+  fi
+  ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DECBUILD_CONFIG=${config_file}"
+}
+
 toolchain()
 {
   arg=${1/#\~\//$HOME/}
@@ -237,7 +251,8 @@ cache()
 {
   arg=$1
   if [ -f $arg ]; then
-    cache_file=$( cd "$arg" && pwd -P )
+    cache_file=$arg
+    cache_file="$( cd $( dirname "${cache_file}" ) && pwd -P )/$( basename ${cache_file} )"
   else
     echo "Error:"
     echo "   Cache file [$arg] is not found or is not a file."
@@ -260,7 +275,7 @@ while test $# -gt 0; do
     case "$1" in
     --*=*)
       opt=`echo "$1" | sed 's/=.*//'`
-      val=`echo "$1" | sed 's/--[_a-zA-Z0-9]*=//'`
+      val=`echo "$1" | sed 's/--[_a-zA-Z0-9-]*=//'`
       ;;
     --*)
       opt=$1
@@ -313,11 +328,17 @@ while test $# -gt 0; do
       --toolchain)
         toolchain $val
         ;;
+      --config)
+        config $val
+        ;;
       --cache)
         cache $val
         ;;
       --build-cmake)
         build_cmake="yes"
+        if [[ -n $val ]]; then
+          cmake_prefix="$val"
+        fi
         ;;
       --)
         shift
@@ -340,41 +361,25 @@ src=${srcARG:=""}
 cmake=${cmakebin:=cmake}
 dryrun=${dryrun:=no}
 build_cmake=${build_cmake:=""}
+cmake_prefix=${cmake_prefix:=$PWD}
 cmake_found=""
 cmake_version_sufficient=""
 
 
 # Check that version $1 satisfies $2
 # CMake versions have no more than 4 fields
-# (adapted from http://stackoverflow.com/a/25731924/396967)
+# Version sort (sort -V) is not available on all platforms
 version_gte() {
-    [  "$2" = "$(echo -e "$1\n$2" | sort -t '.' -k 1,1 -k 2,2 -k 3,3 -k 4,4 -g | head -n1)" ]
+  [ "$2" = "$(echo -e "$1\n$2" | sort -t '.' -k 1,1 -k 2,2 -k 3,3 -k 4,4 -g | head -n1)" ]
 }
 
-# Check if the cmake version is sufficient
-check_cmake() {
-  # Check if cmake is available
-  if $(command -v $cmake >/dev/null 2>&1); then
-    cmake_found="yes"
-    cmake_version=$($cmake --version | head -n1 | awk '{ print $3 }')
-    echo "Found CMake version $cmake_version" >& 2
-    if version_gte $cmake_version $CMAKE_MIN_REQUIRED; then
-      cmake_version_sufficient="yes"
-    fi
-  fi
-}
-check_cmake
 # Use already built CMake if any
-if [[ ! $cmake_version_sufficient && -x bin/cmake ]]; then
-  echo "Using already built CMake in $PWD/bin/cmake" >&2
-  cmake=bin/cmake
-  check_cmake
-fi
-
+if [[ -x "${cmake_prefix}/bin/cmake" ]]; then
+  echo "Using already built CMake in ${cmake_prefix}/bin/cmake" >&2
+  cmake="${cmake_prefix}/bin/cmake"
 # Build CMake if requested and no sufficient version found
-if [[ ! $cmake_version_sufficient && $build_cmake ]]; then
-  echo "CMake version $CMAKE_MIN_REQUIRED is required but only $cmake_version was found." >&2
-  echo "Building CMake version ${CMAKE_BUILD_VERSION} ..." >&2
+elif [[ $build_cmake ]]; then
+  echo "Building CMake version ${CMAKE_BUILD_VERSION} and installing into ${cmake_prefix} ..." >&2
   tarball=cmake-${CMAKE_BUILD_VERSION}.tar.gz
   if [[ ! -r $tarball ]]; then
     url=http://www.cmake.org/files/v${CMAKE_BUILD_VERSION:0:3}/$tarball
@@ -393,10 +398,19 @@ if [[ ! $cmake_version_sufficient && $build_cmake ]]; then
   (
     mkdir -p build_cmake
     cd build_cmake
-    ../cmake-${CMAKE_BUILD_VERSION}/bootstrap --prefix=.. && make && make install
+    ../cmake-${CMAKE_BUILD_VERSION}/bootstrap --prefix="${cmake_prefix}" && make && make install
   )
-  cmake=bin/cmake
-  check_cmake
+  cmake="${cmake_prefix}/bin/cmake"
+fi
+
+# Check if the cmake version is sufficient
+if $(command -v $cmake >/dev/null 2>&1); then
+  cmake_found="yes"
+  cmake_version=$($cmake --version | head -n1 | awk '{ print $3 }')
+  echo "Found CMake version $cmake_version" >& 2
+  if version_gte $cmake_version $CMAKE_MIN_REQUIRED; then
+    cmake_version_sufficient="yes"
+  fi
 fi
 
 # Fail if we don't have a sufficient CMake
diff --git a/cmake/CheckFortranCompilerFlag.cmake b/cmake/CheckFortranCompilerFlag.cmake
deleted file mode 100644
index 5408691..0000000
--- a/cmake/CheckFortranCompilerFlag.cmake
+++ /dev/null
@@ -1,37 +0,0 @@
-# - Check whether the CXX compiler supports a given flag.
-# CHECK_CXX_COMPILER_FLAG(FLAG VARIABLE)
-#
-#  FLAG - the compiler flag
-#  VARIABLE - variable to store the result
-
-# Copyright (c) 2006, Alexander Neundorf, <neundorf at kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-
-INCLUDE(CheckFortranSourceCompiles)
-
-MACRO (CHECK_FORTRAN_COMPILER_FLAG _FLAG _RESULT)
-   SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
-   SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
-   CHECK_FORTRAN_SOURCE_COMPILES("program main\nend program\n" ${_RESULT}
-     # Some compilers do not fail with a bad flag
-     FAIL_REGEX "command line option .* is valid for .* but not for C\\\\+\\\\+" # GNU
-     FAIL_REGEX "unrecognized .*option"                     # GNU
-     FAIL_REGEX "unknown .*option"                          # Clang
-     FAIL_REGEX "invalid value"                             # Clang
-     FAIL_REGEX "ignoring unknown option"                   # MSVC
-     FAIL_REGEX "warning D9002"                             # MSVC, any lang
-     FAIL_REGEX "option.*not supported"                     # Intel
-     FAIL_REGEX "invalid argument .*option"                 # Intel
-     FAIL_REGEX "ignoring option .*argument required"       # Intel
-     FAIL_REGEX "[Uu]nknown option"                         # HP
-     FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
-     FAIL_REGEX "command option .* is not recognized"       # XL
-     FAIL_REGEX "not supported in this configuration; ignored"       # AIX
-     FAIL_REGEX "File with unknown suffix passed to linker" # PGI
-     FAIL_REGEX "WARNING: unknown flag:"                    # Open64
-     )
-   SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
-ENDMACRO (CHECK_FORTRAN_COMPILER_FLAG)
diff --git a/cmake/CheckFortranSourceCompiles.cmake b/cmake/CheckFortranSourceCompiles.cmake
deleted file mode 100644
index 4303315..0000000
--- a/cmake/CheckFortranSourceCompiles.cmake
+++ /dev/null
@@ -1,94 +0,0 @@
-# - Check if given Fortran source compiles and links into an executable
-# CHECK_FORTRAN_SOURCE_COMPILES(<code> <var> [FAIL_REGEX <fail-regex>])
-#  <code>       - source code to try to compile, must define 'main'
-#  <var>        - variable to store whether the source code compiled
-#  <fail-regex> - fail if test output matches this regex
-# The following variables may be set before calling this macro to
-# modify the way the check is run:
-#
-#  CMAKE_REQUIRED_FLAGS = string of compile command line flags
-#  CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
-#  CMAKE_REQUIRED_INCLUDES = list of include directories
-#  CMAKE_REQUIRED_LIBRARIES = list of libraries to link
-
-#=============================================================================
-# Copyright 2005-2009 Kitware, Inc.
-# Fortran version, 2013, James Tappin
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-#  License text for the above reference.)
-
-
-
-macro(CHECK_FORTRAN_SOURCE_COMPILES SOURCE VAR)
-
-if( ${VAR} MATCHES "^${VAR}$" )
-    set(_FAIL_REGEX)
-    set(_key)
-    foreach(arg ${ARGN})
-      if("${arg}" MATCHES "^(FAIL_REGEX)$")
-        set(_key "${arg}")
-      elseif(_key)
-        list(APPEND _${_key} "${arg}")
-      else()
-        message(FATAL_ERROR "Unknown argument:\n  ${arg}\n")
-      endif()
-    endforeach()
-    set(MACRO_CHECK_FUNCTION_DEFINITIONS
-      "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
-    if(CMAKE_REQUIRED_LIBRARIES)
-      set(CHECK_FORTRAN_SOURCE_COMPILES_ADD_LIBRARIES
-        LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
-    else()
-      set(CHECK_FORTRAN_SOURCE_COMPILES_ADD_LIBRARIES)
-    endif()
-    if(CMAKE_REQUIRED_INCLUDES)
-      set(CHECK_FORTRAN_SOURCE_COMPILES_ADD_INCLUDES
-        "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
-    else()
-      set(CHECK_FORTRAN_SOURCE_COMPILES_ADD_INCLUDES)
-    endif()
-    file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.f90"
-      "${SOURCE}\n")
-
-    message(STATUS "Performing Test ${VAR}")
-    try_compile(${VAR}
-      ${CMAKE_BINARY_DIR}
-      ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.f90
-      COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
-      ${CHECK_FORTRAN_SOURCE_COMPILES_ADD_LIBRARIES}
-      CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
-      "${CHECK_FORTRAN_SOURCE_COMPILES_ADD_INCLUDES}"
-      OUTPUT_VARIABLE OUTPUT)
-
-    foreach(_regex ${_FAIL_REGEX})
-      if("${OUTPUT}" MATCHES "${_regex}")
-        set(${VAR} 0)
-      endif()
-    endforeach()
-
-    if(${VAR})
-      set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
-      message(STATUS "Performing Test ${VAR} - Success")
-      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
-        "Performing Fortran SOURCE FILE Test ${VAR} succeded with the following output:\n"
-        "${OUTPUT}\n"
-        "Source file was:\n${SOURCE}\n")
-    else()
-      message(STATUS "Performing Test ${VAR} - Failed")
-      set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
-      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
-        "Performing Fortran SOURCE FILE Test ${VAR} failed with the following output:\n"
-        "${OUTPUT}\n"
-        "Source file was:\n${SOURCE}\n")
-    endif()
-  endif()
-endmacro()
-
diff --git a/cmake/FindADSM.cmake b/cmake/FindADSM.cmake
index 7af6723..b46e798 100644
--- a/cmake/FindADSM.cmake
+++ b/cmake/FindADSM.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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 8a59037..717b2b5 100644
--- a/cmake/FindAEC.cmake
+++ b/cmake/FindAEC.cmake
@@ -1,26 +1,33 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
+# granted to it by virtue of its status as an intergovernmental organisation
+# nor does it submit to any jurisdiction.
 
 # - Try to find AEC (Adaptive Entropy Coding library)
 # See https://www.dkrz.de/redmine/projects/aec/wiki
 
 # Once done this will define
-#  AEC_FOUND - System has AEC
+#  AEC_FOUND        - System has AEC
 #  AEC_INCLUDE_DIRS - The AEC include directories
-#  AEC_LIBRARIES - The libraries needed to use AEC
-
-if( DEFINED AEC_PATH )
-    find_path( AEC_INCLUDE_DIR szlib.h    PATHS ${AEC_PATH}/include PATH_SUFFIXES aec NO_DEFAULT_PATH )
-    find_library( AEC_LIBRARY  NAMES aec  PATHS ${AEC_PATH}/lib     PATH_SUFFIXES aec NO_DEFAULT_PATH )
-endif()
-
-find_path( AEC_INCLUDE_DIR szlib.h PATH_SUFFIXES aec )
-find_library( AEC_LIBRARY NAMES aec PATH_SUFFIXES aec )
+#  AEC_LIBRARIES    - The libraries needed to use AEC
+#
+# The following paths will be searched with priority if set in CMake or env
+#
+#  AEC_DIR          - prefix path of the AEC installation
+#  AEC_PATH         - prefix path of the AEC installation
+
+find_path( AEC_INCLUDE_DIR szlib.h
+           PATHS ${AEC_DIR} ${AEC_PATH} ENV AEC_DIR ENV AEC_PATH
+           PATH_SUFFIXES include include/aec NO_DEFAULT_PATH )
+find_path( AEC_INCLUDE_DIR szlib.h PATH_SUFFIXES include include/aec )
+
+find_library( AEC_LIBRARY  NAMES aec
+              PATHS ${AEC_DIR} ${AEC_PATH} ENV AEC_DIR ENV AEC_PATH
+              PATH_SUFFIXES lib lib64 lib/aec lib64/aec NO_DEFAULT_PATH )
+find_library( AEC_LIBRARY NAMES aec PATH_SUFFIXES lib lib64 lib/aec lib64/aec )
 
 set( AEC_LIBRARIES    ${AEC_LIBRARY} )
 set( AEC_INCLUDE_DIRS ${AEC_INCLUDE_DIR} )
diff --git a/cmake/FindAIO.cmake b/cmake/FindAIO.cmake
index c27b795..76e357a 100644
--- a/cmake/FindAIO.cmake
+++ b/cmake/FindAIO.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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 a3628a5..4ef1a4a 100644
--- a/cmake/FindArmadillo.cmake
+++ b/cmake/FindArmadillo.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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. 
@@ -34,9 +34,10 @@ set( ARMADILLO_INCLUDE_DIRS ${ARMADILLO_INCLUDE_DIR} )
 
 include(FindPackageHandleStandardArgs)
 
-# handle the QUIETLY and REQUIRED arguments and set ARMADILLO_FOUND to TRUE
+# handle the QUIET and REQUIRED arguments and set ARMADILLO_FOUND to TRUE
 # if all listed variables are TRUE
-find_package_handle_standard_args(ARMADILLO  DEFAULT_MSG
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args(Armadillo  DEFAULT_MSG
                                   ARMADILLO_LIBRARY ARMADILLO_INCLUDE_DIR)
 
 mark_as_advanced(ARMADILLO_INCLUDE_DIR ARMADILLO_LIBRARY )
diff --git a/cmake/FindCMath.cmake b/cmake/FindCMath.cmake
index cf80f85..b8a2a0b 100644
--- a/cmake/FindCMath.cmake
+++ b/cmake/FindCMath.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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. 
@@ -10,14 +10,17 @@
 # CMATH_LIBRARIES      = the library to link against (RT etc)
 
 IF(UNIX)
- if( DEFINED CMATH_PATH )
+  if( DEFINED CMATH_PATH )
     find_library(CMATH_LIBRARIES m PATHS ${CMATH_PATH}/lib NO_DEFAULT_PATH )
- endif()
+  endif()
 
- find_library(CMATH_LIBRARIES m )
+  find_library(CMATH_LIBRARIES m )
 
- include(FindPackageHandleStandardArgs)
+  include(FindPackageHandleStandardArgs)
 
- find_package_handle_standard_args(CMATH  DEFAULT_MSG CMATH_LIBRARIES )
+  # handle the QUIET and REQUIRED arguments and set CMATH_FOUND to TRUE
+  # if all listed variables are TRUE
+  # Note: capitalisation of the package name must be the same as in the file name
+  find_package_handle_standard_args(CMath DEFAULT_MSG CMATH_LIBRARIES )
 
 ENDIF(UNIX)
diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake
index 7b3d47e..4298a1d 100644
--- a/cmake/FindCairo.cmake
+++ b/cmake/FindCairo.cmake
@@ -50,9 +50,10 @@ set( CAIRO_INCLUDE_DIRS ${CAIRO_INCLUDE_DIR} )
 
 include(FindPackageHandleStandardArgs)
 
-# handle the QUIETLY and REQUIRED arguments and set GRIBAPI_FOUND to TRUE
+# handle the QUIET and REQUIRED arguments and set CAIRO_FOUND to TRUE
 # if all listed variables are TRUE
-find_package_handle_standard_args(CAIRO  DEFAULT_MSG
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args(Cairo  DEFAULT_MSG
                                   CAIRO_LIBRARY CAIRO_INCLUDE_DIR)
 
 mark_as_advanced( CAIRO_INCLUDE_DIR CAIRO_LIBRARY )
diff --git a/cmake/FindDl.cmake b/cmake/FindDl.cmake
index 30db9c6..16463c6 100644
--- a/cmake/FindDl.cmake
+++ b/cmake/FindDl.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2015 ECMWF.
+# © Copyright 1996-2016 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,4 +17,7 @@ find_library(DL_LIBRARIES dl )
 
 include(FindPackageHandleStandardArgs)
 
-find_package_handle_standard_args(DL  DEFAULT_MSG DL_LIBRARIES )
+# handle the QUIET and REQUIRED arguments and set DL_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args(Dl DEFAULT_MSG DL_LIBRARIES )
diff --git a/cmake/FindEMOS.cmake b/cmake/FindEMOS.cmake
index 70028ca..c549fc2 100644
--- a/cmake/FindEMOS.cmake
+++ b/cmake/FindEMOS.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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 9608a54..4bcbdf3 100644
--- a/cmake/FindFDB.cmake
+++ b/cmake/FindFDB.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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
new file mode 100644
index 0000000..b76afa5
--- /dev/null
+++ b/cmake/FindFFTW.cmake
@@ -0,0 +1,211 @@
+# (C) Copyright 1996-2016 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.
+
+##############################################################################
+#.rst:
+#
+# FindFFTW
+# ========
+#
+# Find the FFTW library. ::
+#
+#   find_package(FFTW [REQUIRED] [QUIET]
+#                [COMPONENTS [single] [double] [long_double] [quad]])
+#
+# By default, search for the double precision library ``fftw3``
+#
+# Components
+# ----------
+#
+# If a different version or multiple versions of the library are required,
+# these need to be specified as ``COMPONENTS``. Note that double must be given
+# explicitly if any ``COMPONENTS`` are specified.
+#
+# The libraries corresponding to each of the ``COMPONENTS`` are:
+#
+# :single:      ``fftw3f``
+# :double:      ``fftw3``
+# :long_double: ``fftw3l``
+# :quad:        ``fftw3q``
+#
+# Output variables
+# ----------------
+#
+# The following CMake variables are set on completion:
+#
+# :FFTW_FOUND:      true if FFTW is found on the system
+# :FFTW_LIBRARIES:  full paths to requested FFTW libraries
+# :FFTW_INCLUDES:   FFTW include directory
+#
+# Input variables
+# ---------------
+#
+# The following CMake variables are checked by the function:
+#
+# :FFTW_USE_STATIC_LIBS:  if true, only static libraries are found
+# :FFTW_ROOT:             if set, this path is exclusively searched
+# :FFTW_DIR:              equivalent to FFTW_ROOT
+# :FFTW_PATH:             equivalent to FFTW_ROOT
+# :FFTW_LIBRARY:          FFTW library to use
+# :FFTW_INCLUDE_DIR:      FFTW include directory
+#
+##############################################################################
+
+if( (NOT FFTW_ROOT) AND EXISTS $ENV{FFTW_ROOT} )
+  set( FFTW_ROOT ${FFTW_ROOT} )
+endif()
+if( NOT FFTW_ROOT AND $FFTW_DIR )
+  set( FFTW_ROOT ${FFTW_DIR} )
+endif()
+if( (NOT FFTW_ROOT) AND EXISTS $ENV{FFTW_DIR} )
+  set( FFTW_ROOT $ENV{FFTW_DIR} )
+endif()
+if( (NOT FFTW_ROOT) AND FFTWDIR )
+  set( FFTW_ROOT ${FFTWDIR} )
+endif()
+if( (NOT FFTW_ROOT) AND EXISTS $ENV{FFTWDIR} )
+  set( FFTW_ROOT $ENV{FFTWDIR} )
+endif()
+if( (NOT FFTW_ROOT) AND FFTW_PATH )
+  set( FFTW_ROOT ${FFTW_PATH} )
+endif()
+if( (NOT FFTW_ROOT) AND EXISTS $ENV{FFTW_PATH})
+  set( FFTW_ROOT $ENV{FFTW_PATH} )
+endif()
+
+if( FFTW_ROOT ) # On cc[a|b|t] FFTW_DIR is set to the lib directory :(
+  get_filename_component(_dirname ${FFTW_ROOT} NAME)
+  if( _dirname MATCHES "lib" )
+    set( FFTW_ROOT "${FFTW_ROOT}/.." )
+  endif()
+endif()
+
+if( NOT FFTW_ROOT )
+  # Check if we can use PkgConfig
+  find_package(PkgConfig)
+
+  #Determine from PKG
+  if( PKG_CONFIG_FOUND AND NOT FFTW_ROOT )
+    pkg_check_modules( PKG_FFTW QUIET "fftw3" )
+  endif()
+endif()
+
+#Check whether to search static or dynamic libs
+set( CMAKE_FIND_LIBRARY_SUFFIXES_SAV ${CMAKE_FIND_LIBRARY_SUFFIXES} )
+
+if( ${FFTW_USE_STATIC_LIBS} )
+  set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} )
+else()
+  set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX} )
+endif()
+
+if( FFTW_FIND_COMPONENTS )
+  ecbuild_debug( "FindFFTW: looking for components: ${FFTW_FIND_COMPONENTS}" )
+  foreach( _component ${FFTW_FIND_COMPONENTS} )
+    if( _component MATCHES "single" )
+      ecbuild_debug( "FindFFTW: looking for single precision (fftw3f)" )
+      set( _require_sp TRUE )
+    elseif( _component MATCHES "double" )
+      ecbuild_debug( "FindFFTW: looking for double precision (fftw3)" )
+      set( _require_dp TRUE )
+    elseif( _component MATCHES "long_double" )
+      ecbuild_debug( "FindFFTW: looking for long double precision (fftw3l)" )
+      set( _require_lp TRUE )
+    elseif( _component MATCHES "quad" )
+      ecbuild_debug( "FindFFTW: looking for quad precision (fftw3q)" )
+      set( _require_qp TRUE )
+    else()
+    endif()
+  endforeach()
+else()
+  ecbuild_debug( "FindFFTW: no components specified, looking for double precision (fftw3)" )
+  set( _require_dp TRUE )
+endif()
+
+if( FFTW_ROOT )
+  set( _default_paths NO_DEFAULT_PATH )
+  set( _lib_paths ${FFTW_ROOT} )
+  set( _include_paths ${FFTW_ROOT} )
+else()
+  set( _lib_paths ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} )
+  set( _include_paths ${PKG_FFTW_INCLUDE_DIRS} ${INCLUDE_INSTALL_DIR} )
+endif()
+
+#find libs
+
+if( _require_dp )
+  find_library(
+    FFTW_LIB
+    NAMES "fftw3"
+    PATHS ${_lib_paths}
+    PATH_SUFFIXES "lib" "lib64"
+    ${_default_paths}
+  )
+  if( NOT FFTW_LIB )
+    ecbuild_warn("FindFFTW: double precision required, but fftw3 was not found")
+  endif()
+endif()
+
+if( _require_sp )
+  find_library(
+    FFTWF_LIB
+    NAMES "fftw3f"
+    PATHS ${_lib_paths}
+    PATH_SUFFIXES "lib" "lib64"
+    ${_default_paths}
+  )
+  if( NOT FFTWF_LIB )
+    ecbuild_warn("FindFFTW: single precision required, but fftw3f was not found")
+  endif()
+endif()
+
+if( _require_lp )
+  find_library(
+    FFTWL_LIB
+    NAMES "fftw3l"
+    PATHS ${_lib_paths}
+    PATH_SUFFIXES "lib" "lib64"
+    ${_default_paths}
+  )
+  if( NOT FFTWL_LIB )
+    ecbuild_warn("FindFFTW: long double precision required, but fftw3l was not found")
+  endif()
+endif()
+
+if( _require_qp )
+  find_library(
+    FFTWQ_LIB
+    NAMES "fftw3q"
+    PATHS ${_lib_paths}
+    PATH_SUFFIXES "lib" "lib64"
+    ${_default_paths}
+  )
+  if( NOT FFTWQ_LIB )
+    ecbuild_warn("FindFFTW: quad precision required, but fftw3q was not found")
+  endif()
+endif()
+
+#find includes
+
+find_path(
+  FFTW_INCLUDES
+  NAMES "fftw3.h"
+  PATHS ${_include_paths}
+  PATH_SUFFIXES "include"
+  ${_default_paths}
+)
+
+set(FFTW_LIBRARIES ${FFTW_LIB} ${FFTWF_LIB} ${FFTWL_LIB} ${FFTWQ_LIB})
+
+set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV} )
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(FFTW DEFAULT_MSG
+                                  FFTW_INCLUDES FFTW_LIBRARIES)
+
+mark_as_advanced(FFTW_INCLUDES FFTW_LIBRARIES FFTW_LIB FFTWF_LIB FFTWL_LIB)
diff --git a/cmake/FindGeoTIFF.cmake b/cmake/FindGeoTIFF.cmake
index f4f3b53..126bc46 100644
--- a/cmake/FindGeoTIFF.cmake
+++ b/cmake/FindGeoTIFF.cmake
@@ -1,37 +1,46 @@
-###############################################################################
+# (C) Copyright 1996-2016 ECMWF.
 #
-# CMake module to search for GeoTIFF library
-#
-# On success, the macro sets the following variables:
-# GEOTIFF_FOUND       = if the library found
-# GEOTIFF_LIBRARIES   = full path to the library
-# GEOTIFF_INCLUDE_DIR = where to find the library headers 
-# also defined, but not for general use are
-# GEOTIFF_LIBRARY, where to find the PROJ.4 library.
-#
-# Copyright (c) 2009 Mateusz Loskot <mateusz at loskot.net>
+# 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 the GeoTIFF includes and library
+# This module defines
 #
-# Module source: http://github.com/mloskot/workshop/tree/master/cmake/
+#  GEOTIFF_FOUND         - System has GeoTIFF
+#  GEOTIFF_INCLUDE_DIRS  - the GeoTIFF include directories
+#  GEOTIFF_LIBRARIES     - the libraries needed to use GeoTIFF
 #
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+# The following paths will be searched with priority if set in CMake or env
 #
-###############################################################################
+#  GEOTIFF_DIR   - root folder of the GeoTIFF installation
+#  GEOTIFF_PATH  - root folder of the GeoTIFF installation
 
-SET(GEOTIFF_NAMES geotiff)
+find_path( GEOTIFF_INCLUDE_DIR geotiff.h
+           PATHS ${GEOTIFF_PATH} ENV GEOTIFF_PATH
+                 ${GEOTIFF_DIR}  ENV GEOTIFF_DIR
+           PATH_SUFFIXES include include/libgeotiff
+           NO_DEFAULT_PATH )
+find_path( GEOTIFF_INCLUDE_DIR  openjpeg.h
+           PATH_SUFFIXES include include/libgeotiff )
 
+find_library( GEOTIFF_LIBRARY NAMES geotiff
+              PATHS ${GEOTIFF_PATH} ENV GEOTIFF_PATH
+                    ${GEOTIFF_DIR}  ENV GEOTIFF_DIR
+              PATH_SUFFIXES lib lib64
+              NO_DEFAULT_PATH )
+find_library( GEOTIFF_LIBRARY NAMES geotiff )
 
-    FIND_PATH(GEOTIFF_INCLUDE_DIR geotiff.h PATH_PREFIXES geotiff 
-         PATHS /usr/local/include/libgeotiff /usr/include/libgeotiff)
+set( GEOTIFF_LIBRARIES    ${GEOTIFF_LIBRARY} )
+set( GEOTIFF_INCLUDE_DIRS ${GEOTIFF_INCLUDE_DIR} )
 
-    FIND_LIBRARY(GEOTIFF_LIBRARY NAMES ${GEOTIFF_NAMES})
+include(FindPackageHandleStandardArgs)
 
-
-IF(GEOTIFF_FOUND)
-  SET(GEOTIFF_LIBRARIES ${GEOTIFF_LIBRARY})
-ENDIF()
-
-# Handle the QUIETLY and REQUIRED arguments and set SPATIALINDEX_FOUND to TRUE
+# handle the QUIETLY and REQUIRED arguments and set GEOTIFF_FOUND to TRUE
 # if all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GEOTIFF DEFAULT_MSG GEOTIFF_LIBRARY GEOTIFF_INCLUDE_DIR)
+find_package_handle_standard_args( GeoTIFF DEFAULT_MSG
+                                   GEOTIFF_LIBRARY GEOTIFF_INCLUDE_DIR )
+
+mark_as_advanced( GEOTIFF_INCLUDE_DIR GEOTIFF_LIBRARY )
diff --git a/cmake/FindHPSS.cmake b/cmake/FindHPSS.cmake
index a96b8d4..b2b662b 100644
--- a/cmake/FindHPSS.cmake
+++ b/cmake/FindHPSS.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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 00335c2..221868f 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-2015 ECMWF.
+# (C) Copyright 1996-2016 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/FindLegacyFDB.cmake b/cmake/FindLegacyFDB.cmake
deleted file mode 100644
index f461a0e..0000000
--- a/cmake/FindLegacyFDB.cmake
+++ /dev/null
@@ -1,35 +0,0 @@
-# (C) Copyright 1996-2015 ECMWF.
-# 
-# This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 
-# In applying this licence, ECMWF does not waive the privileges and immunities 
-# granted to it by virtue of its status as an intergovernmental organisation nor
-# does it submit to any jurisdiction.
-
-# - Try to find FDB
-# Once done this will define
-#  LEGACY_FDB_FOUND - System has FDB
-#  LEGACY_FDB_INCLUDE_DIRS - The FDB include directories
-#  LEGACY_FDB_LIBRARIES - The libraries needed to use FDB
-
-
-if( NOT LEGACY_FDB_FOUND )
-
-	if( DEFINED LEGACY_FDB_PATH )
-		find_library( LEGACY_FDB_LIBRARY NAMES fdb_legacy PATHS ${LEGACY_FDB_PATH} ${LEGACY_FDB_PATH}/lib NO_DEFAULT_PATH)
-	endif()
-	
-	find_library( LEGACY_FDB_LIBRARY NAMES fdb_legacy )
-	
-	set( LEGACY_FDB_LIBRARIES  ${LEGACY_FDB_LIBRARY} )
-	
-	include(FindPackageHandleStandardArgs)
-	
-	# handle the QUIETLY and REQUIRED arguments and set LEGACY_FDB_FOUND to TRUE
-	# if all listed variables are TRUE
-	find_package_handle_standard_args(LEGACY_FDB  DEFAULT_MSG
-		LEGACY_FDB_LIBRARY )
-	
-	mark_as_advanced(LEGACY_FDB_LIBRARY)
-
-endif()
diff --git a/cmake/FindLibGFortran.cmake b/cmake/FindLibGFortran.cmake
index 200ffcb..a293ea5 100644
--- a/cmake/FindLibGFortran.cmake
+++ b/cmake/FindLibGFortran.cmake
@@ -1,8 +1,8 @@
-# © Copyright 1996-2015 ECMWF.
-# 
+# © Copyright 1996-2016 ECMWF.
+#
 # This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 
-# In applying this licence, ECMWF does not waive the privileges and immunities 
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
 # granted to it by virtue of its status as an intergovernmental organisation nor
 # does it submit to any jurisdiction.
 
@@ -23,16 +23,16 @@ if( GFORTRAN_EXECUTABLE )
 		ERROR_VARIABLE _GFORTRAN_ERROR_VALUE
 		OUTPUT_STRIP_TRAILING_WHITESPACE)
 
-#	debug_var(_GFORTRAN_SEARCH_SUCCESS)
-#	debug_var(_GFORTRAN_VALUES_OUTPUT)
-#	debug_var(_GFORTRAN_ERROR_VALUE)
+#	ecbuild_debug_var(_GFORTRAN_SEARCH_SUCCESS)
+#	ecbuild_debug_var(_GFORTRAN_VALUES_OUTPUT)
+#	ecbuild_debug_var(_GFORTRAN_ERROR_VALUE)
 
 	if(_GFORTRAN_SEARCH_SUCCESS MATCHES 0)
 		string(REGEX REPLACE ".*libraries: =(.*)" "\\1" _result  ${_GFORTRAN_VALUES_OUTPUT})
 		string(REGEX REPLACE ":" ";" _gfortran_hints ${_result} )
 	endif()
 
-	debug_var( _gfortran_hints )
+	ecbuild_debug_var( _gfortran_hints )
 
 endif()
 
@@ -47,6 +47,7 @@ endif()
 
 include(FindPackageHandleStandardArgs)
 
-find_package_handle_standard_args( LIBGFORTRAN  DEFAULT_MSG GFORTRAN_LIBRARIES  )
-
-
+# Handle the QUIET and REQUIRED arguments and set LIBGFORTRAN_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( LibGFortran DEFAULT_MSG GFORTRAN_LIBRARIES  )
diff --git a/cmake/FindLibIFort.cmake b/cmake/FindLibIFort.cmake
index e1d82ee..da782a4 100644
--- a/cmake/FindLibIFort.cmake
+++ b/cmake/FindLibIFort.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2015 ECMWF.
+# © Copyright 1996-2016 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. 
@@ -44,4 +44,7 @@ endif()
 
 include(FindPackageHandleStandardArgs)
 
-find_package_handle_standard_args( LIBIFORT DEFAULT_MSG IFORT_LIBRARIES )
+# Handle the QUIET and REQUIRED arguments and set LIBIFORT_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( LibIFort DEFAULT_MSG IFORT_LIBRARIES )
diff --git a/cmake/FindMKL.cmake b/cmake/FindMKL.cmake
index fe182a4..5941179 100644
--- a/cmake/FindMKL.cmake
+++ b/cmake/FindMKL.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -15,6 +15,7 @@
 #
 # The following paths will be searched with priority if set in CMake or env
 #
+#  MKLROOT           - root directory of the MKL installation
 #  MKL_PATH          - root directory of the MKL installation
 #  MKL_ROOT          - root directory of the MKL installation
 
@@ -34,9 +35,9 @@ else()
 
 endif()
 
-# Search with priority for MKL_ROOT and MKL_PATH if set in CMake or env
+# Search with priority for MKLROOT, MKL_PATH and MKL_ROOT if set in CMake or env
 find_path(MKL_INCLUDE_DIR mkl.h
-          PATHS ${MKL_PATH} ${MKL_ROOT} ENV MKL_PATH MKL_ROOT
+          PATHS ${MKLROOT} ${MKL_PATH} ${MKL_ROOT} ENV MKLROOT ENV MKL_PATH ENV MKL_ROOT
           PATH_SUFFIXES include NO_DEFAULT_PATH)
 find_path(MKL_INCLUDE_DIR mkl.h
           PATH_SUFFIXES include)
@@ -53,8 +54,6 @@ if( MKL_INCLUDE_DIR ) # use include dir to find libs
     set( __libsfx "" )
   endif()
 
-  message( STATUS "ICC_LIB_PATH ${ICC_LIB_PATH}" )
-
   find_library( MKL_LIB_INTEL         NAMES mkl_intel${__libsfx} PATHS ${MKL_LIB_PATH} )
   find_library( ${__mkl_lib_par}      NAMES ${__mkl_lib_name} PATHS ${MKL_LIB_PATH} )
   find_library( MKL_LIB_CORE          NAMES mkl_core PATHS ${MKL_LIB_PATH} )
diff --git a/cmake/FindNDBM.cmake b/cmake/FindNDBM.cmake
index 5203ee9..869223f 100644
--- a/cmake/FindNDBM.cmake
+++ b/cmake/FindNDBM.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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 89af114..9084549 100644
--- a/cmake/FindNetCDF.cmake
+++ b/cmake/FindNetCDF.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -76,7 +76,7 @@ if( PREFER_NETCDF4 )
 
   ## hdf5
 
-  # Note: Only the HDF5 C-library is required for NetCDF 
+  # Note: Only the HDF5 C-library is required for NetCDF
   #       ( even for Fortan and CXX bindings)
   find_package( HDF5 COMPONENTS C QUIET )
 
@@ -87,24 +87,24 @@ if( PREFER_NETCDF4 )
   # Find NetCDF4
 
   # message( "NETCDF CMAKE_PREFIX_PATH = [${CMAKE_PREFIX_PATH}]")
-  # debug_var( NETCDF_ROOT )
-  # debug_var( NETCDF_FIND_COMPONENTS )
-  # debug_var( NETCDF_FIND_QUIETLY )
-  # debug_var( NETCDF_FIND_REQUIRED )
+  # ecbuild_debug_var( NETCDF_ROOT )
+  # ecbuild_debug_var( NETCDF_FIND_COMPONENTS )
+  # ecbuild_debug_var( NETCDF_FIND_QUIETLY )
+  # ecbuild_debug_var( NETCDF_FIND_REQUIRED )
   find_package( NetCDF4 COMPONENTS ${NETCDF_FIND_COMPONENTS} )
-  # debug_var( NETCDF4_FOUND )
-  # debug_var( NETCDF_FOUND )
-  # debug_var( NETCDF_LIBRARIES )
-  # debug_var( NETCDF_INCLUDE_DIRS )
+  # ecbuild_debug_var( NETCDF4_FOUND )
+  # ecbuild_debug_var( NETCDF_FOUND )
+  # ecbuild_debug_var( NETCDF_LIBRARIES )
+  # ecbuild_debug_var( NETCDF_INCLUDE_DIRS )
 
   list( APPEND NETCDF_Fortran_LIBRARIES ${NETCDF_FORTRAN_LIBRARIES} ${NETCDF_F90_LIBRARIES} )
   if( NETCDF_Fortran_LIBRARIES )
     list( REMOVE_DUPLICATES NETCDF_Fortran_LIBRARIES )
   endif()
 
-  # debug_var( NETCDF_Fortran_LIBRARIES )
-  # debug_var( NETCDF_C_LIBRARIES )
-  # debug_var( NETCDF_CXX_LIBRARIES )
+  # ecbuild_debug_var( NETCDF_Fortran_LIBRARIES )
+  # ecbuild_debug_var( NETCDF_C_LIBRARIES )
+  # ecbuild_debug_var( NETCDF_CXX_LIBRARIES )
 
 
   set_package_properties( NetCDF4 PROPERTIES TYPE RECOMMENDED PURPOSE "support for NetCDF4 file format" )
@@ -115,13 +115,13 @@ if( PREFER_NETCDF4 )
     list( APPEND NETCDF_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS} )
   endif()
 
-  #debug_var( NETCDF_FOUND )
-  #debug_var( NETCDF_LIBRARIES )
-  #debug_var( NETCDF_INCLUDE_DIRS )
-  #debug_var( HDF5_FOUND )
-  #debug_var( HDF5_INCLUDE_DIRS )
-  #debug_var( HDF5_HL_LIBRARIES )
-  #debug_var( HDF5_LIBRARIES )
+  #ecbuild_debug_var( NETCDF_FOUND )
+  #ecbuild_debug_var( NETCDF_LIBRARIES )
+  #ecbuild_debug_var( NETCDF_INCLUDE_DIRS )
+  #ecbuild_debug_var( HDF5_FOUND )
+  #ecbuild_debug_var( HDF5_INCLUDE_DIRS )
+  #ecbuild_debug_var( HDF5_HL_LIBRARIES )
+  #ecbuild_debug_var( HDF5_LIBRARIES )
 
 endif()
 
@@ -131,9 +131,9 @@ if( PREFER_NETCDF3 )
 
   ecbuild_debug( "FindNetCDF: looking for NetCDF3" )
 
-  # debug_var( NetCDF_FIND_COMPONENTS )
-  # debug_var( NetCDF_FIND_QUIETLY )
-  # debug_var( NetCDF_FIND_REQUIRED )
+  # ecbuild_debug_var( NetCDF_FIND_COMPONENTS )
+  # ecbuild_debug_var( NetCDF_FIND_QUIETLY )
+  # ecbuild_debug_var( NetCDF_FIND_REQUIRED )
 
   list(FIND NetCDF_FIND_COMPONENTS "CXX" _index)
   if(${_index} GREATER -1)
diff --git a/cmake/FindNetCDF3.cmake b/cmake/FindNetCDF3.cmake
index 40e6bc0..5519fd6 100644
--- a/cmake/FindNetCDF3.cmake
+++ b/cmake/FindNetCDF3.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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. 
@@ -104,7 +104,10 @@ if( NETCDF_FIND_REQUIRED )
   set( NETCDF3_FIND_REQUIRED ${NETCDF_FIND_REQUIRED} )
 endif()
 
-find_package_handle_standard_args( NETCDF3  DEFAULT_MSG ${NETCDF_REQUIRED_VARS} )
+# Handle the QUIET and REQUIRED arguments and set NETCDF3_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( NetCDF3  DEFAULT_MSG ${NETCDF_REQUIRED_VARS} )
 
 set( NETCDF_FOUND ${NETCDF3_FOUND} )
 
diff --git a/cmake/FindODB.cmake b/cmake/FindODB.cmake
index 3a1fa12..1beb5c8 100644
--- a/cmake/FindODB.cmake
+++ b/cmake/FindODB.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2015 ECMWF.
+# © Copyright 1996-2016 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 e4e9556..9b6e978 100644
--- a/cmake/FindOpenCL.cmake
+++ b/cmake/FindOpenCL.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -61,7 +61,10 @@ endif()
 
 include(FindPackageHandleStandardArgs)
 
-find_package_handle_standard_args( OPENCL DEFAULT_MSG
+# Handle the QUIET and REQUIRED arguments and set OPENCL_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( OpenCL DEFAULT_MSG
                                    OPENCL_LIBRARIES OPENCL_INCLUDE_DIRS )
 
 mark_as_advanced( OPENCL_INCLUDE_DIRS OPENCL_LIBRARIES )
diff --git a/cmake/FindOpenJPEG.cmake b/cmake/FindOpenJPEG.cmake
index 82d19fb..c660238 100644
--- a/cmake/FindOpenJPEG.cmake
+++ b/cmake/FindOpenJPEG.cmake
@@ -1,33 +1,45 @@
-# (C) Copyright 1996-2015 ECMWF.
-# 
+# (C) Copyright 1996-2016 ECMWF.
+#
 # This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 
-# In applying this licence, ECMWF does not waive the privileges and immunities 
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
 # granted to it by virtue of its status as an intergovernmental organisation nor
 # does it submit to any jurisdiction.
 
-# - Try to find the OpenJPEG includes and library
+# - Try to find the OpenJPEG includes and library (version 1.5.x or 2.1.x)
 # This module defines
+#
 #  OPENJPEG_FOUND         - System has OpenJPEG
 #  OPENJPEG_INCLUDE_DIRS  - the OpenJPEG include directories
 #  OPENJPEG_LIBRARIES     - the libraries needed to use OpenJPEG
 #
-# also defined internally:
-#  OPENJPEG_LIBRARY, where to find the OpenJPEG library.
-#  OPENJPEG_INCLUDE_DIR, where to find the openjpeg.h header
-
-IF( NOT DEFINED OPENJPEG_PATH AND NOT "$ENV{OPENJPEG_PATH}" STREQUAL "" )
-  SET( OPENJPEG_PATH "$ENV{OPENJPEG_PATH}" )
-ENDIF()
-
-# TODO: This only works for OpenJPEG v1.x.y and not for v2 which has a different API, library name etc
-if( DEFINED OPENJPEG_PATH )
-        find_path(OPENJPEG_INCLUDE_DIR openjpeg.h PATHS ${OPENJPEG_PATH}/include PATH_SUFFIXES openjpeg  NO_DEFAULT_PATH)
-        find_library(OPENJPEG_LIBRARY  openjpeg   PATHS ${OPENJPEG_PATH}/lib     PATH_SUFFIXES openjpeg  NO_DEFAULT_PATH)
-endif()
-
-find_path(OPENJPEG_INCLUDE_DIR  openjpeg.h PATH_SUFFIXES openjpeg )
-find_library( OPENJPEG_LIBRARY  openjpeg   PATH_SUFFIXES openjpeg )
+# The following paths will be searched with priority if set in CMake or env
+#
+#  OPENJPEG_DIR   - root folder of the OpenJPEG installation
+#  OPENJPEG_PATH  - root folder of the OpenJPEG installation
+
+# Note: OpenJPEG has a version-specific subdirectory in the include
+# e.g. include/openjpeg-2.0 or include/openjpeg-2.1.
+# Only version 1.5.x and 2.1.x are supported.
+# The library name is different for 1.x (libopenjpeg) and 2.x (libopenjp2).
+
+set( _suff include include/openjpeg include/openjpeg-1.5 include/openjpeg-2.1 )
+find_path( OPENJPEG_INCLUDE_DIR openjpeg.h
+           PATHS ${OPENJPEG_PATH} ENV OPENJPEG_PATH
+                 ${OPENJPEG_DIR}  ENV OPENJPEG_DIR
+           PATH_SUFFIXES ${_suff}
+           NO_DEFAULT_PATH )
+find_path( OPENJPEG_INCLUDE_DIR  openjpeg.h
+           PATH_SUFFIXES ${_suff} )
+unset( _suff )
+
+find_library( OPENJPEG_LIBRARY NAMES openjpeg openjp2
+              PATHS ${OPENJPEG_PATH} ENV OPENJPEG_PATH
+                    ${OPENJPEG_DIR}  ENV OPENJPEG_DIR
+              PATH_SUFFIXES lib lib/openjpeg
+              NO_DEFAULT_PATH )
+find_library( OPENJPEG_LIBRARY NAMES openjpeg openjp2
+              PATH_SUFFIXES lib lib/openjpeg )
 
 set( OPENJPEG_LIBRARIES    ${OPENJPEG_LIBRARY} )
 set( OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_DIR} )
@@ -39,4 +51,4 @@ include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(OpenJPEG  DEFAULT_MSG
                                   OPENJPEG_LIBRARY OPENJPEG_INCLUDE_DIR)
 
-mark_as_advanced(OPENJPEG_INCLUDE_DIR OPENJPEG_LIBRARY )
+mark_as_advanced( OPENJPEG_INCLUDE_DIR OPENJPEG_LIBRARY )
diff --git a/cmake/FindPGIFortran.cmake b/cmake/FindPGIFortran.cmake
index 7308e49..e68bdf6 100644
--- a/cmake/FindPGIFortran.cmake
+++ b/cmake/FindPGIFortran.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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. 
@@ -35,12 +35,15 @@ endforeach()
 
 include(FindPackageHandleStandardArgs)
 
-find_package_handle_standard_args( LIBPGIFORTRAN DEFAULT_MSG pgi_fortran_all_libs_found PGIFORTRAN_LIBRARIES  )
+# Handle the QUIET and REQUIRED arguments and set PGIFORTRAN_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( PGIFortran DEFAULT_MSG pgi_fortran_all_libs_found PGIFORTRAN_LIBRARIES  )
 
-if( LIBPGIFORTRAN_FOUND )
+if( PGIFORTRAN_FOUND )
 	find_package( Realtime )
 endif()
 
 if( REALTIME_FOUND )
-	set( LIBPGIFORTRAN_LIBRARIES ${PGIFORTRAN_LIBRARIES} ${RT_LIB} )
+	set( PGIFORTRAN_LIBRARIES ${PGIFORTRAN_LIBRARIES} ${RT_LIB} )
 endif()
diff --git a/cmake/FindPango.cmake b/cmake/FindPango.cmake
index 811cdf9..76e152a 100644
--- a/cmake/FindPango.cmake
+++ b/cmake/FindPango.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
-# 
+# (C) Copyright 1996-2016 ECMWF.
+#
 # This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 
-# In applying this licence, ECMWF does not waive the privileges and immunities 
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
 # granted to it by virtue of its status as an intergovernmental organisation nor
 # does it submit to any jurisdiction.
 
@@ -17,15 +17,17 @@ find_package(PkgConfig)
 
 pkg_check_modules(PC_LIBPANGO QUIET pango)
 
-debug_var( PC_LIBPANGO_FOUND )
-debug_var( PC_LIBPANGO_VERSION )
-debug_var( PC_LIBPANGO_LIBRARIES )
-debug_var( PC_LIBPANGO_INCLUDE_DIRS )
+ecbuild_debug_var( PC_LIBPANGO_FOUND )
+ecbuild_debug_var( PC_LIBPANGO_VERSION )
+ecbuild_debug_var( PC_LIBPANGO_LIBRARIES )
+ecbuild_debug_var( PC_LIBPANGO_INCLUDE_DIRS )
 
 include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args( pango DEFAULT_MSG PC_LIBPANGO_LIBRARIES PC_LIBPANGO_INCLUDE_DIRS )
+# Handle the QUIET and REQUIRED arguments and set PANGO_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( Pango DEFAULT_MSG PC_LIBPANGO_LIBRARIES PC_LIBPANGO_INCLUDE_DIRS )
 
 set( PANGO_VERSION ${PC_LIBPANGO_VERSION} )
 set( PANGO_LIBRARIES ${PC_LIBPANGO_LIBRARIES} )
 set( PANGO_INCLUDE_DIRS ${PC_LIBPANGO_INCLUDE_DIRS} )
-
diff --git a/cmake/FindPangoCairo.cmake b/cmake/FindPangoCairo.cmake
index 7445754..9979550 100644
--- a/cmake/FindPangoCairo.cmake
+++ b/cmake/FindPangoCairo.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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,17 +18,20 @@ find_package(PkgConfig)
 
 pkg_check_modules(PC_LIBPANGOCAIRO QUIET pangocairo)
 
-#debug_var( PC_LIBPANGOCAIRO_FOUND )
-#debug_var( PC_LIBPANGOCAIRO_VERSION )
-#debug_var( PC_LIBPANGOCAIRO_LIBRARIES )
-#debug_var( PC_LIBPANGOCAIRO_LDFLAGS )
-#debug_var( PC_LIBPANGOCAIRO_LDFLAGS_OTHER )
-#debug_var( PC_LIBPANGOCAIRO_INCLUDE_DIRS )
+#ecbuild_debug_var( PC_LIBPANGOCAIRO_FOUND )
+#ecbuild_debug_var( PC_LIBPANGOCAIRO_VERSION )
+#ecbuild_debug_var( PC_LIBPANGOCAIRO_LIBRARIES )
+#ecbuild_debug_var( PC_LIBPANGOCAIRO_LDFLAGS )
+#ecbuild_debug_var( PC_LIBPANGOCAIRO_LDFLAGS_OTHER )
+#ecbuild_debug_var( PC_LIBPANGOCAIRO_INCLUDE_DIRS )
 
 if(PC_LIBPANGOCAIRO_FOUND)
 
     include(FindPackageHandleStandardArgs)
-    find_package_handle_standard_args( pangocairo DEFAULT_MSG PC_LIBPANGOCAIRO_LIBRARIES PC_LIBPANGOCAIRO_INCLUDE_DIRS )
+    # Handle the QUIET and REQUIRED arguments and set PANGOCAIRO_FOUND to TRUE
+    # if all listed variables are TRUE
+    # Note: capitalisation of the package name must be the same as in file name
+    find_package_handle_standard_args( PangoCairo DEFAULT_MSG PC_LIBPANGOCAIRO_LIBRARIES PC_LIBPANGOCAIRO_INCLUDE_DIRS )
     set( PANGOCAIRO_VERSION ${PC_LIBPANGOCAIRO_VERSION} )
     set( PANGOCAIRO_LIBRARIES "${PC_LIBPANGOCAIRO_LDFLAGS} ${PC_LIBPANGOCAIRO_LDFLAGS_OTHER}" )
     set( PANGOCAIRO_INCLUDE_DIRS ${PC_LIBPANGOCAIRO_INCLUDE_DIRS} )
@@ -69,8 +72,6 @@ else()
 	${X11_INCLUDE_DIR}
     )
 
-#message(WARNING "===> ${PANGOCAIRO_INCLUDE_DIRS}")
-
     find_library( _PANGOCAIRO_LIBRARIES NAMES pangocairo pangocairo-${PANGO_VERSION})
     find_library( _PANGO_LIBRARIES NAMES pango pango-${PANGO_VERSION})
     find_library( _CAIRO_LIBRARIES NAMES cairo)
@@ -84,11 +85,12 @@ else()
 	${X11_LIBRARIES}
     )
 
-#message(WARNING "===> ${PANGOCAIRO_LIBRARIES}")
-
-    find_package_handle_standard_args( pangocairo  DEFAULT_MSG
-        PANGOCAIRO_LIBRARIES
-        PANGOCAIRO_INCLUDE_DIRS  )
+    # Handle the QUIET and REQUIRED arguments and set PANGOCAIRO_FOUND to TRUE
+    # if all listed variables are TRUE
+    # Note: capitalisation of the package name must be the same as in file name
+    find_package_handle_standard_args( PangoCairo  DEFAULT_MSG
+                                       PANGOCAIRO_LIBRARIES
+                                       PANGOCAIRO_INCLUDE_DIRS  )
 
 endif()
 
diff --git a/cmake/FindProj4.cmake b/cmake/FindProj4.cmake
index 6774b6e..a3560b2 100644
--- a/cmake/FindProj4.cmake
+++ b/cmake/FindProj4.cmake
@@ -38,9 +38,9 @@ if( NOT PROJ4_PATH )
 
     endif()
 
-#    debug_var( PKG_CONFIG_FOUND )
-#    debug_var( PKPROJ4_FOUND )
-#    debug_var( PROJ4_MIN_VERSION )
+#    ecbuild_debug_var( PKG_CONFIG_FOUND )
+#    ecbuild_debug_var( PKPROJ4_FOUND )
+#    ecbuild_debug_var( PROJ4_MIN_VERSION )
 
 endif()
 
@@ -55,12 +55,12 @@ find_path(PROJ4_INCLUDE_DIR NAMES proj_api.h PATHS PATH_SUFFIXES proj4 )
 find_library( PROJ4_LIBRARY NAMES proj       PATHS PATH_SUFFIXES proj4 )
 
 
-# debug_var( PROJ4_INCLUDE_DIR )
-# debug_var( PROJ4_LIBRARY )
+# ecbuild_debug_var( PROJ4_INCLUDE_DIR )
+# ecbuild_debug_var( PROJ4_LIBRARY )
 
 # handle the QUIETLY and REQUIRED arguments and set GRIBAPI_FOUND
 include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(PROJ4  DEFAULT_MSG
+find_package_handle_standard_args(Proj4  DEFAULT_MSG
                                   PROJ4_LIBRARY PROJ4_INCLUDE_DIR)
 
 set( PROJ4_LIBRARIES    ${PROJ4_LIBRARY} )
diff --git a/cmake/FindREADLINE.cmake b/cmake/FindREADLINE.cmake
index bbabe15..2ba08b4 100644
--- a/cmake/FindREADLINE.cmake
+++ b/cmake/FindREADLINE.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -47,8 +47,8 @@ cmake_push_check_state()
 
 cmake_pop_check_state()
 
-# debug_var( readline_version )
-# debug_var( __readline_version_out )
+# ecbuild_debug_var( readline_version )
+# ecbuild_debug_var( __readline_version_out )
 
 set( __readline_fail 0 )
 if( __readline_version_out )
diff --git a/cmake/FindRPCGEN.cmake b/cmake/FindRPCGEN.cmake
index 3e25daf..fd42e9f 100644
--- a/cmake/FindRPCGEN.cmake
+++ b/cmake/FindRPCGEN.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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 2c2a7b2..843a54f 100644
--- a/cmake/FindRealtime.cmake
+++ b/cmake/FindRealtime.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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,5 +18,7 @@ find_library( RT_LIB rt )
 mark_as_advanced( RT_LIB )
 
 include(FindPackageHandleStandardArgs)
-
-find_package_handle_standard_args(REALTIME  DEFAULT_MSG RT_LIB )
+# Handle the QUIET and REQUIRED arguments and set REALTIME_FOUND to TRUE
+# if all listed variables are TRUE
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args(Realtime  DEFAULT_MSG RT_LIB )
diff --git a/cmake/FindSZip.cmake b/cmake/FindSZip.cmake
index 6e9b1a2..925348c 100644
--- a/cmake/FindSZip.cmake
+++ b/cmake/FindSZip.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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 a1cabce..0d99b54 100644
--- a/cmake/FindTrilinos.cmake
+++ b/cmake/FindTrilinos.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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 a1b1eb9..aba2980 100644
--- a/cmake/FindViennaCL.cmake
+++ b/cmake/FindViennaCL.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -30,9 +30,10 @@ set( VIENNACL_INCLUDE_DIRS ${VIENNACL_INCLUDE_DIR} )
 
 include(FindPackageHandleStandardArgs)
 
-# handle the QUIETLY and REQUIRED arguments and set VIENNACL_FOUND to TRUE
+# handle the QUIET and REQUIRED arguments and set VIENNACL_FOUND to TRUE
 # if all listed variables are valid
-find_package_handle_standard_args(VIENNACL  DEFAULT_MSG
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args(ViennaCL  DEFAULT_MSG
                                   VIENNACL_INCLUDE_DIR)
 
 mark_as_advanced(VIENNACL_INCLUDE_DIRS)
diff --git a/cmake/FindXLFortranLibs.cmake b/cmake/FindXLFortranLibs.cmake
index 10a68aa..37800c7 100644
--- a/cmake/FindXLFortranLibs.cmake
+++ b/cmake/FindXLFortranLibs.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2015 ECMWF.
+# © Copyright 1996-2016 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,8 +27,10 @@ foreach( lib ${xl_libs} )
 endforeach()
 
 include(FindPackageHandleStandardArgs)
-
-find_package_handle_standard_args( LIBXLFORTRAN DEFAULT_MSG xlf_all_libs_found XLFORTRAN_LIBRARIES  )
+# handle the QUIET and REQUIRED arguments and set XLFORTRANLIBS_FOUND to TRUE
+# if all listed variables are valid
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( XLFortranLibs DEFAULT_MSG xlf_all_libs_found XLFORTRAN_LIBRARIES  )
 
 # HACK for support libraries
 
diff --git a/cmake/FindYACC.cmake b/cmake/FindYACC.cmake
index a410c6f..7b15bfe 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-2015 ECMWF.
+# (C) Copyright 1996-2016 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 8b6cb43..ab6fc0b 100644
--- a/cmake/Findgrib_api.cmake
+++ b/cmake/Findgrib_api.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -20,16 +20,16 @@ option( GRIB_API_JPG "use jpg with grib_api" ON )
 if( NOT grib_api_FOUND AND NOT NO_GRIB_API_BINARIES )
 
     if( GRIB_API_JPG ) # jpeg support
-        
+
         find_package( JPEG     QUIET ) # grib_api might be a static .a library in which
-    
+
         if( NOT "$ENV{JASPER_PATH}" STREQUAL "" )
             list( APPEND CMAKE_PREFIX_PATH "$ENV{JASPER_PATH}" )
         endif()
         find_package( Jasper   QUIET ) # case we don't know if which jpeg library was used
-    
-        find_package( OpenJPEG QUIET ) # so we try to find all jpeg libs and link to them 
-        
+
+        find_package( OpenJPEG QUIET ) # so we try to find all jpeg libs and link to them
+
         if(JPEG_FOUND)
             list( APPEND _grib_api_jpg_incs ${JPEG_INCLUDE_DIR} )
             list( APPEND _grib_api_jpg_libs ${JPEG_LIBRARIES} )
@@ -44,18 +44,18 @@ if( NOT grib_api_FOUND AND NOT NO_GRIB_API_BINARIES )
         endif()
 
     endif()
-    
+
     if( GRIB_API_PNG ) # png support
-    
+
         find_package(PNG)
-    
+
         if( DEFINED PNG_PNG_INCLUDE_DIR AND NOT DEFINED PNG_INCLUDE_DIRS )
           set( PNG_INCLUDE_DIRS ${PNG_PNG_INCLUDE_DIR}  CACHE INTERNAL "PNG include dirs" )
         endif()
         if( DEFINED PNG_LIBRARY AND NOT DEFINED PNG_LIBRARIES )
           set( PNG_LIBRARIES ${PNG_LIBRARY} CACHE INTERNAL "PNG libraries" )
         endif()
-        
+
         if(PNG_FOUND)
             list( APPEND _grib_api_png_defs ${PNG_DEFINITIONS} )
             list( APPEND _grib_api_png_incs ${PNG_INCLUDE_DIRS} )
@@ -85,22 +85,22 @@ if( NOT grib_api_FOUND AND NOT NO_GRIB_API_BINARIES )
         find_library(GRIB_API_LIB_F77  NAMES grib_api_f77 PATHS ${GRIB_API_PATH} ${GRIB_API_PATH}/lib     PATH_SUFFIXES grib_api  NO_DEFAULT_PATH)
         find_program(GRIB_API_INFO     NAMES grib_info  PATHS ${GRIB_API_PATH} ${GRIB_API_PATH}/bin     PATH_SUFFIXES grib_api  NO_DEFAULT_PATH)
     endif()
-    
+
     find_path(GRIB_API_INCLUDE_DIR NAMES grib_api.h PATHS PATH_SUFFIXES grib_api )
     find_library( GRIB_API_LIBRARY NAMES grib_api   PATHS PATH_SUFFIXES grib_api )
     find_library( GRIB_API_LIB_F90 NAMES grib_api_f90 PATHS PATH_SUFFIXES grib_api )
     find_library( GRIB_API_LIB_F77 NAMES grib_api_f77 PATHS PATH_SUFFIXES grib_api )
     find_program(GRIB_API_INFO     NAMES grib_info  PATHS PATH_SUFFIXES grib_api )
-    
+
     list( APPEND GRIB_API_LIBRARIES    ${GRIB_API_LIBRARY} ${GRIB_API_LIB_F90} ${GRIB_API_LIB_F77} )
     set( GRIB_API_INCLUDE_DIRS ${GRIB_API_INCLUDE_DIR} )
 
     if( GRIB_API_INFO )
-        
+
         execute_process( COMMAND ${GRIB_API_INFO} -v  OUTPUT_VARIABLE _grib_info_out ERROR_VARIABLE _grib_info_err OUTPUT_STRIP_TRAILING_WHITESPACE )
-        
-        # debug_var( _grib_info_out )
-    
+
+        # ecbuild_debug_var( _grib_info_out )
+
         string( REPLACE "." " " _version_list ${_grib_info_out} ) # dots to spaces
         separate_arguments( _version_list )
 
@@ -108,22 +108,22 @@ if( NOT grib_api_FOUND AND NOT NO_GRIB_API_BINARIES )
         list( GET _version_list 1 GRIB_API_MINOR_VERSION )
         list( GET _version_list 2 GRIB_API_PATCH_VERSION )
 
-        set( GRIB_API_VERSION     "${GRIB_API_MAJOR_VERSION}.${GRIB_API_MINOR_VERSION}.${GRIB_API_PATCH_VERSION}" ) 
+        set( GRIB_API_VERSION     "${GRIB_API_MAJOR_VERSION}.${GRIB_API_MINOR_VERSION}.${GRIB_API_PATCH_VERSION}" )
         set( GRIB_API_VERSION_STR "${_grib_info_out}" )
 
-        set( grib_api_VERSION     "${GRIB_API_VERSION}" ) 
+        set( grib_api_VERSION     "${GRIB_API_VERSION}" )
         set( grib_api_VERSION_STR "${GRIB_API_VERSION_STR}" )
 
     endif()
-    
+
     include(FindPackageHandleStandardArgs)
-    
+
     # handle the QUIETLY and REQUIRED arguments and set GRIB_API_FOUND to TRUE
     find_package_handle_standard_args( grib_api DEFAULT_MSG
                                        GRIB_API_LIBRARY GRIB_API_INCLUDE_DIR GRIB_API_INFO )
-    
+
     mark_as_advanced( GRIB_API_INCLUDE_DIR GRIB_API_LIBRARY GRIB_API_INFO )
-    
+
     list( APPEND GRIB_API_DEFINITIONS  ${_grib_api_jpg_defs} ${_grib_api_png_defs} )
     list( APPEND GRIB_API_INCLUDE_DIRS ${_grib_api_jpg_incs} ${_grib_api_png_incs} )
 	list( APPEND GRIB_API_LIBRARIES    ${_grib_api_jpg_libs} ${_grib_api_png_libs} )
diff --git a/cmake/Findodb_api.cmake b/cmake/Findodb_api.cmake
index 2b8e800..0058fbe 100644
--- a/cmake/Findodb_api.cmake
+++ b/cmake/Findodb_api.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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 cad0e33..52e0fb5 100644
--- a/cmake/Findspot.cmake
+++ b/cmake/Findspot.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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 a07bd4a..d9d8705 100644
--- a/cmake/VERSION.cmake
+++ b/cmake/VERSION.cmake
@@ -1,7 +1,7 @@
-set( ECBUILD_MAJOR_VERSION "1" )
-set( ECBUILD_MINOR_VERSION "9" )
+set( ECBUILD_MAJOR_VERSION "2" )
+set( ECBUILD_MINOR_VERSION "5" )
 set( ECBUILD_PATCH_VERSION "0" )
 
-set( ECBUILD_VERSION_STR  "1.9.0" )
+set( ECBUILD_VERSION_STR  "2.5.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
new file mode 100644
index 0000000..bc73c69
--- /dev/null
+++ b/cmake/compiler_flags/Clang_C.cmake
@@ -0,0 +1,13 @@
+# (C) Copyright 1996-2016 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.
+
+set( CMAKE_C_FLAGS_RELEASE        "-O3 -DNDEBUG"   CACHE STRING "C compiler flags for Release builds"          FORCE )
+set( CMAKE_C_FLAGS_BIT            "-O2 -DNDEBUG"   CACHE STRING "C compiler flags for Bit-reproducible builds" FORCE )
+set( CMAKE_C_FLAGS_DEBUG          "-O0 -g -ftrapv" CACHE STRING "C compiler flags for Debug builds"            FORCE )
+set( CMAKE_C_FLAGS_PRODUCTION     "-O3 -g"         CACHE STRING "C compiler flags for Production builds."      FORCE )
+set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g"         CACHE STRING "C compiler flags for RelWithDebInfo builds."  FORCE )
diff --git a/cmake/compiler_flags/Clang_CXX.cmake b/cmake/compiler_flags/Clang_CXX.cmake
new file mode 100644
index 0000000..53f0f21
--- /dev/null
+++ b/cmake/compiler_flags/Clang_CXX.cmake
@@ -0,0 +1,13 @@
+# (C) Copyright 1996-2016 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.
+
+set( CMAKE_CXX_FLAGS_RELEASE        "-O3 -DNDEBUG"   CACHE STRING "C++ compiler flags for Release builds"          FORCE )
+set( CMAKE_CXX_FLAGS_BIT            "-O2 -DNDEBUG"   CACHE STRING "C++ compiler flags for Bit-reproducible builds" FORCE )
+set( CMAKE_CXX_FLAGS_DEBUG          "-O0 -g -ftrapv" CACHE STRING "C++ compiler flags for Debug builds"            FORCE )
+set( CMAKE_CXX_FLAGS_PRODUCTION     "-O3 -g"         CACHE STRING "C++ compiler flags for Production builds."      FORCE )
+set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g"         CACHE STRING "C++ compiler flags for RelWithDebInfo builds."  FORCE )
diff --git a/cmake/compiler_flags/Cray_C.cmake b/cmake/compiler_flags/Cray_C.cmake
new file mode 100644
index 0000000..f487cf4
--- /dev/null
+++ b/cmake/compiler_flags/Cray_C.cmake
@@ -0,0 +1,13 @@
+# (C) Copyright 1996-2016 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.
+
+set( CMAKE_C_FLAGS_RELEASE        "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG"        CACHE STRING "Release C flags"                  FORCE )
+set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -hfp1 -Gfast -DNDEBUG"                     CACHE STRING "Release-with-debug-info C flags"  FORCE )
+set( CMAKE_C_FLAGS_PRODUCTION     "-O2 -hfp1 -G2"                                 CACHE STRING "Production C flags"               FORCE )
+set( CMAKE_C_FLAGS_BIT            "-O2 -hfp1 -G2 -hflex_mp=conservative -DNDEBUG" CACHE STRING "Bit-reproducible C flags"         FORCE )
+set( CMAKE_C_FLAGS_DEBUG          "-O0 -G0"                                       CACHE STRING "Debug Cflags"                     FORCE )
diff --git a/cmake/compiler_flags/Cray_CXX.cmake b/cmake/compiler_flags/Cray_CXX.cmake
new file mode 100644
index 0000000..a2a6632
--- /dev/null
+++ b/cmake/compiler_flags/Cray_CXX.cmake
@@ -0,0 +1,13 @@
+# (C) Copyright 1996-2016 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.
+
+set( CMAKE_CXX_FLAGS_RELEASE        "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG"        CACHE STRING "Release C++ flags"                 FORCE )
+set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -hfp1 -Gfast -DNDEBUG"                     CACHE STRING "Release-with-debug-info C++ flags" FORCE )
+set( CMAKE_CXX_FLAGS_PRODUCTION     "-O2 -hfp1 -G2"                                 CACHE STRING "Production C++ flags"              FORCE )
+set( CMAKE_CXX_FLAGS_BIT            "-O2 -hfp1 -G2 -hflex_mp=conservative -DNDEBUG" CACHE STRING "Bit-reproducible C++ flags"        FORCE )
+set( CMAKE_CXX_FLAGS_DEBUG          "-O0 -G0"                                       CACHE STRING "Debug CXX flags"                   FORCE )
diff --git a/cmake/compiler_flags/Cray_Fortran.cmake b/cmake/compiler_flags/Cray_Fortran.cmake
new file mode 100644
index 0000000..34b96e4
--- /dev/null
+++ b/cmake/compiler_flags/Cray_Fortran.cmake
@@ -0,0 +1,15 @@
+# (C) Copyright 1996-2016 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.
+
+# -emf activates .mods and uses lower case
+# -rmoid produces a listing file
+set( CMAKE_Fortran_FLAGS_RELEASE        "-emf -rmoid -O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG"                    CACHE STRING "Release Fortran flags"                 FORCE )
+set( CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-emf -rmoid -O2 -hfp1 -Gfast -DNDEBUG"                                 CACHE STRING "Release-with-debug-info Fortran flags" FORCE )
+set( CMAKE_Fortran_FLAGS_PRODUCTION     "-emf -rmoid -O2 -hfp1 -G2"                                             CACHE STRING "Production Fortran flags"              FORCE )
+set( CMAKE_Fortran_FLAGS_BIT            "-emf -rmoid -O2 -hfp1 -G2 -hflex_mp=conservative -hadd_paren -DNDEBUG" CACHE STRING "Bit-reproducible Fortran flags"        FORCE )
+set( CMAKE_Fortran_FLAGS_DEBUG          "-emf -rmoid -O0 -G0"                                                   CACHE STRING "Debug Fortran flags"                   FORCE )
diff --git a/cmake/compiler_flags/GNU_C.cmake b/cmake/compiler_flags/GNU_C.cmake
new file mode 100644
index 0000000..955f527
--- /dev/null
+++ b/cmake/compiler_flags/GNU_C.cmake
@@ -0,0 +1,18 @@
+# (C) Copyright 1996-2016 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.
+
+set( CMAKE_C_FLAGS_RELEASE        "-O3 -DNDEBUG"                       CACHE STRING "C compiler flags for Release builds"          FORCE )
+set( CMAKE_C_FLAGS_BIT            "-g -O2 -m64 -march=native -DNDEBUG" CACHE STRING "C compiler flags for Bit-reproducible builds" FORCE )
+set( CMAKE_C_FLAGS_DEBUG          "-O0 -g"                             CACHE STRING "C compiler flags for Debug builds"            FORCE )
+set( CMAKE_C_FLAGS_PRODUCTION     "-O2 -g"                             CACHE STRING "C compiler flags for Production builds."      FORCE )
+set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g"                             CACHE STRING "C compiler flags for RelWithDebInfo builds."  FORCE )
+
+# NOTE: gcc does not guarrante that -O3 performs better than -O2
+#       -- it can perform worse due to assembly code bloating.
+#   Moreover for gcc 4.1.2 we found that -O3 remove the parser code generated from Lex/Yacc
+#   and therefore in production mode we downgrade to -O2 if the compiler is GCC (for all versions).
diff --git a/cmake/compiler_flags/GNU_CXX.cmake b/cmake/compiler_flags/GNU_CXX.cmake
new file mode 100644
index 0000000..0ab8c3a
--- /dev/null
+++ b/cmake/compiler_flags/GNU_CXX.cmake
@@ -0,0 +1,18 @@
+# (C) Copyright 1996-2016 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.
+
+set( CMAKE_CXX_FLAGS_RELEASE        "-O3 -DNDEBUG"                       CACHE STRING "C++ compiler flags for Release builds"          FORCE )
+set( CMAKE_CXX_FLAGS_BIT            "-g -O2 -m64 -march=native -DNDEBUG" CACHE STRING "C++ compiler flags for Bit-reproducible builds" FORCE )
+set( CMAKE_CXX_FLAGS_DEBUG          "-O0 -g"                             CACHE STRING "C++ compiler flags for Debug builds"            FORCE )
+set( CMAKE_CXX_FLAGS_PRODUCTION     "-O2 -g"                             CACHE STRING "C++ compiler flags for Production builds."      FORCE )
+set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g"                             CACHE STRING "C++ compiler flags for RelWithDebInfo builds."  FORCE )
+
+# NOTE: gcc does not guarrante that -O3 performs better than -O2
+#       -- it can perform worse due to assembly code bloating.
+#   Moreover for gcc 4.1.2 we found that -O3 remove the parser code generated from Lex/Yacc
+#   and therefore in production mode we downgrade to -O2 if the compiler is GCC (for all versions).
diff --git a/cmake/compiler_flags/GNU_Fortran.cmake b/cmake/compiler_flags/GNU_Fortran.cmake
new file mode 100644
index 0000000..a12abec
--- /dev/null
+++ b/cmake/compiler_flags/GNU_Fortran.cmake
@@ -0,0 +1,21 @@
+# (C) Copyright 1996-2016 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.
+
+set( CMAKE_Fortran_FLAGS_RELEASE        "-O3 -funroll-all-loops -finline-functions"                                CACHE STRING "Fortran compiler flags for Release builds"          FORCE )
+set( CMAKE_Fortran_FLAGS_BIT            "-g -O2 -m64 -march=native -DNDEBUG -fno-range-check -fconvert=big-endian" CACHE STRING "Fortran compiler flags for Bit-reproducible builds" FORCE )
+set( CMAKE_Fortran_FLAGS_DEBUG          "-O0 -g -fcheck=bounds -fbacktrace -finit-real=snan"                       CACHE STRING "Fortran compiler flags for Debug builds"            FORCE )
+set( CMAKE_Fortran_FLAGS_PRODUCTION     "-O2 -g"                                                                   CACHE STRING "Fortran compiler flags for Production builds."      FORCE )
+set( CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-O2 -g"                                                                   CACHE STRING "Fortran compiler flags for RelWithDebInfo builds."  FORCE )
+
+####################################################################
+
+# Meaning of flags
+# ----------------
+# -fstack-arrays     : Allocate automatic arrays on the stack (needs large stacksize!!!)
+# -funroll-all-loops : Unroll all loops
+# -fcheck=bounds     : Bounds checking
diff --git a/cmake/compiler_flags/Intel_C.cmake b/cmake/compiler_flags/Intel_C.cmake
new file mode 100644
index 0000000..dbea59f
--- /dev/null
+++ b/cmake/compiler_flags/Intel_C.cmake
@@ -0,0 +1,13 @@
+# (C) Copyright 1996-2016 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.
+
+set( CMAKE_C_FLAGS_RELEASE        "-O3 -DNDEBUG"      CACHE STRING "Release C compiler flags"                  FORCE )
+set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g"            CACHE STRING "Release-with-debug-info C compiler flags"  FORCE )
+set( CMAKE_C_FLAGS_BIT            "-O2 -DNDEBUG"      CACHE STRING "Bit-reproducible C compiler flags"         FORCE )
+set( CMAKE_C_FLAGS_DEBUG          "-O0 -g -traceback" CACHE STRING "Debug C compiler flags"                    FORCE )
+set( CMAKE_C_FLAGS_PRODUCTION     "-O3 -g"            CACHE STRING "Production C compiler flags"               FORCE )
diff --git a/cmake/compiler_flags/Intel_CXX.cmake b/cmake/compiler_flags/Intel_CXX.cmake
new file mode 100644
index 0000000..5b8dc78
--- /dev/null
+++ b/cmake/compiler_flags/Intel_CXX.cmake
@@ -0,0 +1,13 @@
+# (C) Copyright 1996-2016 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.
+
+set( CMAKE_CXX_FLAGS_RELEASE        "-O3 -DNDEBUG"      CACHE STRING "Release C++ compiler flags"                 FORCE )
+set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g"            CACHE STRING "Release-with-debug-info C++ compiler flags" FORCE )
+set( CMAKE_CXX_FLAGS_BIT            "-O2 -DNDEBUG"      CACHE STRING "Bit-reproducible C++ compiler flags"        FORCE )
+set( CMAKE_CXX_FLAGS_DEBUG          "-O0 -g -traceback" CACHE STRING "Debug C++ compiler flags"                   FORCE )
+set( CMAKE_CXX_FLAGS_PRODUCTION     "-O3 -g"            CACHE STRING "Production C++ compiler flags"              FORCE )
diff --git a/cmake/compiler_flags/Intel_Fortran.cmake b/cmake/compiler_flags/Intel_Fortran.cmake
new file mode 100644
index 0000000..86b69dc
--- /dev/null
+++ b/cmake/compiler_flags/Intel_Fortran.cmake
@@ -0,0 +1,14 @@
+# (C) Copyright 1996-2016 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.
+
+set( CMAKE_Fortran_FLAGS_RELEASE        "-O3 -unroll -inline -heap-arrays"          CACHE STRING "Release Fortran flags"                 FORCE )
+set( CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-O2 -g"                                    CACHE STRING "Release-with-debug-info Fortran flags" FORCE )
+set( CMAKE_Fortran_FLAGS_BIT            "-O2 -unroll -inline -heap-arrays"          CACHE STRING "Bit-reproducible Fortran flags"        FORCE )
+# -check all implies -check bounds
+set( CMAKE_Fortran_FLAGS_DEBUG          "-O0 -g -traceback -heap-arrays -check all" CACHE STRING "Debug Fortran flags"                   FORCE )
+set( CMAKE_Fortran_FLAGS_PRODUCTION     "-O3 -g"                                    CACHE STRING "Production Fortran compiler flags"     FORCE )
diff --git a/cmake/compiler_flags/PGI_C.cmake b/cmake/compiler_flags/PGI_C.cmake
new file mode 100644
index 0000000..6784a14
--- /dev/null
+++ b/cmake/compiler_flags/PGI_C.cmake
@@ -0,0 +1,11 @@
+# (C) Copyright 1996-2016 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.
+
+set( CMAKE_C_FLAGS_RELEASE "-fast -O3 -DNDEBUG" CACHE STRING "Release C compiler flags" FORCE )
+
+set( CMAKE_C_LINK_FLAGS "" CACHE STRING "" )
diff --git a/cmake/compiler_flags/PGI_CXX.cmake b/cmake/compiler_flags/PGI_CXX.cmake
new file mode 100644
index 0000000..877ef3f
--- /dev/null
+++ b/cmake/compiler_flags/PGI_CXX.cmake
@@ -0,0 +1,11 @@
+# (C) Copyright 1996-2016 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.
+
+set( CMAKE_CXX_FLAGS_RELEASE "-fast -O3 -DNDEBUG" CACHE STRING "Release C++ compiler flags" FORCE )
+
+set( CMAKE_CXX_LINK_FLAGS "" CACHE STRING "" )
diff --git a/cmake/compiler_flags/PGI_Fortran.cmake b/cmake/compiler_flags/PGI_Fortran.cmake
new file mode 100644
index 0000000..a268cc9
--- /dev/null
+++ b/cmake/compiler_flags/PGI_Fortran.cmake
@@ -0,0 +1,11 @@
+# (C) Copyright 1996-2016 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.
+
+set( CMAKE_Fortran_FLAGS_RELEASE "-fast -O3" CACHE STRING "Release Fortran compiler flags" FORCE )
+
+set( CMAKE_Fortran_LINK_FLAGS "" CACHE STRING "" )
diff --git a/cmake/contrib/CMakeCheckCompilerFlagCommonPatterns.cmake b/cmake/contrib/CMakeCheckCompilerFlagCommonPatterns.cmake
new file mode 100644
index 0000000..1b5178d
--- /dev/null
+++ b/cmake/contrib/CMakeCheckCompilerFlagCommonPatterns.cmake
@@ -0,0 +1,33 @@
+# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+
+# Do NOT include this module directly into any of your code. It is meant as
+# a library for Check*CompilerFlag.cmake modules. It's content may change in
+# any way between releases.
+
+macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR)
+   set(${_VAR}
+     FAIL_REGEX "[Uu]nrecogni[sz]ed .*option"               # GNU, NAG
+     FAIL_REGEX "unknown .*option"                          # Clang
+     FAIL_REGEX "optimization flag .* not supported"        # Clang
+     FAIL_REGEX "unknown argument ignored"                  # Clang (cl)
+     FAIL_REGEX "ignoring unknown option"                   # MSVC, Intel
+     FAIL_REGEX "warning D9002"                             # MSVC, any lang
+     FAIL_REGEX "option.*not supported"                     # Intel
+     FAIL_REGEX "invalid argument .*option"                 # Intel
+     FAIL_REGEX "ignoring option .*argument required"       # Intel
+     FAIL_REGEX "ignoring option .*argument is of wrong type" # Intel
+     FAIL_REGEX "[Uu]nknown option"                         # HP
+     FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
+     FAIL_REGEX "command option .* is not recognized"       # XL
+     FAIL_REGEX "command option .* contains an incorrect subargument" # XL
+     FAIL_REGEX "not supported in this configuration. ignored"       # AIX
+     FAIL_REGEX "File with unknown suffix passed to linker" # PGI
+     FAIL_REGEX "[Uu]nknown switch"                         # PGI
+     FAIL_REGEX "WARNING: unknown flag:"                    # Open64
+     FAIL_REGEX "Incorrect command line option:"            # Borland
+     FAIL_REGEX "Warning: illegal option"                   # SunStudio 12
+     FAIL_REGEX "[Ww]arning: Invalid suboption"             # Fujitsu
+   )
+endmacro ()
diff --git a/cmake/contrib/CheckFortranCompilerFlag.cmake b/cmake/contrib/CheckFortranCompilerFlag.cmake
index 6a35c8e..8519fcc 100644
--- a/cmake/contrib/CheckFortranCompilerFlag.cmake
+++ b/cmake/contrib/CheckFortranCompilerFlag.cmake
@@ -1,25 +1,53 @@
-# File taken from CMake Bug Report: http://public.kitware.com/Bug/print_bug_page.php?bug_id=12459
+# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
 
-# - Check whether the Fortan compiler supports a given flag.
-# CHECK_FORTRAN_COMPILER_FLAG(<flag> <var>)
-#  <flag> - the compiler flag
-#  <var>  - variable to store the result
-# This internally calls the check_fortran_source_compiles macro.  See help
-# for CheckFortranSourceCompiles for a listing of variables that can
-# modify the build.
+#.rst:
+# CheckFortranCompilerFlag
+# ------------------------
+#
+# Check whether the Fortran compiler supports a given flag.
+#
+# CHECK_Fortran_COMPILER_FLAG(<flag> <var>)
+#
+# ::
+#
+#   <flag> - the compiler flag
+#   <var>  - variable to store the result
+#            Will be created as an internal cache variable.
+#
+# This internally calls the check_fortran_source_compiles macro and
+# sets CMAKE_REQUIRED_DEFINITIONS to <flag>.  See help for
+# CheckFortranSourceCompiles for a listing of variables that can
+# otherwise modify the build.  The result only tells that the compiler
+# does not give an error message when it encounters the flag.  If the
+# flag has any effect or even a specific one is beyond the scope of
+# this module.
 
-INCLUDE(CheckFortranSourceCompiles)
+include(CheckFortranSourceCompiles)
+include(CMakeCheckCompilerFlagCommonPatterns)
 
-MACRO (CHECK_FORTRAN_COMPILER_FLAG _FLAG _RESULT)
-   SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
-   SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
-   CHECK_FORTRAN_SOURCE_COMPILES("end" ${_RESULT}
-     # Some compilers do not fail with a bad flag
-     FAIL_REGEX "unrecognized .*option"                     # GNU
-     FAIL_REGEX "ignoring unknown option"                   # MSVC
-     FAIL_REGEX "[Uu]nknown option"                         # HP
-     FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
-     FAIL_REGEX "command option .* is not recognized"       # XL
-     )
-   SET (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
-ENDMACRO (CHECK_FORTRAN_COMPILER_FLAG)
+macro (CHECK_Fortran_COMPILER_FLAG _FLAG _RESULT)
+  set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
+  set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
+
+  # Normalize locale during test compilation.
+  set(_CheckFortranCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG)
+  foreach(v ${_CheckFortranCompilerFlag_LOCALE_VARS})
+    set(_CheckFortranCompilerFlag_SAVED_${v} "$ENV{${v}}")
+    set(ENV{${v}} C)
+  endforeach()
+  CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckFortranCompilerFlag_COMMON_PATTERNS)
+  CHECK_Fortran_SOURCE_COMPILES("       program test\n       stop\n       end program" ${_RESULT}
+    # Some compilers do not fail with a bad flag
+    FAIL_REGEX "command line option .* is valid for .* but not for Fortran" # GNU
+    ${_CheckFortranCompilerFlag_COMMON_PATTERNS}
+    )
+  foreach(v ${_CheckFortranCompilerFlag_LOCALE_VARS})
+    set(ENV{${v}} ${_CheckFortranCompilerFlag_SAVED_${v}})
+    unset(_CheckFortranCompilerFlag_SAVED_${v})
+  endforeach()
+  unset(_CheckFortranCompilerFlag_LOCALE_VARS)
+  unset(_CheckFortranCompilerFlag_COMMON_PATTERNS)
+
+  set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
+endmacro ()
diff --git a/cmake/contrib/CheckFortranSourceCompiles.cmake b/cmake/contrib/CheckFortranSourceCompiles.cmake
index 500aee6..c42254c 100644
--- a/cmake/contrib/CheckFortranSourceCompiles.cmake
+++ b/cmake/contrib/CheckFortranSourceCompiles.cmake
@@ -1,61 +1,106 @@
-# File taken from CMake Bug Report: http://public.kitware.com/Bug/print_bug_page.php?bug_id=12459
+# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
 
-# - Check if the source code provided in the SOURCE argument compiles.
-# CHECK_FORTRAN_SOURCE_COMPILES(SOURCE VAR)
-# - macro which checks if the source code compiles
-#  SOURCE   - source code to try to compile
-#  VAR      - variable to store whether the source code compiled
+#.rst:
+# CheckFortranSourceCompiles
+# --------------------------
 #
-# The following variables may be set before calling this macro to
-# modify the way the check is run:
+# Check if given Fortran source compiles and links into an executable::
 #
-#  CMAKE_REQUIRED_FLAGS = string of compile command line flags
-#  CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
-#  CMAKE_REQUIRED_INCLUDES = list of include directories
-#  CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+#   CHECK_Fortran_SOURCE_COMPILES(<code> <var> [FAIL_REGEX <fail-regex>]
+#                                 [SRC_EXT <ext>])
+#
+# The arguments are:
+#
+# ``<code>``
+#   Source code to try to compile.  It must define a PROGRAM entry point.
+# ``<var>``
+#   Variable to store whether the source code compiled.
+#   Will be created as an internal cache variable.
+# ``FAIL_REGEX <fail-regex>``
+#   Fail if test output matches this regex.
+# ``SRC_EXT <ext>``
+#   Use source extension ``.<ext>`` instead of the default ``.F``.
+#
+# The following variables may be set before calling this macro to modify
+# the way the check is run::
+#
+#   CMAKE_REQUIRED_FLAGS = string of compile command line flags
+#   CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+#   CMAKE_REQUIRED_INCLUDES = list of include directories
+#   CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+#   CMAKE_REQUIRED_QUIET = execute quietly without messages
 
-MACRO(CHECK_FORTRAN_SOURCE_COMPILES SOURCE VAR)
-  IF("${VAR}" MATCHES "^${VAR}$")
-    SET(MACRO_CHECK_FUNCTION_DEFINITIONS
+macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR)
+  if(NOT DEFINED "${VAR}")
+    set(_FAIL_REGEX)
+    set(_SRC_EXT)
+    set(_key)
+    foreach(arg ${ARGN})
+      if("${arg}" MATCHES "^(FAIL_REGEX|SRC_EXT)$")
+        set(_key "${arg}")
+      elseif(_key)
+        list(APPEND _${_key} "${arg}")
+      else()
+        message(FATAL_ERROR "Unknown argument:\n  ${arg}\n")
+      endif()
+    endforeach()
+    if(NOT _SRC_EXT)
+      set(_SRC_EXT F)
+    endif()
+    set(MACRO_CHECK_FUNCTION_DEFINITIONS
       "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
-    IF(CMAKE_REQUIRED_LIBRARIES)
-      SET(CHECK_FORTRAN_SOURCE_COMPILES_ADD_LIBRARIES
-        "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
-    ELSE(CMAKE_REQUIRED_LIBRARIES)
-      SET(CHECK_FORTRAN_SOURCE_COMPILES_ADD_LIBRARIES)
-    ENDIF(CMAKE_REQUIRED_LIBRARIES)
-    IF(CMAKE_REQUIRED_INCLUDES)
-      SET(CHECK_FORTRAN_SOURCE_COMPILES_ADD_INCLUDES
+    if(CMAKE_REQUIRED_LIBRARIES)
+      set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES
+        LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
+    else()
+      set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES)
+    endif()
+    if(CMAKE_REQUIRED_INCLUDES)
+      set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES
         "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
-    ELSE(CMAKE_REQUIRED_INCLUDES)
-      SET(CHECK_FORTRAN_SOURCE_COMPILES_ADD_INCLUDES)
-    ENDIF(CMAKE_REQUIRED_INCLUDES)
-    FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.f90"
+    else()
+      set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES)
+    endif()
+    file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}"
       "${SOURCE}\n")
 
-    MESSAGE(STATUS "Performing Test ${VAR}")
-    TRY_COMPILE(${VAR}
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Performing Test ${VAR}")
+    endif()
+    try_compile(${VAR}
       ${CMAKE_BINARY_DIR}
-      ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.f90
+      ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}
       COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+      ${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES}
       CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
-      "${CHECK_FORTRAN_SOURCE_COMPILES_ADD_LIBRARIES}"
-      "${CHECK_FORTRAN_SOURCE_COMPILES_ADD_INCLUDES}"
+      "${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}"
       OUTPUT_VARIABLE OUTPUT)
-    IF(${VAR})
-      SET(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
-      MESSAGE(STATUS "Performing Test ${VAR} - Success")
-      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
-        "Performing Fortran SOURCE FILE Test ${VAR} succeded with the following output:\n"
+
+    foreach(_regex ${_FAIL_REGEX})
+      if("${OUTPUT}" MATCHES "${_regex}")
+        set(${VAR} 0)
+      endif()
+    endforeach()
+
+    if(${VAR})
+      set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Performing Test ${VAR} - Success")
+      endif()
+      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+        "Performing Fortran SOURCE FILE Test ${VAR} succeeded with the following output:\n"
         "${OUTPUT}\n"
         "Source file was:\n${SOURCE}\n")
-    ELSE(${VAR})
-      MESSAGE(STATUS "Performing Test ${VAR} - Failed")
-      SET(${VAR} 0 CACHE INTERNAL "Test ${VAR}")
-      FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+    else()
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Performing Test ${VAR} - Failed")
+      endif()
+      set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
+      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
         "Performing Fortran SOURCE FILE Test ${VAR} failed with the following output:\n"
         "${OUTPUT}\n"
         "Source file was:\n${SOURCE}\n")
-    ENDIF(${VAR})
-  ENDIF("${VAR}" MATCHES "^${VAR}$")
-ENDMACRO(CHECK_FORTRAN_SOURCE_COMPILES)
+    endif()
+  endif()
+endmacro()
diff --git a/cmake/contrib/FindFFTW.cmake b/cmake/contrib/FindFFTW.cmake
deleted file mode 100644
index d76767b..0000000
--- a/cmake/contrib/FindFFTW.cmake
+++ /dev/null
@@ -1,152 +0,0 @@
-# - Find the FFTW library
-#
-# Usage:
-#   find_package(FFTW [REQUIRED] [QUIET] )
-#     
-# It sets the following variables:
-#   FFTW_FOUND               ... true if fftw is found on the system
-#   FFTW_LIBRARIES           ... full path to fftw library
-#   FFTW_INCLUDES            ... fftw include directory
-#
-# The following variables will be checked by the function
-#   FFTW_USE_STATIC_LIBS    ... if true, only static libraries are found
-#   FFTW_ROOT               ... if set, the libraries are exclusively searched
-#                               under this path
-#   FFTW_DIR                ... equivalent to FFTW_ROOT
-#   FFTW_PATH               ... equivalent to FFTW_ROOT
-#   FFTW_LIBRARY            ... fftw library to use
-#   FFTW_INCLUDE_DIR        ... fftw include directory
-#
-
-#============================================#
-#                                            #
-#    From Eigen3, modified by W Deconinck    #
-#                                            #
-#============================================#
-
-if( (NOT FFTW_ROOT) AND EXISTS $ENV{FFTW_ROOT} )
-  set( FFTW_ROOT ${FFTW_ROOT} )
-endif()
-if( NOT FFTW_ROOT AND $FFTW_DIR )
-  set( FFTW_ROOT ${FFTW_DIR} )
-endif()
-if( (NOT FFTW_ROOT) AND EXISTS $ENV{FFTW_DIR} )
-  set( FFTW_ROOT $ENV{FFTW_DIR} )
-endif()
-if( (NOT FFTW_ROOT) AND FFTWDIR )
-  set( FFTW_ROOT ${FFTWDIR} )
-endif()
-if( (NOT FFTW_ROOT) AND EXISTS $ENV{FFTWDIR} )
-  set( FFTW_ROOT $ENV{FFTWDIR} )
-endif()
-if( (NOT FFTW_ROOT) AND FFTW_PATH )
-  set( FFTW_ROOT ${FFTW_PATH} )
-endif()
-if( (NOT FFTW_ROOT) AND EXISTS $ENV{FFTW_PATH})
-  set( FFTW_ROOT $ENV{FFTW_PATH} )
-endif()
-
-if( FFTW_ROOT ) # On cc[a|b|t] FFTW_DIR is set to the lib directory :(
-  get_filename_component(_dirname ${FFTW_ROOT} NAME)
-  if( _dirname MATCHES "lib" )
-    set( FFTW_ROOT "${FFTW_ROOT}/.." )
-  endif()
-endif()
-
-if( NOT FFTW_ROOT )
-  # Check if we can use PkgConfig
-  find_package(PkgConfig)
-
-  #Determine from PKG
-  if( PKG_CONFIG_FOUND AND NOT FFTW_ROOT )
-    pkg_check_modules( PKG_FFTW QUIET "fftw3" )
-  endif()
-endif()
-
-#Check whether to search static or dynamic libs
-set( CMAKE_FIND_LIBRARY_SUFFIXES_SAV ${CMAKE_FIND_LIBRARY_SUFFIXES} )
-
-if( ${FFTW_USE_STATIC_LIBS} )
-  set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} )
-else()
-  set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX} )
-endif()
-
-if( FFTW_ROOT )
-
-  #find libs
-  find_library(
-    FFTW_LIB
-    NAMES "fftw3"
-    PATHS ${FFTW_ROOT}
-    PATH_SUFFIXES "lib" "lib64"
-    NO_DEFAULT_PATH
-  )
-
-  find_library(
-    FFTWF_LIB
-    NAMES "fftw3f"
-    PATHS ${FFTW_ROOT}
-    PATH_SUFFIXES "lib" "lib64"
-    NO_DEFAULT_PATH
-  )
-
-  find_library(
-    FFTWL_LIB
-    NAMES "fftw3l"
-    PATHS ${FFTW_ROOT}
-    PATH_SUFFIXES "lib" "lib64"
-    NO_DEFAULT_PATH
-  )
-
-  #find includes
-  find_path(
-    FFTW_INCLUDES
-    NAMES "fftw3.h"
-    PATHS ${FFTW_ROOT}
-    PATH_SUFFIXES "include"
-    NO_DEFAULT_PATH
-  )
-
-else()
-
-  find_library(
-    FFTW_LIB
-    NAMES "fftw3"
-    PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
-  )
-
-  find_library(
-    FFTWF_LIB
-    NAMES "fftw3f"
-    PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
-  )
-
-
-  find_library(
-    FFTWL_LIB
-    NAMES "fftw3l"
-    PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}
-  )
-
-  find_path(
-    FFTW_INCLUDES
-    NAMES "fftw3.h"
-    PATHS ${PKG_FFTW_INCLUDE_DIRS} ${INCLUDE_INSTALL_DIR}
-  )
-
-endif( FFTW_ROOT )
-
-set(FFTW_LIBRARIES ${FFTW_LIB} ${FFTWF_LIB})
-
-if(FFTWL_LIB)
-  set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTWL_LIB})
-endif()
-
-set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV} )
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(FFTW DEFAULT_MSG
-                                  FFTW_INCLUDES FFTW_LIBRARIES)
-
-mark_as_advanced(FFTW_INCLUDES FFTW_LIBRARIES FFTW_LIB FFTWF_LIB FFTWL_LIB)
\ No newline at end of file
diff --git a/cmake/contrib/FindNetCDF4.cmake b/cmake/contrib/FindNetCDF4.cmake
index 89b0337..70e54af 100644
--- a/cmake/contrib/FindNetCDF4.cmake
+++ b/cmake/contrib/FindNetCDF4.cmake
@@ -149,18 +149,21 @@ else()
     set( NETCDF_F90_INCLUDE_NAMES netcdf.mod typesizes.mod ${NETCDF_C_INCLUDE_NAMES} )
 
     set( NETCDF_C_LIBRARY_NAMES netcdf)
-    set( NETCDF_CXX_LIBRARY_NAMES netcdf_c++ ${NETCDF_C_LIBRARY_NAMES} )
+    set( NETCDF_CXX_LIBRARY_NAMES netcdf_c++ netcdf_c++4 ${NETCDF_C_LIBRARY_NAMES} )
     set( NETCDF_FORTRAN_LIBRARY_NAMES netcdff ${NETCDF_C_LIBRARY_NAMES})
     set( NETCDF_F90_LIBRARY_NAMES ${NETCDF_FORTRAN_LIBRARY_NAMES} )
 
-    set( NETCDF_REQUIRED netcdf.h netcdfcpp.h netcdf.mod typesizes.mod netcdf netcdff netcdf_c++)
+    set( NETCDF_REQUIRED netcdf.h netcdfcpp.h netcdf.mod typesizes.mod netcdf netcdff netcdf_c++ netcdf_c++4)
 
     foreach( LANGUAGE ${NETCDF_LANGUAGE_BINDINGS} )
         ecbuild_debug("FindNetCDF4: looking for ${LANGUAGE} language bindings")
+
         set( NETCDF_${LANGUAGE}_FOUND 1 ) # disable this in following if necessary
-      
+
         # find the NETCDF includes
         foreach( INC ${NETCDF_${LANGUAGE}_INCLUDE_NAMES} )
+          #ecbuild_debug( "FindNetCDF4: looking for include file ${INC}")
+
           find_path( NETCDF_${INC}_INCLUDE_DIR ${INC}
               HINTS ${NETCDF_${LANGUAGE}_INCLUDE_FLAGS}
                     ${NETCDF_ROOT} ${NETCDF_DIR} ${NETCDF_PATH} ${NETCDF4_DIR}
@@ -169,8 +172,25 @@ else()
                   include
                   Include
           )
+          if( NOT NETCDF_${INC}_INCLUDE_DIR )
+            #ecbuild_debug( "FindNetCDF4: ${INC} not found" )
+            GET_FILENAME_COMPONENT( _basename ${INC} NAME_WE )
+            GET_FILENAME_COMPONENT( _ext ${INC} EXT )
+            string( TOUPPER ${_basename} _BASENAME )
+            set( INC_MOD "${_BASENAME}${_ext}")
+            #ecbuild_debug( "FindNetCDF4:     try ${INC_MOD}" )
+            find_path( NETCDF_${INC}_INCLUDE_DIR ${INC_MOD}
+              HINTS ${NETCDF_${LANGUAGE}_INCLUDE_FLAGS}
+                    ${NETCDF_ROOT} ${NETCDF_DIR} ${NETCDF_PATH} ${NETCDF4_DIR}
+                    ENV NETCDF_ROOT ENV NETCDF_DIR ENV NETCDF_PATH ENV NETCDF4_DIR
+              PATH_SUFFIXES
+                  include
+                  Include
+            )
+          endif()
+
           mark_as_advanced( NETCDF_${INC}_INCLUDE_DIR )
-          # debug_var( NETCDF_${INC}_INCLUDE_DIR)
+          #ecbuild_debug_var( NETCDF_${INC}_INCLUDE_DIR)
           if (NETCDF_${INC}_INCLUDE_DIR)
             list( APPEND NETCDF_INCLUDE_DIRS ${NETCDF_${INC}_INCLUDE_DIR} )
           else()
@@ -178,7 +198,7 @@ else()
             if( ${location} EQUAL -1 )
               else()
               if(NETCDF_FIND_REQUIRED)
-                message( SEND_ERROR "\"${INC}\" is not found for NetCDF component ${LANGUAGE}" )
+                ecbuild_error( "\"${INC}\" is not found for NetCDF component ${LANGUAGE}" )
               elseif( NOT NETCDF_FIND_QUIETLY )
                 message( STATUS "\"${INC}\" is not found for NetCDF component ${LANGUAGE}" )
               endif()
@@ -249,19 +269,19 @@ else()
 
         # Append the libraries for this language binding to the list of all
         # required libraries.
-        
+
         if( NETCDF_${LANGUAGE}_FOUND )
             ecbuild_debug( "FindNetCDF4: ${LANGUAGE} language bindings found" )
             if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
-                list( APPEND NETCDF_${LANGUAGE}_LIBRARIES 
+                list( APPEND NETCDF_${LANGUAGE}_LIBRARIES
                     debug ${NETCDF_${LANGUAGE}_LIBRARIES_DEBUG}
                     optimized ${NETCDF_${LANGUAGE}_LIBRARIES_RELEASE} )
             else()
-                list( APPEND NETCDF_${LANGUAGE}_LIBRARIES 
-                    ${NETCDF_${LANGUAGE}_LIBRARIES_RELEASE} )                  
+                list( APPEND NETCDF_${LANGUAGE}_LIBRARIES
+                    ${NETCDF_${LANGUAGE}_LIBRARIES_RELEASE} )
             endif()
         endif()
-        # debug_var( NETCDF_${LANGUAGE}_LIBRARIES )
+        # ecbuild_debug_var( NETCDF_${LANGUAGE}_LIBRARIES )
         list( APPEND NETCDF_FOUND_REQUIRED_VARS NETCDF_${LANGUAGE}_FOUND )
     endforeach()
 
@@ -294,7 +314,10 @@ endif()
 
 set( NETCDF4_FIND_QUIETLY ${NETCDF_FIND_QUIETLY} )
 set( NETCDF4_FIND_REQUIRED ${NETCDF_FIND_REQUIRED} )
-find_package_handle_standard_args( NETCDF4 DEFAULT_MSG
+# handle the QUIET and REQUIRED arguments and set NETCDF4_FOUND to TRUE
+# if all listed variables are valid
+# Note: capitalisation of the package name must be the same as in the file name
+find_package_handle_standard_args( NetCDF4 DEFAULT_MSG
     ${NETCDF_FOUND_REQUIRED_VARS}
     NETCDF_LIBRARIES
     NETCDF_INCLUDE_DIRS
diff --git a/cmake/contrib/GetGitRevisionDescription.cmake.in b/cmake/contrib/GetGitRevisionDescription.cmake.in
index 7a3e42f..9fd3e64 100644
--- a/cmake/contrib/GetGitRevisionDescription.cmake.in
+++ b/cmake/contrib/GetGitRevisionDescription.cmake.in
@@ -33,6 +33,10 @@ else()
 endif()
 
 if(NOT HEAD_HASH)
+  if(EXISTS "@GIT_DATA@/head-ref")
     file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
     string(STRIP "${HEAD_HASH}" HEAD_HASH)
-endif()
\ No newline at end of file
+  else()
+    set(HEAD_HASH "unknown")
+  endif()
+endif()
diff --git a/cmake/contrib/GreatCMakeCookOff/AddCPP11Flags.cmake b/cmake/contrib/GreatCMakeCookOff/AddCPP11Flags.cmake
index 2a11e04..ac7f456 100644
--- a/cmake/contrib/GreatCMakeCookOff/AddCPP11Flags.cmake
+++ b/cmake/contrib/GreatCMakeCookOff/AddCPP11Flags.cmake
@@ -29,6 +29,7 @@ endif(CMAKE_VERSION VERSION_LESS 2.8.9)
 
 check_cxx_compiler_flag(-std=c++11 has_std_cpp11)
 check_cxx_compiler_flag(-std=c++0x has_std_cpp0x)
+check_cxx_compiler_flag(-hstd=c++11 has_hstd_cpp11)
 if(MINGW) 
   check_cxx_compiler_flag(-std=gnu++11 has_std_gnupp11)
   check_cxx_compiler_flag(-std=gnu++0x has_std_gnupp0x)
@@ -37,10 +38,12 @@ if(has_std_gnupp11)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
 elseif(has_std_gnupp0x)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
-elseif(has_std_cpp11) 
+elseif(has_std_cpp11)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
 elseif(has_std_cpp0x)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+elseif(has_hstd_cpp11)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -hstd=c++11")
 endif(has_std_gnupp11)
 
 if(MSVC) 
diff --git a/cmake/contrib/GreatCMakeCookOff/CheckCXX11Features.cmake b/cmake/contrib/GreatCMakeCookOff/CheckCXX11Features.cmake
index 71fa610..593b62f 100644
--- a/cmake/contrib/GreatCMakeCookOff/CheckCXX11Features.cmake
+++ b/cmake/contrib/GreatCMakeCookOff/CheckCXX11Features.cmake
@@ -1,14 +1,14 @@
 # Checks for C++11 features
-# 
+#
 # USAGE: There are two functions
 #
-# cxx11_find_all_features(OUTPUT_VARIABLE) 
+# cxx11_find_all_features(OUTPUT_VARIABLE)
 # This function returns a variable with all possible features.
 #
 # cxx11_feature_check([feature feature] [REQUIRED [feature feature]])
 # If no arguments are provided, then checks all available features
 # Features appeacing before REQUIRED are optional.
-# If arguments are provided and those features are available, sets 
+# If arguments are provided and those features are available, sets
 # the variable HAS_CXX11_FEATURENAME, where FEATURENAME is the input in capital letters.
 # Fails if required feature are not available
 #
@@ -17,65 +17,66 @@
 # Original script by Rolf Eike Beer
 # Modifications by Andreas Weis
 # Further Modifications by RSDT at UCL
+# Adapted to ecBuild by Florian Rathgeber <florian.rathgeber at ecmwf.int>
 
 set(CPP11_FEATURE_CHECK_DIR ${CMAKE_CURRENT_LIST_DIR}/cpp11 CACHE INTERNAL "c++11 file directory")
 
 MACRO(cxx11_check_single_feature FEATURE_NAME FEATURE_NUMBER RESULT_VAR)
-	IF (NOT DEFINED ${RESULT_VAR})
+  IF (NOT DEFINED ${RESULT_VAR})
     SET(_bindir "${CMAKE_BINARY_DIR}/cxx11_feature_tests/cxx11_${FEATURE_NAME}")
 
-		IF (${FEATURE_NUMBER})
+    IF (${FEATURE_NUMBER})
       SET(_SRCFILE_BASE ${CPP11_FEATURE_CHECK_DIR}/${FEATURE_NAME}-N${FEATURE_NUMBER})
-			SET(_LOG_NAME "\"${FEATURE_NAME}\" (N${FEATURE_NUMBER})")
-		ELSE (${FEATURE_NUMBER})
+      SET(_LOG_NAME "\"${FEATURE_NAME}\" (N${FEATURE_NUMBER})")
+    ELSE (${FEATURE_NUMBER})
       SET(_SRCFILE_BASE ${CPP11_FEATURE_CHECK_DIR}/${FEATURE_NAME})
-			SET(_LOG_NAME "\"${FEATURE_NAME}\"")
-		ENDIF (${FEATURE_NUMBER})
-		MESSAGE(STATUS "Checking C++11 support for ${_LOG_NAME}")
-
-		SET(_SRCFILE "${_SRCFILE_BASE}.cpp")
-		SET(_SRCFILE_FAIL "${_SRCFILE_BASE}_fail.cpp")
-		SET(_SRCFILE_FAIL_COMPILE "${_SRCFILE_BASE}_fail_compile.cpp")
-
-		IF (CROSS_COMPILING)
-			try_compile(${RESULT_VAR} "${_bindir}" "${_SRCFILE}")
-			IF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
-				try_compile(${RESULT_VAR} "${_bindir}_fail" "${_SRCFILE_FAIL}")
-			ENDIF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
-		ELSE (CROSS_COMPILING)
-			try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR
-					"${_bindir}" "${_SRCFILE}")
-			IF (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR)
-				SET(${RESULT_VAR} TRUE)
-			ELSE (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR)
-				SET(${RESULT_VAR} FALSE)
-			ENDIF (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR)
-			IF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
-				try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR
-						"${_bindir}_fail" "${_SRCFILE_FAIL}")
-				IF (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR)
-					SET(${RESULT_VAR} TRUE)
-				ELSE (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR)
-					SET(${RESULT_VAR} FALSE)
-				ENDIF (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR)
-			ENDIF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
-		ENDIF (CROSS_COMPILING)
-		IF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE})
-			try_compile(_TMP_RESULT "${_bindir}_fail_compile" "${_SRCFILE_FAIL_COMPILE}")
-			IF (_TMP_RESULT)
-				SET(${RESULT_VAR} FALSE)
-			ELSE (_TMP_RESULT)
-				SET(${RESULT_VAR} TRUE)
-			ENDIF (_TMP_RESULT)
-		ENDIF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE})
-
-		IF (${RESULT_VAR})
-			MESSAGE(STATUS "Checking C++11 support for ${_LOG_NAME} -- works")
-		ELSE (${RESULT_VAR})
-			MESSAGE(STATUS "Checking C++11 support for ${_LOG_NAME} -- not supported")
-		ENDIF (${RESULT_VAR})
-		SET(${RESULT_VAR} ${${RESULT_VAR}} CACHE INTERNAL "C++11 support for ${_LOG_NAME}")
-	ENDIF (NOT DEFINED ${RESULT_VAR})
+      SET(_LOG_NAME "\"${FEATURE_NAME}\"")
+    ENDIF (${FEATURE_NUMBER})
+    ecbuild_info("Checking C++11 support for ${_LOG_NAME}")
+
+    SET(_SRCFILE "${_SRCFILE_BASE}.cpp")
+    SET(_SRCFILE_FAIL "${_SRCFILE_BASE}_fail.cpp")
+    SET(_SRCFILE_FAIL_COMPILE "${_SRCFILE_BASE}_fail_compile.cpp")
+
+    IF (CROSS_COMPILING)
+      try_compile(${RESULT_VAR} "${_bindir}" "${_SRCFILE}")
+      IF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
+        try_compile(${RESULT_VAR} "${_bindir}_fail" "${_SRCFILE_FAIL}")
+      ENDIF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
+    ELSE (CROSS_COMPILING)
+      try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR
+          "${_bindir}" "${_SRCFILE}")
+      IF (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR)
+        SET(${RESULT_VAR} TRUE)
+      ELSE (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR)
+        SET(${RESULT_VAR} FALSE)
+      ENDIF (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR)
+      IF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
+        try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR
+            "${_bindir}_fail" "${_SRCFILE_FAIL}")
+        IF (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR)
+          SET(${RESULT_VAR} TRUE)
+        ELSE (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR)
+          SET(${RESULT_VAR} FALSE)
+        ENDIF (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR)
+      ENDIF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
+    ENDIF (CROSS_COMPILING)
+    IF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE})
+      try_compile(_TMP_RESULT "${_bindir}_fail_compile" "${_SRCFILE_FAIL_COMPILE}")
+      IF (_TMP_RESULT)
+        SET(${RESULT_VAR} FALSE)
+      ELSE (_TMP_RESULT)
+        SET(${RESULT_VAR} TRUE)
+      ENDIF (_TMP_RESULT)
+    ENDIF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE})
+
+    IF (${RESULT_VAR})
+      ecbuild_info("Checking C++11 support for ${_LOG_NAME} -- works")
+    ELSE (${RESULT_VAR})
+      ecbuild_info("Checking C++11 support for ${_LOG_NAME} -- not supported")
+    ENDIF (${RESULT_VAR})
+    SET(${RESULT_VAR} ${${RESULT_VAR}} CACHE INTERNAL "C++11 support for ${_LOG_NAME}")
+  ENDIF (NOT DEFINED ${RESULT_VAR})
 ENDMACRO(cxx11_check_single_feature)
 
 # Find list of all features
@@ -138,12 +139,12 @@ macro(_figure_out_cxx11_feature current_feature)
       list(REMOVE_ITEM ALL_FEATURE_FILES ${filename})
     endif()
   endforeach()
-  
+
   list(LENGTH ALL_FEATURE_FILES NFILES)
   if(NOT ${NFILES} EQUAL 1)
-    message(FATAL_ERROR "[c++11] Expected to find only one feature. Found ${NFILES} -- ${ALL_FEATURE_FILES}.")
+    ecbuild_critical("[c++11] Expected to find only one feature. Found ${NFILES} -- ${ALL_FEATURE_FILES}.")
   endif(NOT ${NFILES} EQUAL 1)
-  
+
   # Now we know which file corresponds to option.
   get_filename_component(basename ${ALL_FEATURE_FILES} NAME_WE)
   # If has feature number, extract it
@@ -165,18 +166,18 @@ function(cxx11_feature_check)
   # Parses input to this function.
   parse_input_features("${ALL_CPP11_FEATURES}" OPTIONALS REQUIRED ERRORS ${ARGN})
   if(NOT ${ERRORS} STREQUAL "")
-    message(STATUS "[c++11] The following features are unknown: ${ERRORS}.")
+    ecbuild_info("[c++11] The following features are unknown: ${ERRORS}.")
   endif()
 
   # MinGW has not implemented std::random_device fully yet. Unfortunately, this can only be detected
   # by running a program which tries to call std::random_device. However that generates an error that
-  # is *not* caught by CMake's try_run. 
+  # is *not* caught by CMake's try_run.
   if(MSYS)
     list(REMOVE_ITEM OPTIONALS "random_device")
     list(FIND REQUIRED "random_device" feature_was_found)
     if(NOT feature_was_found EQUAL "-1")
-      message(FATAL_ERROR "[c++1] MSYS does not implement Random devices fully.\n"
-                          "       It cannot be required on this system.")
+      ecbuild_critical("[c++1] MSYS does not implement Random devices fully.\n"
+                       "       It cannot be required on this system.")
     endif()
   endif()
 
@@ -190,7 +191,7 @@ function(cxx11_feature_check)
     _figure_out_cxx11_feature(${current_feature})
     set(VARNAME HAS_CXX11_${UPPER_OPTIONAL})
     if(NOT ${VARNAME})
-      message(FATAL_ERROR "[c++11] Required feature ${current_feature} is not available.")
+      ecbuild_critical("[c++11] Required feature ${current_feature} is not available.")
     endif(NOT ${VARNAME})
   endforeach(current_feature ${REQUIRED})
 
diff --git a/cmake/ecbuild_add_c_flags.cmake b/cmake/ecbuild_add_c_flags.cmake
index bef1d34..098c254 100644
--- a/cmake/ecbuild_add_c_flags.cmake
+++ b/cmake/ecbuild_add_c_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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,7 +16,8 @@
 #
 #   ecbuild_add_c_flags( <flag1> [ <flag2> ... ]
 #                        [ BUILD <build> ]
-#                        [ NAME <name> ] )
+#                        [ NAME <name> ]
+#                        [ NO_FAIL ] )
 #
 # Options
 # -------
@@ -27,6 +28,9 @@
 # NAME : optional
 #   name of the check (if omitted, checks are enumerated)
 #
+# NO_FAIL : optional
+#   do not fail if the flag cannot be added
+#
 ##############################################################################
 
 macro( ecbuild_add_c_flags m_c_flags )
@@ -34,47 +38,61 @@ macro( ecbuild_add_c_flags m_c_flags )
   set( _flags ${m_c_flags} )
 
   if( _flags AND CMAKE_C_COMPILER_LOADED )
-    set( options )
+    set( options NO_FAIL )
     set( single_value_args BUILD NAME )
     set( multi_value_args )
 
     cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
-    if( NOT DEFINED N_CFLAG )
-      set( N_CFLAG 0 )
+    set( _try_add_flag TRUE )
+    if( _PAR_BUILD )
+      string( TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_CAPS )
+      string( TOUPPER ${_PAR_BUILD}  _PAR_BUILD_CAPS )
+      if( NOT CMAKE_BUILD_TYPE_CAPS MATCHES "${_PAR_BUILD_CAPS}" )
+        set( _try_add_flag FALSE )
+      endif()
     endif()
+    if( _try_add_flag )
+      if( NOT DEFINED N_CFLAG )
+        set( N_CFLAG 0 )
+      endif()
 
-    math( EXPR N_CFLAG '${N_CFLAG}+1' )
+      math( EXPR N_CFLAG '${N_CFLAG}+1' )
 
-    if( NOT ECBUILD_TRUST_FLAGS )
-      if( DEFINED _PAR_NAME )
-        check_c_compiler_flag( ${_flags} ${_PAR_NAME} )
-        set( _flag_ok ${${_PAR_NAME}} )
+      if( NOT ECBUILD_TRUST_FLAGS )
+        if( DEFINED _PAR_NAME )
+          check_c_compiler_flag( ${_flags} ${_PAR_NAME} )
+          set( _flag_ok ${${_PAR_NAME}} )
+        else()
+          check_c_compiler_flag( ${_flags} C_FLAG_TEST_${N_CFLAG} )
+          set( _flag_ok ${C_FLAG_TEST_${N_CFLAG}} )
+        endif()
       else()
-        check_c_compiler_flag( ${_flags} C_FLAG_TEST_${N_CFLAG} )
-        set( _flag_ok ${C_FLAG_TEST_${N_CFLAG}} )
+        set( _flag_ok 1 )
       endif()
-    else()
-      set( _flag_ok 1 )
-    endif()
 
-    if( _flag_ok )
-      if( _PAR_BUILD )
-        set( CMAKE_C_FLAGS_${_PAR_BUILD} "${CMAKE_C_FLAGS_${_PAR_BUILD}} ${_flags}" )
-        ecbuild_debug( "C FLAG [${_flags}] added for build type ${_PAR_BUILD}" )
+      if( _flag_ok )
+        if( _PAR_BUILD )
+          set( CMAKE_C_FLAGS_${_PAR_BUILD} "${CMAKE_C_FLAGS_${_PAR_BUILD}} ${_flags}" )
+          ecbuild_debug( "C FLAG [${_flags}] added for build type ${_PAR_BUILD}" )
+        else()
+          set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flags}" )
+          ecbuild_debug( "C FLAG [${_flags}] added" )
+        endif()
+      elseif( _PAR_NO_FAIL )
+        ecbuild_info( "Unrecognised C flag [${_flags}] -- skipping" )
       else()
-        set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flags}" )
-        ecbuild_debug( "C FLAG [${_flags}] added" )
+        ecbuild_error( "Unrecognised C flag [${_flags}]" )
       endif()
-    else()
-      message( WARNING "Unrecognised C flag [${_flags}] -- skipping" )
     endif()
+    unset( _flags )
+    unset( _flag_ok )
+    unset( _try_add_flag )
   endif()
-  unset( _flags )
-  unset( _flag_ok )
+
 endmacro()
 
 macro( cmake_add_c_flags m_c_flags )
-  message( DEPRECATION " cmake_add_c_flags is deprecated, use ecbuild_add_c_flags instead." )
+  ecbuild_deprecate( " cmake_add_c_flags is deprecated, use ecbuild_add_c_flags instead." )
   ecbuild_add_c_flags( ${m_c_flags} )
 endmacro()
diff --git a/cmake/ecbuild_add_cxx11_flags.cmake b/cmake/ecbuild_add_cxx11_flags.cmake
index a4cce91..df8cde5 100644
--- a/cmake/ecbuild_add_cxx11_flags.cmake
+++ b/cmake/ecbuild_add_cxx11_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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 8393572..5104880 100644
--- a/cmake/ecbuild_add_cxx_flags.cmake
+++ b/cmake/ecbuild_add_cxx_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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,7 +16,8 @@
 #
 #   ecbuild_add_cxx_flags( <flag1> [ <flag2> ... ]
 #                          [ BUILD <build> ]
-#                          [ NAME <name> ] )
+#                          [ NAME <name> ]
+#                          [ NO_FAIL ] )
 #
 # Options
 # -------
@@ -27,54 +28,71 @@
 # NAME : optional
 #   name of the check (if omitted, checks are enumerated)
 #
+# NO_FAIL : optional
+#   do not fail if the flag cannot be added
+#
 ##############################################################################
 
 macro( ecbuild_add_cxx_flags m_cxx_flags )
 
   set( _flags ${m_cxx_flags} )
   if( _flags AND CMAKE_CXX_COMPILER_LOADED )
-    set( options )
+    set( options NO_FAIL )
     set( single_value_args BUILD NAME )
     set( multi_value_args )
 
     cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
-    if( NOT DEFINED N_CXXFLAG )
-      set( N_CXXFLAG 0 )
+    set( _try_add_flag TRUE )
+    if( _PAR_BUILD )
+      string( TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_CAPS )
+      string( TOUPPER ${_PAR_BUILD}  _PAR_BUILD_CAPS )
+      if( NOT CMAKE_BUILD_TYPE_CAPS MATCHES "${_PAR_BUILD_CAPS}" )
+        set( _try_add_flag FALSE )
+      endif()
     endif()
+    if( _try_add_flag )
 
-    math( EXPR N_CXXFLAG '${N_CXXFLAG}+1' )
+      if( NOT DEFINED N_CXXFLAG )
+        set( N_CXXFLAG 0 )
+      endif()
 
-    if( NOT ECBUILD_TRUST_FLAGS )
-      if( DEFINED _PAR_NAME )
-        check_cxx_compiler_flag( ${_flags} ${_PAR_NAME} )
-        set( _flag_ok ${${_PAR_NAME}} )
+      math( EXPR N_CXXFLAG '${N_CXXFLAG}+1' )
+
+      if( NOT ECBUILD_TRUST_FLAGS )
+        if( DEFINED _PAR_NAME )
+          check_cxx_compiler_flag( ${_flags} ${_PAR_NAME} )
+          set( _flag_ok ${${_PAR_NAME}} )
+        else()
+          check_cxx_compiler_flag( ${_flags} CXX_FLAG_TEST_${N_CXXFLAG} )
+          set( _flag_ok CXX_FLAG_TEST_${N_CXXFLAG} )
+        endif()
       else()
-        check_cxx_compiler_flag( ${_flags} CXX_FLAG_TEST_${N_CXXFLAG} )
-        set( _flag_ok CXX_FLAG_TEST_${N_CXXFLAG} )
+        set( _flag_ok 1 )
       endif()
-    else()
-      set( _flag_ok 1 )
-    endif()
 
-    if( _flag_ok )
-      if( _PAR_BUILD )
-        set( CMAKE_CXX_FLAGS_${_PAR_BUILD} "${CMAKE_CXX_FLAGS_${_PAR_BUILD}} ${_flags}" )
-        ecbuild_debug( "C++ FLAG [${_flags}] added for build type ${_PAR_BUILD}" )
+      if( _flag_ok )
+        if( _PAR_BUILD )
+          set( CMAKE_CXX_FLAGS_${_PAR_BUILD} "${CMAKE_CXX_FLAGS_${_PAR_BUILD}} ${_flags}" )
+          ecbuild_debug( "C++ FLAG [${_flags}] added for build type ${_PAR_BUILD}" )
+        else()
+          set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flags}" )
+          ecbuild_debug( "C++ FLAG [${_flags}] added" )
+        endif()
+      elseif( _PAR_NO_FAIL )
+        ecbuild_info( "Unrecognised CXX flag [${_flags}] -- skipping" )
       else()
-        set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flags}" )
-        ecbuild_debug( "C++ FLAG [${_flags}] added" )
+        ecbuild_error( "Unrecognised CXX flag [${_flags}]" )
       endif()
-    else()
-      message( STATUS "Unrecognised CXX flag [${_flags}] -- skipping" )
     endif()
+    unset( _flags )
+    unset( _flag_ok )
+    unset( _try_add_flag )
   endif()
-  unset( _flags )
-  unset( _flag_ok )
 
 endmacro()
 
 macro( cmake_add_cxx_flags m_cxx_flags )
-  message( DEPRECATION " cmake_add_cxx_flags is deprecated, use ecbuild_add_cxx_flags instead." )
+  ecbuild_deprecate( " cmake_add_cxx_flags is deprecated, use ecbuild_add_cxx_flags instead." )
   ecbuild_add_cxx_flags( ${m_cxx_flags} )
 endmacro()
diff --git a/cmake/ecbuild_add_executable.cmake b/cmake/ecbuild_add_executable.cmake
index e4e39a1..424059e 100644
--- a/cmake/ecbuild_add_executable.cmake
+++ b/cmake/ecbuild_add_executable.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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,9 @@
 #
 #   ecbuild_add_executable( TARGET <name>
 #                           SOURCES <source1> [<source2> ...]
+#                           [ SOURCES_GLOB <glob1> [<glob2> ...] ]
+#                           [ SOURCES_EXCLUDE_REGEX <regex1> [<regex2> ...] ]
+#                           [ OBJECTS <obj1> [<obj2> ...] ]
 #                           [ TEMPLATES <template1> [<template2> ...] ]
 #                           [ LIBS <library1> [<library2> ...] ]
 #                           [ INCLUDES <path1> [<path2> ...] ]
@@ -23,7 +26,7 @@
 #                           [ PERSISTENT <file1> [<file2> ...] ]
 #                           [ GENERATED <file1> [<file2> ...] ]
 #                           [ DEPENDS <target1> [<target2> ...] ]
-#                           [ CONDITION <condition1> [<condition2> ...] ]
+#                           [ CONDITION <condition> ]
 #                           [ NOINSTALL ]
 #                           [ VERSION <version> | AUTO_VERSION ]
 #                           [ CFLAGS <flag1> [<flag2> ...] ]
@@ -41,6 +44,16 @@
 # SOURCES : required
 #   list of source files
 #
+# SOURCES_GLOB : optional
+#   search pattern to find source files to compile (note: not recommend according to CMake guidelines)
+#   it is usually better to explicitly list the source files in the CMakeList.txt
+#
+# SOURCES_EXCLUDE_REGEX : optional
+#   search pattern to exclude source files from compilation, applies o the results of SOURCES_GLOB
+#
+# OBJECTS : optional
+#   list of object libraries to add to this target
+#
 # TEMPLATES : optional
 #   list of files specified as SOURCES which are not to be compiled separately
 #   (these are commonly template implementation files included in a header)
@@ -69,7 +82,7 @@
 #
 # NOINSTALL : optional
 #   do not install the executable
-# 
+#
 # VERSION : optional, AUTO_VERSION or LIBS_VERSION is used if not specified
 #   version to use as executable version
 #
@@ -85,7 +98,6 @@
 # FFLAGS : optional
 #   list of Fortran compiler flags to use for all Fortran source files
 #
-#
 # LINKER_LANGUAGE : optional
 #   sets the LINKER_LANGUAGE property on the target
 #
@@ -98,20 +110,20 @@ macro( ecbuild_add_executable )
 
   set( options NOINSTALL AUTO_VERSION )
   set( single_value_args TARGET COMPONENT LINKER_LANGUAGE VERSION OUTPUT_NAME )
-  set( multi_value_args  SOURCES TEMPLATES LIBS INCLUDES DEPENDS PERSISTENT DEFINITIONS CFLAGS CXXFLAGS FFLAGS GENERATED CONDITION )
+  set( multi_value_args  SOURCES SOURCES_GLOB SOURCES_EXCLUDE_REGEX OBJECTS TEMPLATES LIBS INCLUDES DEPENDS PERSISTENT DEFINITIONS CFLAGS CXXFLAGS FFLAGS GENERATED CONDITION )
 
   cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
   if(_PAR_UNPARSED_ARGUMENTS)
-    message(FATAL_ERROR "Unknown keywords given to ecbuild_add_executable(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+    ecbuild_critical("Unknown keywords given to ecbuild_add_executable(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
   endif()
 
   if( NOT _PAR_TARGET  )
-    message(FATAL_ERROR "The call to ecbuild_add_executable() doesn't specify the TARGET.")
+    ecbuild_critical("The call to ecbuild_add_executable() doesn't specify the TARGET.")
   endif()
 
-  if( NOT _PAR_SOURCES )
-    message(FATAL_ERROR "The call to ecbuild_add_executable() doesn't specify the SOURCES.")
+  if( NOT _PAR_SOURCES AND NOT _PAR_OBJECTS AND NOT _PAR_SOURCES_GLOB )
+    ecbuild_critical("The call to ecbuild_add_executable() specifies neither SOURCES nor OBJECTS nor SOURCES_GLOB.")
   endif()
 
   ### conditional build
@@ -130,19 +142,6 @@ macro( ecbuild_add_executable )
 
   if( _${_PAR_TARGET}_condition )
 
-    # add include dirs if defined
-    if( DEFINED _PAR_INCLUDES )
-      list(REMOVE_DUPLICATES _PAR_INCLUDES )
-      foreach( path ${_PAR_INCLUDES} ) # skip NOTFOUND
-        if( path )
-          ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): add ${path} to include_directories")
-          include_directories( ${path} )
-        else()
-          ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): ${path} not found - not adding to include_directories")
-        endif()
-      endforeach()
-    endif()
-
     # add persistent layer files
     if( DEFINED _PAR_PERSISTENT )
       if( DEFINED PERSISTENT_NAMESPACE )
@@ -159,8 +158,44 @@ macro( ecbuild_add_executable )
       add_custom_target( ${_PAR_TARGET}_templates SOURCES ${_PAR_TEMPLATES} )
     endif()
 
-    # add the executable target
-    add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} )
+    # 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}")
+    endif()
+
+    add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} ${_all_objects} )
+
+    # ecbuild_echo_target( ${_PAR_TARGET} )
+
+    # add include dirs if defined
+    if( DEFINED _PAR_INCLUDES )
+      list(REMOVE_DUPLICATES _PAR_INCLUDES )
+      foreach( path ${_PAR_INCLUDES} ) # skip NOTFOUND
+        if( path )
+          ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): add ${path} to include_directories")
+          target_include_directories( ${_PAR_TARGET} PRIVATE ${path} )
+        else()
+          ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): ${path} not found - not adding to include_directories")
+        endif()
+      endforeach()
+    endif()
 
     # set OUTPUT_NAME
 
@@ -191,25 +226,16 @@ macro( ecbuild_add_executable )
     endif()
 
     # filter sources
+
     ecbuild_separate_sources( TARGET ${_PAR_TARGET} SOURCES ${_PAR_SOURCES} )
 
-    # add local flags
-    if( DEFINED _PAR_CFLAGS )
-      ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): use C flags ${_PAR_CFLAGS}")
-      set_source_files_properties( ${${_PAR_TARGET}_c_srcs}   PROPERTIES COMPILE_FLAGS "${_PAR_CFLAGS}" )
-    endif()
-    if( DEFINED _PAR_CXXFLAGS )
-      ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): use C++ flags ${_PAR_CFLAGS}")
-      set_source_files_properties( ${${_PAR_TARGET}_cxx_srcs} PROPERTIES COMPILE_FLAGS "${_PAR_CXXFLAGS}" )
-    endif()
-    if( DEFINED _PAR_FFLAGS )
-      ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): use Fortran flags ${_PAR_CFLAGS}")
-      set_source_files_properties( ${${_PAR_TARGET}_f_srcs}   PROPERTIES COMPILE_FLAGS "${_PAR_FFLAGS}" )
-    endif()
-    if( DEFINED _PAR_GENERATED )
-      ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): mark as generated ${_PAR_GENERATED}")
-      set_source_files_properties( ${_PAR_GENERATED} PROPERTIES GENERATED 1 )
-    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}" )
 
     # define VERSION if requested
     if( DEFINED _PAR_VERSION )
@@ -222,11 +248,6 @@ macro( ecbuild_add_executable )
       endif()
     endif()
 
-    #    debug_var( ${_PAR_TARGET}_h_srcs )
-    #    debug_var( ${_PAR_TARGET}_c_srcs )
-    #    debug_var( ${_PAR_TARGET}_cxx_srcs )
-    #    debug_var( ${_PAR_TARGET}_f_srcs )
-
     # installation
 
     if( NOT _PAR_NOINSTALL )
@@ -240,7 +261,7 @@ macro( ecbuild_add_executable )
       #            endif()
 
       install( TARGETS ${_PAR_TARGET}
-               EXPORT  ${CMAKE_PROJECT_NAME}-targets
+               EXPORT  ${PROJECT_NAME}-targets
                RUNTIME DESTINATION ${INSTALL_BIN_DIR}
                LIBRARY DESTINATION ${INSTALL_LIB_DIR}
                ARCHIVE DESTINATION ${INSTALL_LIB_DIR} )
@@ -273,6 +294,13 @@ macro( ecbuild_add_executable )
     if( DEFINED _PAR_LINKER_LANGUAGE )
       ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): using linker language ${_PAR_LINKER_LANGUAGE}")
       set_property( TARGET ${_PAR_TARGET} PROPERTY LINKER_LANGUAGE ${_PAR_LINKER_LANGUAGE} )
+      if( ECBUILD_${_PAR_LINKER_LANGUAGE}_IMPLICIT_LINK_LIBRARIES )
+        target_link_libraries( ${_PAR_TARGET} ${ECBUILD_${_PAR_LINKER_LANGUAGE}_IMPLICIT_LINK_LIBRARIES} )
+      endif()
+    endif()
+
+    if( ECBUILD_IMPLICIT_LINK_LIBRARIES )
+      target_link_libraries( ${_PAR_TARGET} ${ECBUILD_IMPLICIT_LINK_LIBRARIES} )
     endif()
 
     # make sure target is removed before - some problems with AIX
diff --git a/cmake/ecbuild_add_extra_search_paths.cmake b/cmake/ecbuild_add_extra_search_paths.cmake
index fac96ba..94ac85b 100644
--- a/cmake/ecbuild_add_extra_search_paths.cmake
+++ b/cmake/ecbuild_add_extra_search_paths.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -15,10 +15,10 @@
 
 function( ecbuild_add_extra_search_paths pkg )
 
-  message( DEPRECATION " ecbuild_add_extra_search_paths modifies CMAKE_PREFIX_PATH,"
-           " which can affect future package discovery if not undone by the caller."
-           " The current CMAKE_PREFIX_PATH is being backed up as _CMAKE_PREFIX_PATH"
-           " so it can later be restored." )
+  ecbuild_deprecate( " ecbuild_add_extra_search_paths modifies CMAKE_PREFIX_PATH,"
+                     " which can affect future package discovery if not undone by the caller."
+                     " The current CMAKE_PREFIX_PATH is being backed up as _CMAKE_PREFIX_PATH"
+                     " so it can later be restored." )
 
   # Back up current CMAKE_PREFIX_PATH so the caller can reset it
   set( _CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE )
@@ -28,6 +28,6 @@ function( ecbuild_add_extra_search_paths pkg )
   ecbuild_list_extra_search_paths( ${pkg} CMAKE_PREFIX_PATH )
 
   set( CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE )
-  # debug_var( CMAKE_PREFIX_PATH )
+  # ecbuild_debug_var( CMAKE_PREFIX_PATH )
 
 endfunction()
diff --git a/cmake/ecbuild_add_fortran_flags.cmake b/cmake/ecbuild_add_fortran_flags.cmake
index f0da53f..0d3b544 100644
--- a/cmake/ecbuild_add_fortran_flags.cmake
+++ b/cmake/ecbuild_add_fortran_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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,8 @@
 #
 #   ecbuild_add_fortran_flags( <flag1> [ <flag2> ... ]
 #                              [ BUILD <build> ]
-#                              [ NAME <name> ] )
+#                              [ NAME <name> ]
+#                              [ NO_FAIL ] )
 #
 # Options
 # -------
@@ -29,6 +30,9 @@
 # NAME : optional
 #   name of the check (if omitted, checks are enumerated)
 #
+# NO_FAIL : optional
+#   do not fail if the flag cannot be added
+#
 ##############################################################################
 
 include( CheckFortranCompilerFlag )
@@ -38,49 +42,68 @@ macro( ecbuild_add_fortran_flags m_fortran_flags )
 
   if( _flags AND CMAKE_Fortran_COMPILER_LOADED )
 
-    set( options )
+    set( options NO_FAIL )
     set( single_value_args BUILD NAME )
     set( multi_value_args )
 
     cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
-    if( NOT DEFINED N_FortranFLAG )
-      set( N_FortranFLAG 0 )
+    set( _try_add_flag TRUE )
+    if( _PAR_BUILD )
+      string( TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_CAPS )
+      string( TOUPPER ${_PAR_BUILD}  _PAR_BUILD_CAPS )
+      if( NOT CMAKE_BUILD_TYPE_CAPS MATCHES "${_PAR_BUILD_CAPS}" )
+        set( _try_add_flag FALSE )
+      endif()
     endif()
 
-    math( EXPR N_FortranFLAG '${N_FortranFLAG}+1' )
+    if( _try_add_flag )
+      if( NOT DEFINED N_FortranFLAG )
+        set( N_FortranFLAG 0 )
+      endif()
+
+      math( EXPR N_FortranFLAG '${N_FortranFLAG}+1' )
 
-    if( NOT ECBUILD_TRUST_FLAGS )
-      if( DEFINED _PAR_NAME )
-        check_fortran_compiler_flag( ${_flags} ${_PAR_NAME} )
-        set( _flag_ok ${${_PAR_NAME}} )
+      if( ECBUILD_TRUST_FLAGS )
+        set( _flag_ok 1 )
+      # Due to a bug in CMake < 3.0, check_fortran_compiler_flag ALWAYS fails with ifort
+      # see https://cmake.org/Bug/view.php?id=14507
+      elseif( CMAKE_MAJOR_VERSION LESS 3 AND CMAKE_Fortran_COMPILER_ID MATCHES "Intel" )
+        set( _flag_ok 1 )
+        ecbuild_warn( "Not testing Fortran flags due to a bug in CMake < 3.0 with ifort" )
       else()
-        check_fortran_compiler_flag( ${_flags} Fortran_FLAG_TEST_${N_FortranFLAG} )
-        set( _flag_ok ${Fortran_FLAG_TEST_${N_FortranFLAG}} )
+        if( DEFINED _PAR_NAME )
+          check_fortran_compiler_flag( ${_flags} ${_PAR_NAME} )
+          set( _flag_ok ${${_PAR_NAME}} )
+        else()
+          check_fortran_compiler_flag( ${_flags} Fortran_FLAG_TEST_${N_FortranFLAG} )
+          set( _flag_ok ${Fortran_FLAG_TEST_${N_FortranFLAG}} )
+        endif()
       endif()
-    else()
-      set( _flag_ok 1 )
-    endif()
 
-    if( _flag_ok )
-      if( _PAR_BUILD )
-        set( CMAKE_Fortran_FLAGS_${_PAR_BUILD} "${CMAKE_Fortran_FLAGS_${_PAR_BUILD}} ${_flags}" )
-        ecbuild_debug( "Fortran FLAG [${_flags}] added for build type ${_PAR_BUILD}" )
+      if( _flag_ok )
+        if( _PAR_BUILD )
+          set( CMAKE_Fortran_FLAGS_${_PAR_BUILD} "${CMAKE_Fortran_FLAGS_${_PAR_BUILD}} ${_flags}" )
+          ecbuild_debug( "Fortran FLAG [${_flags}] added for build type ${_PAR_BUILD}" )
+        else()
+          set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${_flags}" )
+          ecbuild_debug( "Fortran FLAG [${_flags}] added" )
+        endif()
+      elseif( _PAR_NO_FAIL )
+        ecbuild_info( "Unrecognised Fortran flag [${_flags}] -- skipping" )
       else()
-        set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${_flags}" )
-        ecbuild_debug( "Fortran FLAG [${_flags}] added" )
+        ecbuild_error( "Unrecognised Fortran flag [${_flags}]" )
       endif()
-    else()
-      message( STATUS "Unrecognised Fortran flag [${_flags}] -- skipping" )
     endif()
-  endif()
 
-  unset( _flags )
-  unset( _flag_ok )
+    unset( _flags )
+    unset( _flag_ok )
+    unset( _try_add_flag )
+  endif()
 
 endmacro()
 
 macro( cmake_add_fortran_flags m_fortran_flags )
-  message( DEPRECATION " cmake_add_fortran_flags is deprecated, use ecbuild_add_fortran_flags instead." )
+  ecbuild_deprecate( " cmake_add_fortran_flags is deprecated, use ecbuild_add_fortran_flags instead." )
   ecbuild_add_fortran_flags( ${m_fortran_flags} )
 endmacro()
diff --git a/cmake/ecbuild_add_library.cmake b/cmake/ecbuild_add_library.cmake
index dc47956..a7f8001 100644
--- a/cmake/ecbuild_add_library.cmake
+++ b/cmake/ecbuild_add_library.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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,7 +16,10 @@
 #
 #   ecbuild_add_library( TARGET <name>
 #                        SOURCES <source1> [<source2> ...]
-#                        [ TYPE SHARED|STATIC|MODULE ]
+#                        [ SOURCES_GLOB <glob1> [<glob2> ...] ]
+#                        [ SOURCES_EXCLUDE_REGEX <regex1> [<regex2> ...] ]
+#                        [ TYPE SHARED|STATIC|MODULE|OBJECT ]
+#                        [ OBJECTS <obj1> [<obj2> ...] ]
 #                        [ TEMPLATES <template1> [<template2> ...] ]
 #                        [ LIBS <library1> [<library2> ...] ]
 #                        [ INCLUDES <path1> [<path2> ...] ]
@@ -26,13 +29,14 @@
 #                        [ PERSISTENT <file1> [<file2> ...] ]
 #                        [ GENERATED <file1> [<file2> ...] ]
 #                        [ DEPENDS <target1> [<target2> ...] ]
-#                        [ CONDITION <condition1> [<condition2> ...] ]
+#                        [ CONDITION <condition> ]
 #                        [ NOINSTALL ]
 #                        [ HEADER_DESTINATION <path> ]
 #                        [ INSTALL_HEADERS LISTED|ALL ]
 #                        [ 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> ...] ]
@@ -55,6 +59,17 @@
 #   :STATIC: archives of object files for use when linking other targets.
 #   :MODULE: plugins that are not linked into other targets but may be loaded
 #            dynamically at runtime using dlopen-like functionality
+#   :OBJECT: files are just compiled into objects
+#
+# SOURCES_GLOB : optional
+#   search pattern to find source files to compile (note: not recommend according to CMake guidelines)
+#   it is usually better to explicitly list the source files in the CMakeList.txt
+#
+# SOURCES_EXCLUDE_REGEX : optional
+#   search pattern to exclude source files from compilation, applies o the results of SOURCES_GLOB
+#
+# OBJECTS : optional
+#   list of object libraries to add to this target
 #
 # TEMPLATES : optional
 #   list of files specified as SOURCES which are not to be compiled separately
@@ -109,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
@@ -133,22 +154,22 @@
 
 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( multi_value_args  SOURCES TEMPLATES LIBS INCLUDES PRIVATE_INCLUDES PUBLIC_INCLUDES DEPENDS PERSISTENT DEFINITIONS INSTALL_HEADERS_LIST CFLAGS CXXFLAGS FFLAGS GENERATED CONDITION )
+  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} )
 
   if(_PAR_UNPARSED_ARGUMENTS)
-    message(FATAL_ERROR "Unknown keywords given to ecbuild_add_library(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+    ecbuild_critical("Unknown keywords given to ecbuild_add_library(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
   endif()
 
   if( NOT _PAR_TARGET  )
-    message(FATAL_ERROR "The call to ecbuild_add_library() doesn't specify the TARGET.")
+    ecbuild_critical("The call to ecbuild_add_library() doesn't specify the TARGET.")
   endif()
 
-  if( NOT _PAR_SOURCES )
-    message(FATAL_ERROR "The call to ecbuild_add_library() doesn't specify the SOURCES.")
+  if( NOT _PAR_SOURCES AND NOT _PAR_OBJECTS AND NOT _PAR_SOURCES_GLOB )
+    ecbuild_critical("The call to ecbuild_add_library() specifies neither SOURCES nor OBJECTS nor SOURCES_GLOB")
   endif()
 
   ### conditional build
@@ -172,8 +193,9 @@ function( ecbuild_add_library_impl )
       # checks that is either SHARED or STATIC or MODULE
       if( NOT _PAR_TYPE MATCHES "STATIC" AND
           NOT _PAR_TYPE MATCHES "SHARED" AND
+          NOT _PAR_TYPE MATCHES "OBJECT" AND
           NOT _PAR_TYPE MATCHES "MODULE" )
-        message( FATAL_ERROR "library type must be one of [ STATIC | SHARED | MODULE ]" )
+        ecbuild_critical( "library type must be one of [ STATIC | SHARED | MODULE | OBJECT ]" )
       endif()
       ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): library type is ${_PAR_TYPE}")
     endif()
@@ -195,7 +217,31 @@ function( ecbuild_add_library_impl )
       add_custom_target( ${_PAR_TARGET}_templates SOURCES ${_PAR_TEMPLATES} )
     endif()
 
-    add_library( ${_PAR_TARGET} ${_PAR_TYPE} ${_PAR_SOURCES} )
+    # 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}")
+    endif()
+
+    add_library( ${_PAR_TARGET} ${_PAR_TYPE} ${_PAR_SOURCES}  ${_all_objects} )
+
+    # ecbuild_echo_target( ${_PAR_TARGET} )
 
     # set OUTPUT_NAME
 
@@ -291,42 +337,46 @@ 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()
 
+    # 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()
+
     # filter sources
 
-    ecbuild_separate_sources( TARGET ${_PAR_TARGET} SOURCES ${_PAR_SOURCES} )
+    if( _PAR_SOURCES )
+      ecbuild_separate_sources( TARGET ${_PAR_TARGET} SOURCES ${_PAR_SOURCES} )
+    endif()
 
-    #   debug_var( ${_PAR_TARGET}_h_srcs )
-    #   debug_var( ${_PAR_TARGET}_c_srcs )
-    #   debug_var( ${_PAR_TARGET}_cxx_srcs )
-    #   debug_var( ${_PAR_TARGET}_f_srcs )
+    #   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 )
 
-    # add local flags
+    # Override compilation flags on a per source file basis
+    ecbuild_target_flags( ${_PAR_TARGET} "${_PAR_CFLAGS}" "${_PAR_CXXFLAGS}" "${_PAR_FFLAGS}" )
 
-    if( DEFINED _PAR_CFLAGS )
-      ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): use C flags ${_PAR_CFLAGS}")
-      set_source_files_properties( ${${_PAR_TARGET}_c_srcs}   PROPERTIES COMPILE_FLAGS "${_PAR_CFLAGS}" )
-    endif()
-    if( DEFINED _PAR_CXXFLAGS )
-      ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): use C++ flags ${_PAR_CFLAGS}")
-      set_source_files_properties( ${${_PAR_TARGET}_cxx_srcs} PROPERTIES COMPILE_FLAGS "${_PAR_CXXFLAGS}" )
-    endif()
-    if( DEFINED _PAR_FFLAGS )
-      ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): use Fortran flags ${_PAR_CFLAGS}")
-      set_source_files_properties( ${${_PAR_TARGET}_f_srcs}   PROPERTIES COMPILE_FLAGS "${_PAR_FFLAGS}" )
-    endif()
     if( DEFINED _PAR_GENERATED )
       ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): mark as generated ${_PAR_GENERATED}")
       set_source_files_properties( ${_PAR_GENERATED} PROPERTIES GENERATED 1 )
@@ -336,11 +386,18 @@ function( ecbuild_add_library_impl )
     if( DEFINED _PAR_LINKER_LANGUAGE )
       ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): using linker language ${_PAR_LINKER_LANGUAGE}")
       set_property( TARGET ${_PAR_TARGET} PROPERTY LINKER_LANGUAGE ${_PAR_LINKER_LANGUAGE} )
+      if( ECBUILD_${_PAR_LINKER_LANGUAGE}_IMPLICIT_LINK_LIBRARIES )
+        target_link_libraries( ${_PAR_TARGET} ${ECBUILD_${_PAR_LINKER_LANGUAGE}_IMPLICIT_LINK_LIBRARIES} )
+      endif()
     endif()
 
-    # installation
+    if( ECBUILD_IMPLICIT_LINK_LIBRARIES )
+      target_link_libraries( ${_PAR_TARGET} ${ECBUILD_IMPLICIT_LINK_LIBRARIES} )
+    endif()
 
-    if( NOT _PAR_NOINSTALL )
+    # installation (except for OBJECT libraries)
+
+    if( NOT _PAR_NOINSTALL AND NOT _PAR_TYPE MATCHES "OBJECT" )
       ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): installing to ${INSTALL_LIB_DIR}")
 
       # and associate with defined component
@@ -351,7 +408,7 @@ function( ecbuild_add_library_impl )
       #            endif()
 
       install( TARGETS ${_PAR_TARGET}
-        EXPORT  ${CMAKE_PROJECT_NAME}-targets
+        EXPORT  ${PROJECT_NAME}-targets
         RUNTIME DESTINATION ${INSTALL_BIN_DIR}
         LIBRARY DESTINATION ${INSTALL_LIB_DIR}
         ARCHIVE DESTINATION ${INSTALL_LIB_DIR} )
@@ -421,7 +478,9 @@ function( ecbuild_add_library_impl )
     endif()
 
     # make sure target is removed before - some problems with AIX
-    add_custom_command( TARGET ${_PAR_TARGET} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E remove $<TARGET_FILE:${_PAR_TARGET}> )
+    if( NOT _PAR_TYPE MATCHES "OBJECT" )
+      add_custom_command( TARGET ${_PAR_TARGET} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E remove $<TARGET_FILE:${_PAR_TARGET}> )
+    endif()
 
     # for the links target
     if( NOT _PAR_NOINSTALL )
@@ -469,7 +528,7 @@ macro( ecbuild_add_library )
   else()
 
     if( NOT DEFINED _p_TARGET )
-      message(FATAL_ERROR "The call to ecbuild_add_library() doesn't specify the TARGET.")
+      ecbuild_critical("The call to ecbuild_add_library() doesn't specify the TARGET.")
     else()
 
       if( BUILD_SHARED_LIBS MATCHES "[Bb][Oo][Tt][Hh]" ) # build both types
diff --git a/cmake/ecbuild_add_option.cmake b/cmake/ecbuild_add_option.cmake
index 7728716..fd8076e 100644
--- a/cmake/ecbuild_add_option.cmake
+++ b/cmake/ecbuild_add_option.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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,9 +17,10 @@
 #   ecbuild_add_option( FEATURE <name>
 #                       [ DEFAULT ON|OFF ]
 #                       [ DESCRIPTION <description> ]
+#                       [ PURPOSE <purpose> ]
 #                       [ REQUIRED_PACKAGES <package1> [<package2> ...] ]
-#                       [ CONDITION <condition1> [<condition2> ...] ]
-#                       [ ADVANCED ] )
+#                       [ CONDITION <condition> ]
+#                       [ ADVANCED ] [ NO_TPL ] )
 #
 # Options
 # -------
@@ -33,18 +34,30 @@
 # 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
 #
-#   The package specification can be either ::
+#   The package specification can have one of two forms. Either ::
+#
+#     "<package> [ <version> ... ]"
 #
-#     <package> [ <version> ... ]
+#   to search for a given package using the CMake ``find_package`` mechanism.
+#   The entire specification must be enclosed in quotes and is passed on
+#   verbatim. Any options of ``find_package`` are supported.
 #
-#   to search for a given package with option minimum required version or ::
+#   The other specification must start with ``PROJECT`` like this ::
 #
-#     PROJECT <name> [ VERSION <version> ... ]
+#     "PROJECT <name> [ VERSION <version> ... ]"
 #
-#   to search for an ecBuild project with optional minimum required version.
+#   and is used to search for an ecBuild project via ``ecbuild_use_package``.
+#   The entire specification must be enclosed in quotes and is passed on
+#   verbatim. Any options of ``ecbuild_use_package`` are supported.
 #
 # CONDITION : optional
 #   conditional expression which must evaluate to true for this option to be
@@ -53,6 +66,9 @@
 # ADVANCED : optional
 #   mark the feature as advanced
 #
+# NO_TPL : optional
+#   do not add any ``REQUIRED_PACKAGES`` to the list of third party libraries
+#
 # Usage
 # -----
 #
@@ -71,20 +87,20 @@
 
 macro( ecbuild_add_option )
 
-  set( options ADVANCED )
-  set( single_value_args FEATURE DEFAULT DESCRIPTION )
+  set( options ADVANCED NO_TPL )
+  set( single_value_args FEATURE DEFAULT DESCRIPTION TYPE PURPOSE )
   set( multi_value_args  REQUIRED_PACKAGES CONDITION )
 
   cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
   if( _p_UNPARSED_ARGUMENTS )
-    message(FATAL_ERROR "Unknown keywords given to ecbuild_add_option(): \"${_p_UNPARSED_ARGUMENTS}\"")
+    ecbuild_critical("Unknown keywords given to ecbuild_add_option(): \"${_p_UNPARSED_ARGUMENTS}\"")
   endif()
 
   # check FEATURE parameter
 
   if( NOT _p_FEATURE  )
-    message(FATAL_ERROR "The call to ecbuild_add_option() doesn't specify the FEATURE.")
+    ecbuild_critical("The call to ecbuild_add_option() doesn't specify the FEATURE.")
   endif()
 
   # check DEFAULT parameter
@@ -93,11 +109,15 @@ macro( ecbuild_add_option )
     set( _p_DEFAULT ON )
   else()
     if( NOT _p_DEFAULT MATCHES "[Oo][Nn]" AND NOT _p_DEFAULT MATCHES "[Oo][Ff][Ff]" )
-      message(FATAL_ERROR "In macro ecbuild_add_option(), DEFAULT is either ON or OFF: \"${_p_DEFAULT}\"")
+      ecbuild_critical("In macro ecbuild_add_option(), DEFAULT is either ON or OFF: \"${_p_DEFAULT}\"")
     endif()
   endif()
   ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): defaults to ${_p_DEFAULT}")
 
+  if( NOT _p_TYPE  )
+    set( _p_TYPE OPTIONAL )
+  endif()
+
   # check CONDITION parameter
   if( DEFINED _p_CONDITION )
     set(_feature_condition_file "${CMAKE_CURRENT_BINARY_DIR}/set_${_p_FEATURE}_condition.cmake")
@@ -112,17 +132,16 @@ macro( ecbuild_add_option )
     set( _${_p_FEATURE}_condition TRUE )
   endif()
 
-  # check if user provided value
-
-  get_property( _in_cache CACHE ENABLE_${_p_FEATURE} PROPERTY VALUE )
+  # Check if user explicitly enabled/disabled the feature in cache
+  get_property( _in_cache CACHE ENABLE_${_p_FEATURE} PROPERTY VALUE SET )
 
   # A feature set to REQUIRE is always treated as explicitly enabled
   if( ENABLE_${_p_FEATURE} MATCHES "REQUIRE" )
     set( ENABLE_${_p_FEATURE} ON CACHE BOOL "" FORCE )
     ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ENABLE_${_p_FEATURE} was required")
     set( ${_p_FEATURE}_user_provided_input 1 CACHE BOOL "" FORCE )
-  elseif( NOT "${ENABLE_${_p_FEATURE}}" STREQUAL "" AND _in_cache )
-    ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ENABLE_${_p_FEATURE} was found in cache")
+  elseif( NOT ENABLE_${_p_FEATURE} STREQUAL "" AND _in_cache )
+    ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ENABLE_${_p_FEATURE}=${ENABLE_${_p_FEATURE}} was found in cache")
     set( ${_p_FEATURE}_user_provided_input 1 CACHE BOOL "" )
   else()
     ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ENABLE_${_p_FEATURE} not found in cache")
@@ -135,15 +154,16 @@ macro( ecbuild_add_option )
   # define the option -- for cmake GUI
 
   option( ENABLE_${_p_FEATURE} "${_p_DESCRIPTION}" ${_p_DEFAULT} )
-  ecbuild_set_feature( ${_p_FEATURE} ENABLED ${_p_DEFAULT} PURPOSE "${_p_DESCRIPTION}" )
+  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}" )
 
-  ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ENABLE_${_p_FEATURE} = ${ENABLE_${_p_FEATURE}}")
-  set( _do_search ${ENABLE_${_p_FEATURE}} )
-  if( _p_FEATURE STREQUAL "OMP" )
-    set( _do_search TRUE )
-  endif()
+  ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ENABLE_${_p_FEATURE}=${ENABLE_${_p_FEATURE}}")
 
-  if( _do_search  )
+  if( ENABLE_${_p_FEATURE} )
     ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): feature enabled")
 
     set( HAVE_${_p_FEATURE} 1 )
@@ -167,13 +187,14 @@ macro( ecbuild_add_option )
           set( pkgproject 0 )
         endif()
 
-        # debug_var( pkg )
-        # debug_var( pkglist )
-        # debug_var( pkgname )
+        # ecbuild_debug_var( pkg )
+        # ecbuild_debug_var( pkglist )
+        # ecbuild_debug_var( pkgname )
 
         string( TOUPPER ${pkgname} pkgUPPER )
         string( TOLOWER ${pkgname} pkgLOWER )
 
+        set( __help_msg "Provide ${pkgname} location with -D${pkgUPPER}_PATH=/..." )
         if( ${pkgname}_FOUND OR ${pkgUPPER}_FOUND OR ${pkgLOWER}_FOUND )
 
           ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ${pkgname} has already been found")
@@ -183,7 +204,7 @@ macro( ecbuild_add_option )
 
           if( pkgproject )
 
-            ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for ecbuild project ${pkgname}")
+            ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for ecbuild project ${pkgname} - ecbuild_use_package( ${pkglist} )")
             ecbuild_use_package( ${pkglist} )
 
           else()
@@ -191,7 +212,7 @@ macro( ecbuild_add_option )
             if( pkgname STREQUAL "MPI" )
               set( _find_args ${pkglist} )
               list( REMOVE_ITEM _find_args "MPI" )
-              ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for MPI")
+              ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for MPI - ecbuild_find_mpi( ${_find_args} )")
               ecbuild_find_mpi( ${_find_args} )
             elseif( pkgname STREQUAL "OMP" )
               set( _find_args ${pkglist} )
@@ -199,15 +220,21 @@ macro( ecbuild_add_option )
               if( NOT ENABLE_${_p_FEATURE} )
                 list( APPEND _find_args STUBS )
               endif()
-              ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for OpenMP")
+              ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for OpenMP - ecbuild_find_omp( ${_find_args} )")
               ecbuild_find_omp( ${_find_args} )
             elseif( pkgname STREQUAL "Python" OR pkgname STREQUAL "PYTHON" )
               set( _find_args ${pkglist} )
               list( REMOVE_ITEM _find_args ${pkgname} )
-              ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for Python")
+              ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for Python - ecbuild_find_python( ${_find_args} )")
               ecbuild_find_python( ${_find_args} )
+              set( __help_msg "Specify the location of the Python interpreter with -DPYTHON_EXECUTABLE=/..." )
+            elseif( pkgname STREQUAL "LEXYACC" )
+              set( _find_args ${pkglist} )
+              list( REMOVE_ITEM _find_args ${pkgname} )
+              ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for lex-yacc - ecbuild_find_lexyacc( ${_find_args} )")
+              ecbuild_find_lexyacc( ${_find_args} )
             else()
-              ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for package ${pkgname}")
+              ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): searching for package ${pkgname} - find_package( ${pkglist} )")
               find_package( ${pkglist} )
             endif()
 
@@ -215,24 +242,25 @@ macro( ecbuild_add_option )
 
         endif()
 
-        # if found append to list of third-party libraries (to be forward to other packages )
-        if( ${pkgname}_FOUND OR ${pkgUPPER}_FOUND OR ${pkgLOWER}_FOUND )
-
-          list( APPEND ${PROJECT_NAME_CAPS}_TPLS ${pkgname} )
-          list( REMOVE_DUPLICATES ${PROJECT_NAME_CAPS}_TPLS )
-
-        endif()
-
-        # debug_var( ${pkgname}_FOUND  )
-        # debug_var( ${pkgLOWER}_FOUND )
-        # debug_var( ${pkgUPPER}_FOUND )
+        # ecbuild_debug_var( ${pkgname}_FOUND  )
+        # ecbuild_debug_var( ${pkgLOWER}_FOUND )
+        # ecbuild_debug_var( ${pkgUPPER}_FOUND )
 
         # we have feature if all required packages were FOUND
 
         if( ${pkgname}_FOUND OR ${pkgUPPER}_FOUND OR ${pkgLOWER}_FOUND )
-          message( STATUS "Found package ${pkgname} required for feature ${_p_FEATURE}" )
+          ecbuild_info( "Found package ${pkgname} required for feature ${_p_FEATURE}" )
+
+          # append to list of third-party libraries (to be forward to other packages )
+          # unless the NO_TPL option was given
+          if( NOT _p_NO_TPL )
+            ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): appending ${pkgname} to ${PROJECT_NAME_CAPS}_TPLS")
+            list( APPEND ${PROJECT_NAME_CAPS}_TPLS ${pkgname} )
+            list( REMOVE_DUPLICATES ${PROJECT_NAME_CAPS}_TPLS )
+          endif()
+
         else()
-          message( STATUS "Could not find package ${pkgname} required for feature ${_p_FEATURE} -- Provide ${pkgname} location with -D${pkgUPPER}_PATH=/..." )
+          ecbuild_info( "Could NOT find package ${pkgname} required for feature ${_p_FEATURE} -- ${__help_msg}" )
           set( HAVE_${_p_FEATURE} 0 )
           list( APPEND _failed_to_find_packages ${pkgname} )
         endif()
@@ -247,21 +275,23 @@ macro( ecbuild_add_option )
 
     if( HAVE_${_p_FEATURE} )
 
-      message( STATUS "Feature ${_p_FEATURE} enabled" )
+      ecbuild_info( "Feature ${_p_FEATURE} enabled" )
 
     else() # if user provided input and we cannot satisfy FAIL otherwise WARN
 
       if( ${_p_FEATURE}_user_provided_input )
-        if( _${_p_FEATURE}_condition )
-          message( FATAL_ERROR "Feature ${_p_FEATURE} cannot be enabled -- following required packages weren't found: ${_failed_to_find_packages}" )
+        if( NOT _${_p_FEATURE}_condition )
+          string(REPLACE ";" " " _condition_msg "${_p_CONDITION}")
+          ecbuild_critical( "Feature ${_p_FEATURE} cannot be enabled -- following condition was not met: ${_condition_msg}" )
         else()
-          message( FATAL_ERROR "Feature ${_p_FEATURE} cannot be enabled -- following condition was not met: ${_p_CONDITION}" )
+          ecbuild_critical( "Feature ${_p_FEATURE} cannot be enabled -- following required packages weren't found: ${_failed_to_find_packages}" )
         endif()
       else()
-        if( _${_p_FEATURE}_condition )
-          message( STATUS "Feature ${_p_FEATURE} was not enabled (also not requested) -- following condition was not met: ${_p_CONDITION}" )
+        if( NOT _${_p_FEATURE}_condition )
+          string(REPLACE ";" " " _condition_msg "${_p_CONDITION}")
+          ecbuild_info( "Feature ${_p_FEATURE} was not enabled (also not requested) -- following condition was not met: ${_condition_msg}" )
         else()
-          message( STATUS "Feature ${_p_FEATURE} was not enabled (also not requested) -- following required packages weren't found: ${_failed_to_find_packages}" )
+          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 )
@@ -269,13 +299,13 @@ macro( ecbuild_add_option )
 
     endif()
 
-  else( _do_search )
+  else()
 
     ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): feature disabled")
     set( HAVE_${_p_FEATURE} 0 )
     ecbuild_set_feature( ${_p_FEATURE} ENABLED OFF )
 
-  endif( _do_search )
+  endif()
 
 
   if( ${_p_ADVANCED} )
diff --git a/cmake/ecbuild_add_persistent.cmake b/cmake/ecbuild_add_persistent.cmake
index 96c160d..42bb44b 100644
--- a/cmake/ecbuild_add_persistent.cmake
+++ b/cmake/ecbuild_add_persistent.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
-# 
+# (C) Copyright 1996-2016 ECMWF.
+#
 # This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 
-# In applying this licence, ECMWF does not waive the privileges and immunities 
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
 # granted to it by virtue of its status as an intergovernmental organisation nor
 # does it submit to any jurisdiction.
 
@@ -34,7 +34,7 @@
 #   C++ namespace to place the persistent class information in
 #
 ##############################################################################
-  
+
 # define the script to build the persistent class information
 set( sg_perl "${CMAKE_CURRENT_LIST_DIR}/sg.pl" CACHE INTERNAL "perl script to generate persistent objects" )
 
@@ -44,20 +44,20 @@ macro( ecbuild_add_persistent )
 
   set( options )
   set( single_value_args SRC_LIST NAMESPACE )
-  set( multi_value_args  FILES ) 
+  set( multi_value_args  FILES )
 
   cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
   if(_PAR_UNPARSED_ARGUMENTS)
-    message(FATAL_ERROR "Unknown keywords given to ecbuild_add_persistent(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+    ecbuild_critical("Unknown keywords given to ecbuild_add_persistent(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
   endif()
 
   if( NOT _PAR_SRC_LIST  )
-    message(FATAL_ERROR "The call to ecbuild_add_persistent() doesn't specify the SRC_LIST.")
+    ecbuild_critical("The call to ecbuild_add_persistent() doesn't specify the SRC_LIST.")
   endif()
 
   if( NOT _PAR_FILES )
-    message(FATAL_ERROR "The call to ecbuild_add_persistent() doesn't specify the FILES.")
+    ecbuild_critical("The call to ecbuild_add_persistent() doesn't specify the FILES.")
   endif()
 
   foreach( file ${_PAR_FILES} )
@@ -71,7 +71,7 @@ macro( ecbuild_add_persistent )
       set( file ${_file_dir}/${_file_we} )
     endif()
 
-    # debug_var(file)
+    # ecbuild_debug_var(file)
 
     add_custom_command( OUTPUT  ${file}.b
                         COMMAND ${PERL_EXECUTABLE} ${sg_perl} ${CMAKE_CURRENT_SOURCE_DIR}/${file}.h
diff --git a/cmake/ecbuild_add_resources.cmake b/cmake/ecbuild_add_resources.cmake
index da6e55a..cf0543b 100644
--- a/cmake/ecbuild_add_resources.cmake
+++ b/cmake/ecbuild_add_resources.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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,11 +62,11 @@ macro( ecbuild_add_resources )
     cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
     if(_PAR_UNPARSED_ARGUMENTS)
-      message(FATAL_ERROR "Unknown keywords given to ecbuild_add_resources(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+      ecbuild_critical("Unknown keywords given to ecbuild_add_resources(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
     endif()
 
     if( NOT _PAR_TARGET  )
-      message(FATAL_ERROR "The call to ecbuild_add_resources() doesn't specify the TARGET.")
+      ecbuild_critical("The call to ecbuild_add_resources() doesn't specify the TARGET.")
     endif()
 
     set( LOCAL_FILES_NOT_TO_PACK "" )
diff --git a/cmake/ecbuild_add_test.cmake b/cmake/ecbuild_add_test.cmake
index 6ae839a..1dcf2c6 100644
--- a/cmake/ecbuild_add_test.cmake
+++ b/cmake/ecbuild_add_test.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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,13 +16,16 @@
 #
 #   ecbuild_add_test( [ TARGET <name> ]
 #                     [ SOURCES <source1> [<source2> ...] ]
+#                     [ OBJECTS <obj1> [<obj2> ...] ]
 #                     [ COMMAND <executable> ]
 #                     [ TYPE EXE|SCRIPT|PYTHON ]
+#                     [ LABELS <label1> [<label2> ...] ]
 #                     [ ARGS <argument1> [<argument2> ...] ]
 #                     [ RESOURCES <file1> [<file2> ...] ]
 #                     [ TEST_DATA <file1> [<file2> ...] ]
 #                     [ BOOST ]
-#                     [ MPI <number-of-ranks> ]
+#                     [ MPI <number-of-mpi-tasks> ]
+#                     [ OMP <number-of-threads-per-mpi-task> ]
 #                     [ ENABLED ON|OFF ]
 #                     [ LIBS <library1> [<library2> ...] ]
 #                     [ INCLUDES <path1> [<path2> ...] ]
@@ -31,7 +34,7 @@
 #                     [ GENERATED <file1> [<file2> ...] ]
 #                     [ DEPENDS <target1> [<target2> ...] ]
 #                     [ TEST_DEPENDS <target1> [<target2> ...] ]
-#                     [ CONDITION <condition1> [<condition2> ...] ]
+#                     [ CONDITION <condition> ]
 #                     [ ENVIRONMENT <variable1> [<variable2> ...] ]
 #                     [ WORKING_DIRECTORY <path> ]
 #                     [ CFLAGS <flag1> [<flag2> ...] ]
@@ -48,6 +51,9 @@
 # SOURCES : required if TARGET is provided
 #   list of source files to be compiled
 #
+# OBJECTS : optional
+#   list of object libraries to add to this target
+#
 # COMMAND : either TARGET or COMMAND must be provided, unless TYPE is PYTHON
 #   command or script to execute (no executable is built)
 #
@@ -58,6 +64,22 @@
 #   :SCRIPT: run command or script, default if COMMAND is provided
 #   :PYTHON: run a Python script (requires the Python interpreter to be found)
 #
+# LABELS : optional
+#   list of labels to assign to the test
+#
+#   The project name in lower case is always added as a label. Additional
+#   labels are assigned depending on the type of test:
+#
+#   :executable: for type ``EXE``
+#   :script:     for type ``SCRIPT``
+#   :python:     for type ``PYTHON``
+#   :boost:      uses Boost unit test
+#   :mpi:        if ``MPI`` is set
+#   :openmp:     if ``OMP`` is set
+#
+#   This allows selecting tests to run via ``ctest -L <regex>`` or tests
+#   to exclude via ``ctest -LE <regex>``.
+#
 # ARGS : optional
 #   list of arguments to pass to TARGET or COMMAND when running the test
 #
@@ -71,9 +93,15 @@
 #   use the Boost Unit Test Framework
 #
 # MPI : optional
-#   number of MPI tasks to use.
+#   Run with MPI using the given number of MPI tasks.
+#
+#   If greater than 1, and ``MPIEXEC`` is not available, the test is disabled.
+#
+# OMP : optional
+#   number of OpenMP threads per MPI task to use.
 #
-#   If greater than 1, and MPI is not available, the test is disabled.
+#   If set, the environment variable OMP_NUM_THREADS will set.
+#   Also, in case of launchers like aprun, the OMP_NUMTHREADS_FLAG will be used.
 #
 # ENABLED : optional
 #   if set to OFF, the test is built but not enabled as a test case
@@ -126,31 +154,49 @@
 macro( ecbuild_add_test )
 
   set( options           BOOST )
-  set( single_value_args TARGET ENABLED COMMAND TYPE LINKER_LANGUAGE MPI WORKING_DIRECTORY )
-  set( multi_value_args  SOURCES LIBS INCLUDES TEST_DEPENDS DEPENDS ARGS
+  set( single_value_args TARGET ENABLED COMMAND TYPE LINKER_LANGUAGE MPI OMP WORKING_DIRECTORY )
+  set( multi_value_args  SOURCES OBJECTS LIBS INCLUDES TEST_DEPENDS DEPENDS LABELS ARGS
                          PERSISTENT DEFINITIONS RESOURCES TEST_DATA CFLAGS
                          CXXFLAGS FFLAGS GENERATED CONDITION ENVIRONMENT )
 
   cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
   if(_PAR_UNPARSED_ARGUMENTS)
-    message(FATAL_ERROR "Unknown keywords given to ecbuild_add_test(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+    ecbuild_critical("Unknown keywords given to ecbuild_add_test(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
   endif()
 
   set( _TEST_DIR ${CMAKE_CURRENT_BINARY_DIR} )
 
-  # Check for MPI
-  if(_PAR_MPI)
-    if( (_PAR_MPI GREATER 1) AND ( (NOT HAVE_MPI) OR (NOT MPIEXEC) ) )
-      ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): ${_PAR_MPI} MPI ranks requested but MPI not available - disabling test")
+  # Undocumented flag for disabling all MPI tests for test environment without suitable MPI(EXEC)
+  if( _PAR_MPI AND ECBUILD_DISABLE_MPI_TESTS )
+    ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): ECBUILD_DISABLE_MPI_TESTS set - disabling test")
+    set( _PAR_ENABLED 0 )
+  elseif( _PAR_MPI )
+    # Check for MPIEXEC if it not set
+    find_program( MPIEXEC NAMES mpiexec mpirun lamexec srun
+                  DOC "Executable for running MPI programs." )
+    if( MPIEXEC )
+      set(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC")
+      ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): Running using ${MPIEXEC} on ${_PAR_MPI} MPI rank(s)")
+      set( _PAR_LABELS mpi ${_PAR_LABELS} )
+    elseif( _PAR_MPI GREATER 1 )
+      ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): ${_PAR_MPI} MPI ranks requested but MPIEXEC not available - disabling test")
       set( _PAR_ENABLED 0 )
-    endif()
-    if( (_PAR_MPI EQUAL 1) AND (NOT HAVE_MPI) )
-      ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): 1 MPI rank requested but MPI not available - disabling MPI")
+    else()
+      ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): 1 MPI rank requested but MPIEXEC not available - running sequentially")
       set( _PAR_MPI 0 )
     endif()
   endif()
 
+  # Check for OMP
+  if( DEFINED _PAR_OMP )
+    set( _PAR_LABELS openmp ${_PAR_LABELS} )
+  else()
+    set( _PAR_OMP 1 )
+  endif()
+  list( APPEND _PAR_ENVIRONMENT "OMP_NUM_THREADS=${_PAR_OMP}" )
+
+
   # default is enabled
   if( NOT DEFINED _PAR_ENABLED )
     set( _PAR_ENABLED 1 )
@@ -162,21 +208,24 @@ macro( ecbuild_add_test )
   # command implies script
   if( DEFINED _PAR_COMMAND )
     set( _PAR_TYPE "SCRIPT" )
+    set( _PAR_LABELS script ${_PAR_LABELS} )
   endif()
 
   # default of TYPE
   if( NOT _PAR_TYPE AND DEFINED _PAR_TARGET )
     set( _PAR_TYPE "EXE" )
+    set( _PAR_LABELS executable ${_PAR_LABELS} )
     if( NOT _PAR_SOURCES )
-      message(FATAL_ERROR "The call to ecbuild_add_test() defines a TARGET without SOURCES.")
+      ecbuild_critical("The call to ecbuild_add_test() defines a TARGET without SOURCES.")
     endif()
   endif()
 
   if( _PAR_TYPE MATCHES "PYTHON" )
     if( PYTHONINTERP_FOUND )
       set( _PAR_COMMAND ${PYTHON_EXECUTABLE} )
+      set( _PAR_LABELS python ${_PAR_LABELS} )
     else()
-      message( WARNING "Requested a python test but python interpreter not found - disabling test\nPYTHON_EXECUTABLE: [${PYTHON_EXECUTABLE}]" )
+      ecbuild_warn( "Requested a python test but python interpreter not found - disabling test\nPYTHON_EXECUTABLE: [${PYTHON_EXECUTABLE}]" )
       set( _PAR_ENABLED 0 )
     endif()
   endif()
@@ -184,15 +233,15 @@ macro( ecbuild_add_test )
   ### further checks
 
   if( _PAR_ENABLED AND NOT _PAR_TARGET AND NOT _PAR_COMMAND )
-    message(FATAL_ERROR "The call to ecbuild_add_test() defines neither a TARGET nor a COMMAND.")
+    ecbuild_critical("The call to ecbuild_add_test() defines neither a TARGET nor a COMMAND.")
   endif()
 
   if( _PAR_ENABLED AND NOT _PAR_COMMAND AND NOT _PAR_SOURCES )
-    message(FATAL_ERROR "The call to ecbuild_add_test() defines neither a COMMAND nor SOURCES, so no test can be defined or built.")
+    ecbuild_critical("The call to ecbuild_add_test() defines neither a COMMAND nor SOURCES, so no test can be defined or built.")
   endif()
 
   if( _PAR_TYPE MATCHES "SCRIPT" AND NOT _PAR_COMMAND )
-    message(FATAL_ERROR "The call to ecbuild_add_test() defines a 'script' but doesn't specify the COMMAND.")
+    ecbuild_critical("The call to ecbuild_add_test() defines a 'script' but doesn't specify the COMMAND.")
   endif()
 
   ### conditional build
@@ -214,6 +263,7 @@ macro( ecbuild_add_test )
   if( _PAR_BOOST AND ENABLE_TESTS AND _${_PAR_TARGET}_condition )
 
     if( HAVE_BOOST_UNIT_TEST )
+      set( _PAR_LABELS boost ${_PAR_LABELS} )
       if( BOOST_UNIT_TEST_FRAMEWORK_HEADER_ONLY )
         include_directories( ${ECBUILD_BOOST_HEADER_DIRS} )
         include_directories( ${Boost_INCLUDE_DIRS}  ) # temporary until we ship Boost Unit Test with ecBuild
@@ -266,9 +316,13 @@ macro( ecbuild_add_test )
         endif()
       endif()
 
-      # add the test target
+      # insert already compiled objects (from OBJECT libraries)
+      unset( _all_objects )
+      foreach( _obj ${_PAR_OBJECTS} )
+        list( APPEND _all_objects $<TARGET_OBJECTS:${_obj}> )
+      endforeach()
 
-      add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} )
+      add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} ${_all_objects} )
 
       # add extra dependencies
       if( DEFINED _PAR_DEPENDS)
@@ -299,25 +353,14 @@ macro( ecbuild_add_test )
       # filter sources
       ecbuild_separate_sources( TARGET ${_PAR_TARGET} SOURCES ${_PAR_SOURCES} )
 
-      # add local flags
-      if( DEFINED _PAR_CFLAGS )
-        ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): use C flags ${_PAR_CFLAGS}")
-        set_source_files_properties( ${${_PAR_TARGET}_c_srcs}   PROPERTIES COMPILE_FLAGS "${_PAR_CFLAGS}" )
-      endif()
-      if( DEFINED _PAR_CXXFLAGS )
-        ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): use C++ flags ${_PAR_CFLAGS}")
-        set_source_files_properties( ${${_PAR_TARGET}_cxx_srcs} PROPERTIES COMPILE_FLAGS "${_PAR_CXXFLAGS}" )
-      endif()
-      if( DEFINED _PAR_FFLAGS )
-        ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): use Fortran flags ${_PAR_CFLAGS}")
-        set_source_files_properties( ${${_PAR_TARGET}_f_srcs}   PROPERTIES COMPILE_FLAGS "${_PAR_FFLAGS}" )
-      endif()
+      # Override compilation flags on a per source file basis
+      ecbuild_target_flags( ${_PAR_TARGET} "${_PAR_CFLAGS}" "${_PAR_CXXFLAGS}" "${_PAR_FFLAGS}" )
+
       if( DEFINED _PAR_GENERATED )
         ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): mark as generated ${_PAR_GENERATED}")
         set_source_files_properties( ${_PAR_GENERATED} PROPERTIES GENERATED 1 )
       endif()
 
-
       # modify definitions to compilation ( -D... )
       get_property( _target_defs TARGET ${_PAR_TARGET} PROPERTY COMPILE_DEFINITIONS )
 
@@ -354,9 +397,6 @@ macro( ecbuild_add_test )
                           PRE_BUILD
                           COMMAND ${CMAKE_COMMAND} -E remove ${EXE_FILENAME} )
 
-      set_property( TARGET ${_PAR_TARGET} PROPERTY SKIP_BUILD_RPATH         FALSE )
-      set_property( TARGET ${_PAR_TARGET} PROPERTY BUILD_WITH_INSTALL_RPATH FALSE )
-
     endif() # _PAR_SOURCES
 
     if( DEFINED _PAR_COMMAND AND NOT _PAR_TARGET ) # in the absence of target, we use the command as a name
@@ -376,18 +416,29 @@ macro( ecbuild_add_test )
 
     # define the arguments
     set( TEST_ARGS "" )
-    if( DEFINED _PAR_ARGS  )
+    # Boost Unit Test >= 1.60 requires arguments to be passed to the application to be separated by --
+    if( DEFINED _PAR_ARGS AND _PAR_BOOST )
+      list( APPEND TEST_ARGS "--" ${_PAR_ARGS} )
+    elseif( DEFINED _PAR_ARGS )
       list( APPEND TEST_ARGS ${_PAR_ARGS} )
     endif()
 
     # Wrap with MPIEXEC
     if( _PAR_MPI )
+
+      set( MPIEXEC_TASKS ${MPIEXEC_NUMPROC_FLAG} ${_PAR_MPI} )
+      if( DEFINED MPIEXEC_NUMTHREAD_FLAG )
+        set( MPIEXEC_THREADS ${MPIEXEC_NUMTHREAD_FLAG} ${_PAR_OMP} )
+      endif()
+
+      set( _LAUNCH ${MPIEXEC} ${MPIEXEC_TASKS} ${MPIEXEC_THREADS} )
+
       if( DEFINED _PAR_COMMAND )
-        ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): running as ${MPIEXEC} -n ${_PAR_MPI} ${_TEST_DIR}/${_PAR_COMMAND}")
-        set( _PAR_COMMAND ${MPIEXEC} -n ${_PAR_MPI} ${_TEST_DIR}/${_PAR_COMMAND} )
+        ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): running as ${_LAUNCH} ${_PAR_COMMAND}")
+        set( _PAR_COMMAND ${_LAUNCH} ${_PAR_COMMAND} )
       else()
-        ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): running as ${MPIEXEC} -n ${_PAR_MPI} ${_TEST_DIR}/${_PAR_TARGET}")
-        set( _PAR_COMMAND ${MPIEXEC} -n ${_PAR_MPI} ${_TEST_DIR}/${_PAR_TARGET} )
+        ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): running as ${_LAUNCH} ${_TEST_DIR}/${_PAR_TARGET}")
+        set( _PAR_COMMAND ${_LAUNCH} ${_TEST_DIR}/${_PAR_TARGET} )
       endif()
     endif()
 
@@ -396,9 +447,9 @@ macro( ecbuild_add_test )
     if( _PAR_ENABLED ) # we can disable and still build it but not run it with 'make tests'
 
       if( DEFINED _PAR_COMMAND )
-        add_test( ${_PAR_TARGET} ${_PAR_COMMAND} ${TEST_ARGS} ${_working_dir} ) # run a command as test
+        add_test( NAME ${_PAR_TARGET} COMMAND ${_PAR_COMMAND} ${TEST_ARGS} ${_working_dir} ) # run a command as test
       else()
-        add_test( ${_PAR_TARGET} ${_PAR_TARGET}  ${TEST_ARGS} ${_working_dir} ) # run the test that was generated
+        add_test( NAME ${_PAR_TARGET} COMMAND ${_PAR_TARGET}  ${TEST_ARGS} ${_working_dir} ) # run the test that was generated
       endif()
 
       # get test data
@@ -411,6 +462,12 @@ macro( ecbuild_add_test )
 
       endif()
 
+      # Add lower case project name to custom test labels
+      set( _PAR_LABELS ${PROJECT_NAME_LOWCASE} ${_PAR_LABELS} )
+      list( REMOVE_DUPLICATES _PAR_LABELS )
+      ecbuild_debug("ecbuild_add_test(${_PAR_TARGET}): assign labels ${_PAR_LABELS}")
+      set_property( TEST ${_PAR_TARGET} APPEND PROPERTY LABELS "${_PAR_LABELS}" )
+
       if( DEFINED _PAR_ENVIRONMENT )
         set_property( TEST ${_PAR_TARGET} APPEND PROPERTY ENVIRONMENT "${_PAR_ENVIRONMENT}" )
       endif()
diff --git a/cmake/ecbuild_append_to_rpath.cmake b/cmake/ecbuild_append_to_rpath.cmake
index 5a7bd66..9ecde3e 100644
--- a/cmake/ecbuild_append_to_rpath.cmake
+++ b/cmake/ecbuild_append_to_rpath.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -39,7 +39,7 @@ endfunction()
 macro( ecbuild_append_to_rpath RPATH_DIRS )
    
    if( NOT ${ARGC} EQUAL 1 )
-     message( SEND_ERROR "ecbuild_append_to_rpath takes 1 argument")
+     ecbuild_error( "ecbuild_append_to_rpath takes 1 argument")
    endif()
 
    foreach( RPATH_DIR ${RPATH_DIRS} )
diff --git a/cmake/ecbuild_bundle.cmake b/cmake/ecbuild_bundle.cmake
index 2d9b779..aee900c 100644
--- a/cmake/ecbuild_bundle.cmake
+++ b/cmake/ecbuild_bundle.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -9,10 +9,6 @@
 # Set policies
 include( ecbuild_policies NO_POLICY_SCOPE )
 
-macro( debug_here VAR )
-  message( STATUS " >>>>> ${VAR} [${${VAR}}]")
-endmacro()
-
 include(CMakeParseArguments)
 
 include(ecbuild_git)
@@ -24,7 +20,9 @@ include(ecbuild_git)
 # =========================
 #
 # Initialise the ecBuild environment for a bundle. *Must* be called *before*
-# any call to ecbuild_bundle.
+# any call to ``ecbuild_bundle``. ::
+#
+#   ecbuild_bundle_initialize()
 #
 ##############################################################################
 
@@ -61,7 +59,7 @@ endmacro()
 # Declare a subproject to be built as part of this bundle. ::
 #
 #   ecbuild_bundle( PROJECT <name>
-#                   STASH <repository> | GIT <giturl>
+#                   STASH <repository> | GIT <giturl> | SOURCE <path>
 #                   [ BRANCH <gitbranch> | TAG <gittag> ]
 #                   [ UPDATE | NOREMOTE ] )
 #                   [ MANUAL ] )
@@ -72,12 +70,15 @@ endmacro()
 # PROJECT : required
 #   project name for the Git repository to be managed
 #
-# STASH : cannot be combined with GIT, either is required
+# STASH : cannot be combined with GIT or SOURCE
 #   Stash repository in the form <project>/<repository>
 #
-# URL : cannot be combined with STASH, either is required
+# GIT : cannot be combined with STASH or SOURCE
 #   Git URL of the remote repository to clone (see ``git help clone``)
 #
+# SOURCE : cannot be combined with STASH or GIT
+#   Path to an existing local repository, which will be symlinked
+#
 # BRANCH : optional, cannot be combined with TAG
 #   Git branch to check out
 #
@@ -104,6 +105,10 @@ endmacro()
 # The first time a bundle is built, the sources of all subprojects are cloned
 # into directories named according to project in the *source* tree of the
 # bundle (which means these directories should be added to ``.gitignore``).
+# If the ``SOURCE`` option is used it must point to an existing local
+# repository on disk and no new repository is cloned. Be aware that using the
+# ``BRANCH`` or ``TAG`` option leads to the corresponding version being checked
+# out in that repository!
 #
 # Subprojects are configured and built in order. Due to being added as a
 # subproject, the usual project discovery mechanism (i.e. locating and
@@ -119,23 +124,32 @@ endmacro()
 macro( ecbuild_bundle )
 
   set( options )
-  set( single_value_args PROJECT STASH GIT )
+  set( single_value_args PROJECT STASH GIT SOURCE )
   set( multi_value_args )
   cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
 
   string(TOUPPER "${_PAR_PROJECT}" PNAME)
 
   if( BUNDLE_SKIP_${PNAME} )
-      message( STATUS "Skipping bundle project ${PNAME}" )
+    ecbuild_info( "Skipping bundle project ${PNAME}" )
   else()
 
-      if( _PAR_STASH )
-          ecmwf_stash( PROJECT ${_PAR_PROJECT} DIR ${PROJECT_SOURCE_DIR}/${_PAR_PROJECT} STASH ${_PAR_STASH} ${_PAR_UNPARSED_ARGUMENTS} )
-      elseif( _PAR_GIT )
-          ecbuild_git( PROJECT ${_PAR_PROJECT} DIR ${PROJECT_SOURCE_DIR}/${_PAR_PROJECT} URL ${_PAR_GIT} ${_PAR_UNPARSED_ARGUMENTS} )
+    if( _PAR_STASH )
+      ecmwf_stash( PROJECT ${_PAR_PROJECT} DIR ${PROJECT_SOURCE_DIR}/${_PAR_PROJECT} STASH ${_PAR_STASH} ${_PAR_UNPARSED_ARGUMENTS} )
+    elseif( _PAR_GIT )
+      ecbuild_git( PROJECT ${_PAR_PROJECT} DIR ${PROJECT_SOURCE_DIR}/${_PAR_PROJECT} URL ${_PAR_GIT} ${_PAR_UNPARSED_ARGUMENTS} )
+    elseif( _PAR_SOURCE )
+      if( DEFINED ${PNAME}_SOURCE )
+        ecbuild_critical( "ecbuild_bundle called with SOURCE for project ${_PAR_PROJECT} but ${PNAME}_SOURCE is defined" )
       endif()
+      execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink ${_PAR_SOURCE} ${PROJECT_SOURCE_DIR}/${_PAR_PROJECT} )
+    endif()
+
+    if( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_PAR_PROJECT} OR NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_PAR_PROJECT}/CMakeLists.txt )
+      ecbuild_critical("Source directory '${CMAKE_CURRENT_SOURCE_DIR}/${_PAR_PROJECT}' for subproject '${_PAR_PROJECT}' does not exist or does not contain a CMakeLists.txt file.")
+    endif()
 
-      ecbuild_use_package( PROJECT ${_PAR_PROJECT} )
+    ecbuild_use_package( PROJECT ${_PAR_PROJECT} )
   endif()
 
 endmacro()
@@ -147,7 +161,9 @@ endmacro()
 # =======================
 #
 # Finalise the ecBuild environment for a bundle. *Must* be called *after* the
-# last call to ecbuild_bundle.
+# last call to ``ecbuild_bundle``. ::
+#
+#   ecbuild_bundle_finalize()
 #
 ##############################################################################
 
diff --git a/cmake/ecbuild_cache.cmake b/cmake/ecbuild_cache.cmake
index 9663bca..e257b36 100644
--- a/cmake/ecbuild_cache.cmake
+++ b/cmake/ecbuild_cache.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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 1dadca6..18b6117 100644
--- a/cmake/ecbuild_check_c_source_return.cmake
+++ b/cmake/ecbuild_check_c_source_return.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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. 
@@ -59,11 +59,11 @@ macro( ecbuild_check_c_source_return SOURCE )
     cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
     if(_PAR_UNPARSED_ARGUMENTS)
-      message(FATAL_ERROR "Unknown keywords given to ecbuild_check_c_source_return(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+      ecbuild_critical("Unknown keywords given to ecbuild_check_c_source_return(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
     endif()
 
     if( NOT _PAR_VAR OR NOT _PAR_OUTPUT )
-      message(FATAL_ERROR "The call to ecbuild_check_c_source_return() doesn't specify either SOURCE, VAR or OUTPUT")
+      ecbuild_critical("The call to ecbuild_check_c_source_return() doesn't specify either SOURCE, VAR or OUTPUT")
     endif()
 
 
@@ -97,7 +97,7 @@ macro( ecbuild_check_c_source_return SOURCE )
     
         file( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_${_PAR_VAR}.c" "${SOURCE}\n" )
 
-        message( STATUS "Performing Test ${_PAR_VAR}" )
+        ecbuild_debug( "Performing Test ${_PAR_VAR}" )
         try_run( ${_PAR_VAR}_EXITCODE ${_PAR_VAR}_COMPILED
           ${CMAKE_BINARY_DIR}
           ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_${_PAR_VAR}.c
@@ -117,7 +117,7 @@ macro( ecbuild_check_c_source_return SOURCE )
         # if the return value was 0 then it worked
         if("${${_PAR_VAR}_EXITCODE}" EQUAL 0)
     
-          message(STATUS "Performing Test ${_PAR_VAR} - Success")
+          ecbuild_debug("Performing Test ${_PAR_VAR} - Success")
           file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log 
             "Performing C SOURCE FILE Test ${_PAR_VAR} succeded with the following compile output:\n"
             "${compile_OUTPUT}\n" 
@@ -139,7 +139,7 @@ macro( ecbuild_check_c_source_return SOURCE )
             set(${_PAR_OUTPUT} "" CACHE INTERNAL "Test ${_PAR_VAR} output")
           endif()
     
-          message(STATUS "Performing Test ${_PAR_VAR} - Failed")
+          ecbuild_debug("Performing Test ${_PAR_VAR} - Failed")
           file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log 
             "Performing C SOURCE FILE Test ${_PAR_VAR} failed with the following compile output:\n"
             "${compile_OUTPUT}\n" 
diff --git a/cmake/ecbuild_check_compiler.cmake b/cmake/ecbuild_check_compiler.cmake
index 32ff6cc..437b81e 100644
--- a/cmake/ecbuild_check_compiler.cmake
+++ b/cmake/ecbuild_check_compiler.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -10,7 +10,8 @@
 # enable C to use in system introspection
 
 if( NOT CMAKE_C_COMPILER_LOADED AND ENABLE_OS_TESTS )
-	enable_language( C )
+  enable_language( C )
+  ecbuild_compiler_flags( C )
 endif()
 
 ############################################################################################
@@ -122,6 +123,10 @@ if( CMAKE_COMPILER_IS_GNUCXX )
 
 endif()
 
+if( ENABLE_WARNINGS AND CMAKE_Fortran_COMPILER_ID MATCHES "Intel" )
+  ecbuild_add_fortran_flags("-warn all")
+endif()
+
 ############################################################################################
 # compiler dependent fixes
 
diff --git a/cmake/ecbuild_check_cxx11.cmake b/cmake/ecbuild_check_cxx11.cmake
index 6453786..9552389 100644
--- a/cmake/ecbuild_check_cxx11.cmake
+++ b/cmake/ecbuild_check_cxx11.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -23,111 +23,116 @@
 # Options
 # -------
 #
-# FEATURES : optional, checks for all features if omitted
-#   list of features to check for
+# FEATURES : optional
+#   list of optional features to check for
 #
 # REQUIRED : optional
 #   list of required features to check for
 #
 # PRINT : optional
-#   print a summary of features check for, found and not found
+#   print a summary of features checked for, found and not found
+#
+# Note
+# ----
+#
+# If neither ``FEATURES`` nor ``REQUIRED`` are given, check for all features.
 #
 ##############################################################################
 
 function( ecbuild_check_cxx11 )
 
-	# parse parameters
+  # parse parameters
 
-	set( options PRINT )
-	set( single_value_args )
-	set( multi_value_args   FEATURES REQUIRED )
+  set( options PRINT )
+  set( single_value_args )
+  set( multi_value_args   FEATURES REQUIRED )
 
-	cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
+  cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
-	if(_PAR_UNPARSED_ARGUMENTS)
-		message(FATAL_ERROR "Unknown keywords given to ecbuild_check_cxx11(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
-	endif()
+  if(_PAR_UNPARSED_ARGUMENTS)
+    ecbuild_critical("Unknown keywords given to ecbuild_check_cxx11(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+  endif()
 
-	include( ${ECBUILD_MACROS_DIR}/contrib/GreatCMakeCookOff/CheckCXX11Features.cmake )
+  include( ${ECBUILD_MACROS_DIR}/contrib/GreatCMakeCookOff/CheckCXX11Features.cmake )
 
-	cxx11_find_all_features( ALL_FEATURES ) # list all available features to check
+  cxx11_find_all_features( ALL_FEATURES ) # list all available features to check
 
-	# Save CXX flags
-	set( CXX_FLAGS_SNASHOT ${CMAKE_CXX_FLAGS} )
+  # Save CXX flags
+  set( CXX_FLAGS_SNASHOT ${CMAKE_CXX_FLAGS} )
 
-	# Add C++11 flags
-	include( ${ECBUILD_MACROS_DIR}/ecbuild_get_cxx11_flags.cmake )
-	ecbuild_get_cxx11_flags( CXX11_FLAGS )
-	set( CMAKE_CXX_FLAGS "${CXX11_FLAGS} ${CMAKE_CXX_FLAGS}" )
+  # Add C++11 flags
+  include( ${ECBUILD_MACROS_DIR}/ecbuild_get_cxx11_flags.cmake )
+  ecbuild_get_cxx11_flags( CXX11_FLAGS )
+  ecbuild_debug( "ecbuild_check_cxx11: detected C++11 flag as ${CXX11_FLAGS}" )
+  set( CMAKE_CXX_FLAGS "${CXX11_FLAGS} ${CMAKE_CXX_FLAGS}" )
 
-	if( NOT _p_FEATURES AND NOT _p_REQUIRED ) # no input, then search for all features
+  if( NOT _p_FEATURES AND NOT _p_REQUIRED ) # no input, then search for all features
 
-		cxx11_feature_check()
+    cxx11_feature_check()
 
-	else()
+  else()
 
-		foreach( _f ${_p_FEATURES} )
-			cxx11_feature_check( ${_f} )
-		endforeach()
+    foreach( _f ${_p_FEATURES} )
+      cxx11_feature_check( ${_f} )
+    endforeach()
 
-		foreach( _f ${_p_REQUIRED} )
-			cxx11_feature_check( REQUIRED ${_f} )
-		endforeach()
+    foreach( _f ${_p_REQUIRED} )
+      cxx11_feature_check( REQUIRED ${_f} )
+    endforeach()
 
-	endif()
+  endif()
 
-	# Restore CXX flags
-	set( CMAKE_CXX_FLAGS ${CXX_FLAGS_SNAPSHOT} )
+  # Restore CXX flags
+  set( CMAKE_CXX_FLAGS ${CXX_FLAGS_SNAPSHOT} )
 
-	if( _p_FEATURES OR _p_REQUIRED )
-		set( CXX11_CHECKED_FEATURES ${_p_FEATURES} ${_p_REQUIRED} )
-	else()
-		set( CXX11_CHECKED_FEATURES ${ALL_FEATURES} )
-	endif()
+  if( _p_FEATURES OR _p_REQUIRED )
+    set( CXX11_CHECKED_FEATURES ${_p_FEATURES} ${_p_REQUIRED} )
+  else()
+    set( CXX11_CHECKED_FEATURES ${ALL_FEATURES} )
+  endif()
 
-	foreach( f ${CXX11_CHECKED_FEATURES} )
-		# message( "HAS_CXX11_${FEAT}" )
-		string( TOUPPER ${f} FEAT )
-		if( HAS_CXX11_${FEAT} )
-		   list( APPEND CXX11_SUPPORTED_FEATURES ${f} )
-		else()
-		   list( APPEND CXX11_NOT_SUPPORTED_FEATURES ${f} )
-		endif()
-	endforeach()
+  foreach( f ${CXX11_CHECKED_FEATURES} )
+    string( TOUPPER ${f} FEAT )
+    if( HAS_CXX11_${FEAT} )
+       list( APPEND CXX11_SUPPORTED_FEATURES ${f} )
+    else()
+       list( APPEND CXX11_NOT_SUPPORTED_FEATURES ${f} )
+    endif()
+  endforeach()
 
   if( CXX11_CHECKED_FEATURES )
     list( SORT CXX11_CHECKED_FEATURES )
-	endif()
-	if( CXX11_SUPPORTED_FEATURES )
-		list( SORT CXX11_SUPPORTED_FEATURES )
-	endif()
-	if( CXX11_NOT_SUPPORTED_FEATURES )
-		list( SORT CXX11_NOT_SUPPORTED_FEATURES )
-	endif()
-
-	set( CXX11_CHECKED_FEATURES       ${CXX11_CHECKED_FEATURES}       PARENT_SCOPE )
-	set( CXX11_SUPPORTED_FEATURES     ${CXX11_SUPPORTED_FEATURES}     PARENT_SCOPE )
-	set( CXX11_NOT_SUPPORTED_FEATURES ${CXX11_NOT_SUPPORTED_FEATURES} PARENT_SCOPE )
-
-	if( _p_PRINT )
-		if( CXX11_CHECKED_FEATURES )
-			join( CXX11_CHECKED_FEATURES " " CXX11_CHECKED_FEATURES_STR )
-			message( STATUS "Checked C++11 features: ${CXX11_CHECKED_FEATURES_STR}" )
-		else()
-			message( STATUS "Checked no C++11 features" )
-		endif()
-		if( CXX11_SUPPORTED_FEATURES )
-			join( CXX11_SUPPORTED_FEATURES " " CXX11_SUPPORTED_FEATURES_STR )
-			message( STATUS "Found C++11 features: ${CXX11_SUPPORTED_FEATURES_STR}" )
-		else()
-			message( STATUS "Found no C++11 features" )
-		endif()
-		if( CXX11_NOT_SUPPORTED_FEATURES )
-			join( CXX11_NOT_SUPPORTED_FEATURES " " CXX11_NOT_SUPPORTED_FEATURES_STR )
-			message( STATUS "Not found C++11 features: ${CXX11_NOT_SUPPORTED_FEATURES_STR}" )
-		else()
-			message( STATUS "Found all checked C++11 features" )
-		endif()
-	endif()
+  endif()
+  if( CXX11_SUPPORTED_FEATURES )
+    list( SORT CXX11_SUPPORTED_FEATURES )
+  endif()
+  if( CXX11_NOT_SUPPORTED_FEATURES )
+    list( SORT CXX11_NOT_SUPPORTED_FEATURES )
+  endif()
+
+  set( CXX11_CHECKED_FEATURES       ${CXX11_CHECKED_FEATURES}       PARENT_SCOPE )
+  set( CXX11_SUPPORTED_FEATURES     ${CXX11_SUPPORTED_FEATURES}     PARENT_SCOPE )
+  set( CXX11_NOT_SUPPORTED_FEATURES ${CXX11_NOT_SUPPORTED_FEATURES} PARENT_SCOPE )
+
+  if( _p_PRINT )
+    if( CXX11_CHECKED_FEATURES )
+      join( CXX11_CHECKED_FEATURES " " CXX11_CHECKED_FEATURES_STR )
+      ecbuild_info( "Checked C++11 features: ${CXX11_CHECKED_FEATURES_STR}" )
+    else()
+      ecbuild_info( "Checked no C++11 features" )
+    endif()
+    if( CXX11_SUPPORTED_FEATURES )
+      join( CXX11_SUPPORTED_FEATURES " " CXX11_SUPPORTED_FEATURES_STR )
+      ecbuild_info( "Found C++11 features: ${CXX11_SUPPORTED_FEATURES_STR}" )
+    else()
+      ecbuild_info( "Found no C++11 features" )
+    endif()
+    if( CXX11_NOT_SUPPORTED_FEATURES )
+      join( CXX11_NOT_SUPPORTED_FEATURES " " CXX11_NOT_SUPPORTED_FEATURES_STR )
+      ecbuild_info( "Not found C++11 features: ${CXX11_NOT_SUPPORTED_FEATURES_STR}" )
+    else()
+      ecbuild_info( "Found all checked C++11 features" )
+    endif()
+  endif()
 
 endfunction( ecbuild_check_cxx11 )
diff --git a/cmake/ecbuild_check_cxx_source_return.cmake b/cmake/ecbuild_check_cxx_source_return.cmake
index e364918..0868b22 100644
--- a/cmake/ecbuild_check_cxx_source_return.cmake
+++ b/cmake/ecbuild_check_cxx_source_return.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
-# 
+# (C) Copyright 1996-2016 ECMWF.
+#
 # This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 
-# In applying this licence, ECMWF does not waive the privileges and immunities 
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
 # granted to it by virtue of its status as an intergovernmental organisation nor
 # does it submit to any jurisdiction.
 
@@ -59,11 +59,11 @@ macro( ecbuild_check_cxx_source_return SOURCE )
     cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
     if(_p_UNPARSED_ARGUMENTS)
-      message(FATAL_ERROR "Unknown keywords given to ecbuild_check_cxx_source_return(): \"${_p_UNPARSED_ARGUMENTS}\"")
+      ecbuild_critical("Unknown keywords given to ecbuild_check_cxx_source_return(): \"${_p_UNPARSED_ARGUMENTS}\"")
     endif()
 
     if( NOT _p_VAR OR NOT _p_OUTPUT )
-      message(FATAL_ERROR "The call to ecbuild_check_cxx_source_return() doesn't specify either SOURCE, VAR or OUTPUT")
+      ecbuild_critical("The call to ecbuild_check_cxx_source_return() doesn't specify either SOURCE, VAR or OUTPUT")
     endif()
 
     set( _msg "Testing ${_p_VAR}:" )
@@ -93,12 +93,12 @@ macro( ecbuild_check_cxx_source_return SOURCE )
         if( __add_incs )
             set(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${__add_incs}")
         endif()
-    
+
         # write the source file
-    
+
         file( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_${_p_VAR}.cxx" "${SOURCE}\n" )
 
-        message( STATUS "${_msg}" )
+        ecbuild_debug( "${_msg}" )
         try_run( ${_p_VAR}_EXITCODE ${_p_VAR}_COMPILED
           ${CMAKE_BINARY_DIR}
           ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_${_p_VAR}.cxx
@@ -107,39 +107,39 @@ macro( ecbuild_check_cxx_source_return SOURCE )
           -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
           "${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}"
           "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}"
-          COMPILE_OUTPUT_VARIABLE compile_OUTPUT 
+          COMPILE_OUTPUT_VARIABLE compile_OUTPUT
           RUN_OUTPUT_VARIABLE     run_OUTPUT )
-   
-        # debug_var( ${_p_VAR}_COMPILED )
-        # debug_var( ${_p_VAR}_EXITCODE )
+
+        # ecbuild_debug_var( ${_p_VAR}_COMPILED )
+        # ecbuild_debug_var( ${_p_VAR}_EXITCODE )
 
         # if it did not compile make the return value fail code of 1
 
         if( NOT ${_p_VAR}_COMPILED )
-          message( STATUS "${_msg} failed to compile" )
+          ecbuild_debug( "${_msg} failed to compile" )
         endif()
 
         if( "${${_p_VAR}_EXITCODE}" MATCHES  "FAILED_TO_RUN" )
-          message( STATUS "${_msg} failed to run" )
+          ecbuild_debug( "${_msg} failed to run" )
         endif()
 
         # if the return value was 0 then it worked
         if( ${_p_VAR}_COMPILED AND "${${_p_VAR}_EXITCODE}" EQUAL 0 )
-    
-          message(STATUS "${_msg} Success")
-          file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log 
+
+          ecbuild_debug("${_msg} Success")
+          file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
             "Performing C++ SOURCE FILE Test ${_p_VAR} succeded with the following compile output:\n"
-            "${compile_OUTPUT}\n" 
+            "${compile_OUTPUT}\n"
             "Performing C++ SOURCE FILE Run ${_p_VAR} succeded with the following run output:\n"
-            "${run_OUTPUT}\n" 
+            "${run_OUTPUT}\n"
             "Return value: ${${_p_VAR}}\n"
             "Source file was:\n${SOURCE}\n")
 
           set( ${_p_VAR}     1              CACHE INTERNAL "Test ${_p_VAR}")
           set( ${_p_OUTPUT} "${run_OUTPUT}" CACHE INTERNAL "Test ${_p_VAR} output")
-    
+
         else()
-    
+
           if(CMAKE_CROSSCOMPILING AND "${${_p_VAR}_EXITCODE}" MATCHES  "FAILED_TO_RUN")
             set(${_p_VAR} "${${_p_VAR}_EXITCODE}")
             set(${OUTPUT} "")
@@ -147,17 +147,17 @@ macro( ecbuild_check_cxx_source_return SOURCE )
             set(${_p_VAR} "" CACHE INTERNAL "Test ${_p_VAR}")
             set(${_p_OUTPUT} "" CACHE INTERNAL "Test ${_p_VAR} output")
           endif()
-    
-          message(STATUS "Test ${_p_VAR} - Failed")
-          file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log 
+
+          ecbuild_debug("Test ${_p_VAR} - Failed")
+          file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
             "Performing C++ SOURCE FILE Test ${_p_VAR} failed with the following compile output:\n"
-            "${compile_OUTPUT}\n" 
+            "${compile_OUTPUT}\n"
             "Performing C++ SOURCE FILE Run ${_p_VAR} failed with the following run output:\n"
-            "${run_OUTPUT}\n" 
+            "${run_OUTPUT}\n"
             "Return value: ${${_p_VAR}_EXITCODE}\n"
             "Source file was:\n${SOURCE}\n")
         endif()
-    
+
     endif()
 
 endmacro()
diff --git a/cmake/ecbuild_check_fortran.cmake b/cmake/ecbuild_check_fortran.cmake
new file mode 100644
index 0000000..5612134
--- /dev/null
+++ b/cmake/ecbuild_check_fortran.cmake
@@ -0,0 +1,126 @@
+# (C) Copyright 1996-2016 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.
+
+##############################################################################
+#.rst:
+#
+# ecbuild_check_fortran
+# =====================
+#
+# Check for Fortran features. ::
+#
+#   ecbuild_check_fortran( [ FEATURES <feature1> [ <feature2> ... ] ]
+#                          [ REQUIRED <feature1> [ <feature2> ... ] ]
+#                          [ PRINT ] )
+#
+# Options
+# -------
+#
+# FEATURES : optional
+#   list of optional features to check for
+#
+# REQUIRED : optional
+#   list of required features to check for, fails if not detected
+#
+# PRINT : optional
+#   print a summary of features checked for, found and not found
+#
+# Note
+# ----
+#
+# If neither ``FEATURES`` nor ``REQUIRED`` are given, check for all features.
+#
+##############################################################################
+
+function( ecbuild_check_fortran )
+
+  # parse parameters
+
+  set( options PRINT )
+  set( single_value_args )
+  set( multi_value_args   FEATURES REQUIRED )
+
+  cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
+
+  if(_PAR_UNPARSED_ARGUMENTS)
+    ecbuild_critical("Unknown keywords given to ecbuild_check_fortran(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+  endif()
+
+  include( ${ECBUILD_MACROS_DIR}/fortran_features/CheckFortranFeatures.cmake )
+
+  fortran_find_all_features( ALL_FEATURES ) # list all available features to check
+
+  if( NOT _p_FEATURES AND NOT _p_REQUIRED ) # no input, then search for all features
+
+    fortran_feature_check()
+
+  else()
+
+    foreach( _f ${_p_FEATURES} )
+      fortran_feature_check( ${_f} )
+    endforeach()
+
+    foreach( _f ${_p_REQUIRED} )
+      fortran_feature_check( REQUIRED ${_f} )
+    endforeach()
+
+  endif()
+
+  if( _p_FEATURES OR _p_REQUIRED )
+    set( Fortran_CHECKED_FEATURES ${_p_FEATURES} ${_p_REQUIRED} )
+  else()
+    set( Fortran_CHECKED_FEATURES ${ALL_FEATURES} )
+  endif()
+
+  foreach( f ${Fortran_CHECKED_FEATURES} )
+    string( TOUPPER ${f} FEAT )
+    if( HAS_Fortran_${FEAT} )
+       list( APPEND Fortran_SUPPORTED_FEATURES ${f} )
+       set( EC_HAVE_Fortran_${FEAT} 1 PARENT_SCOPE )
+    else()
+       list( APPEND Fortran_NOT_SUPPORTED_FEATURES ${f} )
+       set( EC_HAVE_Fortran_${FEAT} 0 PARENT_SCOPE )
+    endif()
+  endforeach()
+
+  if( Fortran_CHECKED_FEATURES )
+    list( SORT Fortran_CHECKED_FEATURES )
+  endif()
+  if( Fortran_SUPPORTED_FEATURES )
+    list( SORT Fortran_SUPPORTED_FEATURES )
+  endif()
+  if( Fortran_NOT_SUPPORTED_FEATURES )
+    list( SORT Fortran_NOT_SUPPORTED_FEATURES )
+  endif()
+
+  set( Fortran_CHECKED_FEATURES       ${Fortran_CHECKED_FEATURES}       PARENT_SCOPE )
+  set( Fortran_SUPPORTED_FEATURES     ${Fortran_SUPPORTED_FEATURES}     PARENT_SCOPE )
+  set( Fortran_NOT_SUPPORTED_FEATURES ${Fortran_NOT_SUPPORTED_FEATURES} PARENT_SCOPE )
+
+  if( _p_PRINT )
+    if( Fortran_CHECKED_FEATURES )
+      join( Fortran_CHECKED_FEATURES " " Fortran_CHECKED_FEATURES_STR )
+      ecbuild_info( "Checked Fortran features: ${Fortran_CHECKED_FEATURES_STR}" )
+    else()
+      ecbuild_info( "Checked no Fortran features" )
+    endif()
+    if( Fortran_SUPPORTED_FEATURES )
+      join( Fortran_SUPPORTED_FEATURES " " Fortran_SUPPORTED_FEATURES_STR )
+      ecbuild_info( "Found Fortran features: ${Fortran_SUPPORTED_FEATURES_STR}" )
+    else()
+      ecbuild_info( "Found no Fortran features" )
+    endif()
+    if( Fortran_NOT_SUPPORTED_FEATURES )
+      join( Fortran_NOT_SUPPORTED_FEATURES " " Fortran_NOT_SUPPORTED_FEATURES_STR )
+      ecbuild_info( "Not found Fortran features: ${Fortran_NOT_SUPPORTED_FEATURES_STR}" )
+    else()
+      ecbuild_info( "Found all checked Fortran features" )
+    endif()
+  endif()
+
+endfunction( ecbuild_check_fortran )
diff --git a/cmake/ecbuild_check_fortran_source_return.cmake b/cmake/ecbuild_check_fortran_source_return.cmake
index 1c50896..175f4ef 100644
--- a/cmake/ecbuild_check_fortran_source_return.cmake
+++ b/cmake/ecbuild_check_fortran_source_return.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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. 
@@ -52,7 +52,6 @@
 
 macro( ecbuild_check_fortran_source_return SOURCE )
 
-    message( WARNING "This macro ecbuild_check_fortran_source has never been tested" )
     set( options )
     set( single_value_args VAR  OUTPUT )
     set( multi_value_args  INCLUDES LIBS DEFINITIONS )
@@ -60,11 +59,11 @@ macro( ecbuild_check_fortran_source_return SOURCE )
     cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
     if(_PAR_UNPARSED_ARGUMENTS)
-      message(FATAL_ERROR "Unknown keywords given to ecbuild_check_fortran_source_return(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+      ecbuild_critical("Unknown keywords given to ecbuild_check_fortran_source_return(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
     endif()
 
     if( NOT _PAR_VAR OR NOT _PAR_OUTPUT )
-      message(FATAL_ERROR "The call to ecbuild_check_fortran_source_return() doesn't specify either SOURCE, VAR or OUTPUT")
+      ecbuild_critical("The call to ecbuild_check_fortran_source_return() doesn't specify either SOURCE, VAR or OUTPUT")
     endif()
 
 
@@ -93,15 +92,15 @@ macro( ecbuild_check_fortran_source_return SOURCE )
         if( __add_libs )
             set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${__add_incs}")
         endif()
-    
+
         # write the source file
-    
-        file( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_${_PAR_VAR}.f" "${SOURCE}\n" )
 
-        message( STATUS "Performing Test ${_PAR_VAR}" )
+        file( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_${_PAR_VAR}.F90" "${SOURCE}\n" )
+
+        ecbuild_debug( "Performing Test ${_PAR_VAR}" )
         try_run( ${_PAR_VAR}_EXITCODE ${_PAR_VAR}_COMPILED
           ${CMAKE_BINARY_DIR}
-          ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_${_PAR_VAR}.f
+          ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test_${_PAR_VAR}.F90
           COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
           CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
           -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
@@ -118,7 +117,7 @@ macro( ecbuild_check_fortran_source_return SOURCE )
         # if the return value was 0 then it worked
         if("${${_PAR_VAR}_EXITCODE}" EQUAL 0)
     
-          message(STATUS "Performing Test ${_PAR_VAR} - Success")
+          ecbuild_debug("Performing Test ${_PAR_VAR} - Success")
           file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log 
             "Performing Fortran SOURCE FILE Test ${_PAR_VAR} succeded with the following compile output:\n"
             "${compile_OUTPUT}\n" 
@@ -140,11 +139,11 @@ macro( ecbuild_check_fortran_source_return SOURCE )
             set(${_PAR_OUTPUT} "" CACHE INTERNAL "Test ${_PAR_VAR} output")
           endif()
     
-          message(STATUS "Performing Test ${_PAR_VAR} - Failed")
+          ecbuild_debug("Performing Test ${_PAR_VAR} - Failed")
           file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log 
-            "Performing C SOURCE FILE Test ${_PAR_VAR} failed with the following compile output:\n"
+            "Performing Fortran SOURCE FILE Test ${_PAR_VAR} failed with the following compile output:\n"
             "${compile_OUTPUT}\n" 
-            "Performing C SOURCE FILE Run ${_PAR_VAR} failed with the following run output:\n"
+            "Performing Fortran SOURCE FILE Run ${_PAR_VAR} failed with the following run output:\n"
             "${run_OUTPUT}\n" 
             "Return value: ${${_PAR_VAR}_EXITCODE}\n"
             "Source file was:\n${SOURCE}\n")
diff --git a/cmake/ecbuild_check_functions.cmake b/cmake/ecbuild_check_functions.cmake
index a3ed7a1..73f5cb5 100644
--- a/cmake/ecbuild_check_functions.cmake
+++ b/cmake/ecbuild_check_functions.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
 #
 # This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 
-# In applying this licence, ECMWF does not waive the privileges and immunities 
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
 # granted to it by virtue of its status as an intergovernmental organisation nor
 # does it submit to any jurisdiction.
 
@@ -20,6 +20,8 @@ if( ENABLE_OS_FUNCTIONS_TEST )
     ecbuild_cache_check_symbol_exists( ftruncate    "sys/types.h;unistd.h"            EC_HAVE_FTRUNCATE  )
     ecbuild_cache_check_symbol_exists( open         "sys/types.h;sys/stat.h;fcntl.h"  EC_HAVE_OPEN   )
     ecbuild_cache_check_symbol_exists( fopen        "stdio.h"                         EC_HAVE_FOPEN  )
+    ecbuild_cache_check_symbol_exists( fmemopen     "stdio.h"                         EC_HAVE_FMEMOPEN )
+    ecbuild_cache_check_symbol_exists( funopen      "stdio.h"                         EC_HAVE_FUNOPEN )
     ecbuild_cache_check_symbol_exists( flock        "sys/file.h"                      EC_HAVE_FLOCK  )
     ecbuild_cache_check_symbol_exists( mmap         "sys/mman.h"                      EC_HAVE_MMAP   )
 
@@ -73,10 +75,10 @@ if( ENABLE_OS_FUNCTIONS_TEST )
     ecbuild_cache_check_c_source_compiles( "#define _LARGEFILE64_SOURCE\n#include <sys/stat.h>\nint main(){ struct stat64 s; fstat64(1,&s); return 0; }" EC_HAVE_FSTAT64 )
     # test fseeko64
     ecbuild_cache_check_c_source_compiles( "#define _LARGEFILE64_SOURCE\n#include <stdio.h>\n#include <sys/types.h>\nint main(){FILE* file;off64_t l=0;fseeko64(file,l,SEEK_CUR);return 0;}\n" EC_HAVE_FSEEKO64 )
-   
+
     # test for ftello64
     ecbuild_cache_check_c_source_compiles( "#define _LARGEFILE64_SOURCE\n#include <stdio.h>\n#include <sys/types.h>\nint main(){FILE* file;off64_t l = ftello64(file);return 0;}\n"  EC_HAVE_FTELLO64 )
-    
+
     # test for lseek64
     ecbuild_cache_check_c_source_compiles( "#define _LARGEFILE64_SOURCE\n#include <sys/types.h>\n#include <unistd.h>\nint main(){off64_t h = lseek64(0,0,SEEK_SET);return 0;}\n"  EC_HAVE_LSEEK64 )
     # test for open64
@@ -114,7 +116,7 @@ if( ENABLE_OS_FUNCTIONS_TEST )
     # test for getpwuid_r
     ecbuild_cache_check_c_source_compiles( "#include <unistd.h>\n#include <sys/types.h>\n#include <pwd.h>\nint main(){ char buf[4096]; struct passwd pwbuf; struct passwd *pwbufp = 0; getpwuid_r(getuid(), &pwbuf, buf, sizeof(buf), &pwbufp); }\n" EC_HAVE_GETPWUID_R )
     # test for getpwnam_r
-    ecbuild_cache_check_c_source_compiles( "#include <sys/types.h>\n#include <pwd.h>\nint main(){ struct passwd p; char line[1024]; int n = getpwnam_r(\"user\",&p,line,sizeof(line),0); }\n" EC_HAVE_GETPWNAM_R )    
+    ecbuild_cache_check_c_source_compiles( "#include <sys/types.h>\n#include <pwd.h>\nint main(){ struct passwd p; char line[1024]; int n = getpwnam_r(\"user\",&p,line,sizeof(line),0); }\n" EC_HAVE_GETPWNAM_R )
     # test for readdir_r
     ecbuild_cache_check_c_source_compiles( "#include <dirent.h>\nint main(){ DIR *dirp; struct dirent *entry; struct dirent **result; int i = readdir_r(dirp, entry, result); }\n" EC_HAVE_READDIR_R )
     # test for gethostbyname_r
@@ -164,8 +166,17 @@ if( ENABLE_OS_FUNCTIONS_TEST )
     endif()
     ecbuild_cache_var( EC_HAVE_PROCFS )
 
-#    debug_var(EC_HAVE_PROCFS)
-#    debug_var(EC_HAVE_PROCFS_OUTPUT)
+#    ecbuild_debug_var(EC_HAVE_PROCFS)
+#    ecbuild_debug_var(EC_HAVE_PROCFS_OUTPUT)
+
+    #### check support for DL library #############
+
+    ecbuild_cache_check_include_files( dlfcn.h  EC_HAVE_DLFCN_H )
+
+    cmake_push_check_state(RESET)
+    set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS} )
+    ecbuild_cache_check_c_source_compiles( "#define _GNU_SOURCE\n#include <dlfcn.h>\nint main(){ void* addr; Dl_info info; dladdr(addr, &info); }\n" EC_HAVE_DLADDR )
+    cmake_pop_check_state()
 
 endif()
 
diff --git a/cmake/ecbuild_check_os.cmake b/cmake/ecbuild_check_os.cmake
index 942fb6b..8d325dc 100644
--- a/cmake/ecbuild_check_os.cmake
+++ b/cmake/ecbuild_check_os.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -9,23 +9,34 @@
 ############################################################################################
 # check size of pointer
 
+# Re-check size of void pointer since for some compiler combinations this is not properly set
 ecbuild_cache_check_type_size( "void*" CMAKE_SIZEOF_VOID_P  )
 
+if( NOT CMAKE_C_COMPILER_LOADED AND ENABLE_OS_TESTS )
+
+  enable_language( C )
+  ecbuild_compiler_flags( C )
+
+endif()
+
 math( EXPR EC_OS_BITS "${CMAKE_SIZEOF_VOID_P} * 8" )
 
 # we only support 32 and 64 bit operating systems
 if( NOT EC_OS_BITS EQUAL "32" AND NOT EC_OS_BITS EQUAL "64" )
-	message( FATAL_ERROR "operating system ${CMAKE_SYSTEM} ${EC_OS_BITS} bits -- ecbuild only supports 32 or 64 bit OS's" )
+  ecbuild_critical( "operating system ${CMAKE_SYSTEM} ${EC_OS_BITS} bits -- ecbuild only supports 32 or 64 bit OS's" )
 endif()
-ecbuild_cache_var( EC_OS_BITS )
 
 ############################################################################################
 # For 64 bit architectures enable PIC (position-independent code)
 
-if( ${EC_OS_BITS} EQUAL 64 )
-	set( CMAKE_POSITION_INDEPENDENT_CODE ON )
+# Allow overriding the position independent code setting (ECBUILD-220)
+if( DEFINED ECBUILD_POSITION_INDEPENDENT_CODE )
+  set( CMAKE_POSITION_INDEPENDENT_CODE ${ECBUILD_POSITION_INDEPENDENT_CODE} )
+elseif( ${EC_OS_BITS} EQUAL 64 )
+  set( CMAKE_POSITION_INDEPENDENT_CODE ON )
 endif()
 
+
 ############################################################################################
 # check architecture
 
@@ -45,21 +56,21 @@ if( ENABLE_OS_TYPES_TEST )
 	ecbuild_cache_check_type_size( ssize_t        EC_SIZEOF_SSIZE_T     )
 	ecbuild_cache_check_type_size( off_t          EC_SIZEOF_OFF_T       )
 
-#	message( STATUS "sizeof void*  [${EC_SIZEOF_PTR}]" )
-#	message( STATUS "sizeof off_t  [${EC_SIZEOF_OFF_T}]" )
-#	message( STATUS "sizeof int    [${EC_SIZEOF_INT}]" )
-#	message( STATUS "sizeof short  [${EC_SIZEOF_SHORT}]" )
-#	message( STATUS "sizeof long   [${EC_SIZEOF_LONG}]" )
-#	message( STATUS "sizeof size_t [${EC_SIZEOF_SIZE_T}]" )
-#	message( STATUS "sizeof float  [${EC_SIZEOF_FLOAT}]" )
-#	message( STATUS "sizeof double [${EC_SIZEOF_DOUBLE}]" )
-#	message( STATUS "sizeof long long   [${EC_SIZEOF_LONG_LONG}]" )
-#	message( STATUS "sizeof long double [${EC_SIZEOF_LONG_DOUBLE}]" )
-
-#	message( STATUS "system sizeof :" )
-#	message( STATUS "  void*  [${EC_SIZEOF_PTR}]  size_t [${EC_SIZEOF_SIZE_T}]  off_t  [${EC_SIZEOF_OFF_T}]   short  [${EC_SIZEOF_SHORT}]" )
-#	message( STATUS "  int    [${EC_SIZEOF_INT}]  long   [${EC_SIZEOF_LONG}]  long long   [${EC_SIZEOF_LONG_LONG}]" )
-#	message( STATUS "  float  [${EC_SIZEOF_FLOAT}]  double [${EC_SIZEOF_DOUBLE}]  long double [${EC_SIZEOF_LONG_DOUBLE}]" )
+#	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}]" )
 
 endif()
 
@@ -101,14 +112,19 @@ endif()
 if( ENABLE_OS_ENDINESS_TEST )
 
   if( NOT DEFINED EC_BIG_ENDIAN AND NOT DEFINED EC_LITTLE_ENDIAN )
+
   	test_big_endian( _BIG_ENDIAN )
 
   	if( _BIG_ENDIAN )
-  		set( EC_BIG_ENDIAN    1 )
+        set( EC_BIG_ENDIAN    1 )
+        set( EC_LITTLE_ENDIAN 0 )
   	else()
-  		set( EC_LITTLE_ENDIAN 1 )
+        set( EC_BIG_ENDIAN    0 )
+        set( EC_LITTLE_ENDIAN 1 )
   	endif()
+
   endif()
+
   ecbuild_cache_var( EC_BIG_ENDIAN )
   ecbuild_cache_var( EC_LITTLE_ENDIAN )
 
@@ -142,9 +158,15 @@ if( ENABLE_OS_ENDINESS_TEST )
   	if( "${IEEE_BE}" STREQUAL "" )
   		set( IEEE_BE 0 CACHE INTERNAL "Test IEEE_BE")
   	endif()
+
   endif()
+
   ecbuild_cache_var( IEEE_BE )
 
+  if( EC_BIG_ENDIAN AND NOT IEEE_BE )
+    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) {
@@ -172,12 +194,17 @@ if( ENABLE_OS_ENDINESS_TEST )
   		   return 0;
   		 }" IEEE_LE )
 
-  	if( "${IEEE_BE}" STREQUAL "" )
+  	if( "${IEEE_LE}" STREQUAL "" )
   		set( IEEE_LE 0 CACHE INTERNAL "Test IEEE_LE")
   	endif()
   endif()
+
   ecbuild_cache_var( IEEE_LE )
 
+  if( EC_LITTLE_ENDIAN AND NOT IEEE_LE )
+    ecbuild_critical("Failed to sanity check on endiness: OS should be Little-Endian but compiled code runs differently -- to ignore this pass -DIEEE_LE=0 to CMake/ecBuild")
+  endif()
+
 endif()
 
 ############################################################################################
@@ -202,9 +229,9 @@ if( ENABLE_PROFILING )
     unset( _trust_flags )
 
     unset( _flags )
-  
+
   else()
-    message( WARNING "Profiling enabled but ecbuild doesn't know how to enable for this particular compiler ${CMAKE_C_COMPILER_ID}")
+    ecbuild_warn( "Profiling enabled but ecbuild doesn't know how to enable for this particular compiler ${CMAKE_C_COMPILER_ID}")
   endif()
 
 endif()
@@ -218,33 +245,41 @@ set( EC_OS_NAME "UNKNOWN" )
 
 if( UNIX )
 
-	### APPLE ###
-
-	if( APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
-		set( EC_OS_NAME "macosx" )
-	endif()
-
-	### Linux ###
-
-	if( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
+  ### APPLE ###
 
-		set( EC_OS_NAME "linux" )
+  if( APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
+    set( EC_OS_NAME "macosx" )
+  endif()
 
-		# recent linkers default to --enable-new-dtags
-		# which then adds both RPATH and RUNPATH to executables
-		# thus invalidating RPATH setting, and making LD_LIBRARY_PATH take precedence
-		# to be sure, use tool 'readelf -a <exe> | grep PATH' to see what paths are built-in
-		# see:
-		#  * http://blog.qt.digia.com/blog/2011/10/28/rpath-and-runpath
-		#  * http://www.cmake.org/Wiki/CMake_RPATH_handling
-		#  * man ld
-		#  * http://blog.tremily.us/posts/rpath
-		#  * http://fwarmerdam.blogspot.co.uk/2010/12/rpath-runpath-and-ldlibrarypath.html
-		set(CMAKE_EXE_LINKER_FLAGS     "${CMAKE_EXE_LINKER_FLAGS}    -Wl,--disable-new-dtags")
-		set(CMAKE_SHARED_LINKER_FLAGS  "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--disable-new-dtags")
-		set(CMAKE_MODULE_LINKER_FLAGS  "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--disable-new-dtags")
+  ### Linux ###
+
+  if( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
+
+    set( EC_OS_NAME "linux" )
+
+    # The following option allows enabling the new dtags linker option
+    # (when set to OFF). ONLY SET TO OFF IF YOU KNOW WHAT YOU ARE DOING AND
+    # NEVER WHEN BUILDING PRODUCTION SOFTWARE. YOU HAVE BEEN WARNED!
+    option( ECBUILD_DISABLE_NEW_DTAGS "Set the linker flag --disable-new-dtags" ON )
+    mark_as_advanced( ECBUILD_DISABLE_NEW_DTAGS )
+
+    if( ECBUILD_DISABLE_NEW_DTAGS )
+      # recent linkers default to --enable-new-dtags
+      # which then adds both RPATH and RUNPATH to executables
+      # thus invalidating RPATH setting, and making LD_LIBRARY_PATH take precedence
+      # to be sure, use tool 'readelf -a <exe> | grep PATH' to see what paths are built-in
+      # see:
+      #  * http://blog.qt.digia.com/blog/2011/10/28/rpath-and-runpath
+      #  * http://www.cmake.org/Wiki/CMake_RPATH_handling
+      #  * man ld
+      #  * http://blog.tremily.us/posts/rpath
+      #  * http://fwarmerdam.blogspot.co.uk/2010/12/rpath-runpath-and-ldlibrarypath.html
+      set(CMAKE_EXE_LINKER_FLAGS     "${CMAKE_EXE_LINKER_FLAGS}    -Wl,--disable-new-dtags")
+      set(CMAKE_SHARED_LINKER_FLAGS  "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--disable-new-dtags")
+      set(CMAKE_MODULE_LINKER_FLAGS  "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--disable-new-dtags")
+    endif()
 
-	endif()
+  endif()
 
 	### Solaris ###
 
@@ -350,7 +385,7 @@ endif()
 if( ${CMAKE_SYSTEM_NAME} MATCHES "CYGWIN" )
 
 	set( EC_OS_NAME "cygwin" )
-	message( WARNING "Building on Cygwin should work but is untested" )
+	ecbuild_warn( "Building on Cygwin should work but is untested" )
 
 endif()
 
@@ -359,11 +394,11 @@ endif()
 if( ${EC_OS_NAME} MATCHES "UNKNOWN" )
 
 	if( DISABLE_OS_CHECK )
-		message( WARNING "ecBuild is untested for this operating system: [${CMAKE_SYSTEM_NAME}]"
-						 " -- DISABLE_OS_CHECK is ON so proceeding at your own risk ..." )
+		ecbuild_warn( "ecBuild is untested for this operating system: [${CMAKE_SYSTEM_NAME}]"
+                  " -- DISABLE_OS_CHECK is ON so proceeding at your own risk ..." )
 	else()
-		message( FATAL_ERROR "ecBuild is untested for this operating system: [${CMAKE_SYSTEM_NAME}]"
-							 " -- refusing to continue. Disable this check with -DDISABLE_OS_CHECK=ON" )
+		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()
diff --git a/cmake/ecbuild_compiler_flags.cmake b/cmake/ecbuild_compiler_flags.cmake
new file mode 100644
index 0000000..0e3fe1e
--- /dev/null
+++ b/cmake/ecbuild_compiler_flags.cmake
@@ -0,0 +1,211 @@
+# (C) Copyright 1996-2016 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.
+
+##############################################################################
+#.rst:
+#
+# ecbuild_compiler_flags
+# ======================
+#
+# Set compiler specific default compilation flags for a given language. ::
+#
+#   ecbuild_compiler_flags( <lang> )
+#
+# The procedure is as follows:
+#
+# 1.  ecBuild does *not* set ``CMAKE_<lang>_FLAGS`` i.e. the user can set these
+#     via -D or the CMake cache and these will be the "base" flags.
+#
+# 2.  ecBuild *overwrites* ``CMAKE_<lang>_FLAGS_<btype>`` in the CMake cache
+#     for all build types with compiler specific defaults for the currently
+#     loaded compiler i.e. any value set by the user via -D or the CMake cache
+#     *has no effect*.
+#
+# 3.  Any value the user provides via ``ECBUILD_<lang>_FLAGS`` or
+#     ``ECBUILD_<lang>_FLAGS_<btype>`` *overrides* the corresponding
+#     ``CMAKE_<lang>_FLAGS`` or ``CMAKE_<lang>_FLAGS_<btype>`` *without being
+#     written to the CMake cache*.
+#
+##############################################################################
+
+macro( ecbuild_compiler_flags _lang )
+
+  # Set compiler and language specific default flags - OVERWRITES variables in CMake cache
+  if( CMAKE_${_lang}_COMPILER_LOADED )
+    ecbuild_debug( "ecbuild_compiler_flags(${_lang}): try include ${ECBUILD_MACROS_DIR}/compiler_flags/${CMAKE_${_lang}_COMPILER_ID}_${_lang}.cmake ")
+    include( ${ECBUILD_MACROS_DIR}/compiler_flags/${CMAKE_${_lang}_COMPILER_ID}_${_lang}.cmake OPTIONAL )
+  endif()
+
+  # Apply user or toolchain specified compilation flag overrides (NOT written to cache)
+
+  foreach( _btype NONE DEBUG BIT PRODUCTION RELEASE RELWITHDEBINFO )
+    if( DEFINED ECBUILD_${_lang}_FLAGS_${_btype} )
+      ecbuild_debug( "ecbuild_compiler_flags(${_lang}): overriding CMAKE_${_lang}_FLAGS_${_btype} with ${ECBUILD_${_lang}_FLAGS_${_btype}}")
+      set( CMAKE_${_lang}_FLAGS_${_btype} ${ECBUILD_${_lang}_FLAGS_${_btype}} )
+    endif()
+    mark_as_advanced( CMAKE_${_lang}_FLAGS_${_btype} )
+  endforeach()
+
+  if( DEFINED ECBUILD_${_lang}_FLAGS )
+    ecbuild_debug( "ecbuild_compiler_flags(${_lang}): overriding CMAKE_${_lang}_FLAGS with ${ECBUILD_${_lang}_FLAGS}")
+    set( CMAKE_${_lang}_FLAGS "${ECBUILD_${_lang}_FLAGS}" )
+  endif()
+
+  mark_as_advanced( CMAKE_${_lang}_FLAGS )
+
+  if( DEFINED ECBUILD_${_lang}_LINK_FLAGS )
+    ecbuild_debug( "ecbuild_compiler_flags(${_lang}): overriding CMAKE_${_lang}_LINK_FLAGS with ${ECBUILD_${_lang}_LINK_FLAGS}")
+    set( CMAKE_${_lang}_LINK_FLAGS "${ECBUILD_${_lang}_LINK_FLAGS}" )
+  endif()
+
+  mark_as_advanced( CMAKE_${_lang}_LINK_FLAGS )
+
+  ecbuild_debug_var( CMAKE_${_lang}_FLAGS )
+  foreach( _btype NONE DEBUG BIT PRODUCTION RELEASE RELWITHDEBINFO )
+    ecbuild_debug_var( CMAKE_${_lang}_FLAGS_${_btype} )
+  endforeach()
+
+endmacro()
+
+##############################################################################
+#.rst:
+#
+# Using custom compilation flags
+# ==============================
+#
+# If compilation flags need to be controlled on a per source file basis,
+# ecBuild supports defining custom rules in a CMake or JSON file.
+#
+# When using this approach, *default compilation flags are NOT loaded*!
+#
+# Overriding compilation flags on a per source file basis using CMake rules
+# -------------------------------------------------------------------------
+#
+# Compiler flags can be overridden on a per source file basis by setting the
+# CMake variable ``ECBUILD_COMPILE_FLAGS`` to the *full path* of a CMake file
+# defining the override rules. If set, ``<PNAME>_ECBUILD_COMPILE_FLAGS``
+# takes precendence and ``ECBUILD_COMPILE_FLAGS`` is ignored, allowing for
+# rules that only apply to a subproject (e.g. in a bundle).
+#
+# Flags can be overridden in 3 different ways:
+#
+# 1.  By defining project specific flags for a language and (optionally)
+#     build type e.g. ::
+#
+#       set(<PNAME>_Fortran_FLAGS "...") # common flags for all build types
+#       set(<PNAME>_Fortran_FLAGS_DEBUG "...") # only for DEBUG build type
+#
+# 2.  By defining source file specific flags which are *combined* with the
+#     project and target specific flags ::
+#
+#       set_source_files_properties(<source>
+#         PROPERTIES COMPILE_FLAGS "..."  # common flags for all build types
+#                    COMPILE_FLAGS_DEBUG "...") # only for DEBUG build type
+#
+# 3.  By defining source file specific flags which *override* the project and
+#     target specific flags ::
+#
+#       set_source_files_properties(<source>
+#         PROPERTIES OVERRIDE_COMPILE_FLAGS "..."
+#                    OVERRIDE_COMPILE_FLAGS_DEBUG "...")
+#
+# See ``examples/override-compile-flags`` in the ecBuild source tree for a
+# complete example using this technique.
+#
+# Overriding compilation flags on a per source file basis using JSON rules
+# ------------------------------------------------------------------------
+#
+# Compiler flags can be overridden on a per source file basis by setting the
+# CMake variable ``ECBUILD_SOURCE_FLAGS`` to the *full path* of a JSON file
+# defining the override rules. If set, ``<PNAME>_ECBUILD_SOURCE_FLAGS``
+# takes precendence and ``ECBUILD_SOURCE_FLAGS`` is ignored, allowing for
+# rules that only apply to a subproject (e.g. in a bundle).
+#
+# The JSON file lists shell glob patterns and the rule to apply to each source
+# file matching the pattern, defined as an array ``[op, flag1, ...]``
+# containing an operator followed by one or more flags. Valid operators are:
+#
+# :+: Add the flags to the default compilation flags for matching files
+# :=: Set the flags for matching files, disregarding default compilation flags
+# :/: Remove the flags from the default compilation flags for matching files
+#
+# Rules can be nested to e.g. only apply to a subdirectory by setting the rule
+# to a dictionary, which will only apply to source files matching its pattern.
+#
+# An example JSON file demonstrating different rule types is given below: ::
+#
+#   {
+#     "*"       : [ "+", "-g0" ],
+#     "*.cxx"   : [ "+", "-cxx11" ],
+#     "*.f90"   : [ "+", "-pipe" ],
+#     "foo.c"   : [ "+", "-O0" ],
+#     "foo.cc"  : [ "+", "-O2", "-pipe" ],
+#     "bar/*": {
+#       "*.f90" : [ "=", "-O1" ]
+#     },
+#     "baz/*": {
+#       "*.f90" : [ "/", "-pipe" ],
+#       "*.f90" : [ "/", "-O2" ],
+#       "*.f90" : [ "+", "-O3" ]
+#     }
+#   }
+#
+# See ``examples/override-compile-flags`` in the ecBuild source tree for a
+# complete example using this technique.
+#
+##############################################################################
+
+# Custom (project specific) compilation flags enabled?
+foreach( _flags COMPILE SOURCE )
+  if( ${PROJECT_NAME_CAPS}_ECBUILD_${_flags}_FLAGS )
+    if ( ECBUILD_${_flags}_FLAGS )
+      ecbuild_debug( "Override ECBUILD_${_flags}_FLAGS (${ECBUILD_${_flags}_FLAGS}) with ${PROJECT_NAME} specific flags (${${PROJECT_NAME_CAPS}_ECBUILD_${_flags}_FLAGS})" )
+    else()
+      ecbuild_debug( "Use ${PROJECT_NAME} specific ECBUILD_${_flags}_FLAGS (${${PROJECT_NAME_CAPS}_ECBUILD_${_flags}_FLAGS})" )
+    endif()
+    set( ECBUILD_${_flags}_FLAGS ${${PROJECT_NAME_CAPS}_ECBUILD_${_flags}_FLAGS} )
+  endif()
+  # Ensure ECBUILD_${_flags}_FLAGS is a valid file path
+  if( DEFINED ECBUILD_${_flags}_FLAGS AND NOT EXISTS ${ECBUILD_${_flags}_FLAGS} )
+    ecbuild_warn( "ECBUILD_${_flags}_FLAGS points to non-existent file ${ECBUILD_${_flags}_FLAGS} and will be ignored" )
+    unset( ECBUILD_${_flags}_FLAGS )
+    unset( ECBUILD_${_flags}_FLAGS CACHE )
+  endif()
+endforeach()
+if( ECBUILD_COMPILE_FLAGS )
+  include( "${ECBUILD_COMPILE_FLAGS}" )
+endif()
+
+foreach( _lang C CXX Fortran )
+  if( CMAKE_${_lang}_COMPILER_LOADED )
+
+    # Clear default compilation flags potentially inherited from parent scope
+    # when using custom compilation flags
+    if( ECBUILD_SOURCE_FLAGS OR ECBUILD_COMPILE_FLAGS )
+      set(CMAKE_${_lang}_FLAGS "")
+      foreach(_btype ALL RELEASE RELWITHDEBINFO PRODUCTION BIT DEBUG)
+        set(CMAKE_${_lang}_FLAGS_${_btype} "")
+      endforeach()
+    # Load default compilation flags only if custom compilation flags not enabled
+    else()
+      ecbuild_compiler_flags( ${_lang} )
+    endif()
+
+  endif()
+endforeach()
+
+# Apply user or toolchain specified linker flag overrides per object type (NOT written to cache)
+foreach( _btype NONE DEBUG BIT PRODUCTION RELEASE RELWITHDEBINFO )
+
+  foreach( _obj EXE SHARED MODULE )
+    if( ECBUILD_${_obj}_LINKER_FLAGS_${_btype} )
+      set( CMAKE_${_obj}_LINKER_FLAGS_${_btype} ${ECBUILD_${_obj}_LINKER_FLAGS_${_btype}} )
+    endif()
+  endforeach()
+
+endforeach()
diff --git a/cmake/ecbuild_config.h.in b/cmake/ecbuild_config.h.in
index 2a01618..df9eb91 100644
--- a/cmake/ecbuild_config.h.in
+++ b/cmake/ecbuild_config.h.in
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 1996-2015 ECMWF.
+ * (C) Copyright 1996-2016 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.
@@ -40,6 +40,8 @@
 #cmakedefine EC_HAVE_FTRUNCATE
 #cmakedefine EC_HAVE_OPEN
 #cmakedefine EC_HAVE_FOPEN
+#cmakedefine EC_HAVE_FMEMOPEN
+#cmakedefine EC_HAVE_FUNOPEN
 #cmakedefine EC_HAVE_FLOCK
 #cmakedefine EC_HAVE_MMAP
 
@@ -127,6 +129,12 @@
 #cmakedefine EC_ATTRIBUTE_CONSTRUCTOR_INITS_ARGV
 #cmakedefine EC_HAVE_PROCFS
 
+
+/* --- dl library support --- */
+
+#cmakedefine EC_HAVE_DLFCN_H
+#cmakedefine EC_HAVE_DLADDR
+
 /* --- c compiler support --- */
 
 #cmakedefine EC_HAVE_C_INLINE
diff --git a/cmake/ecbuild_debug_var.cmake b/cmake/ecbuild_debug_var.cmake
deleted file mode 100644
index 9bb3499..0000000
--- a/cmake/ecbuild_debug_var.cmake
+++ /dev/null
@@ -1,47 +0,0 @@
-# (C) Copyright 1996-2015 ECMWF.
-# 
-# This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 
-# In applying this licence, ECMWF does not waive the privileges and immunities 
-# granted to it by virtue of its status as an intergovernmental organisation nor
-# does it submit to any jurisdiction.
-
-##############################################################################
-# macro for exporting a variable to parent scope
-
-macro( set_parent_scope VAR )
-
-	set( ${VAR} ${${VAR}} PARENT_SCOPE )
-
-endmacro( set_parent_scope )
-
-##############################################################################
-# macro for debugging a cmake variable
-
-macro( debug_var VAR )
-
-    message( STATUS "${VAR} [${${VAR}}]" )
-
-endmacro( debug_var )
-
-##############################################################################
-# macro for debugging a cmake list
-
-macro( debug_list VAR )
-
-    message( STATUS "${VAR}:" )
-    foreach( _elem ${${VAR}} )
-      message( STATUS "  ${_elem}" )
-    endforeach()
-
-endmacro( debug_list )
-
-##############################################################################
-# macro for debugging a environment variable within cmake
-
-macro( debug_env_var VAR )
-
-    message( STATUS "ENV ${VAR} [$ENV{${VAR}}]" )
-
-endmacro( debug_env_var )
-
diff --git a/cmake/ecbuild_declare_project.cmake b/cmake/ecbuild_declare_project.cmake
index 11052c6..c95e8e3 100644
--- a/cmake/ecbuild_declare_project.cmake
+++ b/cmake/ecbuild_declare_project.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -28,24 +28,27 @@
 # :<PNAME>_MINOR_VERSION:  minor version number
 # :<PNAME>_PATCH_VERSION:  patch version number
 # :INSTALL_BIN_DIR:        relative install directory for executables
-#                          (default: ``bin``)
 # :INSTALL_LIB_DIR:        relative install directory for libraries
-#                          (default: ``lib``)
 # :INSTALL_INCLUDE_DIR:    relative install directory for include files
-#                          (default: ``include``)
 # :INSTALL_DATA_DIR:       relative install directory for data
-#                          (default: ``share/<project_name>``)
 # :INSTALL_CMAKE_DIR:      relative install directory for CMake files
-#                          (default: ``share/<project_name>/cmake``)
+#
+# Customising install locations
+# -----------------------------
 #
 # The relative installation directories of components can be customised by
 # setting the following CMake variables on the command line or in cache:
 #
-# :<PNAME>_INSTALL_BIN_DIR:     directory for installing executables
-# :<PNAME>_INSTALL_LIB_DIR:     directory for installing libraries
-# :<PNAME>_INSTALL_INCLUDE_DIR: directory for installing include files
-# :<PNAME>_INSTALL_DATA_DIR:    directory for installing data
-# :<PNAME>_INSTALL_CMAKE_DIR:   directory for installing CMake files
+# :INSTALL_BIN_DIR:        directory for installing executables
+#                          (default: ``bin``)
+# :INSTALL_LIB_DIR:        directory for installing libraries
+#                          (default: ``lib``)
+# :INSTALL_INCLUDE_DIR:    directory for installing include files
+#                          (default: ``include``)
+# :INSTALL_DATA_DIR:       directory for installing data
+#                          (default: ``share/<project_name>``)
+# :INSTALL_CMAKE_DIR:      directory for installing CMake files
+#                          (default: ``share/<project_name>/cmake``)
 #
 # Using *relative* paths is recommended, which are interpreted relative to the
 # ``CMAKE_INSTALL_PREFIX``. Using absolute paths makes the build
@@ -69,10 +72,10 @@ macro( ecbuild_declare_project )
     get_git_head_revision( GIT_REFSPEC ${PNAME}_GIT_SHA1 )
     if( ${PNAME}_GIT_SHA1 )
       string( SUBSTRING "${${PNAME}_GIT_SHA1}" 0 7 ${PNAME}_GIT_SHA1_SHORT )
-      #     debug_var( ${PNAME}_GIT_SHA1 )
-      #     debug_var( ${PNAME}_GIT_SHA1_SHORT )
+      #     ecbuild_debug_var( ${PNAME}_GIT_SHA1 )
+      #     ecbuild_debug_var( ${PNAME}_GIT_SHA1_SHORT )
     else()
-      message( STATUS "Could not get git-sha1 for project ${PNAME}")
+      ecbuild_debug( "Could not get git-sha1 for project ${PNAME}")
     endif()
   endif()
 
@@ -101,19 +104,30 @@ macro( ecbuild_declare_project )
   set( ${PNAME}_VERSION_STR "${${PROJECT_NAME}_VERSION_STR}"
        CACHE INTERNAL "package ${PNAME} version string" ) # ignore caps
 
-  #    debug_var( ${PNAME}_VERSION )
-  #    debug_var( ${PNAME}_VERSION_STR )
-  #    debug_var( ${PNAME}_MAJOR_VERSION )
-  #    debug_var( ${PNAME}_MINOR_VERSION )
-  #    debug_var( ${PNAME}_PATCH_VERSION )
+  #    ecbuild_debug_var( ${PNAME}_VERSION )
+  #    ecbuild_debug_var( ${PNAME}_VERSION_STR )
+  #    ecbuild_debug_var( ${PNAME}_MAJOR_VERSION )
+  #    ecbuild_debug_var( ${PNAME}_MINOR_VERSION )
+  #    ecbuild_debug_var( ${PNAME}_PATCH_VERSION )
 
   # install dirs for this project
 
-  set( INSTALL_BIN_DIR bin )
-  set( INSTALL_LIB_DIR lib )
-  set( INSTALL_INCLUDE_DIR include )
-  set( INSTALL_DATA_DIR share/${PROJECT_NAME} )
-  set( INSTALL_CMAKE_DIR share/${PROJECT_NAME}/cmake )
+  # Use defaults unless values are already present in cache
+  if( NOT INSTALL_BIN_DIR )
+    set( INSTALL_BIN_DIR bin )
+  endif()
+  if( NOT INSTALL_LIB_DIR )
+    set( INSTALL_LIB_DIR lib )
+  endif()
+  if( NOT INSTALL_INCLUDE_DIR )
+    set( INSTALL_INCLUDE_DIR include )
+  endif()
+  if( NOT INSTALL_DATA_DIR )
+    set( INSTALL_DATA_DIR share/${PROJECT_NAME} )
+  endif()
+  if( NOT INSTALL_CMAKE_DIR )
+    set( INSTALL_CMAKE_DIR share/${PROJECT_NAME}/cmake )
+  endif()
 
   mark_as_advanced( INSTALL_BIN_DIR )
   mark_as_advanced( INSTALL_LIB_DIR )
@@ -121,10 +135,11 @@ macro( ecbuild_declare_project )
   mark_as_advanced( INSTALL_DATA_DIR )
   mark_as_advanced( INSTALL_CMAKE_DIR )
 
-  # overrides of install dirs
+  # overrides of install dirs (deprecated in ecBuild 2.4.0)
 
   foreach( p LIB BIN INCLUDE DATA CMAKE )
     if( ${PNAME}_INSTALL_${p}_DIR )
+      ecbuild_deprecate( "Use of ${PNAME}_INSTALL_${p}_DIR is deprecated and will be removed in a future release. Use INSTALL_${p}_DIR instead." )
       set( INSTALL_${p}_DIR ${${PNAME}_INSTALL_${p}_DIR} )
     endif()
   endforeach()
@@ -133,7 +148,7 @@ macro( ecbuild_declare_project )
 
   foreach( p LIB BIN INCLUDE DATA CMAKE )
     if( IS_ABSOLUTE ${INSTALL_${p}_DIR} )
-      message( WARNING "Defining INSTALL_${p}_DIR as absolute path '${INSTALL_${p}_DIR}' makes this build non-relocatable, possibly breaking the installation of RPMS and DEB packages" )
+      ecbuild_warn( "Defining INSTALL_${p}_DIR as absolute path '${INSTALL_${p}_DIR}' makes this build non-relocatable, possibly breaking the installation of RPMS and DEB packages" )
     endif()
   endforeach()
 
@@ -146,12 +161,12 @@ macro( ecbuild_declare_project )
       set( ${PNAME}_FULL_INSTALL_${p}_DIR "${CMAKE_INSTALL_PREFIX}/${${var}}"
            CACHE INTERNAL "${PNAME} ${p} full install path" )
     else()
-      message( WARNING "Setting an absolute path for ${VAR} in project ${PNAME}, breakes generation of relocatable binary packages (rpm,deb,...)" )
+      ecbuild_warn( "Setting an absolute path for ${VAR} in project ${PNAME}, breakes generation of relocatable binary packages (rpm,deb,...)" )
       set( ${PNAME}_FULL_INSTALL_${p}_DIR "${${var}}"
            CACHE INTERNAL "${PNAME} ${p} full install path" )
     endif()
 
-    #        debug_var( ${PNAME}_FULL_INSTALL_${p}_DIR )
+    #        ecbuild_debug_var( ${PNAME}_FULL_INSTALL_${p}_DIR )
 
   endforeach()
 
@@ -162,7 +177,7 @@ macro( ecbuild_declare_project )
     if( ENABLE_RELATIVE_RPATHS )
 
       file( RELATIVE_PATH relative_rpath ${${PNAME}_FULL_INSTALL_BIN_DIR} ${${PNAME}_FULL_INSTALL_LIB_DIR} )
-      # debug_var( relative_rpath )
+      # ecbuild_debug_var( relative_rpath )
 
       ecbuild_append_to_rpath( ${relative_rpath} )
 
@@ -171,23 +186,23 @@ macro( ecbuild_declare_project )
       if( IS_ABSOLUTE ${INSTALL_LIB_DIR} )
         ecbuild_append_to_rpath( "${INSTALL_LIB_DIR}" )
       else()
-        ecbuild_append_to_rpath( "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR}" ) 
+        ecbuild_append_to_rpath( "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR}" )
       endif()
 
     endif()
 
   endif()
 
-  # debug_var( CMAKE_INSTALL_RPATH )
+  # ecbuild_debug_var( CMAKE_INSTALL_RPATH )
 
   # print project header
 
   message( STATUS "---------------------------------------------------------" )
 
   if( ${PNAME}_GIT_SHA1_SHORT )
-    message( STATUS "[${PROJECT_NAME}] (${${PNAME}_VERSION_STR}) [${${PNAME}_GIT_SHA1_SHORT}]" )
+    ecbuild_info( "[${PROJECT_NAME}] (${${PNAME}_VERSION_STR}) [${${PNAME}_GIT_SHA1_SHORT}]" )
   else()
-    message( STATUS "[${PROJECT_NAME}] (${${PNAME}_VERSION_STR})" )
+    ecbuild_info( "[${PROJECT_NAME}] (${${PNAME}_VERSION_STR})" )
   endif()
 
 endmacro( ecbuild_declare_project )
diff --git a/cmake/ecbuild_define_build_types.cmake b/cmake/ecbuild_define_build_types.cmake
index 53e4de0..cf92d23 100644
--- a/cmake/ecbuild_define_build_types.cmake
+++ b/cmake/ecbuild_define_build_types.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -7,55 +7,6 @@
 # does it submit to any jurisdiction.
 
 ############################################################################################
-# define a Production build type
-
-# NOTE: gcc does not guarrante that -O3 performs better than -O2
-#       -- it can perform worse due to assembly code bloating.
-#   Moreover for gcc 4.1.2 we found that -O3 remove the parser code generated from Lex/Yacc
-#   and therefore in production mode we downgrade to -O2 if the compiler is GCC (for all versions).
-
-
-if(CMAKE_COMPILER_IS_GNUCXX)
-    set( CMAKE_CXX_FLAGS_PRODUCTION "-O2 -g" CACHE STRING "Flags used by the C++ compiler during Production builds." FORCE )
-else()
-    set( CMAKE_CXX_FLAGS_PRODUCTION "-O3 -g" CACHE STRING "Flags used by the C++ compiler during Production builds." FORCE )
-endif()
-
-if(CMAKE_COMPILER_IS_GNUCC)
-    set( CMAKE_C_FLAGS_PRODUCTION "-O2 -g" CACHE STRING "Flags used by the C compiler during Production builds." FORCE )
-else()
-    set( CMAKE_C_FLAGS_PRODUCTION "-O3 -g" CACHE STRING "Flags used by the C compiler during Production builds." FORCE )
-endif()
-
-set( CMAKE_EXE_LINKER_FLAGS_PRODUCTION "" CACHE STRING "Flags used for linking binaries during Production builds." FORCE )
-set( CMAKE_SHARED_LINKER_FLAGS_PRODUCTION "" CACHE STRING "Flags used by the shared libraries linker during Production builds." FORCE )
-set( CMAKE_MODULE_LINKER_FLAGS_PRODUCTION "" CACHE STRING "Flags used by the static libraries linker during Production builds." FORCE )
-
-mark_as_advanced(
-    CMAKE_CXX_FLAGS_PRODUCTION
-    CMAKE_C_FLAGS_PRODUCTION
-    CMAKE_EXE_LINKER_FLAGS_PRODUCTION
-	  CMAKE_SHARED_LINKER_FLAGS_PRODUCTION
-	  CMAKE_MODULE_LINKER_FLAGS_PRODUCTION )
-
-############################################################################################
-# fixes for specific compilers
-
-### remove -Mipa=fast from PGI compilers in RELEASE mode
-
-if( CMAKE_C_COMPILER_ID STREQUAL "PGI" )
-  set(CMAKE_C_FLAGS_RELEASE "-fast -O3")
-endif()
-
-if( CMAKE_CXX_COMPILER_ID STREQUAL "PGI" )
-  set(CMAKE_CXX_FLAGS_RELEASE "-fast -O3")
-endif()
-
-if( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )
-  set(CMAKE_Fortran_FLAGS_RELEASE "-fast -O3")
-endif()
-
-############################################################################################
 # define default build type
 
 set( _BUILD_TYPE_MSG "Build type options are: [ None | Debug | Bit | Production | Release | RelWithDebInfo ]" )
@@ -104,34 +55,5 @@ if( NOT CMAKE_BUILD_TYPE MATCHES "None"  AND
 	  NOT CMAKE_BUILD_TYPE MATCHES "Production" AND
     NOT CMAKE_BUILD_TYPE MATCHES "Release"  AND
     NOT CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo" )
-    message( FATAL_ERROR "CMAKE_BUILD_TYPE is not recognized. ${_BUILD_TYPE_MSG}" )
+    ecbuild_critical( "CMAKE_BUILD_TYPE is not recognized. ${_BUILD_TYPE_MSG}" )
 endif()
-
-############################################################################################
-# overrides of the flags per build type
-
-foreach( _btype NONE DEBUG BIT PRODUCTION RELEASE RELWITHDEBINFO )
-
-  # OVERRIDE Compiler FLAGS per language (we override because CMake forcely defines them)
-  foreach( _lang C CXX Fortran )
-    if( ECBUILD_${_lang}_FLAGS_${_btype} )
-      set( CMAKE_${_lang}_FLAGS_${_btype} ${ECBUILD_${_lang}_FLAGS_${_btype}} )
-    endif()
-  endforeach()
-
-  # OVERRIDE Linker FLAGS per object type (we override because CMake forcely defines them)
-  foreach( _obj EXE SHARED MODULE )
-    if( ECBUILD_${_obj}_LINKER_FLAGS_${_btype} )
-      set( CMAKE_${_obj}_LINKER_FLAGS_${_btype} ${ECBUILD_${_obj}_LINKER_FLAGS_${_btype}} )
-    endif()
-  endforeach()
-
-endforeach()
-
-# APPEND Linker FLAGS per language (we append because CMake typically leaves them empty)
-
-foreach( _lang C CXX Fortran )
-  if( ECBUILD_${_lang}_LINK_FLAGS )
-    set( CMAKE_${_lang}_LINK_FLAGS "${CMAKE_${_lang}_LINK_FLAGS} ${ECBUILD_${_lang}_LINK_FLAGS}" )
-  endif()
-endforeach()
\ No newline at end of file
diff --git a/cmake/ecbuild_define_libs_and_execs_target.cmake b/cmake/ecbuild_define_libs_and_execs_target.cmake
new file mode 100644
index 0000000..812f42c
--- /dev/null
+++ b/cmake/ecbuild_define_libs_and_execs_target.cmake
@@ -0,0 +1,29 @@
+# (C) Copyright 1996-2016 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.
+
+set( EC_ALL_EXES "" CACHE INTERNAL "" )
+set( EC_ALL_LIBS "" CACHE INTERNAL "" )
+
+############################################################################################
+# define libs and execs targets
+
+macro( ecbuild_define_libs_and_execs_targets )
+
+  add_custom_target( libs )
+
+  if( EC_ALL_LIBS )
+    add_dependencies( libs ${EC_ALL_LIBS} )
+  endif()
+
+  add_custom_target( execs )
+
+  if( EC_ALL_EXECS )
+    add_dependencies( execs ${EC_ALL_EXES} )
+  endif()
+
+endmacro(ecbuild_define_libs_and_execs_targets)
diff --git a/cmake/ecbuild_links_target.cmake b/cmake/ecbuild_define_links_target.cmake
similarity index 92%
rename from cmake/ecbuild_links_target.cmake
rename to cmake/ecbuild_define_links_target.cmake
index c881c0d..b5f53fe 100644
--- a/cmake/ecbuild_links_target.cmake
+++ b/cmake/ecbuild_define_links_target.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -63,11 +63,11 @@ macro( ecbuild_define_links_target )
 
     add_custom_target( links DEPENDS ${ec_link_libs} ${ec_link_exes} )
 
-     #   debug_var( EC_ALL_EXES )
-     #   debug_var( ec_link_exes )
+     #   ecbuild_debug_var( EC_ALL_EXES )
+     #   ecbuild_debug_var( ec_link_exes )
 
-     #  debug_var( EC_ALL_LIBS )
-     #   debug_var( ec_link_libs )
+     #  ecbuild_debug_var( EC_ALL_LIBS )
+     #   ecbuild_debug_var( ec_link_libs )
 
   endif()
 
diff --git a/cmake/ecbuild_define_options.cmake b/cmake/ecbuild_define_options.cmake
index f7a2321..af40ae1 100644
--- a/cmake/ecbuild_define_options.cmake
+++ b/cmake/ecbuild_define_options.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
-# 
+# (C) Copyright 1996-2016 ECMWF.
+#
 # This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 
-# In applying this licence, ECMWF does not waive the privileges and immunities 
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
 # granted to it by virtue of its status as an intergovernmental organisation nor
 # does it submit to any jurisdiction.
 
@@ -46,3 +46,7 @@ option( ECBUILD_USE_INCLUDE_DIRECTORIES "Forces to use global include_directorie
 mark_as_advanced( ECBUILD_USE_INCLUDE_DIRECTORIES )
 
 set( CMAKE_NO_SYSTEM_FROM_IMPORTED ON )
+
+# hide some CMake options from CMake UI
+
+mark_as_advanced( CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT )
\ No newline at end of file
diff --git a/cmake/ecbuild_define_paths.cmake b/cmake/ecbuild_define_paths.cmake
index 822bf71..6584b26 100644
--- a/cmake/ecbuild_define_paths.cmake
+++ b/cmake/ecbuild_define_paths.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
-# 
+# (C) Copyright 1996-2016 ECMWF.
+#
 # This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 
-# In applying this licence, ECMWF does not waive the privileges and immunities 
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
 # granted to it by virtue of its status as an intergovernmental organisation nor
 # does it submit to any jurisdiction.
 
@@ -15,17 +15,22 @@ file( MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
 
 # setup library building rpaths (both in build dir and then when installed)
 
-set( CMAKE_INSTALL_RPATH_USE_LINK_PATH   TRUE  ) # add the automatic parts to RPATH which point to dirs outside build tree
+# add the automatic parts to RPATH which point to dirs outside build tree
+set( CMAKE_INSTALL_RPATH_USE_LINK_PATH   TRUE  )
 
 # use RPATHs for the build tree
 set( CMAKE_SKIP_BUILD_RPATH              FALSE  )
 
-if( ENABLE_RELATIVE_RPATHS )
-    # when building, use the install RPATH immedietly
-	set( CMAKE_BUILD_WITH_INSTALL_RPATH      TRUE  )
+# If INSTALL_LIB_DIR is set to anything other than lib, the relative install
+# RPATH is wrong in the build tree
+if( ENABLE_RELATIVE_RPATHS AND (NOT INSTALL_LIB_DIR OR INSTALL_LIB_DIR STREQUAL "lib") )
+  # when building, use the install RPATH immediately (we don't want to relink)
+  set( CMAKE_BUILD_WITH_INSTALL_RPATH      TRUE  )
+  ecbuild_debug( "Building with install RPATH" )
 else()
-    # when building, don't use the install RPATH yet, but later on when installing
-    set( CMAKE_BUILD_WITH_INSTALL_RPATH      FALSE  ) 
+  # when building, don't use the install RPATH yet, but later on when installing
+  set( CMAKE_BUILD_WITH_INSTALL_RPATH      FALSE  )
+  ecbuild_debug( "Not building with install RPATH, need to relink when installing" )
 endif()
 
 # Always include srcdir and builddir in include path
diff --git a/cmake/ecbuild_dont_pack.cmake b/cmake/ecbuild_dont_pack.cmake
index 099ee1d..bc62182 100644
--- a/cmake/ecbuild_dont_pack.cmake
+++ b/cmake/ecbuild_dont_pack.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -41,11 +41,11 @@ macro( ecbuild_dont_pack )
     cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
     if(_PAR_UNPARSED_ARGUMENTS)
-      message(FATAL_ERROR "Unknown keywords given to ecbuild_dont_pack(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+      ecbuild_critical("Unknown keywords given to ecbuild_dont_pack(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
     endif()
 
     if( NOT DEFINED _PAR_REGEX AND NOT  DEFINED _PAR_FILES AND NOT  DEFINED _PAR_DIRS )
-      message(FATAL_ERROR "Call to ecbuild_dont_pack does not speficify any list to avoid packing.")
+      ecbuild_critical("Call to ecbuild_dont_pack does not speficify any list to avoid packing.")
     endif()
 
     set( LOCAL_FILES_NOT_TO_PACK "" )
diff --git a/cmake/ecbuild_download_resource.cmake b/cmake/ecbuild_download_resource.cmake
index d313704..5d394f5 100644
--- a/cmake/ecbuild_download_resource.cmake
+++ b/cmake/ecbuild_download_resource.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -25,6 +25,7 @@ function( ecbuild_download_resource _p_OUT _p_URL )
   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}
                        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} RESULT_VARIABLE CMD_RESULT )
@@ -34,12 +35,12 @@ function( ecbuild_download_resource _p_OUT _p_URL )
         execute_process( COMMAND ${WGET_PROGRAM} -nv -O ${_p_OUT} ${_p_URL}
                          WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} RESULT_VARIABLE CMD_RESULT )
       else()
-        message(FATAL_ERROR "Could not find curl or wget. Error downloading ${_p_URL}")
+        ecbuild_critical("Could not find curl or wget. Error downloading ${_p_URL}")
       endif()
     endif()
 
     if(CMD_RESULT)
-      message(FATAL_ERROR "Error downloading ${_p_URL}")
+      ecbuild_critical("Error downloading ${_p_URL}")
     endif()
 
   endif()
diff --git a/cmake/ecbuild_echo_targets.cmake b/cmake/ecbuild_echo_targets.cmake
index ddaa2e4..1406a1f 100644
--- a/cmake/ecbuild_echo_targets.cmake
+++ b/cmake/ecbuild_echo_targets.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -32,13 +32,13 @@ function(ecbuild_echo_target_property tgt prop)
   get_property(s TARGET ${tgt} PROPERTY ${prop} SET)
 
   # only produce output for values that are set
-  #if(s)
-    message("tgt='${tgt}' prop='${prop}'")
-    message("  value='${v}'")
-    message("  defined='${d}'")
-    message("  set='${s}'")
-    message("")
-  #endif()
+  if(s)
+    ecbuild_debug("tgt='${tgt}' prop='${prop}'")
+    ecbuild_debug("  value='${v}'")
+    ecbuild_debug("  defined='${d}'")
+    ecbuild_debug("  set='${s}'")
+    ecbuild_debug("")
+  endif()
 
   cmake_policy(POP)
 
@@ -58,7 +58,7 @@ endfunction()
 
 function(ecbuild_echo_target tgt)
   if(NOT TARGET ${tgt})
-    message("There is no target named '${tgt}'")
+    ecbuild_debug("There is no target named '${tgt}'")
     return()
   endif()
 
@@ -205,11 +205,11 @@ WIN32_EXECUTABLE
 XCODE_ATTRIBUTE_WHATEVER
 )
 
-  message("======================== ${tgt} ========================")
+  ecbuild_debug("======================== ${tgt} ========================")
   foreach(p ${props})
-    ecbuild_echo_target_property("${t}" "${p}")
+    ecbuild_echo_target_property("${tgt}" "${p}")
   endforeach()
-  message("")
+  ecbuild_debug("")
 endfunction()
 
 ##############################################################################
diff --git a/cmake/ecbuild_enable_fortran.cmake b/cmake/ecbuild_enable_fortran.cmake
index 16512e8..c1c5503 100644
--- a/cmake/ecbuild_enable_fortran.cmake
+++ b/cmake/ecbuild_enable_fortran.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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,17 +36,24 @@ macro( ecbuild_enable_fortran )
   cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
   if(_PAR_UNPARSED_ARGUMENTS)
-    message(FATAL_ERROR "Unknown keywords given to ecbuild_enable_fortran(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+    ecbuild_critical("Unknown keywords given to ecbuild_enable_fortran(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
   endif()
 
-  enable_language( Fortran )
+  if( NOT CMAKE_Fortran_COMPILER_LOADED )
+    enable_language( Fortran )
+    ecbuild_compiler_flags( Fortran )
+    if( ENABLE_WARNINGS AND CMAKE_Fortran_COMPILER_ID MATCHES "Intel" )
+      set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -warn all" )
+      ecbuild_debug( "Fortran FLAG [-warn all] added" )
+    endif()
+  endif()
 
   if( DEFINED _PAR_REQUIRED )
     if( CMAKE_Fortran_COMPILER_FORCED )
       set( CMAKE_Fortran_COMPILER_WORKS 1 )
     endif()
     if( NOT CMAKE_Fortran_COMPILER OR NOT CMAKE_Fortran_COMPILER_WORKS )
-      message( FATAL_ERROR "Fortran compiler required by project ${PROJECT_NAME} but does not seem to work" )
+      ecbuild_critical( "Fortran compiler required by project ${PROJECT_NAME} but does not seem to work" )
     endif()
   endif()
 
diff --git a/cmake/ecbuild_features.cmake b/cmake/ecbuild_features.cmake
index 5d619a5..6d20038 100644
--- a/cmake/ecbuild_features.cmake
+++ b/cmake/ecbuild_features.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -10,10 +10,6 @@
 
 include( FeatureSummary )
 
-function( debug_var _var )
-  message( "${_var} = ${${_var}}" )
-endfunction()
-
 # Write list of enabled features to CMake variable ${OUT}
 macro( ecbuild_enabled_features OUT )
     get_property( ${OUT}  GLOBAL PROPERTY ENABLED_FEATURES )
@@ -26,17 +22,17 @@ endmacro()
 
 # Enable the feature ${_name} (add to enabled features, remove from disabled)
 function( ecbuild_enable_feature _name )
-  
+
   get_property( _enabled_features  GLOBAL PROPERTY ENABLED_FEATURES )
   get_property( _disabled_features GLOBAL PROPERTY DISABLED_FEATURES )
-  
+
   if( _disabled_features )
     list( REMOVE_ITEM _disabled_features ${_name} )
   endif()
 
   list( APPEND _enabled_features ${_name} )
   list( REMOVE_DUPLICATES _enabled_features )
-    
+
   set_property(GLOBAL PROPERTY ENABLED_FEATURES  "${_enabled_features}" )
   set_property(GLOBAL PROPERTY DISABLED_FEATURES "${_disabled_features}" )
 
@@ -47,53 +43,42 @@ function( ecbuild_disable_feature _name )
 
   get_property( _enabled_features  GLOBAL PROPERTY ENABLED_FEATURES )
   get_property( _disabled_features GLOBAL PROPERTY DISABLED_FEATURES )
-  
+
   if( _enabled_features )
     list( REMOVE_ITEM _enabled_features ${_name} )
   endif()
 
   list( APPEND _disabled_features ${_name} )
   list( REMOVE_DUPLICATES _disabled_features )
-    
+
   set_property(GLOBAL PROPERTY ENABLED_FEATURES  "${_enabled_features}" )
   set_property(GLOBAL PROPERTY DISABLED_FEATURES "${_disabled_features}" )
-  
-endfunction()
 
-# Set description of feature ${_name} to ${_desc}
-function( ecbuild_set_feature_description _name _desc)      
-  set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" )
-endfunction()
-
-# Set purpose of feature ${_name} to ${_desc}
-function( ecbuild_set_feature_purpose _name _purpose )
-  get_property( _purpose_list  GLOBAL PROPERTY _CMAKE_${_name}_PURPOSE )
-  list( APPEND _purpose_list ${_purpose} )
-  list( REMOVE_DUPLICATES _purpose_list )
-  set_property(GLOBAL PROPERTY _CMAKE_${_name}_PURPOSE "${_purpose_list}" )
 endfunction()
 
 # en/disable feature ${_name} and set its description and purpose
 function( ecbuild_set_feature _name )
 
   set(options ) # none
-  set(oneValueArgs ENABLED DESCRIPTION PURPOSE )
+  set(oneValueArgs ENABLED )
   set(multiValueArgs ) # none
 
-  CMAKE_PARSE_ARGUMENTS( _PAR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
-  
-  get_property( _feature_desc      GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION )  
+  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)
@@ -105,17 +90,9 @@ function( ecbuild_set_feature _name )
   if (${_index} GREATER -1)
     set( _feature_found 1 )
   endif()
-  
+
   if( NOT _feature_found )
-    message( WARNING "Feature ${_name} has not yet been enabled or disabled" )
-  endif()
-  
-  if( _PAR_DESCRIPTION )
-    ecbuild_set_feature_description( ${_name} ${_PAR_DESCRIPTION} )
-  endif()
-  
-  if( _PAR_PURPOSE )
-    ecbuild_set_feature_purpose( ${_name} ${_PAR_PURPOSE} )
+    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 850c4a3..279833f 100644
--- a/cmake/ecbuild_find_fortranlibs.cmake
+++ b/cmake/ecbuild_find_fortranlibs.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -39,7 +39,7 @@ macro( ecbuild_find_fortranlibs )
   cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
   if(_PAR_UNPARSED_ARGUMENTS)
-    message(FATAL_ERROR "Unknown keywords given to ecbuild_find_python(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+    ecbuild_critical("Unknown keywords given to ecbuild_find_python(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
   endif()
 
   if( NOT FORTRANLIBS_FOUND ) # don't repeat search
@@ -69,7 +69,7 @@ macro( ecbuild_find_fortranlibs )
     endif()
 
     if( _PAR_COMPILER AND NOT __known_fcomp )
-      message( FATAL_ERROR "unknown fortran compiler ${_PAR_COMPILER}" )
+      ecbuild_critical( "unknown fortran compiler ${_PAR_COMPILER}" )
     endif()
 
     ### set path from environment variables
@@ -88,7 +88,7 @@ macro( ecbuild_find_fortranlibs )
              WITH_XL_FORTRAN OR WITH_INTEL_FORTRAN)
         AND NOT (DEFINED PGI_PATH OR DEFINED LIBGFORTRAN_PATH OR
                  DEFINED XLF_PATH OR DEFINED INTEL_PATH) )
-      message( WARNING "Finding fortran libs for unspecified Fortran compiler: default search [ gfortran ]" )
+      ecbuild_warn( "Finding fortran libs for unspecified Fortran compiler: default search [ gfortran ]" )
       set( WITH_LIBGFORTRAN 1 )
     endif()
 
@@ -148,13 +148,13 @@ macro( ecbuild_find_fortranlibs )
       set( FORTRANLIBS_FOUND 1 CACHE INTERNAL "Fortran libraries found" )
       set( FORTRANLIBS_NAME ${_flibs_txt}  CACHE INTERNAL "Fortran library name" )
       set( FORTRAN_LIBRARIES ${FORTRAN_LIBRARIES} CACHE INTERNAL "Fortran libraries" )
-      message( STATUS "Found Fortran libraries: ${_flibs_txt}" )
+      ecbuild_info( "Found Fortran libraries: ${_flibs_txt}" )
     else()
       set( FORTRANLIBS_FOUND 0 )
       if( _PAR_REQUIRED )
-        message( FATAL_ERROR "Failed to find Fortran libraries" )
+        ecbuild_critical( "Failed to find Fortran libraries" )
       else()
-        message( STATUS "Failed to find Fortran libraries" )
+        ecbuild_warn( "Failed to find Fortran libraries" )
       endif()
     endif()
 
diff --git a/cmake/ecbuild_find_lexyacc.cmake b/cmake/ecbuild_find_lexyacc.cmake
index 9876097..5c13269 100644
--- a/cmake/ecbuild_find_lexyacc.cmake
+++ b/cmake/ecbuild_find_lexyacc.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -34,6 +34,7 @@
 #
 # The following CMake variables are set if lex and yacc were found:
 #
+# :LEXYACC_FOUND:   Found suitable combination of bison, lex, yacc, flex
 # :LEX_FOUND:       lex was found
 # :YACC_FOUND:      yacc was found
 # :LEX_EXECUTABLE:  path to the lex executable
@@ -47,7 +48,10 @@ macro( ecbuild_find_lexyacc )
 
   if( NOT SKIP_BISON )
 
-    find_package( BISON 2.3 )
+    find_package( BISON )
+    if(BISON_FOUND AND BISON_VERSION VERSION_LESS 2.3 )
+        ecbuild_critical( "Bison found with version ${BISON_VERSION} is less than 2.3.\nPlease define BISON_EXECUTABLE to an appropriate version or define SKIP_BISON to try finding Yacc instead" )
+    endif()
     find_package( FLEX )
 
   endif()
@@ -59,25 +63,32 @@ macro( ecbuild_find_lexyacc )
 
   endif()
 
+  set( LEXYACC_FOUND 1 )
+
   if( NOT YACC_FOUND AND NOT BISON_FOUND ) # neither bison nor yacc were found
-    message( FATAL_ERROR "neither bison or yacc were found - at least one is required (together with its lexical analyser" )
+    ecbuild_debug( "Neither bison or yacc were found - at least one is required (together with its lexical analyser" )
+    set( LEXYACC_FOUND 0 )
   endif()
 
   if( NOT YACC_FOUND ) # check for both bison & flex together
     if( BISON_FOUND AND NOT FLEX_FOUND )
-      message( FATAL_ERROR "both bison and flex are required - flex not found" )
+      set( LEXYACC_FOUND 0 )
+      ecbuild_debug( "Both bison and flex are required - flex not found" )
     endif()
     if( FLEX_FOUND AND NOT BISON_FOUND )
-      message( FATAL_ERROR "both bison and flex are required - bison not found" )
+      set( LEXYACC_FOUND 0 )
+      ecbuild_debug( "Both bison and flex are required - bison not found" )
     endif()
   endif()
 
   if( NOT BISON_FOUND ) # check for both yacc & lex together
     if( YACC_FOUND AND NOT LEX_FOUND )
-      message( FATAL_ERROR "both yacc and lex are required - lex not found" )
+      set( LEXYACC_FOUND 0 )
+      ecbuild_debug( "Both yacc and lex are required - lex not found" )
     endif()
     if( LEX_FOUND AND NOT YACC_FOUND )
-      message( FATAL_ERROR "both yacc and lex are required - yacc not found" )
+      set( LEXYACC_FOUND 0 )
+      ecbuild_debug( "Both yacc and lex are required - yacc not found" )
     endif()
   endif()
 
diff --git a/cmake/ecbuild_find_mpi.cmake b/cmake/ecbuild_find_mpi.cmake
index 82fc4b5..a0c6cfa 100644
--- a/cmake/ecbuild_find_mpi.cmake
+++ b/cmake/ecbuild_find_mpi.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -81,7 +81,7 @@ macro( ecbuild_find_mpi )
     cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
     if(_PAR_UNPARSED_ARGUMENTS)
-      message(FATAL_ERROR "Unknown keywords given to ecbuild_find_mpi(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+      ecbuild_critical("Unknown keywords given to ecbuild_find_mpi(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
     endif()
 
     # if user defined compilers are MPI compliant, then we use them ...
@@ -110,7 +110,7 @@ macro( ecbuild_find_mpi )
                 C_COMPILER_SUPPORTS_MPI )
 
             if( C_COMPILER_SUPPORTS_MPI )
-                message( STATUS "C compiler supports MPI -- ${CMAKE_C_COMPILER}" )
+                ecbuild_info( "C compiler supports MPI -- ${CMAKE_C_COMPILER}" )
                 set( MPI_C_COMPILER ${CMAKE_C_COMPILER} )
             endif()
 
@@ -134,7 +134,7 @@ macro( ecbuild_find_mpi )
                  CXX_COMPILER_SUPPORTS_MPI )
 
             if( CXX_COMPILER_SUPPORTS_MPI )
-                message( STATUS "C++ compiler supports MPI -- ${CMAKE_CXX_COMPILER}" )
+                ecbuild_info( "C++ compiler supports MPI -- ${CMAKE_CXX_COMPILER}" )
                 set( MPI_CXX_COMPILER ${CMAKE_CXX_COMPILER} )
             endif()
 
@@ -157,7 +157,7 @@ macro( ecbuild_find_mpi )
             Fortran_COMPILER_SUPPORTS_MPI )
 
             if( Fortran_COMPILER_SUPPORTS_MPI )
-                message( STATUS "Fortran compiler supports MPI (F90) -- ${CMAKE_Fortran_COMPILER}" )
+                ecbuild_info( "Fortran compiler supports MPI (F90) -- ${CMAKE_Fortran_COMPILER}" )
                 set( MPI_Fortran_COMPILER ${CMAKE_Fortran_COMPILER} )
                 set( MPI_Fortran_FOUND TRUE )
             endif()
@@ -251,7 +251,7 @@ macro( ecbuild_enable_mpi )
     cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
     if(_PAR_UNPARSED_ARGUMENTS)
-        message(FATAL_ERROR "Unknown keywords given to ecbuild_find_mpi(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+        ecbuild_critical("Unknown keywords given to ecbuild_find_mpi(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
     endif()
 
     if( NOT _PAR_COMPONENTS )
@@ -304,7 +304,7 @@ macro( ecbuild_include_mpi )
     cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
     if(_PAR_UNPARSED_ARGUMENTS)
-        message(FATAL_ERROR "Unknown keywords given to ecbuild_find_mpi(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+        ecbuild_critical("Unknown keywords given to ecbuild_find_mpi(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
     endif()
 
     if( MPI_C_FOUND AND NOT C_COMPILER_SUPPORTS_MPI )
diff --git a/cmake/ecbuild_find_omp.cmake b/cmake/ecbuild_find_omp.cmake
index 882adfe..914da24 100644
--- a/cmake/ecbuild_find_omp.cmake
+++ b/cmake/ecbuild_find_omp.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -30,7 +30,7 @@ macro( lookup_omp_flags )
   #ifdef _OPENMP
     #pragma omp parallel
     {
-      int id = omp_get_thread_num();
+      (void)omp_get_thread_num();
     }
     return 0;
   #else
@@ -53,7 +53,7 @@ macro( lookup_omp_flags )
     #pragma omp parallel
     {
       // This pragma should have passed compilation
-      int id = 0;
+      (void)0;
     }
     return 0;
   #endif
@@ -123,7 +123,7 @@ macro( ecbuild_find_omp )
   cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
   if( NOT _PAR_COMPONENTS )
-    message( FATAL_ERROR "No COMPONENTS were specified, looking for OMP.\n Please find with COMPONENTS C CXX Fortran " )
+    ecbuild_critical( "No COMPONENTS were specified, looking for OMP.\n Please find with COMPONENTS C CXX Fortran " )
   endif()
 
   set( _STUBS "" )
@@ -206,17 +206,24 @@ endmacro( ecbuild_find_omp )
 
 macro( ecbuild_enable_omp )
 
+  ecbuild_debug("ecbuild_enable_omp: Trying to enable OpenMP")
   ecbuild_find_omp( COMPONENTS C CXX Fortran )
 
+  ecbuild_debug_var("OMP_C_FOUND")
   if( OMP_C_FOUND )
+    ecbuild_debug("Adding ${OMP_C_FLAGS} to CMAKE_C_FLAGS")
     set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OMP_C_FLAGS}" )
   endif()
 
+  ecbuild_debug_var("OMP_CXX_FOUND")
   if( OMP_CXX_FOUND )
+    ecbuild_debug("Adding ${OMP_CXX_FLAGS} to CMAKE_CXX_FLAGS")
     set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OMP_CXX_FLAGS}" )
   endif()
 
+  ecbuild_debug_var("OMP_Fortran_FOUND")
   if( OMP_Fortran_FOUND )
+    ecbuild_debug("Adding ${OMP_Fortran_FLAGS} to CMAKE_Fortran_FLAGS")
     set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${OMP_Fortran_FLAGS}" )
   endif()
 
diff --git a/cmake/ecbuild_find_package.cmake b/cmake/ecbuild_find_package.cmake
index b67b51d..f7f1a9c 100644
--- a/cmake/ecbuild_find_package.cmake
+++ b/cmake/ecbuild_find_package.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -92,18 +92,18 @@ macro( ecbuild_find_package )
   cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
   if(_PAR_UNPARSED_ARGUMENTS)
-    message(FATAL_ERROR "Unknown keywords given to ecbuild_find_package(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+    ecbuild_critical("Unknown keywords given to ecbuild_find_package(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
   endif()
 
   if( NOT _PAR_NAME  )
-    message(FATAL_ERROR "The call to ecbuild_find_package() doesn't specify the NAME.")
+    ecbuild_critical("The call to ecbuild_find_package() doesn't specify the NAME.")
   endif()
 
   if( _PAR_EXACT AND NOT _PAR_VERSION )
-    message(FATAL_ERROR "Call to ecbuild_find_package() requests EXACT but doesn't specify VERSION.")
+    ecbuild_critical("Call to ecbuild_find_package() requests EXACT but doesn't specify VERSION.")
   endif()
 
-  # debug_var( _PAR_NAME )
+  # ecbuild_debug_var( _PAR_NAME )
 
   string( TOUPPER ${_PAR_NAME} pkgUPPER )
   string( TOLOWER ${_PAR_NAME} pkgLOWER )
@@ -157,9 +157,9 @@ macro( ecbuild_find_package )
     set( ${_PAR_NAME}_DIR "$ENV{${_PAR_NAME}_DIR}" )
   endif()
 
-  # Find packages quietly unless in DEVELOPER_MODE, LOG_LEVEL is DEBUG or the package is REQUIRED
+  # Find packages quietly unless in DEVELOPER_MODE or LOG_LEVEL is DEBUG
 
-  if( NOT ( DEVELOPER_MODE OR _PAR_REQUIRED ) AND ( ECBUILD_LOG_LEVEL GREATER ${ECBUILD_DEBUG} ) )
+  if( NOT DEVELOPER_MODE AND ( ECBUILD_LOG_LEVEL GREATER ${ECBUILD_DEBUG} ) )
     set( _find_quiet QUIET )
   endif()
 
@@ -191,10 +191,10 @@ macro( ecbuild_find_package )
 
     if( NOT ${_PAR_NAME}_FOUND )
       if( ${_PAR_NAME}_PATH )
-        message( FATAL_ERROR "${_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" )
       endif()
       if( ${pkgUPPER}_PATH )
-        message( FATAL_ERROR "${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" )
       endif()
     endif()
 
@@ -250,7 +250,7 @@ macro( ecbuild_find_package )
       if( ${_PAR_NAME}_VERSION )
         if( _PAR_EXACT )
           if( NOT ${_PAR_NAME}_VERSION VERSION_EQUAL _PAR_VERSION )
-            message( WARNING "${PROJECT_NAME} requires (exactly) ${_PAR_NAME} = ${_PAR_VERSION} -- found ${${_PAR_NAME}_VERSION}" )
+            ecbuild_warn( "${PROJECT_NAME} requires (exactly) ${_PAR_NAME} = ${_PAR_VERSION} -- found ${${_PAR_NAME}_VERSION}" )
             set( _version_acceptable 0 )
           endif()
         else()
@@ -258,14 +258,14 @@ macro( ecbuild_find_package )
             set( _version_acceptable 1 )
           else()
             if( NOT _PAR_QUIET )
-              message( WARNING "${PROJECT_NAME} requires ${_PAR_NAME} >= ${_PAR_VERSION} -- found ${${_PAR_NAME}_VERSION}" )
+              ecbuild_warn( "${PROJECT_NAME} requires ${_PAR_NAME} >= ${_PAR_VERSION} -- found ${${_PAR_NAME}_VERSION}" )
             endif()
             set( _version_acceptable 0 )
           endif()
         endif()
       else()
         if( NOT _PAR_QUIET )
-          message( WARNING "${PROJECT_NAME} found ${_PAR_NAME} but no version information, so cannot check if satisfies ${_PAR_VERSION}" )
+          ecbuild_warn( "${PROJECT_NAME} found ${_PAR_NAME} but no version information, so cannot check if satisfies ${_PAR_VERSION}" )
         endif()
         set( _version_acceptable 0 )
       endif()
@@ -278,7 +278,7 @@ macro( ecbuild_find_package )
       set( ${pkgUPPER}_FOUND ${${_PAR_NAME}_FOUND} )
     else()
       if( NOT _PAR_QUIET )
-        message( WARNING "${PROJECT_NAME} found ${_PAR_NAME} but with unsuitable version" )
+        ecbuild_warn( "${PROJECT_NAME} found ${_PAR_NAME} but with unsuitable version" )
       endif()
       set( ${pkgUPPER}_FOUND 0 )
       set( ${_PAR_NAME}_FOUND 0 )
@@ -303,21 +303,21 @@ macro( ecbuild_find_package )
 
   if( ${_PAR_NAME}_FOUND OR ${pkgUPPER}_FOUND )
     if( NOT _PAR_QUIET )
-      message( STATUS "[${_PAR_NAME}] (${${_PAR_NAME}_VERSION})" )
+      ecbuild_info( "[${_PAR_NAME}] (${${_PAR_NAME}_VERSION})" )
       foreach( var in ITEMS INCLUDE_DIR INCLUDE_DIRS DEFINITIONS LIBRARY LIBRARIES )
         if( ${pkgUPPER}_${var} )
-          message( STATUS "   ${pkgUPPER}_${var} : [${${pkgUPPER}_${var}}]" )
+          ecbuild_info( "   ${pkgUPPER}_${var} : [${${pkgUPPER}_${var}}]" )
         elseif( ${_PAR_NAME}_${var} )
-          message( STATUS "   ${_PAR_NAME}_${var} : [${${_PAR_NAME}_${var}}]" )
+          ecbuild_info( "   ${_PAR_NAME}_${var} : [${${_PAR_NAME}_${var}}]" )
         endif()
       endforeach()
     endif()
   else()
     if( _PAR_REQUIRED )
-      message( FATAL_ERROR ${_failed_message} " !! ${PROJECT_NAME} requires package ${_PAR_NAME} !!" )
+      ecbuild_critical( ${_failed_message} " !! ${PROJECT_NAME} requires package ${_PAR_NAME} !!" )
     else()
       if( NOT _PAR_QUIET )
-        message( STATUS ${_failed_message} )
+        ecbuild_warn( ${_failed_message} )
       endif()
     endif()
   endif()
diff --git a/cmake/ecbuild_find_perl.cmake b/cmake/ecbuild_find_perl.cmake
index c615203..97b22f8 100644
--- a/cmake/ecbuild_find_perl.cmake
+++ b/cmake/ecbuild_find_perl.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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. 
@@ -45,13 +45,13 @@ macro( ecbuild_find_perl )
   cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
   if(_p_UNPARSED_ARGUMENTS)
-    message(FATAL_ERROR "Unknown keywords given to ecbuild_find_perl(): \"${_p_UNPARSED_ARGUMENTS}\"")
+    ecbuild_critical("Unknown keywords given to ecbuild_find_perl(): \"${_p_UNPARSED_ARGUMENTS}\"")
   endif()
 
   find_package( Perl )
 
   if( NOT PERL_EXECUTABLE AND _p_REQUIRED )
-    message( FATAL_ERROR "Failed to find Perl (REQUIRED)" )
+    ecbuild_critical( "Failed to find Perl (REQUIRED)" )
   endif()
 
   if( PERL_EXECUTABLE )
diff --git a/cmake/ecbuild_find_python.cmake b/cmake/ecbuild_find_python.cmake
index c001a7b..d3cf377 100644
--- a/cmake/ecbuild_find_python.cmake
+++ b/cmake/ecbuild_find_python.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -14,7 +14,7 @@
 #
 # Find Python interpreter, its version and the Python libraries. ::
 #
-#   ecbuild_find_python( [ VERSION <version> ] [ REQUIRED ] )
+#   ecbuild_find_python( [ VERSION <version> ] [ REQUIRED ] [ NO_LIBS ] )
 #
 # Options
 # -------
@@ -25,14 +25,22 @@
 # REQUIRED : optional
 #   fail if Python was not found
 #
+# NO_LIBS : optional
+#   only search for the Python interpreter, not the libraries
+#
+# Unless ``NO_LIBS`` is set, the ``python-config`` utility, if found, is used
+# to determine the Python include directories, libraries and link line. Set the
+# CMake variable ``PYTHON_NO_CONFIG`` to use CMake's FindPythonLibs instead.
+#
 # Output variables
 # ----------------
 #
-# The following CMake variables are set if perl was found:
+# The following CMake variables are set if python was found:
 #
 # :PYTHONINTERP_FOUND:    Python interpreter was found
 # :PYTHONLIBS_FOUND:      Python libraries were found
 # :PYTHON_FOUND:          Python was found (both interpreter and libraries)
+# :PYTHON_EXECUTABLE:     Python executable
 # :PYTHON_VERSION_MAJOR:  major version number
 # :PYTHON_VERSION_MINOR:  minor version number
 # :PYTHON_VERSION_PATCH:  patch version number
@@ -45,133 +53,182 @@
 
 set( __test_python ${CMAKE_CURRENT_LIST_DIR}/pymain.c )
 
-macro( ecbuild_find_python )
+function( ecbuild_find_python )
 
     # parse parameters
 
-    set( options REQUIRED )
+    set( options REQUIRED NO_LIBS )
     set( single_value_args VERSION )
     set( multi_value_args  )
 
     cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
     if(_p_UNPARSED_ARGUMENTS)
-      message(FATAL_ERROR "Unknown keywords given to ecbuild_find_python(): \"${_p_UNPARSED_ARGUMENTS}\"")
+      ecbuild_critical("Unknown keywords given to ecbuild_find_python(): \"${_p_UNPARSED_ARGUMENTS}\"")
+    endif()
+    if( _p_REQUIRED )
+      set( _p_REQUIRED REQUIRED )
+    else()
+      unset( _p_REQUIRED )
     endif()
 
     # find python executable
 
-    find_package( PythonInterp )
-
-    if( NOT PYTHONINTERP_FOUND AND _p_REQUIRED )
-        message( FATAL_ERROR "Failed to find any Python interpreter (REQUIRED)" )
+    # Search first without specifying the version, since doing so gives preference to the specified
+    # version even though a never version of the interpreter may be available
+    find_package( PythonInterp ${_p_REQUIRED} )
+
+    # 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..." )
+        unset( PYTHONINTERP_FOUND )
+        unset( PYTHON_EXECUTABLE )
+        unset( PYTHON_EXECUTABLE CACHE )
+        unset( PYTHON_VERSION_MAJOR )
+        unset( PYTHON_VERSION_MINOR )
+        unset( PYTHON_VERSION_PATCH )
+        unset( PYTHON_VERSION_STRING )
+        find_package( PythonInterp "${_p_VERSION}" ${_p_REQUIRED} )
+      endif()
     endif()
 
-    # find python version
-    # execute_process( COMMAND ${PYTHON_EXECUTABLE} -V ERROR_VARIABLE _version  RESULT_VARIABLE _return ERROR_STRIP_TRAILING_WHITESPACE)
-    # if( NOT _return )
-    #    string(REGEX REPLACE ".*([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1.\\2.\\3" PYTHON_VERSION ${_version} )
-    # endif()
-    # endif()
-
-    # message( STATUS "Python version ${PYTHON_VERSION_STRING}" )
-    # debug_var(PYTHON_VERSION_MAJOR)
-    # debug_var(PYTHON_VERSION_MINOR)
-    # debug_var(PYTHON_VERSION_PATCH)
-
-    if( PYTHONINTERP_FOUND AND DEFINED _p_VERSION )
-        if( _p_VERSION VERSION_GREATER "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}" )
-            set( PYTHONINTERP_FOUND 0 )
-            set( PYTHON_EXECUTABLE "PYTHON_EXECUTABLE-NOTFOUND" )
-            if( _p_REQUIRED )
-                message( FATAL_ERROR "Required python version at least ${_p_VERSION} but found only ${PYTHON_VERSION_STRING}" )
-            else()
-                message( WARNING "Looking for python version at least ${_p_VERSION} but found only ${PYTHON_VERSION_STRING}\nMarking Python as NOTFOUND" )
-            endif()
-        endif()
-    endif()
+    set( __required_vars PYTHONINTERP_FOUND )
 
     if( PYTHONINTERP_FOUND )
         ecbuild_debug( "ecbuild_find_python: Found Python interpreter version ${PYTHON_VERSION_STRING} at ${PYTHON_EXECUTABLE}" )
 
+        # find where python site-packages are ...
+
+        if( PYTHON_EXECUTABLE )
+            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}" )
+    endif()
+
+    if( PYTHONINTERP_FOUND AND NOT _p_NO_LIBS )
+        list( APPEND __required_vars PYTHONLIBS_FOUND PYTHON_LIBS_WORKING )
+
         # find python config
 
         if( PYTHON_EXECUTABLE AND EXISTS ${PYTHON_EXECUTABLE}-config )
-            set(PYTHON_CONFIG ${PYTHON_EXECUTABLE}-config CACHE PATH "" FORCE)
+            set(PYTHON_CONFIG_EXECUTABLE ${PYTHON_EXECUTABLE}-config CACHE PATH "" FORCE)
         else()
-            find_program( PYTHON_CONFIG NAMES python-config python-config${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} )
+            get_filename_component( __python_bin_dir ${PYTHON_EXECUTABLE} PATH )
+            find_program( PYTHON_CONFIG_EXECUTABLE
+                          NO_CMAKE_PATH NO_CMAKE_SYSTEM_PATH
+                          NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
+                          HINTS ${__python_bin_dir}
+                          NAMES python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}-config
+                                python${PYTHON_VERSION_MAJOR}-config
+                                python-config )
         endif()
 
+        ecbuild_debug_var( PYTHON_CONFIG_EXECUTABLE )
+
         # find python libs
 
-        # The OpenBSD python packages have python-config's 
+        # The OpenBSD python packages have python-config's
         # that don't reliably report linking flags that will work.
-        
-        if( PYTHON_CONFIG AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
-            ecbuild_debug( "ecbuild_find_python: Searching for Python include directories and libraries using ${PYTHON_CONFIG}" )
-            
-            execute_process(COMMAND "${PYTHON_CONFIG}" --ldflags
-                            OUTPUT_VARIABLE PYTHON_LIBRARIES
-                            OUTPUT_STRIP_TRAILING_WHITESPACE
-                            ERROR_QUIET)
-
-            execute_process(COMMAND "${PYTHON_CONFIG}" --includes
-                            OUTPUT_VARIABLE PYTHON_INCLUDE_DIR
-                            OUTPUT_STRIP_TRAILING_WHITESPACE
-                            ERROR_QUIET)
-
-            string(REGEX REPLACE "^[-I]" "" PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}")
-            string(REGEX REPLACE "[ ]-I" " " PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}")
-            
-            separate_arguments(PYTHON_INCLUDE_DIR)
 
-        else() # revert to finding pythonlibs the standard way (cmake macro)
-            ecbuild_debug( "ecbuild_find_python: Searching for Python include directories and libraries using find_package(PythonLibs)" )
-            
-            find_package(PythonLibs)
-            if( PYTHON_INCLUDE_PATH AND NOT PYTHON_INCLUDE_DIR )
-                set(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_PATH}")
+        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}" )
+
+            if( NOT PYTHON_LIBRARY )
+              execute_process(COMMAND "${PYTHON_CONFIG_EXECUTABLE}" --prefix
+                              OUTPUT_VARIABLE PYTHON_PREFIX
+                              OUTPUT_STRIP_TRAILING_WHITESPACE
+                              ERROR_QUIET)
+
+              execute_process(COMMAND "${PYTHON_CONFIG_EXECUTABLE}" --ldflags
+                              OUTPUT_VARIABLE PYTHON_LIBRARY
+                              OUTPUT_STRIP_TRAILING_WHITESPACE
+                              ERROR_QUIET)
+
+              # 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} )
+                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()
 
-        endif()
+            if(DEFINED PYTHON_INCLUDE_PATH AND NOT DEFINED PYTHON_INCLUDE_DIR)
+              set( PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_PATH}" CACHE PATH
+                   "Path to where Python.h is found" FORCE )
+            elseif( NOT PYTHON_INCLUDE_DIR )
+              execute_process(COMMAND "${PYTHON_CONFIG_EXECUTABLE}" --includes
+                              OUTPUT_VARIABLE PYTHON_INCLUDE_DIR
+                              OUTPUT_STRIP_TRAILING_WHITESPACE
+                              ERROR_QUIET)
 
-        # Remove duplicate include directories
-        list(REMOVE_DUPLICATES PYTHON_INCLUDE_DIR)
+              string(REGEX REPLACE "^[-I]" "" PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}")
+              string(REGEX REPLACE "[ ]-I" " " PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}")
+
+              separate_arguments(PYTHON_INCLUDE_DIR)
+              set( PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR}" CACHE PATH
+                   "Path to where Python.h is found" FORCE )
+
+            endif()
 
-        # 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_DIR}"
-                     LINK_LIBRARIES ${PYTHON_LIBRARIES} )
+            set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
+            set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
 
-        # set output variables
+            find_package_handle_standard_args( PythonLibs DEFAULT_MSG
+                                               PYTHON_INCLUDE_DIRS PYTHON_LIBRARIES )
 
-        find_package_handle_standard_args( PythonLibs DEFAULT_MSG
-                                           PYTHON_INCLUDE_DIR PYTHON_LIBRARIES PYTHON_LIBS_WORKING )
-        ecbuild_debug( "ecbuild_find_python: PYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIR}" )
-        ecbuild_debug( "ecbuild_find_python: PYTHON_LIBRARIES=${PYTHON_LIBRARIES}" )
+        else() # revert to finding pythonlibs the standard way (cmake macro)
+            ecbuild_debug( "ecbuild_find_python: Searching for Python include directories and libraries using find_package( PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH} ${_p_REQUIRED} )" )
 
-        set( PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR} )
-        set( PYTHON_INCLUDE_PATH ${PYTHON_INCLUDE_DIR} )
+            find_package( PythonLibs "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}" ${_p_REQUIRED} )
 
-        # Also set PYTHON_FOUND and Python_FOUND for compatibility with ecbuild_add_option
-        if( PYTHONLIBS_FOUND )
-          set( PYTHON_FOUND 1 )
-          set( Python_FOUND 1 )
         endif()
 
-        # find where python site-packages are ...
+        # Remove duplicate include directories
+        list(REMOVE_DUPLICATES PYTHON_INCLUDE_DIRS)
+
+
+        if( PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIRS )
+            # 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 )
+              ecbuild_debug( "ecbuild_find_python: trying to link executable with Python libraries failed\n${__try_compile_output}" )
+            endif()
 
-        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)
-        ecbuild_debug( "ecbuild_find_python: PYTHON_SITE_PACKAGES=${PYTHON_SITE_PACKAGES}" )
+        endif()
 
     endif()
 
-#    debug_var( PYTHONINTERP_FOUND )
-#    debug_var( PYTHON_EXECUTABLE )
-#    debug_var( PYTHONLIBS_FOUND )
-#    debug_var( PYTHON_INCLUDE_DIRS )
-#    debug_var( PYTHON_LIBRARIES )
-#    debug_var( PYTHON_SITE_PACKAGES )
-
-endmacro( ecbuild_find_python )
+    find_package_handle_standard_args( Python DEFAULT_MSG ${__required_vars} )
+
+    ecbuild_debug_var( PYTHONINTERP_FOUND )
+    ecbuild_debug_var( PYTHON_FOUND )
+    ecbuild_debug_var( PYTHON_EXECUTABLE )
+    ecbuild_debug_var( PYTHON_CONFIG_EXECUTABLE )
+    ecbuild_debug_var( PYTHON_VERSION_MAJOR )
+    ecbuild_debug_var( PYTHON_VERSION_MINOR )
+    ecbuild_debug_var( PYTHON_VERSION_PATCH )
+    ecbuild_debug_var( PYTHON_VERSION_STRING )
+    ecbuild_debug_var( PYTHON_INCLUDE_DIRS )
+    ecbuild_debug_var( PYTHON_LIBRARIES )
+    ecbuild_debug_var( PYTHON_SITE_PACKAGES )
+
+    set( PYTHONINTERP_FOUND    ${PYTHONINTERP_FOUND} PARENT_SCOPE )
+    set( PYTHONLIBS_FOUND      ${PYTHONLIBS_FOUND} PARENT_SCOPE )
+    set( PYTHON_FOUND          ${PYTHON_FOUND} PARENT_SCOPE )
+    set( PYTHON_EXECUTABLE     ${PYTHON_EXECUTABLE} PARENT_SCOPE )
+    set( PYTHON_VERSION_MAJOR  ${PYTHON_VERSION_MAJOR} PARENT_SCOPE )
+    set( PYTHON_VERSION_MINOR  ${PYTHON_VERSION_MINOR} PARENT_SCOPE )
+    set( PYTHON_VERSION_PATCH  ${PYTHON_VERSION_PATCH} PARENT_SCOPE )
+    set( PYTHON_VERSION_STRING ${PYTHON_VERSION_STRING} PARENT_SCOPE )
+    set( PYTHON_INCLUDE_DIRS   ${PYTHON_INCLUDE_DIRS} PARENT_SCOPE )
+    set( PYTHON_LIBRARIES      ${PYTHON_LIBRARIES} PARENT_SCOPE )
+    set( PYTHON_SITE_PACKAGES  ${PYTHON_SITE_PACKAGES} PARENT_SCOPE )
+
+endfunction( ecbuild_find_python )
diff --git a/cmake/ecbuild_generate_config_headers.cmake b/cmake/ecbuild_generate_config_headers.cmake
index 93cbb1f..6bc8301 100644
--- a/cmake/ecbuild_generate_config_headers.cmake
+++ b/cmake/ecbuild_generate_config_headers.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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,7 +36,7 @@ function( ecbuild_generate_config_headers )
   cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
   if(_PAR_UNPARSED_ARGUMENTS)
-    message(FATAL_ERROR "Unknown keywords given to ecbuild_generate_config_headers(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+    ecbuild_critical("Unknown keywords given to ecbuild_generate_config_headers(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
   endif()
 
   # generate list of compiler flags
diff --git a/cmake/ecbuild_generate_fortran_interfaces.cmake b/cmake/ecbuild_generate_fortran_interfaces.cmake
new file mode 100644
index 0000000..93c7414
--- /dev/null
+++ b/cmake/ecbuild_generate_fortran_interfaces.cmake
@@ -0,0 +1,143 @@
+# (C) Copyright 1996-2016 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.
+
+##############################################################################
+#.rst:
+#
+# ecbuild_generate_fortran_interfaces
+# ===================================
+#
+# Generates interfaces from the Fortran source files. ::
+#
+#   ecbuild_generate_fortran_interfaces()
+#
+# Options
+# -------
+#
+# TARGET : required
+#   target name
+#
+##############################################################################
+
+function( ecbuild_generate_fortran_interfaces )
+
+  find_program( FCM_EXECUTABLE fcm REQUIRED DOC "Fortran interface generator" )
+
+  if( NOT FCM_EXECUTABLE )
+    ecbuild_error( "ecbuild_generate_fortran_interfaces: fcm executable not found." )
+  endif()
+
+  set( options )
+  set( single_value_args TARGET DESTINATION PARALLEL INCLUDE_DIRS GENERATED SOURCE_DIR FCM_CONFIG_FILE )
+  set( multi_value_args DIRECTORIES )
+
+  cmake_parse_arguments( P "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
+
+  if( NOT DEFINED P_TARGET )
+    ecbuild_error( "ecbuild_generate_fortran_interfaces: TARGET argument missing" )
+  endif()
+
+  if( NOT DEFINED P_DESTINATION )
+    ecbuild_error( "ecbuild_generate_fortran_interfaces: DESTINATION argument missing" )
+  endif()
+
+  if( NOT DEFINED P_DIRECTORIES )
+    ecbuild_error( "ecbuild_generate_fortran_interfaces: DIRECTORIES argument missing" )
+  endif()
+
+  if( NOT DEFINED P_PARALLEL OR (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") )
+    set( P_PARALLEL 1 )
+  endif()
+
+  ecbuild_debug_var( P_PARALLEL )
+
+  if( NOT DEFINED P_SOURCE_DIR )
+    ecbuild_error( "ecbuild_generate_fortran_interfaces: SOURCE_DIR argument missing")
+  endif()
+
+  if( DEFINED P_FCM_CONFIG_FILE )
+    set( FCM_CONFIG_FILE ${P_FCM_CONFIG_FILE} )
+  endif()
+
+  if( NOT FCM_CONFIG_FILE )
+    set( PROJECT_FCM_CONFIG_FILE "${PROJECT_SOURCE_DIR}/cmake/fcm-make-interfaces.cfg" )
+    if( EXISTS ${PROJECT_FCM_CONFIG_FILE} )
+      set( FCM_CONFIG_FILE ${PROJECT_FCM_CONFIG_FILE} )
+      ecbuild_debug( "ecbuild_generate_fortran_interfaces: fcm configuration found in ${PROJECT_FCM_CONFIG_FILE}" )
+    else()
+      ecbuild_debug( "ecbuild_generate_fortran_interfaces: fcm configuration not found in ${PROJECT_FCM_CONFIG_FILE}" )
+    endif()
+  endif()
+
+  if( NOT FCM_CONFIG_FILE )
+    set( DEFAULT_FCM_CONFIG_FILE "${ECBUILD_MACROS_DIR}/fcm-make-interfaces.cfg" )
+    if( EXISTS ${DEFAULT_FCM_CONFIG_FILE} )
+      set( FCM_CONFIG_FILE ${DEFAULT_FCM_CONFIG_FILE} )
+      ecbuild_debug( "ecbuild_generate_fortran_interfaces: fcm configuration found in ${DEFAULT_FCM_CONFIG_FILE}" )
+    else()
+      ecbuild_debug( "ecbuild_generate_fortran_interfaces: fcm configuration not found in ${DEFAULT_FCM_CONFIG_FILE}" )
+    endif()
+  endif()
+
+  ecbuild_debug_var( FCM_CONFIG_FILE )
+
+  if( NOT EXISTS ${FCM_CONFIG_FILE} )
+    ecbuild_error( "ecbuild_generate_fortran_interfaces: needs fcm configuration in ${FCM_CONFIG_FILE}" )
+  endif()
+
+  foreach( _srcdir ${P_DIRECTORIES} )
+    if( _srcdir MATCHES "/$" )
+      ecbuild_critical("ecbuild_generate_fortran_interfaces: directory ${_srcdir} must not end with /")
+    endif()
+    ecbuild_list_add_pattern( LIST fortran_files SOURCE_DIR ${P_SOURCE_DIR} GLOB ${_srcdir}/*.F* )
+  endforeach()
+
+  string( REPLACE ";" " " _srcdirs "${P_DIRECTORIES}" )
+
+  set( _cnt 0 )
+  foreach( file ${_fortran_files} )
+    if( ${${SRC}/file} IS_NEWER_THAN ${${SRC}/file} )
+      set( run_fcm 1 )
+    endif()
+  endforeach()
+
+  foreach( fortran_file ${fortran_files} )
+    #list( APPEND fullpath_fortran_files ${CMAKE_CURRENT_SOURCE_DIR}/${fortran_file} )
+      get_filename_component(base ${fortran_file} NAME_WE)
+      set( interface_file "${CMAKE_CURRENT_BINARY_DIR}/interfaces/include/${base}.intfb.h" )
+      list( APPEND interface_files ${interface_file} )
+      set_source_files_properties( ${interface_file} PROPERTIES GENERATED TRUE )
+      math(EXPR _cnt "${_cnt}+1")
+  endforeach()
+
+  ecbuild_info("Target ${P_TARGET} will generate ${_cnt} interface files using FCM")
+
+
+
+  if( DEFINED P_GENERATED )
+    set( ${P_GENERATED} ${interface_files} PARENT_SCOPE )
+  endif()
+
+  set( include_dir ${CMAKE_CURRENT_BINARY_DIR}/${P_DESTINATION}/interfaces/include )
+  set( ${P_INCLUDE_DIRS} ${include_dir} PARENT_SCOPE )
+
+  execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${include_dir}
+                   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
+
+    add_custom_command(
+      OUTPUT  "${P_DESTINATION}/${P_TARGET}.timestamp"
+      COMMAND ${FCM_EXECUTABLE} make -j ${P_PARALLEL} --config-file=${FCM_CONFIG_FILE} interfaces.ns-incl=${_srcdirs} interfaces.source=${P_SOURCE_DIR}
+      COMMAND touch "${P_TARGET}.timestamp"
+      DEPENDS ${fortran_files}
+      COMMENT "Generating ${_cnt} interface files for target ${P_TARGET}"
+      WORKING_DIRECTORY ${P_DESTINATION} VERBATIM )
+
+    add_custom_target( ${P_TARGET} DEPENDS ${P_DESTINATION}/${P_TARGET}.timestamp )
+
+
+endfunction( ecbuild_generate_fortran_interfaces )
diff --git a/cmake/ecbuild_generate_rpc.cmake b/cmake/ecbuild_generate_rpc.cmake
index 45a00ba..f06624f 100644
--- a/cmake/ecbuild_generate_rpc.cmake
+++ b/cmake/ecbuild_generate_rpc.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -45,20 +45,20 @@ macro( ecbuild_generate_rpc )
     cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
     if(_PAR_UNPARSED_ARGUMENTS)
-      message(FATAL_ERROR "Unknown keywords given to ecbuild_generate_rpc(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+      ecbuild_critical("Unknown keywords given to ecbuild_generate_rpc(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
     endif()
 
     if( NOT _PAR_SOURCE  )
-      message(FATAL_ERROR "The call to ecbuild_generate_rpc() doesn't specify the SOURCE file.")
+      ecbuild_critical("The call to ecbuild_generate_rpc() doesn't specify the SOURCE file.")
     endif()
 
 # optional
 #    if( NOT _PAR_DEPENDANT )
-#      message(FATAL_ERROR "The call to ecbuild_generate_rpc() doesn't specify the DEPENDANT files.")
+#      ecbuild_critical("The call to ecbuild_generate_rpc() doesn't specify the DEPENDANT files.")
 #    endif()
 
     if( NOT DEFINED _PAR_TARGET_H AND NOT DEFINED _PAR_TARGET_C )
-      message(FATAL_ERROR "The call to ecbuild_generate_rpc() doesn't specify the _PAR_TARGET_H or _PAR_TARGET_C files.")
+      ecbuild_critical("The call to ecbuild_generate_rpc() doesn't specify the _PAR_TARGET_H or _PAR_TARGET_C files.")
     endif()
 
     find_package( RPCGEN REQUIRED )
diff --git a/cmake/ecbuild_generate_yy.cmake b/cmake/ecbuild_generate_yy.cmake
index 5ef2dad..35088fb 100644
--- a/cmake/ecbuild_generate_yy.cmake
+++ b/cmake/ecbuild_generate_yy.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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,7 @@
 #                        LEX <file>
 #                        DEPENDANT <file1> [ <file2> ... ]
 #                        [ SOURCE_DIR <dir> ]
+#                        [ OUTPUT_DIRECTORY <dir> ]
 #                        [ YACC_TARGET <file> ]
 #                        [ LEX_TARGET <file> ]
 #                        [ YACC_FLAGS <flags> ]
@@ -45,6 +46,9 @@
 # SOURCE_DIR : optional, defaults to CMAKE_CURRENT_SOURCE_DIR
 #   directory where yacc and lex source files are located
 #
+# OUTPUT_DIRECTORY : optional, defaults to CMAKE_CURRENT_BINARY_DIR
+#   output directory for yacc and lex target files
+#
 # YACC_TARGET : optional, defaults to YACC
 #   base name of the generated yacc target file (without .c extension)
 #
@@ -72,29 +76,29 @@ macro( ecbuild_generate_yy )
   ecbuild_find_perl( REQUIRED )
 
   set( options )
-  set( single_value_args YYPREFIX YACC LEX SOURCE_DIR YACC_TARGET LEX_TARGET LEX_FLAGS YACC_FLAGS FLEX_FLAGS BISON_FLAGS )
+  set( single_value_args YYPREFIX YACC LEX SOURCE_DIR OUTPUT_DIRECTORY YACC_TARGET LEX_TARGET LEX_FLAGS YACC_FLAGS FLEX_FLAGS BISON_FLAGS )
   set( multi_value_args  DEPENDANT )
 
   cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
   if(_PAR_UNPARSED_ARGUMENTS)
-    message(FATAL_ERROR "Unknown keywords given to ecbuild_generate_yy(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+    ecbuild_critical("Unknown keywords given to ecbuild_generate_yy(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
   endif()
 
   if( NOT _PAR_YYPREFIX  )
-    message(FATAL_ERROR "The call to ecbuild_generate_yy() doesn't specify the YYPREFIX.")
+    ecbuild_critical("The call to ecbuild_generate_yy() doesn't specify the YYPREFIX.")
   endif()
 
   if( NOT _PAR_YACC  )
-    message(FATAL_ERROR "The call to ecbuild_generate_yy() doesn't specify the YACC file.")
+    ecbuild_critical("The call to ecbuild_generate_yy() doesn't specify the YACC file.")
   endif()
 
   if( NOT _PAR_LEX  )
-    message(FATAL_ERROR "The call to ecbuild_generate_yy() doesn't specify the LEX file.")
+    ecbuild_critical("The call to ecbuild_generate_yy() doesn't specify the LEX file.")
   endif()
 
   if( NOT _PAR_DEPENDANT )
-    message(FATAL_ERROR "The call to ecbuild_generate_yy() doesn't specify the DEPENDANT files.")
+    ecbuild_critical("The call to ecbuild_generate_yy() doesn't specify the DEPENDANT files.")
   endif()
 
   set( BASE ${_PAR_YYPREFIX}_${_PAR_YACC} )
@@ -125,19 +129,23 @@ macro( ecbuild_generate_yy )
     set ( _PAR_LEX_TARGET ${_PAR_LEX} )
   endif()
 
-  set( ${BASE}yy_tmp_target ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_YACC_TARGET}.tmp.c )
-  set( ${BASE}yh_tmp_target ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_YACC_TARGET}.tmp.h )
-  set( ${BASE}yl_tmp_target ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_LEX_TARGET}.tmp.c )
-
-  set( ${BASE}yy_target ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_YACC_TARGET}.c )
-  set( ${BASE}yh_target ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_YACC_TARGET}.h )
-  set( ${BASE}yl_target ${CMAKE_CURRENT_BINARY_DIR}/${_PAR_LEX_TARGET}.c )
-
   if( NOT _PAR_SOURCE_DIR )
     set( _PAR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
   endif()
 
-  add_custom_target( ${_PAR_YYPREFIX}_${DEPENDANT} SOURCES ${_PAR_SOURCE_DIR}/${_PAR_YACC}.y ${_PAR_SOURCE_DIR}/${_PAR_LEX}.l )
+  if( NOT _PAR_OUTPUT_DIRECTORY )
+    set( _PAR_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
+  else()
+    file( MAKE_DIRECTORY ${_PAR_OUTPUT_DIRECTORY} )
+  endif()
+
+  set( ${BASE}yy_tmp_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_YACC_TARGET}.tmp.c )
+  set( ${BASE}yh_tmp_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_YACC_TARGET}.tmp.h )
+  set( ${BASE}yl_tmp_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_LEX_TARGET}.tmp.c )
+
+  set( ${BASE}yy_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_YACC_TARGET}.c )
+  set( ${BASE}yh_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_YACC_TARGET}.h )
+  set( ${BASE}yl_target ${_PAR_OUTPUT_DIRECTORY}/${_PAR_LEX_TARGET}.c )
 
   if( BISON_FOUND )
     bison_target( ${BASE}_parser ${_PAR_SOURCE_DIR}/${_PAR_YACC}.y ${${BASE}yy_tmp_target} COMPILE_FLAGS "${_PAR_BISON_FLAGS}" )
diff --git a/cmake/ecbuild_get_cxx11_flags.cmake b/cmake/ecbuild_get_cxx11_flags.cmake
index 5bfed07..a97fe11 100644
--- a/cmake/ecbuild_get_cxx11_flags.cmake
+++ b/cmake/ecbuild_get_cxx11_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -23,7 +23,7 @@ function( ecbuild_get_cxx11_flags CXX11_FLAGS )
 
   include(CheckCXXCompilerFlag)
 
-  # On older cmake versions + newer compilers, 
+  # On older cmake versions + newer compilers,
   # the given version of CheckCXXCompilerFlags does not quite work.
   if(CMAKE_VERSION VERSION_LESS 2.8.9)
     macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)
@@ -52,7 +52,8 @@ function( ecbuild_get_cxx11_flags CXX11_FLAGS )
 
   check_cxx_compiler_flag(-std=c++11 has_std_cpp11)
   check_cxx_compiler_flag(-std=c++0x has_std_cpp0x)
-  if(MINGW) 
+  check_cxx_compiler_flag(-hstd=c++11 has_hstd_cpp11)
+  if(MINGW)
     check_cxx_compiler_flag(-std=gnu++11 has_std_gnupp11)
     check_cxx_compiler_flag(-std=gnu++0x has_std_gnupp0x)
   endif(MINGW)
@@ -60,12 +61,14 @@ function( ecbuild_get_cxx11_flags CXX11_FLAGS )
     set(${CXX11_FLAGS} "-std=gnu++11" PARENT_SCOPE)
   elseif(has_std_gnupp0x)
     set(${CXX11_FLAGS} "-std=gnu++0x" PARENT_SCOPE)
-  elseif(has_std_cpp11) 
+  elseif(has_hstd_cpp11)
+    set(${CXX11_FLAGS} "-hstd=c++11" PARENT_SCOPE)
+  elseif(has_std_cpp11)
     set(${CXX11_FLAGS} "-std=c++11" PARENT_SCOPE)
   elseif(has_std_cpp0x)
     set(${CXX11_FLAGS} "-std=c++0x" PARENT_SCOPE)
   else()
-    message(FATAL ERROR "Could not detect C++11 flags")
+    ecbuild_critical("Could not detect C++11 flags")
   endif(has_std_gnupp11)
 
 endfunction()
diff --git a/cmake/ecbuild_get_date.cmake b/cmake/ecbuild_get_date.cmake
index ec308a3..730ea54 100644
--- a/cmake/ecbuild_get_date.cmake
+++ b/cmake/ecbuild_get_date.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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. 
@@ -24,7 +24,7 @@ macro(ecbuild_get_date RESULT)
         execute_process(COMMAND "date" "+%d/%m/%Y" OUTPUT_VARIABLE ${RESULT})
         string(REGEX REPLACE "(..)/(..)/(....).*" "\\3.\\2.\\1" ${RESULT} ${${RESULT}})
     else()
-        message(SEND_ERROR "date not implemented")
+        ecbuild_error("date not implemented")
     endif()
 endmacro(ecbuild_get_date)
 
@@ -46,7 +46,7 @@ macro(ecbuild_get_timestamp RESULT)
         execute_process(COMMAND "date" "+%Y/%m/%d/%H/%M/%S" OUTPUT_VARIABLE _timestamp)
         string(REGEX REPLACE "(....)/(..)/(..)/(..)/(..)/(..).*" "\\1\\2\\3\\4\\5\\6" ${RESULT} ${_timestamp})
     else()
-        message(WARNING "This is NOT UNIX - timestamp not implemented")
+        ecbuild_warn("This is NOT UNIX - timestamp not implemented")
     endif()
 endmacro(ecbuild_get_timestamp)
 
diff --git a/cmake/ecbuild_get_resources.cmake b/cmake/ecbuild_get_resources.cmake
index da824d9..f531d82 100644
--- a/cmake/ecbuild_get_resources.cmake
+++ b/cmake/ecbuild_get_resources.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
-# 
+# (C) Copyright 1996-2016 ECMWF.
+#
 # This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 
-# In applying this licence, ECMWF does not waive the privileges and immunities 
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
 # granted to it by virtue of its status as an intergovernmental organisation nor
 # does it submit to any jurisdiction.
 
@@ -19,17 +19,17 @@ macro( ecbuild_get_resources )
     cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
     if(_PAR_UNPARSED_ARGUMENTS)
-        message(FATAL_ERROR "Unknown keywords given to ecbuild_get_resources(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+        ecbuild_critical("Unknown keywords given to ecbuild_get_resources(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
     endif()
 
     if( NOT _PAR_LIST )
-        message( FATAL_ERROR "Missing parameter LIST of resources in macro ecbuild_get_resources()" )
+        ecbuild_critical( "Missing parameter LIST of resources in macro ecbuild_get_resources()" )
     endif()
 
     if( NOT _PAR_TO_DIR )
 		set( _PAR_TO_DIR ${CMAKE_CURRENT_BINARY_DIR} )
 	endif()
-	
+
     list( LENGTH _PAR_LIST _rsize )
     math( EXPR _max "${_rsize}-1" )
     foreach( i RANGE 0 ${_max} 2 )
@@ -39,14 +39,14 @@ macro( ecbuild_get_resources )
         list( GET _PAR_LIST ${i}  r  )
         list( GET _PAR_LIST ${in} rh )
 
-#        debug_var( r  )
-#        debug_var( rh )
+#        ecbuild_debug_var( r  )
+#        ecbuild_debug_var( rh )
 
         get_filename_component( rf ${r} NAME )
 
         file( DOWNLOAD ${r} ${_PAR_TO_DIR}/${rf} EXPECTED_HASH SHA1=${rh} )
 
     endforeach()
-		
+
 
 endmacro()
diff --git a/cmake/ecbuild_get_test_data.cmake b/cmake/ecbuild_get_test_data.cmake
index 8106c65..42185f1 100644
--- a/cmake/ecbuild_get_test_data.cmake
+++ b/cmake/ecbuild_get_test_data.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -20,6 +20,7 @@ function( _download_test_data _p_NAME _p_DIRNAME )
   #endif()
 
   find_program( CURL_PROGRAM curl )
+  mark_as_advanced(CURL_PROGRAM)
 
   if( CURL_PROGRAM )
 
@@ -42,7 +43,7 @@ function( _download_test_data _p_NAME _p_DIRNAME )
     else()
 
       if( WARNING_CANNOT_DOWNLOAD_TEST_DATA )
-        message( WARNING "Couldn't find curl neither wget -- cannot download test data from server.\nPlease obtain the test data by other means and pleace it in the build directory." )
+        ecbuild_warn( "Couldn't find curl neither wget -- cannot download test data from server.\nPlease obtain the test data by other means and pleace it in the build directory." )
         set( WARNING_CANNOT_DOWNLOAD_TEST_DATA 1 CACHE INTERNAL "Couldn't find curl neither wget -- cannot download test data from server" )
         mark_as_advanced( WARNING_CANNOT_DOWNLOAD_TEST_DATA )
       endif()
@@ -130,7 +131,7 @@ function( ecbuild_get_test_data )
     cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
     if(_p_UNPARSED_ARGUMENTS)
-      message(FATAL_ERROR "Unknown keywords given to ecbuild_get_test_data(): \"${_p_UNPARSED_ARGUMENTS}\"")
+      ecbuild_critical("Unknown keywords given to ecbuild_get_test_data(): \"${_p_UNPARSED_ARGUMENTS}\"")
     endif()
 
     file( RELATIVE_PATH currdir ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} )
@@ -138,7 +139,7 @@ function( ecbuild_get_test_data )
     ### check parameters
 
     if( NOT _p_NAME )
-      message(FATAL_ERROR "ecbuild_get_test_data() expects a NAME")
+      ecbuild_critical("ecbuild_get_test_data() expects a NAME")
     endif()
 
     if( NOT _p_TARGET )
@@ -151,10 +152,10 @@ function( ecbuild_get_test_data )
       set( _p_DIRNAME ${PROJECT_NAME}/${currdir} )
     endif()
 
-#    debug_var( _p_TARGET )
-#    debug_var( _p_NAME )
-#    debug_var( _p_URL )
-#    debug_var( _p_DIRNAME )
+#    ecbuild_debug_var( _p_TARGET )
+#    ecbuild_debug_var( _p_NAME )
+#    ecbuild_debug_var( _p_URL )
+#    ecbuild_debug_var( _p_DIRNAME )
 
     # download the data
 
@@ -168,8 +169,6 @@ function( ecbuild_get_test_data )
 
         if( NOT _p_MD5 AND NOT _p_SHA1) # use remote md5
 
-#            message( STATUS " ---  getting MD5 sum " )
-
             add_custom_command( OUTPUT ${_p_NAME}.localmd5
                                 COMMAND ${CMAKE_COMMAND} -E md5sum ${_p_NAME} > ${_p_NAME}.localmd5
                                 DEPENDS ${_p_NAME} )
@@ -187,8 +186,6 @@ function( ecbuild_get_test_data )
 
         if( _p_MD5 )
 
-#            message( STATUS " ---  computing MD5 sum [${_p_MD5}]" )
-
             add_custom_command( OUTPUT ${_p_NAME}.localmd5
                                 COMMAND ${CMAKE_COMMAND} -E md5sum ${_p_NAME} > ${_p_NAME}.localmd5
                                 DEPENDS ${_p_NAME} )
@@ -206,8 +203,6 @@ function( ecbuild_get_test_data )
 
 #        if( _p_SHA1 )
 
-##            message( STATUS " ---  computing SHA1 sum [${_p_SHA1}]" )
-
 #            find_program( SHASUM NAMES sha1sum shasum )
 #            if( SHASUM )
 #                add_custom_command( OUTPUT ${_p_NAME}.localsha1
@@ -246,6 +241,7 @@ endfunction(ecbuild_get_test_data)
 #   ecbuild_get_test_multidata( NAMES <name1> [ <name2> ... ]
 #                               TARGET <target>
 #                               [ DIRNAME <dir> ]
+#                               [ LABELS <label1> [<label2> ...] ]
 #                               [ EXTRACT ]
 #                               [ NOCHECK ] )
 #
@@ -263,6 +259,14 @@ endfunction(ecbuild_get_test_data)
 # DIRNAME : optional, defaults to <project>/<relative path to current dir>
 #   directory in which the test data resides
 #
+# LABELS : optional
+#   list of labels to assign to the test
+#
+#   Lower case project name and ``download_data`` are always added as labels.
+#
+#   This allows selecting tests to run via ``ctest -L <regex>`` or tests
+#   to exclude via ``ctest -LE <regex>``.
+#
 # EXTRACT : optional
 #   extract downloaded files (supported archives: tar, zip, tar.gz, tar.bz2)
 #
@@ -308,27 +312,27 @@ function( ecbuild_get_test_multidata )
 
     set( options EXTRACT NOCHECK )
     set( single_value_args TARGET DIRNAME )
-    set( multi_value_args  NAMES )
+    set( multi_value_args  NAMES LABELS )
 
     cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
     if(_p_UNPARSED_ARGUMENTS)
-      message(FATAL_ERROR "Unknown keywords given to ecbuild_get_test_data(): \"${_p_UNPARSED_ARGUMENTS}\"")
+      ecbuild_critical("Unknown keywords given to ecbuild_get_test_data(): \"${_p_UNPARSED_ARGUMENTS}\"")
     endif()
 
     ### check parameters
 
     if( NOT _p_NAMES )
-      message(FATAL_ERROR "ecbuild_get_test_data() expects a NAMES")
+      ecbuild_critical("ecbuild_get_test_data() expects a NAMES")
     endif()
 
     if( NOT _p_TARGET )
-      message(FATAL_ERROR "ecbuild_get_test_data() expects a TARGET")
+      ecbuild_critical("ecbuild_get_test_data() expects a TARGET")
     endif()
 
-#    debug_var( _p_TARGET )
-#    debug_var( _p_NAME )
-#    debug_var( _p_DIRNAME )
+#    ecbuild_debug_var( _p_TARGET )
+#    ecbuild_debug_var( _p_NAME )
+#    ecbuild_debug_var( _p_DIRNAME )
 
     if( _p_EXTRACT )
         set( _extract EXTRACT )
@@ -372,11 +376,11 @@ endfunction()\n\n" )
             set( _md5 MD5 ${_md5} )
         endif()
 
-        #debug_var(_f)
-        #debug_var(_file)
-        #debug_var(_dirname)
-        #debug_var(_name)
-        #debug_var(_md5)
+        #ecbuild_debug_var(_f)
+        #ecbuild_debug_var(_file)
+        #ecbuild_debug_var(_dirname)
+        #ecbuild_debug_var(_name)
+        #ecbuild_debug_var(_md5)
 
         ecbuild_get_test_data(
             TARGET __get_data_${_p_TARGET}_${_name}
@@ -391,6 +395,9 @@ endfunction()\n\n" )
 
     if( ENABLE_TESTS )
       add_test(  NAME ${_p_TARGET} COMMAND ${CMAKE_COMMAND} -P ${_script} )
+      set( _p_LABELS ${PROJECT_NAME_LOWCASE} download_data ${_p_LABELS} )
+      list( REMOVE_DUPLICATES _p_LABELS )
+      set_property( TEST ${_p_TARGET} APPEND PROPERTY LABELS "${_p_LABELS}" )
     endif()
 
 endfunction(ecbuild_get_test_multidata)
diff --git a/cmake/ecbuild_git.cmake b/cmake/ecbuild_git.cmake
index 42124db..0a378a6 100644
--- a/cmake/ecbuild_git.cmake
+++ b/cmake/ecbuild_git.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -8,6 +8,8 @@
 
 set( ECBUILD_GIT  ON  CACHE BOOL "Turn on/off ecbuild_git() function" )
 
+mark_as_advanced(ECBUILD_GIT)
+
 if( ECBUILD_GIT )
 
   find_package(Git)
@@ -78,15 +80,15 @@ macro( ecbuild_git )
   cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
 
   if( DEFINED _PAR_BRANCH AND DEFINED _PAR_TAG )
-    message( FATAL_ERROR "Cannot defined both BRANCH and TAG in macro ecbuild_git" )
+    ecbuild_critical( "Cannot defined both BRANCH and TAG in macro ecbuild_git" )
   endif()
 
   if( _PAR_UPDATE AND _PAR_NOREMOTE )
-    message( FATAL_ERROR "Cannot pass both NOREMOTE and UPDATE in macro ecbuild_git" )
+    ecbuild_critical( "Cannot pass both NOREMOTE and UPDATE in macro ecbuild_git" )
   endif()
 
   if(_PAR_UNPARSED_ARGUMENTS)
-    message(FATAL_ERROR "Unknown keywords given to ecbuild_git(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+    ecbuild_critical("Unknown keywords given to ecbuild_git(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
   endif()
 
   if( ECBUILD_GIT )
@@ -100,15 +102,15 @@ macro( ecbuild_git )
 
     if( NOT EXISTS "${_PAR_DIR}" )
 
-      message( STATUS "Cloning ${_PAR_PROJECT} from ${_PAR_URL} into ${_PAR_DIR}...")
+      ecbuild_info( "Cloning ${_PAR_PROJECT} from ${_PAR_URL} into ${_PAR_DIR}...")
       execute_process(
         COMMAND ${GIT_EXECUTABLE} "clone" ${_PAR_URL} ${clone_args} ${_PAR_DIR} "-q"
         RESULT_VARIABLE nok ERROR_VARIABLE error
         WORKING_DIRECTORY "${PARENT_DIR}")
       if(nok)
-        message(FATAL_ERROR "${_PAR_DIR} git clone failed: ${error}\n")
+        ecbuild_critical("${_PAR_DIR} git clone failed:\n  ${GIT_EXECUTABLE} clone ${_PAR_URL} ${clone_args} ${_PAR_DIR} -q\n  ${error}\n")
       endif()
-      message( STATUS "${_PAR_DIR} retrieved.")
+      ecbuild_info( "${_PAR_DIR} retrieved.")
       set( _needs_switch 1 )
 
     endif()
@@ -122,7 +124,7 @@ macro( ecbuild_git )
                        OUTPUT_STRIP_TRAILING_WHITESPACE
                        WORKING_DIRECTORY "${ABS_PAR_DIR}" )
       if(nok)
-        message(STATUS "git rev-parse HEAD on ${_PAR_DIR} failed:\n ${error}")
+        ecbuild_info("git rev-parse HEAD on ${_PAR_DIR} failed:\n ${error}")
       endif()
 
       execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
@@ -130,10 +132,9 @@ macro( ecbuild_git )
                        OUTPUT_STRIP_TRAILING_WHITESPACE
                        WORKING_DIRECTORY "${ABS_PAR_DIR}" )
       if( nok OR _current_branch STREQUAL "" )
-        message(STATUS "git rev-parse --abbrev-ref HEAD on ${_PAR_DIR} failed:\n ${error}")
+        ecbuild_info("git rev-parse --abbrev-ref HEAD on ${_PAR_DIR} failed:\n ${error}")
       endif()
 
-      #message(STATUS "git describe --exact-match --abbrev=0 @ ${ABS_PAR_DIR}")
       execute_process( COMMAND ${GIT_EXECUTABLE} describe --exact-match --abbrev=0
                        OUTPUT_VARIABLE _current_tag RESULT_VARIABLE nok ERROR_VARIABLE error
                        OUTPUT_STRIP_TRAILING_WHITESPACE  ERROR_STRIP_TRAILING_WHITESPACE
@@ -143,18 +144,17 @@ macro( ecbuild_git )
         unset( _current_tag )
       else()
         if( nok )
-          message(STATUS "git describe --exact-match --abbrev=0 on ${_PAR_DIR} failed:\n ${error}")
+          ecbuild_info("git describe --exact-match --abbrev=0 on ${_PAR_DIR} failed:\n ${error}")
         endif()
       endif()
 
       if( NOT _current_tag ) # try nother method
-        #message(STATUS "git name-rev --tags --name-only @ ${ABS_PAR_DIR}")
         execute_process( COMMAND ${GIT_EXECUTABLE} name-rev --tags --name-only ${_sha1}
                          OUTPUT_VARIABLE _current_tag RESULT_VARIABLE nok ERROR_VARIABLE error
                          OUTPUT_STRIP_TRAILING_WHITESPACE
                          WORKING_DIRECTORY "${ABS_PAR_DIR}" )
         if( nok OR _current_tag STREQUAL "" )
-          message(STATUS "git name-rev --tags --name-only on ${_PAR_DIR} failed:\n ${error}")
+          ecbuild_info("git name-rev --tags --name-only on ${_PAR_DIR} failed:\n ${error}")
         endif()
       endif()
 
@@ -183,20 +183,11 @@ macro( ecbuild_git )
 
     if( _needs_switch AND IS_DIRECTORY "${_PAR_DIR}/.git" )
 
-      # debug_here( ABS_PAR_DIR )
-      # debug_here( _sha1 )
-      # debug_here( _current_branch )
-      # debug_here( _current_tag )
-      # debug_here( _PAR_TAG )
-      # debug_here( _PAR_BRANCH )
-      # debug_here( _needs_switch )
-      # debug_here( _PAR_UPDATE )
-
       if( DEFINED _PAR_BRANCH )
         set ( _gitref ${_PAR_BRANCH} )
-        message(STATUS "Updating ${_PAR_PROJECT} to head of BRANCH ${_PAR_BRANCH}...")
+        ecbuild_info("Updating ${_PAR_PROJECT} to head of BRANCH ${_PAR_BRANCH}...")
       else()
-        message(STATUS "Updating ${_PAR_PROJECT} to TAG ${_PAR_TAG}...")
+        ecbuild_info("Updating ${_PAR_PROJECT} to TAG ${_PAR_TAG}...")
         set ( _gitref ${_PAR_TAG} )
       endif()
 
@@ -204,34 +195,34 @@ macro( ecbuild_git )
 
       if( NOT _PAR_NOREMOTE )
 
-        message(STATUS "git fetch --all @ ${ABS_PAR_DIR}")
+        ecbuild_info("git fetch --all @ ${ABS_PAR_DIR}")
         execute_process( COMMAND "${GIT_EXECUTABLE}" fetch --all -q
                          RESULT_VARIABLE nok ERROR_VARIABLE error
                          WORKING_DIRECTORY "${ABS_PAR_DIR}")
         if(nok)
-          message(STATUS "git fetch --all in ${_PAR_DIR} failed:\n ${error}")
+          ecbuild_warn("git fetch --all in ${_PAR_DIR} failed:\n ${error}")
         endif()
 
-        message(STATUS "git fetch --all --tags @ ${ABS_PAR_DIR}")
+        ecbuild_info("git fetch --all --tags @ ${ABS_PAR_DIR}")
         execute_process( COMMAND "${GIT_EXECUTABLE}" fetch --all --tags -q
                          RESULT_VARIABLE nok ERROR_VARIABLE error
                          WORKING_DIRECTORY "${ABS_PAR_DIR}")
         if(nok)
-          message(STATUS "git fetch --all --tags in ${_PAR_DIR} failed:\n ${error}")
+          ecbuild_warn("git fetch --all --tags in ${_PAR_DIR} failed:\n ${error}")
         endif()
 
       else()
-        message(STATUS "${_PAR_DIR} marked NOREMOTE : Skipping git fetch")
+        ecbuild_info("${_PAR_DIR} marked NOREMOTE : Skipping git fetch")
       endif()
 
       # checking out gitref
 
-      message(STATUS "git checkout ${_gitref} @ ${ABS_PAR_DIR}")
+      ecbuild_info("git checkout ${_gitref} @ ${ABS_PAR_DIR}")
       execute_process( COMMAND "${GIT_EXECUTABLE}" checkout -q "${_gitref}"
                        RESULT_VARIABLE nok ERROR_VARIABLE error
                        WORKING_DIRECTORY "${ABS_PAR_DIR}")
       if(nok)
-        message(FATAL_ERROR "git checkout ${_gitref} on ${_PAR_DIR} failed:\n ${error}")
+        ecbuild_critical("git checkout ${_gitref} on ${_PAR_DIR} failed:\n  ${GIT_EXECUTABLE} checkout -q ${_gitref}\n  ${error}")
       endif()
 
       if( DEFINED _PAR_BRANCH AND _PAR_UPDATE ) #############################################################################
@@ -240,7 +231,7 @@ macro( ecbuild_git )
                          RESULT_VARIABLE nok ERROR_VARIABLE error
                          WORKING_DIRECTORY "${ABS_PAR_DIR}")
         if(nok)
-          message(STATUS "git pull of branch ${_PAR_BRANCH} on ${_PAR_DIR} failed:\n ${error}")
+          ecbuild_warn("git pull of branch ${_PAR_BRANCH} on ${_PAR_DIR} failed:\n ${error}")
         endif()
 
       endif() ####################################################################################
diff --git a/cmake/ecbuild_install_project.cmake b/cmake/ecbuild_install_project.cmake
index d53f110..5e26bea 100644
--- a/cmake/ecbuild_install_project.cmake
+++ b/cmake/ecbuild_install_project.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -33,7 +33,7 @@
 # the project with cpack and exports the configuration and targets for other
 # projects to use.
 #
-# In a top-level project, the following files are generated:
+# Unless ECBUILD_SKIP_<PNAME>_EXPORT is set, the following files are generated:
 #
 # :<project>-config.cmake:         default project configuration
 # :<project>-config-version.cmake: project version number
@@ -49,7 +49,7 @@
 # and ``<project>-config-version.cmake``.
 #
 # In DEVELOPER_MODE, the build tree location is also added to the CMake user
-# package registry.
+# package registry for top level projects.
 #
 # If the project is added as a subdirectory, the following CMake variables
 # are set in the parent scope:
@@ -70,7 +70,6 @@
 #
 ##############################################################################
 
-
 macro( ecbuild_install_project )
 
     set( options )
@@ -80,11 +79,22 @@ macro( ecbuild_install_project )
     cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
     if(_PAR_UNPARSED_ARGUMENTS)
-      message(FATAL_ERROR "Unknown keywords given to ecbuild_install_project(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+      ecbuild_critical("Unknown keywords given to ecbuild_install_project(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
     endif()
 
     if( NOT _PAR_NAME  )
-      message(FATAL_ERROR "The call to ecbuild_install_project() doesn't specify the NAME.")
+      ecbuild_critical("The call to ecbuild_install_project() doesn't specify the NAME.")
+    endif()
+
+    ### EXTRA TARGETS #####################################################
+
+    # added here to avoid adding another macro call at the end of each project,
+
+    if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
+
+        ecbuild_define_libs_and_execs_targets()
+        ecbuild_define_links_target()
+
     endif()
 
     ### PACKAGING ########################################################
@@ -160,6 +170,8 @@ macro( ecbuild_install_project )
                PATHS ${ECBUILD_MACROS_DIR}/../toolchains
                      ${ECBUILD_MACROS_DIR}/../share/ecbuild/toolchains )
 
+    mark_as_advanced( ECBUILD_TOOLCHAIN_DIR )
+
     if( ECBUILD_TOOLCHAIN_DIR )
       list( APPEND CPACK_SOURCE_INSTALLED_DIRECTORIES "${ECBUILD_TOOLCHAIN_DIR}" "share/ecbuild/toolchains/" )
     endif()
@@ -169,6 +181,8 @@ macro( ecbuild_install_project )
                   PATHS ${ECBUILD_MACROS_DIR}/../bin
                         ${ECBUILD_MACROS_DIR}/../../../bin )
 
+    mark_as_advanced( ECBUILD_SCRIPT )
+
     if( ECBUILD_SCRIPT )
       get_filename_component( ECBUILD_BIN_DIR ${ECBUILD_SCRIPT} PATH )
       list( APPEND CPACK_SOURCE_INSTALLED_DIRECTORIES "${ECBUILD_BIN_DIR}" "bin/" )
@@ -187,7 +201,7 @@ macro( ecbuild_install_project )
         set( ${PNAME}_HAVE_${_f} 1 )
     endforeach()
 
-    message( STATUS "${PROJECT_NAME_CAPS}_TPLS: ${${PROJECT_NAME_CAPS}_TPLS}" )
+    ecbuild_info( "${PROJECT_NAME_CAPS}_TPLS: ${${PROJECT_NAME_CAPS}_TPLS}" )
 
     foreach( _tpl ${${PNAME}_TPLS} )
         string( TOUPPER ${_tpl} _TPL )
@@ -219,16 +233,21 @@ macro( ecbuild_install_project )
         endif()
     endforeach()
 
-    # TOP-LEVEL PROJECT EXPORT
-
-    if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
-
-        # exports the package for use from the build-tree but only in DEVELOPER_MODE
-        # inserts <package> into the CMake user package registry
+    # Deduplicate TPL includes, libs and definitions
+    # The same TPL may indirectly be pulled in multiple times!
+    if( ${PNAME}_TPL_INCLUDE_DIRS )
+      list( REMOVE_DUPLICATES ${PNAME}_TPL_INCLUDE_DIRS )
+    endif()
+    if( ${PNAME}_TPL_LIBRARIES )
+      list( REMOVE_DUPLICATES ${PNAME}_TPL_LIBRARIES )
+    endif()
+    if( ${PNAME}_TPL_DEFINITIONS )
+      list( REMOVE_DUPLICATES ${PNAME}_TPL_DEFINITIONS )
+    endif()
 
-        if( DEVELOPER_MODE )
-            export( PACKAGE ${PROJECT_NAME} )
-        endif()
+    # Generate the project .cmake config files
+    # All variables here must be (sub)project specific in order to work within bundles
+    if ( NOT ECBUILD_SKIP_${PNAME}_EXPORT )
 
         set( _template_config "${ECBUILD_MACROS_DIR}/project-config.cmake.in" )
         if( EXISTS ${LNAME}-config.cmake.in )
@@ -242,7 +261,9 @@ macro( ecbuild_install_project )
 
         # project-config-version.cmake -- format ([0-9]+).([0-9]+).([0-9]+)
 
-        set( PACKAGE_VERSION "${${PNAME}_VERSION}" )
+        set( PACKAGE_VERSION        "${${PNAME}_VERSION}" )
+        set( PACKAGE_GIT_SHA1       "${${PNAME}_GIT_SHA1}" )
+        set( PACKAGE_GIT_SHA1_SHORT "${${PNAME}_GIT_SHA1_SHORT}" )
 
         configure_file( "${_template_config_version}" "${PROJECT_BINARY_DIR}/${LNAME}-config-version.cmake" @ONLY )
 
@@ -269,8 +290,6 @@ macro( ecbuild_install_project )
            set( CONF_TPL_LIBRARIES ${${PNAME}_TPL_LIBRARIES} )
         endif()
 
-        # project-config.cmake @ build tree
-
         set( CONF_TPLS ${${PNAME}_TPLS} )
 
         set( CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}" )
@@ -279,24 +298,18 @@ macro( ecbuild_install_project )
         endif()
 
         set( CONF_TPL_INCLUDE_DIRS "" )
-        foreach( _tpl ${${PNAME}_TPLS} )
-            string( TOUPPER ${_tpl} TPL )
-            if( ${_tpl}_INCLUDE_DIRS )
-                list( APPEND CONF_TPL_INCLUDE_DIRS ${${_tpl}_INCLUDE_DIRS} )
-            elseif( ${_tpl}_INCLUDE_DIR )
-                list( APPEND CONF_TPL_INCLUDE_DIRS ${${_tpl}_INCLUDE_DIR} )
-            elseif( ${TPL}_INCLUDE_DIRS )
-                list( APPEND CONF_TPL_INCLUDE_DIRS ${${TPL}_INCLUDE_DIRS} )
-            elseif( ${TPL}_INCLUDE_DIR )
-                list( APPEND CONF_TPL_INCLUDE_DIRS ${${TPL}_INCLUDE_DIR} )
-            endif()
-        endforeach()
+        if( ${PNAME}_TPL_INCLUDE_DIRS )
+            set( CONF_TPL_INCLUDE_DIRS ${${PNAME}_TPL_INCLUDE_DIRS} )
+        endif()
+
+        # Generate <project>-import.cmake (if it exists)
 
         set( CONF_IMPORT_FILE "${LNAME}-import.cmake" )
 
         # If <project>-import.cmake.in exist in source tree, configure it to
         # the build tree and install the configured version
         if( EXISTS "${PROJECT_SOURCE_DIR}/${CONF_IMPORT_FILE}.in" )
+          ecbuild_debug( "Found ${PROJECT_SOURCE_DIR}/${CONF_IMPORT_FILE}.in - configuring to ${PROJECT_BINARY_DIR}/${CONF_IMPORT_FILE}" )
           configure_file( "${PROJECT_SOURCE_DIR}/${CONF_IMPORT_FILE}.in"
                           "${PROJECT_BINARY_DIR}/${CONF_IMPORT_FILE}" @ONLY )
           install( FILES "${PROJECT_BINARY_DIR}/${CONF_IMPORT_FILE}"
@@ -304,27 +317,51 @@ macro( ecbuild_install_project )
         # Otherwise, if <project>-import.cmake exist in source tree, copy it to
         # the build tree and install it
         elseif( EXISTS "${PROJECT_SOURCE_DIR}/${CONF_IMPORT_FILE}" )
+          ecbuild_debug( "Found ${PROJECT_SOURCE_DIR}/${CONF_IMPORT_FILE} - copying to ${PROJECT_BINARY_DIR}/${CONF_IMPORT_FILE}" )
           configure_file( "${PROJECT_SOURCE_DIR}/${CONF_IMPORT_FILE}"
                           "${PROJECT_BINARY_DIR}/${CONF_IMPORT_FILE}" COPYONLY )
           install( FILES "${PROJECT_SOURCE_DIR}/${CONF_IMPORT_FILE}"
                    DESTINATION "${INSTALL_CMAKE_DIR}" )
+        else()
+          ecbuild_debug( "No ${CONF_IMPORT_FILE} found in ${PROJECT_SOURCE_DIR}" )
         endif()
 
+        # Generate <project>-config.cmake for use from the build tree
+
         set( _lname_config "${PROJECT_BINARY_DIR}/${LNAME}-config.cmake")
 
+        # Include directories (may) reference source and build tree and the
+        # config file is marked as coming from a build tree
         set( _is_build_dir_export ON )
         configure_file( "${_template_config}" "${_lname_config}" @ONLY )
 
+        # Generate <project>-config.cmake.tpls (if there are any TPLs)
+
         file( REMOVE ${_lname_config}.tpls.in )
 
         foreach( _tpl ${${PNAME}_TPLS} )
+
             string( TOUPPER ${_tpl} TPL )
-            if( ${TPL}_IMPORT_FILE )
+
+            if( ${TPL}_IMPORT_FILE ) # ecBuild packages should trigger this if they export themselves
+
+              ecbuild_debug( "Adding TPL ${TPL} import file to ${_lname_config}.tpls.in" )
                 set( __import_file "${${TPL}_IMPORT_FILE}" )
                 file( APPEND "${_lname_config}.tpls.in" "if( NOT ${TPL}_IMPORT_FILE )\n" )
                 file( APPEND "${_lname_config}.tpls.in" "    include( \"${__import_file}\" OPTIONAL )\n" )
                 file( APPEND "${_lname_config}.tpls.in" "endif()\n" )
+
+            elseif( ${TPL}_CONFIG ) # cmake built packages (e.g. CGAL) may have exported their targets
+
+              ecbuild_debug( "Adding TPL ${TPL} import file to ${_lname_config}.tpls.in" )
+                set( __import_file "${${TPL}_CONFIG}" )
+                file( APPEND "${_lname_config}.tpls.in" "if( NOT ${TPL}_CONFIG )\n" )
+                file( APPEND "${_lname_config}.tpls.in" "    include( \"${__import_file}\" OPTIONAL )\n" )
+                file( APPEND "${_lname_config}.tpls.in" "    set( ${TPL}_CONFIG \"${__import_file}\" )\n" )
+                file( APPEND "${_lname_config}.tpls.in" "endif()\n" )
+
             endif()
+
         endforeach()
 
         if( EXISTS "${_lname_config}.tpls.in" )
@@ -332,28 +369,13 @@ macro( ecbuild_install_project )
             install( FILES "${_lname_config}.tpls" DESTINATION "${INSTALL_CMAKE_DIR}" )
         endif()
 
-        # project-config.cmake @ install tree
+        # Generate <project>-config.cmake for use in the install tree
 
+        # Compute path to the include dir relative to the project's CMake dir
+        # where <project>-config.cmake is installed to
         file( RELATIVE_PATH REL_INCLUDE_DIR "${${PNAME}_FULL_INSTALL_CMAKE_DIR}" "${${PNAME}_FULL_INSTALL_INCLUDE_DIR}" )
         set( CONF_INCLUDE_DIRS "\${${PNAME}_CMAKE_DIR}/${REL_INCLUDE_DIR}" )
 
-        set( CONF_TPL_INCLUDE_DIRS "" )
-        foreach( _tpl ${${PNAME}_TPLS} )
-            string( TOUPPER ${_tpl} TPL )
-            if( ${TPL}_FULL_INSTALL_INCLUDE_DIR )
-                 list( APPEND CONF_TPL_INCLUDE_DIRS "\${${PNAME}_CMAKE_DIR}/${REL_INCLUDE_DIR}" )
-            endif()
-            if( ${_tpl}_INCLUDE_DIRS )
-                list( APPEND CONF_TPL_INCLUDE_DIRS ${${_tpl}_INCLUDE_DIRS} )
-            elseif( ${_tpl}_INCLUDE_DIR )
-                list( APPEND CONF_TPL_INCLUDE_DIRS ${${_tpl}_INCLUDE_DIR} )
-            elseif( ${TPL}_INCLUDE_DIRS )
-                list( APPEND CONF_TPL_INCLUDE_DIRS ${${TPL}_INCLUDE_DIRS} )
-            elseif( ${TPL}_INCLUDE_DIR )
-                list( APPEND CONF_TPL_INCLUDE_DIRS ${${TPL}_INCLUDE_DIR} )
-            endif()
-        endforeach()
-
         set( _is_build_dir_export OFF )
         configure_file( "${_template_config}" "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${LNAME}-config.cmake" @ONLY )
         install( FILES "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${LNAME}-config.cmake" DESTINATION "${INSTALL_CMAKE_DIR}" )
@@ -361,14 +383,30 @@ macro( ecbuild_install_project )
         # install the export
 
         if( ${PROJECT_NAME}_ALL_EXES OR ${PROJECT_NAME}_ALL_LIBS )
-            install( EXPORT ${CMAKE_PROJECT_NAME}-targets DESTINATION "${INSTALL_CMAKE_DIR}" )
+            install( EXPORT ${PROJECT_NAME}-targets
+                     DESTINATION "${INSTALL_CMAKE_DIR}" )
+        endif()
+
+    endif()  # if ( NOT ECBUILD_SKIP_${PNAME}_EXPORT )
+
+    # exports the package for use from the build-tree but only in DEVELOPER_MODE
+    # inserts <package> into the CMake user package registry
+
+    if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
+
+        if( DEVELOPER_MODE )
+            export( PACKAGE ${PROJECT_NAME} )
         endif()
 
     else()
 
+    # export variables for upper projects
+
         set( ${PNAME}_FOUND             TRUE                          PARENT_SCOPE )
         set( ${PROJECT_NAME}_FOUND      TRUE                          PARENT_SCOPE )
         set( ${PNAME}_VERSION           ${${PNAME}_VERSION}           PARENT_SCOPE )
+        set( ${PNAME}_GIT_SHA1          ${${PNAME}_GIT_SHA1}          PARENT_SCOPE )
+        set( ${PNAME}_GIT_SHA1_SHORT    ${${PNAME}_GIT_SHA1_SHORT}    PARENT_SCOPE )
         set( ${PROJECT_NAME}_VERSION    ${${PNAME}_VERSION}           PARENT_SCOPE )
         set( ${PNAME}_INCLUDE_DIRS      ${${PNAME}_INCLUDE_DIRS}      PARENT_SCOPE )
         set( ${PNAME}_LIBRARIES         ${${PNAME}_LIBRARIES}         PARENT_SCOPE )
@@ -382,6 +420,7 @@ macro( ecbuild_install_project )
         foreach( _f ${${PNAME}_FEATURES} )
             set( ${PNAME}_HAVE_${_f} ${${PNAME}_HAVE_${_f}} PARENT_SCOPE )
         endforeach()
-     endif()
+
+    endif()
 
 endmacro( ecbuild_install_project )
diff --git a/cmake/ecbuild_list_add_pattern.cmake b/cmake/ecbuild_list_add_pattern.cmake
new file mode 100644
index 0000000..0f68217
--- /dev/null
+++ b/cmake/ecbuild_list_add_pattern.cmake
@@ -0,0 +1,102 @@
+# (C) Copyright 1996-2016 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.
+
+##############################################################################
+#.rst:
+#
+# ecbuild_list_add_pattern
+# ========================
+#
+# Exclude items from a list that match a list of patterns. ::
+#
+#   ecbuild_list_add_pattern( LIST <input_list>
+#                             GLOB <pattern1> [ <pattern2> ... ]
+#                             [ SOURCE_DIR <source_dir> ]
+#                             [ QUIET ] )
+#
+# Options
+# -------
+#
+# LIST : required
+#   list variable to be appended to
+#
+# GLOB : required
+#   Regex pattern of exclusion
+#
+# SOURCE_DIR : optional
+#   Directory from where to start search
+#
+# QUIET  : optional
+#   Don't warn if patterns don't match
+#
+##############################################################################
+
+function( ecbuild_list_add_pattern )
+
+  set( options QUIET )
+  set( single_value_args LIST SOURCE_DIR )
+  set( multi_value_args  GLOB )
+
+  cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
+
+  if(_p_UNPARSED_ARGUMENTS)
+    ecbuild_critical("Unknown keywords given to ecbuild_list_add_pattern(): \"${_p_UNPARSED_ARGUMENTS}\"")
+  endif()
+
+  if( NOT _p_LIST  )
+    ecbuild_critical("The call to ecbuild_list_add_pattern() doesn't specify the LIST.")
+  endif()
+
+  if( NOT _p_GLOB )
+    ecbuild_critical("The call to ecbuild_list_add_pattern() doesn't specify the GLOB.")
+  endif()
+
+  #####
+
+  set( input_list ${${_p_LIST}} )
+  unset( matched_files )
+
+  foreach( pattern ${_p_GLOB} )
+
+    if( IS_ABSOLUTE ${pattern} )
+      ecbuild_debug( "ecbuild_list_add_pattern: Adding ${pattern}" )
+      file( GLOB_RECURSE matched_files ${pattern} )
+    else()
+
+      if(_p_SOURCE_DIR)
+        if( IS_ABSOLUTE ${_p_SOURCE_DIR} )
+          ecbuild_debug( "ecbuild_list_add_pattern: Adding ${_p_SOURCE_DIR}/${pattern}" )
+          file( GLOB_RECURSE matched_files ${_p_SOURCE_DIR}/${pattern} )
+        else()
+          ecbuild_debug( "ecbuild_list_add_pattern: Adding ${_p_SOURCE_DIR}/${pattern}" )
+          file( GLOB_RECURSE matched_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${_p_SOURCE_DIR}/${pattern} )
+        endif()
+      else()
+        ecbuild_debug( "ecbuild_list_add_pattern: Adding ${pattern} ")
+        file( GLOB_RECURSE matched_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${pattern} )
+      endif()
+
+    endif()
+
+    if(matched_files)
+      ecbuild_debug( "ecbuild_list_add_pattern: Found ${matched_files}" )
+      list( APPEND input_list ${matched_files} )
+      list( REMOVE_DUPLICATES input_list )
+      set( ${_p_LIST} ${input_list} PARENT_SCOPE )
+    else()
+      if(NOT _p_QUIET)
+        ecbuild_warn( "ecbuild_list_add_pattern: no matches found for patterns ${pattern}" )
+      else()
+        ecbuild_debug( "ecbuild_list_add_pattern:no matches found for patterns ${pattern}" )
+      endif()
+    endif()
+
+  endforeach()
+
+
+endfunction(ecbuild_list_add_pattern)
diff --git a/cmake/ecbuild_list_exclude_pattern.cmake b/cmake/ecbuild_list_exclude_pattern.cmake
new file mode 100644
index 0000000..7e02f47
--- /dev/null
+++ b/cmake/ecbuild_list_exclude_pattern.cmake
@@ -0,0 +1,88 @@
+# (C) Copyright 1996-2016 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.
+
+##############################################################################
+#.rst:
+#
+# ecbuild_list_exclude_pattern
+# ============================
+#
+# Exclude items from a list that match a list of patterns. ::
+#
+#   ecbuild_list_exclude_pattern( LIST <input_list>
+#                                 REGEX <regex1> [ <regex2> ... ]
+#                                 [ QUIET ] )
+#
+# Options
+# -------
+#
+# LIST : required
+#   list variable to be cleaned
+#
+# REGEX : required
+#   Regex pattern of exclusions
+#
+# QUIET  : optional
+#   Don't warn if patterns don't match
+#
+##############################################################################
+
+function( ecbuild_list_exclude_pattern )
+
+  set( options QUIET )
+  set( single_value_args LIST )
+  set( multi_value_args  REGEX )
+
+  cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
+
+  if(_p_UNPARSED_ARGUMENTS)
+    ecbuild_critical("Unknown keywords given to ecbuild_list_exclude_pattern(): \"${_p_UNPARSED_ARGUMENTS}\"")
+  endif()
+
+  if( NOT _p_LIST  )
+    ecbuild_critical("The call to ecbuild_list_exclude_pattern() doesn't specify the LIST.")
+  endif()
+
+  if( NOT _p_REGEX )
+    ecbuild_critical("The call to ecbuild_list_exclude_pattern() doesn't specify the REGEX.")
+  endif()
+
+  #####
+
+  set( result "" )
+  set( matches_found 0 )
+
+  # ecbuild_debug_var(_p_REGEX)
+
+  foreach( item ${${_p_LIST}} )
+
+    set( _keep 1 )
+
+    foreach( pattern ${_p_REGEX} )
+        if( ${item} MATCHES ${pattern} )
+            set( _keep 0 )
+            set( matches_found 1 )
+        endif()
+    endforeach()
+    if( _keep )
+        list( APPEND result ${item} )
+#    else()
+#      ecbuild_warn( "removing ${item}" )
+    endif()
+
+  endforeach()
+
+  if( matches_found )
+      set( ${_p_LIST} ${result} PARENT_SCOPE )
+  else()
+    if( NOT _p_QUIET )
+        ecbuild_warn( "ecbuild_list_exclude_pattern: no matches found for patterns ${_p_REGEX} in ${_p_LIST}" )
+    endif()
+  endif()
+
+endfunction(ecbuild_list_exclude_pattern)
diff --git a/cmake/ecbuild_list_extra_search_paths.cmake b/cmake/ecbuild_list_extra_search_paths.cmake
index 0768a48..b81f062 100644
--- a/cmake/ecbuild_list_extra_search_paths.cmake
+++ b/cmake/ecbuild_list_extra_search_paths.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -14,11 +14,11 @@
 
 function( ecbuild_list_extra_search_paths pkg var )
 
-  message( DEPRECATION " ecbuild_list_extra_search_paths should no longer be"
-           " used and is going to be removed in a future version of ecBuild." )
+  ecbuild_deprecate( " ecbuild_list_extra_search_paths should no longer be"
+                     " used and is going to be removed in a future version of ecBuild." )
 
-	# debug_var( pkg )
-	# debug_var( var )
+	# ecbuild_debug_var( pkg )
+	# ecbuild_debug_var( var )
 
 	string( TOUPPER ${pkg} _PKG )
 
@@ -75,7 +75,7 @@ function( ecbuild_list_extra_search_paths pkg var )
   ecbuild_debug("ecbuild_list_extra_search_paths(${pkg}): setting ${var} to ${${var}}")
 	set( ${var} ${${var}} PARENT_SCOPE )
 
-# debug_var( ${var} )
+# ecbuild_debug_var( ${var} )
 
 endfunction()
 
diff --git a/cmake/ecbuild_list_macros.cmake b/cmake/ecbuild_list_macros.cmake
index a4152c7..176a161 100644
--- a/cmake/ecbuild_list_macros.cmake
+++ b/cmake/ecbuild_list_macros.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
-# 
+# (C) Copyright 1996-2016 ECMWF.
+#
 # This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 
-# In applying this licence, ECMWF does not waive the privileges and immunities 
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
 # granted to it by virtue of its status as an intergovernmental organisation nor
 # does it submit to any jurisdiction.
 
@@ -56,35 +56,3 @@ function( MAP_GET _map _key _var )
 	set( ${_var} "${_${_map}_${_key}}" PARENT_SCOPE )
 endfunction(MAP_GET)
 
-##############################################################################
-# function to remove items from a list that match a list of patterns
-#
-# examples:
-#
-#   ecbuild_list_remove_pattern( mylist "foo;bar" VAR )
-#
-
-function(ecbuild_list_remove_pattern _list _patterns _var)
-
-#debug_var(  _list )
-#debug_var(  _patterns )
-#debug_var(  _var )
-
-    foreach( _elem ${_list} )
-        set( _keep TRUE)
-        foreach( _pat ${_patterns} )
-            if( ${_elem} MATCHES ${_pat} )
-                set( _keep FALSE)
-            endif()
-        endforeach()
-        if( _keep )
-            list( APPEND _result ${_elem} )
-        endif()
-
-    endforeach()
-
-#debug_var(  _result )
-
-    set( ${_var} "${_result}" PARENT_SCOPE )
-
-endfunction(ecbuild_list_remove_pattern)
diff --git a/cmake/ecbuild_log.cmake b/cmake/ecbuild_log.cmake
index fbb2349..32a1398 100644
--- a/cmake/ecbuild_log.cmake
+++ b/cmake/ecbuild_log.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -12,22 +12,42 @@
 # Logging
 # =======
 #
-# ecBuild provides macros for logging based on a log level set by the user,
+# ecBuild provides functions for logging based on a log level set by the user,
 # similar to the Python logging module:
 #
-# :ecbuild_debug:    logs a ``STATUS`` message if log level <= ``DEBUG``
-# :ecbuild_info:     logs a ``STATUS`` message if log level <= ``INFO``
-# :ecbuild_warn:     logs a ``WARNING`` message if log level <= ``WARN``
-# :ecbuild_error:    logs a ``SEND_ERROR`` message if log level <= ``ERROR``
-# :ecbuild_critical: logs a ``FATAL_ERROR`` message if log level <= ``CRITICAL``
+# :ecbuild_debug:     logs a ``STATUS`` message if log level <= ``DEBUG``
+# :ecbuild_info:      logs a ``STATUS`` message if log level <= ``INFO``
+# :ecbuild_warn:      logs a ``WARNING`` message if log level <= ``WARN``
+# :ecbuild_error:     logs a ``SEND_ERROR`` message if log level <= ``ERROR``
+# :ecbuild_critical:  logs a ``FATAL_ERROR`` message if log level <= ``CRITICAL``
+# :ecbuild_deprecate: logs a ``DEPRECATION`` message as a warning
+#                     enable CMAKE_ERROR_DEPRECATED to raise an error instead
+#                     disable CMAKE_WARN_DEPRECATED to hide deprecations
+#
+# 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``
+#
+# To log a message to the ecBuild log file only at a given log level, use ::
+#
+#   ecbuild_log( <level> <msg> )
 #
 # Input variables
 # ---------------
 #
 # CMake variables controlling logging behaviour:
 #
+# ECBUILD_LOG_FILE : path
+#   set the log file, defaults to ``${CMAKE_BINARY_DIR}/ecbuild.log``
+#
+#   All ecBuild log functions write their messages to this log file with a time
+#   stamp. Messages emitted by CMake directly cannot be logged to file.
+#
 # ECBUILD_LOG_LEVEL : string, one of DEBUG, INFO, WARN, ERROR, CRITICAL, OFF
-#   set the desired log level, OFF to disable logging altogether
+#   desired log level, defaults to ``INFO``, ``OFF`` to disable logging
 #
 # ECBUILD_NO_COLOUR : bool
 #   if set, does not colour log output (by default log output is coloured)
@@ -35,14 +55,14 @@
 # Usage
 # -----
 #
-# The macros ``ecbuild_debug`` and ``ecbuild_info`` can be used to output
+# The functions ``ecbuild_debug`` and ``ecbuild_info`` can be used to output
 # messages which are not printed by default. Many ecBuild macros use this
 # facility to log debugging hints. When debugging a CMake run, users can use
 # ``-DECBUILD_LOG_LEVEL=DEBUG`` to get detailed diagnostics.
 #
 ##############################################################################
 
-# Define colour escape sequences (https://stackoverflow.com/a/19578320/396967)
+# Define colour escape sequences (not available on Windows)
 if(NOT (WIN32 OR ECBUILD_NO_COLOUR))
   string(ASCII 27 Esc)
   set(ColourReset "${Esc}[m")
@@ -70,7 +90,7 @@ set(ECBUILD_ERROR    40)
 set(ECBUILD_CRITICAL 50)
 
 if( NOT DEFINED ECBUILD_LOG_LEVEL )
-  set(ECBUILD_LOG_LEVEL ${ECBUILD_WARN})
+  set(ECBUILD_LOG_LEVEL ${ECBUILD_INFO})
 elseif( NOT ECBUILD_LOG_LEVEL )
   set(ECBUILD_LOG_LEVEL 60)
 elseif( ECBUILD_LOG_LEVEL STREQUAL "DEBUG" )
@@ -88,42 +108,158 @@ else()
   set(ECBUILD_LOG_LEVEL ${ECBUILD_WARN})
 endif()
 
+if( NOT DEFINED ECBUILD_LOG_FILE )
+  set( ECBUILD_LOG_FILE ${CMAKE_BINARY_DIR}/ecbuild.log )
+endif()
+if( NOT DEFINED CMAKE_ERROR_DEPRECATED AND NOT DEFINED CMAKE_WARN_DEPRECATED )
+  set( CMAKE_WARN_DEPRECATED ON )
+endif()
+
 ##############################################################################
 
-macro( ecbuild_debug MSG )
+function( ecbuild_log LEVEL )
+  string( REPLACE ";" " " MSG "${ARGN}" )
+  string( TIMESTAMP _time )
+  file( APPEND ${ECBUILD_LOG_FILE} "${_time} - ${LEVEL} - ${MSG}\n" )
+endfunction( ecbuild_log )
+
+##############################################################################
+
+function( ecbuild_debug )
+  string( REPLACE ";" " " MSG "${ARGV}" )
+  ecbuild_log(DEBUG "${MSG}")
   if( ECBUILD_LOG_LEVEL LESS 11)
     message(STATUS "${Blue}DEBUG - ${MSG}${ColourReset}")
   endif()
-endmacro( ecbuild_debug )
+endfunction( ecbuild_debug )
 
 ##############################################################################
 
-macro( ecbuild_info MSG )
+function( ecbuild_info )
+  string( REPLACE ";" " " MSG "${ARGV}" )
+  ecbuild_log(INFO "${MSG}")
   if( ECBUILD_LOG_LEVEL LESS 21)
-    message(STATUS "${Green}INFO - ${MSG}${ColourReset}")
+    message(STATUS "${MSG}")
   endif()
-endmacro( ecbuild_info )
+endfunction( ecbuild_info )
 
 ##############################################################################
 
-macro( ecbuild_warn MSG )
+function( ecbuild_warn )
+  string( REPLACE ";" " " MSG "${ARGV}" )
+  ecbuild_log(WARNING "${MSG}")
   if( ECBUILD_LOG_LEVEL LESS 31)
     message(WARNING "${Yellow}WARN - ${MSG}${ColourReset}")
   endif()
-endmacro( ecbuild_warn )
+endfunction( ecbuild_warn )
 
 ##############################################################################
 
-macro( ecbuild_error MSG )
+function( ecbuild_error )
+  string( REPLACE ";" " " MSG "${ARGV}" )
+  ecbuild_log(ERROR "${MSG}")
   if( ECBUILD_LOG_LEVEL LESS 41)
     message(SEND_ERROR "${BoldRed}ERROR - ${MSG}${ColourReset}")
   endif()
-endmacro( ecbuild_error )
+endfunction( ecbuild_error )
+
+##############################################################################
+
+function( ecbuild_deprecate )
+  string(REPLACE ";" " " MSG ${ARGV})
+  ecbuild_log(DEPRECATION "${MSG}")
+  # DEPRECATION message type was only introduced in CMake 3.0, provide
+  # consistent behaviour for CMake < 3.0
+  if( CMAKE_VERSION VERSION_LESS 3.0 )
+    if( CMAKE_ERROR_DEPRECATED )
+      message(FATAL_ERROR "${BoldRed}DEPRECATION - ${MSG}${ColourReset}")
+    elseif( CMAKE_WARN_DEPRECATED )
+      message(WARNING "${Yellow}DEPRECATION - ${MSG}${ColourReset}")
+    endif()
+  else()
+    message(DEPRECATION "${BoldRed}${MSG}${ColourReset}")
+  endif()
+endfunction( ecbuild_deprecate )
 
 ##############################################################################
 
-macro( ecbuild_critical MSG )
+function( ecbuild_critical )
+  string(REPLACE ";" " " MSG ${ARGV})
+  ecbuild_log(FATAL_ERROR "${MSG}")
   if( ECBUILD_LOG_LEVEL LESS 51)
     message(FATAL_ERROR "${BoldMagenta}CRITICAL - ${MSG}${ColourReset}")
   endif()
-endmacro( ecbuild_critical )
+endfunction( ecbuild_critical )
+
+##############################################################################
+# function for debugging CMake variables
+
+function( ecbuild_debug_var )
+  foreach( VAR ${ARGV} )
+    ecbuild_log(DEBUG "${VAR} : ${${VAR}}")
+    if( ECBUILD_LOG_LEVEL LESS 11)
+      message(STATUS "${Blue}DEBUG - ${VAR} : ${${VAR}}${ColourReset}")
+    endif()
+  endforeach()
+endfunction()
+
+##############################################################################
+# function for debugging CMake lists
+
+function( ecbuild_debug_list )
+  foreach( VAR ${ARGV} )
+    ecbuild_log(DEBUG "${VAR} : ${${VAR}}")
+    foreach( _elem ${${VAR}} )
+      ecbuild_log( DEBUG "  ${_elem}" )
+    endforeach()
+    if( ECBUILD_LOG_LEVEL LESS 11)
+      message( STATUS "${Blue}DEBUG - ${VAR}" )
+      foreach( _elem ${${VAR}} )
+        message( STATUS "  ${_elem}" )
+      endforeach()
+      message(STATUS "${ColourReset}")
+    endif()
+  endforeach()
+endfunction()
+
+##############################################################################
+# function for debugging environment variables
+
+function( ecbuild_debug_env_var )
+  foreach( VAR ${ARGV} )
+    ecbuild_log(DEBUG "ENV ${VAR} : $ENV{${VAR}}")
+    if( ECBUILD_LOG_LEVEL LESS 11)
+      message(STATUS "${Blue}DEBUG - ENV ${VAR} [$ENV{${VAR}}]${ColourReset}")
+    endif()
+  endforeach()
+endfunction()
+
+##############################################################################
+# macro for debugging a cmake variable
+
+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()
diff --git a/cmake/ecbuild_pkgconfig.cmake b/cmake/ecbuild_pkgconfig.cmake
index 6db3726..d839a86 100644
--- a/cmake/ecbuild_pkgconfig.cmake
+++ b/cmake/ecbuild_pkgconfig.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -275,7 +275,7 @@ endfunction(ecbuild_pkgconfig_include)
 # ---------------
 #
 # The following CMake variables are used as default values for some of the
-# options listed above, where ``PNAME`` is the project name in upper case: ::
+# options listed above, where ``PNAME`` is the project name in upper case:
 #
 # :<PNAME>_LIBRARIES:    list of libraries to export
 # :<PNAME>_DESCRIPTION:  package description
@@ -312,7 +312,7 @@ function( ecbuild_pkgconfig )
   string( TOLOWER ${PROJECT_NAME} LNAME )
 
   if(_PAR_UNPARSED_ARGUMENTS)
-    message(FATAL_ERROR "Unknown keywords given to ecbuild_add_executable(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+    ecbuild_critical("Unknown keywords given to ecbuild_add_executable(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
   endif()
 
   unset( PKGCONFIG_LANGUAGES )
@@ -412,7 +412,7 @@ function( ecbuild_pkgconfig )
   endif()
 
   configure_file( ${_PAR_TEMPLATE} "${CMAKE_BINARY_DIR}/${_PAR_FILENAME}" @ONLY )
-  message( STATUS "pkg-config file created: ${_PAR_FILENAME}" )
+  ecbuild_info( "pkg-config file created: ${_PAR_FILENAME}" )
 
   install( FILES ${CMAKE_BINARY_DIR}/${_PAR_FILENAME}
            DESTINATION ${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR}/pkgconfig/
diff --git a/cmake/ecbuild_policies.cmake b/cmake/ecbuild_policies.cmake
index 06f856b..36ab7fe 100644
--- a/cmake/ecbuild_policies.cmake
+++ b/cmake/ecbuild_policies.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 ECMWF.
 #
 # This software is licensed under the terms of the Apache Licence Version 2.0
 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
@@ -6,13 +6,17 @@
 # granted to it by virtue of its status as an intergovernmental organisation
 # nor does it submit to any jurisdiction.
 
-###############################################################################
-# define cmake policies
+##############################################################################
+#
+# ecBuild Policies
+# ================
 #
 # NOTE: This file needs to be included with NO_POLICY_SCOPE or it will have no
 #       effect!
 # NOTE: Policies 1 through 17 will be set to NEW by requiring CMake 2.8.4 i.e.
 #       calling cmake_minimum_required( VERSION 2.8.4 FATAL_ERROR )
+#
+##############################################################################
 
 # allow for empty spaces around library names 
 if( POLICY CMP0004 )
diff --git a/cmake/ecbuild_print_summary.cmake b/cmake/ecbuild_print_summary.cmake
index d4bffba..6fc70d0 100644
--- a/cmake/ecbuild_print_summary.cmake
+++ b/cmake/ecbuild_print_summary.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -28,9 +28,9 @@ macro( ecbuild_print_summary )
 
   if( EXISTS ${PROJECT_SOURCE_DIR}/project_summary.cmake )
 
-    message( STATUS "---------------------------------------------------------" )
-    message( STATUS "Project ${PROJECT_NAME} summary" )
-    message( STATUS "---------------------------------------------------------" )
+    ecbuild_info( "---------------------------------------------------------" )
+    ecbuild_info( "Project ${PROJECT_NAME} summary" )
+    ecbuild_info( "---------------------------------------------------------" )
 
     include( ${PROJECT_SOURCE_DIR}/project_summary.cmake )
 
@@ -38,58 +38,62 @@ macro( ecbuild_print_summary )
 
   if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
 
-    ecbuild_define_links_target()
-
     get_property( langs GLOBAL PROPERTY ENABLED_LANGUAGES )
 
-    message( STATUS "---------------------------------------------------------" )
+    ecbuild_info( "---------------------------------------------------------" )
     if( NOT ${DEVELOPER_MODE} )
-      message( STATUS "Build summary" )
+      ecbuild_info( "Build summary" )
     else()
-      message( STATUS "Build summary -- ( DEVELOPER_MODE )" )
+      ecbuild_info( "Build summary -- ( DEVELOPER_MODE )" )
     endif()
-    message( STATUS "---------------------------------------------------------" )
+    ecbuild_info( "---------------------------------------------------------" )
 
-    message( STATUS "system : [${BUILD_SITE}] [${CMAKE_SYSTEM}] [${EC_OS_NAME}.${EC_OS_BITS}]" )
-    message( STATUS "processor        : [${CMAKE_SYSTEM_PROCESSOR}]" )
+    ecbuild_info( "system : [${BUILD_SITE}] [${CMAKE_SYSTEM}] [${EC_OS_NAME}.${EC_OS_BITS}]" )
+    ecbuild_info( "processor        : [${CMAKE_SYSTEM_PROCESSOR}]" )
     if( EC_BIG_ENDIAN )
-      message( STATUS "endiness         : Big Endian -- IEEE [${IEEE_BE}]" )
+      ecbuild_info( "endiness         : Big Endian -- IEEE [${IEEE_BE}]" )
     endif()
     if( EC_LITTLE_ENDIAN )
-      message( STATUS "endiness         : Little Endian -- IEEE [${IEEE_LE}]" )
+      ecbuild_info( "endiness         : Little Endian -- IEEE [${IEEE_LE}]" )
     endif()
-    message( STATUS "build type       : [${CMAKE_BUILD_TYPE}]" )
-    message( STATUS "timestamp        : [${EC_BUILD_TIMESTAMP}]" )
-    message( STATUS "install prefix   : [${CMAKE_INSTALL_PREFIX}]" )
+    ecbuild_info( "build type       : [${CMAKE_BUILD_TYPE}]" )
+    ecbuild_info( "timestamp        : [${EC_BUILD_TIMESTAMP}]" )
+    ecbuild_info( "install prefix   : [${CMAKE_INSTALL_PREFIX}]" )
+    ecbuild_info( "  bin dir        : [${${PNAME}_FULL_INSTALL_BIN_DIR}]" )
+    ecbuild_info( "  lib dir        : [${${PNAME}_FULL_INSTALL_LIB_DIR}]" )
+    ecbuild_info( "  include dir    : [${${PNAME}_FULL_INSTALL_INCLUDE_DIR}]" )
+    ecbuild_info( "  data dir       : [${${PNAME}_FULL_INSTALL_DATA_DIR}]" )
+    ecbuild_info( "  cmake dir      : [${${PNAME}_FULL_INSTALL_CMAKE_DIR}]" )
     if( EC_LINK_DIR )
-      message( STATUS "links prefix     : [${EC_LINK_DIR}]" )
+      ecbuild_info( "links prefix     : [${EC_LINK_DIR}]" )
     endif()
-    message( STATUS "---------------------------------------------------------" )
+    ecbuild_info( "---------------------------------------------------------" )
 
     foreach( lang ${langs} )
-      message( STATUS "${lang} -- ${CMAKE_${lang}_COMPILER_ID} ${CMAKE_${lang}_COMPILER_VERSION}"  )
-      message( STATUS "    compiler   : ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_FLAGS} ${CMAKE_${lang}_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}" )
-      message( STATUS "    link flags : ${CMAKE_${lang}_LINK_FLAGS}" )
+      ecbuild_info( "${lang} -- ${CMAKE_${lang}_COMPILER_ID} ${CMAKE_${lang}_COMPILER_VERSION}"  )
+      ecbuild_info( "    compiler   : ${CMAKE_${lang}_COMPILER}" )
+      ecbuild_info( "    flags      : ${CMAKE_${lang}_FLAGS} ${CMAKE_${lang}_FLAGS_${CMAKE_BUILD_TYPE_CAPS}} ${${PNAME}_${lang}_FLAGS} ${${PNAME}_${lang}_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}" )
+      ecbuild_info( "    link flags : ${CMAKE_${lang}_LINK_FLAGS}" )
     endforeach()
 
-    message( STATUS "linker : ${CMAKE_LINKER}")
-    message( STATUS "ar     : ${CMAKE_AR}")
-    message( STATUS "ranlib : ${CMAKE_RANLIB}")
-    message( STATUS "link flags" )
-    message( STATUS "    executable [${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}]" )
-    message( STATUS "    shared lib [${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}]" )
-    message( STATUS "    static lib [${CMAKE_MODULE_LINKER_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}]" )
-    message( STATUS "install rpath  : ${CMAKE_INSTALL_RPATH}" )
+    ecbuild_info( "linker : ${CMAKE_LINKER}")
+    ecbuild_info( "ar     : ${CMAKE_AR}")
+    ecbuild_info( "ranlib : ${CMAKE_RANLIB}")
+    ecbuild_info( "link flags" )
+    ecbuild_info( "    executable [${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}]" )
+    ecbuild_info( "    shared lib [${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}]" )
+    ecbuild_info( "    static lib [${CMAKE_MODULE_LINKER_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}]" )
+    ecbuild_info( "install rpath  : ${CMAKE_INSTALL_RPATH}" )
 
     get_directory_property( defs COMPILE_DEFINITIONS )
 
-    message( STATUS "common definitions: ${defs}" )
+    ecbuild_info( "common definitions: ${defs}" )
 
-    message( STATUS "---------------------------------------------------------" )
+    ecbuild_info( "---------------------------------------------------------" )
 
     ### FEATURE SUMMARY
 
-    # debug_var( CMAKE_VERSION )
+    # ecbuild_debug_var( CMAKE_VERSION )
     if( ${CMAKE_VERSION} VERSION_LESS "2.8.6" )
       feature_summary( WHAT ALL )
     else()
@@ -101,6 +105,6 @@ macro( ecbuild_print_summary )
     # issue warnings / errors in case there are unused project files
     ecbuild_warn_unused_files()
 
-  endif( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
+  endif()
 
 endmacro( ecbuild_print_summary )
diff --git a/cmake/ecbuild_project_files.cmake b/cmake/ecbuild_project_files.cmake
index fbf3015..3e4b3d2 100644
--- a/cmake/ecbuild_project_files.cmake
+++ b/cmake/ecbuild_project_files.cmake
@@ -1,8 +1,8 @@
-# (C) Copyright 1996-2015 ECMWF.
-# 
+# (C) Copyright 1996-2016 ECMWF.
+#
 # This software is licensed under the terms of the Apache Licence Version 2.0
-# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 
-# In applying this licence, ECMWF does not waive the privileges and immunities 
+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+# In applying this licence, ECMWF does not waive the privileges and immunities
 # granted to it by virtue of its status as an intergovernmental organisation nor
 # does it submit to any jurisdiction.
 
@@ -50,7 +50,7 @@ macro( ecbuild_declare_project_files )
   if( CHECK_UNUSED_FILES )
     foreach( _afile ${ARGV} )
 
-      # debug_var( _afile )
+      # ecbuild_debug_var( _afile )
 
       get_property( _src_gen SOURCE ${_afile} PROPERTY GENERATED )
 
@@ -62,7 +62,7 @@ macro( ecbuild_declare_project_files )
         if( EXISTS ${_abspath} )
             list( REMOVE_ITEM EC_UNUSED_FILES ${_abspath} )
         else()
-        message( FATAL_ERROR "In directory ${CMAKE_CURRENT_SOURCE_DIR} file ${_afile} was declared in CMakeLists.txt but not found" )
+        ecbuild_critical( "In directory ${CMAKE_CURRENT_SOURCE_DIR} file ${_afile} was declared in CMakeLists.txt but not found" )
         endif()
       endif()
 
diff --git a/cmake/ecbuild_remove_fortran_flags.cmake b/cmake/ecbuild_remove_fortran_flags.cmake
new file mode 100644
index 0000000..3a80316
--- /dev/null
+++ b/cmake/ecbuild_remove_fortran_flags.cmake
@@ -0,0 +1,60 @@
+# (C) Copyright 1996-2016 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.
+
+##############################################################################
+#.rst:
+#
+# ecbuild_remove_fortran_flags
+# ============================
+#
+# Remove Fortran compiler flags from ``CMAKE_Fortran_FLAGS``. ::
+#
+#   ecbuild_remove_fortran_flags( <flag1> [ <flag2> ... ] [ BUILD <build> ] )
+#
+# Options
+# -------
+#
+# BUILD : optional
+#   remove flags from ``CMAKE_Fortran_FLAGS_<build>`` instead of
+#   ``CMAKE_Fortran_FLAGS``
+#
+##############################################################################
+
+include( CheckFortranCompilerFlag )
+macro( ecbuild_remove_fortran_flags m_flags )
+
+  set( _flags ${m_flags} )
+  if( _flags AND CMAKE_Fortran_COMPILER_LOADED )
+
+    set( single_value_args BUILD )
+    set( multi_value_args )
+    cmake_parse_arguments( _PAR "" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
+
+    string( TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_CAPS )
+    string( TOUPPER ${_PAR_BUILD} _PAR_BUILD_CAPS )
+
+    if( _PAR_BUILD AND (CMAKE_BUILD_TYPE_CAPS MATCHES "${_PAR_BUILD_CAPS}") )
+
+      foreach( _flag ${_flags} )
+        string(REGEX REPLACE " *${_flag} *" " " CMAKE_Fortran_FLAGS_${_PAR_BUILD} ${CMAKE_Fortran_FLAGS_${_PAR_BUILD}})
+        ecbuild_debug( "Fortran FLAG [${_flag}] removed from build type ${_PAR_BUILD}" )
+      endforeach()
+
+    elseif( NOT _PAR_BUILD )
+
+      foreach( _flag ${_flags} )
+        string(REGEX REPLACE " *${_flag} *" " " CMAKE_Fortran_FLAGS ${CMAKE_Fortran_FLAGS} )
+        ecbuild_debug( "Fortran FLAG [${_flag}] removed" )
+      endforeach()
+
+    endif()
+
+  endif()
+  unset( _flags )
+
+endmacro()
diff --git a/cmake/ecbuild_requires_macro_version.cmake b/cmake/ecbuild_requires_macro_version.cmake
index ef13d64..1603446 100644
--- a/cmake/ecbuild_requires_macro_version.cmake
+++ b/cmake/ecbuild_requires_macro_version.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -21,7 +21,7 @@
 macro( ecbuild_requires_macro_version req_vrs )
 
 	if( ECBUILD_MACRO_VERSION VERSION_LESS ${req_vrs} )
-		message( FATAL_ERROR "${PROJECT_NAME} needs ecbuild macro version >= ${req_vrs}" )
+		ecbuild_critical( "${PROJECT_NAME} needs ecbuild macro version >= ${req_vrs}" )
 	endif()
 
 endmacro()
diff --git a/cmake/ecbuild_separate_sources.cmake b/cmake/ecbuild_separate_sources.cmake
index 55c6d8f..00722ae 100644
--- a/cmake/ecbuild_separate_sources.cmake
+++ b/cmake/ecbuild_separate_sources.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -32,10 +32,11 @@
 # If any file of the following group of extensions is present in the list of
 # sources, the corresponding CMake variable is set:
 #
-# :<target>_h_srcs:   list of sources with extension .h, .hxx, .hh, .hpp, .H
-# :<target>_c_srcs:   list of sources with extension .c
-# :<target>_cxx_srcs: list of sources with extension .cc, .cxx, .cpp, .C
-# :<target>_f_srcs:   list of sources with extension .f, .F, .for, f77, .f90, .f95
+# :<target>_h_srcs:       source files with extension .h, .hxx, .hh, .hpp, .H
+# :<target>_c_srcs:       source files with extension .c
+# :<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
 #
 ##############################################################################
 
@@ -48,44 +49,45 @@ macro( ecbuild_separate_sources )
 	cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
 	if(_PAR_UNPARSED_ARGUMENTS)
-	  message(FATAL_ERROR "Unknown keywords given to ecbuild_separate_sources(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
+	  ecbuild_critical("Unknown keywords given to ecbuild_separate_sources(): \"${_PAR_UNPARSED_ARGUMENTS}\"")
 	endif()
 
 	if( NOT _PAR_TARGET  )
-	  message(FATAL_ERROR "The call to ecbuild_separate_sources() doesn't specify the TARGET.")
+	  ecbuild_critical("The call to ecbuild_separate_sources() doesn't specify the TARGET.")
 	endif()
 
 	if( NOT _PAR_SOURCES )
-	  message(FATAL_ERROR "The call to ecbuild_separate_sources() doesn't specify the SOURCES.")
+	  ecbuild_critical("The call to ecbuild_separate_sources() doesn't specify the SOURCES.")
 	endif()
 
 	foreach( src ${_PAR_SOURCES} )
-		if(${src} MATCHES "(\\.h|\\.hxx|\\.hh|\\.hpp|\\.H)")
+		if(${src} MATCHES "(\\.h$|\\.hxx$|\\.hh$|\\.hpp$|\\.H$)")
 			list( APPEND ${_PAR_TARGET}_h_srcs ${src} )
 		endif()
 	endforeach()
 
 	foreach( src ${_PAR_SOURCES} )
-		if(${src} MATCHES "(\\.c)")
+		if(${src} MATCHES "(\\.c$)")
 			list( APPEND ${_PAR_TARGET}_c_srcs ${src} )
 		endif()
 	endforeach()
 
 	foreach( src ${_PAR_SOURCES} )
-		if(${src} MATCHES "(\\.cc|\\.cxx|\\.cpp|\\.C)")
+		if(${src} MATCHES "(\\.cc$|\\.cxx$|\\.cpp$|\\.C$)")
 			list( APPEND ${_PAR_TARGET}_cxx_srcs ${src} )
 		endif()
 	endforeach()
 
 	foreach( src ${_PAR_SOURCES} )
-		if(${src} MATCHES "(\\.f|\\.F|\\.for|\\.f77|\\.f90|\\.f95)")
-			list( APPEND ${_PAR_TARGET}_f_srcs ${src} )
+		if(${src} MATCHES "(\\.f$|\\.F$|\\.for$|\\.f77$|\\.f90$|\\.f95$|\\.f03$|\\.f08$|\\.F77$|\\.F90$|\\.F95$|\\.F03$|\\.F08$)")
+			list( APPEND ${_PAR_TARGET}_fortran_srcs ${src} )
 		endif()
 	endforeach()
+	set_source_files_properties( ${${_PAR_TARGET}_fortran_srcs} PROPERTIES LANGUAGE Fortran )
 
-#    debug_var( ${_PAR_TARGET}_h_srcs )
-#    debug_var( ${_PAR_TARGET}_c_srcs )
-#    debug_var( ${_PAR_TARGET}_cxx_srcs )
-#    debug_var( ${_PAR_TARGET}_f_srcs )
+#    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 )
 
-endmacro( ecbuild_separate_sources  )
+endmacro( ecbuild_separate_sources )
diff --git a/cmake/ecbuild_setup_test_framework.cmake b/cmake/ecbuild_setup_test_framework.cmake
index 538a433..c14b2f9 100644
--- a/cmake/ecbuild_setup_test_framework.cmake
+++ b/cmake/ecbuild_setup_test_framework.cmake
@@ -2,7 +2,7 @@ ecbuild_add_option( FEATURE TESTS
                     DEFAULT ON
                     DESCRIPTION "Enable the unit tests" )
 
-if( ENABLE_TESTS )
+if( ENABLE_TESTS AND CMAKE_CXX_COMPILER_LOADED )
 
   # Try to find compiled boost
 
@@ -23,11 +23,11 @@ if( ENABLE_TESTS )
     set( HAVE_BOOST_UNIT_TEST 1 )
     set( BOOST_UNIT_TEST_FRAMEWORK_LINKED 1 )
 
-    message( STATUS "Using Boost for unit tests:\n    INC [${Boost_INCLUDE_DIRS}]\n    LIB [${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}]" )
+    ecbuild_info( "Using Boost for unit tests:\n    INC [${Boost_INCLUDE_DIRS}]\n    LIB [${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}]" )
 
   else()
 
-    message( STATUS "Boost unit test framework -- NOT FOUND" )
+    ecbuild_info( "Boost unit test framework -- NOT FOUND" )
 
     set( HAVE_BOOST_UNIT_TEST 0 )
 
@@ -39,3 +39,7 @@ if( ENABLE_TESTS )
   endif()
 
 endif()
+
+if( NOT ENABLE_TESTS )
+  ecbuild_info("Tests have been disabled")
+endif()
diff --git a/cmake/ecbuild_source_flags.cmake b/cmake/ecbuild_source_flags.cmake
new file mode 100644
index 0000000..a281f1d
--- /dev/null
+++ b/cmake/ecbuild_source_flags.cmake
@@ -0,0 +1,34 @@
+# (C) Copyright 1996-2016 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.
+
+set( __gen_source_flags ${CMAKE_CURRENT_LIST_DIR}/gen_source_flags.py )
+
+# Calls gen_source_flags.py to generate a CMake file with the per
+# source file flags for a given target.
+function( ecbuild_source_flags OUT TARGET DEFAULT_FLAGS SOURCES )
+
+  if( NOT PYTHONINTERP_FOUND OR PYTHON_VERSION VERSION_LESS 2.7 )
+    find_package( PythonInterp 2.7 REQUIRED )
+  endif()
+
+  set( OUTFILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_source_flags.cmake )
+
+  if( ECBUILD_LOG_LEVEL LESS 11)
+    set( __debug "--debug" )
+  endif()
+  execute_process( COMMAND ${PYTHON_EXECUTABLE} ${__gen_source_flags}
+                           ${ECBUILD_SOURCE_FLAGS} ${OUTFILE} "${DEFAULT_FLAGS}"
+                           ${SOURCES} "${__debug}"
+                   RESULT_VARIABLE __res )
+
+  if( __res GREATER 0 )
+    ecbuild_error( "ecbuild_source_flags: failed generating source flags for target ${TARGET} from ${ECBUILD_SOURCE_FLAGS}" )
+  endif()
+  set( ${OUT} ${OUTFILE} PARENT_SCOPE )
+
+endfunction()
diff --git a/cmake/ecbuild_system.cmake b/cmake/ecbuild_system.cmake
index ca4f4fa..f02113e 100644
--- a/cmake/ecbuild_system.cmake
+++ b/cmake/ecbuild_system.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -28,7 +28,7 @@ endif()
 ########################################################################################################
 # ecbuild versioning support
 
-set( ECBUILD_CMAKE_MINIMUM "2.8.4" )
+set( ECBUILD_CMAKE_MINIMUM "2.8.10" )
 if( ${CMAKE_VERSION} VERSION_LESS ${ECBUILD_CMAKE_MINIMUM} )
     message(FATAL_ERROR "${PROJECT_NAME} requires at least CMake ${ECBUILD_CMAKE_MINIMUM} -- you are using ${CMAKE_COMMAND} [${CMAKE_VERSION}]\n Please, get a newer version of CMake @ www.cmake.org" )
 endif()
@@ -59,16 +59,23 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
 
     set( ECBUILD_PROJECTS  "" CACHE INTERNAL "list of ecbuild (sub)projects that use ecbuild" )
 
-    message( STATUS "ecbuild   ${ecbuild_VERSION_STR}\t${ECBUILD_MACROS_DIR}" )
-    message( STATUS "cmake     ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}\t${CMAKE_COMMAND}" )
+    # Include log macros since these are used right away
+    include( ecbuild_log )
+
+    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}" )
 
     if( CMAKE_TOOLCHAIN_FILE )
-    message( STATUS "toolchain ${CMAKE_TOOLCHAIN_FILE}" )
+      ecbuild_info( "toolchain ${CMAKE_TOOLCHAIN_FILE}" )
+    endif()
+
+    if( ECBUILD_CONFIG )
+      ecbuild_info( "config    ${ECBUILD_CONFIG}" )
     endif()
 
     if( ECBUILD_CACHE )
-    include( ${ECBUILD_CACHE} )
-      message( STATUS "cache     ${ECBUILD_CACHE}" )
+      include( ${ECBUILD_CACHE} )
+      ecbuild_info( "cache     ${ECBUILD_CACHE}" )
     endif()
 
     message( STATUS "---------------------------------------------------------" )
@@ -93,7 +100,7 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
     enable_testing()
 
     # keep this until we modify the meaning to 'check' if installation worked
-    add_custom_target( check COMMAND ${CMAKE_CTEST_COMMAND} -V )
+    add_custom_target( check COMMAND ${CMAKE_CTEST_COMMAND} )
 
     ############################################################################################
     # define valid build types
@@ -121,19 +128,19 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
     # include(CMakePrintSystemInformation) # available in cmake 2.8.4
 
     if( CMAKE_CXX_COMPILER_LOADED )
-    include(CheckIncludeFileCXX)
-    include(CheckCXXCompilerFlag)
-    include(CheckCXXSourceCompiles)
-    include(CheckCXXSourceRuns)
+        include(CheckIncludeFileCXX)
+        include(CheckCXXCompilerFlag)
+        include(CheckCXXSourceCompiles)
+        include(CheckCXXSourceRuns)
     endif()
 
     if( CMAKE_Fortran_COMPILER_LOADED )
         set( CMAKE_Fortran_MODULE_DIRECTORY  ${CMAKE_BINARY_DIR}/module CACHE PATH "directory for all fortran modules." )
-    include(CheckFortranFunctionExists)
-    if( CMAKE_C_COMPILER_LOADED AND ENABLE_FORTRAN_C_INTERFACE )
-    include(FortranCInterface)
-    endif()
-    set( EC_HAVE_FORTRAN 1 )
+        include(CheckFortranFunctionExists)
+        if( CMAKE_C_COMPILER_LOADED AND ENABLE_FORTRAN_C_INTERFACE )
+            include(FortranCInterface)
+        endif()
+        set( EC_HAVE_FORTRAN 1 )
     endif()
 
     include(FeatureSummary) # support features in cmake
@@ -144,17 +151,17 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
     # backport of cmake > 2.8.4 functions
 
     if( "${CMAKE_VERSION}" VERSION_LESS "2.8.6" )
-    include( ${CMAKE_CURRENT_LIST_DIR}/2.8/CMakePushCheckState.cmake )
+        include( ${CMAKE_CURRENT_LIST_DIR}/2.8/CMakePushCheckState.cmake )
     else()
-    include(CMakePushCheckState)
+        include(CMakePushCheckState)
     endif()
 
     ############################################################################################
     # add our macros
 
-    include( ecbuild_debug_var )
-    include( ecbuild_log )
     include( ecbuild_list_macros )
+    include( ecbuild_list_add_pattern )
+    include( ecbuild_list_exclude_pattern )
 
     include( ecbuild_check_c_source_return )
     include( ecbuild_check_cxx_source_return )
@@ -167,6 +174,7 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
     include( ecbuild_generate_config_headers )
     include( ecbuild_generate_rpc )
     include( ecbuild_generate_yy )
+    include( ecbuild_generate_fortran_interfaces )
     include( ecbuild_echo_targets )
     include( ecbuild_features )
     include( ecbuild_add_option )
@@ -179,6 +187,7 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
     include( ecbuild_add_cxx_flags )
     include( ecbuild_add_cxx11_flags )
     include( ecbuild_get_cxx11_flags )
+    include( ecbuild_check_fortran )
     include( ecbuild_add_fortran_flags )
     include( ecbuild_add_test )
     include( ecbuild_add_resources )
@@ -202,30 +211,39 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
     include( ecbuild_find_fortranlibs )
     include( ecbuild_git )
     include( ecbuild_enable_fortran )
+    include( ecbuild_source_flags )
+    include( ecbuild_target_flags )
     include( ecbuild_bundle )
     include( ecbuild_pkgconfig )
     include( ecbuild_cache )
+    include( ecbuild_remove_fortran_flags )
 
     include( ${CMAKE_CURRENT_LIST_DIR}/contrib/GetGitRevisionDescription.cmake )
 
     ############################################################################################
     # kickstart the build system
 
-      ecbuild_prepare_cache()
+    if( ECBUILD_CONFIG )
+      include( ${ECBUILD_CONFIG} )
+    endif()
+
+    ecbuild_prepare_cache()
 
     include( ecbuild_define_options )               # define build options
+    include( ecbuild_compiler_flags )               # compiler flags
     include( ecbuild_check_compiler )               # check for compiler characteristics
     include( ecbuild_check_os )                     # check for os characteristics
     include( ecbuild_check_functions )              # check for available functions
-    include( ecbuild_define_paths )                 # define installation paths
-    include( ecbuild_links_target )                 # define the links target
+    include( ecbuild_define_paths )                 # defines installation paths
+    include( ecbuild_define_libs_and_execs_target ) # defines the top level execs and libs
+    include( ecbuild_define_links_target )          # defines the links target
     include( ecbuild_setup_test_framework )         # setup test framework
     include( ecbuild_define_uninstall )             # define uninstall target
 
     ecbuild_flush_cache()
 
     ############################################################################################
-    # define the build timestamp
+    # define the build timestamp, unless the user provided one via EC_BUILD_TIMESTAMP
 
     if( NOT DEFINED EC_BUILD_TIMESTAMP )
         ecbuild_get_timestamp( EC_BUILD_TIMESTAMP )
@@ -234,5 +252,17 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
 
     message( STATUS "---------------------------------------------------------" )
 
-endif()
+else()
 
+    # Allow subprojects with different compilation flags. This could be done by defining
+    #     set( ECBUILD_C_FLAGS_DEBUG "-O0" )
+    # or
+    #     set( ECBUILD_CONFIG "<subproject-config>.cmake" )
+    if( ECBUILD_CONFIG )
+        message( STATUS "---------------------------------------------------------" )
+        ecbuild_info( "config    ${ECBUILD_CONFIG}" )
+        include( ${ECBUILD_CONFIG} )
+    endif()
+    include( ecbuild_compiler_flags )
+
+endif()
diff --git a/cmake/ecbuild_target_flags.cmake b/cmake/ecbuild_target_flags.cmake
new file mode 100644
index 0000000..4c589af
--- /dev/null
+++ b/cmake/ecbuild_target_flags.cmake
@@ -0,0 +1,91 @@
+# (C) Copyright 1996-2016 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.
+
+##############################################################################
+#.rst:
+#
+# ecbuild_target_flags
+# ====================
+#
+# Override compiler flags for a given target. ::
+#
+#   ecbuild_target_flags( <target> <c_flags> <cxx_flags> <fortran_flags> )
+#
+# Required arguments:
+#
+# :target:        Target name
+# :c_flags:       Target specific C flags (can be empty)
+# :cxx_flags:     Target specific CXX flags (can be empty)
+# :fortran_flags: Target specific Fortran flags (can be empty)
+#
+# There are 3 cases, only the first applicable case takes effect:
+#
+# 1.  Use custom rules from user specified ``ECBUILD_COMPILE_FLAGS`` file and
+#     append target specific flags.
+#
+# 2.  Use JSON rules from user specified ``ECBUILD_SOURCE_FLAGS`` file and
+#     append target specific flags.
+#
+# 3.  Only the target specific flags are applied to all matching source files.
+#
+##############################################################################
+
+function( ecbuild_target_flags target c_flags cxx_flags fortran_flags )
+
+  get_property( languages GLOBAL PROPERTY ENABLED_LANGUAGES )
+
+  foreach( lang ${languages} )
+
+    string( TOLOWER ${lang} l )
+
+    if( ${target}_${l}_srcs )
+
+      # 1) Override compile flags from user specified CMake file
+      if( ECBUILD_COMPILE_FLAGS )
+
+        # Project specific flags for current language and optionally build type
+        set( pflags "${${PNAME}_${lang}_FLAGS} ${${PNAME}_${lang}_FLAGS_${CMAKE_BUILD_TYPE_CAPS}}" )
+
+        foreach( src ${${target}_${l}_srcs} )
+          get_property( oflags SOURCE ${src} PROPERTY OVERRIDE_COMPILE_FLAGS )
+          get_property( oflags_btype SOURCE ${src} PROPERTY OVERRIDE_COMPILE_FLAGS_${CMAKE_BUILD_TYPE_CAPS} )
+          # Override compile flags for source file?
+          if( oflags OR oflags_btype )
+            set_source_files_properties( ${src} PROPERTIES COMPILE_FLAGS "${oflags} ${oflags_btype}" )
+            ecbuild_debug( "ecbuild_target_flags(${target}): overriding flags for ${src} with '${oflags} ${oflags_btype}'" )
+          # Otherwise append source file specific flags to project specific and target specific flags
+          else()
+            get_property( flags SOURCE ${src} PROPERTY COMPILE_FLAGS )
+            get_property( flags_btype SOURCE ${src} PROPERTY COMPILE_FLAGS_${CMAKE_BUILD_TYPE_CAPS} )
+            set_source_files_properties( ${src} PROPERTIES COMPILE_FLAGS "${pflags} ${${l}_flags} ${flags} ${flags_btype}" )
+            ecbuild_debug( "ecbuild_target_flags(${target}): setting flags for ${src} to '${pflags} ${${l}_flags} ${flags} ${flags_btype}'" )
+          endif()
+        endforeach()
+
+      # 2) Override compile flags from user specified JSON file
+      elseif( ECBUILD_SOURCE_FLAGS )
+        ecbuild_source_flags( ${target}_${lang}_SOURCE_FLAGS
+                              ${target}_${l}
+                              "${${l}_flags}"
+                              "${${target}_${l}_srcs}" )
+
+        ecbuild_debug("ecbuild_target_flags(${target}): setting source file ${lang} flags from ${${target}_${lang}_SOURCE_FLAGS}")
+        include( ${${target}_${lang}_SOURCE_FLAGS} )
+
+      # 3) Use target specific compile flags
+      elseif( ${l}_flags )
+
+        set_source_files_properties( ${${target}_${l}_srcs} PROPERTIES COMPILE_FLAGS "${${l}_flags}" )
+        ecbuild_debug("ecbuild_target_flags(${target}): setting flags for '${${target}_${l}_srcs}' to '${${l}_flags}'")
+
+      endif()
+    endif()
+
+  endforeach()
+
+endfunction()
diff --git a/cmake/ecbuild_use_package.cmake b/cmake/ecbuild_use_package.cmake
index acbe495..c88bca8 100644
--- a/cmake/ecbuild_use_package.cmake
+++ b/cmake/ecbuild_use_package.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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.
@@ -87,15 +87,15 @@ macro( ecbuild_use_package )
   cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}"  ${_FIRST_ARG} ${ARGN} )
 
   if(_p_UNPARSED_ARGUMENTS)
-    message(FATAL_ERROR "Unknown keywords given to ecbuild_use_package(): \"${_p_UNPARSED_ARGUMENTS}\"")
+    ecbuild_critical("Unknown keywords given to ecbuild_use_package(): \"${_p_UNPARSED_ARGUMENTS}\"")
   endif()
 
   if( NOT _p_PROJECT  )
-    message(FATAL_ERROR "The call to ecbuild_use_package() doesn't specify the PROJECT.")
+    ecbuild_critical("The call to ecbuild_use_package() doesn't specify the PROJECT.")
   endif()
 
   if( _p_EXACT AND NOT _p_VERSION )
-    message(FATAL_ERROR "Call to ecbuild_use_package() requests EXACT but doesn't specify VERSION.")
+    ecbuild_critical("Call to ecbuild_use_package() requests EXACT but doesn't specify VERSION.")
   endif()
 
   # try to find the package as a subproject and build it
@@ -105,6 +105,7 @@ macro( ecbuild_use_package )
   # user defined dir with subprojects
 
   if( NOT DEFINED ${pkgUPPER}_SOURCE AND DEFINED SUBPROJECT_DIRS )
+    ecbuild_warn("ecbuild_use_package(): setting SUBPROJECT_DIRS is deprecated")
     ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): scanning subproject directories ${SUBPROJECT_DIRS}")
     foreach( dir ${SUBPROJECT_DIRS} )
       if( EXISTS ${dir}/${_p_PROJECT} AND EXISTS ${dir}/${_p_PROJECT}/CMakeLists.txt )
@@ -119,7 +120,7 @@ macro( ecbuild_use_package )
   if( DEFINED ${pkgUPPER}_SOURCE )
 
     if( NOT EXISTS ${${pkgUPPER}_SOURCE} OR NOT EXISTS ${${pkgUPPER}_SOURCE}/CMakeLists.txt )
-      message( FATAL_ERROR "User defined source directory '${${pkgUPPER}_SOURCE}' for project '${_p_PROJECT}' does not exist or does not contain a CMakeLists.txt file." )
+      ecbuild_critical("User defined source directory '${${pkgUPPER}_SOURCE}' for project '${_p_PROJECT}' does not exist or does not contain a CMakeLists.txt file.")
     endif()
 
     set( ${pkgUPPER}_subproj_dir_ "${${pkgUPPER}_SOURCE}" )
@@ -176,6 +177,7 @@ macro( ecbuild_use_package )
       # add as a subproject
 
       set( ${pkgUPPER}_subproj_dir_ ${${pkgUPPER}_subproj_dir_} CACHE PATH "Path to ${_p_PROJECT} source directory" )
+      mark_as_advanced( ${pkgUPPER}_subproj_dir_ )
 
       set( ECBUILD_PROJECTS ${ECBUILD_PROJECTS} ${_p_PROJECT} CACHE INTERNAL "" )
 
@@ -187,6 +189,8 @@ macro( ecbuild_use_package )
       set( ${pkgUPPER}_FOUND 1 )
       set( ${_p_PROJECT}_VERSION ${${pkgUPPER}_VERSION} )
 
+      list( APPEND ${pkgUPPER}_INCLUDE_DIRS ${${pkgUPPER}_TPL_INCLUDE_DIRS} )
+
     endif()
 
   endif()
@@ -198,7 +202,7 @@ macro( ecbuild_use_package )
     ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): 2) project was already added as subproject, check version is acceptable")
 
     if( NOT ${pkgUPPER}_FOUND )
-      message( FATAL_ERROR "${_p_PROJECT} was already included as sub-project but ${pkgUPPER}_FOUND isn't set -- this is likely a BUG in ecbuild" )
+      ecbuild_critical( "${_p_PROJECT} was already included as sub-project but ${pkgUPPER}_FOUND isn't set -- this is likely a BUG in ecbuild" )
     endif()
 
     # check version is acceptable
@@ -221,26 +225,26 @@ macro( ecbuild_use_package )
 
   # test version for Cases 1,2,3
 
-  # debug_var( _p_PROJECT )
-  # debug_var( _p_VERSION )
-  # debug_var( ${pkgUPPER}_VERSION )
-  # debug_var( ${_p_PROJECT}_VERSION )
-  # debug_var( _just_added )
-  # debug_var( _do_version_check )
-  # debug_var( _source_description )
-  # debug_var( ${pkgUPPER}_FOUND )
-  # debug_var( ${pkgUPPER}_previous_subproj_ )
+  # ecbuild_debug_var( _p_PROJECT )
+  # ecbuild_debug_var( _p_VERSION )
+  # ecbuild_debug_var( ${pkgUPPER}_VERSION )
+  # ecbuild_debug_var( ${_p_PROJECT}_VERSION )
+  # ecbuild_debug_var( _just_added )
+  # ecbuild_debug_var( _do_version_check )
+  # ecbuild_debug_var( _source_description )
+  # ecbuild_debug_var( ${pkgUPPER}_FOUND )
+  # ecbuild_debug_var( ${pkgUPPER}_previous_subproj_ )
 
   if( _p_VERSION AND _do_version_check )
     if( _p_EXACT )
       if( NOT ${_p_PROJECT}_VERSION VERSION_EQUAL _p_VERSION )
-        message( FATAL_ERROR "${PROJECT_NAME} requires (exactly) ${_p_PROJECT} = ${_p_VERSION} -- detected as ${_source_description} ${${_p_PROJECT}_VERSION}" )
+        ecbuild_critical( "${PROJECT_NAME} requires (exactly) ${_p_PROJECT} = ${_p_VERSION} -- detected as ${_source_description} ${${_p_PROJECT}_VERSION}" )
       endif()
     else()
       if( _p_VERSION VERSION_LESS ${_p_PROJECT}_VERSION OR _p_VERSION VERSION_EQUAL ${_p_PROJECT}_VERSION )
-        message( STATUS "${PROJECT_NAME} requires ${_p_PROJECT} >= ${_p_VERSION} -- detected as ${_source_description} ${${_p_PROJECT}_VERSION}" )
+        ecbuild_info( "${PROJECT_NAME} requires ${_p_PROJECT} >= ${_p_VERSION} -- detected as ${_source_description} ${${_p_PROJECT}_VERSION}" )
       else()
-        message( FATAL_ERROR "${PROJECT_NAME} requires ${_p_PROJECT} >= ${_p_VERSION} -- detected only ${_source_description} ${${_p_PROJECT}_VERSION}" )
+        ecbuild_critical( "${PROJECT_NAME} requires ${_p_PROJECT} >= ${_p_VERSION} -- detected only ${_source_description} ${${_p_PROJECT}_VERSION}" )
       endif()
     endif()
   endif()
diff --git a/cmake/ecbuild_version.h.in b/cmake/ecbuild_version.h.in
index 3ed96ce..70c5f0a 100644
--- a/cmake/ecbuild_version.h.in
+++ b/cmake/ecbuild_version.h.in
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 1996-2015 ECMWF.
+ * (C) Copyright 1996-2016 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 084adb3..314a006 100644
--- a/cmake/ecbuild_warn_unused_files.cmake
+++ b/cmake/ecbuild_warn_unused_files.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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. 
@@ -48,24 +48,24 @@ macro( ecbuild_warn_unused_files )
           # if unused files where found, put the list on the file
           if( EC_UNUSED_FILES )
     
-            message( STATUS "")
-            message( STATUS " !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
-            message( STATUS " !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
-            message( STATUS "")
-            message( STATUS " Unused source files found:")
+            ecbuild_info("")
+            ecbuild_info(" !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
+            ecbuild_info(" !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
+            ecbuild_info("")
+            ecbuild_info(" Unused source files found:")
             foreach( AFILE ${EC_UNUSED_FILES} )
-              message( STATUS "     ${AFILE}")
+              ecbuild_info("     ${AFILE}")
               file( APPEND ${UNUSED_FILE} "${AFILE}\n" )
             endforeach()
-            message( STATUS "")
-            message( STATUS " List dumped to ${UNUSED_FILE}")
-            message( STATUS "")
-            message( STATUS " !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
-            message( STATUS " !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
-            message( STATUS "")
+            ecbuild_info("")
+            ecbuild_info(" List dumped to ${UNUSED_FILE}")
+            ecbuild_info("")
+            ecbuild_info(" !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
+            ecbuild_info(" !!!--- ${UNUSED_FILES_LEVEL} ---!!! ")
+            ecbuild_info("")
     
             if( UNUSED_FILES_LEVEL STREQUAL "ERROR" )
-                message( FATAL_ERROR "\n Aborted build system configuration. \n Add unused files to the build system or remove them." )
+              ecbuild_critical( "\n Aborted build system configuration. \n Add unused files to the build system or remove them." )
             endif()
     
           endif()
diff --git a/cmake/fcm-make-interfaces.cfg b/cmake/fcm-make-interfaces.cfg
new file mode 100644
index 0000000..a73363a
--- /dev/null
+++ b/cmake/fcm-make-interfaces.cfg
@@ -0,0 +1,31 @@
+# FCM configuration file used to auto-generate interface files
+# for F77 and F90 files.
+# Interface files will have the extention ".intfb.h"
+# Results will be in a directory "interfaces/include" relative to cwd
+
+# Usage: fcm make --config-file=<path -to-this-file> \
+#                 interfaces.ns-incl="<space-sep-list-of-dirs>"
+
+$SRC{?}  = $HERE
+
+step.class[interfaces] = build
+steps  = interfaces
+
+interfaces.target{task}     = ext-iface
+interfaces.target{category} = include
+
+interfaces.source = $SRC
+
+# Exclude all
+interfaces.ns-excl = /
+
+# Include some
+# interfaces.ns-incl = <list of dirs passed at command-line>
+
+# Extention of interface files
+interfaces.prop{file-ext.f90-interface} = .intfb.h
+
+# Do not follow includes
+interfaces.prop{no-dep.f.module} = *
+interfaces.prop{no-dep.include} = *
+
diff --git a/cmake/fortran_features/CheckFortranFeatures.cmake b/cmake/fortran_features/CheckFortranFeatures.cmake
new file mode 100644
index 0000000..992964f
--- /dev/null
+++ b/cmake/fortran_features/CheckFortranFeatures.cmake
@@ -0,0 +1,167 @@
+###############################################################################
+# checks
+set(Fortran_FEATURE_CHECK_DIR ${CMAKE_CURRENT_LIST_DIR} CACHE INTERNAL "fortran file directory")
+
+MACRO(fortran_check_single_feature FEATURE_NAME FEATURE_NUMBER RESULT_VAR)
+  IF (NOT DEFINED ${RESULT_VAR})
+    SET(_bindir "${CMAKE_BINARY_DIR}/fortran_feature_tests/fortran_${FEATURE_NAME}")
+
+    IF (${FEATURE_NUMBER})
+      SET(_SRCFILE_BASE ${Fortran_FEATURE_CHECK_DIR}/${FEATURE_NAME}-N${FEATURE_NUMBER})
+      SET(_LOG_NAME "\"${FEATURE_NAME}\" (N${FEATURE_NUMBER})")
+    ELSE (${FEATURE_NUMBER})
+      SET(_SRCFILE_BASE ${Fortran_FEATURE_CHECK_DIR}/${FEATURE_NAME})
+      SET(_LOG_NAME "\"${FEATURE_NAME}\"")
+    ENDIF (${FEATURE_NUMBER})
+    ecbuild_info("Checking Fortran support for ${_LOG_NAME}")
+
+    SET(_SRCFILE "${_SRCFILE_BASE}.F90")
+    SET(_SRCFILE_FAIL "${_SRCFILE_BASE}_fail.F90")
+    SET(_SRCFILE_FAIL_COMPILE "${_SRCFILE_BASE}_fail_compile.F90")
+
+    IF (CROSS_COMPILING)
+      try_compile(${RESULT_VAR} "${_bindir}" "${_SRCFILE}")
+      IF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
+        try_compile(${RESULT_VAR} "${_bindir}_fail" "${_SRCFILE_FAIL}")
+      ENDIF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
+    ELSE (CROSS_COMPILING)
+      try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR
+          "${_bindir}" "${_SRCFILE}")
+      IF (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR)
+        SET(${RESULT_VAR} TRUE)
+      ELSE (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR)
+        SET(${RESULT_VAR} FALSE)
+      ENDIF (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR)
+      IF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
+        try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR
+            "${_bindir}_fail" "${_SRCFILE_FAIL}")
+        IF (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR)
+          SET(${RESULT_VAR} TRUE)
+        ELSE (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR)
+          SET(${RESULT_VAR} FALSE)
+        ENDIF (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR)
+      ENDIF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
+    ENDIF (CROSS_COMPILING)
+    IF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE})
+      try_compile(_TMP_RESULT "${_bindir}_fail_compile" "${_SRCFILE_FAIL_COMPILE}")
+      IF (_TMP_RESULT)
+        SET(${RESULT_VAR} FALSE)
+      ELSE (_TMP_RESULT)
+        SET(${RESULT_VAR} TRUE)
+      ENDIF (_TMP_RESULT)
+    ENDIF (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE})
+
+    IF (${RESULT_VAR})
+      ecbuild_info("Checking Fortran support for ${_LOG_NAME} -- works")
+    ELSE (${RESULT_VAR})
+      ecbuild_info("Checking Fortran support for ${_LOG_NAME} -- not supported")
+    ENDIF (${RESULT_VAR})
+    SET(${RESULT_VAR} ${${RESULT_VAR}} CACHE INTERNAL "Fortran support for ${_LOG_NAME}")
+  ENDIF (NOT DEFINED ${RESULT_VAR})
+ENDMACRO(fortran_check_single_feature)
+
+# Find list of all features
+function(fortran_find_all_features outvar)
+  FILE(GLOB ALL_Fortran_FEATURE_FILES "${Fortran_FEATURE_CHECK_DIR}/*.F90")
+  set(OUTPUT_VARIABLES)
+  foreach(filename ${ALL_Fortran_FEATURE_FILES})
+    get_filename_component(filename ${filename} NAME_WE)
+    string(REGEX REPLACE "_fail_compile" "" filename "${filename}")
+    string(REGEX REPLACE "_fail" "" filename "${filename}")
+    string(REGEX REPLACE "-N[0-9]*" "" filename "${filename}")
+    set(OUTPUT_VARIABLES ${OUTPUT_VARIABLES} ${filename})
+  endforeach()
+  list(REMOVE_DUPLICATES OUTPUT_VARIABLES)
+  set(${outvar} ${OUTPUT_VARIABLES} PARENT_SCOPE)
+endfunction()
+
+# Parses input and separates into arguments before REQUIRED and after REQUIRED.
+# Arguments before REQUIRED are OPTIONALS.
+# Arguments after REQUIRED are REQUIRED.
+# If no arguments, then sets output OPTIONALS to ALLFEATURES.
+function(parse_input_features ALLFEATURES OPTIONALS REQUIRED ERRORS)
+
+  if("${ARGN}" STREQUAL "")
+    set(${OPTIONALS} ${ALLFEATURES} PARENT_SCOPE)
+    set(${REQUIRED} "" PARENT_SCOPE)
+  else()
+    set(REQUIRED_FEATURES)
+    set(OPTIONAL_FEATURES)
+    set(UNKNOWN_FEATURES)
+    set(result_type OPTIONAL_FEATURES)
+    foreach(feature ${ARGN})
+      if(${feature} STREQUAL "REQUIRED")
+        set(result_type REQUIRED_FEATURES)
+      else()
+        list(FIND ALLFEATURES ${feature} feature_was_found)
+
+        if(feature_was_found EQUAL -1)
+          list(APPEND UNKNOWN_FEATURES ${feature})
+        else()
+          list(APPEND ${result_type} ${feature})
+        endif()
+
+      endif(${feature} STREQUAL "REQUIRED")
+    endforeach()
+
+    set(${OPTIONALS} ${OPTIONAL_FEATURES} PARENT_SCOPE)
+    set(${REQUIRED} ${REQUIRED_FEATURES} PARENT_SCOPE)
+    set(${ERRORS} ${UNKNOWN_FEATURES} PARENT_SCOPE)
+  endif("${ARGN}" STREQUAL "")
+endfunction(parse_input_features)
+
+# Figures out name and number of feature
+# then calls macro that does the work
+macro(_figure_out_fortran_feature current_feature)
+  # Find set of files that match current_feature, excepting _fail and _fail_compile.
+  file(GLOB ALL_FEATURE_FILES "${Fortran_FEATURE_CHECK_DIR}/${current_feature}*.F90")
+  foreach(filename ${ALL_FEATURE_FILES})
+    if(filename MATCHES "_fail")
+      list(REMOVE_ITEM ALL_FEATURE_FILES ${filename})
+    endif()
+  endforeach()
+
+  list(LENGTH ALL_FEATURE_FILES NFILES)
+  if(NOT ${NFILES} EQUAL 1)
+    ecbuild_critical("[Fortran] Expected to find only one feature. Found ${NFILES} -- ${ALL_FEATURE_FILES}.")
+  endif(NOT ${NFILES} EQUAL 1)
+
+  # Now we know which file corresponds to option.
+  get_filename_component(basename ${ALL_FEATURE_FILES} NAME_WE)
+  # If has feature number, extract it
+  set(number "")
+  if(basename MATCHES "-N[0-9]*$")
+    string(REGEX REPLACE "${current_feature}-N" "" number "${basename}")
+  endif()
+  # Then call macro
+  string(TOUPPER ${current_feature} UPPER_OPTIONAL)
+  set(VARNAME HAS_Fortran_${UPPER_OPTIONAL})
+  fortran_check_single_feature(${current_feature} "${number}" ${VARNAME})
+endmacro(_figure_out_fortran_feature)
+
+function(fortran_feature_check)
+
+  # find all features
+  fortran_find_all_features(ALL_Fortran_FEATURES)
+
+  # Parses input to this function.
+  parse_input_features("${ALL_Fortran_FEATURES}" OPTIONALS REQUIRED ERRORS ${ARGN})
+  if(NOT ${ERRORS} STREQUAL "")
+    ecbuild_info("[Fortran] The following features are unknown: ${ERRORS}.")
+  endif()
+
+  # Check optional features
+  foreach(current_feature ${OPTIONALS})
+    _figure_out_fortran_feature(${current_feature})
+  endforeach(current_feature ${ARGN})
+
+  # Check required features
+  foreach(current_feature ${REQUIRED})
+    _figure_out_fortran_feature(${current_feature})
+    set(VARNAME HAS_Fortran_${UPPER_OPTIONAL})
+    if(NOT ${VARNAME})
+      ecbuild_critical("[Fortran] Required feature ${current_feature} is not available.")
+    endif(NOT ${VARNAME})
+  endforeach(current_feature ${REQUIRED})
+
+endfunction(fortran_feature_check)
diff --git a/cmake/fortran_features/c_size_t.F90 b/cmake/fortran_features/c_size_t.F90
new file mode 100644
index 0000000..3c47136
--- /dev/null
+++ b/cmake/fortran_features/c_size_t.F90
@@ -0,0 +1,8 @@
+program test_c_sizeof
+use, intrinsic :: iso_c_binding, only : c_size_t, c_int, c_long
+
+write(0,*) "c_int    = ",c_int
+write(0,*) "c_long   = ",c_long
+write(0,*) "c_size_t = ",c_size_t
+
+end program
\ No newline at end of file
diff --git a/cmake/fortran_features/c_sizeof.F90 b/cmake/fortran_features/c_sizeof.F90
new file mode 100644
index 0000000..fc1be41
--- /dev/null
+++ b/cmake/fortran_features/c_sizeof.F90
@@ -0,0 +1,3 @@
+program test_c_sizeof
+use, intrinsic :: iso_c_binding, only : c_sizeof
+end program
\ No newline at end of file
diff --git a/cmake/fortran_features/derivedtype_interface.F90 b/cmake/fortran_features/derivedtype_interface.F90
new file mode 100644
index 0000000..d59a1c3
--- /dev/null
+++ b/cmake/fortran_features/derivedtype_interface.F90
@@ -0,0 +1,54 @@
+module constructor
+
+implicit none
+
+TYPE :: AnimalType
+  private
+  integer :: m_age
+contains
+  procedure :: age
+  procedure :: speak
+ENDTYPE
+
+! Declare constructor as interface with same name as type
+interface AnimalType
+  module procedure AnimalType__ctor
+end interface
+
+contains
+
+function AnimalType__ctor(age) result(self)
+  type(AnimalType) :: self
+  integer :: age
+  write(0,'(A)') "Constructor Animal"
+  self%m_age = age
+end function
+
+function age(self)
+  class(AnimalType), intent(inout) :: self
+  integer :: age
+  age = self%m_age
+end function
+
+subroutine speak(self)
+  class(AnimalType), intent(in) :: self
+  write(0,'(A)') "Animal::speak not overridden"
+end subroutine
+
+end module
+
+! ------------------------------------------------------------------------
+
+program test_constructor
+use constructor
+implicit none
+
+  type(AnimalType) :: animal
+
+  animal = AnimalType(8)
+
+  write(0,'(A,I0)') "age = ",animal%age()
+
+  call animal%speak()
+
+end program
diff --git a/cmake/fortran_features/derivedtype_io.F90 b/cmake/fortran_features/derivedtype_io.F90
new file mode 100644
index 0000000..47a98b0
--- /dev/null
+++ b/cmake/fortran_features/derivedtype_io.F90
@@ -0,0 +1,42 @@
+module write_module
+
+implicit none
+
+TYPE :: AnimalType
+  integer :: m_age
+  integer :: m_paws
+contains
+  procedure :: writetype
+  generic :: write(formatted) => writetype
+ENDTYPE
+
+contains
+
+subroutine writetype(animal, unit, iotype, v_list, iostat, iomsg)
+  ! Argument names here from the std, but you can name them differently.
+  class(AnimalType), intent(in) :: animal ! Object to write.
+  integer, intent(in) :: unit             ! Internal unit to write to.
+  character(*), intent(in) :: iotype      ! LISTDIRECTED or DTxxx
+  integer, intent(in) :: v_list(:)        ! parameters from fmt spec.
+  integer, intent(out) :: iostat          ! non zero on error, etc.
+  character(*), intent(inout) :: iomsg    ! define if iostat non zero.
+
+  write (unit, "(A)", IOSTAT=iostat, IOMSG=iomsg) &
+      "I am a dog"
+end subroutine writetype
+
+end module
+
+! ------------------------------------------------------------------------
+
+program test_write
+use write_module
+implicit none
+
+  type(AnimalType) :: animal
+
+  animal = AnimalType(8,4)
+
+  write(0,'(A,DT)') 'Custom writing: ',animal
+
+end program
diff --git a/cmake/fortran_features/finalization.F90 b/cmake/fortran_features/finalization.F90
new file mode 100644
index 0000000..5bacd5f
--- /dev/null
+++ b/cmake/fortran_features/finalization.F90
@@ -0,0 +1,141 @@
+module final_module
+
+implicit none
+
+integer :: final_counted = 0
+integer :: destroy_counted = 0
+
+TYPE :: AnimalType
+  character(len=20), private :: m_kind = "unidentified"
+  logical :: constructed = .false.
+contains
+  procedure :: speak
+  final :: AnimalType__dtor
+ENDTYPE
+
+interface AnimalType
+  module procedure AnimalType__ctor
+end interface
+
+interface assignment(=)
+  module procedure AnimalType__assignment
+end interface
+
+contains
+
+subroutine speak(self)
+  class(AnimalType), intent(in) :: self
+  write(0,'(2A)') "I am a ",self%m_kind
+end subroutine
+
+subroutine AnimalType__dtor(self)
+  type(AnimalType), intent(inout) :: self
+
+  write(0,'(2A)') "Final animal ",self%m_kind
+  final_counted = final_counted + 1
+
+  ! Destruction guard needed for portability
+  if( self%constructed ) then
+    write(0,'(2A)') "    Destroy animal ",self%m_kind
+    destroy_counted = destroy_counted + 1
+  endif
+end subroutine
+
+function AnimalType__ctor(animaltype_) result(self)
+  type(AnimalType) :: self
+  character(len=*) :: animaltype_
+  self%m_kind = animaltype_
+  write(0,'(3A,I0)') "Constructing animal ",self%m_kind, " -- address = ",loc(self)
+  self%constructed = .true.
+end function
+
+subroutine AnimalType__assignment(animal_out,animal_in)
+  type(AnimalType), intent(out) :: animal_out
+  class(AnimalType), intent(in) :: animal_in
+  write(0,'(3A,I0,A,I0)') '   Copying ',animal_in%m_kind, " -- from address ", loc(animal_in), " to address ", loc(animal_out)
+  animal_out%m_kind = animal_in%m_kind
+  animal_out%constructed = animal_in%constructed
+end subroutine
+
+end module
+
+! ------------------------------------------------------------------------
+
+subroutine scope_test
+use final_module
+implicit none
+
+  type(AnimalType) :: dog
+  type(AnimalType) :: cat
+
+  dog = AnimalType("dog")  ! Cray       : final called on temporary AnimalType("dog"); missing final call on dog before assignment
+                           ! Intel      : final called on dog before assignment; and on temporary AnimalType("dog")
+                           ! PGI 14.4   : final NOT called at all, possibly compiler bug
+                           ! GNU 4.9    : final called on dog before assignment; missing call on temporary AnimalType("dog")
+  call dog%speak()
+
+  ! final called on dog when out of scope
+end subroutine
+
+! -------------------------------------------------------
+
+subroutine assignment_test
+use final_module
+implicit none
+
+  type(AnimalType) :: dog
+  type(AnimalType) :: animal
+
+  dog = AnimalType("dog")    ! final called on dog before assignment
+  call dog%speak()
+  write(0,'(A)') "-- animal = dog"
+  animal = dog               ! final called on animal before assignment
+  call animal%speak()
+
+  ! final called on dog when out of scope
+  ! final called on animal when out of scope
+end subroutine
+
+! -------------------------------------------------------
+
+program test_final
+use final_module
+implicit none
+  logical :: test_failed = .false.
+
+  final_counted = 0
+  destroy_counted = 0
+
+  write(0,'(A)') " "
+  write(0,'(A)') ">>>>>> begin scope_test"
+  call scope_test
+  write(0,'(A)') "<<<<<< end scope_test"
+  write(0,'(A)') " "
+
+  write(0,'(A,I0)') "final_counted = ", final_counted
+  write(0,'(A,I0)') "destroy_counted = ", destroy_counted
+
+  if( destroy_counted < 1 ) then
+    test_failed = .true.
+    write(0,'(A)') "ASSERTION FAILED: destroy_counted < 1"
+  endif
+
+  final_counted = 0
+  destroy_counted = 0
+
+  write(0,'(A)') " "
+  write(0,'(A)') ">>>>>> begin assignment_test"
+  call assignment_test
+  write(0,'(A)') "<<<<<< end assignment_test"
+  write(0,'(A)') " "
+
+  write(0,'(A,I0)') "final_counted = ", final_counted
+  write(0,'(A,I0)') "destroy_counted = ", destroy_counted
+
+  if( destroy_counted < 2 ) then
+    test_failed = .true.
+    write(0,*) "ASSERTION FAILED: destroy_counted < 2"
+  endif
+  if( test_failed ) STOP 1
+
+end program
diff --git a/cmake/fortran_features/submodules.F90 b/cmake/fortran_features/submodules.F90
new file mode 100644
index 0000000..3a2261f
--- /dev/null
+++ b/cmake/fortran_features/submodules.F90
@@ -0,0 +1,35 @@
+module sb_module
+implicit none
+integer :: a = 1
+
+interface
+  module subroutine sb
+  end subroutine
+end interface
+
+contains
+end module sb_module
+
+! -------------------------------------------------------
+
+submodule (sb_module) sb_submod1
+implicit none
+integer :: b = 2
+
+contains
+
+module subroutine sb()
+  a = b
+end subroutine
+
+end submodule sb_submod1
+
+! -------------------------------------------------------
+
+program test_submodule
+use sb_module
+implicit none
+write(0,*) a
+call sb()
+write(0,*) a
+end program
\ No newline at end of file
diff --git a/cmake/gen_source_flags.py b/cmake/gen_source_flags.py
new file mode 100644
index 0000000..b976d31
--- /dev/null
+++ b/cmake/gen_source_flags.py
@@ -0,0 +1,84 @@
+# (C) Copyright 1996-2016 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.
+
+"""
+Generate .cmake file to set source-file specific compiler flags based on
+rules defined in a JSON file.
+"""
+
+from argparse import ArgumentParser
+from fnmatch import fnmatch
+import logging
+from json import JSONDecoder
+from os import path
+
+log = logging.getLogger('gen_source_flags')
+
+
+def match(source, pattern, op, flags, indent=0):
+    if fnmatch(source, pattern):
+
+        suff = '' if op[0] in ('+', '=', '/') else ' (nested pattern)'
+        log.debug('%s-> pattern "%s" matches "%s"%s',
+                  ' ' * (indent + 1), pattern, source, suff)
+
+        if op[0] == "+":
+            flags += [flag for flag in op[1:] if flag not in flags]
+            log.debug('%sappending %s --> flags: %s', ' ' * (indent + 2), op[1:], flags)
+
+        elif op[0] == "=":
+            flags = op[1:]
+            log.debug('%ssetting %s --> flags: %s', ' ' * (indent + 2), op[1:], flags)
+
+        elif op[0] == "/":
+            flags = [flag for flag in flags if flag not in op[1:]]
+            log.debug('%sremoving %s --> flags: %s', ' ' * (indent + 2), op[1:], flags)
+
+        else:  # Nested rule
+            log.debug('%sapplying nested rules for "%s" (flags: %s)',
+                      ' ' * (indent + 2), pattern, flags)
+            for nested_pattern, nested_op in op:
+                flags = match(source, nested_pattern, nested_op, flags, indent + 2)
+
+    return flags
+
+
+def generate(rules, out, default_flags, sources, debug=False):
+    logging.basicConfig(level=logging.DEBUG if debug else logging.INFO,
+                        format='-- %(levelname)s - %(name)s: %(message)s')
+
+    with open(path.expanduser(rules)) as f:
+        rules = JSONDecoder(object_pairs_hook=list).decode(f.read())
+
+    with open(path.expanduser(out), 'w') as f:
+        for source in sources:
+            log.debug('%s (default flags: "%s")', source, default_flags)
+            flags = default_flags.split()
+            for pattern, op in rules:
+                flags = match(source, pattern, op, flags)
+
+            if flags:
+                log.debug(' ==> setting flags for %s to %s', source, ' '.join(flags))
+                f.write('set_source_files_properties(%s PROPERTIES COMPILE_FLAGS "%s")\n'
+                        % (source, ' '.join(flags)))
+            else:
+                log.debug(' ==> flags for %s empty', source)
+
+
+def main():
+    """Parse arguments"""
+    parser = ArgumentParser(description=__doc__)
+    parser.add_argument('rules', metavar='RULES.json', help='JSON rules file')
+    parser.add_argument('out', metavar='OUT.cmake', help='CMake script to generate')
+    parser.add_argument('default_flags', help='Default compiler flags to use')
+    parser.add_argument('sources', metavar='file', nargs='+', help='Path to file to apply rules to')
+    parser.add_argument('--debug', '-d', action='store_true', help='Log debug messages')
+    generate(**vars(parser.parse_args()))
+
+if __name__ == '__main__':
+    main()
diff --git a/cmake/include/ecbuild/boost_test_framework.h b/cmake/include/ecbuild/boost_test_framework.h
index 8cbd8e9..f593b70 100644
--- a/cmake/include/ecbuild/boost_test_framework.h
+++ b/cmake/include/ecbuild/boost_test_framework.h
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 1996-2015 ECMWF.
+ * (C) Copyright 1996-2016 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/project-config.cmake.in b/cmake/project-config.cmake.in
index 03f875b..6d48728 100644
--- a/cmake/project-config.cmake.in
+++ b/cmake/project-config.cmake.in
@@ -1,11 +1,13 @@
 # Config file for the @PROJECT_NAME@ package
 # Defines the following variables:
 #
-#  @PNAME at _INCLUDE_DIRS - include directories
-#  @PNAME at _DEFINITIONS  - preprocessor definitions
-#  @PNAME at _LIBRARIES    - libraries to link against
-#  @PNAME at _FEATURES     - list of enabled features
-#  @PNAME at _VERSION      - version of the package
+#  @PNAME at _INCLUDE_DIRS   - include directories
+#  @PNAME at _DEFINITIONS    - preprocessor definitions
+#  @PNAME at _LIBRARIES      - libraries to link against
+#  @PNAME at _FEATURES       - list of enabled features
+#  @PNAME at _VERSION        - version of the package
+#  @PNAME at _GIT_SHA1       - Git revision of the package
+#  @PNAME at _GIT_SHA1_SHORT - short Git revision of the package
 #
 # Also defines @PROJECT_NAME@ third-party library dependencies:
 #  @PNAME at _TPLS             - package names of  third-party library dependencies
@@ -26,12 +28,16 @@ set( @PNAME at _TPL_INCLUDE_DIRS  "@CONF_TPL_INCLUDE_DIRS@" )
 set( @PNAME at _TPL_DEFINITIONS   "@CONF_TPL_DEFINITIONS@" )
 set( @PNAME at _TPL_LIBRARIES     "@CONF_TPL_LIBRARIES@" )
 
+set( @PNAME at _VERSION           "@PACKAGE_VERSION@" )
+set( @PNAME at _GIT_SHA1          "@PACKAGE_GIT_SHA1@" )
+set( @PNAME at _GIT_SHA1_SHORT    "@PACKAGE_GIT_SHA1_SHORT@" )
+
 ### export include paths as absolute paths
 
 set( @PNAME at _INCLUDE_DIRS "" )
 foreach( path ${@PNAME at _SELF_INCLUDE_DIRS} )
-	get_filename_component( abspath ${path} ABSOLUTE )
-	list( APPEND @PNAME at _INCLUDE_DIRS ${abspath} )
+  get_filename_component( abspath ${path} ABSOLUTE )
+  list( APPEND @PNAME at _INCLUDE_DIRS ${abspath} )
 endforeach()
 list( APPEND @PNAME at _INCLUDE_DIRS ${@PNAME at _TPL_INCLUDE_DIRS} )
 
@@ -47,7 +53,7 @@ set( @PNAME at _LIBRARIES        ${@PNAME at _SELF_LIBRARIES}   ${@PNAME at _TPL_LIBRARIE
 
 set( @PNAME at _FEATURES    "@CONF_FEATURES@" )
 foreach( _f ${@PNAME at _FEATURES} )
-	set( @PNAME at _HAVE_${_f} 1 )
+  set( @PNAME at _HAVE_${_f} 1 )
 endforeach()
 
 # Has this configuration been exported from a build tree?
@@ -58,22 +64,22 @@ if( EXISTS ${@PNAME at _CMAKE_DIR}/@CONF_IMPORT_FILE@ )
   include( ${@PNAME at _IMPORT_FILE} )
 endif()
 
+# here goes the imports of the TPL's
+
+include( ${CMAKE_CURRENT_LIST_FILE}.tpls OPTIONAL )
+
 # insert definitions for IMPORTED targets
 
 if( NOT @PROJECT_NAME at _BINARY_DIR )
 
   if( @PNAME at _IS_BUILD_DIR_EXPORT )
-		include( "@TOP_PROJECT_TARGETS_FILE@" OPTIONAL )
-	else()
-		include( "${@PNAME at _CMAKE_DIR}/@CMAKE_PROJECT_NAME at -targets.cmake" )
-	endif()
+    include( "@TOP_PROJECT_TARGETS_FILE@" OPTIONAL )
+  else()
+    include( "${@PNAME at _CMAKE_DIR}/@PROJECT_NAME at -targets.cmake" )
+  endif()
 
 endif()
 
-# here goes the imports of the TPL's
-
-include( ${CMAKE_CURRENT_LIST_FILE}.tpls OPTIONAL )
-
 # publish this file as imported
 
 set( @PNAME at _IMPORT_FILE ${CMAKE_CURRENT_LIST_FILE} )
@@ -82,9 +88,10 @@ mark_as_advanced( @PNAME at _IMPORT_FILE )
 # set @PROJECT_NAME at _BASE_DIR for final installations or build directories
 
 if( NOT @PROJECT_NAME@ )
-	if( @PNAME at _IS_BUILD_DIR_EXPORT )
-		set( @PROJECT_NAME at _BASE_DIR @CMAKE_BINARY_DIR@ )
-	else()
-		set( @PROJECT_NAME at _BASE_DIR @CMAKE_INSTALL_PREFIX@ )
-	endif()
+  if( @PNAME at _IS_BUILD_DIR_EXPORT )
+    set( @PROJECT_NAME at _BASE_DIR @CMAKE_BINARY_DIR@ )
+  else()
+    get_filename_component( abspath ${CMAKE_CURRENT_LIST_DIR}/../../.. ABSOLUTE )
+    set( @PROJECT_NAME at _BASE_DIR ${abspath} )
+  endif()
 endif()
diff --git a/cmake/sg.pl b/cmake/sg.pl
index 8a64bf4..6bce843 100755
--- a/cmake/sg.pl
+++ b/cmake/sg.pl
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 #!/usr/local/share/perl56
 
-# (C) Copyright 1996-2015 ECMWF.
+# (C) Copyright 1996-2016 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/debian/changelog b/debian/changelog
index fded219..f9edd65 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,82 @@
-metview (4.6.1-2) unstable; urgency=medium
+metview (4.8.0-1) unstable; urgency=medium
+
+  * New upstream release
+  * Now build against eccodes instead of grib-api
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Wed, 30 Nov 2016 16:43:48 +0000
+
+metview (4.7.2-3) unstable; urgency=medium
+
+  * Depend on mksh, ksh subst. needed to build. Closes: #843025.
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Mon, 21 Nov 2016 07:39:18 +0000
+
+metview (4.7.2-2) unstable; urgency=medium
+
+  * Drop dependencies on ksh: no ksh scripts now included. Closes: #843025.
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Thu, 03 Nov 2016 11:22:47 +0000
+
+metview (4.7.2-1) unstable; urgency=medium
+
+  * New upstream release
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Fri, 28 Oct 2016 21:14:59 +0100
+
+metview (4.7.0-1) unstable; urgency=medium
+
+  * New upstream release
+  * DH_COMPAT=10
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Mon, 19 Sep 2016 19:46:17 +0100
+
+metview (4.6.7-1) unstable; urgency=medium
+
+  * New upstream release
+   - g++6 patch merged upstream. 
+   - Depend on 4.3.0+dfsg.2-8 of libterralib. Closes: #83471
+   - To pre-generate files: ObjectListAll -> ObjectListAllTarget
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Fri, 15 Jul 2016 06:46:09 +0100
+
+metview (4.6.5-5) unstable; urgency=medium
+
+  * Use python3-all-dev, now that magics++ uses python3. Closes: #823165
+  * set LC_ALL=C in debian/rules for reproducibility
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Sun, 03 Jul 2016 13:18:25 +0100
+
+metview (4.6.5-4) unstable; urgency=medium
+
+  * Remove obsolete dependency on OpenJPEG. Closes: #826821
+  * Enable stdc=c++11 for unique_ptr features in magics++
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Sun, 19 Jun 2016 11:48:38 +0100
+
+metview (4.6.5-3) unstable; urgency=medium
+
+  * Depend on magics >= 2.28.0-2 to get fixed gfortran dependency.
+    Closes: #825021
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Fri, 27 May 2016 10:14:42 +0100
+
+metview (4.6.5-2) unstable; urgency=medium
+
+  * Add python-all-dev, now needed for linking. Closes: #823165.
+  * Standards-Version: 3.9.8.
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Mon, 02 May 2016 15:57:01 +0100
+
+metview (4.6.5-1) unstable; urgency=medium
+
+  * New upstream release: Closes: #818857.
+    *  fix-paths.patch removed
+  * Standards-Version: 3.9.7. No changes required.
+  * auto-ptr.patch: remove obsolete auto_ptrs.
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Sat, 02 Apr 2016 16:44:21 +0100
+
+metview (4.6.1-5) unstable; urgency=medium
 
   * Remove B-D on libmotif-dev as it is no longer used (Qt5 is instead)
   * Split dh_fixperms to arch and -indep parts, so dpkg-buildpackage -A
@@ -6,7 +84,25 @@ metview (4.6.1-2) unstable; urgency=medium
   * Fix bashisms. Closes: #772310.
   * Patch for G++ 6 changes (c++-11 abi). Closes: #812161.
 
- -- Alastair McKinstry <mckinstry at debian.org>  Mon, 15 Feb 2016 05:01:53 +0000
+ -- Alastair McKinstry <mckinstry at debian.org>  Tue, 16 Feb 2016 23:02:36 +0000
+
+metview (4.6.1-4) unstable; urgency=medium
+
+  * Fix for --no-arch-all builds
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Fri, 15 Jan 2016 03:08:30 +0000
+
+metview (4.6.1-3) unstable; urgency=medium
+
+  * compress files 'gzip -n' for reproducibility. 
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Fri, 15 Jan 2016 07:23:27 +0000
+
+metview (4.6.1-2) unstable; urgency=medium
+
+  * Depend on libgrib-api-dev >= 1.14.4-5 to pull in its Build-dependencies.
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Thu, 14 Jan 2016 13:21:31 +0000
 
 metview (4.6.1-1) unstable; urgency=medium
 
@@ -18,6 +114,12 @@ metview (4.6.1-1) unstable; urgency=medium
 
  -- Alastair McKinstry <mckinstry at debian.org>  Mon, 11 Jan 2016 07:36:31 +0000
 
+metview (4.5.7-4) unstable; urgency=medium
+
+  * Add FPIC support properly. FPIC not being picked up on CXX for i386
+
+ -- Alastair McKinstry <mckinstry at debian.org>  Mon, 09 Nov 2015 10:37:35 +0000
+
 metview (4.5.7-3) unstable; urgency=medium
 
   * Next in the round of exciting metview reproducibility fixes. 
diff --git a/debian/compat b/debian/compat
index ec63514..f599e28 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-9
+10
diff --git a/debian/control b/debian/control
index 62177a3..fd4079e 100644
--- a/debian/control
+++ b/debian/control
@@ -2,25 +2,28 @@ Source: metview
 Section: science
 Priority: optional
 Maintainer: Alastair McKinstry <mckinstry at debian.org>
-Build-Depends: debhelper (>= 9), 
-  flex, bison, libhdf5-dev, libpango1.0-dev, chrpath, ksh,
+Build-Depends: debhelper (>= 10), 
+  flex, bison, libhdf5-dev, libpango1.0-dev, chrpath, mksh,
   libqt5webkit5-dev, qtbase5-dev, libqt5xmlpatterns5-dev,
-  libgrib-api-dev, libgrib-api-tools,
+  libeccodes-dev | libgrib-api-dev, 
+  libeccodes-tools | libgrib-api-tools,
   libemos-dev (>= 2:4.1.1-2), libboost-dev,
-  libmagics++-metview-dev, libmagics++-dev (>= 2.26.2),
+  libmagics++-metview-dev, 
+  libmagics++-dev (>= 2.28.0-2),
   libxmu-dev, libgdbm-dev, libcurl4-gnutls-dev,
   libcairo2-dev, pkg-config, swig, libexpat1-dev,
-  libterralib-dev, ksh, libproj-dev,
+  libterralib-dev (>= 4.3.0+dfsg.2-8), 
+  libproj-dev, libqt5svg5-dev,
   libgd-dev, imagemagick, libnetcdf-dev, libnetcdf-cxx-legacy-dev,
-  libopenjpeg-dev, cmake, flextra, gfortran, libgeotiff-dev
-Build-Conflicts: lesstif2-dev
-Standards-Version: 3.9.6
+  cmake, flextra, gfortran, libgeotiff-dev,
+  python3-all-dev
+Standards-Version: 3.9.8
 Homepage: https://software.ecmwf.int/wiki/display/METV/Metview
 Vcs-Git: git://anonscm.debian.org/debian-science/packages/metview.git
 
 Package: metview
 Architecture: any
-Depends: ${misc:Depends}, ${shlibs:Depends}, ksh | mksh | pdksh | zsh, 
+Depends: ${misc:Depends}, ${shlibs:Depends},
  x11-utils, metview-data, python
 Recommends: magics++
 Description: Interactive data visualization and analysis environment,
diff --git a/debian/patches/auto-ptr.patch b/debian/patches/auto-ptr.patch
new file mode 100644
index 0000000..5721580
--- /dev/null
+++ b/debian/patches/auto-ptr.patch
@@ -0,0 +1,760 @@
+Author: Alastair McKinstry <mckinstry at debian.org>
+Description: Move auto_ptr -> std::unique_ptr() for c++11 standard
+Last-Updated: 2016-03-21
+Forwarded: no
+
+Index: metview-4.6.5/src/Desktop/Log.cc
+===================================================================
+--- metview-4.6.5.orig/src/Desktop/Log.cc
++++ metview-4.6.5/src/Desktop/Log.cc
+@@ -56,11 +56,11 @@ Log::operator ostream&()
+ 	if(tee_.get() == 0)
+ 	{
+ 	
+-		auto_ptr<ostream> o(new ofstream(path_.str().c_str(),ios::app));
+-		out_ = o;
++		unique_ptr<ostream> o(new ofstream(path_.str().c_str(),ios::app));
++		out_ = move(o);
+ 		
+-		auto_ptr<ostream> t(new TeeStream(global(),*out_));
+-		tee_ = t;
++		unique_ptr<ostream> t(new TeeStream(global(),*out_));
++		tee_ = move(t);
+ 
+ 
+ 	}
+@@ -138,4 +138,4 @@ ostream& Log::find(IconObject* o)
+ 	string str;
+ 	str=string(buf);
+ 	return str;
+-}*/	
+\ No newline at end of file
++}*/	
+Index: metview-4.6.5/src/Desktop/Log.h
+===================================================================
+--- metview-4.6.5.orig/src/Desktop/Log.h
++++ metview-4.6.5/src/Desktop/Log.h
+@@ -41,8 +41,8 @@ private:
+ 	Log& operator=(const Log&);
+ 
+ 	Path              path_;
+-	auto_ptr<ostream> out_;
+-	auto_ptr<ostream> tee_;
++	unique_ptr<ostream> out_;
++	unique_ptr<ostream> tee_;
+ 	IconObject* object_;
+ 
+ 	static ostream& global();
+Index: metview-4.6.5/src/Macro/grib.cc
+===================================================================
+--- metview-4.6.5.orig/src/Macro/grib.cc
++++ metview-4.6.5/src/Macro/grib.cc
+@@ -376,10 +376,10 @@ nontested_grib_api_port("GenerateFunctio
+       field *g = get_field(v,i,expand_mem);
+       field *h = get_field(w,i,expand_mem);
+ 
+-      auto_ptr<MvGridBase> grd( MvGridFactory( g ) );
++      unique_ptr<MvGridBase> grd( MvGridFactory( g ) );
+       if( ! grd->hasLocationInfo() )
+          return Error("GenerateFunction: unimplemented or spectral data - unable to extract location data");
+-      auto_ptr<MvGridBase> grdOut( MvGridFactory( h ) );
++      unique_ptr<MvGridBase> grdOut( MvGridFactory( h ) );
+ 
+       bool cont = true;
+       while( cont )                          //-- process current field
+@@ -526,11 +526,11 @@ Value MaskFunction::Execute(int arity,Va
+ 
+ 	for(i = 0; i < v->count ;i++)
+ 	{
+-		auto_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
++		unique_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
+ 		if(! grd->hasLocationInfo() )
+ 		  return Error( "mask: unimplemented or spectral data - unable to extract location data" );
+ 
+-		auto_ptr<MvGridBase> newGrd( MvGridFactory( z->fields[i] ) );
++		unique_ptr<MvGridBase> newGrd( MvGridFactory( z->fields[i] ) );
+ 
+ 		for( int j=0; j < grd->length(); ++j )
+ 		{
+@@ -629,7 +629,7 @@ Value RMaskFunction::Execute( int arity,
+ 
+   for( i = 0; i < v->count; i++ )          //-- for all fields in a fieldset
+     {
+-      auto_ptr<MvGridBase> newGrd( MvGridFactory( z->fields[i] ) );
++      unique_ptr<MvGridBase> newGrd( MvGridFactory( z->fields[i] ) );
+ 
+       if(! newGrd->hasLocationInfo() )
+ 	return Error( "rmask: unimplemented or spectral data - unable to extract location data" );
+@@ -725,7 +725,7 @@ Value GridDistanceFunction::Execute( int
+ 
+   for( i = 0; i < v->count; i++ )          //-- for all fields in a fieldset
+     {
+-      auto_ptr<MvGridBase> newGrd( MvGridFactory( z->fields[i] ) );
++      unique_ptr<MvGridBase> newGrd( MvGridFactory( z->fields[i] ) );
+ 
+       if(! newGrd->hasLocationInfo() )
+ 	return Error( "distance: unimplemented or spectral data - unable to extract location data" );
+@@ -1828,11 +1828,11 @@ Value CosLatFunction::Execute(int,Value
+ 
+ 	for(i = 0; i < v->count ;i++)
+ 	{
+-		auto_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
++		unique_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
+ 		if(! grd->hasLocationInfo() )
+ 		  return Error( "coslat: unimplemented or spectral data - unable to extract location data" );
+ 
+-		auto_ptr<MvGridBase> newGrd( MvGridFactory( z->fields[i] ) );
++		unique_ptr<MvGridBase> newGrd( MvGridFactory( z->fields[i] ) );
+ 
+ 		for( int j=0; j < grd->length(); ++j )
+ 		  {
+@@ -1870,11 +1870,11 @@ Value SinLatFunction::Execute(int,Value
+ 
+ 	for(i = 0; i < v->count ;i++)
+ 	{
+-		auto_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
++		unique_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
+ 		if(! grd->hasLocationInfo() )
+ 		  return Error( "sinlat: unimplemented or spectral data - unable to extract location data" );
+ 
+-		auto_ptr<MvGridBase> newGrd( MvGridFactory( z->fields[i] ) );
++		unique_ptr<MvGridBase> newGrd( MvGridFactory( z->fields[i] ) );
+ 
+ 		for( int j=0; j < grd->length(); ++j )
+ 		  {
+@@ -1976,7 +1976,7 @@ Value GridLatLonsFunction::Execute(int /
+ 
+     for(i = 0; i < fs->count ;i++)  // for each field...
+     {
+-		auto_ptr<MvGridBase> grid( MvGridFactory( fs->fields[i] ) );
++		unique_ptr<MvGridBase> grid( MvGridFactory( fs->fields[i] ) );
+ 		if(! grid->hasLocationInfo() )
+ 			return Error( "gridlats/gridlons: unimplemented or spectral data - unable to extract location data" );
+ 
+@@ -2565,15 +2565,15 @@ Value IntegrateFunction::Execute(int ari
+ 
+ 	for(i = 0; i < v->count ;i++)
+ 	{
+-		auto_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
++		unique_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
+ 		if(! grd->hasLocationInfo() )
+ 			return Error( "integrate: unimplemented or spectral data - unable to extract location data" );
+ 
+-		auto_ptr<MvGridBase> maskgrd;
++		unique_ptr<MvGridBase> maskgrd;
+ 		if( z )
+ 		  {
+-		    auto_ptr<MvGridBase> tmp( MvGridFactory( z->fields[ z->count>1 ? i : 0 ] ) );
+-		    maskgrd = tmp;
++		    unique_ptr<MvGridBase> tmp( MvGridFactory( z->fields[ z->count>1 ? i : 0 ] ) );
++		    maskgrd = move(tmp);
+ 		  }
+ 
+ 		if( maskgrd.get() && ! maskgrd->isEqual( grd.get() ) )
+@@ -2685,7 +2685,7 @@ Value MinMaxAreaFunction::Execute(int, V
+ 
+   for(i = 0; i < v->count ;i++)
+   {
+-    auto_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
++    unique_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
+     if(! grd->hasLocationInfo() )
+         return Error( "minvalue/maxvalue: unimplemented or spectral data - unable to extract location data" );
+ 
+@@ -2826,7 +2826,7 @@ Value InterpolateFunction::Execute(int a
+ 
+ 		release_field(g);
+ #else
+-		auto_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
++		unique_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
+ 
+ 		if( ! grd->hasLocationInfo() )
+ 		{
+@@ -2991,7 +2991,7 @@ Value NearestGridpointFunction::Execute(
+ 			vvals = new CVector(vlat->Count());
+ 
+ 
+-		auto_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
++		unique_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
+ 
+ 		if( ! grd->hasLocationInfo() )
+ 		{
+@@ -3229,15 +3229,15 @@ Value FindFunction::Execute(int arity,Va
+ 
+ 	for(i = 0; i < v->count ;i++)
+ 	  {
+-	    auto_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
++	    unique_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
+ 	    if(! grd->hasLocationInfo() )
+ 	      return Error( "find: unimplemented or spectral data - unable to extract location data" );
+ 
+-	    auto_ptr<MvGridBase> maskgrd;
++	    unique_ptr<MvGridBase> maskgrd;
+ 	    if( z )
+ 	      {
+-		auto_ptr<MvGridBase> tmp( MvGridFactory( z->fields[ z->count>1 ? i : 0 ] ) );
+-		maskgrd = tmp;
++		unique_ptr<MvGridBase> tmp( MvGridFactory( z->fields[ z->count>1 ? i : 0 ] ) );
++		maskgrd = move(tmp);
+ 	      }
+ 
+ 	    if( maskgrd.get() && ! maskgrd->isEqual( grd.get() ) )
+@@ -3349,7 +3349,7 @@ Value GFindFunction::Execute(int arity,V
+ 
+ 	for(int i = 0; i < v->count ;i++)
+ 	  {
+-	    auto_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
++	    unique_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
+ 	    if(! grd->hasLocationInfo() )
+ 	      return Error( "gfind: unimplemented or spectral data - unable to extract location data" );
+ 
+@@ -3423,7 +3423,7 @@ Value VertIntFunction::Execute(int arity
+ 		{
+ 			field *g  = GetIndexedFieldWithAtLeastPackedMem (v,i);
+ 			//gribsec1   *s1 = (gribsec1*)&g->ksec1[0];
+-			auto_ptr<MvGridBase> grd( MvGridFactory( g ) );
++			unique_ptr<MvGridBase> grd( MvGridFactory( g ) );
+ 			//if(s1->parameter == 152) n = i;
+ 			if( grd->getLong(parameterKey) == 152 )
+ 			    n = i;
+@@ -3765,7 +3765,7 @@ Value UniVertIntFunction::Execute(int /*
+     for(int i = 0; (i < fs_data->count) && (n_lnsp == -1) ; ++i)
+     {
+       f_lnsp_orig = GetIndexedFieldWithAtLeastPackedMem(fs_data,i);
+-      auto_ptr<MvGridBase> grd( MvGridFactory( f_lnsp_orig ) );
++      unique_ptr<MvGridBase> grd( MvGridFactory( f_lnsp_orig ) );
+       if( grd->getLong(parameterKey) == lnsp_ )
+       {
+         n_lnsp = i;                   //-- lnsp found - stop the loop
+@@ -4333,7 +4333,7 @@ Value UniThicknessAndPressureFunction::E
+ 				for(i = 0; i < w->count ;i++)
+ 				{
+ 					field *g = GetIndexedFieldWithAtLeastPackedMem(w,i);
+-					auto_ptr<MvField> fld( new MvField( g ) );
++					unique_ptr<MvField> fld( new MvField( g ) );
+ 					levels[i] = (int)fld->level();
+ 					release_field(g);
+ 				}
+@@ -4347,7 +4347,7 @@ Value UniThicknessAndPressureFunction::E
+ 
+ 	for(int i = 0; i < v->count ;i++)
+ 	{
+-	   auto_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
++	   unique_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
+ 	   if(! grd->isValid() )
+ 	      return Error( "unipressure/unithickness: cannot process this type of grid!" );
+ 	  long param = grd->getLong(parameterKey);
+@@ -4376,7 +4376,7 @@ Value UniThicknessAndPressureFunction::E
+ 		grd->init();
+ 
+ 		field* h = copy_field(g,false);
+-		auto_ptr<MvGridBase> grdOut( MvGridFactory( h ) );
++		unique_ptr<MvGridBase> grdOut( MvGridFactory( h ) );
+ 
+ 		double a1, b1, a0, b0;
+ 		if( ! grd->vertCoordCoefs( a1, b1, level ) )
+@@ -4608,7 +4608,7 @@ Value GribMatrixFunction::Execute(int,Va
+     {
+         field *g = get_field(v,i,expand_mem);
+ 	//gribsec2_ll *s2 = (gribsec2_ll*) &g->ksec2[0];
+-        auto_ptr<MvGridBase> grd( MvGridFactory( g ) );
++        unique_ptr<MvGridBase> grd( MvGridFactory( g ) );
+         string gridType = grd->gridType();
+ 
+         if ((gridType != cLatLonGrid) && (gridType != cSatelliteImage))
+@@ -4679,18 +4679,18 @@ Value GribDirectionFunction::Execute(int
+ 
+   for(int i = 0; i < u->count ;i++)
+     {
+-      auto_ptr<MvGridBase> gu( MvGridFactory( u->fields[i] ) );
++      unique_ptr<MvGridBase> gu( MvGridFactory( u->fields[i] ) );
+       if( gu->gridType() == "NA" )
+ 	return Error( "direction: U: cannot process this type of field!" );
+ 
+-      auto_ptr<MvGridBase> gv( MvGridFactory( v->fields[i] ) );
++      unique_ptr<MvGridBase> gv( MvGridFactory( v->fields[i] ) );
+       if( gv->gridType() == "NA" )
+ 	return Error( "direction: V: cannot process this type of field!" );
+ 
+       if( ! gu->isEqual( gv.get() ) )
+ 	return Error( "direction: U and V: different grids!" );
+ 
+-      auto_ptr<MvGridBase> gdir( MvGridFactory( dir->fields[i] ) );
++      unique_ptr<MvGridBase> gdir( MvGridFactory( dir->fields[i] ) );
+ 
+       for( int j=0; j < gu->length(); ++j )
+ 	{
+@@ -4754,7 +4754,7 @@ Value MeanEwFunction::Execute(int,Value
+ 
+ 	for( int i = 0; i < v->count; i++ )
+ 	  {
+-	    auto_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
++	    unique_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
+ 
+ 	    if(! grd->hasLocationInfo() )
+ 	      return Error( "mean_ew: unimplemented grid type: %s", grd->gridType().c_str() );
+@@ -4765,7 +4765,7 @@ Value MeanEwFunction::Execute(int,Value
+ 		grd->gridType() != cGaussianReducedGrid )
+ 	      return Error( "mean_ew: unsuitable grid type: %s", grd->gridType().c_str() );
+ 
+-	    auto_ptr<MvGridBase> newGrd( MvGridFactory( z->fields[i] ) );
++	    unique_ptr<MvGridBase> newGrd( MvGridFactory( z->fields[i] ) );
+ 
+ 	    double currentLatRow = grd->lat_y();
+ 	    bool   cont = true;
+@@ -4870,7 +4870,7 @@ LatLonAverageFunction::Execute(int,Value
+ 
+     for( int fi = 0; fi < fs->count; fi++ ) //-- loop over fields in fieldset
+     {
+-        auto_ptr<MvGridBase> grd( MvGridFactory( fs->fields[fi] ) );
++        unique_ptr<MvGridBase> grd( MvGridFactory( fs->fields[fi] ) );
+         if(! grd->hasLocationInfo() )
+             return Error( "average_xx: unimplemented grid type: %s", grd->gridType().c_str() );
+ 
+@@ -5054,12 +5054,12 @@ Value GribIntToFloatFunction::Execute( i
+   for( int i = 0; i < v->count; ++i )        //-- for all fields in a fieldset
+     {
+       field *g = get_field(v,i,expand_mem);
+-      auto_ptr<MvGridBase> grd( MvGridFactory( g ) );
++      unique_ptr<MvGridBase> grd( MvGridFactory( g ) );
+       if(! grd->isValid() )
+          return Error( "float: unimplemented grid type: %s", grd->gridType().c_str() );
+ 
+       field *h = get_field(z,i,expand_mem);
+-      auto_ptr<MvGridBase> grdOut( MvGridFactory( h ) );
++      unique_ptr<MvGridBase> grdOut( MvGridFactory( h ) );
+       if(! grdOut->isValid() )
+          return Error( "float: unimplemented grid type: %s", grdOut->gridType().c_str() );
+ 
+@@ -5132,12 +5132,12 @@ Value GribFloatToIntFunction::Execute( i
+   for( int i = 0; i < v->count; ++i )        //-- for all fields in a fieldset
+     {
+       field *g = get_field(v,i,expand_mem);  //-- input field
+-      auto_ptr<MvGridBase> grd( MvGridFactory( g ) );
++      unique_ptr<MvGridBase> grd( MvGridFactory( g ) );
+       if(! grd->isValid() )
+          return Error( "integer: unimplemented grid type: %s", grd->gridType().c_str() );
+ 
+       field *h = get_field(z,i,expand_mem);  //-- output field
+-      auto_ptr<MvGridBase> grdOut( MvGridFactory( h ) );
++      unique_ptr<MvGridBase> grdOut( MvGridFactory( h ) );
+       if(! grdOut->isValid() )
+          return Error( "integer: unimplemented grid type: %s", grdOut->gridType().c_str() );
+ 
+@@ -5293,11 +5293,11 @@ Value CovarianceFunction::Execute(int ar
+ 
+ double CovarFunc( field* f1, field* f2, const MvGeoBox& area )
+ {
+-   auto_ptr<MvGridBase> grd1( MvGridFactory( f1 ) );
++   unique_ptr<MvGridBase> grd1( MvGridFactory( f1 ) );
+    if(! grd1->hasLocationInfo() )
+       throw MvException( "Unimplemented or spectral data - unable to extract location data" );
+ 
+-   auto_ptr<MvGridBase> grd2( MvGridFactory( f2 ) );
++   unique_ptr<MvGridBase> grd2( MvGridFactory( f2 ) );
+    if(! grd2->hasLocationInfo() )
+       throw MvException( "Unimplemented or spectral data - unable to extract location data" );
+ 
+@@ -5612,7 +5612,7 @@ Value FrequenciesFunction::Execute(int a
+ 	bool found;
+ 	for(i = 0; i < v->count ;i++)
+ 	{
+-		auto_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
++		unique_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
+ 		if(! grd->hasLocationInfo() )
+ 			return Error( "frequencies: unimplemented or spectral data - unable to extract location data" );
+ 
+@@ -5681,11 +5681,11 @@ Value FillMVEWFunction::Execute(int,Valu
+ 
+    for( int i = 0; i < v->count; i++)
+    {
+-      auto_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
++      unique_ptr<MvGridBase> grd( MvGridFactory( v->fields[i] ) );
+       if(! grd->isRegularLatLongGrid() )
+          return Error( "fill_missing_values_ew: implemented only for regular latlong format" );
+ 
+-      auto_ptr<MvGridBase> newGrd( MvGridFactory( z->fields[i] ) );
++      unique_ptr<MvGridBase> newGrd( MvGridFactory( z->fields[i] ) );
+ 
+       // Copy first point
+       v1 = grd->value();
+Index: metview-4.6.5/src/MetviewUI/CMakeLists.txt
+===================================================================
+--- metview-4.6.5.orig/src/MetviewUI/CMakeLists.txt
++++ metview-4.6.5/src/MetviewUI/CMakeLists.txt
+@@ -385,7 +385,6 @@ set(MetviewUI_srcs
+     XPalette.h
+     XPixmap.h
+     XResource.h
+-    auto_ptr.h
+ )
+ 
+ include_directories( CMAKE_CURRENT_SOURCE_DIR . )
+Index: metview-4.6.5/src/MetviewUI/Log.cc
+===================================================================
+--- metview-4.6.5.orig/src/MetviewUI/Log.cc
++++ metview-4.6.5/src/MetviewUI/Log.cc
+@@ -63,10 +63,10 @@ Log::operator ostream&()
+ 	if(tee_.get() == 0)
+ 	{
+ 	
+-		auto_ptr<ostream> o(new ofstream(path_.str().c_str(),ios::app));
++		unique_ptr<ostream> o(new ofstream(path_.str().c_str(),ios::app));
+ 		out_ = o;
+ 		
+-		auto_ptr<ostream> t(new TeeStream(global(),*out_));
++		unique_ptr<ostream> t(new TeeStream(global(),*out_));
+ 		tee_ = t;
+ 
+ 
+Index: metview-4.6.5/src/MetviewUI/Log.h
+===================================================================
+--- metview-4.6.5.orig/src/MetviewUI/Log.h
++++ metview-4.6.5/src/MetviewUI/Log.h
+@@ -92,8 +92,8 @@ private:
+ // -- Members
+ 
+ 	Path              path_;
+-	auto_ptr<ostream> out_;
+-	auto_ptr<ostream> tee_;
++	unique_ptr<ostream> out_;
++	unique_ptr<ostream> tee_;
+ 	IconObject* object_;
+ 
+ // -- Methods
+Index: metview-4.6.5/src/libMetview/MvFieldSet.cc
+===================================================================
+--- metview-4.6.5.orig/src/libMetview/MvFieldSet.cc
++++ metview-4.6.5/src/libMetview/MvFieldSet.cc
+@@ -1314,7 +1314,7 @@ double MvField::covar( MvField& other,
+ 	  }
+ 
+ 	//-- cReleaseMemoryFalse or cReleaseMemoryTrue???
+-	auto_ptr<MvGridBase> grd2( MvGridFactory( other.libmars_field(), cReleaseMemoryTrue ) );
++	unique_ptr<MvGridBase> grd2( MvGridFactory( other.libmars_field(), cReleaseMemoryTrue ) );
+ 
+ 	if( ! mvgrid_->isEqual( grd2.get() ) )
+ 	  {
+Index: metview-4.6.5/src/libUtil/CMakeLists.txt
+===================================================================
+--- metview-4.6.5.orig/src/libUtil/CMakeLists.txt
++++ metview-4.6.5/src/libUtil/CMakeLists.txt
+@@ -31,7 +31,7 @@ Tokenizer.cc
+ UtilitiesC.c
+ Cached.h GribMetaData.h LogHandler.h MagicsColours.h MtInputEvent.h MvException.h
+ MvFileInfo.h MvFlextra.h MvGribParC.h MvKeyManager.h MvKeyProfile.h MvMessageMetaData.h MvMsg.h MvOdb.h
+-MvSTL.h MvStopWatch.h MvVersionInfo.h Rectangle.h Request.h UtilitiesC.h auto_ptr.h
++MvSTL.h MvStopWatch.h MvVersionInfo.h Rectangle.h Request.h UtilitiesC.h
+ bits.h gdefines.h inc_iostream.h inc_stl.h min_max_macros.h
+ xec.h
+ Assertions.hpp Box.hpp Factory.hpp Grib.hpp
+Index: metview-4.6.5/src/libUtil/inc_stl.h
+===================================================================
+--- metview-4.6.5.orig/src/libUtil/inc_stl.h
++++ metview-4.6.5/src/libUtil/inc_stl.h
+@@ -30,7 +30,7 @@
+ #ifndef NOUSING
+ //-- for HPUX aCC
+ 
+-using std::auto_ptr;
++using std::unique_ptr;
+ using std::less;
+ using std::list;
+ using std::map;
+Index: metview-4.6.5/src/uPlot/Canvas.h
+===================================================================
+--- metview-4.6.5.orig/src/uPlot/Canvas.h
++++ metview-4.6.5/src/uPlot/Canvas.h
+@@ -195,7 +195,7 @@ protected:
+ 	// Members
+         Device&   myDevice_;   // pointer to the device
+ 
+-//D	auto_ptr <DeviceDriver>  canvasDeviceDriver_; //  Pointer to the deviceDriver
++//D	unique_ptr <DeviceDriver>  canvasDeviceDriver_; //  Pointer to the deviceDriver
+ 
+ 	double aspectRatio_;         // aspectRatio must be preserved
+ 
+Index: metview-4.6.5/src/uPlot/CartesianView.cc
+===================================================================
+--- metview-4.6.5.orig/src/uPlot/CartesianView.cc
++++ metview-4.6.5/src/uPlot/CartesianView.cc
+@@ -253,7 +253,7 @@ void CartesianView::DecodeDataUnit ( MvI
+ 
+ 	// Build a new data decoder, which will provide information
+ 	// about the data
+-	auto_ptr<Decoder> decoder ( DecoderFactory::Make ( givenUnit.Request() ) );
++	unique_ptr<Decoder> decoder ( DecoderFactory::Make ( givenUnit.Request() ) );
+ 	ensure (decoder.get() != 0);
+ 
+ 	int subpageId = 0;
+Index: metview-4.6.5/src/uPlot/CommonXSectView.cc
+===================================================================
+--- metview-4.6.5.orig/src/uPlot/CommonXSectView.cc
++++ metview-4.6.5/src/uPlot/CommonXSectView.cc
+@@ -387,7 +387,7 @@ void CommonXSectView::DecodeDataUnit ( M
+ 
+     // Build a new data decoder, which will provide information
+     // about the data
+-    auto_ptr<Decoder> decoder ( DecoderFactory::Make ( dataUnit.Request() ) );
++    unique_ptr<Decoder> decoder ( DecoderFactory::Make ( dataUnit.Request() ) );
+     ensure (decoder.get() != 0);
+ 
+     int subpageId = 0;
+@@ -514,7 +514,7 @@ bool CommonXSectView::NetCDFtoMatrix(MvI
+   MvRequest Matrix = du.Request();
+ 
+   MvRequest dcRequest =  Matrix.getSubrequest("_DC_REQUEST" );
+-  auto_ptr<Decoder> decoder ( DecoderFactory::Make ( dcRequest ) );
++  unique_ptr<Decoder> decoder ( DecoderFactory::Make ( dcRequest ) );
+ 
+   int offset = Matrix("_OFFSET");
+   const char *fullName = Matrix("_FILE_NAME");
+Index: metview-4.6.5/src/uPlot/DataBuilder.cc
+===================================================================
+--- metview-4.6.5.orig/src/uPlot/DataBuilder.cc
++++ metview-4.6.5/src/uPlot/DataBuilder.cc
+@@ -50,7 +50,7 @@ DataBuilder::Execute (PmContext& context
+   // Then try to get from contents of file
+   if ( ! (const char *)viewName )
+   {
+-      auto_ptr<Decoder> decoder ( DecoderFactory::Make ( context.InRequest() ) );
++      unique_ptr<Decoder> decoder ( DecoderFactory::Make ( context.InRequest() ) );
+       viewName = decoder->GetView();
+   }
+ #endif
+Index: metview-4.6.5/src/uPlot/GeoView.cc
+===================================================================
+--- metview-4.6.5.orig/src/uPlot/GeoView.cc
++++ metview-4.6.5/src/uPlot/GeoView.cc
+@@ -213,7 +213,7 @@ void GeoView::DecodeDataUnit ( MvIcon& d
+     MvIconDataBase& dataBase = Owner().IconDataBase();
+ 
+     // Build a new data decoder, which will provide information about the data
+-    auto_ptr<Decoder> decoder ( DecoderFactory::Make ( dataUnit.Request() ) );
++    unique_ptr<Decoder> decoder ( DecoderFactory::Make ( dataUnit.Request() ) );
+     ensure (decoder.get() != 0);
+ 
+     // Inquire if this Page is empty
+@@ -877,7 +877,7 @@ void GeoView::UpdateView ( MvRequest& vi
+         viewRequest_ = viewRequest;
+ 
+         // Create a view associated to the page
+-        auto_ptr <PlotModView> view ( PlotModViewFactory::Make (Owner(), viewRequest ) );
++        unique_ptr <PlotModView> view ( PlotModViewFactory::Make (Owner(), viewRequest ) );
+         Owner().SetView(view);
+         #endif
+    }
+Index: metview-4.6.5/src/uPlot/MapView.cc
+===================================================================
+--- metview-4.6.5.orig/src/uPlot/MapView.cc
++++ metview-4.6.5/src/uPlot/MapView.cc
+@@ -207,7 +207,7 @@ void MapView::DecodeDataUnit ( MvIcon& d
+ 
+     // Build a new data decoder, which will provide information
+     // about the data
+-    auto_ptr<Decoder> decoder ( DecoderFactory::Make ( dataUnit.Request() ) );
++    unique_ptr<Decoder> decoder ( DecoderFactory::Make ( dataUnit.Request() ) );
+     ensure (decoder.get() != 0);
+ 
+     // Inquire if this Page is empty
+@@ -380,7 +380,7 @@ MapView::UpdateView ( MvRequest& viewReq
+       viewRequest_ = viewRequest;
+ 
+       // Create a view associated to the page
+-      auto_ptr <PlotModView> view ( PlotModViewFactory::Make (Owner(), viewRequest ) );
++      unique_ptr <PlotModView> view ( PlotModViewFactory::Make (Owner(), viewRequest ) );
+       Owner().SetView(view);
+       #endif
+    }
+Index: metview-4.6.5/src/uPlot/Page.cc
+===================================================================
+--- metview-4.6.5.orig/src/uPlot/Page.cc
++++ metview-4.6.5/src/uPlot/Page.cc
+@@ -29,15 +29,15 @@ Page::Page ( MvRequest& pageRequest ):
+            dropShouldStay_(false)
+ {
+    // Each page has its own graphics engine
+-   auto_ptr <GraphicsEngine> eng ( GraphicsEngineFactory::Make ( *this ) );
+-   engine_ = eng;
++   unique_ptr <GraphicsEngine> eng ( GraphicsEngineFactory::Make ( *this ) );
++   engine_ = move(eng);
+ 
+    // Find out if there is a view associated with the request
+    MvRequest viewRequest = pageRequest.getSubrequest( "VIEW" );
+    const char* viewClass = (const char*)viewRequest.getVerb();
+    if ( viewClass && ObjectList::IsGeographicalView(viewClass) )
+    {
+-      auto_ptr <PmProjection> proj ( PmProjectionFactory::Make ( viewRequest ) );
++      unique_ptr <PmProjection> proj ( PmProjectionFactory::Make ( viewRequest ) );
+ 
+       // If AREA is not given, Magics will use the default value
+       if ( (const char*)viewRequest("AREA") )
+@@ -74,8 +74,8 @@ Page::Page ( MvRequest& pageRequest ):
+    }
+ 
+    // Create a view associated to the page
+-   auto_ptr <PlotModView> view ( PlotModViewFactory::Make (*this, viewRequest ) );
+-   myView_ = view;
++   unique_ptr <PlotModView> view ( PlotModViewFactory::Make (*this, viewRequest ) );
++   myView_ = move(view);
+ 
+    // By default, indicates that a drawing needs to be performed later.
+    // This default will be overrulled if the dropping icon triggers a call
+@@ -96,16 +96,16 @@ Page::Page ( const Page & old ):
+ {
+    // ZoomStacks not copied
+    // Easiest to make new projection from view request
+-   auto_ptr<PmProjection> proj(  PmProjectionFactory::Make ( old.myView_->ViewRequest() ) );
+-   projection_ = proj;
++   unique_ptr<PmProjection> proj(  PmProjectionFactory::Make ( old.myView_->ViewRequest() ) );
++   projection_ = move(proj);
+ 
+    // Each page has its own graphics engine, create one for this page
+-   auto_ptr <GraphicsEngine> eng ( GraphicsEngineFactory::Make ( *this ) );
+-   engine_ = eng;
++   unique_ptr <GraphicsEngine> eng ( GraphicsEngineFactory::Make ( *this ) );
++   engine_ = move(eng);
+ 
+    // Clone the view associated to the page and set the new owner.
+-   auto_ptr <PlotModView> view ( old.GetView().Clone() ) ;
+-   myView_ = view;
++   unique_ptr <PlotModView> view ( old.GetView().Clone() ) ;
++   myView_ = move(view);
+    myView_->Owner(*this);
+ }
+ 
+@@ -1268,9 +1268,9 @@ void
+ Page::SetProjection ( const MvRequest& viewRequest )
+ {
+ 	// Initialize projection based on a request
+-	auto_ptr <PmProjection> proj ( PmProjectionFactory::Make ( viewRequest ) );
++	unique_ptr <PmProjection> proj ( PmProjectionFactory::Make ( viewRequest ) );
+ 
+-	projection_ = proj;
++	projection_ = move(proj);
+ }
+ 
+ #if 0
+Index: metview-4.6.5/src/uPlot/Page.h
+===================================================================
+--- metview-4.6.5.orig/src/uPlot/Page.h
++++ metview-4.6.5/src/uPlot/Page.h
+@@ -233,8 +233,8 @@ public:
+ 	virtual PlotModView& GetView() const
+ 		{ return *myView_; }
+ 
+-        void SetView(auto_ptr<PlotModView>& newView)
+-                 { myView_ = newView; } 
++        void SetView(unique_ptr<PlotModView>& newView)
++                 { myView_ = move(newView); } 
+ 
+ 	int FirstPrintable ();
+ 
+@@ -296,9 +296,9 @@ private:
+    Page& operator=(const Page&);
+ 
+    // Members
+-   auto_ptr <PlotModView> myView_;
++   unique_ptr <PlotModView> myView_;
+ 
+-   auto_ptr <GraphicsEngine> engine_;
++   unique_ptr <GraphicsEngine> engine_;
+ 
+    int firstVisible_;
+    int visibleCount_;
+@@ -308,7 +308,7 @@ private:
+ 
+    bool dropShouldStay_;
+ 
+-   auto_ptr <PmProjection> projection_;  // projection associated with page
++   unique_ptr <PmProjection> projection_;  // projection associated with page
+    DrawingPriority drawingPriority_;
+ };
+ 
+Index: metview-4.6.5/src/uPlot/Presentable.cc
+===================================================================
+--- metview-4.6.5.orig/src/uPlot/Presentable.cc
++++ metview-4.6.5/src/uPlot/Presentable.cc
+@@ -848,8 +848,8 @@ void
+ Presentable::SetDeviceData ( DeviceData* devdata )
+ { 
+ 	require ( devdata != 0 );
+-	auto_ptr <DeviceData> p ( devdata );
+-	deviceData_ = p;
++	unique_ptr <DeviceData> p ( devdata );
++	deviceData_ = move(p);
+ }
+ 
+ DeviceData*
+@@ -1376,7 +1376,7 @@ void Presentable::GetDataUnitInfo ( MvRe
+    {
+       // Build a new data decoder, which will provide information
+       // about the data
+-      auto_ptr<Decoder> decoder ( DecoderFactory::Make ((*lCursor).Request() ) );
++      unique_ptr<Decoder> decoder ( DecoderFactory::Make ((*lCursor).Request() ) );
+       ensure (decoder.get() != 0);
+ 
+       // Read data headers (one by one)
+Index: metview-4.6.5/src/uPlot/Presentable.h
+===================================================================
+--- metview-4.6.5.orig/src/uPlot/Presentable.h
++++ metview-4.6.5/src/uPlot/Presentable.h
+@@ -405,7 +405,7 @@ protected:
+    MvRequest myRequest_;               // request used to build me
+    int presentableId_;                 // unique Id
+    Presentable* myParent_;             // next level up on the tree
+-   auto_ptr <DeviceData > deviceData_; // information on the device
++   unique_ptr <DeviceData > deviceData_; // information on the device
+    Location myLocation_;               // position of the presentable
+ 
+    // Definition for the tree hierarchy of the Presentable class
+Index: metview-4.6.5/src/uPlot/SuperPage.cc
+===================================================================
+--- metview-4.6.5.orig/src/uPlot/SuperPage.cc
++++ metview-4.6.5/src/uPlot/SuperPage.cc
+@@ -120,8 +120,8 @@ SuperPage::SuperPage(const SuperPage &ol
+   printIndex_(0)
+ {
+ 	// Make a new icon db from the old one
+-	auto_ptr<MvIconDataBase> iconDb( new MvIconDataBase(old.IconDataBase() ) );
+-	iconDataBase_ = iconDb;
++	unique_ptr<MvIconDataBase> iconDb( new MvIconDataBase(old.IconDataBase() ) );
++	iconDataBase_ = move(iconDb);
+ 
+ 	// Set new owner for preferences
+ 	preferences_.Owner(*this);
+@@ -396,9 +396,9 @@ SuperPage::SetDeviceInfo ( const MvReque
+ 	// appropriate device Request
+ 	MvRequest deviceRequest = Device::CreateRequest ( inRequest );
+ 
+-	auto_ptr <Device> dev ( DeviceFactory::Make ( deviceRequest ) );
++	unique_ptr <Device> dev ( DeviceFactory::Make ( deviceRequest ) );
+ 
+-	myDevice_ = dev;
++	myDevice_ = move(dev);
+ 
+ 	// The device is a visitor - this command will trigger
+ 	// its visit (i.e., its traversal through the page hierarchy)
+@@ -439,7 +439,7 @@ SuperPage::GenerateMacro( )
+ 	macroFileName_ = MacroVisitor::CreateFileName ( myRequest_ );
+ 
+ 	// Create a new visitor
+-	auto_ptr <Visitor> vis ( new MacroVisitor ( macroFileName_ ) );
++	unique_ptr <Visitor> vis ( new MacroVisitor ( macroFileName_ ) );
+ 
+ 	// Visit me
+ 	vis->Visit (*this);
+Index: metview-4.6.5/src/uPlot/SuperPage.h
+===================================================================
+--- metview-4.6.5.orig/src/uPlot/SuperPage.h
++++ metview-4.6.5/src/uPlot/SuperPage.h
+@@ -299,8 +299,8 @@ public:
+     // Members
+     PaperSize                 size_;            // size of superpage in paper coords (cms)
+     string                    macroFileName_;   // name of the macro file which is produced
+-    auto_ptr <MvIconDataBase> iconDataBase_;    // icon data base (one per superpage)
+-    auto_ptr <Device>         myDevice_;        // device (plot media)
++    unique_ptr <MvIconDataBase> iconDataBase_;    // icon data base (one per superpage)
++    unique_ptr <Device>         myDevice_;        // device (plot media)
+     Preferences               preferences_;     // preferences associated to the superpage
+ 
+ #if 0
diff --git a/debian/patches/cmake-fixes.patch b/debian/patches/cmake-fixes.patch
index db2ec9e..05bc3a7 100644
--- a/debian/patches/cmake-fixes.patch
+++ b/debian/patches/cmake-fixes.patch
@@ -1,7 +1,7 @@
-Index: metview-4.6.1/CMakeLists.txt
+Index: metview-4.6.5/CMakeLists.txt
 ===================================================================
---- metview-4.6.1.orig/CMakeLists.txt
-+++ metview-4.6.1/CMakeLists.txt
+--- metview-4.6.5.orig/CMakeLists.txt
++++ metview-4.6.5/CMakeLists.txt
 @@ -134,7 +134,7 @@ endif()
  
  if(MARS_SOURCE_PATH)
@@ -11,10 +11,10 @@ Index: metview-4.6.1/CMakeLists.txt
  else()
      # otherwise look in some default locations
      set(MARS_SOURCE_PATHS ${CMAKE_SOURCE_DIR}/src/libMars         # embedded in source
-Index: metview-4.6.1/share/metview/etc/CMakeLists.txt
+Index: metview-4.6.5/share/metview/etc/CMakeLists.txt
 ===================================================================
---- metview-4.6.1.orig/share/metview/etc/CMakeLists.txt
-+++ metview-4.6.1/share/metview/etc/CMakeLists.txt
+--- metview-4.6.5.orig/share/metview/etc/CMakeLists.txt
++++ metview-4.6.5/share/metview/etc/CMakeLists.txt
 @@ -148,7 +148,7 @@ set(extra_install_files macro_built_in_f
  
  ADD_CUSTOM_COMMAND(
@@ -42,10 +42,10 @@ Index: metview-4.6.1/share/metview/etc/CMakeLists.txt
      DEPENDS ${FULL_STARTUP_SCRIPT_PATH} ${dict_file} ${metview_core_targets}
  )
  
-Index: metview-4.6.1/scripts/metview_base.in
+Index: metview-4.6.5/scripts/metview_base.in
 ===================================================================
---- metview-4.6.1.orig/scripts/metview_base.in
-+++ metview-4.6.1/scripts/metview_base.in
+--- metview-4.6.5.orig/scripts/metview_base.in
++++ metview-4.6.5/scripts/metview_base.in
 @@ -17,14 +17,14 @@ set -ea
  # THIS FILE IS GENERATED BY cmake on @TODAYS_DATE@
  #
diff --git a/debian/patches/fix-bashisms.patch b/debian/patches/fix-bashisms.patch
index e1e44de..5d1f39e 100644
--- a/debian/patches/fix-bashisms.patch
+++ b/debian/patches/fix-bashisms.patch
@@ -3,10 +3,10 @@ Description: Remove bashisms to that we can use the dash shell
 Last-Updated: 2016-02-14
 Forwarded: no
 
-Index: metview-4.6.1/scripts/logrun
+Index: metview-4.6.5/scripts/logrun
 ===================================================================
---- metview-4.6.1.orig/scripts/logrun
-+++ metview-4.6.1/scripts/logrun
+--- metview-4.6.5.orig/scripts/logrun
++++ metview-4.6.5/scripts/logrun
 @@ -31,12 +31,14 @@ else
    # -- create log file --
    echo "[logrun info] process $$ starting `date` with cmd:" > $MYLOG
diff --git a/debian/patches/fix-paths.patch b/debian/patches/fix-paths.patch
deleted file mode 100644
index ee4336b..0000000
--- a/debian/patches/fix-paths.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Author: Alastair McKinstry <mckinstry at debian.org>
-Description: Fix patch of ksh on Debian systems.
-Forwarded: no
-Last-Updated: 2014-02-23
-
-Index: metview-4.4.7+dfsg.1/scripts/mv_flextra_prep
-===================================================================
---- metview-4.4.7+dfsg.1.orig/scripts/mv_flextra_prep
-+++ metview-4.4.7+dfsg.1/scripts/mv_flextra_prep
-@@ -1,4 +1,4 @@
--#!/usr/bin/ksh
-+#!/bin/ksh
- 
- # **************************** LICENSE START ***********************************
- #
diff --git a/debian/patches/fix-scripts.patch b/debian/patches/fix-scripts.patch
index 5bae458..516ef2a 100644
--- a/debian/patches/fix-scripts.patch
+++ b/debian/patches/fix-scripts.patch
@@ -4,57 +4,57 @@ Description: Ensure all scripts have a correct start line
 Forwarded: not-needed
 Last-Updated: 2016-01-11
 
-Index: metview-4.6.1/scripts/document_macros.pl
+Index: metview-4.6.5/scripts/document_macros.pl
 ===================================================================
---- metview-4.6.1.orig/scripts/document_macros.pl
-+++ metview-4.6.1/scripts/document_macros.pl
+--- metview-4.6.5.orig/scripts/document_macros.pl
++++ metview-4.6.5/scripts/document_macros.pl
 @@ -1,4 +1,4 @@
 -
 +#!/usr/bin/perl
  # **************************** LICENSE START ***********************************
  #
  # Copyright 2012 ECMWF and INPE. This software is distributed under the terms
-Index: metview-4.6.1/scripts/metview_help
+Index: metview-4.6.5/scripts/metview_help
 ===================================================================
---- metview-4.6.1.orig/scripts/metview_help
-+++ metview-4.6.1/scripts/metview_help
+--- metview-4.6.5.orig/scripts/metview_help
++++ metview-4.6.5/scripts/metview_help
 @@ -1,4 +1,4 @@
 -
 +#!/bin/sh
  # **************************** LICENSE START ***********************************
  #
  # Copyright 2014 ECMWF and INPE. This software is distributed under the terms
-Index: metview-4.6.1/scripts/mv_flextra_prep.mv
+Index: metview-4.6.5/scripts/mv_flextra_prep.mv
 ===================================================================
---- metview-4.6.1.orig/scripts/mv_flextra_prep.mv
-+++ metview-4.6.1/scripts/mv_flextra_prep.mv
+--- metview-4.6.5.orig/scripts/mv_flextra_prep.mv
++++ metview-4.6.5/scripts/mv_flextra_prep.mv
 @@ -1,3 +1,4 @@
 +#!/usr/bin/metview
  # Metview Macro
  
  # **************************** LICENSE START ***********************************
-Index: metview-4.6.1/scripts/mv_mars_catalog.py
+Index: metview-4.6.5/scripts/mv_mars_catalog.py
 ===================================================================
---- metview-4.6.1.orig/scripts/mv_mars_catalog.py
-+++ metview-4.6.1/scripts/mv_mars_catalog.py
+--- metview-4.6.5.orig/scripts/mv_mars_catalog.py
++++ metview-4.6.5/scripts/mv_mars_catalog.py
 @@ -1,3 +1,4 @@
 +#!/usr/bin/python
  # Copyright 2012 ECMWF and INPE. This software is distributed under the terms
  # of the Apache License version 2.0. In applying this license, ECMWF does not
  # waive the privileges and immunities granted to it by virtue of its status as
-Index: metview-4.6.1/scripts/mv_scm_vis.mv
+Index: metview-4.6.5/scripts/mv_scm_vis.mv
 ===================================================================
---- metview-4.6.1.orig/scripts/mv_scm_vis.mv
-+++ metview-4.6.1/scripts/mv_scm_vis.mv
+--- metview-4.6.5.orig/scripts/mv_scm_vis.mv
++++ metview-4.6.5/scripts/mv_scm_vis.mv
 @@ -1,3 +1,4 @@
 +#!/usr/bin/metview 
  # Metview Macro
  
  # **************************** LICENSE START ***********************************
-Index: metview-4.6.1/scripts/mv_vapor_prep.mv
+Index: metview-4.6.5/scripts/mv_vapor_prep.mv
 ===================================================================
---- metview-4.6.1.orig/scripts/mv_vapor_prep.mv
-+++ metview-4.6.1/scripts/mv_vapor_prep.mv
+--- metview-4.6.5.orig/scripts/mv_vapor_prep.mv
++++ metview-4.6.5/scripts/mv_vapor_prep.mv
 @@ -1,3 +1,4 @@
 +#!/usr/bin/magml
  # Metview Macro
@@ -67,10 +67,10 @@ Index: metview-4.6.1/scripts/mv_vapor_prep.mv
 -end listToString 
 \ No newline at end of file
 +end listToString 
-Index: metview-4.6.1/scripts/metview_base.in
+Index: metview-4.6.5/scripts/metview_base.in
 ===================================================================
---- metview-4.6.1.orig/scripts/metview_base.in
-+++ metview-4.6.1/scripts/metview_base.in
+--- metview-4.6.5.orig/scripts/metview_base.in
++++ metview-4.6.5/scripts/metview_base.in
 @@ -17,13 +17,14 @@ set -ea
  # THIS FILE IS GENERATED BY cmake on @TODAYS_DATE@
  #
diff --git a/debian/patches/fpic.patch b/debian/patches/fpic.patch
index 9ae8cef..d09fb92 100644
--- a/debian/patches/fpic.patch
+++ b/debian/patches/fpic.patch
@@ -5,11 +5,11 @@ Description: Add FPIC support
 Last-Updated: 2015-11-09
 Forwarded: no
 
-Index: metview-4.6.1/CMakeLists.txt
+Index: metview-4.5.7/CMakeLists.txt
 ===================================================================
---- metview-4.6.1.orig/CMakeLists.txt
-+++ metview-4.6.1/CMakeLists.txt
-@@ -662,6 +662,9 @@ endif()
+--- metview-4.5.7.orig/CMakeLists.txt
++++ metview-4.5.7/CMakeLists.txt
+@@ -768,6 +768,9 @@ endif()
  # -------------------------
  # compiler-specific options
  # -------------------------
diff --git a/debian/patches/g++-6.patch b/debian/patches/g++-6.patch
index e95323b..48ad25a 100644
--- a/debian/patches/g++-6.patch
+++ b/debian/patches/g++-6.patch
@@ -3,10 +3,10 @@ Description: Fixes for G++-6
 Last-Updated: 2016-02-14
 Forwarded: no
 
-Index: metview-4.6.1/src/libMarsClient/rpcmars.x
+Index: metview-4.6.5/src/libMarsClient/rpcmars.x
 ===================================================================
---- metview-4.6.1.orig/src/libMarsClient/rpcmars.x
-+++ metview-4.6.1/src/libMarsClient/rpcmars.x
+--- metview-4.6.5.orig/src/libMarsClient/rpcmars.x
++++ metview-4.6.5/src/libMarsClient/rpcmars.x
 @@ -2,7 +2,7 @@
  %#include <rpc/xdr.h>
  #ifdef RPC_HDR
@@ -25,10 +25,10 @@ Index: metview-4.6.1/src/libMarsClient/rpcmars.x
  	long             order;
  #endif
  
-Index: metview-4.6.1/src/libUtil/MvFlextra.cc
+Index: metview-4.6.5/src/libUtil/MvFlextra.cc
 ===================================================================
---- metview-4.6.1.orig/src/libUtil/MvFlextra.cc
-+++ metview-4.6.1/src/libUtil/MvFlextra.cc
+--- metview-4.6.5.orig/src/libUtil/MvFlextra.cc
++++ metview-4.6.5/src/libUtil/MvFlextra.cc
 @@ -11,6 +11,7 @@
  
  #include "MvDate.h"
diff --git a/debian/patches/hurd.patch b/debian/patches/hurd.patch
index ea30f9a..9b391df 100644
--- a/debian/patches/hurd.patch
+++ b/debian/patches/hurd.patch
@@ -3,10 +3,10 @@ Description: Fix for FTBFS on Hurd
 Last-Updated: 2016-01-02
 Forwarded: no
 
-Index: metview-4.6.1/src/libMarsClient/mars.h
+Index: metview-4.6.5/src/libMarsClient/mars.h
 ===================================================================
---- metview-4.6.1.orig/src/libMarsClient/mars.h
-+++ metview-4.6.1/src/libMarsClient/mars.h
+--- metview-4.6.5.orig/src/libMarsClient/mars.h
++++ metview-4.6.5/src/libMarsClient/mars.h
 @@ -694,6 +694,12 @@ typedef void* msockopt;
  
  #endif
diff --git a/debian/patches/mv_compress.patch b/debian/patches/mv_compress.patch
index 0a702ab..7774b6b 100644
--- a/debian/patches/mv_compress.patch
+++ b/debian/patches/mv_compress.patch
@@ -1,7 +1,7 @@
-Index: metview-4.6.1/scripts/mv_compress
+Index: metview-4.6.5/scripts/mv_compress
 ===================================================================
---- metview-4.6.1.orig/scripts/mv_compress
-+++ metview-4.6.1/scripts/mv_compress
+--- metview-4.6.5.orig/scripts/mv_compress
++++ metview-4.6.5/scripts/mv_compress
 @@ -25,7 +25,7 @@ text_ERR="ERROR: script `basename $0` FA
  
  #The original version of this function was taken from: 
diff --git a/debian/patches/reproducible-build.patch b/debian/patches/reproducible-build.patch
index 747470f..0f69874 100644
--- a/debian/patches/reproducible-build.patch
+++ b/debian/patches/reproducible-build.patch
@@ -3,17 +3,17 @@ Description: Hard-code dates to make the build bit-reproducible
 Last-Updated: 2016-01-05
 Forwarded: not-needed
 
-Index: metview-4.6.1/share/metview/app-defaults/MvVersionDetails.in
+Index: metview-4.6.5/share/metview/app-defaults/MvVersionDetails.in
 ===================================================================
---- metview-4.6.1.orig/share/metview/app-defaults/MvVersionDetails.in
-+++ metview-4.6.1/share/metview/app-defaults/MvVersionDetails.in
+--- metview-4.6.5.orig/share/metview/app-defaults/MvVersionDetails.in
++++ metview-4.6.5/share/metview/app-defaults/MvVersionDetails.in
 @@ -1 +1 @@
 -1 Metview @metview_MAJOR_VERSION_STR@ @metview_MINOR_VERSION_STR@ @metview_REVISION_VERSION_STR@ @THIS_YEAR@ 1990- at THIS_YEAR@ @THIS_VERBOSE_DATE@
 +1 Metview @metview_MAJOR_VERSION_STR@ @metview_MINOR_VERSION_STR@ @metview_REVISION_VERSION_STR@ 2015 1990-2015 21-October-2015
-Index: metview-4.6.1/scripts/metview_base.in
+Index: metview-4.6.5/scripts/metview_base.in
 ===================================================================
---- metview-4.6.1.orig/scripts/metview_base.in
-+++ metview-4.6.1/scripts/metview_base.in
+--- metview-4.6.5.orig/scripts/metview_base.in
++++ metview-4.6.5/scripts/metview_base.in
 @@ -14,8 +14,6 @@
  #
  set -ea
diff --git a/debian/patches/series b/debian/patches/series
index 97f587a..c75edbd 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,3 @@
-fix-paths.patch
 fix-scripts.patch
 cmake-fixes.patch
 mv_compress.patch
@@ -6,4 +5,3 @@ reproducible-build.patch
 fpic.patch
 hurd.patch
 fix-bashisms.patch
-g++-6.patch
diff --git a/debian/rules b/debian/rules
index 3e6546e..e3acb64 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,6 +8,7 @@ DEB_BUILD_MAINT_OPTIONS:= hardening=+all,-format
 DEB_CFLAGS_MAINT_APPEND:= -Wall -pedantic -fPIC
 export DEB_BUILD_MAINT_OPTIONS DEB_CFLAGS_MAINT_APPEND DEB_LDFLAGS_MAINT_PREPEND
 export QT_SELECT=5
+CXXFLAGS:= $(shell dpkg-buildflags --get CXXFLAGS) -std=c++11
 
 # Needed for sbuild. metview creates temp directories during build
 export HOME:=/tmp
@@ -23,6 +24,8 @@ AUTOGENERATED:= libmetview-dev.install  metview.install
 MV_DIR:=/usr/lib/$(DEB_HOST_MULTIARCH)/metview
 export METVIEW_DIR_DEV:=$(CURDIR)/debian/build
 export METVIEW_BIN:=$(METVIEW_DIR_DEV)/bin
+LC_ALL=C
+export LC_ALL
 
 FPIC:= ''
 
@@ -75,6 +78,7 @@ override_dh_auto_configure:
 	# so copy pre-generated versions stored in etc
 	mkdir -p debian/build/share/metview/etc/
 	cp debian/etc/* debian/build/share/metview/etc/
+	cd debian/build/share/metview/etc && $(MAKE) ObjectListAllTarget
 
 override_dh_auto_test:
 	@echo "Checks disabled for the moment due to syntax errors in tests" 
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..5998774
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,4 @@
+version=3
+# https://software.ecmwf.int/wiki/display/METV/Releases Metview\-(.+)\-Source\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))\?api=v(.+)
+https://software.ecmwf.int/wiki/display/METV/Releases /wiki/download/attachments/.*/Metview\-(.+)\-Source.tar.gz?api=v2
+
diff --git a/project_summary.cmake b/project_summary.cmake
index 95e0483..e661835 100644
--- a/project_summary.cmake
+++ b/project_summary.cmake
@@ -1,40 +1,45 @@
 foreach( _tpl ${METVIEW_TPLS} )
 	string( TOUPPER ${_tpl} TPL )
 	if( ${TPL}_FOUND )
-		message( STATUS "   ${_tpl} ${${_tpl}_VERSION}" )
+		ecbuild_info("   ${_tpl} ${${_tpl}_VERSION}" )
 		if( ${TPL}_INCLUDE_DIRS )
-		  message( STATUS "      includes : [${${TPL}_INCLUDE_DIRS}]" )
+		  ecbuild_info("      includes : [${${TPL}_INCLUDE_DIRS}]" )
 		endif()
 		if( ${TPL}_LIBRARIES )
-		  message( STATUS "      libs     : [${${TPL}_LIBRARIES}]" )
+		  ecbuild_info("      libs     : [${${TPL}_LIBRARIES}]" )
 		endif()
 		if( ${TPL}_DEFINITIONS )
-		  message( STATUS "      defs     : [${${TPL}_DEFINITIONS}]" )
+		  ecbuild_info("      defs     : [${${TPL}_DEFINITIONS}]" )
 		endif()
 	endif()
 endforeach()
 
 if(WITH_PLOTTING)
-    message(STATUS "      Magics includes : [${MAGICS_INCLUDE_DIRS}]")
-    message(STATUS "      Magics libs     : [${MAGICS_LIBRARIES}]")
-    message(STATUS "      Magics defs     : [${MAGICS_DEFINITIONS}]")
+    ecbuild_info("      Magics includes : [${MAGICS_INCLUDE_DIRS}]")
+    ecbuild_info("      Magics libs     : [${MAGICS_LIBRARIES}]")
+    ecbuild_info("      Magics defs     : [${MAGICS_DEFINITIONS}]")
 endif()
 
-message(STATUS "      MARS access  : " ${MARS_ACCESS})
-message(STATUS "      UI           : " ${ENABLE_UI})
-message(STATUS "      Motif        : " ${ENABLE_MOTIF})
-message(STATUS "      Plotting     : " ${ENABLE_PLOTTING})
-message(STATUS "      OPERA Radar  : " ${ENABLE_OPERA_RADAR})
-message(STATUS "      MARS access  : " ${ENABLE_MARS})
-message(STATUS "      ODB          : " ${ENABLE_ODB})
-message(STATUS "      MARS_ODB     : " ${ENABLE_MARS_ODB})
-message(STATUS "      Usage log    : " ${ENABLE_USAGE_LOG})
-message(STATUS "      Log dir      : " ${LOG_DIR})
-message(STATUS "      INPE access  : " ${ENABLE_INPE})
-message(STATUS "      Weather Room : " ${ENABLE_WEATHER_ROOM})
-message(STATUS "      Experimental : " ${ENABLE_EXPERIMENTAL})
-message(STATUS "      Contrib      : " ${ENABLE_CONTRIB})
+ecbuild_info("      MARS access  :  ${MARS_ACCESS}")
+ecbuild_info("      UI           :  ${ENABLE_UI}")
+ecbuild_info("      Motif        :  ${ENABLE_MOTIF}")
+ecbuild_info("      Plotting     :  ${ENABLE_PLOTTING}")
+ecbuild_info("      OPERA Radar  :  ${ENABLE_OPERA_RADAR}")
+ecbuild_info("      MARS access  :  ${ENABLE_MARS}")
+ecbuild_info("      ODB          :  ${ENABLE_ODB}")
+ecbuild_info("      MARS_ODB     :  ${ENABLE_MARS_ODB}")
+ecbuild_info("      Usage log    :  ${ENABLE_USAGE_LOG}")
+ecbuild_info("      Log dir      :  ${LOG_DIR}")
+ecbuild_info("      INPE access  :  ${ENABLE_INPE}")
+ecbuild_info("      Weather Room :  ${ENABLE_WEATHER_ROOM}")
+ecbuild_info("      URL download :  ${ENABLE_URL_DOWNLOAD}")
+ecbuild_info("      Experimental :  ${ENABLE_EXPERIMENTAL}")
+ecbuild_info("      Contrib      :  ${ENABLE_CONTRIB}")
+
+if(NOT CURL_FOUND)
+ecbuild_warn("      If you would like to use the Download module or the MARS Web API, please install the 'curl' development package")
+endif()
 
 
-message(STATUS "")
-message(STATUS " Built ${PROJECT_NAME} version ${${PROJECT_NAME}_VERSION_STR}")
+ecbuild_info("")
+ecbuild_info(" Built ${PROJECT_NAME} version ${${PROJECT_NAME}_VERSION_STR}")
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 5cfccdd..62a30f2 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -21,7 +21,7 @@ set(scripts
 )
 
 if(AT_ECMWF)
-    list(APPEND scripts mv_debug_env.sh)
+    list(APPEND scripts mv_debug_env.sh metgram.py)
 endif()
 
 
@@ -51,13 +51,27 @@ list(REMOVE_ITEM GRIB_API_LIBRARIES_STR "debug")     # remove non-compiler items
 list(REMOVE_ITEM GRIB_API_LIBRARIES_STR "optimized") # remove non-compiler items from the string
 
 string (REPLACE ";"         " "           GRIB_API_LIBRARIES_STR    "${GRIB_API_LIBRARIES_STR}")
-string (REPLACE " grib_api" " -lgrib_api" GRIB_API_LIBRARIES_STR    "${GRIB_API_LIBRARIES_STR}")
+if( HAVE_ECCODES )
+  string (REPLACE " eccodes"  " -leccodes"  GRIB_API_LIBRARIES_STR  "${GRIB_API_LIBRARIES_STR}")
+else()
+  string (REPLACE " grib_api" " -lgrib_api" GRIB_API_LIBRARIES_STR  "${GRIB_API_LIBRARIES_STR}")
+endif()
 string (REPLACE ";"         " "           EMOS_LIBRARIES_STR        "${EMOS_LIB_PATH}")
 
 
 set(GRIB_API_LIBRARIES_STR "${GRIB_API_LIBRARIES_STR} ${PTHREAD_LIB}") # add pthread in case needed
+
+
+# we may need to add the netCDF lib dir to the rpath. We don't seem to have a variable
+# which tells us this directly, so we need to make an educated guess...
+if(DEFINED NETCDF_INCLUDE_DIR)
+    set(NETCDF_LIB_RPATH "-Wl,-rpath,${NETCDF_INCLUDE_DIR}/../lib64:${NETCDF_INCLUDE_DIR}/../lib")
+    set(GRIB_API_LIBRARIES_STR "${GRIB_API_LIBRARIES_STR} ${NETCDF_LIB_RPATH}")
+endif()
+
 set(GRIB_API_LIBRARIES_STR_ORIGINAL "${GRIB_API_LIBRARIES_STR}")       # keep a backup for later
 
+
 # if we are linking with shared GRIB_API libraries, then in order to be able
 # to run compiled inline Fortran/C/Macro programs, we will need to set
 # LD_LIBRARY_PATH to where GRIB_API was installed (this should only be
@@ -65,8 +79,12 @@ set(GRIB_API_LIBRARIES_STR_ORIGINAL "${GRIB_API_LIBRARIES_STR}")       # keep a
 # GRIB_API_LIB_DIR will be added to METVIEW_LD_PATHS and used in compile.in.
 
 # first, if GRIB_API_PATH is not defined, then we need to compute the path
+set( grib_handling_pkg grib_api )
+if( HAVE_ECCODES )
+  set( grib_handling_pkg eccodes )
+endif()
 if(NOT GRIB_API_PATH)
-    get_property(GRIB_LIB_PATH TARGET grib_api PROPERTY LIBRARY_OUTPUT_DIRECTORY)
+    get_property(GRIB_LIB_PATH TARGET ${grib_handling_pkg} PROPERTY LIBRARY_OUTPUT_DIRECTORY)
     if(GRIB_LIB_PATH)
         set(GRIB_API_PATH ${GRIB_LIB_PATH}/..)
     else()
@@ -78,7 +96,7 @@ if(NOT GRIB_API_PATH)
             endif()
         endif()
     endif()
-    message(STATUS "Computed GRIB_PATH: ${GRIB_API_PATH}")
+    ecbuild_info("Computed GRIB_PATH: ${GRIB_API_PATH}")
 endif()
 
 
@@ -117,10 +135,11 @@ configure_file(compile.in ${CMAKE_BINARY_DIR}/bin/compile @ONLY)
 # script which is the one that will actually be installed. In the case where
 # we're not building a bundle, these two compile scripts will be identical.
 
-if(DEFINED METVIEW_BUNDLE)
+if(DEFINED METVIEW_BUNDLE OR METVIEW_BUNDLE_TYPE STREQUAL "MMG")
     set(GRIB_API_LIBRARIES_STR    "-L${CMAKE_INSTALL_PREFIX}/lib ${GRIB_API_LIBRARIES_STR_ORIGINAL}")
     set(GRIB_API_INCLUDE_DIRS_STR "-I${CMAKE_INSTALL_PREFIX}/include")
     string(REPLACE "${CMAKE_BINARY_DIR}/lib"  "${CMAKE_INSTALL_PREFIX}/lib"    EMOS_LIBRARIES_STR  "${EMOS_LIBRARIES_STR}")
+    set(GRIB_API_PATH ${CMAKE_INSTALL_PREFIX})
 endif()
 
 configure_file(compile.in ${CMAKE_BINARY_DIR}/bin/compile_install @ONLY)
@@ -180,6 +199,29 @@ ecbuild_get_date(TODAYS_DATE)
 # endforeach()
 
 
+
+# MAGPLUS_HOME - under normal circumstances, we link with a specific
+# Magics library which knows where it's been installed, so we don't
+# need (or want) to set MAGPLUS_HOME, and in fact we want to avoid
+# the situation where a user sets it to the wrong path (as can happen
+# if a Magics module is set up by default in a user's environment).
+# So the simplest thing is to unset MAGPLUS_HOME and let the library
+# find its own resource files. This works fine if Magics has been
+# installed, but not if we are linking with a Magics in the build tree.
+# In this case MAGPLUS_HOME will need to point to the Magics source(!)
+# directory. In Magics 2.27.0 onwards, this is all taken care of by the
+# CMake variable MAFPLUS_HOME. If this is not set (i.e. earlier version
+# of Magics) then we just unset it. MV_MAGPLUS_HOME_PATH_SET is used
+# in metview_base.in.
+
+if(DEFINED MAGPLUS_HOME)
+    set(MV_MAGPLUS_HOME_PATH_SET "MAGPLUS_HOME=${MAGPLUS_HOME}")
+else()
+    set(MV_MAGPLUS_HOME_PATH_SET "unset MAGPLUS_HOME")
+endif()
+
+
+
 # create the Metview startup script
 configure_file(metview_base.in ${FULL_STARTUP_SCRIPT_PATH} @ONLY)
 
@@ -200,9 +242,25 @@ ADD_CUSTOM_TARGET(mvs ALL DEPENDS ${FULL_STARTUP_SCRIPT_PATH} ${PROD_TEMPORARY_S
 
 
 # when we install, we actually want to install the production script and rename it
+# NOTE: if building as part of a bundle, then we have the option (EXPOSE_SUBPACKAGES)
+# of installing everything apart from the startup script into a subdirectory so that
+# libs and executables from other packages don't clash with anything else on
+# the system. If we elect to do this (NOT EXPOSE_SUBPACKAGES) then we will have already
+# modified the CMAKE_INSTALL_PREFIX (in the bundle's top-level CMakeLists.txt file) to
+# put everything two levels deeper. But... we want the startup script to go
+# into the original CMAKE_INSTALL_PREFIX/bin directory
+
+if((DEFINED METVIEW_BUNDLE OR DEFINED METVIEW_BUNDLE_TYPE) AND (NOT ENABLE_EXPOSE_SUBPACKAGES))
+    set (STARTUP_SCRIPT_INSTALL_DIR "../../bin")
+else()
+    set (STARTUP_SCRIPT_INSTALL_DIR bin)
+endif()
+ecbuild_info("Startup script will be installed to: ${STARTUP_SCRIPT_INSTALL_DIR}")
+
+
 install( FILES       ${PROD_TEMPORARY_STARTUP_SCRIPT}
          RENAME      ${METVIEW_SCRIPT}
-         DESTINATION bin # NOT ${MV_BIN_DIR}!
+         DESTINATION ${STARTUP_SCRIPT_INSTALL_DIR} # NOT ${MV_BIN_DIR}!
          PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
 
 
diff --git a/scripts/MarsOdbWrapper b/scripts/MarsOdbWrapper
index dc67a7a..72af887 100644
--- a/scripts/MarsOdbWrapper
+++ b/scripts/MarsOdbWrapper
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/MarsTiggeWrapper b/scripts/MarsTiggeWrapper
index 7b064b2..49da222 100755
--- a/scripts/MarsTiggeWrapper
+++ b/scripts/MarsTiggeWrapper
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/ObstatToolWrapper b/scripts/ObstatToolWrapper
index d363681..a4af4b1 100644
--- a/scripts/ObstatToolWrapper
+++ b/scripts/ObstatToolWrapper
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/compile.in b/scripts/compile.in
index ab988fc..201bc7b 100755
--- a/scripts/compile.in
+++ b/scripts/compile.in
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
@@ -24,6 +24,11 @@
 #-- MACRO_EXTRA_CC_FLAGS can be set externally for extra C/C++ flags!
 #-- MACRO_EXTRA_INCS is reserved for C programs, for extra -I flags!
 
+# NOTE that we use environment variables METVIEW_DDIR and METVIEW_VVERSION instead
+# of METVIEW_DIR and METVIEW_VERSION. We set these in extern.cc when we call the
+# popen() routine; we can't always use the normal env vars because these can be
+# overwritten by the default modules command at ECMWF.
+
 
 set -e
 CC=@CMAKE_C_COMPILER@
@@ -43,13 +48,27 @@ LDFLAGS_INLINE="@LDFLAGS_INLINE@"
 
 MV_EMOSLIB=${MV_EMOSLIB:="-L/usr/local/lib -lemosR64"}
 
-#-- Warning: here Mars and Emos library names are hardcoded!!
+
+# installed version with own-built GRIB_API - make sure we pick up the right GRIB libs
+case $METVIEW_VVERSION in
+ prod)
+
+    if [ "x$MV_BUNDLE_TYPE" == "xMMG" -o "x$MV_BUNDLE_SRC" != "x" ]
+    then
+        GRIBAPI_INC="-I$METVIEW_DDIR/include $GRIBAPI_INC"
+        GRIBAPI_LIB="-L$METVIEW_DDIR/$LIBNAME -Wl,-rpath,/$METVIEW_DDIR/$LIBNAME $GRIBAPI_LIB"
+    fi
+	;;
+esac
+
+
+
 #-- Note that we end up with a duplicated '-lgrib_api' in $FLIBS, but this is because this needs to
 #-- come after the fortran library (and it also exists within $GRIBAPI_LIB).
 
-FLIB="-L$METVIEW_DIR/${LIBNAME} -lmacro_api_f90 -lMvMars $MACRO_EXTRA_LIBS $MV_EMOSLIB $GRIBAPI_INC $GRIBAPI_LIB $LDFLAGS_INLINE -lm -lc"
-CLIB="$MACRO_EXTRA_LIBS $GRIBAPI_INC -L$METVIEW_DIR/${LIBNAME} -lMvMars $MV_EMOSLIB $GRIBAPI_LIB $LDFLAGS_INLINE -lm $FC_LIBS"
-CINC="$MACRO_EXTRA_INCS $GRIBAPI_INC -I$METVIEW_DIR/include"
+FLIB="-L$METVIEW_DDIR/${LIBNAME} -lmacro_api_f90 -lMvMars $MACRO_EXTRA_LIBS $MV_EMOSLIB $GRIBAPI_INC $GRIBAPI_LIB $LDFLAGS_INLINE -lm -lc"
+CLIB="$MACRO_EXTRA_LIBS $GRIBAPI_INC -L$METVIEW_DDIR/${LIBNAME} -lMvMars $MV_EMOSLIB $GRIBAPI_LIB $LDFLAGS_INLINE -lm $FC_LIBS"
+CINC="$MACRO_EXTRA_INCS $GRIBAPI_INC -I$METVIEW_DDIR/include"
 MX77="$MACRO_EXTRA_F77_FLAGS"
 MX90="$MACRO_EXTRA_F90_FLAGS"
 MXCC="$MACRO_EXTRA_CC_FLAGS"
@@ -109,7 +128,7 @@ case "$type" in
 	*)
 		# Consider the string as a command
 		cat <<@ > "$out"
-#!/bin/ksh
+#!/bin/bash
 
 
 cat <<\end_of_inline_macro$$ > $METVIEW_TMPDIR/\$\$
diff --git a/scripts/compile.src b/scripts/compile.src
index 5c1567e..54ea309 100755
--- a/scripts/compile.src
+++ b/scripts/compile.src
@@ -91,7 +91,7 @@ case "$type" in
 	*)
 		# Consider the string as a command
 		cat <<@ > "$out"
-#!/bin/ksh
+#!/bin/bash
 
 
 cat <<\end_of_inline_macro$$ > $METVIEW_TMPDIR/\$\$
diff --git a/scripts/dump b/scripts/dump
index 7798661..ff49a09 100755
--- a/scripts/dump
+++ b/scripts/dump
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/find_from_libs b/scripts/find_from_libs
index 3bf5299..90b67ef 100755
--- a/scripts/find_from_libs
+++ b/scripts/find_from_libs
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/generate_video b/scripts/generate_video
index a36db2c..e975cd3 100644
--- a/scripts/generate_video
+++ b/scripts/generate_video
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
@@ -49,4 +49,4 @@ fi
 #clear
 rm -f ${fileBase}_*.png
 
-exit retVal
\ No newline at end of file
+exit retVal
diff --git a/scripts/logrun b/scripts/logrun
index babb874..59c111d 100644
--- a/scripts/logrun
+++ b/scripts/logrun
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/metgram.py b/scripts/metgram.py
new file mode 100644
index 0000000..ad003db
--- /dev/null
+++ b/scripts/metgram.py
@@ -0,0 +1,134 @@
+
+import xml.sax
+import requests
+import json
+import sys, getopt
+import os
+
+epsgrams = {
+    "15_days"           : "classical_15d",
+    "15_days_with_clim" : "classical_15d_with_climate",
+    "10_days"           : "classical_10d",
+    "10_days_wave"      : "classical_wave",
+    "10_days_plumes"    : "classical_plume",
+
+}
+
+class MetgramHandler( xml.sax.ContentHandler ):
+   def __init__(self):
+      self.CurrentData = ""
+      self.type = ""
+      self.date = ""
+      self.expver = ""
+      self.stations = []
+
+
+   # Call when an element starts
+   def startElement(self, tag, attributes):
+      self.CurrentData = tag
+      if tag == "eps":
+         self.type = attributes["template"]
+         self.date = attributes.get("date", "").strip()
+         self.time = attributes.get("time", "").strip()
+         if ( self.time != "") :
+            self.time = self.time[:2]
+         self.expver = attributes.get("expver", "0001")
+         self.stations = []
+         if self.date == "latest":
+            self.date = ""
+         else:
+            self.date = "%s%s" % (self.date, self.time)
+
+
+      if tag == "station":
+
+         request =  {
+            "station_name" :  attributes["name"],
+            "lat" :  attributes["latitude"].strip(),
+            "lon" :  attributes["longitude"].strip(),
+            "token" : "metview",
+            "expver" : self.expver,
+            "epsgram" : epsgrams[self.type]
+         }
+         if attributes.has_key("height") :
+            request["altitude"] =  attributes["height"],
+
+         if self.date != "" :
+            request["time"] = self.date
+
+         if attributes.has_key("pngfile") :
+            request["format"] = "png"
+            output =  attributes["pngfile"]
+         if attributes.has_key("psfile") :
+            request["format"] = "ps"
+            output =  attributes["psfile"]
+         if attributes.has_key("pdffile") :
+            request["format"] = "pdf"
+            output =  attributes["pdffile"]
+         self.stations.append({"request" : request,
+                "output": output}
+            )
+
+
+
+   # Call when an elements ends
+   def endElement(self, tag):
+      if tag == "eps":
+
+
+         self.execute()
+
+
+
+   # Call when a character is read
+   def characters(self, content):
+      pass
+
+   def execute(self):
+        url = "https://apps.ecmwf.int/plots/product-download/web/classical_meteogram"
+        for station in self.stations :
+            request = station["request"]
+            request["token"]           = "metview" # this token will only work from inside ECMWF
+            request["email"]           = "Web.Administrator at ecmwf.int"
+            request["generator"]       = "Metview"
+            request["metview_version"] = os.environ["METVIEW_RELEASE"]
+            request["metview_user"]    = os.environ["USER"]
+            request = requests.get(url, params = request,
+            proxies = { "http": "http://proxy.ecmwf.int:3333/" })
+            print request.url
+            if request.status_code == 200 :
+                out = open(station["output"], "w")
+                out.write(request.content)
+                out.close()
+                print "Result saved in %s" % (station["output"], )
+            else :
+                print "No Result -->Error %d" % (request.status_code)
+        self.stations = []
+
+
+def main(argv):
+    try:
+      opts, args = getopt.getopt(argv,"hi:",["input="])
+    except getopt.GetoptError:
+      print 'metgram.py -i <inputfile> '
+      sys.exit(2)
+    for opt, arg in opts:
+      if opt == '-h':
+         print 'metgram.py -i <inputfile> '
+         sys.exit()
+      elif opt in ("-i", "--input"):
+         input = arg
+
+   # create an XMLReader
+    parser = xml.sax.make_parser()
+   # turn off namepsaces
+    parser.setFeature(xml.sax.handler.feature_namespaces, 0)
+
+   # override the default ContextHandler
+    Handler = MetgramHandler()
+    parser.setContentHandler( Handler )
+
+    parser.parse(input)
+
+if __name__ == "__main__":
+   main(sys.argv[1:])
diff --git a/scripts/metview-mail b/scripts/metview-mail
index ff6d70e..be45d6d 100755
--- a/scripts/metview-mail
+++ b/scripts/metview-mail
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/metview_base.in b/scripts/metview_base.in
index 2fa09e6..f92c9f1 100755
--- a/scripts/metview_base.in
+++ b/scripts/metview_base.in
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
@@ -32,7 +32,7 @@ MV_LOG_DIR=@LOG_DIR@
 ##OS=linux
 ##MAJOR_VERSION=2
 SHELL=/bin/sh
-#MAGPLUS_HOME=@MAGICS_PATH@
+ at MV_MAGPLUS_HOME_PATH_SET@
 GRIBAPI_DIR=@GRIB_API_PATH@
 ##MV_PYTHON_COMMAND=/usr/local/bin/python
 MV_ODB1_VERSION=@MV_ODB1_VERSION@
@@ -44,9 +44,26 @@ METVIEW_VERSION_TITLE="Metview @METVIEW_VERSION_STR@ @EXTRA_TITLE@ (@TODAYS_DATE
 METVIEW_GUI_BUILT=@METVIEW_GUI_BUILT@
 @MV_FLEXTRA_PATH_SET@
 MV_WEATHER_ROOM_BUILT=@MV_WEATHER_ROOM_BUILT@
+MV_BUNDLE_TYPE=@METVIEW_BUNDLE_TYPE@
 MV_BUNDLE_SRC=@METVIEW_BUNDLE_SRC@
 METVIEW_QT5=@METVIEW_QT5@
-unset MAGPLUS_HOME
+
+
+# prevent environment variable disruptions caused by scripts
+# that are called from $BASH_ENV. We have seen a case where having
+# default modules set (with the 'module initadd' command) can cause
+# those modules to be loaded with each shell that Metview spawns,
+# overwriting MAGPLUS_HOME for example. See JIRA issue METV-1406.
+unset BASH_ENV
+
+
+# on some systems, the locale is set in such a way that dots and commas within numbers
+# are 'the other way around' compared with what we expect; we can override this
+# without affecting the other aspects of the locale by just setting LC_NUMERIC
+# to "C", which should work on all systems. This setting is supposed to provide
+# a 'machine-friendly' locale and does not reply on a specific one such as en_GB.UTF-8.
+LC_NUMERIC="C"
+
 
 #
 # Metview scripts are built automatically by 'make'.
@@ -210,8 +227,8 @@ ensure_system_dir_links_correct(){
         # one which points to the newly-created System link.
         # The following lines set KSH arrays.
 
-        set -A local_dirs "System Drawers" "System Templates"
-        set -A sys_dirs    Drawers          Templates
+        local_dirs=("System Drawers" "System Templates")
+        sys_dirs=(   Drawers          Templates)
 
         for i in 0 1
         do
@@ -339,6 +356,19 @@ do
 			break
 			;;
 
+      -p)
+         METVIEW_MODE=plotSA   #plot stand alone
+         inputfile=$(readlink -m $2)  #make sure the filename contains the full path
+         if [ ! -f "$inputfile" ]
+         then
+            info "Cannot find file $inputfile"
+            exit 1
+         fi
+         METVIEW_STARTUP="$METVIEW_BIN/uPlot '$inputfile'"
+         METVIEW_EXIT=uPlot
+         shift 1
+         ;;
+
 		-e)
 			METVIEW_MODE=examine
 			datatype=$2
@@ -453,16 +483,20 @@ case $METVIEW_VERSION in
     # in the build directory
     if [ "x$MV_BUNDLE_SRC" != "x" ]
     then
-        METVIEW_EXTRA_GRIB_DEFINITION_PATH="${METVIEW_DIR_DEV}/share/grib_api/definitions:${METVIEW_EXTRA_GRIB_DEFINITION_PATH}"
-        METVIEW_EXTRA_GRIB_SAMPLES_PATH="${METVIEW_DIR_DEV}/share/grib_api/samples"
         MAGPLUS_HOME=${MV_BUNDLE_SRC}/magics
         BUFR_TABLES=${MV_BUNDLE_SRC}/bufrdc_tables
         MARS_LSM_PATH=${MV_BUNDLE_SRC}/libemos/tables/interpol
-        GRIBAPI_DIR=${METVIEW_DIR_DEV}
         #FDB_CONFIG_FILE=/tmp/cgi/git/metview-bundle/fdb/etc/Config  # has no effect
         #FDB_CONF_FILE=/tmp/cgi/git/metview-bundle/fdb/etc/Config    # has no effect
     fi
 
+    if [ "x$MV_BUNDLE_TYPE" == "xMMG" -o "x$MV_BUNDLE_SRC" != "x" ]
+    then
+        METVIEW_EXTRA_GRIB_DEFINITION_PATH="${METVIEW_DIR_DEV}/share/@grib_handling_pkg@/definitions:${METVIEW_EXTRA_GRIB_DEFINITION_PATH}"
+        METVIEW_EXTRA_GRIB_SAMPLES_PATH="${METVIEW_DIR_DEV}/share/@grib_handling_pkg@/samples"
+        GRIBAPI_DIR=${METVIEW_DIR_DEV}
+    fi
+
     if [ "x at MV_BUNDLE_MAGICS_SRC@" != "x" ]
     then
         MAGPLUS_HOME=@MV_BUNDLE_MAGICS_SRC@
@@ -610,12 +644,12 @@ fi
 
 METVIEW_EXTRA_GRIB_DEFINITION_PATH=${METVIEW_EXTRA_GRIB_DEFINITION_PATH:=""}
 if [ "x$METVIEW_EXTRA_GRIB_DEFINITION_PATH" != x -a "x$GRIBAPI_DIR" != x ] ; then
-  export GRIB_DEFINITION_PATH="${METVIEW_EXTRA_GRIB_DEFINITION_PATH}:${GRIBAPI_DIR}/share/grib_api/definitions"
+  export GRIB_DEFINITION_PATH="${METVIEW_EXTRA_GRIB_DEFINITION_PATH}:${GRIBAPI_DIR}/share/@grib_handling_pkg@/definitions"
 fi
 
 METVIEW_EXTRA_GRIB_SAMPLES_PATH=${METVIEW_EXTRA_GRIB_SAMPLES_PATH:=""}
 if [ "x$METVIEW_EXTRA_GRIB_SAMPLES_PATH" != x -a "x$GRIBAPI_DIR" != x ] ; then
-  export GRIB_SAMPLES_PATH="${METVIEW_EXTRA_GRIB_SAMPLES_PATH}:${GRIBAPI_DIR}/share/grib_api/samples"
+  export GRIB_SAMPLES_PATH="${METVIEW_EXTRA_GRIB_SAMPLES_PATH}:${GRIBAPI_DIR}/share/@grib_handling_pkg@/samples"
 fi
 
 # =============================================================
@@ -716,9 +750,20 @@ esac
 # =============================================================
 # Create Metview user directory if missing
 
+uname_=`uname`
+if [[ "$uname_" == 'Darwin' ]]; then
+      # on the MAC, 'dot' files in .tar.gz are treated specially - we want
+      # to disable this special behaviour so that we don't get spurious
+      # files appearing. See discussion here:
+      #   http://superuser.com/questions/61185/why-do-i-get-files-like-foo-in-my-tarball-on-os-x
+      COPYFILE_DISABLE=1
+fi
+
 if [ ! -d "$METVIEW_USER_DIRECTORY/System" ]
 then
-	metview_create_user_dir "$METVIEW_USER_DIRECTORY"
+	# note that since changing the scripts to bash, we need to be aware that the
+	# modules system can overwrite the variable METVIEWDIR in a new shell
+	. metview_create_user_dir "$METVIEW_USER_DIRECTORY"
 fi
 
 
@@ -781,7 +826,6 @@ then
 
 
     # set up the file viewers
-    uname_=`uname`
     if [[ "$uname_" == 'Darwin' ]]; then
       METVIEW_PS_VIEWER=${METVIEW_PS_VIEWER:=open}
       METVIEW_PDF_VIEWER=${METVIEW_PDF_VIEWER:=open}
diff --git a/scripts/metview_create_user_dir b/scripts/metview_create_user_dir
index 5c78724..8af9625 100755
--- a/scripts/metview_create_user_dir
+++ b/scripts/metview_create_user_dir
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
@@ -53,3 +53,8 @@ else
    rmdir $USER_DIR
    exit 1
 fi
+
+# for neatness, unset these env vars
+unset TAR_FILE
+unset DRAWERS_TAR_FILE
+unset USER_DIR
diff --git a/scripts/metview_help b/scripts/metview_help
index 98d49ac..dc1f4b5 100755
--- a/scripts/metview_help
+++ b/scripts/metview_help
@@ -187,6 +187,10 @@ Metview command flags:
 			'type' can be grib, bufr or odb
 			e.g. metview -e grib /path/to/grib
 
+ Plotting flags:
+    -p  path	plot the given file
+			e.g. metview -p /path/to/grib
+
  Batch mode specific flags:
     -b mname		run macro mname in batch mode
 			(-b must be the last Metview flag!)
diff --git a/scripts/mv_compress b/scripts/mv_compress
index 3fb15a7..c66e823 100644
--- a/scripts/mv_compress
+++ b/scripts/mv_compress
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/mv_dots b/scripts/mv_dots
index e1af7a4..aca544c 100755
--- a/scripts/mv_dots
+++ b/scripts/mv_dots
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/mv_flexpart_run b/scripts/mv_flexpart_run
index 37d3de2..fd9b582 100644
--- a/scripts/mv_flexpart_run
+++ b/scripts/mv_flexpart_run
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/mv_flextra_prep b/scripts/mv_flextra_prep
index 7b82acc..427ff21 100755
--- a/scripts/mv_flextra_prep
+++ b/scripts/mv_flextra_prep
@@ -1,4 +1,4 @@
-#!/usr/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/mv_flextra_run b/scripts/mv_flextra_run
index a11fb56..5323cb2 100644
--- a/scripts/mv_flextra_run
+++ b/scripts/mv_flextra_run
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
@@ -80,6 +80,15 @@ if [ ! -x $exe_FLEXTRA ] ; then
    exit 1
 fi
 
+f_PATHNAMES=pathnames
+if [ ! -r $f_PATHNAMES ] ; then
+   print_err "FLEXTRA pathnames file does not exist or cannot be read!"
+   exit 1
+fi
+
+echo "Content of pathnames file:"
+cat $f_PATHNAMES
+
 #-------------------------------
 #Run flextra
 #-------------------------------
@@ -163,4 +172,4 @@ if [ $resCnt -gt 1 ] ; then
 	cat $resCnt  > "multipleRes"
 fi	 
 	
-exit $outCode
\ No newline at end of file
+exit $outCode
diff --git a/scripts/mv_grib_dump b/scripts/mv_grib_dump
index 611ed86..5d9b2b9 100755
--- a/scripts/mv_grib_dump
+++ b/scripts/mv_grib_dump
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/mv_mail b/scripts/mv_mail
index 2ee7573..aed6e8a 100644
--- a/scripts/mv_mail
+++ b/scripts/mv_mail
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/mv_obstat b/scripts/mv_obstat
index 128f86d..a008773 100644
--- a/scripts/mv_obstat
+++ b/scripts/mv_obstat
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/mv_odbsql b/scripts/mv_odbsql
index 938db3f..2100e0d 100755
--- a/scripts/mv_odbsql
+++ b/scripts/mv_odbsql
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/mv_rttov_run b/scripts/mv_rttov_run
index 5d9f7a8..4509d81 100644
--- a/scripts/mv_rttov_run
+++ b/scripts/mv_rttov_run
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/mv_scm_run b/scripts/mv_scm_run
index c5f0bf8..e884d10 100644
--- a/scripts/mv_scm_run
+++ b/scripts/mv_scm_run
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/mv_uniquename b/scripts/mv_uniquename
index 62183b2..d853c78 100644
--- a/scripts/mv_uniquename
+++ b/scripts/mv_uniquename
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
@@ -41,4 +41,4 @@ done
 
 echo "$n"_$maxNum
 
-exit
\ No newline at end of file
+exit
diff --git a/scripts/mv_vapor_gui b/scripts/mv_vapor_gui
index d792b44..9813d08 100644
--- a/scripts/mv_vapor_gui
+++ b/scripts/mv_vapor_gui
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/mvrun b/scripts/mvrun
index e3d51d6..011c007 100644
--- a/scripts/mvrun
+++ b/scripts/mvrun
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/mvrun_c b/scripts/mvrun_c
index 9451bee..3f37874 100644
--- a/scripts/mvrun_c
+++ b/scripts/mvrun_c
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/mvrun_lnx b/scripts/mvrun_lnx
index 370fbd4..30723ff 100644
--- a/scripts/mvrun_lnx
+++ b/scripts/mvrun_lnx
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/mvusage b/scripts/mvusage
index 86cc1d3..5ced846 100755
--- a/scripts/mvusage
+++ b/scripts/mvusage
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/scripts/select_mars_config b/scripts/select_mars_config
index 44fd9e0..c8d34a7 100755
--- a/scripts/select_mars_config
+++ b/scripts/select_mars_config
@@ -1,4 +1,4 @@
-#!/bin/ksh 
+#!/bin/bash 
 #set -x
 
 export MARS_HOME=${MARS_HOME:=/usr/local/apps/mars/current}
diff --git a/scripts/set_mars_env b/scripts/set_mars_env
index 4270f2e..25ceb68 100755
--- a/scripts/set_mars_env
+++ b/scripts/set_mars_env
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 
 # **************************** LICENSE START ***********************************
 #
diff --git a/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake b/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
index 1e12d66..c6947e8 100644
--- a/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
+++ b/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
@@ -1,4 +1,12 @@
 ####################################################################
+# ARCHITECTURE
+####################################################################
+set( CMAKE_SIZEOF_VOID_P 8 )
+
+# Disable relative rpaths as aprun does not respect it
+set( ENABLE_RELATIVE_RPATHS OFF CACHE STRING "Disable relative rpaths" FORCE )
+
+####################################################################
 # COMPILER
 ####################################################################
 
@@ -8,15 +16,11 @@ CMAKE_FORCE_C_COMPILER       ( cc  Cray )
 CMAKE_FORCE_CXX_COMPILER     ( CC  Cray )
 CMAKE_FORCE_Fortran_COMPILER ( ftn Cray )
 
-link_libraries("$ENV{CC_X86_64}/lib/x86-64/libcray-c++-rts.so")
-link_libraries("-lmpichf90_cray")
-link_libraries("-lmpichcxx_cray")
-
 set( ECBUILD_FIND_MPI OFF )
 set( ECBUILD_TRUST_FLAGS ON )
 
 ####################################################################
-# FLAGS COMMON TO ALL BUILD TYPES
+# OpenMP FLAGS
 ####################################################################
 
 set( OMP_C_FLAGS             "-homp" )
@@ -27,55 +31,11 @@ set( OMPSTUBS_C_FLAGS        "-hnoomp" )
 set( OMPSTUBS_CXX_FLAGS      "-hnoomp" )
 set( OMPSTUBS_Fortran_FLAGS  "-hnoomp" )
 
-set( CMAKE_C_FLAGS       "" CACHE STRING "" FORCE )
-set( CMAKE_CXX_FLAGS     "" CACHE STRING "" FORCE )
-set( CMAKE_Fortran_FLAGS "-emf -rmoid" CACHE STRING "" FORCE )   # -emf activates .mods and uses lower case -rmoid produces a listing file
-
-####################################################################
-# RELEASE FLAGS
-####################################################################
-
-set( ECBUILD_C_FLAGS_RELEASE       "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
-set( ECBUILD_CXX_FLAGS_RELEASE     "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
-set( ECBUILD_Fortran_FLAGS_RELEASE "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
-
-####################################################################
-# BIT REPRODUCIBLE FLAGS
-####################################################################
-
-set( ECBUILD_C_FLAGS_BIT        "-O1 -G2 -hflex_mp=conservative -hadd_paren -hfp1 -DNDEBUG" )
-set( ECBUILD_CXX_FLAGS_BIT      "-O1 -G2 -hflex_mp=conservative -hadd_paren -hfp1 -DNDEBUG" )
-set( ECBUILD_Fortran_FLAGS_BIT  "-O1 -G2 -hflex_mp=conservative -hadd_paren -hfp1 -DNDEBUG" )
-
-####################################################################
-# RELWITHDEBINFO FLAGS
-####################################################################
-
-set( ECBUILD_C_FLAGS_RELWITHDEBINFO        "-O2 -hfp1 -Gfast -DNDEBUG" )
-set( ECBUILD_CXX_FLAGS_RELWITHDEBINFO      "-O2 -hfp1 -Gfast -DNDEBUG" )
-set( ECBUILD_Fortran_FLAGS_RELWITHDEBINFO  "-O2 -hfp1 -Gfast -DNDEBUG" )
-
-####################################################################
-# DEBUG FLAGS
-####################################################################
-
-set( ECBUILD_C_FLAGS_DEBUG        "-O0 -G0" )
-set( ECBUILD_CXX_FLAGS_DEBUG      "-O0 -G0" )
-set( ECBUILD_Fortran_FLAGS_DEBUG  "-O0 -G0" )
-
-####################################################################
-# PRODUCTION FLAGS
-####################################################################
-
-set( ECBUILD_C_FLAGS_PRODUCTION        "-O2 -hfp1 -G2" )
-set( ECBUILD_CXX_FLAGS_PRODUCTION      "-O2 -hfp1 -G2" )
-set( ECBUILD_Fortran_FLAGS_PRODUCTION  "-O2 -hfp1 -G2" )
-
 ####################################################################
 # LINK FLAGS
 ####################################################################
 
-set( ECBUILD_C_LINK_FLAGS        "-Wl,-Map,loadmap -Wl,--as-needed -Ktrap=fp" )
-set( ECBUILD_CXX_LINK_FLAGS      "-Wl,-Map,loadmap -Wl,--as-needed -Ktrap=fp" )
-set( ECBUILD_Fortran_LINK_FLAGS  "-Wl,-Map,loadmap -Wl,--as-needed -Ktrap=fp" )
-
+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_CXX_IMPLICIT_LINK_LIBRARIES "$ENV{CC_X86_64}/lib/x86-64/libcray-c++-rts.so" CACHE STRING "" )
diff --git a/share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake b/share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake
index 3c890d5..3ea294f 100644
--- a/share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake
+++ b/share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake
@@ -1,4 +1,12 @@
 ####################################################################
+# ARCHITECTURE
+####################################################################
+set( CMAKE_SIZEOF_VOID_P 8 )
+
+# Disable relative rpaths as aprun does not respect it
+set( ENABLE_RELATIVE_RPATHS OFF CACHE STRING "Disable relative rpaths" FORCE )
+
+####################################################################
 # COMPILER
 ####################################################################
 
@@ -12,62 +20,25 @@ set( ECBUILD_FIND_MPI OFF )
 set( ECBUILD_TRUST_FLAGS ON )
 
 ####################################################################
-# FLAGS COMMON TO ALL BUILD TYPES
+# OpenMP FLAGS
 ####################################################################
 
 set( OMP_C_FLAGS             "-fopenmp" )
 set( OMP_CXX_FLAGS           "-fopenmp" )
 set( OMP_Fortran_FLAGS       "-fopenmp" )
 
-set( CMAKE_C_FLAGS       "" CACHE STRING "" FORCE )
-set( CMAKE_CXX_FLAGS     "" CACHE STRING "" FORCE )
-set( CMAKE_Fortran_FLAGS "" CACHE STRING "" FORCE )
-
-####################################################################
-# RELEASE FLAGS
-####################################################################
-
-#set( ECBUILD_C_FLAGS_RELEASE       "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
-#set( ECBUILD_CXX_FLAGS_RELEASE     "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
-#set( ECBUILD_Fortran_FLAGS_RELEASE "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
-
-####################################################################
-# BIT REPRODUCIBLE FLAGS
-####################################################################
-
-set( ECBUILD_C_FLAGS_BIT        "-g -O2 -m64 -march=native -DNDEBUG" )
-set( ECBUILD_CXX_FLAGS_BIT      "-g -O2 -m64 -march=native -DNDEBUG" )
-set( ECBUILD_Fortran_FLAGS_BIT  "-g -O2 -m64 -march=native -DNDEBUG -fno-range-check -ffree-line-length-300 -fconvert=big-endian" )
-
-####################################################################
-# RELWITHDEBINFO FLAGS
-####################################################################
-
-#set( ECBUILD_C_FLAGS_RELWITHDEBINFO        "-O2 -hfp1 -Gfast -DNDEBUG" )
-#set( ECBUILD_CXX_FLAGS_RELWITHDEBINFO      "-O2 -hfp1 -Gfast -DNDEBUG" )
-#set( ECBUILD_Fortran_FLAGS_RELWITHDEBINFO  "-O2 -hfp1 -Gfast -DNDEBUG" )
-
 ####################################################################
 # DEBUG FLAGS
 ####################################################################
 
-#set( ECBUILD_C_FLAGS_DEBUG        "-O0 -G0" )
-#set( ECBUILD_CXX_FLAGS_DEBUG      "-O0 -G0" )
-#set( ECBUILD_Fortran_FLAGS_DEBUG  "-O0 -G0" )
-
-####################################################################
-# PRODUCTION FLAGS
-####################################################################
-
-#set( ECBUILD_C_FLAGS_PRODUCTION        "-O2 -hfp1 -G2" )
-#set( ECBUILD_CXX_FLAGS_PRODUCTION      "-O2 -hfp1 -G2" )
-#set( ECBUILD_Fortran_FLAGS_PRODUCTION  "-O2 -hfp1 -G2" )
+set( ECBUILD_C_FLAGS_DEBUG        "-O0 -g -ftrapv" )
+set( ECBUILD_CXX_FLAGS_DEBUG      "-O0 -g -ftrapv" )
+set( ECBUILD_Fortran_FLAGS_DEBUG  "-ffree-line-length-none -O0 -g -fcheck=bounds -fbacktrace -finit-real=snan -ffpe-trap=invalid,zero,overflow" )
 
 ####################################################################
 # LINK FLAGS
 ####################################################################
 
-set( ECBUILD_C_LINK_FLAGS        "-Wl,-Map,load.map -Wl,--as-needed" )
-set( ECBUILD_CXX_LINK_FLAGS      "-Wl,-Map,load.map -Wl,--as-needed" )
-set( ECBUILD_Fortran_LINK_FLAGS  "-Wl,-Map,load.map -Wl,--as-needed" )
-
+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" )
diff --git a/share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake b/share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake
index 485b122..d5fdb32 100644
--- a/share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake
+++ b/share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake
@@ -1,4 +1,13 @@
 ####################################################################
+# ARCHITECTURE
+####################################################################
+set( CMAKE_SIZEOF_VOID_P 8 )
+
+# Disable relative rpaths as aprun does not respect it
+set( ENABLE_RELATIVE_RPATHS OFF CACHE STRING "Disable relative rpaths" FORCE )
+
+
+####################################################################
 # COMPILER
 ####################################################################
 
@@ -12,27 +21,23 @@ set( ECBUILD_FIND_MPI OFF )
 set( ECBUILD_TRUST_FLAGS ON )
 
 ####################################################################
-# FLAGS COMMON TO ALL BUILD TYPES
+# OpenMP FLAGS
 ####################################################################
 
-set( OMP_C_FLAGS             "-qopenmp -qopenmp-threadprivate=compat -qopenmp-report=2 -qopt-report-phase=vec,openmp" )
-set( OMP_CXX_FLAGS           "-qopenmp -qopenmp-threadprivate=compat -qopenmp-report=2 -qopt-report-phase=vec,openmp" )
-set( OMP_Fortran_FLAGS       " -openmp  -openmp-threadprivate=compat  -openmp-report=2  -opt-report-phase=vec,openmp" ) # -[q] is missing on purpose, ifort does not take -q as flag
-
-# for diagnostics:
-#  -diag-enable=vec -diag-file -Winline
-
-set( CMAKE_C_FLAGS       "-fp-speculation=strict -fp-model precise -traceback" CACHE STRING "" FORCE )
-set( CMAKE_CXX_FLAGS     "-fp-speculation=strict -fp-model precise -traceback" CACHE STRING "" FORCE )
-set( CMAKE_Fortran_FLAGS "-fp-speculation=strict -fp-model precise -convert big_endian -assume byterecl -traceback -fpe0" CACHE STRING "" FORCE )
+set( OMP_C_FLAGS             "-openmp -openmp-threadprivate=compat" )
+set( OMP_CXX_FLAGS           "-openmp -openmp-threadprivate=compat" )
+set( OMP_Fortran_FLAGS       "-openmp -openmp-threadprivate=compat" )
 
 ####################################################################
-# RELEASE FLAGS
+# COMMON FLAGS
 ####################################################################
 
-#set( ECBUILD_C_FLAGS_RELEASE       "not implemented" )
-#set( ECBUILD_CXX_FLAGS_RELEASE     "not implemented" )
-#set( ECBUILD_Fortran_FLAGS_RELEASE "not implemented" )
+# for diagnostics:
+#  -diag-enable=vec -diag-file -Winline
+
+set( ECBUILD_C_FLAGS       "-fp-speculation=strict -fp-model precise -traceback")
+set( ECBUILD_CXX_FLAGS     "-fp-speculation=strict -fp-model precise -traceback" )
+set( ECBUILD_Fortran_FLAGS "-fp-speculation=strict -fp-model source  -convert big_endian -assume byterecl -traceback -fpe0" )
 
 ####################################################################
 # BIT REPRODUCIBLE FLAGS
@@ -43,34 +48,18 @@ set( ECBUILD_CXX_FLAGS_BIT      "-O2 -xAVX -finline-function -finline-limit=500"
 set( ECBUILD_Fortran_FLAGS_BIT  "-O2 -xAVX -finline-function -finline-limit=500 -align array64byte" )
 
 ####################################################################
-# RELWITHDEBINFO FLAGS
-####################################################################
-
-#set( ECBUILD_C_FLAGS_RELWITHDEBINFO        "not implemented" )
-#set( ECBUILD_CXX_FLAGS_RELWITHDEBINFO      "not implemented" )
-#set( ECBUILD_Fortran_FLAGS_RELWITHDEBINFO  "not implemented" )
-
-####################################################################
 # DEBUG FLAGS
 ####################################################################
 
-set( ECBUILD_C_FLAGS_DEBUG        "-g -O0" )
-set( ECBUILD_CXX_FLAGS_DEBUG      "-g -O0" )
-set( ECBUILD_Fortran_FLAGS_DEBUG  "-g -O0" ) # ??? -align array64byte
-
-####################################################################
-# PRODUCTION FLAGS
-####################################################################
-
-#set( ECBUILD_C_FLAGS_PRODUCTION        "not implemented" )
-#set( ECBUILD_CXX_FLAGS_PRODUCTION      "not implemented" )
-#set( ECBUILD_Fortran_FLAGS_PRODUCTION  "not implemented" )
+set( ECBUILD_C_FLAGS_DEBUG        "-O0 -g -traceback -fp-trap=common" )
+set( ECBUILD_CXX_FLAGS_DEBUG      "-O0 -g -traceback -fp-trap=common" )
+# -check all implies -check bounds
+set( ECBUILD_Fortran_FLAGS_DEBUG  "-O0 -g -traceback -warn all -heap-arrays -fpe-all=0 -fpe:0 -check all" )
 
 ####################################################################
 # LINK FLAGS
 ####################################################################
 
-set( ECBUILD_C_LINK_FLAGS        "-Wl,-Map,load.map -Wl,--as-needed" )
-set( ECBUILD_CXX_LINK_FLAGS      "-Wl,-Map,load.map -Wl,--as-needed" )
-set( ECBUILD_Fortran_LINK_FLAGS  "-Wl,-Map,load.map -Wl,--as-needed" )
-
+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" )
diff --git a/share/ecbuild/toolchains/ichec-fionn-Intel.cmake b/share/ecbuild/toolchains/ichec-fionn-Intel.cmake
new file mode 100644
index 0000000..184dfb5
--- /dev/null
+++ b/share/ecbuild/toolchains/ichec-fionn-Intel.cmake
@@ -0,0 +1,67 @@
+####################################################################
+# ARCHITECTURE
+####################################################################
+
+
+####################################################################
+# COMPILER
+####################################################################
+
+include(CMakeForceCompiler)
+
+CMAKE_FORCE_C_COMPILER       ( icc  Intel )
+CMAKE_FORCE_CXX_COMPILER     ( icpc  Intel )
+CMAKE_FORCE_Fortran_COMPILER ( ifort Intel )
+
+####################################################################
+# OpenMP FLAGS
+####################################################################
+
+set( OMP_C_FLAGS             "-openmp -openmp-threadprivate=compat" )
+set( OMP_CXX_FLAGS           "-openmp -openmp-threadprivate=compat" )
+set( OMP_Fortran_FLAGS       "-openmp -openmp-threadprivate=compat" )
+
+####################################################################
+# COMMON FLAGS
+####################################################################
+
+# for diagnostics:
+#  -diag-enable=vec -diag-file -Winline
+
+set( ECBUILD_C_FLAGS       "-fp-speculation=strict -fp-model precise -traceback")
+set( ECBUILD_CXX_FLAGS     "-fp-speculation=strict -fp-model precise -traceback" )
+set( ECBUILD_Fortran_FLAGS "-fp-speculation=strict -fp-model source  -convert big_endian -assume byterecl -traceback -fpe0" )
+
+####################################################################
+# BIT REPRODUCIBLE FLAGS
+####################################################################
+
+set( ECBUILD_C_FLAGS_BIT        "-O2 -xAVX -finline-function -finline-limit=500" )
+set( ECBUILD_CXX_FLAGS_BIT      "-O2 -xAVX -finline-function -finline-limit=500" )
+set( ECBUILD_Fortran_FLAGS_BIT  "-O2 -xAVX -finline-function -finline-limit=500 -align array64byte" )
+
+####################################################################
+# DEBUG FLAGS
+####################################################################
+
+set( ECBUILD_C_FLAGS_DEBUG        "-O0 -g -traceback -fp-trap=common" )
+set( ECBUILD_CXX_FLAGS_DEBUG      "-O0 -g -traceback -fp-trap=common" )
+# -check all implies -check bounds
+set( ECBUILD_Fortran_FLAGS_DEBUG  "-O0 -g -traceback -warn all -heap-arrays -fpe-all=0 -fpe:0 -check all" )
+
+####################################################################
+# LINK FLAGS
+####################################################################
+
+set( ECBUILD_C_LINK_FLAGS        "-Wl,-Map,load.map -Wl,--as-needed" )
+set( ECBUILD_CXX_LINK_FLAGS      "-Wl,-Map,load.map -Wl,--as-needed" )
+set( ECBUILD_Fortran_LINK_FLAGS  "-Wl,-Map,load.map -Wl,--as-needed" )
+
+###################################################################
+# 
+# Serial versions of these packages (need to specify intel_mpi versions? )
+###################################################################
+
+set( FFTW_PATH    "/ichec/packages/fftw/intel/3.3.4")
+set( NETCDF_PATH  "/ichec/packages/netcdf/intel/4.4.0")
+set( HDF5_PATH    "/ichec/packages/hdf5/intel/1.8.16")
diff --git a/share/metview/app-defaults/CMakeLists.txt b/share/metview/app-defaults/CMakeLists.txt
index a853c19..80c0c98 100644
--- a/share/metview/app-defaults/CMakeLists.txt
+++ b/share/metview/app-defaults/CMakeLists.txt
@@ -70,7 +70,7 @@ foreach( dir ${dirs})
                     OUTPUT_VARIABLE outv
                     ERROR_VARIABLE  errv)
     if(NOT res EQUAL 0)
-        message(FATAL_ERROR "Could not create symbolic link to ${dir} : ${res} ${outv} , ${errv}")
+        ecbuild_critical("Could not create symbolic link to ${dir} : ${res} ${outv} , ${errv}")
     endif()
 
 
diff --git a/share/metview/app-defaults/FrameKeyProfile_default.xml b/share/metview/app-defaults/FrameKeyProfile_default.xml
index 0ef38d7..00b9ee9 100644
--- a/share/metview/app-defaults/FrameKeyProfile_default.xml
+++ b/share/metview/app-defaults/FrameKeyProfile_default.xml
@@ -2,10 +2,10 @@
 	<Profile name="System::Default">
 		<Key name="MV_Frame" shortName="Frame" desc="Frame index"/>
 		<Key name="shortName" shortName="Name" desc=""/>
-		<Key name="date" shortName="Date" desc=""/>
+		<Key name="dataDate" shortName="Date" desc=""/>
 		<Key name="time" shortName="Time" desc=""/>
 		<Key name="stepRange" shortName="Step" desc=""/>
 		<Key name="level" shortName="Level" desc=""/>
 		<Key name="levelType" shortName="LevType" desc=""/>
 	</Profile>
-</MetviewKeyProfile>
\ No newline at end of file
+</MetviewKeyProfile>
diff --git a/share/metview/app-defaults/GribKeyProfile_default.xml b/share/metview/app-defaults/GribKeyProfile_default.xml
index a0e0725..911bedf 100644
--- a/share/metview/app-defaults/GribKeyProfile_default.xml
+++ b/share/metview/app-defaults/GribKeyProfile_default.xml
@@ -2,10 +2,10 @@
 	<Profile name="System::Default">
 		<Key name="MV_Index" shortName="Index" desc="Message index"/>
 		<Key name="shortName" shortName="Name" desc=""/>
-		<Key name="date" shortName="Date" desc=""/>
+		<Key name="dataDate" shortName="Date" desc=""/>
 		<Key name="time" shortName="Time" desc=""/>
 		<Key name="stepRange" shortName="Step" desc=""/>
 		<Key name="level" shortName="Level" desc=""/>
 		<Key name="levelType" shortName="LevType" desc=""/>
 	</Profile>
-</MetviewKeyProfile>
\ No newline at end of file
+</MetviewKeyProfile>
diff --git a/share/metview/app-defaults/LayerKeyProfile_default.xml b/share/metview/app-defaults/LayerKeyProfile_default.xml
index 7fbe481..455bce2 100644
--- a/share/metview/app-defaults/LayerKeyProfile_default.xml
+++ b/share/metview/app-defaults/LayerKeyProfile_default.xml
@@ -14,7 +14,7 @@
 		</Key>
 		<Key name="scaling_formula" shortName="Scaling"/>
 		<Key name="scaled_units" shortName="Scaled units"/>
-		<Key name="date" shortName="Date">
+		<Key name="dataDate" shortName="Date">
 			<Data source="gribapi"/>
 		</Key>
 		<Key name="time" shortName="Time">
@@ -32,9 +32,10 @@
 		<Key name="gridType" shortName="Grid type">
 			<Data source="gribapi"/>		
 		</Key>
-		<Key name="N" shortName="Grid (N)">
+		<Key name="N" shortName="Gaussian number">
 			<Data source="gribapi"/>		
 		</Key>
+		<Key name="isOctahedral" shortName="Octahedral"/>
 		<Key name="iDirectionIncrementInDegrees" shortName="Dx">
 			<Data source="gribapi"/>
 		</Key>
diff --git a/share/metview/app-defaults/Sample_Drawers.tar.gz b/share/metview/app-defaults/Sample_Drawers.tar.gz
index ec809ab..45ad719 100644
Binary files a/share/metview/app-defaults/Sample_Drawers.tar.gz and b/share/metview/app-defaults/Sample_Drawers.tar.gz differ
diff --git a/share/metview/app-defaults/User_Dir_Frame.tar.gz b/share/metview/app-defaults/User_Dir_Frame.tar.gz
index a1f89d4..afeeffb 100644
Binary files a/share/metview/app-defaults/User_Dir_Frame.tar.gz and b/share/metview/app-defaults/User_Dir_Frame.tar.gz differ
diff --git a/share/metview/etc/AnnotationViewDef b/share/metview/etc/AnnotationViewDef
index fd80dd9..989131e 100644
--- a/share/metview/etc/AnnotationViewDef
+++ b/share/metview/etc/AnnotationViewDef
@@ -36,7 +36,7 @@ SUBPAGE_FRAME
 
 SUBPAGE_FRAME_COLOUR [interface=colour]
 {
-   %include MagicsColors.h
+   %include MagicsColours.txt
 } = BLACK
 
 SUBPAGE_FRAME_LINE_STYLE
@@ -64,7 +64,7 @@ SUBPAGE_FRAME_THICKNESS
 
 SUBPAGE_BACKGROUND_COLOUR [interface=colour]
 {
-   %include MagicsColors.h
+   %include MagicsColours.txt
 } = WHITE
 
 }
diff --git a/share/metview/etc/AxisDef b/share/metview/etc/AxisDef
index 5bfc501..eeac5f2 100755
--- a/share/metview/etc/AxisDef
+++ b/share/metview/etc/AxisDef
@@ -6,7 +6,7 @@ PARAMSHARE ; ParamShare; PARAMSHARE
        }
  
        COLOUR {
-			%include MagicsColors.h
+			%include MagicsColours.txt
        } 
 
        LINE_STYLE {
diff --git a/share/metview/etc/BinningObjectDef b/share/metview/etc/BinningObjectDef
index 520a081..43cd33a 100644
--- a/share/metview/etc/BinningObjectDef
+++ b/share/metview/etc/BinningObjectDef
@@ -1,7 +1,7 @@
 PARAMSHARE ; ParamShare; PARAMSHARE
 {
 	COLOUR {
-		%include MagicsColors.h
+		%include MagicsColours.txt
 	}
 	STYLE {
 		SOLID; SOLID
diff --git a/share/metview/etc/CMakeLists.txt b/share/metview/etc/CMakeLists.txt
index 3c634a5..99b23a7 100644
--- a/share/metview/etc/CMakeLists.txt
+++ b/share/metview/etc/CMakeLists.txt
@@ -1,8 +1,3 @@
-### TODO:
-### ObjectListAll
-### Macro Editor resource files
-### LOTS MORE!
-
 
 set(files
 	AnnotationViewDef AnnotationViewRules
@@ -56,7 +51,7 @@ set(files
 	MacroParamDef
 	MacroParamRules
 	MacroRules
-	MagicsColors.h
+	MagicsColours.txt
 	MapViewDef
 	MapViewRules
 	MarsDef
@@ -141,6 +136,7 @@ set(files
 
 set(metview_core_targets
     macro
+    ObjectListAllTarget
 )
 
 
@@ -269,7 +265,7 @@ add_custom_command(
 	COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/${MARS_ACCESS} > ObjectListAll.temp \; echo 'cat <<\@'   >> ObjectListAll.temp \; cat ${ObjectListAllComponents} >> ObjectListAll.temp \; echo '\@'          >> ObjectListAll.temp \; grep -v "^#" ObjectListAll.temp > ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/etc/ObjectListAll \; rm -f ObjectListAll.temp
 #	COMMAND cat $(MARS_ACCESS) > ObjectListAll.temp \; echo "cat <<@ "   >> ObjectListAll.temp \; cat Services ObjectList uPlotTable >> ObjectListAll.temp \; cat `ls  ObjectSpec.* | grep -v \~`  >> ObjectListAll.temp \; echo "@"          >> ObjectListAll.temp \; grep -v '^#' ObjectListAll.temp > ObjectListAll
     DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ObjectList ${ObjectListAllComponents})
-add_custom_target(ObjectListAll DEPENDS ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/etc/ObjectListAll)
+add_custom_target(ObjectListAllTarget DEPENDS ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/etc/ObjectListAll)
 
 
 install( FILES ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/etc/ObjectListAll
@@ -281,7 +277,7 @@ install( FILES ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/etc/ObjectListAll
 add_custom_command( 
     OUTPUT  defs_created.txt
     COMMAND touch defs_created.txt
-    DEPENDS ${dependencies} ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/etc/ObjectListAll
+    DEPENDS ${dependencies} ObjectListAllTarget
     )
 
 add_custom_target( all_defs ALL DEPENDS defs_created.txt )
diff --git a/share/metview/etc/CoastDef b/share/metview/etc/CoastDef
index 6929531..e4a9bb7 100755
--- a/share/metview/etc/CoastDef
+++ b/share/metview/etc/CoastDef
@@ -6,7 +6,7 @@ PARAMSHARE ; ParamShare; PARAMSHARE
        }
  
        COLOUR {
-			%include MagicsColors.h
+			%include MagicsColours.txt
        } 
 
        LINE_STYLE {
diff --git a/share/metview/etc/ContDef b/share/metview/etc/ContDef
index 3c867fa..d8f4e44 100755
--- a/share/metview/etc/ContDef
+++ b/share/metview/etc/ContDef
@@ -6,7 +6,7 @@ PARAMSHARE ; ParamShare; PARAMSHARE
        }
  
        COLOUR {
-			%include MagicsColors.h
+			%include MagicsColours.txt
        } 
 
        LINE_STYLE {
diff --git a/share/metview/etc/EPSOutputDef b/share/metview/etc/EPSOutputDef
index e065e3f..16a4871 100644
--- a/share/metview/etc/EPSOutputDef
+++ b/share/metview/etc/EPSOutputDef
@@ -1,17 +1,3 @@
-PARAMSHARE ; ParamShare; PARAMSHARE
-{
-	COLOUR {
-		%include MagicsColors.h
-	}
-	STYLE {
-		SOLID; SOLID
-		DASH; DASH
-		DOT; DOT
-		CHAIN_DOT; CHAIN_DOT
-		CHAIN_DASH; CHAIN_DASH
-	}
-}
-
 EPSOUTPUT; Magics; Automatically generated
 {
 	OUTPUT_TITLE
diff --git a/share/metview/etc/GeoToGribDef b/share/metview/etc/GeoToGribDef
index 16cd08c..f7993f7 100644
--- a/share/metview/etc/GeoToGribDef
+++ b/share/metview/etc/GeoToGribDef
@@ -60,6 +60,9 @@ GEO_TO_GRIB; Transform Geopoints to regular grid; metview
 		RECIPROCAL
 		EXPONENTIAL_MEAN
 		EXPONENTIAL_SUM
+		NEAREST_GRIDPOINT_MEAN
+		NEAREST_GRIDPOINT_SUM
+		NEAREST_GRIDPOINT_COUNT
 	} = RECIPROCAL
 
 	PARAMETER
diff --git a/share/metview/etc/GeoToGribRules b/share/metview/etc/GeoToGribRules
index ab8fff2..bd77917 100644
--- a/share/metview/etc/GeoToGribRules
+++ b/share/metview/etc/GeoToGribRules
@@ -5,3 +5,6 @@
 
 %if GRID_DEFINITION_MODE <> GRIB %then
 	%unset TEMPLATE_GRIB
+
+%if INTERPOLATION_METHOD = NEAREST_GRIDPOINT_MEAN %or INTERPOLATION_METHOD = NEAREST_GRIDPOINT_SUM %or INTERPOLATION_METHOD = NEAREST_GRIDPOINT_COUNT %then
+	%unset TOLERANCE
diff --git a/share/metview/etc/GeoViewDef b/share/metview/etc/GeoViewDef
index 24bc789..238f873 100644
--- a/share/metview/etc/GeoViewDef
+++ b/share/metview/etc/GeoViewDef
@@ -18,8 +18,8 @@ GEOVIEW; GEOVIEW; UPLOT
       CYLINDRICAL ; CYLINDRICAL
       BONNE
       COLLIGNON
-      EPSG:32661
       EPSG:4326
+      EPSG:3857
       GEOS
       GOODE
       LAMBERT
diff --git a/share/metview/etc/GraphDef b/share/metview/etc/GraphDef
index 833aa47..431c4fe 100755
--- a/share/metview/etc/GraphDef
+++ b/share/metview/etc/GraphDef
@@ -6,7 +6,7 @@ PARAMSHARE ; ParamShare; PARAMSHARE
        }
  
        COLOUR {
-			%include MagicsColors.h
+			%include MagicsColours.txt
        } 
 
        LINE_STYLE {
diff --git a/share/metview/etc/KMLOutputDef b/share/metview/etc/KMLOutputDef
index 9707841..2323eb5 100644
--- a/share/metview/etc/KMLOutputDef
+++ b/share/metview/etc/KMLOutputDef
@@ -1,17 +1,3 @@
-PARAMSHARE ; ParamShare; PARAMSHARE
-{
-	COLOUR {
-		%include MagicsColors.h
-	}
-	STYLE {
-		SOLID; SOLID
-		DASH; DASH
-		DOT; DOT
-		CHAIN_DOT; CHAIN_DOT
-		CHAIN_DASH; CHAIN_DASH
-	}
-}
-
 KMLOUTPUT; Magics; Automatically generated
 {
 	OUTPUT_TITLE
diff --git a/share/metview/etc/MAXISDef b/share/metview/etc/MAXISDef
index ff6ffd6..1646e44 100755
--- a/share/metview/etc/MAXISDef
+++ b/share/metview/etc/MAXISDef
@@ -1,7 +1,7 @@
 PARAMSHARE ; ParamShare; PARAMSHARE
 {
 	COLOUR {
-		%include MagicsColors.h
+		%include MagicsColours.txt
 	}
 	STYLE {
 		SOLID; SOLID
@@ -68,7 +68,7 @@ MAXIS; Magics; Automatically generated
 	AXIS_GRID_COLOUR [ help = help_colour,interface = colour ]
 	{ 
 		&PARAMSHARE&COLOUR
-	} = YELLOW
+	} = BLACK
 
 	AXIS_GRID_LINE_STYLE
 	{
@@ -290,6 +290,29 @@ MAXIS; Magics; Automatically generated
 		*
 	} = 1
 
+
+	AXIS_MINOR_GRID
+	{
+		ON;  ON
+		OFF; OFF
+	} = OFF
+
+	AXIS_MINOR_GRID_COLOUR [ help = help_colour,interface = colour ]
+	{ 
+		&PARAMSHARE&COLOUR
+	} = BLACK
+
+	AXIS_MINOR_GRID_LINE_STYLE
+	{
+		&PARAMSHARE&STYLE
+	} = SOLID
+
+	AXIS_MINOR_GRID_THICKNESS
+	{
+		*
+	} = 1
+
+
 	AXIS_TIP_TITLE
 	{
 		ON;  ON
diff --git a/share/metview/etc/MAXISRules b/share/metview/etc/MAXISRules
index 685a6ba..37d2be5 100755
--- a/share/metview/etc/MAXISRules
+++ b/share/metview/etc/MAXISRules
@@ -7,6 +7,10 @@
 	%unset AXIS_GRID_LINE_STYLE
 	%unset AXIS_GRID_COLOUR
 	%unset AXIS_GRID_REFERENCE_LINE_STYLE
+	%unset AXIS_MINOR_GRID
+	%unset AXIS_MINOR_GRID_THICKNESS
+	%unset AXIS_MINOR_GRID_LINE_STYLE
+	%unset AXIS_MINOR_GRID_COLOUR
 
 %if AXIS_TICK_LABEL <> ON %or AXIS_TICK_LABEL_TYPE <> NUMBER %then
 	%unset AXIS_TICK_LABEL_FORMAT
@@ -21,6 +25,15 @@
 	%unset AXIS_MINOR_TICK_COLOUR
 	%unset AXIS_MINOR_TICK_THICKNESS
 	%unset AXIS_MINOR_TICK_COUNT
+    %unset AXIS_MINOR_GRID
+	%unset AXIS_MINOR_GRID_THICKNESS
+	%unset AXIS_MINOR_GRID_LINE_STYLE
+	%unset AXIS_MINOR_GRID_COLOUR
+
+%if AXIS_MINOR_GRID <> ON %then
+	%unset AXIS_MINOR_GRID_THICKNESS
+	%unset AXIS_MINOR_GRID_LINE_STYLE
+	%unset AXIS_MINOR_GRID_COLOUR
 
 %if AXIS_TICK_LABEL <> ON %or AXIS_TICK_LABEL_TYPE <> LABEL_LIST %then
 	%unset AXIS_TICK_LABEL_LIST
diff --git a/share/metview/etc/MBOXPLOTDef b/share/metview/etc/MBOXPLOTDef
index 8d9d5dd..1c87a96 100644
--- a/share/metview/etc/MBOXPLOTDef
+++ b/share/metview/etc/MBOXPLOTDef
@@ -1,7 +1,7 @@
 PARAMSHARE ; ParamShare; PARAMSHARE
 {
 	COLOUR {
-		%include MagicsColors.h
+		%include MagicsColours.txt
 		}
 	STYLE {
 		SOLID; SOLID
diff --git a/share/metview/etc/MCOASTDef b/share/metview/etc/MCOASTDef
index 80db4b4..d223844 100644
--- a/share/metview/etc/MCOASTDef
+++ b/share/metview/etc/MCOASTDef
@@ -1,7 +1,7 @@
 PARAMSHARE ; ParamShare; PARAMSHARE
 {
 	COLOUR {
-		%include MagicsColors.h
+		%include MagicsColours.txt
 	}
 	STYLE {
 		SOLID; SOLID
@@ -204,112 +204,112 @@ MCOAST; Magics; Automatically generated
 
 	MAP_ADMINISTRATIVE_BOUNDARIES_COUNTRIES_LIST [ help = help_multiple_selection, exclusive = False ]
 	{
-		ANGOLA;AGO
+		AFGHANISTAN;AFG
 		ALGERIA;DZA
-		EGYPT;EGY
+		ANGOLA;AGO
+		ARGENTINA;ARG
+		AUSTRALIA;AUS
+		AUSTRALIA CCK;CCK
+		AUSTRALIA CXR;CXR
+		AUSTRALIA HMD;HMD
+		AUSTRALIA NFK;NFK
+		AUSTRIA;AUT
+		BAIKONUR COSMODROME;RUS
 		BANGLADESH;BGD
-		NAMIBIA;NAM
+		BELARUS;BLR
 		BOLIVIA;BOL
-		GHANA;GHA
-		AUSTRALIA CCK;CCK
-		PAKISTAN;PAK
-		LIBYA;LBY
-		MALAYSIA;MYS
-		KOREA  NORTH;PRK
-		TANZANIA;TZA
 		BOTSWANA;BWA
-		PARAGUAY;PRY
-		SAUDI ARABIA;SAU
-		MAURITANIA;MRT
+		BRAZIL;BRA
+		CAMEROON;CMR
+		CANADA;CAN
+		CENTRAL AFRICAN REPUBLIC;CAF
+		CHAD;TCD
 		CHILE;CHL
 		CHINA;CHN
-		LAOS;LAO
-		UNITED KINGDOM GIB;GIB
-		GUINEA;GIN
-		FINLAND;FIN
-		URUGUAY;URY
-		NEPAL;NPL
-		AUSTRALIA CXR;CXR
-		MOROCCO;MAR
-		YEMEN;YEM
-		SOUTH AFRICA;ZAF
-		TOGO;TGO
-		SYRIA;SYR
-		KAZAKHSTAN;KAZ
+		COLOMBIA;COL
+		CONGO  BRAZZAVILLE ;COG
 		CONGO  KINSHASA ;COD
-		NIGERIA;NGA
-		ZIMBABWE;ZWE
-		UNITED KINGDOM;GBR
-		GUYANA;GUY
-		MYANMAR;MMR
-		CAMEROON;CMR
-		TURKMENISTAN;TKM
-		AUSTRALIA HMD;HMD
-		CHAD;TCD
-		ROMANIA;ROU
-		MONGOLIA;MNG
-		AFGHANISTAN;AFG
-		AUSTRALIA NFK;NFK
-		BELARUS;BLR
-		FINLAND ALA;ALA
-		GREECE;GRC
-		MOZAMBIQUE;MOZ
-		TAJIKISTAN;TJK
-		INDIA;IND
+		CUBA;CUB
 		CZECH REPUBLIC;CZE
-		ISRAEL;ISR
-		PERU;PER
-		INDONESIA;IDN
-		VANUATU;VUT
-		SURINAME;SUR
-		CONGO  BRAZZAVILLE ;COG
-		ETHIOPIA;ETH
-		NIGER;NER
-		COLOMBIA;COL
-		MADAGASCAR;MDG
-		SENEGAL;SEN
+		DENMARK;FRO
 		EAST TIMOR;TLS
+		EGYPT;EGY
+		ERITREA;ERI
+		ETHIOPIA;ETH
+		FINLAND ALA;ALA
+		FINLAND;FIN
 		FRANCE;FRA
-		RWANDA;RWA
-		ZAMBIA;ZMB
+		GABON;GAB
 		GAMBIA  THE;GMB
-		DENMARK;FRO
 		GERMANY;DEU
-		AUSTRALIA;AUS
-		AUSTRIA;AUT
-		NORWAY;SJM
-		VENEZUELA;VEN
-		KENYA;KEN
-		TURKEY;TUR
+		GHANA;GHA
+		GREECE;GRC
+		GUINEA;GIN
+		GUYANA;GUY
+		INDIA;IND
+		INDONESIA;IDN
+		IRAN;IRN
+		IRAQ;IRQ
+		ISRAEL;ISR
 		ITALY;ITA
-		BAIKONUR COSMODROME;RUS
-		MEXICO;MEX
-		BRAZIL;BRA
 		IVORY COAST;CIV
-		SERBIA;SRB
-		UNITED STATES OF AMERICA;USA
-		UKRAINE;UKR
-		CANADA;CAN
-		KOREA  SOUTH;KOR
-		CENTRAL AFRICAN REPUBLIC;CAF
-		SOMALIA;SOM
-		UZBEKISTAN;UZB
-		ERITREA;ERI
-		POLAND;POL
-		GABON;GAB
-		SPAIN;ESP
-		IRAQ;IRQ
-		MALI;MLI
-		IRAN;IRN
-		SOLOMON ISLANDS;SLB
-		NEW ZEALAND;NZL
 		JAPAN;JPN
+		KAZAKHSTAN;KAZ
+		KENYA;KEN
+		KOREA  NORTH;PRK
+		KOREA  SOUTH;KOR
 		KYRGYZSTAN;KGZ
+		LAOS;LAO
+		LIBYA;LBY
+		MADAGASCAR;MDG
+		MALAYSIA;MYS
+		MALI;MLI
+		MAURITANIA;MRT
+		MEXICO;MEX
+		MONGOLIA;MNG
+		MOROCCO;MAR
+		MOZAMBIQUE;MOZ
+		MYANMAR;MMR
+		NAMIBIA;NAM
+		NEPAL;NPL
 		NEW CALEDONIA;NCL
-		ARGENTINA;ARG
-		SUDAN;SDN
+		NEW ZEALAND;NZL
+		NIGERIA;NGA
+		NIGER;NER
+		NORWAY;SJM
+		PAKISTAN;PAK
 		PAPUA NEW GUINEA;PNG
-		CUBA;CUB
+		PARAGUAY;PRY
+		PERU;PER
+		POLAND;POL
+		ROMANIA;ROU
+		RWANDA;RWA
+		SAUDI ARABIA;SAU
+		SENEGAL;SEN
+		SERBIA;SRB
+		SOLOMON ISLANDS;SLB
+		SOMALIA;SOM
+		SOUTH AFRICA;ZAF
+		SPAIN;ESP
+		SUDAN;SDN
+		SURINAME;SUR
+		SYRIA;SYR
+		TAJIKISTAN;TJK
+		TANZANIA;TZA
+		TOGO;TGO
+		TURKEY;TUR
+		TURKMENISTAN;TKM
+		UKRAINE;UKR
+		UNITED KINGDOM;GBR
+		UNITED KINGDOM GIB;GIB
+		UNITED STATES OF AMERICA;USA
+		URUGUAY;URY
+		UZBEKISTAN;UZB
+		VANUATU;VUT
+		VENEZUELA;VEN
+		YEMEN;YEM
+		ZAMBIA;ZMB
+		ZIMBABWE;ZWE
 		*
 		/
 	} = ''
diff --git a/share/metview/etc/MCONTDef b/share/metview/etc/MCONTDef
index e767d67..01efde4 100644
--- a/share/metview/etc/MCONTDef
+++ b/share/metview/etc/MCONTDef
@@ -1,7 +1,7 @@
 PARAMSHARE ; ParamShare; PARAMSHARE
 {
 	COLOUR {
-		%include MagicsColors.h
+		%include MagicsColours.txt
 	}
 	STYLE {
 		SOLID; SOLID
diff --git a/share/metview/etc/MGRAPHDef b/share/metview/etc/MGRAPHDef
index a558a5c..20ef508 100755
--- a/share/metview/etc/MGRAPHDef
+++ b/share/metview/etc/MGRAPHDef
@@ -1,7 +1,7 @@
 PARAMSHARE ; ParamShare; PARAMSHARE
 {
 	COLOUR {
-		%include MagicsColors.h
+		%include MagicsColours.txt
 	}
 	STYLE {
 		SOLID; SOLID
diff --git a/share/metview/etc/MLEGENDDef b/share/metview/etc/MLEGENDDef
index 60f56ea..d2ca98b 100755
--- a/share/metview/etc/MLEGENDDef
+++ b/share/metview/etc/MLEGENDDef
@@ -1,7 +1,7 @@
 PARAMSHARE ; ParamShare; PARAMSHARE
 {
 	COLOUR {
-		%include MagicsColors.h
+		%include MagicsColours.txt
 	}
 	STYLE {
 		SOLID; SOLID
diff --git a/share/metview/etc/MSYMBDef b/share/metview/etc/MSYMBDef
index fb8b0e3..ef0898e 100644
--- a/share/metview/etc/MSYMBDef
+++ b/share/metview/etc/MSYMBDef
@@ -1,7 +1,7 @@
 PARAMSHARE ; ParamShare; PARAMSHARE
 {
 	COLOUR {
-		%include MagicsColors.h
+		%include MagicsColours.txt
 	}
 	STYLE {
 		SOLID; SOLID
diff --git a/share/metview/etc/MTAYLORDef b/share/metview/etc/MTAYLORDef
index d748a1e..601943c 100644
--- a/share/metview/etc/MTAYLORDef
+++ b/share/metview/etc/MTAYLORDef
@@ -1,7 +1,7 @@
 PARAMSHARE ; ParamShare; PARAMSHARE
 {
 	COLOUR {
-		%include MagicsColors.h
+		%include MagicsColours.txt
 		}
 	STYLE {
 		SOLID; SOLID
diff --git a/share/metview/etc/MTEXTDef b/share/metview/etc/MTEXTDef
index 629564f..561a853 100755
--- a/share/metview/etc/MTEXTDef
+++ b/share/metview/etc/MTEXTDef
@@ -1,7 +1,7 @@
 PARAMSHARE ; ParamShare; PARAMSHARE
 {
 	COLOUR {
-		%include MagicsColors.h
+		%include MagicsColours.txt
 	}
 	STYLE {
 		SOLID; SOLID
diff --git a/share/metview/etc/MTHERMOGRIDDef b/share/metview/etc/MTHERMOGRIDDef
index 511fe49..90ae603 100644
--- a/share/metview/etc/MTHERMOGRIDDef
+++ b/share/metview/etc/MTHERMOGRIDDef
@@ -1,7 +1,7 @@
 PARAMSHARE ; ParamShare; PARAMSHARE
 {
 	COLOUR {
-		%include MagicsColors.h
+		%include MagicsColours.txt
 	}
 	STYLE {
 		SOLID; SOLID
diff --git a/share/metview/etc/MWINDDef b/share/metview/etc/MWINDDef
index d16df4d..359ec3c 100644
--- a/share/metview/etc/MWINDDef
+++ b/share/metview/etc/MWINDDef
@@ -1,7 +1,7 @@
 PARAMSHARE ; ParamShare; PARAMSHARE
 {
 	COLOUR {
-		%include MagicsColors.h
+		%include MagicsColours.txt
 	}
 	STYLE {
 		SOLID; SOLID
diff --git a/share/metview/etc/MagicsColors.h b/share/metview/etc/MagicsColours.txt
similarity index 98%
rename from share/metview/etc/MagicsColors.h
rename to share/metview/etc/MagicsColours.txt
index 56dff68..8abc762 100644
--- a/share/metview/etc/MagicsColors.h
+++ b/share/metview/etc/MagicsColours.txt
@@ -22,6 +22,7 @@ BLUE_PURPLE          ; BLUE_PURPLE          #7fff0000ffff:270:100: 50
 LAVENDER             ; LAVENDER             #9df36830f0a2:263: 81: 67
 PURPLISH_BLUE        ; PURPLISH_BLUE        #257a0000ffff:248:100: 50
 BLUE                 ; BLUE                 #00000000ffff:240:100: 50
+ECMWF_BLUE           ; ECMWF_BLUE           #40006e00b300:216:121:121
 NAVY                 ; NAVY                 #000000006666:240:100: 20
 SKY                  ; SKY                  #7332a3d6ffff:219:100: 72
 GREENISH_BLUE        ; GREENISH_BLUE        #00007fffffff:210:100: 50
diff --git a/share/metview/etc/MarsRules b/share/metview/etc/MarsRules
index c03f72a..f3193f0 100755
--- a/share/metview/etc/MarsRules
+++ b/share/metview/etc/MarsRules
@@ -474,15 +474,6 @@
 	%and (%not DATABASE) %then
 	%set DATABASE = file
 
-%if (_VERB = ARCHIVE %or 
-	 _VERB = FLUSH %or 
-	 _VERB = STAGE %or 
-	 _VERB = LIST %or 
-	 _VERB = REMOVE)
-	%and (EXPVER=fdy1) 
-	%and (%not DATABASE) %then
-	%set DATABASE = mars grib2
-
 
 %if (_VERB = ARCHIVE %or 
 	 _VERB = FLUSH %or 
@@ -503,6 +494,7 @@
 		  CLASS=EM %or 
 		  CLASS=E2 %or 
 		  CLASS=EA %or 
+		  CLASS=ET %or 
 		  CLASS=NR %or 
 		  CLASS=EP %or 
 		  CLASS=RM %or 
@@ -577,6 +569,7 @@
 		  CLASS<>EM %and
 		  CLASS<>E2 %and
 		  CLASS<>EA %and
+		  CLASS<>ET %and
 		  CLASS<>UR %and
 		  CLASS<>MC %and
 		  CLASS<>NR %and
@@ -725,10 +718,12 @@
 # 	%unset STEP
 # 
 
-%if (CLASS = TI %or CLASS = S2) %then                %unset DOMAIN
+%if (CLASS = TI %or CLASS = S2 %or CLASS = UR ) %then                %unset DOMAIN
 %if (CLASS = TI %or CLASS = S2) %and TYPE = CF %then %set NUMBER=0
 %if CLASS = TI %and TYPE = FC %then %set STREAM=OPER
-%if (CLASS = TI %or CLASS = S2) %and (%not EXPVER) %then %set EXPVER=PROD
+%if (CLASS = TI %or CLASS = S2 %or CLASS = UR ) %and (%not EXPVER) %then %set EXPVER=PROD
+
+%if (CLASS = UR) %then %unset MODEL
 
 %if CLASS = DM %and TYPE = FC %then %set TIME=0
 
diff --git a/share/metview/etc/ObjectList b/share/metview/etc/ObjectList
index a32be7b..9976d85 100644
--- a/share/metview/etc/ObjectList
+++ b/share/metview/etc/ObjectList
@@ -59,7 +59,7 @@ resources,
 			    devices/all_printers/
 			    coastlines/macros/hidden/general/
 			    templates/system_templates/retrieve,
-	colour_file 	  = '$METVIEW_DIR_SHARE/etc/MagicsColors.h',
+	colour_file 	  = '$METVIEW_DIR_SHARE/etc/MagicsColours.txt',
 	help_file         = 'Metview_UI_Help',
 #	vismod_help_file  = 'Visualisation_Help',
 #	printer_list_file = '$METVIEW_DIR_SHARE/etc/PrinterList',
@@ -1645,7 +1645,7 @@ state,
    service    = uPlotManager
 
 state,
-   class      = GRIB/GEOPOINTS/BUFR/ODB_DB/NETCDF/IMAGE,
+   class      = GRIB/GEOPOINTS/BUFR/ODB_DB/NETCDF/IMAGE/TABLE,
    action     = save,
    service    = savepool
 
@@ -1780,7 +1780,7 @@ state,
 		       SAMPLE_FORMULA_FDN/
 		       SAMPLE_FORMULA_FND/
 		       SAMPLE_FORMULA_FNN,
-	output_class = GRIB/GEOPOINTS,
+	output_class = GRIB/GEOPOINTS/BUFR,
 	service      = macro
 
 state,
diff --git a/share/metview/etc/ObsFilterDef b/share/metview/etc/ObsFilterDef
index e4d8a21..a7fbf2d 100644
--- a/share/metview/etc/ObsFilterDef
+++ b/share/metview/etc/ObsFilterDef
@@ -34,7 +34,11 @@ _SUBREQUEST ; Dummy ; dummy
 		LSD - Synop auto record 2 land		; SA2	; 4
 		LSD - Soil and earth temperature	; SET	; 7
 		LSD - Metar				; METAR	; 140
-
+        LSD - Bufr land synop             ; BS ; 170
+        LSD - Bufr land synop 2          ; BS2 ; 172
+        LSD - Bufr land synop Wmo region 6   ; BSR6 ; 176
+        LSD - Bufr land synop 1 hourly   ; BS1H ; 178
+        
 		SSD - Synop ship abbreviated		; SAB	; 9
 		SSD - Synop ship			; SS	; 11
 		SSD - Synop record 2 ship		; SS2	; 12
@@ -44,6 +48,7 @@ _SUBREQUEST ; Dummy ; dummy
 		SSD - DRIBU SURFACE			; DSU	; 21
 		SSD - BATHY SURFACE			; BSU	; 22
 		SSD - TESAC SURFACE			; TSU	; 23
+        SSD - Bufr ship synop       ; BSS   ; 180
 
 		SF - STORM				; STOR	; 31
 
diff --git a/share/metview/etc/ObsPlottingDef b/share/metview/etc/ObsPlottingDef
index a011027..950eae9 100644
--- a/share/metview/etc/ObsPlottingDef
+++ b/share/metview/etc/ObsPlottingDef
@@ -1,7 +1,7 @@
 PARAMSHARE ; ParamShare; PARAMSHARE
 {
 	COLOUR {
-		%include MagicsColors.h
+		%include MagicsColours.txt
 	}
 	STYLE {
 		SOLID; SOLID
diff --git a/share/metview/etc/PDFOutputDef b/share/metview/etc/PDFOutputDef
index e0e0d6e..090f921 100644
--- a/share/metview/etc/PDFOutputDef
+++ b/share/metview/etc/PDFOutputDef
@@ -1,17 +1,3 @@
-PARAMSHARE ; ParamShare; PARAMSHARE
-{
-	COLOUR {
-		%include MagicsColors.h
-	}
-	STYLE {
-		SOLID; SOLID
-		DASH; DASH
-		DOT; DOT
-		CHAIN_DOT; CHAIN_DOT
-		CHAIN_DASH; CHAIN_DASH
-	}
-}
-
 PDFOUTPUT; Magics; Automatically generated
 {
 	OUTPUT_TITLE
diff --git a/share/metview/etc/PNGOutputDef b/share/metview/etc/PNGOutputDef
index 5f4b81b..3a9d1ae 100644
--- a/share/metview/etc/PNGOutputDef
+++ b/share/metview/etc/PNGOutputDef
@@ -1,17 +1,3 @@
-PARAMSHARE ; ParamShare; PARAMSHARE
-{
-	COLOUR {
-		%include MagicsColors.h
-	}
-	STYLE {
-		SOLID; SOLID
-		DASH; DASH
-		DOT; DOT
-		CHAIN_DOT; CHAIN_DOT
-		CHAIN_DASH; CHAIN_DASH
-	}
-}
-
 PNGOUTPUT; Magics; Automatically generated
 {
 	OUTPUT_TITLE
diff --git a/share/metview/etc/PSOutputDef b/share/metview/etc/PSOutputDef
index a5e29aa..6e7a68a 100644
--- a/share/metview/etc/PSOutputDef
+++ b/share/metview/etc/PSOutputDef
@@ -1,17 +1,3 @@
-PARAMSHARE ; ParamShare; PARAMSHARE
-{
-	COLOUR {
-		%include MagicsColors.h
-	}
-	STYLE {
-		SOLID; SOLID
-		DASH; DASH
-		DOT; DOT
-		CHAIN_DOT; CHAIN_DOT
-		CHAIN_DASH; CHAIN_DASH
-	}
-}
-
 PSOUTPUT; Magics; Automatically generated
 {
 	OUTPUT_TITLE
diff --git a/share/metview/etc/PageFrameDef b/share/metview/etc/PageFrameDef
index 96fa346..4990744 100644
--- a/share/metview/etc/PageFrameDef
+++ b/share/metview/etc/PageFrameDef
@@ -6,7 +6,7 @@ PAGE_FRAME
 
 PAGE_FRAME_COLOUR [interface = colour]
 {
-   %include MagicsColors.h
+   %include MagicsColours.txt
 } = CHARCOAL
 
 PAGE_FRAME_LINE_STYLE
@@ -56,8 +56,8 @@ PAGE_FRAME_THICKNESS
 
    PAGE_ID_LINE_COLOUR [ visible = false, interface = colour]
    {
-      %include MagicsColors.h
-   } = BLUE
+      %include MagicsColours.txt
+   } = ECMWF_BLUE
 
    PAGE_ID_LINE_SYSTEM_PLOT [ visible = false ]
    {
diff --git a/share/metview/etc/PlotPageDef b/share/metview/etc/PlotPageDef
index 27bea30..8c8e4da 100644
--- a/share/metview/etc/PlotPageDef
+++ b/share/metview/etc/PlotPageDef
@@ -6,7 +6,7 @@ PARAMSHARE ; ParamShare; PARAMSHARE
        }
  
        COLOUR {
-			%include MagicsColors.h
+			%include MagicsColours.txt
        } 
 
        LINE_STYLE {
diff --git a/share/metview/etc/SVGOutputDef b/share/metview/etc/SVGOutputDef
index ba8451c..e0bf972 100644
--- a/share/metview/etc/SVGOutputDef
+++ b/share/metview/etc/SVGOutputDef
@@ -1,17 +1,3 @@
-PARAMSHARE ; ParamShare; PARAMSHARE
-{
-	COLOUR {
-		%include MagicsColors.h
-	}
-	STYLE {
-		SOLID; SOLID
-		DASH; DASH
-		DOT; DOT
-		CHAIN_DOT; CHAIN_DOT
-		CHAIN_DASH; CHAIN_DASH
-	}
-}
-
 SVGOUTPUT; Magics; Automatically generated
 {
 	OUTPUT_TITLE
diff --git a/share/metview/etc/SubpageFrameDef b/share/metview/etc/SubpageFrameDef
index 5bba56a..784ecad 100644
--- a/share/metview/etc/SubpageFrameDef
+++ b/share/metview/etc/SubpageFrameDef
@@ -6,7 +6,7 @@ SUBPAGE_FRAME
 
 SUBPAGE_FRAME_COLOUR [interface = colour]
 {
-   %include MagicsColors.h
+   %include MagicsColours.txt
 } = BLACK
 
 SUBPAGE_FRAME_LINE_STYLE
@@ -34,5 +34,5 @@ SUBPAGE_FRAME_THICKNESS
 
 SUBPAGE_BACKGROUND_COLOUR [interface = colour]
 {
-   %include MagicsColors.h
+   %include MagicsColours.txt
 } = WHITE
diff --git a/share/metview/etc/SymbDef b/share/metview/etc/SymbDef
index 0e03ec1..e1a6512 100755
--- a/share/metview/etc/SymbDef
+++ b/share/metview/etc/SymbDef
@@ -6,7 +6,7 @@ PARAMSHARE ; ParamShare; PARAMSHARE
        }
  
        COLOUR {
-			%include MagicsColors.h
+			%include MagicsColours.txt
        } 
 
        LINE_STYLE {
diff --git a/share/metview/etc/TextDef b/share/metview/etc/TextDef
index 5067d26..7f23afb 100755
--- a/share/metview/etc/TextDef
+++ b/share/metview/etc/TextDef
@@ -6,7 +6,7 @@ PARAMSHARE ; ParamShare; PARAMSHARE
        }
 
        COLOUR {
-			%include MagicsColors.h
+			%include MagicsColours.txt
        }
 
        LINE_STYLE {
diff --git a/share/metview/etc/WindDef b/share/metview/etc/WindDef
index e53f43c..dff9331 100755
--- a/share/metview/etc/WindDef
+++ b/share/metview/etc/WindDef
@@ -6,7 +6,7 @@ PARAMSHARE ; ParamShare; PARAMSHARE
        }
  
        COLOUR {
-			%include MagicsColors.h
+			%include MagicsColours.txt
        } 
 
        LINE_STYLE {
diff --git a/share/metview/etc/ecmwf.def b/share/metview/etc/ecmwf.def
index f9f7614..dfffc9f 100755
--- a/share/metview/etc/ecmwf.def
+++ b/share/metview/etc/ecmwf.def
@@ -59,6 +59,7 @@ ACCUMULATED LIQUID WATER TENDENCY             ;  ALW   ;  242
 ACCUMULATED CARBON DIOXIDE NET ECOSYSTEM EXCHANGE   ; ACO2NEE; 80.228
 ACCUMULATED CARBON DIOXIDE GROSS PRIMARY PRODUCTION ; ACO2GPP; 81.228
 ACCUMULATED CARBON DIOXIDE ECOSYSTEM RESPIRATION    ; ACO2REC; 82.228
+ACCUMULATED FREEZING RAIN                     ;  FZRA  ;  228216
 ADIABATIC TENDENCY OF HUMIDITY                ;  ATH   ;  229
 ADIABATIC TENDENCY OF HUMIDITY - ECMWF        ;  ATHE  ;  252
 ADIABATIC TENDENCY OF MERIDIONAL WIND         ;  ATMW  ;  254
@@ -101,8 +102,10 @@ CLOUD LIQUID WATER CONTENT                    ;  CLWC  ;  246
 CLOUD LIQUID WATER CONTENT - ERA              ; CLWCER ;  241
 CLOUD RAIN WATER CONTENT                      ;  CRWC  ;  75
 CLOUD SNOW WATER CONTENT                      ;  CSWC  ;  76
+CLOUDY BRIGHTNESS TEMPERATURE                 ;  CLBT  ; 260510
 COEFFICIENT OF DRAG WITH WAVES                ;  CDWW  ;  233
 CONVECTIVE AVAILABLE POTENTIAL ENERGY         ;  CAPE  ;  059
+CONVECTIVE AVAILABLE POTENTIAL ENERGY SHEAR   ;  CAPES ;  228044
 CONVECTIVE CLOUD COVER                        ;  CCC   ;  185
 CONVECTIVE INHIBITION                         ;  CIN   ;  228001
 CONVECTIVE PRECIPITATION                      ;  CP    ;  143
@@ -299,6 +302,7 @@ SIGNIFICANT WAVE HEIGHT PROBABILITY           ;  SWHP  ;  229
 SIGNIFICANT WAVE HEIGHT OF FIRST SWELL PARTITION ;  SWH1 ;    121
 SIGNIFICANT WAVE HEIGHT OF SECOND SWELL PARTITION;  SWH2 ;    124
 SIGNIFICANT WAVE HEIGHT OF SWELL THIRD PARTITION ;  SWH3 ;    127
+SIGNIFICANT WAVE HEIGHT OF ALL WAVES WITH PERIOD LARGER THAN 10S  ; SH10  ; 120
 SKIN RESERVOIR CONTENT                        ;  SRC   ;  198
 SKIN TEMPERATURE                              ;  SKT   ;  235
 SLOPE OF SUBGRID OROGRAPHY                    ;  SLOR  ;  163
@@ -712,12 +716,12 @@ TOTAL AEROSOL OPTICAL DEPTH AT 1240NM         ; AOD1240 ; 216.210
 		E20CM       ; EM
 		E20C        ; E2
 		ESAT        ; ERA5   ; EA
-		CERA20C     ; EP
+		CERA20C     ; CERA-20C ; EP
 
         EURO4M      ; RM
-        UERRA       ; UR
         20CR        ; NCEP 20CR ; NR
 		JRA55       ;	J5
+		CERASAT     ; CERA-SAT ; ET
 
 		! Member stats
 
@@ -741,8 +745,11 @@ TOTAL AEROSOL OPTICAL DEPTH AT 1240NM         ; AOD1240 ; 216.210
 		SWEDEN		;	SE 
 		SWITZERLAND	;	CH 
 		TURKEY		;	TR 
-		UNITED KINGDOM;	UK 
-
+		UNITED KINGDOM  ;	UK
+                ! 07/2016 MASV at ECMWF.INT
+                ! hack used by UERRA (tigge.def)
+                ! class on following line is fictitious 
+                UNITED UERRA HACK ;     UZZZ
 		! Test
 		METAPS      ;   MA
 		TEST        ;   TE
@@ -1057,7 +1064,7 @@ TOTAL AEROSOL OPTICAL DEPTH AT 1240NM         ; AOD1240 ; 216.210
 
 		 ALL                = (NSD/SD)
 		 CONVENTIONAL; NSD  = (LSD/SSD/VSNS/SLNS/SLS/OD/DD/CC/SF/GBGPS/OSTIA)
-		 SD                 = (SDS/VSS/SSMI/SSMIS/SSBT/TRMM/QSCAT/REO3/IASI/ATMS/CRIS)
+		 SD                 = (SDS/VSS/SSMI/SSMIS/SSBT/TRMM/QSCAT/REO3/IASI/ATMS/CRIS/VASS)
 
 # Image stuff
 
@@ -1090,6 +1097,8 @@ ATMS = (201)
 CRIS = (202)
 SMOS = (203)
 AMSR2_GC = (60)
+DMBO = (181/182)
+SAPHIR = (211)
 
 # FeedBack
 
@@ -1130,7 +1139,7 @@ FBWINDSAT = (156)
 
 # Type SSD (NSD)
 
-	SEA SURFACE DATA ; SSD  = ( 9/11/12/13/14/19/21/22/23/180 )
+	SEA SURFACE DATA ; SSD  = ( 9/11/12/13/14/19/21/22/23/180/181/182 )
 
 	SYNOP ABBREVIATED SHIP    ; SAB ; 9
 	SYNOP SHIP               ; SS   ; 11
@@ -1144,6 +1153,8 @@ FBWINDSAT = (156)
 	OSTIA                     ;       26
 	BUOY                      ;       27
 	BUFR SHIP SYNOP           ; BSS ; 180
+	BUFR MOORED BUOYS         ; BMB ; 181
+	BUFR DRIFTING BUOYS       ; BDB ; 182
 
 
 # Type VSNS (NSD)
@@ -1480,6 +1491,7 @@ CROSS-TRACK INFRARED SOUNDER               ; CRIS ; 202
 		O512
 		O640
 		O1280
+		O2000
         *
         /
         OFF     ;  OFF
@@ -1534,7 +1546,7 @@ ARCHIVE ;   Archives data   ;   MARS
 		@
 	}
 
-    CLASS  { &_DUMMY&CLASS  } = OD
+    CLASS  { &_DUMMY&CLASS  } = OD 
 
     TYPE   { &_DUMMY&TYPE   } = AN
 
@@ -1862,6 +1874,12 @@ ARCHIVE ;   Archives data   ;   MARS
         "   
     } = ""
 
+	OPTIMISE 
+    {
+		ON
+		OFF
+	} = OFF
+
 	DATABASE [ priority = 1 ]
 	{
 		@
@@ -4051,6 +4069,16 @@ RETRIEVE    ;   Retrieval of data   ;   MARS
         NO  ;   N
     } = N
     
+	OPTIMISE [ java_control = CHOICE, 
+				java_section = OTHER, 
+				hidden      = TRUE,
+			check        = false,
+				java_hidden = FALSE ]
+    {
+		ON
+		OFF
+	} = OFF
+
     PROCESS  [ java_control = CHOICE, 
 			   java_section = OTHER, 
 			   hidden       = TRUE,
@@ -4419,7 +4447,7 @@ READ ; X; METVIEW
 		/
 	} = ANY
 
-    GRID
+    GRID [ exact_match = true ]
     {
 		&_DUMMY&GRID
         ANY     ; ANY
diff --git a/share/metview/etc/licence_for_about_box.txt b/share/metview/etc/licence_for_about_box.txt
index 77221a0..8b9a1dd 100644
--- a/share/metview/etc/licence_for_about_box.txt
+++ b/share/metview/etc/licence_for_about_box.txt
@@ -1,4 +1,4 @@
-Copyright 2014 ECMWF and INPE. This software is distributed under the terms
+Copyright 2016 ECMWF and INPE. This software is distributed under the terms
 of the Apache License version 2.0. In applying this license, ECMWF does not
 waive the privileges and immunities granted to it by virtue of its status as
 an Intergovernmental Organization or submit itself to any jurisdiction.
diff --git a/share/metview/etc/mars.chk b/share/metview/etc/mars.chk
index c03f72a..f3193f0 100755
--- a/share/metview/etc/mars.chk
+++ b/share/metview/etc/mars.chk
@@ -474,15 +474,6 @@
 	%and (%not DATABASE) %then
 	%set DATABASE = file
 
-%if (_VERB = ARCHIVE %or 
-	 _VERB = FLUSH %or 
-	 _VERB = STAGE %or 
-	 _VERB = LIST %or 
-	 _VERB = REMOVE)
-	%and (EXPVER=fdy1) 
-	%and (%not DATABASE) %then
-	%set DATABASE = mars grib2
-
 
 %if (_VERB = ARCHIVE %or 
 	 _VERB = FLUSH %or 
@@ -503,6 +494,7 @@
 		  CLASS=EM %or 
 		  CLASS=E2 %or 
 		  CLASS=EA %or 
+		  CLASS=ET %or 
 		  CLASS=NR %or 
 		  CLASS=EP %or 
 		  CLASS=RM %or 
@@ -577,6 +569,7 @@
 		  CLASS<>EM %and
 		  CLASS<>E2 %and
 		  CLASS<>EA %and
+		  CLASS<>ET %and
 		  CLASS<>UR %and
 		  CLASS<>MC %and
 		  CLASS<>NR %and
@@ -725,10 +718,12 @@
 # 	%unset STEP
 # 
 
-%if (CLASS = TI %or CLASS = S2) %then                %unset DOMAIN
+%if (CLASS = TI %or CLASS = S2 %or CLASS = UR ) %then                %unset DOMAIN
 %if (CLASS = TI %or CLASS = S2) %and TYPE = CF %then %set NUMBER=0
 %if CLASS = TI %and TYPE = FC %then %set STREAM=OPER
-%if (CLASS = TI %or CLASS = S2) %and (%not EXPVER) %then %set EXPVER=PROD
+%if (CLASS = TI %or CLASS = S2 %or CLASS = UR ) %and (%not EXPVER) %then %set EXPVER=PROD
+
+%if (CLASS = UR) %then %unset MODEL
 
 %if CLASS = DM %and TYPE = FC %then %set TIME=0
 
diff --git a/share/metview/etc/tigge.def b/share/metview/etc/tigge.def
index ed54429..5d6c26c 100755
--- a/share/metview/etc/tigge.def
+++ b/share/metview/etc/tigge.def
@@ -109,6 +109,38 @@ SNOW ALBEDO                              ;    ASN   ;     228032
 TIME INTEGRATED SURFACE NET SOLAR RADIATION DOWNWARDS       ;    SSRD ;     169
 TIME INTEGRATED SURFACE NET THERMAL RADIATION DOWNWARDS     ;    STRD ;     175
 
+# Additions for UERRA
+SPECIFIC CLOUD LIQUID WATER CONTENT      ;   CLWC   ;    246
+SPECIFIC CLOUD ICE WATER CONTENT         ;   CIWC   ;    247
+TOTAL COLUMN INTEGRATED WATER VAPOUR     ;  TCIWV   ; 260057
+RELATIVE HUMIDITY                        ;      R   ;    157
+CLOUD COVER                              ;    CCL   ; 260257
+HIGH CLOUD COVER                         ;    HCC   ;   3075
+MEDIUM CLOUD COVER                       ;    MCC   ;   3074
+LOW CLOUD COVER                          ;    LCC   ;   3073
+WIND SPEED                               ;     WS   ;     10
+WIND DIRECTION                           ;   WDIR   ;   3031
+PRESSURE                                 ;   PRES   ;     54
+SURFACE AIR RELATIVE HUMIDITY            ;     2R   ; 260242
+PERCOLATION                              ;   PERC   ; 260430
+ALBEDO                                   ;     AL   ; 260509
+EVAPORATION                              ;    EVA   ; 260259
+TIME-INTEGRATED SURFACE CLEAR-SKY SOLAR RADIATION DOWNWARDS   ; ADSWRF_CS  ; 260423
+TIME-INTEGRATED SURFACE CLEAR-SKY SOLAR RADIATION UPWARDS     ; AUSWRF_CS  ; 260427
+TIME-INTEGRATED SURFACE DIRECT SOLAR RADIATION                ; TIDIRSWRF  ; 260264
+TIME-INTEGRATED SURFACE CLEAR-SKY THERMAL RADIATION DOWNWARDS ; ADLWRF_CS ; 260428
+10 METRE WIND DIRECTION                  ;  10WDIR  ; 260260
+10 METRE WIND SPEED                      ;    10SI  ;    207
+WIND GUST AT 10 METRES SINCE PREVIOUS POST-PROCESSING  ; 10FG   ;  49
+SURFACE AIR MAXIMUM TEMPERATURE SINCE PREVIOUS POST-PROCESSING  ; MX2T  ; 201
+SURFACE AIR MINIMUM TEMPERATURE SINCE PREVIOUS POST-PROCESSING  ; MN2T  ; 202
+LIQUID NON-FROZEN VOLUMETRIC SOIL WATER  ;  LIQVSM  ; 260210
+VOLUMETRIC SOIL WATER                    ;     VSW  ; 260199
+SOIL HEAT FLUX                           ;    SOHF  ; 260364
+SOIL DEPTH                               ;     SOD  ; 260367
+SOIL TEMPERATURE                         ;     SOT  ; 260360
+SNOW DEPTH                               ;     SDE  ;   3066
+SURFACE ROUGHNESS                        ;      SR  ;    173
 		*
         /   
     } = T
@@ -136,6 +168,8 @@ TIME INTEGRATED SURFACE NET THERMAL RADIATION DOWNWARDS     ;    STRD ;     175
 		ENFO
 		ENFH
 		DA   ; OPER
+# For UERRA
+		ENDA
     } = ENFO
 
 	EXPVER
@@ -191,6 +225,9 @@ TIME INTEGRATED SURFACE NET THERMAL RADIATION DOWNWARDS     ;    STRD ;     175
 		AROMEEPS-MF-EU
 		PEARP-MF-EU
 
+	# UERRA
+		ESWI
+		EDZW
 		/
 		ALL
 
@@ -201,15 +238,18 @@ TIME INTEGRATED SURFACE NET THERMAL RADIATION DOWNWARDS     ;    STRD ;     175
 	{
 		GLOB
 		LAM
+		OFF
 	} = GLOB
 
     LEVTYPE  
     {
 		POTENTIAL VORTICITY   ; PV
 		POTENTIAL TEMPERATURE ; PT
-        SURFACE               ; SFC
+        SURFACE               ; SL ; SFC
         PRESSURE LEVELS       ; PL
         MODEL LEVELS          ; ML
+		HEIGHT LEVELS         ; HL
+		SOIL LEVELS           ; SOL
 		ALL
     } = PL
     
@@ -322,7 +362,7 @@ ARCHIVE ;   Archives data   ;   TIGGE
 		@
 	}
 
-    CLASS  { &TIGGEDEF&CLASS  } = TI
+    CLASS{ &TIGGEDEF&CLASS  } = TI 
 
     TYPE   { &TIGGEDEF&TYPE   } = CF
 
diff --git a/share/metview/icons/FLEXTRA_FILE.xpm b/share/metview/icons/FLEXTRA_FILE.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons/FLEXTRA_PREPARE.xpm b/share/metview/icons/FLEXTRA_PREPARE.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons/FLEXTRA_RUN.xpm b/share/metview/icons/FLEXTRA_RUN.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons/FLEXTRA_VISUALISER.xpm b/share/metview/icons/FLEXTRA_VISUALISER.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons/INPUTVISUALISER.xpm b/share/metview/icons/INPUTVISUALISER.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons/NETCDFPLUS.xpm b/share/metview/icons/NETCDFPLUS.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons/ODB_DB.xpm b/share/metview/icons/ODB_DB.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons/ODB_VISUALISER.xpm b/share/metview/icons/ODB_VISUALISER.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons/TABLEVISUALISER.xpm b/share/metview/icons/TABLEVISUALISER.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons/fix_last_line b/share/metview/icons/fix_last_line
index 3e8780d..a2e9a68 100755
--- a/share/metview/icons/fix_last_line
+++ b/share/metview/icons/fix_last_line
@@ -1,4 +1,4 @@
-#!/bin/ksh
+#!/bin/bash
 #                                        030109/vk
 # On some platforms 'convert' is broken
 # and is not able to read xpm files that
diff --git a/share/metview/icons/help_area.xpm b/share/metview/icons/help_area.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons/help_line.xpm b/share/metview/icons/help_line.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons/help_map.xpm b/share/metview/icons/help_map.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons/help_point.xpm b/share/metview/icons/help_point.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons/help_station.xpm b/share/metview/icons/help_station.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/AVERAGE.xpm b/share/metview/icons_mv5/AVERAGE.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/AVERAGEVIEW.xpm b/share/metview/icons_mv5/AVERAGEVIEW.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/FLEXTRA_FILE.svg b/share/metview/icons_mv5/FLEXTRA_FILE.svg
index 581f2fd..59224d3 100644
--- a/share/metview/icons_mv5/FLEXTRA_FILE.svg
+++ b/share/metview/icons_mv5/FLEXTRA_FILE.svg
@@ -14,7 +14,7 @@
    height="32"
    id="svg2"
    version="1.1"
-   inkscape:version="0.47 r22583"
+   inkscape:version="0.48.4 r9939"
    sodipodi:docname="FLEXTRA_FILE.svg"
    style="display:inline"
    inkscape:export-xdpi="360"
@@ -159,16 +159,16 @@
      inkscape:pageshadow="2"
      inkscape:zoom="28.4375"
      inkscape:cx="14.709653"
-     inkscape:cy="15.388584"
+     inkscape:cy="15.406166"
      inkscape:document-units="px"
-     inkscape:current-layer="layer7"
+     inkscape:current-layer="layer4"
      showgrid="true"
      width="64px"
      inkscape:snap-grids="false"
      inkscape:window-width="1620"
      inkscape:window-height="1096"
-     inkscape:window-x="2044"
-     inkscape:window-y="0"
+     inkscape:window-x="2638"
+     inkscape:window-y="125"
      inkscape:window-maximized="0">
     <inkscape:grid
        type="xygrid"
@@ -255,30 +255,6 @@
            y="-5.8902793" /></flowRegion><flowPara
          id="flowPara4697" /></flowRoot>    <text
        xml:space="preserve"
-       style="font-size:8.22735882px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:85.00000238%;writing-mode:lr-tb;text-anchor:start;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Arial Black;-inkscape-font-specification:'Arial Black, Bold'"
-       x="1.9132091"
-       y="42.483063"
-       id="text4681"
-       transform="scale(0.96637605,1.0347939)"
-       sodipodi:linespacing="85.000002%"><tspan
-         sodipodi:role="line"
-         id="tspan2907"
-         x="1.9132091"
-         y="42.483063">T</tspan><tspan
-         sodipodi:role="line"
-         id="tspan2909"
-         x="1.9132091"
-         y="49.476318">R</tspan><tspan
-         sodipodi:role="line"
-         id="tspan2911"
-         x="1.9132091"
-         y="56.469574">A</tspan><tspan
-         sodipodi:role="line"
-         id="tspan2913"
-         x="1.9132091"
-         y="63.462826" /></text>
-    <text
-       xml:space="preserve"
        style="font-size:8.34053326px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:94.99999881%;writing-mode:lr-tb;text-anchor:start;fill:#3737c8;fill-opacity:1;stroke:none;display:inline;font-family:Arial Black;-inkscape-font-specification:'Arial Black, Bold'"
        x="9.8165455"
        y="60.536304"
@@ -289,6 +265,47 @@
          id="tspan2915"
          x="9.8165455"
          y="60.536304" /></text>
+    <text
+       xml:space="preserve"
+       style="font-size:9px;font-style:normal;font-weight:normal;line-height:85.00000238%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Courier New KOI-8;-inkscape-font-specification:Courier New KOI-8"
+       x="1.8761462"
+       y="51.185665"
+       id="text3036-3"
+       sodipodi:linespacing="85.000002%"><tspan
+         sodipodi:role="line"
+         x="1.8761462"
+         y="51.185665"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black"
+         id="tspan3054-7">R</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:9px;font-style:normal;font-weight:normal;line-height:85.00000238%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Courier New KOI-8;-inkscape-font-specification:Courier New KOI-8"
+       x="2.0295608"
+       y="44.02916"
+       id="text3036-8-0"
+       sodipodi:linespacing="85.000002%"><tspan
+         sodipodi:role="line"
+         x="2.0295608"
+         y="44.02916"
+         id="tspan3042-0-9"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black">T</tspan><tspan
+         sodipodi:role="line"
+         x="2.0295608"
+         y="51.02211"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black"
+         id="tspan3054-4-5" /></text>
+    <text
+       xml:space="preserve"
+       style="font-size:9px;font-style:normal;font-weight:normal;line-height:85.00000238%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Courier New KOI-8;-inkscape-font-specification:Courier New KOI-8"
+       x="1.9555587"
+       y="58.422531"
+       id="text3036-6-9"
+       sodipodi:linespacing="85.000002%"><tspan
+         sodipodi:role="line"
+         x="1.9555587"
+         y="58.422531"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black"
+         id="tspan3054-5-5">A</tspan></text>
   </g>
   <g
      inkscape:groupmode="layer"
diff --git a/share/metview/icons_mv5/FLEXTRA_PREPARE.svg b/share/metview/icons_mv5/FLEXTRA_PREPARE.svg
index 7670e2b..8546013 100644
--- a/share/metview/icons_mv5/FLEXTRA_PREPARE.svg
+++ b/share/metview/icons_mv5/FLEXTRA_PREPARE.svg
@@ -14,7 +14,7 @@
    height="32"
    id="svg2"
    version="1.1"
-   inkscape:version="0.47 r22583"
+   inkscape:version="0.48.4 r9939"
    sodipodi:docname="FLEXTRA_PREPARE.svg"
    style="display:inline"
    inkscape:export-xdpi="360"
@@ -98,16 +98,16 @@
      inkscape:pageshadow="2"
      inkscape:zoom="28.340063"
      inkscape:cx="11.589162"
-     inkscape:cy="15.20477"
+     inkscape:cy="22.705775"
      inkscape:document-units="px"
-     inkscape:current-layer="layer6"
+     inkscape:current-layer="layer4"
      showgrid="true"
      width="64px"
      inkscape:snap-grids="false"
      inkscape:window-width="1620"
-     inkscape:window-height="1096"
-     inkscape:window-x="235"
-     inkscape:window-y="35"
+     inkscape:window-height="960"
+     inkscape:window-x="2216"
+     inkscape:window-y="26"
      inkscape:window-maximized="0">
     <inkscape:grid
        type="xygrid"
@@ -194,28 +194,45 @@
            y="-5.8902793" /></flowRegion><flowPara
          id="flowPara4697" /></flowRoot>    <text
        xml:space="preserve"
-       style="font-size:8.22735882px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:85.00000238%;writing-mode:lr-tb;text-anchor:start;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Arial Black;-inkscape-font-specification:'Arial Black, Bold'"
-       x="1.8615597"
-       y="42.352486"
-       id="text4681"
-       transform="scale(0.96637601,1.0347939)"
+       style="font-size:9px;font-style:normal;font-weight:normal;line-height:85.00000238%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Courier New KOI-8;-inkscape-font-specification:Courier New KOI-8"
+       x="1.8233471"
+       y="51.202194"
+       id="text3036-3"
        sodipodi:linespacing="85.000002%"><tspan
          sodipodi:role="line"
-         id="tspan2907"
-         x="1.8615597"
-         y="42.352486">T</tspan><tspan
+         x="1.8233471"
+         y="51.202194"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black"
+         id="tspan3054-7">R</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:9px;font-style:normal;font-weight:normal;line-height:85.00000238%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Courier New KOI-8;-inkscape-font-specification:Courier New KOI-8"
+       x="1.9767618"
+       y="44.045689"
+       id="text3036-8-0"
+       sodipodi:linespacing="85.000002%"><tspan
          sodipodi:role="line"
-         id="tspan2909"
-         x="1.8615597"
-         y="49.345741">R</tspan><tspan
+         x="1.9767618"
+         y="44.045689"
+         id="tspan3042-0-9"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black">T</tspan><tspan
          sodipodi:role="line"
-         id="tspan2911"
-         x="1.8615597"
-         y="56.338997">A</tspan><tspan
+         x="1.9767618"
+         y="51.038639"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black"
+         id="tspan3054-4-5" /></text>
+    <text
+       xml:space="preserve"
+       style="font-size:9px;font-style:normal;font-weight:normal;line-height:85.00000238%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Courier New KOI-8;-inkscape-font-specification:Courier New KOI-8"
+       x="1.9027596"
+       y="58.43906"
+       id="text3036-6-9"
+       sodipodi:linespacing="85.000002%"><tspan
          sodipodi:role="line"
-         id="tspan2913"
-         x="1.8615597"
-         y="63.332253" /></text>
+         x="1.9027596"
+         y="58.43906"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black"
+         id="tspan3054-5-5">A</tspan></text>
   </g>
   <g
      inkscape:groupmode="layer"
diff --git a/share/metview/icons_mv5/FLEXTRA_RUN.svg b/share/metview/icons_mv5/FLEXTRA_RUN.svg
index bcd4403..048ce5f 100644
--- a/share/metview/icons_mv5/FLEXTRA_RUN.svg
+++ b/share/metview/icons_mv5/FLEXTRA_RUN.svg
@@ -14,7 +14,7 @@
    height="32"
    id="svg2"
    version="1.1"
-   inkscape:version="0.47 r22583"
+   inkscape:version="0.48.4 r9939"
    sodipodi:docname="FLEXTRA_RUN.svg"
    style="display:inline"
    inkscape:export-xdpi="360"
@@ -126,6 +126,100 @@
        id="linearGradient4236"
        xlink:href="#linearGradient3622-95"
        inkscape:collect="always" />
+    <radialGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3648-8"
+       id="radialGradient3656-4"
+       cx="15.794774"
+       cy="23.04089"
+       fx="15.794774"
+       fy="23.04089"
+       r="1.5355394"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       id="linearGradient3648-8">
+      <stop
+         style="stop-color:#acc6d2;stop-opacity:1;"
+         offset="0"
+         id="stop3650-8" />
+      <stop
+         style="stop-color:#498ca2;stop-opacity:1;"
+         offset="1"
+         id="stop3652-2" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3700-5"
+       id="linearGradient3706-4"
+       x1="22.977591"
+       y1="16.533602"
+       x2="29.822767"
+       y2="16.274597"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.7675676,0,0,1,5.0632296,-0.88802268)" />
+    <linearGradient
+       id="linearGradient3700-5">
+      <stop
+         style="stop-color:#727272;stop-opacity:1;"
+         offset="0"
+         id="stop3702-5" />
+      <stop
+         style="stop-color:#a5a5a5;stop-opacity:1;"
+         offset="1"
+         id="stop3704-1" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3708-1"
+       id="linearGradient3714-7"
+       x1="12.987333"
+       y1="40.467396"
+       x2="29.933771"
+       y2="40.467396"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.9235808,0,0,1,1.6029976,-32.888023)" />
+    <linearGradient
+       id="linearGradient3708-1">
+      <stop
+         style="stop-color:#838383;stop-opacity:1;"
+         offset="0"
+         id="stop3710-1" />
+      <stop
+         style="stop-color:#b3b3b3;stop-opacity:1;"
+         offset="1"
+         id="stop3712-5" />
+    </linearGradient>
+    <linearGradient
+       y2="51.049667"
+       x2="23.125591"
+       y1="51.049667"
+       x1="12.98733"
+       gradientTransform="matrix(0.91240876,0,0,1,3.4559832,-32.677214)"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3965"
+       xlink:href="#linearGradient3716-7"
+       inkscape:collect="always" />
+    <linearGradient
+       id="linearGradient3716-7">
+      <stop
+         style="stop-color:#a5a5a5;stop-opacity:1;"
+         offset="0"
+         id="stop3718-6" />
+      <stop
+         style="stop-color:#bbbbbb;stop-opacity:1;"
+         offset="1"
+         id="stop3720-1" />
+    </linearGradient>
+    <linearGradient
+       y2="51.049667"
+       x2="23.125591"
+       y1="51.049667"
+       x1="12.98733"
+       gradientTransform="matrix(0.91240876,0,0,1,1.7480916,-32.888023)"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient4645"
+       xlink:href="#linearGradient3716-7"
+       inkscape:collect="always" />
   </defs>
   <sodipodi:namedview
      id="base"
@@ -135,16 +229,16 @@
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
      inkscape:zoom="27.026333"
-     inkscape:cx="9.4025213"
-     inkscape:cy="14.763428"
+     inkscape:cx="19.040495"
+     inkscape:cy="18.082753"
      inkscape:document-units="px"
      inkscape:current-layer="layer2"
      showgrid="true"
      width="64px"
      inkscape:snap-grids="false"
      inkscape:window-width="1620"
-     inkscape:window-height="1171"
-     inkscape:window-x="204"
+     inkscape:window-height="1132"
+     inkscape:window-x="2031"
      inkscape:window-y="0"
      inkscape:window-maximized="0">
     <inkscape:grid
@@ -258,95 +352,90 @@
          y="6.0131869" /></text>
     <text
        xml:space="preserve"
-       style="font-size:8.22735882px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:85.00000238%;writing-mode:lr-tb;text-anchor:start;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Arial Black;-inkscape-font-specification:'Arial Black, Bold'"
-       x="1.8785396"
-       y="42.424026"
-       id="text4681"
-       transform="scale(0.96637601,1.0347939)"
+       style="font-size:9px;font-style:normal;font-weight:normal;line-height:85.00000238%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Courier New KOI-8;-inkscape-font-specification:Courier New KOI-8"
+       x="1.8130463"
+       y="51.289948"
+       id="text3036-3"
        sodipodi:linespacing="85.000002%"><tspan
          sodipodi:role="line"
-         id="tspan2907"
-         x="1.8785396"
-         y="42.424026">T</tspan><tspan
+         x="1.8130463"
+         y="51.289948"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black"
+         id="tspan3054-7">R</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:9px;font-style:normal;font-weight:normal;line-height:85.00000238%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Courier New KOI-8;-inkscape-font-specification:Courier New KOI-8"
+       x="1.9664611"
+       y="44.133442"
+       id="text3036-8-0"
+       sodipodi:linespacing="85.000002%"><tspan
          sodipodi:role="line"
-         id="tspan2909"
-         x="1.8785396"
-         y="49.417282">R</tspan><tspan
+         x="1.9664611"
+         y="44.133442"
+         id="tspan3042-0-9"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black">T</tspan><tspan
          sodipodi:role="line"
-         id="tspan2911"
-         x="1.8785396"
-         y="56.410538">A</tspan><tspan
+         x="1.9664611"
+         y="51.126392"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black"
+         id="tspan3054-4-5" /></text>
+    <text
+       xml:space="preserve"
+       style="font-size:9px;font-style:normal;font-weight:normal;line-height:85.00000238%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Courier New KOI-8;-inkscape-font-specification:Courier New KOI-8"
+       x="1.8924588"
+       y="58.526814"
+       id="text3036-6-9"
+       sodipodi:linespacing="85.000002%"><tspan
          sodipodi:role="line"
-         id="tspan2913"
-         x="1.8785396"
-         y="63.403793" /></text>
+         x="1.8924588"
+         y="58.526814"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black"
+         id="tspan3054-5-5">A</tspan></text>
   </g>
   <g
      inkscape:groupmode="layer"
      id="layer2"
      inkscape:label="server"
      style="display:inline">
-    <g
-       id="g4388"
-       transform="matrix(0.1517954,0,0,0.1444919,-3.6601239,-0.37919708)"
-       style="display:inline">
-      <g
-         id="g4572"
-         transform="matrix(3.2881343,0,0,3.2881343,-142.60085,-210.03517)">
-        <path
-           id="path4582"
-           d="m 78.12815,120.177 0,-35.100414 21.09672,0 0,35.100414 -21.09672,0 z"
-           style="fill:url(#linearGradient3739);fill-opacity:1" />
-        <path
-           id="path4596"
-           d="M 85.777742,78.679005 76.886261,84.507778 98.799667,84.420458 107.77827,78.59168 85.777742,78.679 z"
-           style="fill:url(#linearGradient3755);fill-opacity:1"
-           sodipodi:nodetypes="ccccc" />
-        <path
-           id="path4600"
-           d="m 107.56892,115.25014 -9.044924,5.71268 0.08732,-36.750184 8.957604,-5.588749 0,36.626253 z"
-           style="fill:url(#linearGradient3747);fill-opacity:1"
-           sodipodi:nodetypes="ccccc" />
-        <path
-           id="path4604"
-           d="m 107.29929,78.615545 0,36.711945"
-           style="fill:#000000;stroke:#76769d;stroke-width:1.64281785;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
-        <path
-           style="fill:#000000;stroke:#000000;stroke-width:3.0802834;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
-           d="m 80.975225,91.767747 c 13.18592,0 13.18592,0 13.18592,0"
-           id="path4666" />
-        <path
-           style="fill:#000000;stroke:#000000;stroke-width:3.0802834;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
-           d="m 80.967985,99.626076 c 13.11308,0 13.11308,0 13.11308,0"
-           id="path4666-2" />
-        <path
-           id="path4584"
-           d="m 77.373321,120.27806 0,-35.890473 21.26287,0 0,35.890473 -21.26287,0"
-           style="fill:none;stroke:#76769d;stroke-width:1.64281785;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
-        <path
-           style="fill:none;stroke:#76769d;stroke-width:2.05352211px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-           d="m 77.265046,84.433308 c 8.818789,-5.850087 8.906104,-5.937402 8.906104,-5.937402"
-           id="path4712" />
-        <path
-           style="fill:none;stroke:#76769d;stroke-width:1.64281785;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
-           d="m 98.744473,84.520623 c 8.469537,-5.500829 8.469537,-5.500829 8.469537,-5.500829"
-           id="path4714" />
-        <path
-           style="fill:none;stroke:#76769d;stroke-width:1.64281785;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
-           d="m 85.559948,78.495906 c 22.701832,-0.17463 22.701832,-0.17463 22.701832,-0.17463"
-           id="path4718" />
-        <path
-           style="fill:none;stroke:#76769d;stroke-width:1.64281785;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
-           d="m 99.050573,120.34641 c 8.643177,-5.92978 8.643177,-5.92978 8.643177,-5.92978"
-           id="path4722" />
-        <rect
-           style="fill:#74f030;fill-opacity:1;fill-rule:evenodd;stroke:#2e9c41;stroke-width:1.02676105;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
-           id="rect4724"
-           width="5.9374022"
-           height="5.5881438"
-           x="81.456161"
-           y="107.22245" />
-      </g>
-    </g>
+    <path
+       style="fill:url(#linearGradient4645);fill-opacity:1;fill-rule:evenodd;stroke:none;display:inline"
+       d="m 13.597846,8.2823913 c 0,0 2.380431,0.969574 3.91227,1.282181 1.531839,0.3126058 5.27045,0.4958127 5.27045,0.4958127 l 0.06752,17.980513 c 0,0 -3.772018,-0.256764 -5.61367,-0.685905 -1.244221,-0.289928 -3.636568,-1.267745 -3.636568,-1.267745 l 0,-17.8048567 z"
+       id="rect2870-42"
+       sodipodi:nodetypes="czccacc"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:url(#linearGradient3714-7);fill-opacity:1;fill-rule:evenodd;stroke:none;display:inline"
+       d="m 22.243711,5.0263073 7.005543,1.2599809 -6.492942,3.8461498 c 0,0 -3.713429,-0.2615439 -5.242549,-0.5826297 -1.529121,-0.321086 -3.915914,-1.223016 -3.915914,-1.223016 l 8.645862,-3.300485 z"
+       id="rect2870-4-3"
+       sodipodi:nodetypes="ccczcc"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:url(#linearGradient3706-4);fill-opacity:1;fill-rule:evenodd;stroke:none;display:inline"
+       d="m 22.700087,10.095437 6.401161,-3.7370958 -0.0852,17.1684428 -6.259161,4.440114 -0.0568,-17.871461 z"
+       id="rect3690-2"
+       sodipodi:nodetypes="ccccc"
+       inkscape:connector-curvature="0" />
+    <path
+       sodipodi:type="arc"
+       style="fill:url(#radialGradient3656-4);fill-opacity:1;fill-rule:evenodd;stroke:#335596;stroke-width:0.39196318;stroke-miterlimit:3.29999995;stroke-opacity:1;stroke-dasharray:none;display:inline"
+       id="path3724-2"
+       sodipodi:cx="16.631927"
+       sodipodi:cy="23.101271"
+       sodipodi:rx="1.5355394"
+       sodipodi:ry="1.5355394"
+       d="m 18.167467,23.101271 a 1.5355394,1.5355394 0 1 1 -3.071079,0 1.5355394,1.5355394 0 1 1 3.071079,0 z"
+       transform="matrix(1.1400126,-0.10213105,0.12685752,1.4160157,-4.3527264,-9.0773861)" />
+    <path
+       style="fill:#3771c8;stroke:none;display:inline"
+       d="m 13.59785,10.57645 c 0,0 2.693952,1.050538 4.218108,1.369035 1.524156,0.318497 4.921126,0.518014 4.921126,0.518014 l -1e-6,1.59104 c 0,0 -3.620824,-0.225659 -5.143132,-0.555014 -1.522308,-0.329354 -3.959101,-1.295033 -3.959101,-1.295033 l -0.037,-1.628042 z"
+       id="path3726-1"
+       sodipodi:nodetypes="czcczcc"
+       inkscape:connector-curvature="0" />
+    <path
+       sodipodi:nodetypes="czcczcc"
+       id="path3728-6"
+       d="m 13.59785,13.943536 c 0,0 2.693952,1.050538 4.218108,1.369035 1.524156,0.318497 4.921126,0.518014 4.921126,0.518014 l -1e-6,1.59104 c 0,0 -3.620824,-0.225659 -5.143132,-0.555014 -1.522308,-0.329354 -3.959101,-1.295033 -3.959101,-1.295033 l -0.037,-1.628042 z"
+       style="fill:#3771c8;stroke:none;display:inline"
+       inkscape:connector-curvature="0" />
   </g>
 </svg>
diff --git a/share/metview/icons_mv5/FLEXTRA_VISUALISER.svg b/share/metview/icons_mv5/FLEXTRA_VISUALISER.svg
index 2d69532..f06712a 100644
--- a/share/metview/icons_mv5/FLEXTRA_VISUALISER.svg
+++ b/share/metview/icons_mv5/FLEXTRA_VISUALISER.svg
@@ -14,7 +14,7 @@
    height="32"
    id="svg2"
    version="1.1"
-   inkscape:version="0.47 r22583"
+   inkscape:version="0.48.4 r9939"
    sodipodi:docname="FLEXTRA_VISUALISER.svg"
    style="display:inline"
    inkscape:export-xdpi="360"
@@ -63,6 +63,68 @@
        id="linearGradient4590"
        xlink:href="#linearGradient3622-3"
        inkscape:collect="always" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4026"
+       id="linearGradient4032"
+       x1="16.804222"
+       y1="14.95285"
+       x2="27.970543"
+       y2="14.95285"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.0951557,0,0,1,-16.546772,-5.4935131)" />
+    <linearGradient
+       id="linearGradient4026">
+      <stop
+         style="stop-color:#f30e1e;stop-opacity:1;"
+         offset="0"
+         id="stop4028" />
+      <stop
+         style="stop-color:#ba2f39;stop-opacity:1;"
+         offset="1"
+         id="stop4030" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3975"
+       id="linearGradient3981"
+       x1="21.350325"
+       y1="20.322937"
+       x2="23.313965"
+       y2="20.322939"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.135239,0,0,1.0828856,-16.606068,-5.9410348)" />
+    <linearGradient
+       id="linearGradient3975">
+      <stop
+         style="stop-color:#565c64;stop-opacity:1;"
+         offset="0"
+         id="stop3977" />
+      <stop
+         style="stop-color:#99a4b4;stop-opacity:1;"
+         offset="1"
+         id="stop3979" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3975"
+       id="linearGradient4382"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.135239,0,0,1.0828856,-4.1735548,0.73621401)"
+       x1="21.350325"
+       y1="20.322937"
+       x2="23.313965"
+       y2="20.322939" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4026"
+       id="linearGradient4384"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(1.0951557,0,0,1,-4.1142586,1.1837357)"
+       x1="16.804222"
+       y1="14.95285"
+       x2="27.970543"
+       y2="14.95285" />
   </defs>
   <sodipodi:namedview
      id="base"
@@ -75,14 +137,14 @@
      inkscape:cx="13.89257"
      inkscape:cy="15.440296"
      inkscape:document-units="px"
-     inkscape:current-layer="layer6"
+     inkscape:current-layer="layer4"
      showgrid="true"
      width="64px"
      inkscape:snap-grids="false"
      inkscape:window-width="1620"
-     inkscape:window-height="1171"
-     inkscape:window-x="275"
-     inkscape:window-y="0"
+     inkscape:window-height="1132"
+     inkscape:window-x="338"
+     inkscape:window-y="56"
      inkscape:window-maximized="0">
     <inkscape:grid
        type="xygrid"
@@ -134,6 +196,57 @@
        height="31.261541"
        x="0.38681135"
        y="0.33406448" />
+    <path
+       sodipodi:type="arc"
+       style="fill:#939dac;fill-opacity:1;fill-rule:evenodd;stroke:#123b7d;stroke-width:0.28685689;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3.29999995;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;display:inline"
+       id="path3869"
+       sodipodi:cx="-3.3759081"
+       sodipodi:cy="15.175204"
+       sodipodi:rx="2.6094856"
+       sodipodi:ry="1.2408743"
+       d="m -0.76642251,15.175204 a 2.6094856,1.2408743 0 1 1 -5.21897129,0 2.6094856,1.2408743 0 1 1 5.21897129,0 z"
+       transform="matrix(1.7971318,0.34159025,-0.37101268,1.6200355,31.573908,1.4112182)" />
+    <path
+       style="fill:url(#linearGradient4382);fill-opacity:1;fill-rule:evenodd;stroke:none;display:inline"
+       d="m 17.876431,19.980535 c 0,0 0.257868,1.326588 1.996868,1.665105 1.739004,0.338517 2.420066,-0.806817 2.420066,-0.806817 l -0.0062,4.057523 c 0,0 -0.680348,0.8151 -2.436815,0.561448 -1.496348,-0.216089 -2.015341,-1.135695 -2.015341,-1.135695 l 0.04144,-4.341564 2.8e-5,0 z"
+       id="rect2870-42"
+       sodipodi:nodetypes="czccsccc"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:#6f7c91;fill-opacity:1;fill-rule:evenodd;stroke:none;display:inline"
+       d="m 15.558676,6.6772488 c 0,0 3.208652,1.0687276 5.56385,1.3803788 2.3552,0.3116513 8.318581,0.260686 8.318581,0.260686 l -1.17551,1.7541394 c 0,0 -5.796507,-0.0066 -8.83197,-0.4333152 C 16.398164,9.2123994 12.432513,7.6033685 12.432513,7.6033685 l 3.126163,-0.9261197 z"
+       id="rect2870-4-3-8"
+       sodipodi:nodetypes="czcczcc"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:#373e48;fill-opacity:1;fill-rule:evenodd;stroke:none;display:inline"
+       d="M 28.195688,9.9138208 29.48397,8.3172957 29.46879,20.861991 28.275188,22.383809 28.195688,9.9138208 z"
+       id="rect3690-2-0"
+       sodipodi:nodetypes="ccccc"
+       inkscape:connector-curvature="0" />
+    <path
+       inkscape:connector-curvature="0"
+       style="fill:#dbe2e3;fill-opacity:1;fill-rule:evenodd;stroke:#0c2248;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3.29999995;stroke-opacity:1;stroke-dashoffset:0;display:inline"
+       d="m 12.73299,7.9934662 c 0,0 2.955238,1.2768375 6.851552,1.8575016 3.896315,0.5806642 8.394286,0.3556922 8.394286,0.3556922 l 0.04538,11.895917 c 0,0 -5.032626,0.291789 -8.514194,-0.243177 -3.481568,-0.534966 -6.715432,-2.161573 -6.715432,-2.161573 l -0.0616,-11.7043608 z"
+       id="rect3828-2"
+       sodipodi:nodetypes="czcczcc" />
+    <path
+       inkscape:connector-curvature="0"
+       style="fill:none;stroke:#6c5b5d;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
+       d="m 14.311513,17.43558 c 1.825257,0.632676 3.250822,1.483391 5.475771,1.788319 0.839425,0.182748 3.035471,0.413693 7.034567,0.145985"
+       id="path3996-1"
+       sodipodi:nodetypes="ccc" />
+    <path
+       inkscape:connector-curvature="0"
+       style="fill:none;stroke:#6c5b5d;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
+       d="M 18.588211,20.647255 18.468303,10.464786"
+       id="path3998-0" />
+    <path
+       inkscape:connector-curvature="0"
+       style="fill:none;stroke:url(#linearGradient4384);stroke-width:0.99999994px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;display:inline"
+       d="m 14.836559,15.27246 c 0,0 0.839489,2.702497 1.251996,2.148768 1.609019,-2.159868 3.463916,-5.927736 3.781734,-5.425425 0.704791,1.113917 1.201134,4.983495 2.066852,6.515474 0.351413,0.621863 2.466197,-2.729574 2.466197,-2.729574 l 1.566925,4.541256"
+       id="path3992"
+       sodipodi:nodetypes="cssscc" />
   </g>
   <g
      inkscape:groupmode="layer"
@@ -155,72 +268,50 @@
      inkscape:label="text1">
     <text
        xml:space="preserve"
-       style="font-size:8.22735882px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:85.00000238%;writing-mode:lr-tb;text-anchor:start;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Arial Black;-inkscape-font-specification:'Arial Black, Bold'"
-       x="1.8805583"
-       y="11.413416"
-       id="text4681"
-       transform="scale(0.96637601,1.0347939)"
+       style="font-size:9px;font-style:normal;font-weight:normal;line-height:85.00000238%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Courier New KOI-8;-inkscape-font-specification:Courier New KOI-8"
+       x="1.735487"
+       y="19.185667"
+       id="text3036-3"
        sodipodi:linespacing="85.000002%"><tspan
          sodipodi:role="line"
-         id="tspan2907"
-         x="1.8805583"
-         y="11.413416">T</tspan><tspan
+         x="1.735487"
+         y="19.185667"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black"
+         id="tspan3054-7">R</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:9px;font-style:normal;font-weight:normal;line-height:85.00000238%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Courier New KOI-8;-inkscape-font-specification:Courier New KOI-8"
+       x="1.8889017"
+       y="12.02916"
+       id="text3036-8-0"
+       sodipodi:linespacing="85.000002%"><tspan
          sodipodi:role="line"
-         id="tspan2909"
-         x="1.8805583"
-         y="18.406672">R</tspan><tspan
+         x="1.8889017"
+         y="12.02916"
+         id="tspan3042-0-9"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black">T</tspan><tspan
          sodipodi:role="line"
-         id="tspan2911"
-         x="1.8805583"
-         y="25.399927">A</tspan><tspan
+         x="1.8889017"
+         y="19.02211"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black"
+         id="tspan3054-4-5" /></text>
+    <text
+       xml:space="preserve"
+       style="font-size:9px;font-style:normal;font-weight:normal;line-height:85.00000238%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;fill:#216778;fill-opacity:1;stroke:none;display:inline;font-family:Courier New KOI-8;-inkscape-font-specification:Courier New KOI-8"
+       x="1.8148994"
+       y="26.422531"
+       id="text3036-6-9"
+       sodipodi:linespacing="85.000002%"><tspan
          sodipodi:role="line"
-         id="tspan2913"
-         x="1.8805583"
-         y="32.393181" /></text>
+         x="1.8148994"
+         y="26.422531"
+         style="font-size:8.22700024px;line-height:85.00000238%;writing-mode:lr-tb;fill:#216778;font-family:Arial Black;-inkscape-font-specification:Arial Black"
+         id="tspan3054-5-5">A</tspan></text>
   </g>
   <g
      inkscape:groupmode="layer"
      id="layer6"
      inkscape:label="item"
      transform="translate(0,-32)"
-     style="display:inline">
-    <rect
-       style="fill:#e7e4e0;fill-opacity:1;fill-rule:evenodd;stroke:#10140d;stroke-width:1.00858581;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
-       id="rect4231"
-       width="15.596395"
-       height="11.160296"
-       x="12.705956"
-       y="40.864311"
-       ry="1.1240586" />
-    <rect
-       style="fill:#b6c6cc;fill-opacity:1;fill-rule:evenodd;stroke:#10140d;stroke-width:0.95900005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
-       id="rect4233"
-       width="14.461813"
-       height="2.4989576"
-       x="13.368137"
-       y="53.497963"
-       ry="1.1285614" />
-    <rect
-       style="fill:#666666;fill-opacity:1;fill-rule:evenodd;stroke:#10140d;stroke-width:0.8581652;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
-       id="rect4235"
-       width="3.0842593"
-       height="1.3806968"
-       x="19.132833"
-       y="52.001503"
-       ry="0.69034839"
-       rx="0" />
-    <path
-       style="fill:none;stroke:#e52626;stroke-width:1px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;display:inline"
-       d="m 16.784314,48.258214 2.884772,-5.400974 0.986897,4.111189 2.163579,-1.934678 c 0.847718,0.76581 1.450869,1.271924 2.543154,2.29743"
-       id="path5224"
-       sodipodi:nodetypes="ccccc" />
-    <path
-       style="fill:none;stroke:#1f283c;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
-       d="m 14.506864,42.413877 c 0.03794,7.617789 0.03794,7.698401 0.03794,7.698401"
-       id="path5226" />
-    <path
-       style="fill:none;stroke:#1f283c;stroke-width:1.00666595px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
-       d="m 14.130118,50.230192 12.748068,-0.0343"
-       id="path5228" />
-  </g>
+     style="display:inline" />
 </svg>
diff --git a/share/metview/icons_mv5/GRIBVECTORS.xpm b/share/metview/icons_mv5/GRIBVECTORS.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/GeoToKML.xpm b/share/metview/icons_mv5/GeoToKML.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/HOVMOELLERDATA.xpm b/share/metview/icons_mv5/HOVMOELLERDATA.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/INPUTVISUALISER.svg b/share/metview/icons_mv5/INPUTVISUALISER.svg
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/Interpolation.svg b/share/metview/icons_mv5/Interpolation.svg
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/MAGML.xpm b/share/metview/icons_mv5/MAGML.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/MHOVMOELLERDATA.xpm b/share/metview/icons_mv5/MHOVMOELLERDATA.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/MHOVMOELLERVIEW.xpm b/share/metview/icons_mv5/MHOVMOELLERVIEW.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/MTHERMO.xpm b/share/metview/icons_mv5/MTHERMO.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/MVPROFILE.xpm b/share/metview/icons_mv5/MVPROFILE.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/MVPROFILEVIEW.xpm b/share/metview/icons_mv5/MVPROFILEVIEW.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/MXAVERAGE.xpm b/share/metview/icons_mv5/MXAVERAGE.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/MXAVERAGEVIEW.xpm b/share/metview/icons_mv5/MXAVERAGEVIEW.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/MXSECTION.xpm b/share/metview/icons_mv5/MXSECTION.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/MXSECTIONVIEW.xpm b/share/metview/icons_mv5/MXSECTIONVIEW.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/MetPlus.xpm b/share/metview/icons_mv5/MetPlus.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/NETCDFPLUS.svg b/share/metview/icons_mv5/NETCDFPLUS.svg
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/OBSTAT.xpm b/share/metview/icons_mv5/OBSTAT.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/OBSTAT_CURVE.xpm b/share/metview/icons_mv5/OBSTAT_CURVE.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/OBSTAT_SCATTER.xpm b/share/metview/icons_mv5/OBSTAT_SCATTER.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/ODB_MARS.xpm b/share/metview/icons_mv5/ODB_MARS.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/REPROJECTION.xpm b/share/metview/icons_mv5/REPROJECTION.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/TABLEVISUALISER.svg b/share/metview/icons_mv5/TABLEVISUALISER.svg
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/THERMODATA.xpm b/share/metview/icons_mv5/THERMODATA.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/VPROF.xpm b/share/metview/icons_mv5/VPROF.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/VPROFILE.xpm b/share/metview/icons_mv5/VPROFILE.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/VPROFVIEW.xpm b/share/metview/icons_mv5/VPROFVIEW.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/WEBACCESS.xpm b/share/metview/icons_mv5/WEBACCESS.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/XAVERAGE.xpm b/share/metview/icons_mv5/XAVERAGE.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/XSECT.xpm b/share/metview/icons_mv5/XSECT.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/XSECTION.xpm b/share/metview/icons_mv5/XSECTION.xpm
old mode 100755
new mode 100644
diff --git a/share/metview/icons_mv5/XSECTVIEW.xpm b/share/metview/icons_mv5/XSECTVIEW.xpm
old mode 100755
new mode 100644
diff --git a/src/AppMod/checkdisplay.cc b/src/AppMod/checkdisplay.cc
index ad417ef..2a00448 100644
--- a/src/AppMod/checkdisplay.cc
+++ b/src/AppMod/checkdisplay.cc
@@ -15,7 +15,7 @@
 
 using namespace std;
 
-main()
+int main()
 {
 	Display *toBeOrNotToBe;
 	if( toBeOrNotToBe = XOpenDisplay( 0 ) )  // NULL == $DISPLAY (if POSIX!)
@@ -28,4 +28,6 @@ main()
 		cerr << " [checkdisplay] Oops! Unable to open display!" << endl;
 		exit( EXIT_FAILURE );
 	}
+
+	return 0;
 }
diff --git a/src/BufrExaminer/BufrMetaData.cc b/src/BufrExaminer/BufrMetaData.cc
index f1c06da..39825e4 100644
--- a/src/BufrExaminer/BufrMetaData.cc
+++ b/src/BufrExaminer/BufrMetaData.cc
@@ -65,21 +65,21 @@ bool BufrSectionDump::read(const string& fname, int msgCnt)
 
 	MvObsSet oset(fname.c_str());
 	MvObsSetIterator iter(oset);
-        MvObs obs;
+	MvObs obs;
 
-        bool found=false;
-	while(obs = iter())
+	bool found=false;
+	while( (obs = iter()) )
 	{
 		if(iter.msgNumber() == msgCnt)
-        	{
+		{
 			found=true;
 			break;
 		}
-        }
+	}
 
-        if(!found)
+	if(!found)
 	{
-            	log->error("Message not found!");
+		log->error("Message not found!");
 		return false;
 	}
 
@@ -204,20 +204,20 @@ void BufrDataDump::read(const string& fname, int msgCnt,int subsetCnt)
 
 	MvObsSet oset(fname.c_str());
 	MvObsSetIterator iter(oset);
-        MvObs obs;
+	MvObs obs;
 
-        bool found=false;
-	while(obs = iter())
+	bool found=false;
+	while( (obs = iter()) )
 	{
 		if(iter.msgNumber() == msgCnt)
-        	{
+		{
 			found=true;
 			break;
 		}
-        }
+	}
 
-        if(!found)
-        {
+	if(!found)
+	{
 		log->error("Message not found!");
 		return;
 	}
@@ -288,21 +288,21 @@ void BufrBitmapDump::read(const string& fname, int msgCnt,int subsetCnt)
 
 	MvObsSet oset(fname.c_str());
 	MvObsSetIterator iter(oset);
-        MvObs obs;
+	MvObs obs;
 
   	bool found=false;
-	while(obs = iter())
+	while( (obs = iter()) )
 	{
 		if(iter.msgNumber() == msgCnt)
-        	{
+		{
 			found=true;
 			break;
 		}
-        }
+	}
 
-        if(!found)
+	if(!found)
 	{
-            	log->error("Message not found!");
+		log->error("Message not found!");
 		return;
 	}
 
@@ -394,23 +394,22 @@ int BufrMetaData::subsetNum(int msgCnt)
 {
 	MvObsSet oset(fileName_.c_str());
 	MvObsSetIterator iter(oset);
-        MvObs obs;
+	MvObs obs;
 
 	bool found=false;
-	while(obs = iter())
+	while( (obs = iter()) )
 	{
 		if(iter.msgNumber() == msgCnt)
-        	{
+		{
 			found=true;
 			break;
 		}
-        }
+	}
 
-        if(!found)
-            return 0;
+	if(!found)
+		return 0;
 
 	return obs.msgSubsetCount();
-
 }
 
 void BufrMetaData::readMessages(MvKeyProfile *prof)
@@ -426,12 +425,12 @@ void BufrMetaData::readMessages(MvKeyProfile *prof)
 
 	//int index=1;
 
-    	messageNum_=0;
+	messageNum_=0;
 	totalMessageNum_=0;
 	int bytesRead=0;
 
-   	while(obs = iter())
-    	{
+   	while( (obs = iter()) )
+	{
  		if(iter.subsetNumber() != 1)
 		{
 			continue;
@@ -621,14 +620,12 @@ void BufrMetaData::readMessages(MvKeyProfile *prof)
                 		}
             		}
 		}
-
-            	messageNum_++;
+		messageNum_++;
 
 		//observer_->messageScanStepChanged(messageNum_);
 		bytesRead+=obs.messageTotalLen();
 		observer_->messageScanStepChanged(bytesRead);
 	}
-
 	totalMessageNum_=messageNum_;
 }
 
@@ -647,9 +644,9 @@ string BufrSection::itemValue(string itemName)
 
 void BufrSection::setText(const string& txt)
 {
-        text_=txt;
+	text_=txt;
 
-        istringstream in(text_);
+	istringstream in(text_);
 	string c;
 	while(getline(in,c))
 	{
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9632f6a..a3c072f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,7 +9,6 @@ add_subdirectory( Datacoverage )
 add_subdirectory( Divrot )
 add_subdirectory( Ecfile )
 add_subdirectory( Event )
-
 add_subdirectory( Macro )
 add_subdirectory( MvApp )
 add_subdirectory( Flextra )
@@ -38,6 +37,10 @@ if(ENABLE_OPERA_RADAR)
     add_subdirectory(OperaRadar)
 endif()
 
+if(ENABLE_URL_DOWNLOAD)
+    add_subdirectory(Download)
+endif()
+
 if(ENABLE_UI)
     if(ENABLE_MOTIF)
         add_subdirectory(libMvMotif)
diff --git a/src/Desktop/EditTransaction.cc b/src/Desktop/EditTransaction.cc
index 5710b0a..b119d55 100644
--- a/src/Desktop/EditTransaction.cc
+++ b/src/Desktop/EditTransaction.cc
@@ -82,7 +82,8 @@ void EditTransaction::callback(MvRequest& r)
 		const char* name = def("_NAME");
 		if(name)
 		{	  
-	      		if(const char* mode = def("_DEFAULT"))
+            const char* mode = def("_DEFAULT");
+            if(mode)
 			{ 
 				const IconClass& kind=IconClass::find(def.getVerb());
 			  	current_=kind.defaultObject();
diff --git a/src/Desktop/FolderInfo.cc b/src/Desktop/FolderInfo.cc
index 0e98d66..98d0ffe 100644
--- a/src/Desktop/FolderInfo.cc
+++ b/src/Desktop/FolderInfo.cc
@@ -183,7 +183,6 @@ bool FolderInfo::read(const Path& folderPath,std::map<std::string,std::string>&
 
 	Tokenizer parse(",");
 	vector<string> n;
-	int cnt=0;
 	std::size_t pos;
 	
 	while(getline(in,line))
diff --git a/src/Desktop/MvQColourLine.cc b/src/Desktop/MvQColourLine.cc
index 47c2233..66c2f53 100644
--- a/src/Desktop/MvQColourLine.cc
+++ b/src/Desktop/MvQColourLine.cc
@@ -167,7 +167,16 @@ void MvQColourLine::setCustomColour(QColor color,QString name, QString realName,
 	  	colCb_->setItemText(idx,name);
 		colCb_->setItemData(idx,realName);
 		if(setCurrent)
-	  		colCb_->setCurrentIndex(idx);
+		{
+			// although we set the current index, this does not always trigger
+			// slotCurrentChanged because all custom RGB values will have the
+			// same index (42), even though they might be different colours
+			// (which could be an issue if we open two different icons which both
+			// have custom colours for the same parameter).
+			// Therefore we manually trigger slotCurrentChanged here to make sure
+			colCb_->setCurrentIndex(idx);
+			slotCurrentChanged(idx);
+		}
 	}
 	
 	if(idx != -1)
@@ -228,9 +237,7 @@ void MvQColourLine::slotHelperEdited(const vector<string>& values)
 				return;
 			}	
 		}
-		
-		int currentPrev=colCb_->currentIndex();
-		
+
 		QString name=QString::fromStdString(values[0]);
 		//This sets the current index as well
 		setCustomColour(MvQPalette::magics(values[0]),name,name,true);
diff --git a/src/Desktop/MvQDetailedFolderView.cc b/src/Desktop/MvQDetailedFolderView.cc
index bbbbd17..7f3cc3c 100644
--- a/src/Desktop/MvQDetailedFolderView.cc
+++ b/src/Desktop/MvQDetailedFolderView.cc
@@ -566,10 +566,7 @@ void MvQDetailedFolderView::dropEvent(QDropEvent *event)
 	  	event->ignore();
 		return;
 	}	
-	
-	QPoint scrollOffset(horizontalScrollBar()->value(),verticalScrollBar()->value());
-	QPoint pos=event->pos()+scrollOffset;
-	
+
 	//--------------------------------------
 	// Drag and drop from another folder
 	//--------------------------------------
diff --git a/src/Desktop/MvQFolderItemProperty.cc b/src/Desktop/MvQFolderItemProperty.cc
index 9a4f16a..b2e3a83 100644
--- a/src/Desktop/MvQFolderItemProperty.cc
+++ b/src/Desktop/MvQFolderItemProperty.cc
@@ -196,8 +196,7 @@ QRect MvQClassicIconItemProperty::iconRect(QString name)
 
 
 QRect MvQClassicIconItemProperty::textRect(QString name) 
-{
-  	QSize s=size(name);		 
+{ 
   	return QRect(paddingX_,
 		      paddingY_+iconSize_+textOffset_,
 		      textWidth(name),
@@ -295,7 +294,6 @@ QPoint MvQSimpleIconItemProperty::position(QString, QPoint refPos)
 QPoint MvQSimpleIconItemProperty::positionFromHotSpot(QString name, QPoint pos,QPointF hotSpotAtPos)
 {	
 	//hotSpotAtPos is the relative position inside the icon pixmap 		
-	QSize s=size(name);
 	QPoint d(iconSize_*hotSpotAtPos.x(),iconSize_*hotSpotAtPos.y());
   	return QPoint(pos.x()-d.x()-paddingX_,pos.y()-d.y()-paddingY_);
 }	
@@ -326,9 +324,8 @@ QPoint MvQSimpleIconItemProperty::adjsutReferencePosition(QString /*name*/,QStri
 	return QPoint();
 }
 
-QRect MvQSimpleIconItemProperty::iconRect(QString name)
+QRect MvQSimpleIconItemProperty::iconRect(QString /*name*/)
 {
-  	QSize s=size(name);
 	return QRect(paddingX_,
 		     paddingY_,
 		     iconSize_,
diff --git a/src/Desktop/MvQFolderItemProperty.h b/src/Desktop/MvQFolderItemProperty.h
index f76a78b..8e6602c 100644
--- a/src/Desktop/MvQFolderItemProperty.h
+++ b/src/Desktop/MvQFolderItemProperty.h
@@ -22,7 +22,8 @@ class MvQAbstractIconItemProperty
 {
 public:   	
   	MvQAbstractIconItemProperty();
-	
+    virtual ~MvQAbstractIconItemProperty() {}
+
 	int iconSize() const {return iconSize_;}
 	QFont font() const {return font_;}
 	float scaling() const {return scaling_;}
@@ -160,4 +161,4 @@ protected:
 	
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/Desktop/MvQFolderModel.cc b/src/Desktop/MvQFolderModel.cc
index 2ebf14c..b28a6b8 100644
--- a/src/Desktop/MvQFolderModel.cc
+++ b/src/Desktop/MvQFolderModel.cc
@@ -31,6 +31,7 @@
 #include "MvQFolderItemProperty.h"
 #include "MvQIconProvider.h"
 #include "MvQTheme.h"
+#include "MvQFileInfo.h"
 
 #include <assert.h>
 #include <map>
@@ -769,16 +770,7 @@ QString MvQFolderModel::objectInfo( const QModelIndex & index)
 
 QString MvQFolderModel::formatFileSize(qint64 size) const
 {	
-  	if(size < 1024)
-	  	return QString::number(size) + " B";
-	else if(size < 1024*1024)
-	  	return QString::number(size/1024) + " KB";
-	else if(size < 1024*1024*1024)
-	  	return QString::number(size/(1024*1024)) + " MB";
-	else
-	  	return QString::number(size/(1024*1024*1024)) + " GB";
-
- 	return QString();
+    return MvQFileInfo::formatSize(size);
 }
 
 QString MvQFolderModel::formatFileDate(time_t t) const
@@ -974,4 +966,4 @@ bool MvQFolderFilterModel::setFilter(QString name,QString type)
 	
 	return found;
 }
-*/
\ No newline at end of file
+*/
diff --git a/src/Desktop/MvQFolderViewBase.cc b/src/Desktop/MvQFolderViewBase.cc
index e1b3fd3..ba56269 100644
--- a/src/Desktop/MvQFolderViewBase.cc
+++ b/src/Desktop/MvQFolderViewBase.cc
@@ -635,9 +635,6 @@ MvQIconMimeData *MvQFolderViewBase::buildClipboardData(IconObject *dragObj,QList
 			//Pixmap rect of the drag object
 			QRect rect=pixmapRect(dragObj);
 				
-			//Find bounding box for selected pixmap rects				
-			QRect bbox=pixmapRect(objLst);
-		
 			for(int i=0; i < objLst.count(); i++)
 			{
 			 	QRect vr=pixmapRect(objLst[i]);
diff --git a/src/Desktop/MvQGeoHelp.cc b/src/Desktop/MvQGeoHelp.cc
index 726a646..8935fee 100644
--- a/src/Desktop/MvQGeoHelp.cc
+++ b/src/Desktop/MvQGeoHelp.cc
@@ -90,6 +90,8 @@ void MvQGeoHelp::message(const Request& msg)
 		res.push_back(string(ch));
 	 }
 	 owner_.set(param_.name(),res); 
+
+	 stop();  // stop observing the helper widget since it could be reused for other params
 	 
           //owner_.changed(*this);
 }
diff --git a/src/Desktop/MvQIconFolderView.cc b/src/Desktop/MvQIconFolderView.cc
index 1ab7c0a..d83a148 100644
--- a/src/Desktop/MvQIconFolderView.cc
+++ b/src/Desktop/MvQIconFolderView.cc
@@ -1727,8 +1727,7 @@ QGraphicsItem *MvQIconFolderView::findByKey(int key)
   	if(sLst.size()>0) current=sLst.at(0);
 	 
 	QRectF rect=current->boundingRect();
-	rect.moveTo(current->pos());
-	QRectF initialRect = rect;
+	rect.moveTo(current->pos());	
  
 	QSizeF contents = sceneRect().size();
     	QList<QGraphicsItem*> intersectVector;
@@ -1917,4 +1916,4 @@ void MvQIconFolderView::showIcon(const QModelIndex& index)
 		ensureVisible(item);
 		selectOnlyOneItem(item);
 	}	
-}
\ No newline at end of file
+}
diff --git a/src/Desktop/MvQIconProvider.cc b/src/Desktop/MvQIconProvider.cc
index d66a773..5aff3af 100644
--- a/src/Desktop/MvQIconProvider.cc
+++ b/src/Desktop/MvQIconProvider.cc
@@ -24,7 +24,7 @@
 //This array defines the avaiable icon sizes
 static int sizeArr[]={12,16,24,32,48,64,96};
 
-static MvQIcon unknownIcon(":/desktop/unknown.svg");
+static MvQUnknownIcon unknownIcon(":/desktop/unknown.svg");
 static MvQIcon linkIcon(":/desktop/link.svg");
 static MvQIcon linkBrokenIcon(":/desktop/link_broken.svg");
 static MvQIcon lockIcon(":/desktop/padlock.svg");
@@ -57,7 +57,7 @@ QPixmap MvQIcon::pixmap(int size)
 	 {
 	   	QPixmap pix;
 		QImageReader imgR(path_);
-		if(imgR.canRead())
+        if(imgR.canRead())
 		{
 			imgR.setScaledSize(QSize(size,size));
 			QImage img=imgR.read();
@@ -65,7 +65,7 @@ QPixmap MvQIcon::pixmap(int size)
 		}
 		else
 		{
-		  	qDebug() << path_;
+            qDebug() << "MvQIcon::pixmap() could not find icon=" << path_;
 		  	pix=unknownIcon.pixmap(size);		
 		} 
 		
@@ -74,24 +74,6 @@ QPixmap MvQIcon::pixmap(int size)
 	 }
 	 return QPixmap();
 }	 
-  
-/*QPixmap MvQIcon::fadedPixmap(int size)
-{
- 	 map<int,QPixmap>::iterator it=fadedPixmaps_.find(size);
-	 if(it != fadedPixmaps_.end())
-	   	return it->second;
-	 else
-	 {	   	
-	   	QPixmap pix=pixmap(size);
-		QImage img=pix.toImage();
-		greyOut(img);
-		pix=QPixmap::fromImage(img);
-		fadedPixmaps_[size]=pix;
-		return pix;
-	 }
-	 return QPixmap();
-}*/	 
-
 
 QPixmap MvQIcon::pixmap(IconObject *obj,int size,bool checkEmbedded)
 {  	
@@ -189,6 +171,52 @@ void MvQIcon::greyOut(QImage &img)
 		}	
 }	
 
+MvQUnknownIcon::MvQUnknownIcon(QString n) : MvQIcon(n)
+{
+}
+
+//We must serve back a valid pixmap all the time!!! The MvQIcon pixmap() method
+//calls this a fallback!!!
+QPixmap MvQUnknownIcon::pixmap(int size)
+{
+    map<int,QPixmap>::iterator it=pixmaps_.find(size);
+    if(it != pixmaps_.end())
+       return it->second;
+    else
+    {
+        QImageReader imgR(path_);
+        if(imgR.canRead())
+        {
+            return MvQIcon::pixmap(size);
+        }
+        else
+        {
+            QPixmap pix(size,size);
+            pix.fill(QColor(210,210,210));
+
+            QPainter painter(&pix);
+            painter.setPen(Qt::black);
+            QRect r(0,0,size,size);
+            QFont f;
+            float reqFontSize=4+72.0*0.75*static_cast<float>(size)/96.; //estimate with 96 dpi
+            f.setPointSize(reqFontSize);
+            QFontMetrics fm(f);
+            while(fm.height() > 3*size/4 && f.pointSize() > 8)
+            {
+                f.setPointSize(f.pointSize()-1);
+                fm=QFontMetrics(f);
+            }
+            painter.setFont(f);
+            painter.drawText(r,Qt::AlignCenter,"?");
+            pixmaps_[size]=pix;
+
+            return pix;
+        }
+    }
+
+    return QPixmap(size,size);
+}
+
 //===========================================
 // 
 // MvQIconProvider
@@ -290,4 +318,4 @@ QPixmap MvQIconProvider::errorPixmap(int size)
 	 return errorIcon.pixmap(size);  
 } 
 
-static MvQIconProvider	iconProvider;	
\ No newline at end of file
+static MvQIconProvider	iconProvider;	
diff --git a/src/Desktop/MvQIconProvider.h b/src/Desktop/MvQIconProvider.h
index 569cff0..9562320 100644
--- a/src/Desktop/MvQIconProvider.h
+++ b/src/Desktop/MvQIconProvider.h
@@ -30,7 +30,7 @@ class MvQIcon
 {
 public:  
   	MvQIcon(QString);
-	QPixmap pixmap(int);
+    virtual QPixmap pixmap(int);
 	QPixmap pixmap(IconObject*,int,bool checkEmbedded=false);
 	QPixmap greyedOutPixmap(IconObject*,int);
 	
@@ -42,6 +42,12 @@ protected:
 	std::map<int,QPixmap> fadedPixmaps_;
 };  
 
+class MvQUnknownIcon : public MvQIcon
+{
+public:
+    MvQUnknownIcon(QString);
+    QPixmap pixmap(int);
+};
 
 class MvQIconProvider
 {
@@ -71,4 +77,4 @@ private:
 	static std::map<string,Folder*> folders_; 	
 };
 
-#endif
\ No newline at end of file
+#endif
diff --git a/src/Desktop/MvQPageView.cc b/src/Desktop/MvQPageView.cc
index e75df1d..6a72169 100644
--- a/src/Desktop/MvQPageView.cc
+++ b/src/Desktop/MvQPageView.cc
@@ -1496,11 +1496,10 @@ void MvQPageView::pagesResized(QList<MvQPageItem*> pages,QList<QRectF> oriPaperR
 {
   	MvQUndoCommand *cmdParent = new MvQUndoCommand(this,0);
 	cmdParent->setText("resize");
-     
-	MvQPageResizeCommand *cmd;
+
 	for(int i=0; i < pages.count(); i++)
 	{
-		cmd = new MvQPageResizeCommand(this,pages[i],oriPaperRects[i],pages.at(i)->paperRect(),cmdParent);	
+        new MvQPageResizeCommand(this,pages[i],oriPaperRects[i],pages.at(i)->paperRect(),cmdParent);
 	}	
 	  
 	undoStack_->push(cmdParent);
@@ -1513,10 +1512,9 @@ void MvQPageView::pagesMoved(QList<MvQPageItem*> pages,const QPointF& delta)
   	MvQUndoCommand *cmdParent = new MvQUndoCommand(this,0);
 	cmdParent->setText("move");
     
-	MvQPageMoveCommand *cmd;
 	foreach(MvQPageItem *item,pages)
 	{
-		cmd = new MvQPageMoveCommand(this,item,delta,cmdParent);	
+        new MvQPageMoveCommand(this,item,delta,cmdParent);
 	}
 	
 	undoStack_->push(cmdParent);
@@ -1532,10 +1530,9 @@ void MvQPageView::duplicateSelection()
   	MvQUndoCommand *cmdParent = new MvQUndoCommand(this,0);
 	cmdParent->setText("duplicate");
 		
-	MvQPageAddCommand *cmd;
 	foreach(MvQPageItem* item,selector_->pages())
 	{
-		cmd = new MvQPageAddCommand(this,item,cmdParent);     		
+        new MvQPageAddCommand(this,item,cmdParent);
 	}
 	
 	undoStack_->push(cmdParent);		
@@ -1549,10 +1546,9 @@ void MvQPageView::deleteSelection()
   	MvQUndoCommand *cmdParent = new MvQUndoCommand(this,0);
 	cmdParent->setText("delete");
 		
-	MvQPageDeleteCommand *cmd;
 	foreach(MvQPageItem* item,selector_->pages())
 	{
-		cmd = new MvQPageDeleteCommand(this,item,cmdParent);     		
+        new MvQPageDeleteCommand(this,item,cmdParent);
 	}
 	
 	undoStack_->push(cmdParent);		
@@ -1575,10 +1571,9 @@ void MvQPageView::splitSelection(int row, int column)
 	MvQUndoCommand *cmdParent = new MvQUndoCommand(this,0);
 	cmdParent->setText("split");
 	
-	MvQPageSplitCommand *cmd;
 	foreach(MvQPageItem* item,selector_->pages())
 	{
-		cmd = new MvQPageSplitCommand(this,item,row,column,cmdParent);     		
+        new MvQPageSplitCommand(this,item,row,column,cmdParent);
 	}
 	
 	undoStack_->push(cmdParent);
@@ -1592,7 +1587,6 @@ void MvQPageView::expandSelection()
   	MvQUndoCommand *cmdParent = new MvQUndoCommand(this,0);
 	cmdParent->setText("expand");
 		
-	MvQPageExpandCommand *cmd;
 	QRectF selRect=selector_->mapToParent(selector_->boundingRect()).boundingRect();
 	QRectF expandRect=superPage_->boundingRect();
 	
@@ -1603,7 +1597,7 @@ void MvQPageView::expandSelection()
 	  	QRectF r=superPage_->itemToPercentage(item->rectToSelector(expandRect,selRect));
 	  	qDebug() << "  item" << item->paperRect() << r;
 		
-		cmd = new MvQPageExpandCommand(this,item,r,cmdParent);     		
+        new MvQPageExpandCommand(this,item,r,cmdParent);
 	}
 	
 	undoStack_->push(cmdParent);		
@@ -1638,13 +1632,12 @@ void MvQPageView::disconnectSelection()
 	
 	MvQUndoCommand *cmdParent = new MvQUndoCommand(this,0);
 	cmdParent->setText("disconnect");
-		
-	MvQPageDisconnectCommand *cmd; 
+		 
 	foreach(MvQPageItem* item,selector_->pages())
 	{
 		if(item->hasSubPaperRect())
 		{  
-			cmd = new MvQPageDisconnectCommand(this,item,cmdParent);    
+            new MvQPageDisconnectCommand(this,item,cmdParent);
 		}
 	}
 	
diff --git a/src/Desktop/MvQRequestPanelLine.cc b/src/Desktop/MvQRequestPanelLine.cc
index f521d9b..de2e5b9 100644
--- a/src/Desktop/MvQRequestPanelLine.cc
+++ b/src/Desktop/MvQRequestPanelLine.cc
@@ -25,10 +25,10 @@
 MvQRequestPanelLine::MvQRequestPanelLine(RequestPanel& owner,const Parameter& param, bool buildLine) : 
 	RequestPanelItem(owner,param),
 	defaultTb_(0),
-	gray_(false),
-	helper_(0),
 	helpTb_(0),
-	parentWidget_(owner.parentWidget())
+    gray_(false),
+    helper_(0),
+    parentWidget_(owner.parentWidget())
 {	
 	if(!buildLine)
 	  	return;
diff --git a/src/Desktop/Parameter.cc b/src/Desktop/Parameter.cc
index 9f905ed..d95154a 100644
--- a/src/Desktop/Parameter.cc
+++ b/src/Desktop/Parameter.cc
@@ -144,6 +144,19 @@ Parameter::Parameter(Language& l,parameter* p):
 			if(ev !=0  && (*ev == 'F' || *ev == 'f'))
 	  			multiple_ = true;
 		}
+		else if(strcmp(h,"any") == 0)
+		{
+			// if 'exclusive' is set, then do not split elements into a list
+			// - interface=text does this spltting; string does not
+			const char * ev=get_value(param_->interface,"exclusive",0);
+			if(ev !=0  && (*ev == 'F' || *ev == 'f'))
+				multiple_ = true;
+                
+			if(multiple_)
+				set_value(param_->interface,"interface","text");
+			else
+				set_value(param_->interface,"interface","string");    
+		}        
 	}
 		
 	//No helper if the interface is "none"		
diff --git a/src/Download/CMakeLists.txt b/src/Download/CMakeLists.txt
new file mode 100644
index 0000000..68dc1bb
--- /dev/null
+++ b/src/Download/CMakeLists.txt
@@ -0,0 +1,12 @@
+
+ecbuild_add_executable( TARGET       Download
+                        SOURCES      Download.cc
+                        DEFINITIONS  ${METVIEW_EXTRA_DEFINITIONS}
+                        INCLUDES     ${METVIEW_STANDARD_INCLUDES}
+                        LIBS         ${STANDARD_METVIEW_LIBS}
+                    )
+
+
+metview_module_files(ETC_FILES ObjectSpec.Download
+                               DownloadDef
+                     SVG_FILES DOWNLOAD.svg)
diff --git a/src/Download/DOWNLOAD.svg b/src/Download/DOWNLOAD.svg
new file mode 100644
index 0000000..5b27857
--- /dev/null
+++ b/src/Download/DOWNLOAD.svg
@@ -0,0 +1,226 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="32"
+   height="32"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="DOWNLOAD.svg"
+   style="display:inline"
+   inkscape:export-xdpi="180"
+   inkscape:export-ydpi="180"
+   sodipodi:version="0.32"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape"
+   inkscape:export-filename="/var/tmp/cgi/git/metview/src/Download/DOWNLOAD.png">
+  <defs
+     id="defs4">
+    <linearGradient
+       id="linearGradient5324">
+      <stop
+         id="stop5326"
+         offset="0"
+         style="stop-color:#2270c7;stop-opacity:1;" />
+      <stop
+         id="stop5328"
+         offset="1"
+         style="stop-color:#bec0f6;stop-opacity:1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient5268">
+      <stop
+         style="stop-color:#2270c7;stop-opacity:1;"
+         offset="0"
+         id="stop5270" />
+      <stop
+         style="stop-color:#bec0f6;stop-opacity:1"
+         offset="1"
+         id="stop5272" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient5246"
+       osb:paint="solid">
+      <stop
+         style="stop-color:#668000;stop-opacity:1;"
+         offset="0"
+         id="stop5248" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3622-8">
+      <stop
+         style="stop-color:#c6cee3;stop-opacity:1;"
+         offset="0"
+         id="stop3624-3" />
+      <stop
+         style="stop-color:#eaeef9;stop-opacity:0;"
+         offset="1"
+         id="stop3626-2" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient4749">
+      <stop
+         id="stop4751"
+         offset="0"
+         style="stop-color:#2c936f;stop-opacity:1;" />
+      <stop
+         id="stop4753"
+         offset="1"
+         style="stop-color:#d0e0d1;stop-opacity:1;" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5324"
+       id="linearGradient5274"
+       x1="7.2826061"
+       y1="16.28569"
+       x2="24.329329"
+       y2="16.28569"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(-31.898305,28.400855)" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5324"
+       id="linearGradient5336"
+       x1="5.2868624"
+       y1="48.438992"
+       x2="26.258589"
+       y2="48.438992"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.85370838,0,0,0.92184449,2.6249888,4.3150578)" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="1"
+     inkscape:pageshadow="2"
+     inkscape:zoom="14.170032"
+     inkscape:cx="-5.9536924"
+     inkscape:cy="17.54612"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer6"
+     showgrid="true"
+     width="64px"
+     inkscape:snap-grids="true"
+     inkscape:window-width="1620"
+     inkscape:window-height="1096"
+     inkscape:window-x="1968"
+     inkscape:window-y="81"
+     inkscape:window-maximized="0">
+    <inkscape:grid
+       type="xygrid"
+       id="grid2816"
+       empspacing="5"
+       visible="true"
+       enabled="true"
+       snapvisiblegridlinesonly="true" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+        <cc:license
+           rdf:resource="Apache License 2.0" />
+        <dc:creator>
+          <cc:Agent>
+            <dc:title />
+          </cc:Agent>
+        </dc:creator>
+        <dc:publisher>
+          <cc:Agent>
+            <dc:title>ECMWF</dc:title>
+          </cc:Agent>
+        </dc:publisher>
+        <dc:language>en-GB</dc:language>
+        <dc:subject>
+          <rdf:Bag>
+            <rdf:li>Metview icon</rdf:li>
+          </rdf:Bag>
+        </dc:subject>
+        <dc:description>Metview icon</dc:description>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:groupmode="layer"
+     id="layer5"
+     inkscape:label="frame"
+     style="display:inline"
+     transform="translate(0,-32)" />
+  <g
+     inkscape:groupmode="layer"
+     id="layer6"
+     inkscape:label="item"
+     transform="translate(0,-32)"
+     style="display:inline">
+    <path
+       sodipodi:type="arc"
+       style="fill:none;stroke:#7c9ee2;stroke-width:0.91649183000000001;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;fill-opacity:1"
+       id="path5322"
+       sodipodi:cx="18"
+       sodipodi:cy="17"
+       sodipodi:rx="14"
+       sodipodi:ry="14"
+       d="M 32,17 A 14,14 0 1 1 4,17 14,14 0 1 1 32,17 z"
+       transform="matrix(1.0911172,0,0,1.0911172,-3.5808243,29.498293)" />
+    <path
+       style="fill:url(#linearGradient5336);fill-opacity:1;stroke:#0b274c;stroke-width:0.88712257px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 11.782602,38.39669 8.770263,0.02662 -0.275369,13.635127 4.337816,0.06505 -8.494891,7.416375 -8.5551388,-7.286263 4.1570738,-0.130112 z"
+       id="path3028"
+       inkscape:connector-curvature="0"
+       inkscape:export-filename="/var/tmp/cgi/git/metview/src/Download/DOWNLOAD_64.png"
+       inkscape:export-xdpi="180"
+       inkscape:export-ydpi="180"
+       sodipodi:nodetypes="cccccccc" />
+  </g>
+  <g
+     inkscape:groupmode="layer"
+     id="layer7"
+     inkscape:label="box"
+     style="display:none">
+    <rect
+       style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;display:inline"
+       id="rect3195"
+       width="31.226377"
+       height="31.261541"
+       x="0.47710654"
+       y="0.4906483"
+       inkscape:export-filename="/var/tmp/cgi/git/metview/src/Download/DOWNLOAD_64.png"
+       inkscape:export-xdpi="180"
+       inkscape:export-ydpi="180" />
+  </g>
+  <g
+     inkscape:groupmode="layer"
+     id="layer4"
+     inkscape:label="text"
+     style="display:inline"
+     transform="translate(0,-32)">
+    <flowRoot
+       xml:space="preserve"
+       id="flowRoot4691"
+       style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none"
+       transform="translate(0,32)"><flowRegion
+         id="flowRegion4693"><rect
+           id="rect4695"
+           width="10.360623"
+           height="14.985902"
+           x="-0.074004449"
+           y="-5.8902793" /></flowRegion><flowPara
+         id="flowPara4697" /></flowRoot>  </g>
+</svg>
diff --git a/src/Download/Download.cc b/src/Download/Download.cc
new file mode 100755
index 0000000..b17a721
--- /dev/null
+++ b/src/Download/Download.cc
@@ -0,0 +1,208 @@
+/***************************** LICENSE START ***********************************
+
+ Copyright 2016 ECMWF and INPE. This software is distributed under the terms
+ of the Apache License version 2.0. In applying this license, ECMWF does not
+ waive the privileges and immunities granted to it by virtue of its status as
+ an Intergovernmental Organization or submit itself to any jurisdiction.
+
+ ***************************** LICENSE END *************************************/
+
+#include <fstream>
+#include <sstream>
+#include <Metview.h>
+#include <MvScanFileType.h>
+#include <MvNetwork.h>
+#include <MvPath.hpp>
+
+
+class Download : public MvService {
+public:
+    Download(char *name) : MvService(name) {};
+    void serve(MvRequest&,MvRequest&);
+    bool sanitiseUrl(std::string &url);
+};
+
+
+// --------------------------------------------------------
+// filetoString
+// utility function to read a text file into a std::string
+// --------------------------------------------------------
+
+std::string filetoString(std::string filename)
+{
+    // open the file
+    std::ifstream ifStream;
+    ifStream.open(filename.c_str());
+
+    // get the text stream and convert into a string
+    std::stringstream stream;
+    stream << ifStream.rdbuf();
+    string str = stream.str();
+    return str;
+}
+
+
+// --------------------------------------------------------------------
+// replace_all
+// utility function to replace all occurences of a string with another.
+// Code taken from ECMWF's ecFlow.
+// --------------------------------------------------------------------
+
+bool replace_all(std::string& subject, const std::string& search, const std::string& replace)
+{
+    bool replaced = false;
+    size_t pos = 0;
+    while ((pos = subject.find(search, pos)) != std::string::npos)
+    {
+        subject.replace(pos, search.length(), replace);
+        pos += replace.length();
+        replaced = true;
+    }
+    return replaced;
+}
+
+
+// --------------------------------------------------------------------
+// Download::sanitiseUrl
+// Utility function to remove/replace unwanted characters from the URL.
+// Returns true if any strings were replaced.
+// --------------------------------------------------------------------
+
+bool Download::sanitiseUrl(std::string &url)
+{
+    bool replaced = replace_all(url, " ", "%20");
+    return replaced;
+}
+
+
+
+// ------------------------------------
+// Download::serve
+// Main function, performs the download
+// ------------------------------------
+
+void Download::serve(MvRequest& in,MvRequest& out)
+{
+
+    cout << "Entry Download::serve..." << endl;
+    in.print();
+
+
+    // if the URL is not supplied, abort immediately
+    const char *url = in("URL");
+    if (!url)
+    {
+        setError(1, "URL has not been supplied");
+        return;
+    }
+
+
+    // get the target path (optional parameter)
+    string target;
+    string errText;
+    if (!in.getPath("TARGET", target, true, errText))
+    {
+        marslog(LOG_EROR, "%s", errText.c_str());
+        setError(1);
+        return;
+    }
+
+
+    string urlStr(url);
+    bool urlChanged = sanitiseUrl(urlStr);
+    
+    if (urlChanged)
+    {
+        cout << "URL sanitised to this:" << endl;
+        cout << urlStr << endl;
+    }
+
+
+    // perform the network transfer
+    string outname(marstmp());
+
+    MvNetwork *net=new MvNetwork();
+    bool ok = net->get(urlStr, outname, "", errText);
+
+    if (!ok)
+    {
+        marslog(LOG_EROR, "Failed to download data: %s", errText.c_str());
+        setError(1);
+        return;
+    }
+
+
+    string h=net->header();
+    long responseCode = net->responseCode();
+    cout << "header " << h << endl;
+    cout << "response code: " << responseCode << endl;
+    char responseCodeString[32];
+    sprintf(responseCodeString, "%ld", responseCode);
+
+
+    // decide whether we got the right thing back or not
+    bool gotData = responseCode/100 == 2;  // code is 2xx
+
+    if (!gotData)
+    {
+        if (FileHasValidSize(outname.c_str()))
+        {
+            // in this case, we got an error, but also a file
+            // - ASSUME that this file contains error information,
+            // and therefore print it out
+            std::string logtext = filetoString(outname);
+            cout << "Log text:" << endl;
+            cout << logtext;
+            replace_all(logtext, "\n", " "); // remove newlines for the error reporting
+            string errorMsg = "Error code returned; message from server:";
+            marslog(LOG_EROR, "%s", errorMsg.c_str());
+            marslog(LOG_EROR, "%s", logtext.c_str());
+            setError(1);
+            return;
+        }
+        else
+        {
+            marslog(LOG_EROR, "Got error response code from server: %s", responseCodeString);
+            setError(1);
+            return;
+        }
+    }
+
+
+    // if we got to here, the download seems to have been ok
+    // if the user specified a TARGET, we should copy the file there
+    if (!target.empty())
+    {
+        string copyCommand = "cp " + outname + " \"" + target + "\"";
+        cout << "Copy: " << copyCommand << endl;
+        int ret2 = system(copyCommand.c_str());
+
+        if (ret2 != 0)
+        {
+            marslog(LOG_EROR,"Failed to copy file to TARGET destination. Command was: ");
+            marslog(LOG_EROR," %s", copyCommand.c_str());
+            setError(1, "Failed to copy file to TARGET location.");
+            return;
+        }
+    }
+
+
+    // Create output request
+    string iconType = ScanFileType(outname.c_str());  // dynamically find the type
+    out.setVerb(iconType.c_str());
+    out("PATH") = outname.c_str();
+    out("_RESPONSE_CODE") = responseCodeString;
+
+    out.print();
+
+    return;
+}
+
+
+int main(int argc,char **argv)
+{
+   MvApplication theApp(argc,argv);
+   Download data("DOWNLOAD");
+
+   theApp.run();
+}
diff --git a/src/Download/DownloadDef b/src/Download/DownloadDef
new file mode 100644
index 0000000..dd68f82
--- /dev/null
+++ b/src/Download/DownloadDef
@@ -0,0 +1,12 @@
+DOWNLOAD; Metview; Specific Application
+{
+        URL [interface =  scrolled_text]
+        {
+                @
+        } = ''
+
+        TARGET
+        {
+                @
+        } = ''
+}
diff --git a/src/Download/ObjectSpec.Download b/src/Download/ObjectSpec.Download
new file mode 100644
index 0000000..cb8b992
--- /dev/null
+++ b/src/Download/ObjectSpec.Download
@@ -0,0 +1,29 @@
+################################################################################
+#
+#	ObjectSpec.Download
+#
+
+object,
+	class		= DOWNLOAD,
+	icon_box	= Data Access,
+	can_be_created	= True,
+	definition_file	= '$METVIEW_DIR/share/metview/etc/DownloadDef',
+	#rules_file	= '$METVIEW_DIR/share/metview/etc/DownloadRules',
+	default_name	= Download,
+	help_page	= Download,
+	type		= Data,
+	expand		= 0,
+	macro		= download,
+	editor_type	= SimpleEditor,
+	pixmap		= '$METVIEW_DIR/share/metview/icons/DOWNLOAD.icon'
+
+state,
+	class		= DOWNLOAD,
+	output_class= GRIB/BUFR/GEOPOINTS/NETCDF/TABLE,
+	service		= Download
+
+service,
+	cmd		= '$METVIEW_CMD $METVIEW_BIN/Download',
+	name		=  Download,
+	fullname	=  Download
+
diff --git a/src/Flextra/FlextraRun.cc b/src/Flextra/FlextraRun.cc
index 409f51f..a590f1a 100644
--- a/src/Flextra/FlextraRun.cc
+++ b/src/Flextra/FlextraRun.cc
@@ -294,6 +294,7 @@ bool FlextraRun::getParamValue(vector<string>& value,MvRequest& in,string parNam
 bool FlextraRun::generatePathnamesFile(const string& fPathnames,MvRequest& in,const string& optionsPath,const string& outPath)
 {
 	string inPath,fAvailable;
+    string errTxt;
 		
 	const char *input_mode=in("FLEXTRA_INPUT_MODE");	
 	if(!input_mode)
@@ -320,10 +321,21 @@ bool FlextraRun::generatePathnamesFile(const string& fPathnames,MvRequest& in,co
 	}	
 	else if(strcmp(input_mode,"PATH") == 0) 
 	{
-	  	FLEXTRA_CHK(getParamValue(inPath,in,"FLEXTRA_INPUT_PATH"));
-		FLEXTRA_CHK(getParamValue(fAvailable,in,"FLEXTRA_AVAILABLE_FILE_PATH"));
-
-		if(fAvailable == "SAME_AS_INPUT_PATH")
+        if(!in.getPath("FLEXTRA_INPUT_PATH",inPath,false,errTxt))
+        {
+            marslog(LOG_EROR,"No parameter FLEXTRA_INPUT_PATH is specified!");
+            setError(13);
+            return false;
+        }
+
+        if(!in.getPath("FLEXTRA_AVAILABLE_FILE_PATH",fAvailable,false,errTxt))
+        {
+            marslog(LOG_EROR,"No parameter FLEXTRA_AVAILABLE_FILE_PATH is specified!");
+            setError(13);
+            return false;
+        }
+
+        if(fAvailable.find("SAME_AS_INPUT_PATH") != string::npos)
 		{
 			fAvailable = inPath + "/AVAILABLE";
 		}	
diff --git a/src/Flextra/ObjectSpec.Flexpart b/src/Flextra/ObjectSpec.Flexpart
index c5c2a77..cd9cf7b 100644
--- a/src/Flextra/ObjectSpec.Flexpart
+++ b/src/Flextra/ObjectSpec.Flexpart
@@ -10,7 +10,7 @@
 
 object,
 	class               = FLEXPART_RUN,
- 	can_be_created      = True,
+    can_be_created      = False,
  	definition_file     = '$METVIEW_DIR_SHARE/etc/FlexpartRunDef',
 	rules_file          = '$METVIEW_DIR_SHARE/etc/FlexpartRunRules',
 	default_name        = 'Flexpart Run',		
diff --git a/src/Hovmoeller/HovArea.cc b/src/Hovmoeller/HovArea.cc
index e363c56..cd3dedb 100644
--- a/src/Hovmoeller/HovArea.cc
+++ b/src/Hovmoeller/HovArea.cc
@@ -108,19 +108,27 @@ bool HovAreaToolkit::GetInputInfo(MvRequest& in)
    x2_ = in("AREA",3);
 
    // Check if coordinates follow Mars rules (n/w/s/e)
+   bool swap = false;
    if ( x1_ > x2_ )
    {
       double W = x1_;
       x1_ = x2_;
       x2_ = W;
+      swap = true;
    }
    if( y2_ > y1_ )
    {
       double W = y1_;
       y1_ = y2_;
       y2_ = W;
+      swap = true;
    }
 
+   // Send a warning message
+   if ( swap )
+//      marslog(LOG_WARN,"WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped.");
+      cout << "WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped." << endl;
+
    // Get direction
    geoDir_ = ((const char*)in("AVERAGE_DIRECTION") && strcmp(in("AVERAGE_DIRECTION"),"NORTH_SOUTH" ) == 0 ) ? HOV_NS : HOV_EW;
 
@@ -246,10 +254,22 @@ bool HovAreaToolkit::consistencyCheck( MvRequest& req1, MvRequest& req2)
 MvRequest HovAreaToolkit::CreateViewRequest()
 {
    MvRequest viewReq("MHOVMOELLERVIEW");
+
    viewReq("TYPE") = this->ApplicationType();
-   viewReq("SWAP_AXES") = swapAxes_ ? "YES" : "NO";
+   viewReq.addValue("AREA",y1_);
+   viewReq.addValue("AREA",x1_);
+   viewReq.addValue("AREA",y2_);
+   viewReq.addValue("AREA",x2_);
+
    viewReq("AVERAGE_DIRECTION") = ( geoDir_ == HOV_NS ) ? "NORTH_SOUTH" : "EAST_WEST";
+
+   viewReq("SWAP_AXES") = swapAxes_ ? "YES" : "NO";
+   if ( (const char*)origReq_("RESOLUTION") )
+      viewReq("RESOLUTION") = (const char*)origReq_("RESOLUTION");
+
+   viewReq("_CLASS") = "MHOVMOELLERVIEW";
    viewReq("_DEFAULT") = 1;
+   viewReq("_DATAATTACHED") = "YES";
 
    return viewReq;
 }
diff --git a/src/Hovmoeller/HovHeight.cc b/src/Hovmoeller/HovHeight.cc
index 307b6d4..f03860b 100644
--- a/src/Hovmoeller/HovHeight.cc
+++ b/src/Hovmoeller/HovHeight.cc
@@ -179,19 +179,27 @@ bool HovHeightToolkit::GetInputInfo(MvRequest& in)
    x2_ = in("AREA",3);
 
    // Check if coordinates follow Mars rules (n/w/s/e)
+   bool swap = false;
    if ( x1_ > x2_ )
    {
       double W = x1_;
       x1_ = x2_;
       x2_ = W;
+      swap = true;
    }
    if( y2_ > y1_ )
    {
       double W = y1_;
       y1_ = y2_;
       y2_ = W;
+      swap = true;
    }
 
+   // Send a warning message
+   if ( swap )
+//      marslog(LOG_WARN,"WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped.");
+      cout << "WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped." << endl;
+
    // Get vertical axis type
    vertAxisType_ = ( (const char*)in("VERTICAL_LEVEL_TYPE") && strcmp(in("VERTICAL_LEVEL_TYPE"),"PRESSURE") == 0 ) ? HOV_PRESSURE : HOV_ASINDATA;
 
@@ -281,9 +289,18 @@ bool HovHeightToolkit::consistencyCheck( MvRequest& req1, MvRequest& req2)
 MvRequest HovHeightToolkit::CreateViewRequest()
 {
    MvRequest viewReq("MHOVMOELLERVIEW");
+
    viewReq("TYPE") = this->ApplicationType();
+   viewReq.addValue("AREA",y1_);
+   viewReq.addValue("AREA",x1_);
+   viewReq.addValue("AREA",y2_);
+   viewReq.addValue("AREA",x2_);
+
    viewReq("VERTICAL_LEVEL_TYPE") = ( vertAxisType_ == HOV_PRESSURE ) ? "PRESSURE" : "AS_IN_DATA";
+
+   viewReq("_CLASS") = "MHOVMOELLERVIEW";
    viewReq("_DEFAULT") = 1;
+   viewReq("_DATAATTACHED") = "YES";
 
    return viewReq;
 }
diff --git a/src/Hovmoeller/HovLine.cc b/src/Hovmoeller/HovLine.cc
index d045bfa..4a09f72 100644
--- a/src/Hovmoeller/HovLine.cc
+++ b/src/Hovmoeller/HovLine.cc
@@ -108,19 +108,27 @@ bool HovLineToolkit::GetInputInfo(MvRequest& in)
    x2_ = in("LINE",3);
 
    // Check if coordinates follow Mars rules (n/w/s/e)
+   bool swap = false;
    if ( x1_ > x2_ )
    {
       double W = x1_;
       x1_ = x2_;
       x2_ = W;
+      swap = true;
    }
    if( y2_ > y1_ )
    {
       double W = y1_;
       y1_ = y2_;
       y2_ = W;
+      swap = true;
    }
 
+   // Send a warning message
+   if ( swap )
+//      marslog(LOG_WARN,"WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped.");
+      cout << "WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped." << endl;
+
    // Get swap axes flag
    swapAxes_ = ( (const char*)in("SWAP_AXES") && strcmp(in("SWAP_AXES"),"YES") == 0 ) ? true : false;
 
@@ -217,8 +225,18 @@ MvRequest HovLineToolkit::CreateViewRequest()
 {
    MvRequest viewReq("MHOVMOELLERVIEW");
    viewReq("TYPE") = this->ApplicationType();
+   viewReq.addValue("LINE",y1_);
+   viewReq.addValue("LINE",x1_);
+   viewReq.addValue("LINE",y2_);
+   viewReq.addValue("LINE",x2_);
+
    viewReq("SWAP_AXES") = swapAxes_ ? "YES" : "NO";
+   if ( (const char*)origReq_("RESOLUTION") )
+      viewReq("RESOLUTION") = (const char*)origReq_("RESOLUTION");
+
+   viewReq("_CLASS") = "MHOVMOELLERVIEW";
    viewReq("_DEFAULT") = 1;
+   viewReq("_DATAATTACHED") = "YES";
 
    return viewReq;
 }
diff --git a/src/Hovmoeller/HovToolkit.cc b/src/Hovmoeller/HovToolkit.cc
index 5c4bc9b..32ea789 100644
--- a/src/Hovmoeller/HovToolkit.cc
+++ b/src/Hovmoeller/HovToolkit.cc
@@ -148,10 +148,8 @@ MvRequest HovToolkit::CreateOutputRequest()
    // Create netCDF output request
    MvRequest out1("NETCDF_XY_MATRIX");
    out1("NETCDF_PLOT_TYPE") = "XY_MATRIX";
-   string xAxisType, yAxisType;
+   out1("NETCDF_DATA") = req;
    const char* secondCoordName = GetSecondCoordName();
-   MvRequest horAxisReq, vertAxisReq;
-   bool latVertAxis = false;    // indicates if vertical axis is latitude
    if ( verticalAxis_ == HOV_TIME )  // TIME is vertical axis
    {
       out1("NETCDF_Y_VARIABLE") = HOV_VARTIME.c_str();;
@@ -160,19 +158,7 @@ MvRequest HovToolkit::CreateOutputRequest()
       {
          out1("NETCDF_X_AUXILIARY_VARIABLE") = GetSecondAuxiliaryCoordName();
          out1("NETCDF_X_GEOLINE_CONVENTION") = (const char*)GeolineConvention().c_str();
-         xAxisType = "geoline";
-      }
-      else
-      {
-         if ( string(secondCoordName) == HOV_VARLAT || string(secondCoordName) == HOV_VARLON )
-         {
-            horAxisReq.setVerb("MAXIS");
-            horAxisReq("AXIS_ORIENTATION") = "HORIZONTAL";
-            horAxisReq("AXIS_TICK_LABEL_TYPE") = (secondCoordName == HOV_VARLAT) ? "Latitude" : "Longitude";
-         }
-         xAxisType = "regular";
       }
-      yAxisType = "date";
    }
    else  // TIME is horizontal axis
    {
@@ -182,74 +168,39 @@ MvRequest HovToolkit::CreateOutputRequest()
       {
          out1("NETCDF_Y_AUXILIARY_VARIABLE") = GetSecondAuxiliaryCoordName();
          out1("NETCDF_Y_GEOLINE_CONVENTION") = (const char*)GeolineConvention().c_str();
-         yAxisType = "geoline";
-      }
-      else
-      {
-         if ( secondCoordName == HOV_VARLAT || secondCoordName == HOV_VARLON )
-         {
-            vertAxisReq.setVerb("MAXIS");
-            vertAxisReq("AXIS_ORIENTATION") = "VERTICAL";
-            vertAxisReq("AXIS_TICK_LABEL_TYPE") = (secondCoordName == HOV_VARLAT) ? "Latitude" : "Longitude";
-         }
-         latVertAxis = (secondCoordName == HOV_VARLAT) ? true : false;
-         yAxisType = "regular";
       }
-
-      xAxisType = "date";
    }
 
    out1("NETCDF_VALUE_VARIABLE") = getNetcdfVarname(par->ParamName()).c_str();
    out1("NETCDF_MISSING_ATTRIBUTE") = "_FillValue";
    out1("_VERB") = "NETCDF_XY_MATRIX";
 
-   // Create customised CARTESIANVIEW request.
-   // This is only needed if a HovData visualisation action was requested.
-   // If a dropped (data or HovData) action was requested, the View is taken
-   // from uPlot. In this implementation, the view request will be always
-   // sent because: a) it is clean; b) does not cause problem.
-   MvRequest viewReq("CARTESIANVIEW");
-   viewReq("X_AUTOMATIC") = "on";
-   viewReq("X_AXIS_TYPE") = xAxisType.c_str();
-   viewReq("Y_AUTOMATIC") = "on";
-   viewReq("Y_AXIS_TYPE") = yAxisType.c_str();
-
-   // If Y_AUTOMATIC is ON and AXIS_TICK_LABEL_TYPE is LATITUDE then
-   // reverte the axis values because Hovmoeller computes values from
-   // North to South and Magics plots them from bottom to top by default
-   if ( strcmp(viewReq("Y_AUTOMATIC"), "on") == 0 && latVertAxis )
-      viewReq("Y_AUTOMATIC_REVERSE") = "on";
-
-   if ( horAxisReq )
-      viewReq("HORIZONTAL_AXIS") = horAxisReq;
-
-   if ( vertAxisReq )
-      viewReq("VERTICAL_AXIS") = vertAxisReq;
+   // Add information to help the Macro Converter to translate
+   // the output request to a Macro code
+   out1("_ORIGINAL_REQUEST") = this->buildMacroConverterRequest();
+
+   // Create the View request taking values from the input application
+   MvRequest viewReq = CreateViewRequest();
 
    // Save min/max date. This info is important if the dates in the
    // original View are 'automatic'.
-   string xy = (yAxisType == "date") ? "Y_" : "X_";
    MvDate dd(dateMinD_);
-   string str = xy + "DATE_MIN";
-   viewReq(str.c_str()) = dd.magicsDate().c_str();
+   viewReq("DATE_MIN") = dd.magicsDate().c_str();
    dd = dateMaxD_;
-   str = xy + "DATE_MAX";
-   viewReq(str.c_str()) = dd.magicsDate().c_str();
+   viewReq("DATE_MAX") = dd.magicsDate().c_str();
 
    // If action is not visualisation related then return the netcdf data.
    // Also, add the visualisation and original requests as hidden parameters.
    // These may be used later to help the visualisation of the netcdf data.
-   MvRequest hovViewReq = CreateViewRequest();
-   req("_VIEW") = "MHOVMOELLERVIEW";
-   req("_VIEW_REQUEST") = hovViewReq;
-   req("_VISUALISE") = out1;
-   req("_CARTESIANVIEW") = viewReq;
-   req("_ORIGINAL_REQUEST") = origReq_;
    if ( !IsVisualise() )
+   {
+      req("_VIEW") = "MHOVMOELLERVIEW";
+      req("_VIEW_REQUEST") = viewReq;
+      req("_VISUALISE") = out1;
       return req;
+   }
 
    // Final output request
-   out1("NETCDF_DATA") = req;
    MvRequest out = viewReq + out1;
 
    return out;
@@ -260,10 +211,9 @@ MvRequest HovToolkit::CreateOutputRequest( MvRequest& in )
    // Create NetCDF output request
    MvRequest data = in.getSubrequest("DATA");
    MvRequest out1 = data.getSubrequest("_VISUALISE");
-   MvRequest viewReq = data.getSubrequest("_CARTESIANVIEW");
+   MvRequest viewReq = data.getSubrequest("_VIEW_REQUEST");
    data.unsetParam("_VISUALISE");        // to avoid duplication of info
    data.unsetParam("_VIEW_REQUEST");     // to avoid duplication of info
-   data.unsetParam("_CARTESIANVIEW");    // to avoid duplication of info
    data.unsetParam("_ORIGINAL_REQUEST"); // to avoid duplication of info
    out1("NETCDF_DATA") = data;
 
@@ -444,7 +394,7 @@ bool HovToolkit::CreateParamInfo(MvRequest& data)
 //   iter.sort("DATE");
    iter.sort("EXPVER");
    iter.sort("PARAM");
-   while( field = iter() )
+   while( (field = iter()) )
    {
       // MvFieldExpander	x(field);
       MvRequest rq=field.getRequest();
@@ -487,7 +437,7 @@ bool HovToolkit::CreateParamInfo(MvRequest& data)
    // Maybe this restriction should be removed in the future
    if ( params_.size() > 1 )
    {
-      marslog(LOG_EROR, "Creation of Hovmoeller diagrams from multiple parameters is not yet supported. This data has %d parameters.", params_.size());
+      marslog(LOG_EROR, "Creation of Hovmoeller diagrams from multiple parameters or vertical levels is not yet supported. This data has %d parameters or levels.", params_.size());
       return false;
    }
 
@@ -516,9 +466,10 @@ void HovToolkit::GenerateKey(string &str, MvRequest& rq)
  
 void HovToolkit::GenerateTimeKey(string &str, MvRequest& rq)
 {
-   int  istep  = rq("STEP");
-   long idate  = rq("DATE");
-   int  itime  = rq("TIME");
+   int istep  = rq("STEP");
+   int itime  = rq("TIME");
+   int idate  = rq.getBaseDate();
+
 
    char key[20];
    ostrstream oss( key, sizeof( key ) );
@@ -646,7 +597,7 @@ bool HovToolkit::GenerateData(MvRequest& data)
    string lastKey = "FIRSTFIELD";
    MvField field, lastField;
    ParamIterator paramIter;
-   while( field = iter() )
+   while( (field = iter()) )
    {
       currentGenerated++;
 
@@ -1057,3 +1008,23 @@ bool HovToolkit::ExpandGetTimeInfo()
 
    return true;
 }
+
+MvRequest HovToolkit::buildMacroConverterRequest()
+{
+   const char* caux = origReq_.getVerb();
+   MvRequest oreq( caux );
+   oreq("_MACRO_DECODE_TAG") = 1;  // extra info for the Macro Converter
+   oreq("_CLASS") = (const char*)origReq_("_CLASS") ? (const char*)origReq_("_CLASS") : caux;
+   oreq("_VERB") = (const char*)origReq_("_VERB") ? (const char*)origReq_("_VERB") : caux;
+   if ( strcmp((const char*)oreq("_CLASS"),"RETRIEVE") == 0  ||
+        strcmp((const char*)oreq("_CLASS"),"GRIB") == 0 )
+   {
+      MvRequest retReq = origReq_("DATA");
+      if ( (const char*)retReq("_NAME") )
+         oreq("_NAME") = (const char*)retReq("_NAME");
+   }
+   else if ( (const char*)origReq_("_NAME") )
+      oreq("_NAME") = (const char*)origReq_("_NAME");
+
+   return oreq;
+}
diff --git a/src/Hovmoeller/HovToolkit.h b/src/Hovmoeller/HovToolkit.h
index 98ae364..d030e67 100644
--- a/src/Hovmoeller/HovToolkit.h
+++ b/src/Hovmoeller/HovToolkit.h
@@ -138,6 +138,9 @@ public:
    // Check if parameters between two requests are consistent
    virtual bool consistencyCheck( MvRequest&, MvRequest& ) = 0;
 
+   // Add information to help the Macro Converter to translate
+   // the output request to a Macro code
+   MvRequest buildMacroConverterRequest();
 
 protected:
 
diff --git a/src/Hovmoeller/MHovmoellerDataDef b/src/Hovmoeller/MHovmoellerDataDef
index 8b13bc1..4b87bd3 100644
--- a/src/Hovmoeller/MHovmoellerDataDef
+++ b/src/Hovmoeller/MHovmoellerDataDef
@@ -56,7 +56,7 @@ AREA_HOVM; Hovmoeller AREA Application
    AREA
       [
          help         = help_input,
-         help_icon    = 'help_area',
+         help_icon    = 'help_map',
          input_type   = area,
          input_window = '/System/Defaults/Input Window'
       ]
@@ -139,7 +139,7 @@ VERTICAL_HOVM; Hovmoeller Vertical Application
    AREA
       [
          help         = help_input,
-         help_icon    = 'help_area',
+         help_icon    = 'help_map',
          input_type   = area,
          input_window = '/System/Defaults/Input Window'
         ]
diff --git a/src/Hovmoeller/MHovmoellerViewDef b/src/Hovmoeller/MHovmoellerViewDef
index babe2ae..38ed292 100644
--- a/src/Hovmoeller/MHovmoellerViewDef
+++ b/src/Hovmoeller/MHovmoellerViewDef
@@ -20,7 +20,7 @@ MHOVMOELLERVIEW; uPlot Icon; Metview
 
    AREA [
           help         = help_input,
-          help_icon    = 'help_area',
+          help_icon    = 'help_map',
           input_type   = area,
           input_window = '/System/Defaults/Input Window'
         ]
diff --git a/src/Macro/bufr.cc b/src/Macro/bufr.cc
index 2638a57..c2ab69b 100644
--- a/src/Macro/bufr.cc
+++ b/src/Macro/bufr.cc
@@ -1179,6 +1179,11 @@ Value SubGeoFunction::Execute(int,Value *arg)
 	p->load();
 
 	request *r = empty_request(NULL);
+
+	if (n < 0 || n > p->Count()-1)
+		return Error("Geopoints index is %ld, but should be from 0 to %ld", n, p->Count()-1);
+
+
 	MvGeoP1& g = (*p)[n];
 
 	set_value(r,"latitude",		"%g",	g.lat_y() );
diff --git a/src/Macro/extern.cc b/src/Macro/extern.cc
index f2a7588..643fe12 100644
--- a/src/Macro/extern.cc
+++ b/src/Macro/extern.cc
@@ -137,7 +137,12 @@ int ExternFunction::Compile(void)
 	char buf[2048];
 	char *newcmd = marstmp();
 
-	sprintf(buf,"$METVIEW_BIN/compile %s \"%s\" %s %s 2>&1",
+	const char* mvVersion = getenv( "METVIEW_VERSION" );
+	const char* mvDir     = getenv( "METVIEW_DIR" );
+
+
+	sprintf(buf,"env METVIEW_VVERSION=%s METVIEW_DDIR=%s $METVIEW_BIN/compile %s \"%s\" %s %s 2>&1",
+		mvVersion, mvDir,
 		(Context::Trace()>0)?"-d":"",
 		cmd,file,newcmd);
 
diff --git a/src/Macro/grib.cc b/src/Macro/grib.cc
index 4ade188..ea59d01 100644
--- a/src/Macro/grib.cc
+++ b/src/Macro/grib.cc
@@ -7,15 +7,18 @@
 
  ***************************** LICENSE END *************************************/
 
-#include "macro.h"
 #include <math.h>
 #include <ctype.h>
 #include <assert.h>
-#include "MvGrid.h"
+
+#include "macro.h"
 #include "cbufr.h"
 #include "inc_stl.h"
+#include "script.h"
+
 #include "MvException.h"
 #include "MvFieldSet.h"
+#include "MvGrid.h"
 #include "MvPath.hpp"
 
 #define NO_MVGRID 0
@@ -39,6 +42,21 @@ enum eGridLatLonsType
     GLL_LONS
 };
 
+// used in function GribDateFunction
+enum eGribDateType
+{
+    GDT_BASE = 0,
+    GDT_VALID
+};
+
+
+// used in SubGribFunction
+enum eGribIndexType
+{
+    GINDEX_NUMBERS,
+    GINDEX_VECTOR
+};
+
 
 double CovarFunc( field*, field*, const MvGeoBox& );
 
@@ -273,19 +291,39 @@ public:
 	SubGribFunction(const char *n) : Function(n) { };
 	virtual Value Execute(int arity,Value *arg);
 	virtual int ValidArguments(int arity,Value *arg);
+private:
+	eGribIndexType indexType_;
 };
 
 int SubGribFunction::ValidArguments(int arity,Value *arg)
 {
 	if(arity != 2 && arity != 3 && arity != 4) return false;
 
-	for(int i=1;i<arity;i++)
-		if(arg[i].GetType() != tnumber)
-			return false;
 
 	if(arg[0].GetType() != tgrib)
 		return false;
 
+
+	// indexing can either be a set of numbers or a single vector
+	if (arg[1].GetType() == tvector)  // vector
+	{
+		if (arity > 2)
+			return false;
+		else
+		{
+			indexType_ = GINDEX_VECTOR;
+			return true;
+		}
+	}
+	else  // number(s)
+	{
+		indexType_ = GINDEX_NUMBERS;
+
+		for(int i=1;i<arity;i++)
+			if(arg[i].GetType() != tnumber)
+				return false;
+	}
+
 	return true;
 }
 
@@ -293,19 +331,46 @@ extern int vcnt;
 
 Value SubGribFunction::Execute(int arity ,Value *arg)
 {
-	int from=0,to=0,step=0;
-	fieldset *v;
+	if (indexType_ == GINDEX_NUMBERS)
+	{
+		int from=0,to=0,step=0;
+		fieldset *v;
 
-	arg[0].GetValue(v);
+		arg[0].GetValue(v);
 
-	arg[1].GetValue(from);
-	if(arity>2) arg[2].GetValue(to);
-	if(arity>3) arg[3].GetValue(step);
+		arg[1].GetValue(from);
+		if(arity>2) arg[2].GetValue(to);
+		if(arity>3) arg[3].GetValue(step);
 
-	fieldset *w = sub_fieldset(v,from,to,step);
-	if(!w)
-	   return Error("fs[]: Cannot extract sub-fieldset");
-	return Value(w);
+		fieldset *w = sub_fieldset(v,from,to,step);
+		if(!w)
+		   return Error("fs[]: Cannot extract sub-fieldset");
+		return Value(w);
+	}
+
+	else  // vector indexing (i.e. the index is itself a vector of indexes)
+	{
+		// code partly taken from MARS/field.c/sub_fieldset()
+		fieldset *v;
+		CVector  *vi;
+		arg[0].GetValue(v);
+		arg[1].GetValue(vi);
+
+		fieldset *w = new_fieldset(vi->Count());
+
+		for(int i = 0; i < vi->Count(); i++)
+		{
+			int index = (*vi)[i];
+			if (index < 1 || index > v->count)
+				return Error("index %d(%d) is out of range. Fieldset size is %d", i+1, index, v->count);
+
+			field *g = v->fields[index-1];
+			w->fields[i] = g;
+			g->refcnt++;
+		}
+
+		return Value(w);
+	}
 }
 
 //=============================================================================
@@ -2161,6 +2226,44 @@ Value SetGridValsFunction::Execute(int /*arity*/,Value *arg)
 }
 
 
+//=============================================================================
+
+class GribDateFunction : public Function {
+    eGribDateType type;
+public:
+	GribDateFunction(const char *n, eGribDateType t) : Function(n,1,tgrib), type(t)
+	{info = "Returns a single or list of base/valid dates for the given fieldset.";}
+	virtual Value Execute(int arity,Value *arg);
+};
+
+
+Value GribDateFunction::Execute(int, Value *arg)
+{
+	fieldset *fs;
+	arg[0].GetValue(fs);   // get the fieldset variable
+
+	CList *l = new CList(fs->count); // initialise the resulting list
+
+	for(int i = 0; i < fs->count; i++)
+	{
+		field  *h = GetIndexedFieldWithAtLeastPackedMem(fs,i);
+		MvField *mvfield = new MvField(h);
+		double baseDate = mvfield->yyyymmddFoh();
+		double dateAsNumber = baseDate;
+		if (type == GDT_VALID)  // valid_date requested? then add the step
+			dateAsNumber += mvfield->stepFoh();
+
+		Date d(dateAsNumber);
+		(*l)[i] = d;
+	}
+
+
+	// if only one field, then just return a single date, otherwise return the list
+	if (l->Count() > 1)
+		return Value(l);
+	else
+		return Value((*l)[0]);
+}
 
 //=============================================================================
 
@@ -5339,6 +5442,7 @@ double CovarFunc( field* f1, field* f2, const MvGeoBox& area )
 
 CGrib::CGrib(fieldset *v) : InPool(tgrib), cube(0)
 {
+   path_ = "";
 
 	static int done = 0;
 	if(!done)
@@ -5353,36 +5457,36 @@ CGrib::CGrib(fieldset *v) : InPool(tgrib), cube(0)
 
 CGrib::CGrib(request *r) : InPool(tgrib,r), cube(0)
 {
-	fs = request_to_fieldset(r);
+   fs = request_to_fieldset(r);
+   path_ = MakeAbsolutePath((const char*)get_value(r,"PATH",0),dirname(Script::MacroMainPath()));
 
-	// Make sure all path are temporary
-	while(r)
-	{
-		if(get_value(r,"PATH",0))
-		{
-			const char *p = get_value(r,"TEMPORARY",0);
-			if(!p) return;
-			if(atoi(p) == 0) return;
-		}
-		r = r->next;
-	}
-
-	// We will handle the unlinking of temp file ourselves
-	if(!IsIcon())
-	{
-		IsIcon(true); // InPool won't touch the data
-		SetFileTempFlag(true);
-	}
+   // Make sure all path are temporary
+   while(r)
+   {
+      if(get_value(r,"PATH",0))
+      {
+         const char *p = get_value(r,"TEMPORARY",0);
+         if(!p) return;
+         if(atoi(p) == 0)
+            return;
+      }
+      r = r->next;
+   }
 
+   // We will handle the unlinking of temp file ourselves
+   if(!IsIcon())
+   {
+      IsIcon(true); // InPool won't touch the data
+      SetFileTempFlag(true);
+   }
 }
 
 CGrib::CGrib(const char *fname) : InPool(tgrib), cube(0)
 {
-	//fs = read_fieldset(fname,0);
-	fs = read_fieldset(FullPathName(fname).c_str(),0);
+   path_ = "";
+   fs = read_fieldset(FullPathName(fname).c_str(),0);
 }
 
-
 void CGrib::DestroyContent()
 {
 	// Check if we have more that one ref
@@ -5417,8 +5521,7 @@ void CGrib::ToRequest(request* &s)
 
 	set_value(r,"_CLASS","MACRO");
 	set_value(r,"_NAME","%s",GetName());
-
-
+   set_value(r,"_PATH",path_.c_str());
 
 	// fieldset_to_request() sets the 'temp' member of the gribfile for each
 	// field to 'false', meaning that even if this is supposed to be a temporary
@@ -5785,10 +5888,15 @@ static void install(Context *c)
 	c->AddFunction(new GridLatLonsFunction("longitudes", GLL_LONS, false));              // new version
 	c->AddFunction(new GridLatLonsFunction("gridlons",   GLL_LONS, true, "longitudes")); // deprecated version
 
-
 	c->AddFunction(new SetGridValsFunction("set_values",   false));                // new version
 	c->AddFunction(new SetGridValsFunction("set_gridvals", true, "set_values"));   // deprecated version
 
+
+	c->AddFunction(new GribDateFunction("base_date",  GDT_BASE));
+	c->AddFunction(new GribDateFunction("valid_date", GDT_VALID));
+
+
+
 #if 0
 	c->AddFunction(new SpectrumFunction("spectrum"));
 #endif
@@ -5819,7 +5927,7 @@ static void install(Context *c)
 	c->AddFunction(new GribHeaderFunctionW("grib_set_string", GRIB_STRING));
 	c->AddFunction(new GribHeaderFunctionWGeneric("grib_set"));
 
-   c->AddFunction(new FillMVEWFunction("fill_missing_values_ew"));
+	c->AddFunction(new FillMVEWFunction("fill_missing_values_ew"));
 }
 
 static Linkage linkage(install);
diff --git a/src/Macro/include/macro.h b/src/Macro/include/macro.h
index d33a936..4688b8f 100644
--- a/src/Macro/include/macro.h
+++ b/src/Macro/include/macro.h
@@ -17,8 +17,6 @@
 #include "value.h"
 #include "node.h"
 
-static const char* M_UPLOT = "uPlotManager";
-
 class Context;
 class CObject;
 
diff --git a/src/Macro/include/value.h b/src/Macro/include/value.h
index 3bfb896..b50600e 100644
--- a/src/Macro/include/value.h
+++ b/src/Macro/include/value.h
@@ -26,11 +26,17 @@ typedef int _vtype;
 
 class Value;
 
+using std::string;
+
 //=============================================================================
 
 class Notify {
+
 public:
-	virtual void trigger(void*) = 0;
+   Notify() {}
+   ~Notify() {}
+
+   virtual void trigger(void*) = 0;
 };
 
 class Reference {
@@ -245,26 +251,39 @@ public:
 //=============================================================================
 
 class CGrib  : public InPool {
-	fieldset  *fs;
-	hypercube *cube;
-	virtual void ToFieldset(fieldset* &x) { x = fs; };
-	virtual void ToRequest(request* &);
-	virtual void ToGrib(CGrib*       &x) { x = this;};
-	virtual void Print(void);
-	virtual int  Write(FILE*);
-	virtual Content *Clone(void);
-	virtual void SetSubValue(Value&,int,Value*);
-	virtual void Dump2();
-    void DestroyContent();
+
+   fieldset  *fs;
+   hypercube *cube;
+   string    path_;  // It stores an absolute path. This is important
+                     // specially if request parameter PATH contains
+                     // a relative path. 
+   
+   virtual void ToFieldset(fieldset* &x)
+      { x = fs; }
+
+   virtual void ToRequest(request* &);
+   virtual void ToGrib(CGrib* &x)
+      { x = this; }
+
+   virtual void Print(void);
+   virtual int  Write(FILE*);
+   virtual Content *Clone(void);
+   virtual void SetSubValue(Value&,int,Value*);
+   virtual void Dump2();
+   void DestroyContent();
 
 public:
-	CGrib(const char *);
-	CGrib(request  *);
-	CGrib(fieldset  *);
-	fieldset *GetFieldset(void)       { return fs; };
-	void SetFileTempFlag(boolean);
-	~CGrib();
-	hypercube* get_cube();
+   CGrib(const char*);
+   CGrib(request*);
+   CGrib(fieldset*);
+
+   ~CGrib();
+
+   fieldset *GetFieldset(void)
+      { return fs; };
+      
+   void SetFileTempFlag(boolean);
+   hypercube* get_cube();
 };
 
 
diff --git a/src/Macro/main.cc b/src/Macro/main.cc
index 92d3b1e..95f9586 100644
--- a/src/Macro/main.cc
+++ b/src/Macro/main.cc
@@ -12,6 +12,7 @@
 #include <cctype>
 #include "script.h"
 #include "MvDebugPrintControl.h"
+#include "MvPath.hpp"
 
 typedef struct data {
 	boolean serve;
@@ -73,7 +74,7 @@ class sbuf : public streambuf { // 76830942
 
 	virtual int overflow(int c=EOF)
 	{
-		if(n >= sizeof(line)-2) sync();
+		if(n >= (signed)sizeof(line)-2) sync();
 		if( (line[n++] = c) == '\n' ) { n--; sync(); }
 		return 0;
 	}
@@ -181,18 +182,16 @@ static void serve_macro(svcid *id,request *r,void *data)
 	Script::SvcId = id;
 	mars.outproc  = Script::PutMessage;
 
-	char save[1024];
-	getcwd(save,sizeof(save)-1);
-
-
-//	chdir(getenv("METVIEW_USER_DIRECTORY"));
-//	chdir(dirname(name)+1);
-
-	chdir(dirname(path));  // to ensure we always get the dir that the
-                           // macro is in, even if run from the editor
-	setenv("PWD",dirname(path),1); // change env variable too
-
-
+   // Important: first, save directory where the Macro application is
+   // currently running, usually where the Macro executable is located.
+   // Second, change directory to where the Macro program is located.
+   // Third, before finishing the execution of this program, restore
+   // the current directory.
+   char save[1024];
+   getcwd(save,sizeof(save)-1);
+   chdir(dirname(path));  // to ensure we always get the dir that the
+                          // macro is in, even if run from the editor
+   setenv("PWD",dirname(path),1); // change env variable too
 
 	start_timer();
 
@@ -213,15 +212,12 @@ static void serve_macro(svcid *id,request *r,void *data)
 	{
 
 		Value v(param);
-	        	
-		// Because the macro editor uses a temp file,
-		// we need to set the MacroPath here again
 
-		char buf[1024];
-		sprintf(buf,"%s/%s",getenv("METVIEW_USER_DIRECTORY"),name);
-		Script::MacroPath(buf);    //It can be updated according to the
-		                           // last function compiled
-		Script::MacroMainPath(buf);
+      // Because the macro editor uses a temp file,
+      // we need to set the MacroPath here again
+      string fullPath = MakeAbsolutePath(name);
+      Script::MacroPath(fullPath.c_str());
+      Script::MacroMainPath(fullPath.c_str());
 
 		s->SetRunMode(action);
 		Context::Trace(trace?atoi(trace):0);
@@ -300,10 +296,19 @@ static void serve_macro(svcid *id,request *r,void *data)
 	marslog(LOG_INFO,"Compile+run = %s",info);
 	marslog(LOG_INFO,"End of %s %s %s",path,name,action);
 
+   // Add parameter _PATH
+   if ( !(const char*)get_value(reply,"_PATH",0) )
+   {
+      string fullPath = MakeAbsolutePath((const char*)get_value(reply,"PATH",0),dirname(Script::MacroMainPath()));
+      set_value(reply,"_PATH",fullPath.c_str());
+   }
+
 	send_reply(id,reply);
 	// Don't free reply, it's go when the Value is destroyed
 
-	chdir(save);
+   // Restore current directory
+   chdir(save);
+
 	if(forked != -1)
 	{
 		destroy_service(id->s);
@@ -474,8 +479,6 @@ static void serve_formula(svcid *id,request *r,void*)
 
 int main(int argc,char **argv)
 {
-	extern int zzdebug;
-
 	marsinit(&argc,argv,&setup,NUMBER(opts),opts);
 
 	mvSetMarslogLevel();  //-- if "quiet log"
diff --git a/src/Macro/misc.cc b/src/Macro/misc.cc
index 421fc7a..1f8e9dc 100644
--- a/src/Macro/misc.cc
+++ b/src/Macro/misc.cc
@@ -12,11 +12,20 @@
 #include <MvRequest.h>
 #include <MvVersionInfo.h>
 
+#if defined(METVIEW_ODB)
+    #include "odb_api/odbcapi.h"
+#endif
+
 
 #include "macro.h"
 #include "script.h"
 #include "cbufr.h"
 
+
+#define QUOTE_PP(P) #P
+#define QUOTE_PPP(P) QUOTE_PP(P)
+
+
 //=============================================================================
 
 class NilFunction : public Function {
@@ -786,8 +795,15 @@ Value MetviewVersionFunction::Execute(int arity,Value *arg)
 	}
 
 
+	// extra code to take into account the possibility of
+	// using either GRIB_API or ecCodes for GRIB handling
+	std::string grib_package=QUOTE_PPP(GRIB_HANDLING_PACKAGE);
+	for(unsigned int i = 0; i < grib_package.length(); ++i)
+		grib_package[i] = tolower(grib_package[i]);
+	grib_package += "_version";
+
 	grib_api_version = grib_get_api_version();
-	set_value(r, "grib_api_version", "%d", grib_api_version);
+	set_value(r, grib_package.c_str(), "%d", grib_api_version);
 
 	mars_version = marsversion();
 	set_value(r, "mars_version", "%d", mars_version);
@@ -795,6 +811,13 @@ Value MetviewVersionFunction::Execute(int arity,Value *arg)
 	emos_version = emosnum_(&konoff);
 	set_value(r, "emos_version", "%d", emos_version);
 
+
+#if defined(METVIEW_ODB)
+	const char *odbapi_version = odb_api_version();
+	set_value(r, "odb_api_version", "%s", odbapi_version);
+#endif
+
+
 	return Value(r);
 }
 
diff --git a/src/Macro/mlist.cc b/src/Macro/mlist.cc
index e178934..55c526d 100644
--- a/src/Macro/mlist.cc
+++ b/src/Macro/mlist.cc
@@ -13,6 +13,15 @@
 #include "inc_stl.h"
 
 
+
+enum eListIndexType
+{
+    LINDEX_NUMBERS,
+    LINDEX_VECTOR
+};
+
+
+
 //=============================================================================
 
 int CList::Write(FILE *f)
@@ -170,6 +179,9 @@ public:
 	ListElemFunction(const char *n) : Function(n,2,tlist,tnumber) {};
 	virtual Value Execute(int arity,Value *arg);
 	virtual int ValidArguments(int arity,Value *arg);
+
+private:
+	eListIndexType indexType_;
 };
 
 int ListElemFunction::ValidArguments(int arity,Value *arg)
@@ -177,44 +189,86 @@ int ListElemFunction::ValidArguments(int arity,Value *arg)
 	if(arity<2 || arity > 4) return false;
 	if(arg[0].GetType() != tlist) return false;
 
-	for(int i=1;i<arity;i++)
-		if(arg[i].GetType() != tnumber)
+
+	// indexing can either be a set of numbers or a single vector
+
+	if (arg[1].GetType() == tvector)  // vector
+	{
+		if (arity > 2)
 			return false;
+		else
+		{
+			indexType_ = LINDEX_VECTOR;
+			return true;
+		}
+	}
+	else  // number(s)
+	{
+		indexType_ = LINDEX_NUMBERS;
+
+		for(int i=1;i<arity;i++)
+			if(arg[i].GetType() != tnumber)
+				return false;
+	}
 
 	return true;
 }
 
 Value ListElemFunction::Execute(int arity,Value *arg)
 {
-	CList *v;
-	int  n;
-	int  m = 0;
-	int  s = 0;
+	if (indexType_ == LINDEX_NUMBERS)
+	{
+		CList *v;
+		int  n;
+		int  m = 0;
+		int  s = 0;
 
-	arg[0].GetValue(v);
-	arg[1].GetValue(n);
-	if(arity>2) arg[2].GetValue(m);
-	if(arity>3) arg[3].GetValue(s);
+		arg[0].GetValue(v);
+		arg[1].GetValue(n);
+		if(arity>2) arg[2].GetValue(m);
+		if(arity>3) arg[3].GetValue(s);
+
+		if(m <  n) m = n;
+		if(m >  v->Count()) m = v->Count();
+		if(s <= 0) s = 1;
 
-	if(m <  n) m = n;
-	if(m >  v->Count()) m = v->Count();
-	if(s <= 0) s = 1;
+		if(n <1 || n>v->Count())
+			return Error("Index out of range. Index is %d, list size is %d",
+				n,v->Count());
 
-	if(n <1 || n>v->Count())
-		return Error("Index out of range. Index is %d, list size is %d",
-			n,v->Count());
+		if(m == n ) return (*v)[n-1];
 
-	if(m == n ) return (*v)[n-1];
 
+		int c = (m-n)/s+1;
+		CList *l = new CList(c);
+		int i,j;
 
-	int c = (m-n)/s+1;
-	CList *l = new CList(c);
-	int i,j;
+		for(i = 0, j = n-1 ; i < c ; i++, j += s)
+			(*l)[i] = (*v)[j];
 
-	for(i = 0, j = n-1 ; i < c ; i++, j += s)
-		(*l)[i] = (*v)[j];
+		return Value(l);
+	}
+
+	else  // vector indexing (i.e. the index is itself a vector of indexes)
+	{
+		CList   *v;
+		CVector *vi;
+		arg[0].GetValue(v);
+		arg[1].GetValue(vi);
+
+		// the result vector
+		CList *vnew = new CList(vi->Count());
+		for (int i = 0; i < vi->Count(); i++)
+		{
+			int index = (*vi)[i];
+			if (index < 1 || index > v->Count())
+				return Error("index %d(%d) is out of range. List size is %d", i+1, index, v->Count());
 
-	return Value(l);
+			(*vnew)[i] = (*v)[index-1];  // -1 to convert from 1-index (Macro) to 0-index (C)
+		}
+
+		return Value(vnew);
+	}
 }
 
 //=============================================================================
@@ -322,7 +376,7 @@ Value ListFindFunction::Execute(int arity,Value *arg)
         if (s && !strcmp(s, "all"))
             findAll = true;
         else
-            marslog(LOG_WARN, "find(any, list, string) only accepts 'all' as its last argument. Supplied: '%s'", s);
+            marslog(LOG_WARN, "find(list, any, string) only accepts 'all' as its last argument. Supplied: '%s'", s);
     }
 
     arg[0].GetValue(v);
@@ -363,7 +417,7 @@ Value ListFindFunction::Execute(int arity,Value *arg)
         {
             CList *outlist = new CList(results.size());
 
-            for(int i=0; i < results.size(); i++)
+            for(unsigned int i=0; i < results.size(); i++)
             {
                 (*outlist)[i] = results[i];
             }
diff --git a/src/Macro/mvector.cc b/src/Macro/mvector.cc
index 1323bbd..22cf418 100644
--- a/src/Macro/mvector.cc
+++ b/src/Macro/mvector.cc
@@ -61,6 +61,15 @@ enum eVectorSortType
 };
 
 
+
+enum eVectorIndexType
+{
+    VINDEX_NUMBERS,
+    VINDEX_VECTOR
+};
+
+
+
 /*******************************************************************************
  *
  * Function      : CVector::CVector(int)
@@ -730,7 +739,9 @@ Value Vector2Function::Execute(int ,Value *arg)
  *                 last element to be extracted - if supplied, then a vector
  *                 is returned. A third argument is an optional step size.
  *                 A fourth argument tells us how many elements to extract
- *                 at each step.
+ *                 at each step. Alternatively, a vector can be supplied
+ *                 instead of all these numbers - e.g. a vector index with
+ *                 6 elements will return a resulting vector with 6 elements.
  *
  ******************************************************************************/
 
@@ -739,6 +750,8 @@ public:
 	VectorGetElemFunction(char *n) : Function(n,2,tvector,tnumber) {};
 	virtual Value Execute(int arity,Value *arg);
 	virtual int ValidArguments(int arity,Value *arg);
+private:
+	eVectorIndexType indexType_;
 };
 
 int VectorGetElemFunction::ValidArguments(int arity,Value *arg)
@@ -746,9 +759,26 @@ int VectorGetElemFunction::ValidArguments(int arity,Value *arg)
 	if(arity<2 || arity > 5) return false;
 	if(arg[0].GetType() != tvector) return false;
 
-	for(int i=1;i<arity;i++) // all arguments after the first one must be numbers
-		if(arg[i].GetType() != tnumber)
+
+	// indexing can either be a set of numbers or a single vector
+	if (arg[1].GetType() == tvector)  // vector
+	{
+		if (arity > 2)
 			return false;
+		else
+		{
+			indexType_ = VINDEX_VECTOR;
+			return true;
+		}
+	}
+	else  // number(s)
+	{
+		indexType_ = VINDEX_NUMBERS;
+
+		for(int i=1;i<arity;i++) // all arguments after the first one must be numbers
+			if(arg[i].GetType() != tnumber)
+				return false;
+	}
 
 	return true;
 }
@@ -756,41 +786,66 @@ int VectorGetElemFunction::ValidArguments(int arity,Value *arg)
 
 Value VectorGetElemFunction::Execute(int arity,Value *arg)
 {
-    CVector *v;
-    int  first;
-    int  last   = 0; // index of first element
-    int  step   = 0; // step
-    int  length = 1; // how many we extract at each step
+	if (indexType_ == VINDEX_NUMBERS)
+	{
+		CVector *v;
+		int  first;
+		int  last   = 0; // index of first element
+		int  step   = 0; // step
+		int  length = 1; // how many we extract at each step
 
-    arg[0].GetValue(v);
-    arg[1].GetValue(first);
-    if (arity>2) arg[2].GetValue(last);
-    if (arity>3) arg[3].GetValue(step);
-    if (arity>4) arg[4].GetValue(length);
+		arg[0].GetValue(v);
+		arg[1].GetValue(first);
+		if (arity>2) arg[2].GetValue(last);
+		if (arity>3) arg[3].GetValue(step);
+		if (arity>4) arg[4].GetValue(length);
 
-    if (last <  first) last = first;
-    if (step <= 0) step = 1;
+		if (last <  first) last = first;
+		if (step <= 0) step = 1;
 
-    if (last+length-step >  v->Count())
-       return Error("last element out of range. last is %d, vector size is %d",
-            last+length-step,v->Count());
+		if (last+length-step >  v->Count())
+		   return Error("last element out of range. last is %d, vector size is %d",
+				last+length-step,v->Count());
 
-    if (first <1 || first>v->Count())
-        return Error("first out of range. first is %d, vector size is %d",
-            first,v->Count());
+		if (first <1 || first>v->Count())
+			return Error("first out of range. first is %d, vector size is %d",
+				first,v->Count());
 
-    if ((last == first) && (length == 1))
-        return (*v)[first-1];
+		if ((last == first) && (length == 1))
+			return (*v)[first-1];
 
 
-    int c = ((last-first)/step+1) * length;
-    CVector *vnew = new CVector(c);
-    int i,j;
+		int c = ((last-first)/step+1) * length;
+		CVector *vnew = new CVector(c);
+		int i,j;
 
-    for (i = 0, j = first-1 ; i < c ; i+=length, j += step)
-        vnew->CopyValues(i, *v, j, length);
+		for (i = 0, j = first-1 ; i < c ; i+=length, j += step)
+			vnew->CopyValues(i, *v, j, length);
 
-    return Value(vnew);
+		return Value(vnew);
+	}
+
+	else  // vector indexing (i.e. the index is itself a vector of indexes)
+	{
+		CVector *v;
+		CVector *vi;
+		arg[0].GetValue(v);
+		arg[1].GetValue(vi);
+
+		// the result vector
+		CVector *vnew = new CVector(vi->Count());
+		for (int i = 0; i < vi->Count(); i++)
+		{
+			int index = (*vi)[i];
+			if (index < 1 || index > v->Count())
+				return Error("index %d(%d) is out of range. Vector size is %d", i+1, index, v->Count());
+
+			(*vnew)[i] = (*v)[index-1];  // -1 to convert from 1-index (Macro) to 0-index (C)
+		}
+
+		return Value(vnew);
+
+	}
 }
 
 
@@ -1380,6 +1435,87 @@ Value VectorSort::Execute(int arity,Value *arg)
     return Value(v2);
 }
 
+//=============================================================================
+
+class VectorFindFunction : public Function {
+public:
+	VectorFindFunction(const char *n) : Function(n,2,tany,tvector)
+	{ info="Find where a number occurs in a vector";};
+	virtual Value Execute(int arity,Value *arg);
+	virtual int ValidArguments(int arity,Value *arg);
+};
+
+
+int VectorFindFunction::ValidArguments(int arity,Value *arg)
+{
+    if(arity != 2 && arity != 3)    return false;
+	if(arg[0].GetType() != tvector) return false;                  // first arg must be a vector
+	if(arg[1].GetType() != tnumber) return false;                  // second arg must be a number
+	if((arity == 3) && arg[2].GetType() != tstring) return false;  // third (optional) arg must be a string
+	return true;
+}
+
+
+Value VectorFindFunction::Execute(int arity,Value *arg)
+{
+    CVector *v;
+    double d;
+    bool findAll = false;
+
+    if (arity == 3)
+    {
+        const char *s;
+        arg[2].GetValue(s);
+        if (s && !strcmp(s, "all"))
+            findAll = true;
+        else
+            marslog(LOG_WARN, "find(vector, number, string) only accepts 'all' as its last argument. Supplied: '%s'", s);
+    }
+
+    arg[0].GetValue(v);
+    arg[1].GetValue(d);
+
+
+    std::vector<int> results;  // only need a vector if we're looking for more than 1 result
+
+    for(int i=0;i<v->Count();i++)
+    {
+        if((*v)[i] == d)                   // does it match?
+        {
+            if (findAll)
+            {
+                results.push_back(i+1);    // we want 'all', so add to our list
+            }
+            else
+            {
+                return Value(i+1);         // we want just the first, to return it
+            }
+        }
+    }
+
+
+    if (findAll)
+    {
+        if (results.size() > 0)
+        {
+            CVector *outvec = new CVector(results.size());
+
+            for(unsigned int i=0; i < results.size(); i++)
+            {
+                (*outvec)[i] = results[i];
+            }
+            return Value(outvec);
+        }
+        else
+        {
+            return Value();  // looked for all the values, but did not find any - return nil
+        }
+    }
+    else  // looked for the first value, but did not find it - return nil
+    {
+        return Value();
+    }
+}
 
 
 //===========================================================================
@@ -1511,6 +1647,7 @@ static void install(Context *c)
 	c->AddFunction(new VectorBitmap("bitmap"));
 	c->AddFunction(new VectorNoBitmap("nobitmap"));
 	c->AddFunction(new VectorFilter("filter"));
+	c->AddFunction(new VectorFindFunction("find"));
 	c->AddFunction(new VectorSort("sort",         VSORT_VALUES));
 	c->AddFunction(new VectorSort("sort_indices", VSORT_INDICES));
 
diff --git a/src/Macro/request.cc b/src/Macro/request.cc
index 34529ba..fa8e428 100644
--- a/src/Macro/request.cc
+++ b/src/Macro/request.cc
@@ -13,6 +13,8 @@
 #include "macro.h"
 #include "script.h"
 #include "value.h"
+
+#include "MvPath.hpp"
 #include "MvRequest.h"
 #include "MvApplication.h"
 
@@ -22,6 +24,9 @@ static Cache LangCache;
 static Cache TestCache;
 static Cache ObjsCache;
 
+static const char* M_UPLOT = "uPlotManager";
+
+
 static const char *find_service(const char *verb,const char *mode)
 {
 	char *state = strcache("state");
@@ -608,8 +613,10 @@ Value SimpleRequestFunction::Execute(int arity ,Value *arg)
 		set_subrequest(r,"_DEVICE_DRIVER",s);  //-- directrly for new PlotMod
 	   }
 #endif
-	   set_value(r,"_MACRO","%s",Script::MacroPath());
-	   set_value(r,"_PATH","%s",Script::MacroMainPath());
+
+      set_value(r,"_MACRO","%s",Script::MacroPath());
+      string fullPath = MakeAbsolutePath((const char*)get_value(r,"PATH",0),dirname(Script::MacroMainPath()));
+      set_value(r,"_PATH",fullPath.c_str());
 	}
 
 	v = service ? Value(service,r,attachedContent) : Value(r);
@@ -1004,7 +1011,8 @@ Value ComplexRequestFunction::Execute(int arity ,Value *arg)
     }
 
     set_value(p,"_MACRO","%s",Script::MacroPath());
-    set_value(p,"_PATH","%s",Script::MacroMainPath());
+    string fullPath = MakeAbsolutePath((const char*)get_value(p,"PATH",0),dirname(Script::MacroMainPath()));
+    set_value(p,"_PATH",fullPath.c_str());
 
     Value v(Service(),p);
     free_all_requests(p);
@@ -1101,9 +1109,11 @@ Value PlotFunction::ExecuteComplexRequestFunction(int arity ,Value *arg)
 		}
 	}
 
-	set_value(p,"_MACRO","%s",Script::MacroPath());
-	set_value(p,"_PATH","%s",Script::MacroMainPath());
-	set_value(p,"_NAME",Context::UniqueName());
+   // Add hidden parameters
+   set_value(p,"_MACRO","%s",Script::MacroPath());
+   set_value(p,"_NAME",Context::UniqueName());
+   string fullPath = MakeAbsolutePath((const char*)get_value(p,"PATH",0),dirname(Script::MacroMainPath()));
+   set_value(p,"_PATH",fullPath.c_str());
 
 	// Define output requests according to the following rules/priorities:
 	// 1. Drivers defined in the "plot" command have top priority (overwrite "setoutput")
diff --git a/src/Macro/value.cc b/src/Macro/value.cc
index f81fc65..110122d 100644
--- a/src/Macro/value.cc
+++ b/src/Macro/value.cc
@@ -49,7 +49,7 @@ class SimpleNotify : public Notify {
 	virtual void trigger(void*);
 public:
 	SimpleNotify(const char*,const char*);
-	~SimpleNotify();
+   virtual ~SimpleNotify();
 };
 
 SimpleNotify::SimpleNotify(const char *m,const char *n)
@@ -525,7 +525,7 @@ Value::~Value()
 
 const char *Value::TypeName(vtype t)
 {
-	for(int i = 0;i<NUMBER(types);i++)
+	for(unsigned int i = 0;i<NUMBER(types);i++)
 		if(types[i].t == t)
 			return types[i].n;
 	return "unknown";
@@ -534,7 +534,7 @@ const char *Value::TypeName(vtype t)
 vtype Value::NameType(const char *n)
 {
 	if(n == 0) return tany;
-	for(int i = 0;i<NUMBER(types);i++)
+	for(unsigned int i = 0;i<NUMBER(types);i++)
 		if(strcmp(types[i].n,n) == 0)
 			return types[i].t;
 	return tnone;
diff --git a/src/MacroEditor/FindTextDialog.cc b/src/MacroEditor/FindTextDialog.cc
index ee3af33..3d50e28 100644
--- a/src/MacroEditor/FindTextDialog.cc
+++ b/src/MacroEditor/FindTextDialog.cc
@@ -140,6 +140,15 @@ void FindTextDialog::onReplaceAllButtonClicked()
     emit replaceAll(findComboBox->currentText(), replaceComboBox->currentText(), findFlags());
 }
 
+// ---------------------------------------------------------------------------
+// FindTextDialog::onSelectionChanged
+// triggered when the selection in the main editor is changed
+// ---------------------------------------------------------------------------
+
+void FindTextDialog::onSelectionChanged(bool isSelection)
+{
+    replaceButton->setEnabled(isSelection);  // only enable this button if there is a selection
+}
 
 
 // ---------------------------------------------------------------------------
diff --git a/src/MacroEditor/FindTextDialog.h b/src/MacroEditor/FindTextDialog.h
index 26d787e..676565e 100644
--- a/src/MacroEditor/FindTextDialog.h
+++ b/src/MacroEditor/FindTextDialog.h
@@ -44,6 +44,7 @@ public slots:
     void onReplaceButtonClicked();
     void onReplaceSelectedButtonClicked();
     void onReplaceAllButtonClicked();
+    void onSelectionChanged(bool);
 
 
 private:
diff --git a/src/MacroEditor/FindTextDialog.ui b/src/MacroEditor/FindTextDialog.ui
index 776d04d..3c4e0cc 100644
--- a/src/MacroEditor/FindTextDialog.ui
+++ b/src/MacroEditor/FindTextDialog.ui
@@ -140,7 +140,7 @@
        <item>
         <widget class="QPushButton" name="replaceButton">
          <property name="text">
-          <string>&Replace Next</string>
+          <string>&Replace Selection</string>
          </property>
         </widget>
        </item>
diff --git a/src/MacroEditor/MacroEdit.cc b/src/MacroEditor/MacroEdit.cc
index e05966e..d1189e8 100644
--- a/src/MacroEditor/MacroEdit.cc
+++ b/src/MacroEditor/MacroEdit.cc
@@ -1028,6 +1028,10 @@ void MacroEdit::showFindDialog(bool showReplaceOptions)
                 this, SLOT(replaceStringInFile(const QString &,const QString &,QTextDocument::FindFlags)));
 
         connect(findDialog_, SIGNAL(rejected()), this, SLOT(findClosed()));
+
+        connect(textEditor, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
+
+        connect(this, SIGNAL(selectionChanged(bool)), findDialog_, SLOT(onSelectionChanged(bool)));
     }
 
 
@@ -1171,7 +1175,15 @@ void MacroEdit::findString(const QString &s,QTextDocument::FindFlags flags, bool
 
 void MacroEdit::replaceString(const QString &s,const QString &r,QTextDocument::FindFlags flags)
 {
-    findString(s, flags, true, r);
+    // perform the 'replace'
+    textEditor->insertPlainText (r);
+
+    // highlight the replaced text - the current text cursor will be
+    // at the end of the replaced text, so we move it back to the start
+    // (anchored so that the text is selected)
+    QTextCursor cursor = textEditor->textCursor();   // get the document's cursor
+    cursor.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor, r.length());
+    textEditor->setTextCursor(cursor);               // send the cursor back to the document
 }
 
 
@@ -1584,6 +1596,23 @@ void MacroEdit::onRunOptionsChanged (MacroRunOptions options)
 
 
 
+// ---------------------------------------------------------------------------
+// MacroEdit::onSelectionChanged
+// triggered when the user changes the text selection
+// ---------------------------------------------------------------------------
+
+void MacroEdit::onSelectionChanged()
+{
+    // if the find/replace dialogue is open, it needs to know about the change
+
+    if (findDialog_)
+    {
+        bool isSelection = textEditor->textCursor().hasSelection();
+        emit selectionChanged(isSelection);
+    }
+}
+
+
 
 // ---------------------------------------------------------------------------
 // MacroEdit::onReadOnlyStatusChanged
diff --git a/src/MacroEditor/MacroEdit.h b/src/MacroEditor/MacroEdit.h
index cd2b8cd..ae400b5 100644
--- a/src/MacroEditor/MacroEdit.h
+++ b/src/MacroEditor/MacroEdit.h
@@ -242,6 +242,7 @@ public slots:
     void gotoLine();
     void gotoLine(int line);
     void onIndentLines();
+    void onSelectionChanged();
     void onCommentLines();
     void tabsDialog();
     void runDialog();
@@ -286,6 +287,10 @@ public slots:
     void setAutoInsertLicenceOn()  {setAutoInsertLicence(true);};
     void setAutoInsertLicenceOff() {setAutoInsertLicence(false);};
 
+signals:
+    void selectionChanged(bool);
+
+
 private:
     void setupEditor();
     bool AskToSave();
diff --git a/src/MacroEditor/ShellHelper.cc b/src/MacroEditor/ShellHelper.cc
index a493198..e531dbe 100644
--- a/src/MacroEditor/ShellHelper.cc
+++ b/src/MacroEditor/ShellHelper.cc
@@ -115,7 +115,7 @@ bool ShellHelper::isHeaderLine(const QString &text)
 {
     return (text.contains("#") && 
             text.contains("bin") &&
-            (text.contains("sh") || text.contains("ksh") || text.contains("csh")));
+            (text.contains("sh") || text.contains("ksh") || text.contains("csh") || text.contains("bash")));
 }
 
 
diff --git a/src/Meteogram/CMakeLists.txt b/src/Meteogram/CMakeLists.txt
index 833f317..e5b7577 100644
--- a/src/Meteogram/CMakeLists.txt
+++ b/src/Meteogram/CMakeLists.txt
@@ -13,13 +13,3 @@ metview_module_files(ETC_FILES ObjectSpec.Meteogram
                      XPM_FILES MetPlus.xpm)
 
 
-
-set(local_metgram_script ${CMAKE_BINARY_DIR}/bin/metgram_client)
-
-configure_file(${MAGICS_METEOGRAM_SCRIPT} ${local_metgram_script} COPYONLY)
-
-install(FILES ${local_metgram_script}
-        DESTINATION ${MV_BIN_DIR}
-        PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
-
-
diff --git a/src/Meteogram/MetPlus.cc b/src/Meteogram/MetPlus.cc
index c1e5f0d..323c048 100644
--- a/src/Meteogram/MetPlus.cc
+++ b/src/Meteogram/MetPlus.cc
@@ -48,8 +48,8 @@ MetPlus::MetPlus() :  MvService("MetPlus")
 		if ( setup.getVerb() == Cached("MetPlus")  ) {
 			databases_["10_days_epsgram"]              = "10_days";
   			databases_["15_days_epsgram"]              = "15_days";
- 			databases_["10_days_metgram"]              = "10_days_metgram";
  			databases_["10_days_wave_epsgram"]         = "10_days_wave";
+ 			databases_["10_days_plumes"]               = "10_days_plumes";
  			databases_["15_days_epsgram_with_climate"] = "15_days_with_clim";
 
             break;
@@ -80,7 +80,7 @@ void substitute(string& xml, const string& var, const string& val)
 static string toString(double val)
 {
     ostringstream tool;
-    tool.width(7);
+    //tool.width(7);
     tool.precision(5);
     tool <<  val;
     cout << "toString:" << val << "--->" <<  tool.str() << endl;
@@ -276,7 +276,7 @@ void MetPlus::serve( MvRequest& in, MvRequest& out )
 
         string latitude_option  = toString(station("LATITUDE"));
         string longitude_option = toString(station("LONGITUDE"));
-        mgrequest += "latitude='"  + latitude_option + "' ";
+        mgrequest += "latitude='"  + latitude_option  + "' ";
         mgrequest += "longitude='" + longitude_option + "' ";
 
 
@@ -301,7 +301,7 @@ void MetPlus::serve( MvRequest& in, MvRequest& out )
         else if (format == "gif")   format_option = "giffile";
         else if (format == "jpeg")  format_option = "jpgfile";
         else if (format == "pdf")   format_option = "pdffile";
-        else                        format_option = "psfile";
+        else                        format_option = "pdffile";
         // SVG????????????
 
 
@@ -338,9 +338,9 @@ void MetPlus::serve( MvRequest& in, MvRequest& out )
     // we only support multiple stations with PostScript output
     // (for backwards compatibility with the previous metgram module)
 
-    if (tempFileNames.size() > 1 && format != "ps")
+    if (tempFileNames.size() > 1 && (format != "ps") && (format != "pdf"))
     {
-        setError(1, "Multiple stations only supported with PostScript output; use 'ps' output or use multiple calls. Aborting.");
+        setError(1, "Multiple stations only supported with PDF or PostScript output; use 'pdf' output or use multiple calls. Aborting.");
         return;
     }
 
@@ -369,9 +369,14 @@ void MetPlus::serve( MvRequest& in, MvRequest& out )
 
 
     // run the metgram command
+    // which command to run to get the metgram - the 'classic' metgram requires a different script
+
+    string command;
+
+    command = "python ";
+    command += getenv("METVIEW_BIN");
+    command += "/metgram.py -i " + mgrequestfile;
 
-    string command = getenv("METVIEW_BIN");
-    command += "/metgram_client " + mgrequestfile;
 
     cout << "Running command: " << command << endl;
     int return_code = system (command.c_str());
@@ -399,11 +404,12 @@ void MetPlus::serve( MvRequest& in, MvRequest& out )
         {
             // copy the temporary files to their proper destinations
 
-            if (format == "ps")
+            if (tempFileNames.size() > 1)
             {
-                if (tempFileNames.size() > 1)
+                // multiple metgrams - join them into one; format-dependent code here
+
+                if (format == "ps")
                 {
-                    // multiple metgrams - join them into one
 
                     string psJoinCommand = "psjoin -p ";
 
@@ -415,10 +421,22 @@ void MetPlus::serve( MvRequest& in, MvRequest& out )
                     psJoinCommand += " > " + outputFileName;
 
                     cout << "running: " << psJoinCommand;
-
                     system (psJoinCommand.c_str());
                 }
 
+                else if (format == "pdf")
+                {
+                    string pdfJoinCommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=";
+                    pdfJoinCommand += outputFileName + " ";
+                    
+                    for (size_t i = 0; i < tempFileNames.size(); i++)
+                    {
+                        pdfJoinCommand += tempFileNames[i] + " ";
+                    }
+
+                    cout << "running: " << pdfJoinCommand;
+                    system (pdfJoinCommand.c_str());
+                }
                 else
                 {
                     // otherwise, just one file so copy it to the dest filename
diff --git a/src/Meteogram/MetPlusDef b/src/Meteogram/MetPlusDef
index d00db08..2f3f21b 100644
--- a/src/Meteogram/MetPlusDef
+++ b/src/Meteogram/MetPlusDef
@@ -3,16 +3,16 @@ MetPlus; New Metgram module; MetPlus
     type {
         10_days_epsgram
         15_days_epsgram
-        10_days_metgram
-        10_days_wave_epsgram
         15_days_epsgram_with_climate
+        10_days_wave_epsgram
+        10_days_plumes
     } = 15_days_epsgram
     
     
     station 
 		[ interface = icon, class = STATION, exclusive = false,
 		  help            = help_data,missing = fatal,
-		  help_directory  = '/Metview/Defaults',
+		  help_directory  = '/System/Defaults',
 		  help_name       = Station for Meteogram,
 		  help_class      = STATIONS,
 		  help_definition = ( STATIONS, NAME = Heathrow ) ]
@@ -45,12 +45,12 @@ MetPlus; New Metgram module; MetPlus
 
 
     format {
-        PostScript ; ps
         PDF        ; pdf
-        GIF        ; gif
         PNG        ; png
+        PostScript ; ps
+#        GIF        ; gif
 #        SVG        ; svg
-    } = PostScript
+    } = PDF
 
 
 	database { @ } = latest	
diff --git a/src/Meteogram/ObjectSpec.Meteogram b/src/Meteogram/ObjectSpec.Meteogram
index f099a42..2d6b88d 100644
--- a/src/Meteogram/ObjectSpec.Meteogram
+++ b/src/Meteogram/ObjectSpec.Meteogram
@@ -14,7 +14,7 @@ object,
 
 state,
 	class           = MetPlus,
-	output_class    = PSFILE,
+	output_class    = PDF,
 	service         = MetPlus
 
 MetPlus,
diff --git a/src/MvApp/geo_to_grib.cc b/src/MvApp/geo_to_grib.cc
index 84ededa..7f68440 100644
--- a/src/MvApp/geo_to_grib.cc
+++ b/src/MvApp/geo_to_grib.cc
@@ -29,6 +29,9 @@ const int   cLatBandCount = (int)( 180.0 / cLatBandSize ) + 1;
 const int   G2G_RECIPROCAL       = 0;
 const int   G2G_EXPONENTIAL_MEAN = 1;
 const int   G2G_EXPONENTIAL_SUM  = 2;
+const int   G2G_NEAREST_MEAN     = 3;
+const int   G2G_NEAREST_SUM      = 4;
+const int   G2G_NEAREST_COUNT    = 5;
 
 double makeDateNumber( long date, long time );
 
@@ -65,6 +68,9 @@ public:
     bool estimate();
     bool estimateToUserGrid();
     bool estimateToTemplateGrid();
+    bool estimateNearestToTemplateGrid();
+    void setupUserMatrix(bool zero);
+    bool convertUserToTemplateGrid();
     double value(float lat, float lon);
     void sortPoints();
     string &errorMessage() {return errorMessage_;};
@@ -170,8 +176,14 @@ ToMatrix::ToMatrix(MvRequest& def)
         Weight_ = G2G_RECIPROCAL;
     else if ( st == "EXPONENTIAL_MEAN" )
         Weight_ = G2G_EXPONENTIAL_MEAN;
-    else
+    else if ( st == "EXPONENTIAL_SUM" )
         Weight_ = G2G_EXPONENTIAL_SUM;
+    else if ( st == "NEAREST_GRIDPOINT_MEAN" )
+        Weight_ = G2G_NEAREST_MEAN;
+    else if ( st == "NEAREST_GRIDPOINT_SUM" )
+        Weight_ = G2G_NEAREST_SUM;
+    else
+        Weight_ = G2G_NEAREST_COUNT;
 
 
     MvRequest data;
@@ -294,17 +306,30 @@ void ToMatrix::sortPoints()
 
 bool ToMatrix::estimate()
 {
-    if (gribDefMode == User)
-        return estimateToUserGrid();
+    if (Weight_ == G2G_NEAREST_MEAN || Weight_ == G2G_NEAREST_SUM || Weight_ == G2G_NEAREST_COUNT)
+    {
+        //  if User, convert to Template, because we need that on order to use these modes
+
+        if (gribDefMode == User)
+            if (!convertUserToTemplateGrid())
+                return false;
+
+        return estimateNearestToTemplateGrid();
+    }
     else
-        return estimateToTemplateGrid();
+    {
+        if (gribDefMode == User)
+            return estimateToUserGrid();
+        else
+            return estimateToTemplateGrid();
+    }
 }
+
+
 //_____________________________________________________________________
 
-bool ToMatrix::estimateToUserGrid()
+void ToMatrix::setupUserMatrix(bool zero)
 {
-  int   i, j;
-  float lat,lon;
   double epsilon=0.001;
   
   double oriEast=East;
@@ -340,6 +365,19 @@ bool ToMatrix::estimateToUserGrid()
 #endif
 
   Matrix = new double[NbLon*NbLat];
+  
+  if (zero)
+    memset(Matrix, 0, NbLon*NbLat*sizeof(double));  // set all values to zero
+}
+
+//_____________________________________________________________________
+
+bool ToMatrix::estimateToUserGrid()
+{
+  int   i, j;
+  float lat,lon;
+
+  setupUserMatrix(false);
 
   lat = North;
   for (j = 0; j < NbLat; j++) 
@@ -392,6 +430,106 @@ bool ToMatrix::estimateToTemplateGrid()
 
     return true;
 }
+
+//_____________________________________________________________________
+
+bool ToMatrix::estimateNearestToTemplateGrid()
+{
+    unsigned int *numClosest;
+    templateField->setShape(expand_mem);
+    MvGridBase *grid = templateField->mvGrid();  // be careful with this pointer because MvField is in charge!
+
+    if (!grid->hasLocationInfo())       //-- check that it is ok
+    {
+        errorMessage_ = "Template GRIB field grid locations cannot be read by Metview.";
+        return false;
+    }
+
+    numValsInTemplateGrib = templateField->countValues();
+
+
+    Matrix = new double[numValsInTemplateGrib];               // create the matrix to hold the result
+    memset(Matrix, 0, numValsInTemplateGrib*sizeof(double));  // set all values to zero
+
+
+    if (Weight_ == G2G_NEAREST_MEAN)
+    {
+        // create matrix (zeroed) to store how many gpts are assinged to each grid point
+        numClosest = new unsigned int[numValsInTemplateGrib];  
+        memset(numClosest, 0, numValsInTemplateGrib*sizeof(unsigned int));
+    }
+
+
+    // for each geopoint, find the nearest gridpoint and add the geopoint's value to that gridpoint
+    long ngeo = GPoints.count();
+    for (long i = 0; i < ngeo; i++)
+    {
+        MvGeoP1 gp = GPoints[i];
+        MvGridPoint gridpt = grid->nearestGridpoint(gp.lat_y(), gp.lon_x());
+        if (Weight_ == G2G_NEAREST_COUNT)
+            Matrix[gridpt.index_]++;              // G2G_NEAREST_COUNT
+        else
+            Matrix[gridpt.index_] += gp.value();  // G2G_NEAREST_MEAN or G2G_NEAREST_SUM
+
+
+        if (Weight_ == G2G_NEAREST_MEAN)
+            numClosest[gridpt.index_]++;
+    }
+
+
+    // mean? then divide by the number of points
+    if (Weight_ == G2G_NEAREST_MEAN)
+    {
+        for (long j=0; j<numValsInTemplateGrib; j++)
+            if (numClosest[j] != 0)
+                Matrix[j] /= numClosest[j];
+
+        delete[] numClosest;
+    }
+
+
+    return true;
+}
+
+//_____________________________________________________________________
+
+bool ToMatrix::convertUserToTemplateGrid()
+{
+    // the user has supplied grid parameters, but we want to convert this into
+    // an actual GRIB file so that we can use it as a template
+
+    setupUserMatrix(true);
+
+    string llmatrixpath;
+    if (save(llmatrixpath))
+    {
+        marslog( LOG_INFO, "geo_to_grib: can not write matrix into file %s", llmatrixpath.c_str());
+        return false;
+    }
+
+    string tmpGribFile = marstmp();
+
+    if( LLMatrixToGRIB( llmatrixpath.c_str(), tmpGribFile.c_str() ) )
+    {
+        marslog( LOG_INFO, "geo_to_grib: conversion from geo/LLMatrix to GRIB failed");
+        return false;
+    }
+
+    unlink(llmatrixpath.c_str());  // remove the temporary LLMATRIX file
+
+
+
+
+    MvFieldSet fieldset(tmpGribFile.c_str()) ;  // load it up
+    templateField = new MvField(fieldset[0].libmars_field());
+
+    gribDefMode = Grib;
+
+    return true;
+}
+
+
+
 //_____________________________________________________________________
 
 int ToMatrix::save(string &path)  // returns path to caller
@@ -490,7 +628,7 @@ void GeoToGRIB::serve( MvRequest& in, MvRequest& out )
 
       if( LLMatrixToGRIB( path.c_str(), tmpGribFile.c_str() ) )
       {
-          setError( 1, "geo_to_grib: convertion from geo/LLMatrix to GRIB failed" );
+          setError( 1, "geo_to_grib: conversion from geo/LLMatrix to GRIB failed" );
           return;
       }
 
diff --git a/src/ObsFilter/BufrPicker.cc b/src/ObsFilter/BufrPicker.cc
index d7a3507..7b83b45 100644
--- a/src/ObsFilter/BufrPicker.cc
+++ b/src/ObsFilter/BufrPicker.cc
@@ -414,7 +414,7 @@ BufrPicker::serve( MvRequest& in, MvRequest& out )
    counter_ = 0;                         //-- m a i n   l o o p
    try
    {
-     while( myObs = (*iter_)( obsOrMsg_ ) )
+     while( (myObs = (*iter_)(obsOrMsg_) ) )
      {
         pickValue( myObs );
      }
diff --git a/src/ObsFilter/ObsFilter.cc b/src/ObsFilter/ObsFilter.cc
index c208d12..28f3d5d 100644
--- a/src/ObsFilter/ObsFilter.cc
+++ b/src/ObsFilter/ObsFilter.cc
@@ -744,7 +744,7 @@ ObsFilter :: serve( MvRequest& in, MvRequest& out )
    _counter = 0;                         //-- m a i n   l o o p
    try
    {
-     while( obs_ = (*_iter)( _obsOrMsg ) )
+     while( (obs_ = (*_iter)(_obsOrMsg) ) )
      {
        add();
      }
diff --git a/src/OdbExaminer/OdbExaminer.cc b/src/OdbExaminer/OdbExaminer.cc
index e78abd9..1919868 100755
--- a/src/OdbExaminer/OdbExaminer.cc
+++ b/src/OdbExaminer/OdbExaminer.cc
@@ -31,6 +31,7 @@
 
 #ifdef METVIEW_ODB_NEW
 #include "MvOdb.h"
+#include "odb_api/odbcapi.h"
 #endif
 
 #include "MvQAbout.h"
@@ -519,7 +520,13 @@ void OdbExaminer::slotTabIndexChanged(int index)
 
 void OdbExaminer::slotShowAboutBox()
 {
-	MvQAbout about("ODB Examiner","",MvQAbout::MetviewVersion );
+	const char *odbapi_version = odb_api_version();
+	QString odbapiVersion(odbapi_version);
+
+	QMap<MvQAbout::Version,QString> text;
+	text[MvQAbout::OdbApiVersion]=odbapiVersion;	
+
+	MvQAbout about("ODB Examiner","",MvQAbout::MetviewVersion | MvQAbout::OdbApiVersion,text);
 	about.exec();
 }
 
diff --git a/src/OgcClient/MvQOgcParam.h b/src/OgcClient/MvQOgcParam.h
index 9fca707..d9750d2 100644
--- a/src/OgcClient/MvQOgcParam.h
+++ b/src/OgcClient/MvQOgcParam.h
@@ -30,6 +30,8 @@ public:
 	MvQOgcName(QString requestName, QString displayName) : 
 		requestName_(requestName), displayName_(displayName) {};
 
+    virtual ~MvQOgcName() {}
+
 	QString  requestName() {return requestName_;}
 	void setRequestName(QString s) {requestName_=s;}
 
diff --git a/src/OgcClient/MvQOgcRequest.h b/src/OgcClient/MvQOgcRequest.h
index 01c4011..6671a52 100644
--- a/src/OgcClient/MvQOgcRequest.h
+++ b/src/OgcClient/MvQOgcRequest.h
@@ -18,6 +18,8 @@ class MvQOgcRequest
 {
 public:
 	MvQOgcRequest() {};
+    virtual ~MvQOgcRequest() {}
+
 	const QString& request() const {return request_;} 
 	void setRequest(QString);
 	virtual QString item(QString) const;
diff --git a/src/OgcClient/MvQWmsClient.cc b/src/OgcClient/MvQWmsClient.cc
index 32269cb..130b02a 100644
--- a/src/OgcClient/MvQWmsClient.cc
+++ b/src/OgcClient/MvQWmsClient.cc
@@ -1511,7 +1511,7 @@ void MvQWmsUiClient::slotReplyPreview(QNetworkReply* reply)
 			QString eMsg(ba);
 		
 			log->error(eMsg.toStdString() + "\n");
-			emit legendLoaded(QString());
+            emit previewLoaded(QString());
 			emit statusMessage(tr("Load preview <font color=red>(FAILED)</font>"));
 		}
 		else
@@ -1545,7 +1545,11 @@ void MvQWmsUiClient::slotReplyPreview(QNetworkReply* reply)
 
 void MvQWmsUiClient::slotReplyLegend(QNetworkReply* reply)
 {
-	QNetworkRequest r=reply->request();
+    Q_ASSERT(reply == legendReply_);
+
+    qDebug() << "MvQWmsUiClient::slotReplyLegend -->";
+
+    QNetworkRequest r=reply->request();
 	QUrl url=r.url();
 
 	//qDebug() << url.toString();
@@ -1702,7 +1706,9 @@ bool MvQWmsUiClient::legendDownloadActive()
 
 void MvQWmsUiClient::slotAbortDownloadProcess()
 {
-	if(getCapReply_ && getCapReply_->isRunning())
+    qDebug() << "MvQWmsUiClient::slotAbortDownloadProcess -->";
+
+    if(getCapReply_ && getCapReply_->isRunning())
 	{
 		LogItem *log=new LogItem;
 		LogHandler::instance()->add(log);
diff --git a/src/Percentile/Percentile.cc b/src/Percentile/Percentile.cc
index 478ef86..557625d 100644
--- a/src/Percentile/Percentile.cc
+++ b/src/Percentile/Percentile.cc
@@ -137,7 +137,7 @@ bool Percentile::ComputePercentile(MvRequest& out)
 	bool first = true;
 	vfield.reserve(nfsin);
 	vfieldExp.reserve(nfsin);
-	while( field = iter() )
+	while( (field = iter()) )
 	{
 	    vfield.push_back(field);
 	    MvFieldExpander* vex = new MvFieldExpander(field);
diff --git a/src/Scm/ObjectSpec.Scm b/src/Scm/ObjectSpec.Scm
index 9d9ca6b..d856e23 100644
--- a/src/Scm/ObjectSpec.Scm
+++ b/src/Scm/ObjectSpec.Scm
@@ -29,7 +29,8 @@ object,
 	type		= File,
 	default_name    = 'Scm Output Data',
 	pixmap 		= '$METVIEW_DIR_SHARE/icons/SCM_OUTPUT_DATA.icon',
-	editor_type     = QtScmDataEditor 
+	default_method	= Examine,
+	editor_type     = NoEditor 
 
 
 
diff --git a/src/Stations/CMakeLists.txt b/src/Stations/CMakeLists.txt
index e88d0e7..1934da7 100644
--- a/src/Stations/CMakeLists.txt
+++ b/src/Stations/CMakeLists.txt
@@ -17,11 +17,10 @@ if(ENABLE_UI)
     endif()
 endif()
 
-
 ecbuild_add_executable( TARGET       writebase
                         SOURCES      writebase.c
                         DEFINITIONS  ${METVIEW_EXTRA_DEFINITIONS}
-                        INCLUDES     
+                        INCLUDES     ${GDBM_INCLUDE}
                         LIBS         ${GDBM_LIB}
                       )
 
diff --git a/src/Stations/stat.fmt b/src/Stations/stat.fmt
index 0dd7f8a..2fe6bba 100644
--- a/src/Stations/stat.fmt
+++ b/src/Stations/stat.fmt
@@ -1,20 +1,21 @@
 01001 7093 -867 9 10 0 ---- JAN MAYEN
-01001 7094 -867 0 9 0 T-T- JAN MAYEN
-01002 8006 1625 8 8 0 ---- VERLEGENHUKEN
-01003 7700 1550 11 10 0 ---- HORNSUND
+01001 7094 -867 0 9 0 TTTT JAN MAYEN
+01002 8006 1625 7 8 0 ---- VERLEGENHUKEN
+01003 7700 1550 10 10 0 ---- HORNSUND
 01004 7892 1193 8 8 0 --T- NY-ALESUND II
 01004 7892 1192 0 16 0 --T- NY-ALESUND II
-01006 7825 2282 14 14 0 ---- EDGEOYA
+01006 7825 2282 13 14 0 ---- EDGEOYA
 01007 7892 1193 8 8 0 ---- NY-ALESUND
 01008 7825 1547 27 28 0 ---- SVALBARD AP
 01009 8065 2501 0 5 0 ---- KARL XII OYA
 01010 6931 1613 13 10 0 ---- ANDOYA
 01010 6931 1613 0 10 0 T-T- ANDOYA
 01011 8006 3150 0 10 0 ---- KVITOYA
+01013 7806 1362 9 7 0 ---- ISFJORD RADIO
 01014 6923 1789 0 9 0 ---- SENJA-LAUKHELLA
 01015 6959 1784 0 14 0 ---- HEKKINGEN LH
 01016 7893 2889 0 20 0 ---- KONGSOYA
-01017 7769 1478 6 6 0 ---- AKSELOYA
+01017 7769 1478 7 6 0 ---- AKSELOYA
 01018 6923 1600 0 436 0 ---- ANDOYA-TROLLTINDEN
 01019 7752 2082 0 20 0 ---- SVARTTANGEN
 01020 7648 1655 0 10 0 ---- SORKAPPOYA
@@ -24,13 +25,14 @@
 01026 6965 1894 115 100 0 ---- TROMSO
 01027 6965 1891 20 10 0 ---- TROMSO-HOLT
 01028 7452 1900 0 18 0 ---- BJORNOYA
-01028 7450 1900 0 20 0 T-T- BJORNOYA
+01028 7450 1900 0 20 0 TTTT BJORNOYA
 01030 6929 1813 0 982 0 ---- KISTEFJELL
 01033 7025 1950 24 21 0 ---- TORSVAG LH
 01034 7031 2014 38 37 0 ---- FUGLOYKALVEN FYR
 01035 6956 2009 0 710 0 ---- LYNGEN GJERDVASSBU
 01036 6956 2043 0 700 0 ---- NORDNESFJELLET
 01037 6939 2028 20 20 0 ---- SKIBOTN 2
+01039 7823 1539 469 0 0 ---- SPITSBERGEN
 01041 6973 2102 0 5 0 ---- NORDREISA-OYENG
 01042 7061 2244 0 438 0 ---- HASVIK-SLUSKFJELLET
 01043 7041 2282 0 10 0 ---- ROGNSUNDET
@@ -49,21 +51,21 @@
 01064 6930 2535 0 591 0 ---- ISKORAS II
 01065 6945 2550 131 131 0 ---- KARASJOK
 01066 7106 2623 0 33 0 ---- HELNES FYR
-01068 7101 2598 13 14 0 ---- HONNINGSVAG AP
-01074 7103 2783 13 12 0 ---- MEHAMN AP
+01068 7101 2598 14 14 0 ---- HONNINGSVAG AP
+01074 7103 2783 12 12 0 ---- MEHAMN AP
 01075 7040 2819 11 10 0 ---- RUSTEFJELBMA
 01076 7020 2816 0 32 0 ---- TANABRU
 01078 7108 2822 8 8 0 ---- SLETTNES LH
-01082 6915 2924 56 0 0 ---- NYRUD
+01082 6915 2924 55 0 0 ---- NYRUD
 01083 7087 2903 13 13 0 ---- BERLEVAG AP
 01084 6945 3004 27 0 0 ---- PASVIK
-01086 7059 2970 152 149 0 ---- BATSFJORD AP
+01086 7059 2970 149 149 0 ---- BATSFJORD AP
 01088 7006 2984 39 39 0 ---- VADSO AP
 01089 6973 2990 86 89 0 ---- KIRKENES
 01091 6819 1779 0 740 0 ---- LOSISTUA
 01092 7070 3007 0 9 0 ---- MAKKAUR LH
 01098 7037 3110 15 14 0 ---- VARDO
-01099 7034 3104 12 13 0 ---- VARDO AP
+01099 7034 3104 13 13 0 ---- VARDO AP
 01102 6520 1100 16 23 0 ---- SKLINNA LH
 01103 6509 1170 0 47 0 ---- LEKA
 01104 6837 1595 8 0 0 ---- ROTVAER
@@ -71,7 +73,7 @@
 01106 6752 1210 2 4 0 ---- ROEST III
 01107 6753 1210 2 4 0 ---- ROST AP
 01108 6570 1186 9 4 0 ---- VEGA-VALLSJO
-01112 6545 1222 9 8 0 ---- BRONNOYSUND AP
+01112 6545 1222 8 8 0 ---- BRONNOYSUND AP
 01113 6680 1398 39 39 0 ---- GLOMFJORD
 01114 6690 1365 8 9 0 ---- REIPA
 01115 6676 1249 17 17 0 ---- MYKEN
@@ -84,6 +86,7 @@
 01133 6562 1329 0 50 0 ---- LAKSFORS
 01134 6518 1342 339 339 0 ---- MAJAVATN III
 01135 6613 1359 124 126 0 ---- SELJELIA
+01136 6522 1199 0 302 0 ---- SOMNA-KVALOYFJELLET
 01139 6765 1272 4 4 0 ---- VAEROY HELIPORT
 01141 6816 1362 26 25 0 ---- LEKNES AP
 01143 6805 1607 0 19 0 ---- DRAG-AJLUOKTA
@@ -101,15 +104,15 @@
 01156 6861 1443 8 7 0 ---- BO I VESTERALEN
 01158 6717 1549 8 7 0 ---- SETSA
 01160 6815 1465 11 11 0 ---- SKROVA LH
-01161 6825 1467 9 8 0 ---- SVOLVAER AP
+01161 6825 1467 8 8 0 ---- SVOLVAER AP
 01162 6858 1503 3 3 0 ---- STOKMARKNES AP
 01167 6870 1542 3 3 0 ---- SORTLAND
-01169 6694 1532 37 37 0 ---- SALTDAL-NORDNES
+01169 6694 1532 39 37 0 ---- SALTDAL-NORDNES
 01172 6800 1562 0 53 0 ---- FINNOY I HAMAROY
 01180 6880 1654 46 45 0 ---- HARSTAD
 01183 6848 1668 26 26 0 ---- EVENES AP
 01192 6843 1766 0 200 0 ---- STRAUMSNES
-01193 6844 1739 31 29 0 ---- NARVIK AP
+01193 6844 1739 29 29 0 ---- NARVIK AP
 01194 6847 1750 23 17 0 ---- NARVIK III
 01196 6875 1782 0 21 0 ---- TENNEVOLL
 01198 6878 1970 204 204 0 ---- DIVIDALEN II
@@ -144,7 +147,7 @@
 01240 6417 941 16 16 0 ---- HALTEN LH
 01241 6370 960 9 10 0 ---- ORLAND III
 01241 6371 961 0 10 0 T-T- ORLAND III
-01242 6397 1022 0 20 0 ---- AFJORD II
+01242 6397 1022 0 30 0 ---- AFJORD II
 01245 6260 967 599 604 0 ---- OPPDAL-SETER
 01250 6213 999 694 0 0 ---- FOLLDAL-FREDHEIM
 01252 6282 1002 475 0 0 ---- BERKAK
@@ -178,7 +181,7 @@
 01306 6075 472 23 0 0 ---- HELLISOY FYR
 01307 6078 472 19 19 0 ---- FEDJE
 01308 6129 504 7 0 0 ---- FURUNESET
-01310 6158 503 9 11 0 ---- FLORO AP
+01310 6158 503 11 11 0 ---- FLORO AP
 01311 6029 523 50 48 0 ---- BERGEN/FLESLAND
 01314 6052 572 0 10 0 ---- FOSSMARK
 01315 6065 611 0 17 0 ---- EVANGER
@@ -188,7 +191,7 @@
 01320 6183 610 60 60 0 ---- SANDANE AP
 01321 6192 656 209 208 0 ---- STRYN
 01322 6146 593 0 64 0 ---- FORDE-TEFRE
-01323 6139 576 321 319 0 ---- FORDE AP
+01323 6139 576 319 319 0 ---- FORDE AP
 01325 6083 595 0 114 0 ---- MODALEN II
 01326 6086 597 0 125 0 ---- MODALEN III
 01327 6039 596 0 455 0 ---- KVAMSKOGEN-JONSHOGDI
@@ -206,7 +209,7 @@
 01344 6070 694 0 695 0 ---- MJOLFJELL
 01345 6072 721 0 960 0 ---- KLEVAVATNET
 01346 6066 728 0 1162 0 ---- MIDTSTOVA
-01347 6116 714 497 498 0 ---- SOGNDAL AP
+01347 6116 714 498 498 0 ---- SOGNDAL AP
 01350 6059 753 1210 1210 0 ---- FINSEVATN
 01352 6018 748 0 1250 0 ---- SANDHAUG
 01355 6110 750 4 2 0 ---- LAERDAL IV
@@ -216,7 +219,7 @@
 01359 6053 819 774 772 0 ---- GEILO-OLDEBRATEN
 01360 6190 790 0 664 0 ---- BRATA-SLETTOM
 01361 6202 766 872 872 0 ---- GROTLI III
-01362 6168 836 1894 0 0 ---- JUVVASSHOE
+01362 6168 836 1893 0 0 ---- JUVVASSHOE
 01363 6042 850 798 798 0 ---- DAGALI AP
 01364 6118 811 955 956 0 ---- FILEFJELL
 01365 6125 892 0 965 0 ---- BEITOSTOLEN II
@@ -245,12 +248,12 @@
 01392 6061 1201 185 185 0 ---- FLISA II
 01393 6189 1203 674 672 0 ---- DREVSJO
 01397 6129 1227 361 360 0 ---- TRYSIL VEGSTASJON
-01400 5650 320 49 50 0 ---- EKOFISK
-01400 5655 321 0 52 0 T-T- EKOFISK
+01400 5654 322 49 50 0 ---- EKOFISK
+01400 5654 322 0 52 0 T-T- EKOFISK
 01401 5998 225 48 48 0 ---- FRIGG
 01403 5931 487 56 55 0 ---- UTSIRA LH
 01406 5991 507 16 25 0 ---- SLATTEROY LH
-01408 5935 520 24 26 0 ---- HAUGESUND AP
+01408 5935 520 26 26 0 ---- HAUGESUND AP
 01409 5915 525 7 7 0 ---- SKUDENES
 01411 5907 541 22 21 0 ---- KVITSOY - NORDBO
 01412 5866 556 26 24 0 ---- OBRESTAD
@@ -297,7 +300,7 @@
 01463 5966 1078 89 0 0 ---- AS
 01464 5834 852 6 0 0 ---- LANDVIK
 01465 5840 878 15 12 0 ---- TORUNGEN LH
-01466 5997 1104 109 108 0 ---- KJELLER AP
+01466 5997 1104 108 108 0 ---- KJELLER AP
 01467 5863 915 5 4 0 ---- LYNGOR LH
 01468 6019 1201 0 148 0 ---- KONGSVINGER
 01469 6017 1025 142 140 0 ---- HONEFOSS-HOYBY
@@ -582,14 +585,14 @@
 02670 5668 1630 4 6 0 ---- KALMAR
 02679 5692 1814 36 34 0 ---- HOBURG A
 02680 5692 1814 39 40 0 ---- HOBURG
-02701 6905 2085 1009 1007 0 ---- KILPISJARVI SAANA
-02702 6913 2727 0 156 0 ---- INARI KAAMANEN
+02701 6904 2085 1009 1002 0 ---- KILPISJARVI SAANA
+02702 6914 2727 0 156 0 ---- INARI KAAMANEN
 02703 6021 2474 32 31 0 ---- ESPOO SEPANKYLA
-02704 6112 2433 0 87 0 ---- HATTULA LEPAA AWS
+02704 6111 2432 0 87 0 ---- HATTULA LEPAA AWS
 02705 6702 2722 488 491 0 ---- PELKOSENNIEMI PYHATUNTURI
-02706 6025 2405 0 37 0 ---- LOHJA PORLA
+02706 6024 2405 0 37 0 ---- LOHJA PORLA
 02708 6218 2280 0 161 0 ---- KARVIA ALKKIA
-02710 6295 2640 0 127 0 ---- VESANTO SONKARI
+02710 6292 2642 0 120 0 ---- VESANTO SONKARI
 02711 6310 2162 13 15 0 ---- VAASA KESKUSTA
 02713 6122 2513 136 134 0 ---- HAMEENLINNA LAMMI EVO
 02714 6450 2644 115 114 0 ---- VAALA PELSO
@@ -600,19 +603,19 @@
 02719 6781 2775 0 240 0 ---- SODANKYLA LOKKA
 02720 6770 2486 191 196 0 ---- KITTILA AIRPORT
 02721 6395 2284 6 5 0 ---- KOKKOLA TANKAR
-02722 6842 2742 0 320 0 ---- INARI SAARISELKA
+02722 6842 2741 0 302 0 ---- INARI SAARISELKA
 02723 6778 2485 200 522 0 ---- KITTILA LEVITUNTURI
 02724 6012 2030 13 11 0 ---- LUMPARLAND LANGNAS HARBOUR
-02725 6345 2445 0 153 0 ---- HALSUA KANALA PUROLA
+02725 6345 2444 0 153 0 ---- HALSUA KANALA PUROLA
 02726 6859 2358 371 374 0 ---- ENONTEKIO NAKKALA
-02727 6127 2552 76 80 0 ---- ASIKKALA PULKKILANHARJU
+02727 6127 2552 76 79 0 ---- ASIKKALA PULKKILANHARJU
 02728 6130 2818 88 86 0 ---- TAIPALSAARI KYLANIEMI
 02729 6188 2533 0 205 0 ---- JAMSA HIMOS
 02730 6183 2885 157 155 0 ---- SAVONLINNA RUUNAVUORI
 02731 6153 2820 127 125 0 ---- PUUMALA KK
-02732 6280 2790 87 86 0 ---- KUOPIO RITONIEMI
+02732 6280 2790 87 82 0 ---- KUOPIO RITONIEMI
 02733 6104 2856 46 46 0 ---- LAPPEENRANTA KONNUNSUO
-02734 6145 2947 75 74 0 ---- PARIKKALA KOITSANLAHTI
+02734 6144 2946 75 74 0 ---- PARIKKALA KOITSANLAHTI
 02735 6233 2354 140 138 0 ---- VIRRAT AIJANNEVA
 02736 6189 2789 112 110 0 ---- JUVA PARTALA
 02737 6382 2416 85 83 0 ---- TOHOLAMPI LAITALA
@@ -620,36 +623,38 @@
 02739 6411 2834 163 161 0 ---- SOTKAMO KUOLANIEMI
 02740 6588 2427 9 8 0 ---- TORNIO LIAKKA
 02741 6018 1998 13 11 0 ---- JOMALA JOMALABY
-02743 5987 2220 0 8 0 ---- KEMIONSAARI VANO
+02743 5987 2219 0 8 0 ---- KEMIONSAARI VANO
 02744 6150 2376 0 92 0 ---- TAMPERE SATAKUNNANKATU
 02745 6716 2918 215 213 0 ---- SALLA NARUSKA
 02746 5981 2292 28 11 0 ---- HANKO TULLINIEMI
 02747 6038 2210 6 4 0 ---- TURKU RAJAKARI
 02748 6217 2786 83 87 0 ---- JOROINEN VARKAUS AIRPORT
-02750 5985 2325 0 3 0 ---- HANKO TVARMINNE
-02751 6163 2138 5 3 0 ---- PORI TAHKOLUOTO
+02749 6631 2940 0 298 0 ---- KUUSAMO OULANKA
+02750 5984 2325 0 3 0 ---- HANKO TVARMINNE
+02751 6163 2138 5 3 0 ---- PORI TAHKOLUOTO HARBOUR
 02752 6220 2117 22 0 0 ---- KRISTIINANKAUPUNKI LIGHTHOUSE
 02753 6184 2246 123 122 0 ---- KANKAANPAA NIINISALO AIRFIELD
-02754 6100 2450 85 87 0 ---- HAMEENLINNA KATINEN
+02754 6100 2449 85 87 0 ---- HAMEENLINNA KATINEN
 02755 6405 2472 76 76 0 ---- YLIVIESKA AIRFIELD
-02756 6037 2312 0 3 0 ---- SALO KARKKA
+02756 6037 2311 0 2 0 ---- SALO KARKKA
 02757 5982 2358 23 15 0 ---- RAASEPORI JUSSARO
 02758 6042 2440 44 42 0 ---- VIHTI MAASOJA
 02759 6039 2561 24 22 0 ---- PORVOO HARABACKA
 02760 6617 2914 307 305 0 ---- KUUSAMO RUKA TALVIJARVI
-02761 6115 2130 29 4 0 ---- RAUMA KYLMAPIHLAJA
+02761 6114 2130 29 4 0 ---- RAUMA KYLMAPIHLAJA
 02762 6127 2225 39 37 0 ---- KOKEMAKI PEIPOHJA HYRKOLA
 02763 6147 2375 86 85 0 ---- TAMPERE HARMALA
 02764 6800 2421 0 270 0 ---- KITTILA LOMPOLONVUOMA
 02765 6170 2551 83 81 0 ---- LUHANKA JUDINSALO
-02766 6315 3105 237 235 0 ---- ILOMANTSI POTSONVAARA
-02767 6105 2505 0 125 0 ---- HAMEENLINNA LAMMI PAPPILA
-02768 6122 2605 0 100 0 ---- HEINOLA ASEMANTAUS
+02766 6314 3104 237 235 0 ---- ILOMANTSI POTSONVAARA
+02767 6105 2504 0 125 0 ---- HAMEENLINNA LAMMI PAPPILA
+02768 6120 2605 0 92 0 ---- HEINOLA ASEMANTAUS
 02769 6241 2218 95 93 0 ---- KAUHAJOKI KUJA-KOKKO
-02770 6185 2428 0 153 0 ---- JUUPAJOKI HYYTIALA
-02771 6188 2610 0 146 0 ---- JOUTSA LEIVONMAKI SAVENAHO
-02772 6207 2857 80 79 0 ---- RANTASALMI RUKKASLUOTO
+02770 6185 2429 0 153 0 ---- JUUPAJOKI HYYTIALA
+02771 6188 2609 0 146 0 ---- JOUTSA LEIVONMAKI SAVENAHO
+02772 6206 2857 80 76 0 ---- RANTASALMI RUKKASLUOTO
 02773 6045 2218 9 8 0 ---- TURKU ARTUKAINEN
+02774 6063 2519 85 83 0 ---- MANTSALA HIRVIHAARA
 02777 6046 2365 121 117 0 ---- SALO KIIKALA AIRFIELD
 02778 6180 2932 80 78 0 ---- SAVONLINNA PUNKAHARJU
 02780 6293 2119 3 1 0 ---- KORSNAS BREDSKARET
@@ -659,42 +664,42 @@
 02788 6314 2731 91 90 0 ---- KUOPIO MAANINKA
 02789 6338 2866 166 166 0 ---- RAUTAVAARA YLA-LUOSTA
 02790 6026 2075 23 23 0 ---- KUMLINGE KK
-02791 6323 2923 0 116 0 ---- JUUKA NIEMELA
+02791 6323 2923 0 115 0 ---- JUUKA NIEMELA
 02793 6255 2967 80 78 0 ---- LIPERI TUISKAVANLUOTO
 02794 5992 2435 0 2 0 ---- KIRKKONUMMI MAKILUOTO
 02795 6010 2498 6 3 0 ---- HELSINKI HARMAJA
 02796 6332 3005 0 98 0 ---- LIEKSA LAMPELA
-02797 6415 2543 0 112 0 ---- HAAPAVESI
+02797 6414 2542 0 112 0 ---- HAAPAVESI MUSTIKKAMAKI
 02798 6367 2883 0 115 0 ---- VALTIMO KK
 02799 6430 3017 198 197 0 ---- KUHMO KALLIOJOKI
 02800 6461 2390 24 0 0 ---- RAAHE NAHKIAINEN
 02801 6905 2079 483 480 0 ---- ENONTEKIO KILPISJARVI
 02803 6468 2509 50 48 0 ---- SIIKAJOKI REVONLAHTI
-02804 6556 2825 0 197 0 ---- TAIVALKOSKI KK KAUPPATIE
+02804 6558 2822 0 197 0 ---- TAIVALKOSKI KK URHEILUTIE
 02805 6976 2701 106 107 0 ---- UTSJOKI KEVO
 02807 6861 2741 145 147 0 ---- INARI IVALO AIRPORT
 02808 6958 2885 132 130 0 ---- INARI SEVETTIJARVI
-02811 6637 2932 0 160 0 ---- KUUSAMO KIUTAKONGAS
-02812 6653 2465 0 91 0 ---- YLITORNIO MELTOSJARVI
+02811 6637 2931 0 165 0 ---- KUUSAMO KIUTAKONGAS
+02812 6653 2465 0 93 0 ---- YLITORNIO MELTOSJARVI
 02813 6658 2601 107 106 0 ---- ROVANIEMI APUKKA
 02814 6672 2716 209 208 0 ---- KEMIJARVI AIRFIELD
-02815 6728 2818 0 180 0 ---- SAVUKOSKI KK
+02815 6729 2818 0 180 0 ---- SAVUKOSKI KK
 02816 6808 2718 249 248 0 ---- SODANKYLA VUOTSO
 02817 6843 2744 438 437 0 ---- SAARISELKA KAUNISPAA
 02818 6848 2830 255 253 0 ---- INARI RAJAJOOSEPPI
-02819 6775 2962 0 370 0 ---- SALLA VARRIOTUNTURI
+02819 6775 2961 0 360 0 ---- SALLA VARRIOTUNTURI
 02820 6806 2403 762 760 0 ---- MUONIO LAUKUKERO
 02821 6797 2412 566 565 0 ---- MUONIO SAMMALTUNTURI
 02823 6795 2368 253 236 0 ---- MUONIO ALAMUONIO
 02824 6798 2424 350 347 0 ---- KITTILA KENTTAROVA
-02825 7008 2795 0 35 0 ---- UTSJOKI NUORGAM
+02825 7008 2790 0 22 0 ---- UTSJOKI NUORGAM
 02826 6737 2663 180 179 0 ---- SODANKYLA AWS
 02827 6906 2749 124 123 0 ---- INARI VAYLA
 02828 6039 2255 5 6 0 ---- KAARINA YLTOINEN
 02829 6060 2480 88 86 0 ---- HYVINKAA HYVINKAANKYLA
-02830 6070 2682 0 33 0 ---- KOUVOLA ANJALA
-02831 6053 2768 0 5 0 ---- VIROLAHTI KOIVUNIEMI
-02832 6223 3035 0 90 0 ---- TOHMAJARVI KEMIE
+02830 6070 2681 0 33 0 ---- KOUVOLA ANJALA
+02831 6053 2767 0 5 0 ---- VIROLAHTI KOIVUNIEMI
+02832 6224 3035 0 90 0 ---- TOHMAJARVI KEMIE
 02833 6294 2249 32 26 0 ---- SEINAJOKI PELMAA
 02834 6384 2722 208 207 0 ---- VIEREMA KAARAKKALA
 02835 6884 2830 123 121 0 ---- INARI NELLIM
@@ -704,22 +709,22 @@
 02847 6650 2571 82 85 0 ---- ROVANIEMI RAUTATIEASEMA
 02849 6683 2867 222 215 0 ---- SALLA KK MYLLYTIE
 02850 6232 2791 84 83 0 ---- VARKAUS KOLSUANNIEMI
-02851 6493 2538 12 10 0 ---- OULU OULUNSALO PELLONPAA
+02851 6494 2537 12 10 0 ---- OULU OULUNSALO PELLONPAA
 02852 6384 2312 8 6 0 ---- KOKKOLA HOLLIHAKA
 02857 6890 2574 0 285 0 ---- INARI ANGELI LINTUPUOLISELKA
 02858 6958 2889 0 106 0 ---- INARI KIRAKKAJARVI
 02859 6466 2806 0 341 0 ---- PUOLANKA PALJAKKA
 02860 6765 2490 0 181 0 ---- KITTILA KK
 02862 6567 2452 3 3 0 ---- KEMI AJOS
-02863 6542 2413 19 19 0 ---- KEMI I LIGHTHOUSE
+02863 6539 2410 19 25 0 ---- KEMI I LIGHTHOUSE
 02864 6578 2458 15 19 0 ---- KEMI-TORNIO AIRPORT
 02866 6541 2696 120 120 0 ---- PUDASJARVI AIRFIELD
 02868 6617 2915 363 500 0 ---- KUUSAMO RUKATUNTURI
 02869 6600 2922 266 264 0 ---- KUUSAMO AIRPORT
-02872 6467 2441 2 2 0 ---- RAAHE LAPALUOTO
+02872 6467 2441 2 2 0 ---- RAAHE LAPALUOTO HARBOUR
 02873 6504 2456 7 7 0 ---- HAILUOTO MARJANIEMI
 02874 6502 2473 7 7 0 ---- HAILUOTO KESKIKYLA
-02875 6493 2537 15 12 0 ---- OULU AIRPORT
+02875 6493 2537 13 11 0 ---- OULU AIRPORT
 02876 6501 2539 4 3 0 ---- OULU VIHREASAARI HARBOUR
 02880 6584 2417 9 8 0 ---- TORNIO TORPPI
 02881 6598 2637 163 161 0 ---- RANUA AIRFIELD
@@ -732,9 +737,9 @@
 02901 6373 2258 13 11 0 ---- MASSKAR
 02903 6372 2314 25 26 0 ---- KRUUNUPYY AIRPORT
 02906 6017 2276 0 12 0 ---- KEMIONSAARI KEMIO
-02907 6433 2361 5 3 0 ---- KALAJOKI ULKOKALLA
+02907 6433 2345 5 3 0 ---- KALAJOKI ULKOKALLA
 02910 6344 2106 11 4 0 ---- MUSTASAARI VALASSAARET
-02911 6305 2177 8 4 0 ---- VAASA AIRPORT
+02911 6306 2175 8 6 0 ---- VAASA AIRPORT
 02913 6314 2305 46 44 0 ---- KAUHAVA AIRFIELD
 02914 6312 2304 0 40 0 ---- KAUHAVA KK UUNIMAANTIE
 02915 6308 2586 132 130 0 ---- VIITASAARI HAAPANIEMI
@@ -758,19 +763,19 @@
 02943 6152 2375 98 98 0 ---- TAMPERE SIILINKARI
 02944 6142 2362 109 122 0 ---- TAMPERE-PIRKKALA AIRPORT
 02945 6186 2480 145 143 0 ---- JAMSA HALLI AIRFIELD
-02946 6187 2482 0 144 0 ---- JAMSA HALLI LENTOASEMANTIE
+02946 6186 2481 0 144 0 ---- JAMSA HALLI LENTOASEMANTIE
 02947 6169 2720 100 99 0 ---- MIKKELI AIRPORT
 02948 6195 2893 95 95 0 ---- SAVONLINNA AIRPORT
 02949 6065 2381 0 143 0 ---- SOMERO SALKOLA
 02950 6011 2170 5 3 0 ---- PARAINEN FAGERHOLM
-02952 6147 2180 17 13 0 ---- PORI AIRPORT
-02955 6290 2763 88 87 0 ---- KUOPIO SAVILAHTI
+02952 6147 2179 14 12 0 ---- PORI AIRPORT
+02955 6289 2763 88 83 0 ---- KUOPIO SAVILAHTI
 02956 6089 2694 100 99 0 ---- KOUVOLA UTTI LENTOPORTINTIE
-02957 6310 2165 9 7 0 ---- VAASA KLEMETTILA
+02957 6310 2164 9 7 0 ---- VAASA KLEMETTILA
 02958 6104 2815 106 106 0 ---- LAPPEENRANTA AIRPORT
-02959 6105 2822 115 103 0 ---- LAPPEENRANTA LEPOLA
+02959 6106 2821 114 103 0 ---- LAPPEENRANTA LEPOLA
 02961 6113 2137 10 6 0 ---- KUUSKAJASKARI
-02963 6082 2350 103 104 0 T-T- JOKIOINEN OBSERVATORY
+02963 6081 2350 103 104 0 T-T- JOKIOINEN OBSERVATORY
 02964 6072 2103 4 4 0 ---- KUSTAVI ISOKARI
 02965 6096 2563 79 78 0 ---- LAHTI LAUNE
 02966 6089 2694 100 99 0 ---- KOUVOLA UTTI AIRFIELD
@@ -778,18 +783,18 @@
 02968 6038 2705 28 17 0 ---- KOTKA KIRKONMAA
 02970 6012 1989 6 5 0 ---- JOMALA MARIEHAMN AIRPORT
 02971 6015 1987 10 9 0 ---- JOMALA
-02972 6052 2227 59 47 0 ---- TURKU AIRPORT
+02972 6052 2228 59 45 0 ---- TURKU AIRPORT
 02973 6040 2377 86 84 0 ---- SUOMUSJARVI
 02974 6033 2496 54 51 0 ---- VANTAA HELSINKI-VANTAA AIRPORT
 02975 6025 2505 28 17 0 ---- HELSINKI-MALMI
 02976 6038 2696 13 11 0 ---- KOTKA RANKKI
-02978 6018 2495 4 4 0 ---- HELSINKI KAISANIEMI
-02979 5950 2035 16 4 0 ---- BOGSKAR
-02980 5997 1997 10 8 0 ---- NYHAMN
+02978 6018 2494 4 4 0 ---- HELSINKI KAISANIEMI
+02979 5951 2036 16 4 0 ---- KOKAR BOGSKAR
+02980 5996 1995 10 8 0 ---- LEMLAND NYHAMN
 02981 5978 2137 7 9 0 ---- PARAINEN UTO
 02982 5977 2295 7 5 0 ---- HANKO RUSSARO
 02983 6051 2465 113 111 0 ---- NURMIJARVI GEOPHYSICAL OBSERVATORY
-02984 5993 2402 12 10 0 ---- BAGASKAR
+02984 5993 2401 12 12 0 ---- INKOO BAGASKAR
 02985 6018 2479 8 6 0 ---- ESPOO TAPIOLA
 02986 6029 2457 92 90 0 ---- ESPOO NUUKSIO
 02987 5999 2560 23 0 0 ---- PORVOO KALLBADAGRUND
@@ -798,6 +803,7 @@
 02991 6020 2563 27 20 0 ---- PORVOO EMASALO
 02992 6028 2644 4 5 0 ---- LOVIISA ORRENGRUND
 02993 6030 1913 15 3 0 ---- HAMMARLAND MARKET
+02994 6030 2555 0 2 0 ---- PORVOO KILPILAHTI
 02996 6040 2195 7 5 0 ---- RYMATTYLA RAULA
 02997 6009 1993 0 3 0 ---- MARIEHAMN WEST HARBOUR
 02998 6020 2496 25 24 0 ---- HELSINKI KUMPULA
@@ -993,6 +999,7 @@
 03837 5040 -348 0 8 0 ---- BRIXHAM
 03839 5074 -341 0 31 0 ---- EXETER AIRPORT
 03840 5086 -324 252 256 0 PPPP DUNKESWELL AERODROME
+03844 5074 -340 27 31 0 ---- EXETER AIRPORT NO. 2
 03853 5101 -264 20 23 0 ---- YEOVILTON
 03857 5052 -246 52 52 0 ---- ISLE OF PORTLAND
 03862 5078 -184 10 12 0 ---- HURN
@@ -1286,6 +1293,7 @@
 06210 5217 443 1 0 0 ---- VALKENBURG AWS
 06211 5382 295 34 46 0 ---- J6-A
 06212 5292 415 41 51 0 ---- HOORN-A
+06214 5404 604 37 42 0 ---- BUITENGAATS/BG-OHVS2
 06215 5214 444 0 -1 0 ---- VOORSCHOTEN AWS
 06225 5246 455 0 4 0 ---- IJMUIDEN WP
 06229 5300 472 0 1 0 ---- TEXELHORS WP
@@ -1384,7 +1392,7 @@
 06600 4757 769 0 493 0 ---- ST. CHRISCHONA
 06601 4754 758 317 316 0 ---- BASEL / BINNINGEN
 06602 4735 735 439 439 0 ---- DELEMONT
-06603 4735 733 0 415 0 ---- DELEMONT
+06603 4647 682 0 405 0 ---- VEVEY
 06604 4700 695 485 485 0 ---- NEUCHATEL
 06605 4713 705 1595 1599 2 ---- CHASSERAL
 06606 4705 706 432 431 0 ---- CRESSIER
@@ -1394,6 +1402,8 @@
 06610 4681 694 490 490 0 T-T- PAYERNE
 06611 4689 701 0 435 0 ---- AVENCHES
 06612 4708 679 1018 1018 2 ---- LA CHAUX-DE-FONDS
+06613 4660 766 0 756 0 ---- FRUTIGEN
+06614 4612 702 0 990 0 ---- LES MARECOTTES
 06616 4742 694 598 596 0 ---- FAHY
 06617 4698 661 1050 1050 2 ---- LA BREVINE
 06618 4674 657 437 437 0 ---- MATHOD
@@ -1420,18 +1430,18 @@
 06639 4700 794 1405 1404 2 ---- NAPF
 06640 4666 707 0 715 0 ---- MARSENS
 06641 4757 788 345 344 0 ---- MOEHLIN
-06642 4735 777 0 735 0 ---- LANGENBRUCK
+06642 4663 975 0 1408 0 ---- LATSCH
 06643 4726 779 423 422 0 ---- WYNAU
 06644 4724 823 453 453 0 ---- MOSEN
 06645 4743 788 613 611 2 ---- RUENENBERG
 06646 4756 823 327 326 0 ---- BEZNAU
 06647 4754 823 335 334 0 ---- WUERENLINGEN
 06648 4718 800 523 521 0 ---- EGOLZWIL
-06649 4755 805 0 322 0 ---- LAUFENBURG
+06649 4738 961 409 409 0 ---- OBERRIET
 06650 4704 830 455 454 0 ---- LUZERN
 06651 4695 801 744 742 2 ---- SCHUEPFHEIM
-06652 4707 830 0 430 0 ---- EMMEN / RATHAUSEN
-06653 4720 817 0 693 0 ---- BEROMUENSTER
+06652 4689 802 0 940 0 ---- FLUEHLI
+06653 4700 852 0 521 0 ---- GERSAU
 06654 4747 817 0 350 0 ---- BRUGG-WILDEGG
 06655 4682 841 1036 1036 2 ---- ENGELBERG
 06656 4674 806 569 567 0 ---- BRIENZ
@@ -1440,9 +1450,12 @@
 06659 4698 825 2103 2106 2 ---- PILATUS
 06660 4738 857 558 556 0 ---- ZUERICH / FLUNTERN
 06661 4728 851 0 928 0 ---- ALBIS
-06662 4767 843 0 402 0 ---- TRASADINGEN
+06662 4708 864 0 790 0 ---- SATTEL-AEGERI
+06663 4663 919 0 1242 0 ---- VALS
 06664 4743 852 444 444 0 ---- ZUERICH / AFFOLTERN
+06665 4718 886 0 468 0 ---- LACHEN/GALGENEN
 06666 4760 819 342 341 0 ---- LEIBSTADT
+06668 4669 860 952 950 2 ---- GOESCHENEN
 06669 4748 840 846 845 2 ---- LAEGERN
 06670 4748 853 427 426 0 ---- ZUERICH / KLOTEN
 06671 4767 898 399 398 0 ---- STECKBORN
@@ -1479,14 +1492,15 @@
 06707 4662 671 0 859 0 ---- VILLARS-TIERCELIN
 06708 4657 686 829 827 2 ---- ORON
 06709 4639 686 375 374 0 ---- BOUVERET
-06710 4653 662 0 610 0 ---- LAUSANNE
+06710 4718 709 0 695 0 ---- COURTELARY
 06711 4651 667 456 456 0 ---- PULLY
 06712 4633 692 382 381 0 ---- AIGLE
+06713 4639 710 0 1412 0 ---- COL DES MOSSES
 06714 4633 720 2964 2964 3 ---- LES DIABLERETS
 06715 4618 703 482 482 0 ---- EVIONNAZ
-06716 4618 727 728 737 0 ---- FEY
+06716 4615 762 1580 1560 2 ---- MOTTEC
 06717 4587 717 2487 2472 0 ---- COL DU GRAND ST-BERNARD
-06718 4620 702 0 665 0 ---- SAVATAN
+06718 4638 690 0 373 0 ---- NOVILLE
 06719 4587 717 0 2460 0 ---- LE GRAND SAINT-BERNARD DOUANE
 06720 4622 733 482 482 0 ---- SION
 06721 4637 819 0 1448 0 ---- BINN
@@ -1529,7 +1543,9 @@
 06768 4604 883 0 1625 0 ---- MONTE LEMA
 06770 4600 896 301 273 0 ---- LUGANO
 06771 4584 893 352 353 0 ---- STABIO
+06774 4646 967 0 1856 0 ---- BIVIO
 06775 4600 891 0 279 0 ---- LUGANO-AGNO
+06776 4684 978 0 2840 0 ---- WEISSFLUHGIPFEL
 06777 4593 902 1601 1600 2 ---- MONTE GENEROSO
 06778 4665 1027 1969 1968 2 ---- BUFFALORA
 06779 4643 976 1804 1804 2 ---- SEGL-MARIA
@@ -1538,7 +1554,7 @@
 06782 4671 885 1198 1197 2 ---- DISENTIS / SEDRUN
 06783 4646 918 1640 1639 2 ---- S. BERNARDINO
 06784 4681 984 1595 1594 2 ---- DAVOS
-06785 4678 967 1846 1840 2 ---- AROSA
+06785 4679 968 1878 1878 2 ---- AROSA
 06786 4687 952 558 556 0 ---- CHUR
 06787 4661 943 989 987 0 ---- ANDEER
 06788 4635 963 1089 1089 2 ---- VICOSOPRANO
@@ -1553,14 +1569,14 @@
 06797 4641 1002 2260 2260 0 ---- PASSO DEL BERNINA
 06798 4679 1028 1305 1304 2 ---- SCUOL
 06799 4682 1026 2401 2400 3 ---- NALUNS / SCHLIVERA
-06801 4685 692 0 446 0 ---- PAYERNE
+06801 4685 692 0 443 0 ---- PAYERNE
 06802 4622 734 0 483 0 ---- SION
 06803 4673 811 0 577 0 ---- MEIRINGEN
 06804 4695 827 0 440 0 ---- ALPNACH
 06805 4708 830 0 426 0 ---- EMMEN
 06806 4698 839 0 442 0 ---- BUOCHS
 06807 4740 863 0 435 0 ---- DUEBENDORF
-06808 4617 888 0 196 0 ---- MAGADINO
+06808 4617 888 0 198 0 ---- MAGADINO
 06809 4630 899 0 259 0 ---- LODRINO
 06810 4708 907 0 447 0 ---- MOLLIS
 06842 4751 926 0 506 0 TPTP SITTERDORF
@@ -1569,7 +1585,7 @@
 06845 4743 788 0 611 0 TPTP RUENENBERG MIL
 06846 4672 951 0 2323 0 ---- SCALOTTAS
 06847 4679 803 0 2280 0 ---- BRIENZER ROTHORN
-06848 4695 960 0 1120 0 ---- VALZEINA
+06848 4697 950 0 1490 0 ---- PFAEFERS
 06849 4723 949 0 436 0 TPTP SALEZ
 06850 4729 889 0 1115 0 ---- BACHTEL
 06851 4724 877 0 496 0 ---- HOMBRECHTIKON
@@ -1592,7 +1608,7 @@
 06990 4713 952 458 457 0 ---- VADUZ
 07002 5073 160 68 73 0 ---- BOULOGNE
 07003 5051 162 20 6 0 ---- LE TOUQUET
-07005 5014 183 74 67 0 ---- ABBEVILLE
+07005 5014 183 72 67 0 ---- ABBEVILLE
 07010 5106 234 16 11 0 ---- DUNKERQUE
 07015 5057 310 47 48 0 ---- LILLE-LESQUIN
 07017 5022 315 77 78 0 ---- CAMBRAI-EPINOY
@@ -1623,16 +1639,16 @@
 07103 4804 -473 81 67 0 ---- POINTE DU RAZ
 07107 4868 -433 18 9 0 ---- BRIGNOGAN
 07108 4846 -443 0 96 0 ---- PLABENNEC-RADAR
-07109 4828 -444 83 51 0 ---- LANVEOC
+07109 4828 -444 83 87 0 ---- LANVEOC
 07110 4844 -441 95 99 0 T-T- BREST-GUIPAVAS
 07112 4862 88 0 245 0 ---- LA FERTE VIDAME PROFILEUR
 07117 4883 -347 58 55 0 ---- PLOUMANAC'H
 07118 4876 -347 87 88 0 ---- LANNION
 07119 4823 -330 0 262 0 ---- ROSTRENEN
-07120 4853 -285 135 130 0 ---- TREMUSON-ST-BRIEUC
+07120 4853 -285 135 138 0 ---- TREMUSON-ST-BRIEUC
 07125 4859 -208 59 67 0 ---- DINARD
 07129 4893 -15 0 155 0 ---- FALAISE-RADAR
-07130 4807 -173 43 38 0 ---- RENNES-SAINT JACQUES
+07130 4807 -173 37 38 0 ---- RENNES-SAINT JACQUES
 07134 4803 -75 100 101 0 ---- LAVAL-ETRONNIER
 07139 4845 11 145 145 0 ---- ALENCON
 07140 4806 138 127 132 0 ---- CHATEAUDUN
@@ -1682,7 +1698,7 @@
 07270 4707 393 0 598 0 ---- CHATEAU-CHINON
 07274 4736 478 0 592 0 ---- BLAISY HAUT RADAR
 07276 4785 458 0 263 0 ---- CHATILLON/SEINE
-07280 4727 509 227 221 0 ---- DIJON-LONGVIC
+07280 4727 509 227 222 0 ---- DIJON-LONGVIC
 07283 4784 534 467 466 0 ---- LANGRES
 07288 4725 599 310 307 0 ---- BESANCON
 07291 4737 702 0 913 0 ---- MONTANCY-RADAR
@@ -1691,18 +1707,18 @@
 07296 4759 684 402 401 0 ---- DORANS
 07299 4761 751 273 270 0 ---- BALE-MULHOUSE
 07300 4669 -233 32 32 0 ---- L ILE D YEU
-07306 4670 -138 91 91 0 ---- LA ROCHE-SUR-YON
+07306 4671 -138 91 91 0 ---- LA ROCHE-SUR-YON
 07314 4605 -141 23 11 0 ---- POINTE DE CHASSIRON
 07315 4615 -114 10 4 0 ---- LA ROCHELLE
 07316 4618 -119 18 23 0 ---- LA ROCHELLE AEROPORT ILE DE RE
 07330 4632 -40 61 61 0 ---- NIORT
-07335 4659 31 120 128 0 ---- POITIERS-BIARD
+07335 4659 31 120 129 0 ---- POITIERS-BIARD
 07336 4670 7 0 159 0 ---- CHERVES RADAR
 07354 4687 174 157 161 0 ---- CHATEAUROUX DEOLS
 07360 4615 187 553 546 0 ---- GUERET-GRANCHER
 07361 4618 195 366 365 0 ---- GUERET ST LAURENT
 07374 4617 340 251 249 0 ---- VICHY-CHARMEIL
-07379 4641 401 244 243 0 ---- SAINT-YAN
+07379 4641 401 242 243 0 ---- SAINT-YAN
 07381 4607 445 0 908 0 ---- SAINT NIZIER-RADAR
 07385 4630 480 217 222 0 ---- MACON
 07386 4704 543 195 197 0 ---- DOLE-TAVAUX
@@ -1714,6 +1730,7 @@
 07438 4515 147 117 112 0 ---- BRIVE
 07460 4579 315 326 333 0 ---- CLERMONT-FERRAND
 07461 4529 371 0 1115 0 ---- SEMBADEL-RADAR
+07468 4515 564 0 1895 0 ---- MOUCHEROTTE RADAR
 07469 4593 688 1037 1042 2 ---- CHAMONIX
 07471 4507 376 833 832 2 ---- LE PUY-LOUDES
 07475 4553 429 402 404 0 ---- ST-ETIENNE BOUTHEON
@@ -1730,7 +1747,7 @@
 07500 4463 -125 28 9 0 ---- LEGE-CAP FERRET
 07502 4453 -112 24 23 0 ---- CAZAUX
 07503 4443 -125 39 35 0 ---- BISCAROSSE
-07510 4483 -69 54 51 0 T-T- BORDEAUX MERIGNAC
+07510 4483 -69 48 51 0 T-T- BORDEAUX MERIGNAC
 07524 4417 59 69 62 0 ---- AGEN
 07530 4482 52 52 52 0 ---- BERGERAC
 07535 4474 140 261 260 0 ---- GOURDON
@@ -1744,7 +1761,9 @@
 07563 4391 490 48 38 0 ---- AVIGNON
 07569 4432 476 0 309 0 ---- BOLLENE-RADAR
 07570 4454 437 280 281 0 ---- LANAS SYN
+07572 4401 653 0 1772 0 ---- MONT-MAUREL RADAR
 07577 4458 473 74 73 0 ---- MONTELIMAR
+07578 4450 622 0 1736 0 ---- MONT-COLOMBIS RADAR
 07579 4414 486 55 60 0 ---- ORANGE
 07586 4408 505 106 99 0 ---- CARPENTRAS
 07587 4468 572 0 1069 0 ---- LUS-LA-CROIX-HAUTE
@@ -1756,6 +1775,7 @@
 07606 4362 -61 0 126 0 ---- MOMUY RADAR
 07607 4391 -50 59 62 0 ---- MONT-DE-MARSAN
 07610 4338 -42 183 188 0 ---- PAU-UZEIN
+07618 4358 137 158 158 0 -TT- TOULOUSE RW
 07621 4319 0 364 384 0 ---- TARBES-OSSUN
 07622 4369 60 128 125 0 ---- AUCH
 07627 4301 111 415 419 0 ---- SAINT GIRONS
@@ -1764,13 +1784,13 @@
 07630 4362 138 150 152 0 ---- TOULOUSE BLAGNAC
 07631 4353 137 166 164 0 ---- TOULOUSE FRANCAZAL
 07632 4391 212 171 172 0 ---- ALBI
-07635 4322 229 130 132 0 ---- CARCASSONNE
+07635 4322 229 127 132 0 ---- CARCASSONNE
 07637 4399 261 0 667 0 ---- MONTCLAR RADAR
 07638 4332 335 16 17 0 ---- BEZIERS-VIAS
-07641 4340 369 77 80 0 ---- SETE
+07641 4340 369 81 80 0 ---- SETE
 07643 4358 396 8 5 0 ---- MONTPELLIER
 07645 4386 441 62 60 0 T-T- NIMES-COURBESSAC
-07646 4376 441 105 94 0 ---- NIMES GARONS
+07646 4376 442 105 94 0 ---- NIMES GARONS
 07647 4352 492 24 25 0 ---- ISTRES
 07648 4360 509 59 60 0 ---- SALON DE PROVENCE
 07650 4344 522 32 21 0 ---- MARIGNANE
@@ -1784,8 +1804,9 @@
 07675 4338 639 82 81 0 ---- LE LUC
 07680 4342 675 6 2 0 ---- SAINT-RAPHAEL
 07684 4356 695 4 4 0 ---- CANNES
-07690 4365 721 28 4 0 ---- NICE
+07690 4365 721 26 4 0 ---- NICE
 07695 4368 733 144 138 0 ---- CAP FERRAT
+07714 4459 665 0 2575 0 ---- VARS-MAYT RADAR
 07745 4292 286 0 702 0 ---- OPOUL-RADAR
 07747 4274 287 44 44 0 ---- PERPIGNAN
 07749 4252 314 87 82 0 ---- CAP BEAR
@@ -1797,23 +1818,23 @@
 07774 4213 950 0 50 0 ---- ALERIA RADAR
 07775 4226 953 74 65 0 ---- ALISTRO
 07780 4151 910 23 27 0 ---- FIGARI
-07785 4300 936 113 104 0 ---- CAP CORSE
+07785 4300 936 113 72 0 ---- CAP CORSE
 07790 4254 949 12 8 0 ---- BASTIA
 08001 4337 -842 67 58 0 T-T- LA CORUNA
-08002 4331 -836 103 97 0 ---- LA CORUNA/ALVEDRO
+08002 4331 -836 103 98 0 ---- LA CORUNA/ALVEDRO
 08005 4348 -823 9 6 0 ---- EL FERROL
 08007 4317 -852 0 595 0 ---- CERCEDA
-08008 4312 -746 446 445 0 ---- LUGO/ROZAS
+08008 4311 -746 446 445 0 ---- LUGO/ROZAS
 08011 4357 -604 130 127 0 ---- ASTURIAS/AVILES
 08014 4356 -570 6 5 0 ---- GIJON-MUSEL
 08015 4335 -587 339 336 0 ---- OVIEDO
-08019 4346 -630 0 923 0 ---- AGUION
+08019 4346 -630 927 923 0 ---- AGUION
 08021 4343 -383 1 5 0 ---- SANTANDER/PARAYAS
 08023 4349 -380 59 52 0 T-T- SANTANDER
 08025 4330 -291 39 42 0 ---- BILBAO/AEROPUERTO
 08027 4331 -204 259 251 0 ---- SAN SEBASTIAN/IGUELDO
 08029 4336 -179 8 4 0 ---- SAN SEBASTIAN/FUENTERRABIA
-08042 4289 -841 367 370 0 ---- SANTIAGO/LABACOLLA
+08042 4289 -841 367 370 0 ---- SANTIAGO DE COMPOSTELA/LABACOLLA
 08043 4240 -869 10 9 0 ---- MARIN
 08044 4244 -861 108 108 0 ---- PONTEVEDRA
 08045 4224 -861 258 261 0 ---- VIGO/PEINADOR
@@ -1821,33 +1842,34 @@
 08048 4233 -786 147 143 0 ---- ORENSE
 08053 4256 -660 550 534 0 ---- PONFERRADA
 08055 4259 -565 914 916 9 ---- LEON/VIRGEN DEL CAMINO
-08072 4200 -459 0 874 9 ---- PALENCIA-AUTILLA PINO
+08072 4200 -459 860 874 9 ---- PALENCIA-AUTILLA PINO
 08075 4236 -362 892 891 9 ---- BURGOS/VILLAFRIA
-08080 4287 -273 510 513 0 ---- VITORIA
-08081 4340 -284 0 576 0 ---- BAQUIO
+08080 4287 -273 510 513 0 ---- VITORIA/FORONDA
+08081 4340 -284 0 576 0 ---- BAKIO
 08084 4245 -233 363 353 0 ---- LOGRONO/AGONCILLO
 08085 4278 -165 453 459 0 ---- PAMPLONA/NOAIN
 08087 4220 -147 295 295 0 ---- BARDENAS REALES
-08094 4208 -33 554 541 0 ---- HUESCA/MONFLORITE
+08094 4208 -33 554 541 0 ---- HUESCA/PIRINEOS
 08112 4221 87 800 799 2 ---- TALARN
 08117 4233 194 1702 1704 2 ---- LA MOLINA
-08130 4152 -573 667 656 0 ---- ZAMORA
-08140 4170 -484 846 846 9 ---- VALLADOLID/VILLANUBLA
-08141 4165 -476 735 735 0 ---- VALLADOLID
-08148 4177 -247 1082 1082 2 ---- SORIA
-08157 4111 -141 779 779 9 ---- DAROCA
-08160 4166 -101 258 263 0 T-T- ZARAGOZA/AEROPUERTO
-08162 4174 -54 0 820 0 ---- PERDIGUERA
-08171 4163 60 199 192 0 ---- LLEIDA
+08130 4152 -574 667 656 0 ---- ZAMORA
+08140 4171 -486 846 846 9 ---- VALLADOLID/VILLANUBLA
+08141 4164 -475 735 735 0 ---- VALLADOLID
+08148 4178 -248 1082 1082 2 ---- SORIA
+08157 4111 -141 779 779 9 ---- DAROCA I
+08160 4166 -100 258 263 0 ---- ZARAGOZA/AEROPUERTO
+08160 4168 -107 0 252 0 T-T- ZARAGOZA/BASE AEREA
+08162 4173 -55 0 820 0 ---- PERDIGUERA
+08171 4163 60 199 185 0 ---- LLEIDA
 08175 4115 118 76 71 0 ---- REUS/AEROPUERTO
-08179 4141 189 0 651 0 ---- CORBERA
+08179 4141 188 0 647 0 ---- CORBERA, PIC D'AGULLES
 08181 4129 206 5 4 0 ---- BARCELONA/AEROPUERTO
 08184 4191 276 129 143 0 ---- GIRONA/COSTA BRAVA
 08190 4138 212 91 95 0 T-T- BARCELONA SERVEI
 08202 4096 -550 794 790 9 ---- SALAMANCA/MATACAN
 08210 4065 -468 1132 1130 2 ---- AVILA
 08213 4095 -413 1005 1005 2 ---- SEGOVIA
-08215 4078 -401 1888 1894 2 ---- NAVACERRADA
+08215 4079 -401 1888 1894 2 ---- NAVACERRADA, PUERTO
 08219 4070 -376 998 1004 9 ---- COLMENAR VIEJO/FAMET
 08220 4045 -372 669 664 0 ---- MADRID/C. UNIVERSITARIA
 08221 4047 -356 582 609 0 ---- MADRID/BARAJAS
@@ -1855,52 +1877,52 @@
 08222 4040 -368 667 667 0 ---- MADRID, RETIRO
 08223 4038 -379 687 690 0 ---- MADRID/CUATRO VIENTOS
 08224 4029 -372 617 620 0 ---- MADRID/GETAFE
-08226 4065 -317 640 639 0 ---- GUADALAJARA
-08227 4047 -345 612 607 0 ---- MADRID/TORREJON
+08226 4063 -315 724 721 0 ---- GUADALAJARA
+08227 4047 -344 612 607 0 ---- MADRID/TORREJON
 08228 4018 -371 0 704 0 ---- TORREJON DE VELASCO
-08231 4007 -214 946 945 9 ---- CUENCA
-08232 4084 -189 1063 1056 2 ---- MOLINA DE ARAGON
-08233 4093 -130 889 890 9 ---- CALAMOCHA
+08231 4007 -213 946 945 9 ---- CUENCA
+08232 4084 -188 1063 1062 2 ---- MOLINA DE ARAGON
+08233 4093 -129 889 890 9 ---- CALAMOCHA
 08235 4035 -112 902 900 9 ---- TERUEL
-08238 4082 49 50 44 0 ---- TORTOSA
-08261 3947 -634 405 405 0 ---- CACERES
-08262 3943 -628 0 652 0 ---- SIERRA DE FUENTES
+08238 4082 49 50 50 0 ---- TORTOSA
+08261 3947 -634 391 394 0 ---- CACERES
+08262 3943 -629 0 652 0 ---- SIERRA DE FUENTES
 08272 3988 -405 516 515 0 ---- TOLEDO
 08280 3895 -186 704 702 0 ---- ALBACETE/LOS LLANOS
-08284 3949 -47 62 69 0 ---- VALENCIA/AEROPUERTO
-08285 3947 -37 11 11 0 ---- VALENCIA
-08286 3995 -7 35 35 0 ---- CASTELLON
+08284 3947 -47 62 60 0 ---- VALENCIA/AEROPUERTO
+08285 3947 -37 11 11 0 ---- VALENCIA VIVEROS
+08286 3996 -7 44 43 0 ---- CASTELLON-ALMAZORA
 08289 3918 -25 0 234 0 ---- CULLERA
-08301 3956 263 6 3 0 ---- PALMA DE MALLORCA
+08301 3954 263 6 3 0 ---- PALMA DE MALLORCA, CMT
 08302 3961 271 41 41 0 T-T- MALLORCA-SON BONET
 08306 3956 274 5 8 0 ---- PALMA DE MALLORCA/SON SAN JUAN
-08308 3938 279 0 113 0 ---- LLUCMAYOR
-08314 3985 422 86 91 0 ---- MENORCA/MAHON
+08308 3938 278 0 113 0 ---- LLUCMAYOR
+08314 3985 422 86 91 0 ---- MENORCA/AEROPUERTO
 08330 3888 -683 192 185 0 ---- BADAJOZ/TALAVERA LA REAL
 08335 3850 -513 541 540 0 ---- HINOJOSA DEL DUQUE
 08348 3899 -392 629 628 0 ---- CIUDAD REAL
 08349 3895 -374 622 622 0 ---- ALMAGRO-FAMET
 08359 3836 -49 82 81 0 ---- ALICANTE
 08360 3828 -56 31 43 0 ---- ALICANTE/EL ALTET
-08364 3827 -119 0 1261 0 ---- FORTUNA
+08364 3826 -119 0 1261 0 ---- FORTUNA
 08373 3888 138 17 6 0 ---- IBIZA/ES CODOLA
 08383 3728 -691 20 19 0 ---- HUELVA
 08386 3769 -633 0 517 0 ---- CASTILLO LAS GUARDAS
 08391 3742 -588 31 34 0 ---- SEVILLA/SAN PABLO
-08397 3715 -562 88 87 0 ---- MORON DE LA FRONTERA
-08410 3784 -484 92 90 0 ---- CORDOBA/AEROPUERTO
-08417 3778 -381 580 582 0 ---- JAEN
+08397 3715 -561 88 87 0 ---- MORON DE LA FRONTERA
+08410 3785 -484 92 90 0 ---- CORDOBA/AEROPUERTO
+08417 3778 -381 580 580 0 ---- JAEN
 08419 3719 -379 570 567 0 ---- GRANADA/AEROPUERTO
 08420 3714 -363 692 687 0 ---- GRANADA/BASE AEREA
 08429 3796 -123 75 75 0 ---- MURCIA/AL CANTARILLA
 08430 3800 -117 62 61 0 T-T- MURCIA
 08433 3779 -80 3 4 0 ---- MURCIA/SAN JAVIER
-08449 3664 -633 23 21 0 ---- ROTA
+08449 3664 -633 23 21 0 ---- ROTA B.N. OBSERVATORIO
 08451 3675 -606 28 27 0 ---- JEREZ DE LA FRONTERA AEROPUERTO
-08452 3650 -626 9 1 0 ---- CADIZ, OBS.
+08452 3650 -626 9 2 0 ---- CADIZ, OBS.
 08458 3602 -560 25 32 0 ---- TARIFA
 08475 3661 -466 0 1147 0 ---- ALHAURIN EL GRANDE
-08482 3668 -449 7 16 0 ---- MALAGA/AEROPUERTO
+08482 3667 -448 7 5 0 ---- MALAGA/AEROPUERTO
 08487 3685 -236 21 21 0 ---- ALMERIA/AEROPUERTO
 08489 3683 -208 0 486 0 ---- NIJAR
 08495 3615 -535 0 5 0 ---- GIBRALTAR
@@ -1957,37 +1979,37 @@
 08583 1682 -2505 18 20 0 ---- MINDELO
 08589 1494 -2348 95 95 0 ---- PRAIA
 08594 1673 -2295 56 54 0 --T- SAL
-08911 4277 -63 0 1540 0 ---- ARAGUES DEL PUERTO, LIZARRA
+08911 4276 -63 0 1540 0 ---- ARAGUES DEL PUERTO, LIZARRA
 08912 4296 -80 0 1591 0 ---- ISABA,  EL FERIAL
 08913 4290 -80 0 1340 0 ---- ANSO, REFUGIO DE LINZA
-08914 4279 -53 0 1560 0 ---- CANDANCHU, ETUKSA
+08914 4279 -54 0 1560 0 ---- CANDANCHU, ETUKSA
 08916 4282 -50 0 1730 0 ---- ASTUN, 'ESQUI 1730'
-08917 4276 -39 0 1780 0 ---- SALLENT DE GALLEGO,  FURCO
-08918 4278 -37 0 1560 0 ---- SALLENT DE GALLEGO,  FORMIGAL
-08920 4282 -28 0 2180 0 ---- SALLENT DE GALLEGO,  RESPOMUSO
-08922 4276 -23 0 1660 0 ---- PANTICOSA, REFUGIO CASA PIEDRA
+08917 4276 -38 0 1855 0 ---- SALLENT DE GALLEGO,  FURCO
+08918 4277 -37 0 1500 0 ---- SALLENT DE GALLEGO,  FORMIGAL
+08920 4282 -30 0 2145 0 ---- SALLENT DE GALLEGO,  RESPOMUSO
+08922 4276 -23 0 1645 0 ---- PANTICOSA, REFUGIO CASA PIEDRA
 08924 4270 -28 0 1830 0 ---- PANTICOSA, ESQUI
-08925 4263 46 0 2150 0 ---- ERISTE, REFUGIO ANGEL ORUS
-08926 4266 1 0 2215 0 ---- FANLO, REFUGIO DE GORIZ
-08927 4267 10 0 1350 0 ---- BIELSA, REFUGIO DE PINETA
+08925 4263 46 0 2115 0 ---- ERISTE, REFUGIO ANGEL ORUS
+08926 4266 2 0 2195 0 ---- FANLO, REFUGIO DE GORIZ
+08927 4267 10 0 1240 0 ---- BIELSA, REFUGIO DE PINETA
 08928 4268 48 0 1890 0 ---- BENASQUE, REFUGIO DE ESTOS
-08930 4257 55 0 2020 0 ---- CERLER, ESQU COTA 2000
+08930 4257 54 0 2020 0 ---- CERLER, ESQU COTA 2000
 08932 4248 87 0 2280 0 ---- BOI TAHULL
 08934 4270 95 0 1870 0 ---- BAQUEIRA
-08936 4241 112 0 680 0 ---- SORT
-08938 4242 121 0 2080 0 ---- PORT AINE
-08940 4264 125 0 1100 0 ---- TAVESCAN
-08942 4217 156 0 1750 0 ---- PORT DEL COMTE
+08936 4269 97 0 2467 0 ---- CAP DE VAQUEIRA
+08938 4241 121 0 2410 0 ---- PORT AINE, L'ORRI
+08940 4243 167 0 1940 0 ---- CAP DE RAC
+08942 4217 156 0 1813 0 ---- PORT DEL COMTE
 08944 4233 190 0 2150 0 ---- MASELLA
 08946 4239 216 0 1967 0 ---- NURIA
-08948 4244 227 0 2160 0 ---- VALLTER 2000
-08958 4011 -104 0 1520 0 ---- CAMARENA DE LA SIERRA
-08960 4038 -63 0 1975 0 ---- VALDELINARES, ESQUI
+08948 4243 227 0 2167 0 ---- VALLTER 2000
+08958 4011 -103 0 1520 0 ---- CAMARENA DE LA SIERRA
+08960 4038 -63 0 1955 0 ---- VALDELINARES, ESQUI
 10004 5417 635 0 0 0 ---- UFS TW EMS
 10006 5468 675 5 5 0 ---- NORDSEEBOJE III
 10007 5418 743 0 0 0 ---- UFS DEUTSCHE BUCHT
 10008 5500 633 3 3 0 ---- NORDSEEBOJE II
-10015 5418 789 8 4 0 ---- HELGOLAND
+10015 5418 789 3 4 0 ---- HELGOLAND
 10018 5492 835 19 16 0 ---- WESTERLAND/SYLT
 10020 5501 841 26 26 0 ---- LIST/SYLT
 10022 5479 894 8 7 0 ---- LECK
@@ -2004,7 +2026,7 @@
 10044 5450 1027 26 5 0 ---- LEUCHTTURM KIEL
 10046 5438 1014 28 0 0 ---- KIEL-HOLTENAU
 10055 5453 1106 9 3 0 ---- FEHMARN
-10067 5449 1124 11 5 0 ---- MARIENLEUCHTE
+10067 5449 1124 12 5 0 ---- MARIENLEUCHTE
 10089 5417 1211 0 2 0 ---- ROSTOCK (RADAR)
 10091 5468 1344 42 42 0 ---- ARKONA
 10093 5436 1348 41 40 0 ---- PUTBUS
@@ -2012,7 +2034,7 @@
 10113 5371 715 16 11 0 T-T- NORDERNEY
 10121 5378 792 0 2 0 ---- WANGEROOGE
 10122 5352 787 20 7 0 ---- JEVER
-10124 5387 813 31 32 0 ---- LEUCHTTURM ALTE WESER
+10124 5386 813 31 32 0 ---- LEUCHTTURM ALTE WESER
 10125 5350 805 0 5 0 ---- WILHELMSHAVEN-MARIENSIEL
 10126 5355 767 12 8 0 ---- WITTMUNDHAVEN
 10127 5353 817 10 6 0 ---- WILHELMSHAVEN (FLUGPLATZ)
@@ -2029,7 +2051,7 @@
 10149 5353 983 13 5 0 ---- HAMBURG-FINKENWERDER
 10150 5417 1035 28 26 0 ---- DOERNICK
 10152 5409 1088 2 1 0 ---- PELZERHAKEN
-10156 5380 1070 16 17 0 ---- LUEBECK-BLANKENSEE
+10156 5380 1070 17 16 0 ---- LUEBECK-BLANKENSEE
 10157 5380 1072 21 18 0 ---- LUEBECK-BLANKENSEE
 10161 5400 1119 16 15 0 ---- BOLTENHAGEN
 10162 5364 1139 60 59 0 ---- SCHWERIN
@@ -2050,8 +2072,8 @@
 10222 5315 861 30 6 0 ---- LEMWERDER
 10224 5305 880 5 4 0 ---- BREMEN
 10235 5296 978 77 76 0 ---- SOLTAU
-10238 5282 993 78 70 0 TTTP BERGEN
-10246 5292 1018 88 73 0 ---- FASSBERG
+10238 5282 992 78 70 0 TTTT BERGEN
+10246 5292 1019 88 73 0 ---- FASSBERG
 10249 5339 1069 46 45 0 ---- BOIZENBURG
 10253 5297 1114 18 17 0 ---- LUECHOW
 10261 5289 1173 23 21 0 ---- SEEHAUSEN
@@ -2065,7 +2087,7 @@
 10282 5332 1342 116 115 0 ---- FELDBERG/MECKLENBURG
 10289 5332 1393 57 56 0 ---- GRUENOW
 10291 5303 1399 55 54 0 ---- ANGERMUENDE
-10304 5273 733 41 0 0 -TT- MEPPEN
+10304 5272 732 41 19 0 -TT- MEPPEN
 10305 5252 731 23 22 0 ---- LINGEN
 10306 5229 739 49 40 0 ---- RHEINE-BENTLAGE
 10309 5208 694 47 46 0 ---- AHAUS
@@ -2107,7 +2129,7 @@
 10403 5123 650 38 37 0 ---- MOENCHENGLADBACH
 10404 5173 627 43 31 0 ---- KALKAR
 10406 5183 653 24 21 0 ---- BOCHOLT
-10410 5141 697 150 150 0 ---- ESSEN-BREDENEY
+10410 5140 697 150 150 0 ---- ESSEN-BREDENEY
 10410 5141 697 153 153 0 T-T- ESSEN-BREDENEY
 10412 5140 695 0 158 0 ---- ESSEN (RADAR)
 10413 5165 717 0 74 0 ---- MARL/LOEMUEHLE
@@ -2178,7 +2200,7 @@
 10552 5065 1077 939 937 2 ---- SCHMUECKE
 10554 5098 1096 322 316 0 ---- ERFURT-WEIMAR
 10555 5098 1132 268 264 0 ---- WEIMAR
-10557 5050 1114 851 845 2 ---- NEUHAUS A.R.
+10557 5050 1113 851 845 2 ---- NEUHAUS A.R.
 10558 5038 1118 630 626 0 ---- SONNEBERG-NEUFANG
 10564 5057 1180 502 501 0 ---- SCHLEIZ
 10565 5109 1193 246 246 0 ---- OSTERFELD
@@ -2200,7 +2222,7 @@
 10615 4976 705 482 481 0 ---- DEUSELBACH
 10616 4995 726 503 497 0 ---- HAHN
 10617 4997 712 0 257 0 ---- TRABEN-TRARBACH
-10618 4970 733 377 376 0 TTTP IDAR-OBERSTEIN
+10618 4969 733 377 376 0 TTTT IDAR-OBERSTEIN
 10628 4998 795 111 110 0 ---- GEISENHEIM
 10629 4999 871 0 198 0 ---- OFFENTHAL (RADAR)
 10630 5002 855 144 0 0 ---- FRANKFURT-WALLDORF (RADAR)
@@ -2217,7 +2239,7 @@
 10648 4972 910 455 453 0 ---- MICHELSTADT-VIELBRUNN
 10653 4965 997 298 298 0 ---- GIEBELSTADT
 10655 4977 996 272 268 0 ---- WUERZBURG
-10658 5022 1008 282 282 0 ---- BAD KISSINGEN
+10658 5022 1008 281 282 0 ---- BAD KISSINGEN
 10671 5031 1097 345 345 0 ---- LAUTERTAL-OBERLAUTER
 10675 4988 1092 241 240 0 ---- BAMBERG
 10677 4998 1163 498 488 0 ---- BAYREUTH
@@ -2244,7 +2266,7 @@
 10739 4883 919 318 314 0 ---- STUTTGART/SCHNARRENBERG
 10739 4883 919 315 314 0 T-T- STUTTGART/SCHNARRENBERG
 10742 4921 952 274 276 0 ---- OEHRINGEN
-10743 4940 997 473 473 0 ---- NIEDERSTETTEN
+10743 4939 997 473 473 0 ---- NIEDERSTETTEN
 10747 4892 969 490 489 0 ---- KAISERSBACH-CRONHUETTE
 10752 4947 1038 347 325 0 ---- ILLESHEIM
 10755 4932 1063 476 467 0 ---- ANSBACH/KATTERBACH
@@ -2252,7 +2274,7 @@
 10761 4901 1093 441 439 0 ---- WEISSENBURG-EMETZHEIM
 10763 4950 1106 318 314 0 ---- NUERNBERG
 10765 4922 1110 394 385 0 ---- ROTH
-10771 4943 1190 418 417 0 ---- KUEMMERSBRUCK
+10771 4943 1190 418 417 0 TTTT KUEMMERSBRUCK
 10771 4943 1190 0 417 0 TTTT KUEMMERSBRUCK
 10775 4922 1183 442 442 0 ---- HOHENFELS
 10776 4904 1210 370 365 0 ---- REGENSBURG
@@ -2276,14 +2298,14 @@
 10850 4879 1071 503 502 0 ---- HARBURG
 10852 4843 1094 477 461 0 ---- AUGSBURG
 10853 4871 1121 387 380 0 ---- NEUBURG/DONAU (FLUGPLATZ)
-10856 4819 1085 562 550 0 ---- LECHFELD
+10856 4818 1085 562 550 0 ---- LECHFELD
 10857 4808 1091 628 621 0 ---- LANDSBERG (FLUGPLATZ)
 10859 4808 1128 600 593 0 ---- OBERPFAFFENHOFEN
-10860 4872 1153 366 364 0 ---- INGOLSTADT (FLUGPLATZ)
+10860 4871 1154 366 364 0 ---- INGOLSTADT (FLUGPLATZ)
 10863 4840 1170 479 477 0 ---- WEIHENSTEPHAN-DURNAST
 10865 4816 1154 526 515 0 ---- MUENCHEN-STADT
 10868 4824 1155 489 484 0 T-T- MUENCHEN-OBERSCHLEISSHEIM
-10869 4832 1195 468 460 0 ---- ERDING
+10869 4832 1194 468 460 0 ---- ERDING
 10870 4835 1181 447 446 0 ---- MUENCHEN-FLUGHAFEN
 10871 4834 1161 0 489 0 ---- FUERHOLZEN (RADAR)
 10872 4866 1254 351 350 0 ---- GOTTFRIEDING
@@ -2300,7 +2322,7 @@
 10946 4772 1033 702 705 0 ---- KEMPTEN
 10948 4740 1028 807 806 2 ---- OBERSTDORF
 10950 4804 1022 0 667 0 ---- MEMMINGEN (RADAR)
-10954 4784 1087 757 756 0 -PP- ALTENSTADT
+10954 4783 1087 757 756 0 -TTT ALTENSTADT
 10961 4742 1099 2960 2964 3 ---- ZUGSPITZE
 10962 4780 1101 986 977 2 -T-- HOHENPEISSENBERG
 10963 4748 1106 720 719 0 ---- GARMISCH-PARTENKIRCHEN
@@ -2539,14 +2561,14 @@
 11450 4976 1338 372 360 0 ---- PLZEN-MIKULKA
 11457 4907 1362 1122 1118 2 ---- CHURANOV
 11464 5056 1393 843 831 9 ---- MILESOVKA
-11487 4947 1384 522 519 0 ---- KOCELOVICE
+11487 4947 1384 523 519 0 ---- KOCELOVICE
 11502 5068 1404 379 375 0 ---- USTI NAD LABEM
 11509 5046 1417 160 158 0 ---- DOKSANY
 11518 5010 1426 365 380 0 ---- PRAHA/RUZYNE
 11520 5001 1445 304 302 0 TTT- PRAHA-LIBUS
 11538 4920 1434 508 500 0 ---- TEMELIN
 11541 4895 1443 436 432 0 ---- CESKE BUDEJOVICE
-11546 4895 1447 396 395 0 ---- C. BUDEJOVICE-ROZNOV
+11546 4895 1447 403 395 0 ---- C. BUDEJOVICE-ROZNOV
 11567 5012 1454 286 285 0 ---- PRAHA-KBELY
 11603 5077 1502 401 398 0 ---- LIBEREC
 11624 4994 1539 240 242 0 ---- CASLAV
@@ -2572,6 +2594,7 @@
 11774 4932 1757 224 222 0 ---- HOLESOV
 11782 4970 1812 252 257 0 ---- OSTRAVA/MOSNOV
 11787 4955 1845 1327 1322 2 ---- LYSA HORA
+11791 4937 1782 666 664 255 ---- HOSTALKOVA, MARUSKA
 11801 4840 1714 207 205 0 ---- MALACKY
 11816 4820 1720 134 133 0 ---- BRATISLAVA-LETISKO
 11819 4848 1767 178 176 0 ---- JASLOVSKE BOHUNICE
@@ -2733,7 +2756,7 @@
 13383 4357 2135 167 166 0 ---- KRUSEVAC
 13384 4393 2138 125 123 0 ---- CUPRIJA
 13386 4339 2144 0 1482 0 ---- JASTREBAC
-13388 4333 2190 202 202 0 ---- NIS
+13388 4333 2190 203 203 0 T-T- NIS
 13389 4298 2195 232 230 0 ---- LESKOVAC
 13397 4302 2275 450 448 0 ---- DIMITROVGRAD
 13455 4245 1855 10 10 0 ---- HERCEG NOVI-IGALO
@@ -2757,7 +2780,7 @@
 13577 4153 2070 1321 1332 2 ---- LAZAROPOLE
 13578 4112 2080 761 760 2 ---- OHRID
 13579 4110 2082 700 705 0 ---- OHRID-AERODROME
-13580 4085 2107 910 912 0 ---- PRETOR-PGC
+13580 4098 2106 910 912 0 ---- PRETOR-PGC
 13581 4122 2147 0 0 2 ---- TOPOLCANI-PGC
 13582 4137 2125 1230 0 2 ---- KRUSEVO
 13583 4105 2137 589 586 0 ---- BITOLA
@@ -2879,7 +2902,7 @@
 15025 4783 2722 111 110 1 ---- STANCA STEFANESTI
 15033 4760 2465 1787 1785 2 ---- IEZER
 15042 4734 2209 112 124 1 ---- SACUIENI
-15044 4746 2278 161 159 1 ---- SUPURU DE JOS
+15044 4746 2278 160 159 1 ---- SUPURU DE JOS
 15047 4744 2387 365 363 1 ---- TARGU LAPUS
 15052 4745 2557 1574 1572 2 ---- RARAU
 15056 4736 2693 290 289 1 ---- COTNARI
@@ -3080,6 +3103,7 @@
 16044 4603 1318 94 93 0 TTTT UDINE/CAMPOFORMIDO
 16044 4604 1319 94 93 0 TTTT CAMPOFORMIDO RDS
 16045 4598 1305 53 51 0 ---- UDINE/RIVOLTO
+16045 4598 1306 51 50 0 TTTT UDINE/RIVOLTO RDS
 16046 4598 1305 54 52 0 ---- UDINE/RIVOLTO
 16052 4594 771 3488 3480 3 ---- PIAN ROSA
 16054 4573 735 552 550 0 ---- AOSTA POLLEIN
@@ -3395,6 +3419,7 @@
 17098 4054 4308 1795 1794 2 ---- KARS
 17099 3972 4305 1632 1632 2 ---- AGRI
 17100 3992 4405 858 858 0 ---- IGDIR
+17109 4020 2588 19 0 0 ---- GOKCEADA
 17110 4018 2590 72 42 0 ---- GOKCEADA
 17111 3983 2607 30 30 0 ---- BOZCAADA
 17112 4013 2640 6 6 0 ---- CANAKKALE
@@ -3431,6 +3456,7 @@
 17193 3861 3470 1260 1260 2 ---- NEVSEHIR
 17194 3877 3453 945 947 0 ---- KAPODOKYA
 17195 3882 3543 1054 1055 2 ---- KAYSERI/ERKILET
+17196 3868 3547 1096 1096 0 T-T- KAYSERI BOLGE
 17197 3835 3825 931 920 0 ---- TULGA MEYDAN
 17199 3835 3832 948 948 0 ---- MALATYA/BOLGE
 17200 3843 3808 849 862 0 ---- MALATYA/ERHAC
@@ -3483,7 +3509,7 @@
 17350 3700 3542 66 73 0 ---- ADANA/INCIRLIK
 17351 3697 3535 27 27 0 T-T- ADANA/BOLGE
 17352 3697 3529 20 20 0 ---- ADANA
-17355 3717 3617 120 120 0 ---- OSMANIYE
+17355 3710 3625 0 94 0 ---- OSMANIYE
 17370 3658 3617 4 4 0 ---- ISKENDERUN
 17372 3620 3617 100 100 0 ---- HATAY-ANTAKYA
 17375 3629 3015 2 2 0 ---- FINIKE
@@ -3494,7 +3520,7 @@
 17609 3486 3361 10 10 0 ---- LARNACA AIRPORT
 20046 8063 5806 25 21 0 T--- POLARGMO IM. E.T. KRENKELJA
 20069 7948 7698 10 10 0 ---- OSTROV VIZE
-20087 7955 9057 8 7 0 ---- OSTROV GOLOMJANNYJ
+20087 7955 9057 8 7 0 ---- MGMS IM. G.F. USHAKOVA
 20094 7928 10162 26 24 0 T--- MYS BARANOVA
 20107 7806 1422 76 73 0 ---- BARENTSBURG
 20274 7750 8220 23 0 0 ---- OSTROV UEDINENIJA
@@ -4168,7 +4194,7 @@
 28202 5835 5157 178 179 0 ---- FALENKI
 28214 5813 5258 170 168 0 ---- GLAZOV
 28216 5808 5468 226 238 0 ---- VERESCAGINO
-28224 5800 5667 171 171 0 ---- PERM'
+28224 5799 5634 171 171 0 ---- PERM'
 28225 5795 5620 170 0 0 ---- PERM'
 28225 5796 5620 170 170 0 T--- PERM'
 28234 5812 5778 226 223 0 ---- LYS'VA
@@ -4193,7 +4219,7 @@
 28409 5643 5220 169 170 0 ---- MOZGA
 28411 5683 5345 156 155 0 ---- IZHEVSK
 28418 5647 5373 133 135 0 ---- SARAPUL
-28419 5628 5497 102 98 0 ---- JANAUL
+28419 5628 5497 99 98 0 ---- JANAUL
 28428 5650 5613 148 148 0 ---- CHERNUSKA
 28434 5665 5778 206 205 0 ---- KRASNOUFIMSK
 28440 5683 6063 281 280 0 ---- EKATERINBURG
@@ -4944,7 +4970,7 @@
 35188 5113 7137 350 0 0 ---- ASTANA
 35217 5025 5257 32 0 0 ---- DZHAMBEJTY
 35229 5028 5715 219 0 0 T--- AKTOBE
-35235 5072 5867 243 0 0 ---- STEPNOE
+35235 5072 5867 276 0 0 ---- STEPNOE
 35302 5020 5117 17 0 0 ---- CHAPAEVO
 35334 4980 5798 368 0 0 ---- TOKMANSAY
 35357 4968 6952 349 0 0 ---- BARSHINO
@@ -4954,18 +4980,18 @@
 35406 4905 5187 2 0 0 ---- TAIPAK
 35416 4907 5468 95 0 0 ---- UIL
 35426 4915 5712 234 0 0 ---- TEMIR
-35475 4901 6866 490 0 0 ---- SHUBARKUL
+35475 4900 6865 490 0 0 ---- SHUBARKUL
 35497 4885 7287 656 0 0 ---- ZHARYK
 35532 4863 5850 398 0 0 ---- MUGODZARSKAJA
 35576 4830 6965 0 0 0 ---- KYZYLZHAR
-35615 4763 5332 -22 0 0 ---- MAKAT
-35662 4783 6673 488 0 0 ---- KARSAKBAY
+35615 4763 5332 -21 0 0 ---- MAKAT
+35662 4783 6672 488 0 0 ---- KARSAKBAY
 35671 4780 6772 346 0 0 T--- ZHEZKAZGAN
 35699 4745 7481 620 0 0 ---- BEKTAUATA
 35700 4712 5192 -22 0 0 T--- ATYRAU
-35701 4722 5098 -27 0 0 ---- ISATAI
+35701 4720 5098 -27 0 0 ---- ISATAI
 35746 4678 6165 62 0 0 ---- ARAL TENIZI
-35793 4722 7336 582 0 0 ---- MOIYNTY
+35793 4722 7334 585 0 0 ---- MOIYNTY
 35796 4680 7508 350 0 0 ---- BALHASH
 35849 4577 6212 68 0 0 ---- KAZALY
 35925 4540 5612 88 0 0 ---- SAM
@@ -5000,21 +5026,21 @@
 36278 5038 9043 1850 1850 0 ---- MUGUR-AKSY
 36307 5026 9517 1101 1100 2 ---- ERZIN
 36325 5060 9752 1315 1314 2 ---- KUNGUR-TUK
-36341 4978 7638 776 0 0 ---- EGINDYBULAK
+36341 4978 7637 776 0 0 ---- EGINDYBULAK
 36397 4922 8122 455 0 0 ---- ZHALGYZTOBE
 36428 4920 8452 401 0 0 ---- ULKEN NARYN
 36535 4875 8237 512 0 0 ---- KOKPEKTY
 36639 4712 8162 491 0 0 ---- URZHAR
 36686 4655 7687 349 0 0 ---- ALGAZY OSTROV
-36785 4539 7950 628 0 0 ---- ZHANSUGUROV
+36785 4538 7948 628 0 0 ---- ZHANSUGUROV
 36821 4483 7627 396 0 0 ---- BAKANAS
-36856 4427 7931 1224 0 0 ---- KONYROLEN
+36856 4427 7930 1224 0 0 ---- KONYROLEN
 36859 4417 8006 645 0 0 ---- ZHARKENT
 36864 4353 7525 743 0 0 ---- OTAR
 36870 4323 7693 851 0 0 ---- ALMATY
-36871 4319 7675 810 0 0 ---- KARASAYSKY
+36871 4318 7675 810 0 0 ---- KARASAYSKY
 36872 4336 7700 663 0 0 T-T- ALMATY
-36883 4348 7698 614 0 0 ---- ILIYSKY
+36883 4348 7698 613 0 0 ---- ILIYSKY
 36911 4283 7528 817 816 0 ---- TOKMAK
 36944 4235 7834 1769 1768 0 ---- KYZYL-SUU
 36974 4143 7600 2041 2039 0 ---- NARYN
@@ -5093,6 +5119,7 @@
 37537 4160 4408 1458 0 0 ---- TSALKA
 37541 4193 4458 551 0 0 ---- MUHRANI
 37545 4175 4477 428 427 4 ---- TBILISI
+37548 4176 4492 0 462 4 ---- TBILISI (RADAR STATION)
 37549 4168 4495 462 0 0 T--- TBILISI-AMC
 37553 4193 4551 566 568 4 ---- TELAVI
 37556 4173 4533 806 0 0 ---- SAGAREDZO
@@ -5245,8 +5272,8 @@
 38262 4295 5980 93 95 0 ---- CHIMBAJ
 38264 4248 5962 75 77 0 ---- NUKUS
 38267 4230 5913 71 0 0 ---- KENEURGENCH
-38313 4272 6900 406 0 0 ---- BUGUN
-38318 4210 6812 184 0 0 ---- BAYYRKUM
+38313 4372 6900 405 0 0 ---- BUGUN
+38318 4210 6812 183 0 0 ---- BAYYRKUM
 38328 4232 6970 604 0 0 ---- SHYMKENT
 38334 4248 7030 808 0 0 ---- AUL TURARA RYSKULOVA
 38339 4217 7088 2162 2150 2 ---- OLGAING
@@ -5523,6 +5550,7 @@
 40594 2855 4838 20 19 0 ---- NUWASIB
 40595 2882 4877 6 5 0 ---- QARUH ISLAND
 40596 2868 4865 8 7 0 ---- UMM-AL-MARADIM
+40598 2879 4767 193 0 4 ---- UMM QUDEER
 40602 3679 4210 382 0 0 ---- RABIAH
 40603 3636 4248 373 0 0 ---- TEL-AFER
 40604 3632 4183 583 0 0 ---- SINJAR
@@ -5870,17 +5898,25 @@
 41620 3135 6947 1407 1405 2 PPPP ZHOB
 41624 3182 7092 173 172 0 PPPP DERA ISMAIL KHAN
 41630 3143 7309 184 183 4 ---- FAISALABAD
+41633 3187 7190 186 0 0 ---- NOOR PUR THAL
+41634 3292 7284 519 0 0 ---- CHAKWAL
+41635 3250 7243 187 0 0 ---- JAUHARBAD
 41636 3127 7231 153 0 0 ---- JHANG
 41638 3098 7247 156 0 0 ---- TOBA TEK SINGH
+41639 3253 7409 233 0 0 ---- GUJRAT
 41640 3155 7433 215 214 0 TPPP LAHORE CITY
 41641 3152 7440 217 216 0 ---- LAHORE AIRPORT
 41646 3080 7343 180 0 0 ---- OKARA
 41652 3005 7063 125 123 0 ---- DERA GHAZI KHAN
 41660 3025 6688 1589 1587 2 ---- QUETTA AIRPORT
 41661 3027 6692 1621 1620 2 TPPP QUETTA (SHEIKH MANDA)
+41669 3162 7106 162 0 0 ---- BHAKKAR
+41670 3102 7097 151 0 0 ---- LAYYAH
 41672 3078 7220 150 0 4 PPPP RAFIQUI
 41675 3020 7143 123 122 0 TPPP MULTAN
+41676 3045 7095 133 0 0 ---- KOT ADDU
 41678 2995 7325 163 162 0 PPPP BAHAWALNAGAR
+41679 3110 7447 218 0 0 ---- KASUR
 41685 2988 6972 1098 1097 2 PPPP BARKHAN
 41696 2903 6658 2017 2015 2 PPPP KALAT
 41697 2955 6788 134 133 0 ---- SIBI
@@ -6187,6 +6223,7 @@
 42699 2398 8537 611 611 0 ---- HAZARIBAGH
 42701 2332 8532 646 646 0 TPT- M.O. RANCHI
 42703 2378 8643 258 256 0 ---- DHANBAD
+42704 2347 8743 74 74 0 TPT- PANAGARH AFS
 42705 2333 8642 255 255 0 ---- PURULIA
 42706 2338 8708 99 100 0 ---- BANKURA
 42708 2365 8770 59 59 0 ---- SHANTI NIKETAN
@@ -6545,6 +6582,7 @@
 44474 2735 8767 1732 1732 2 ---- TAPLEJUNG
 44477 2698 8735 1210 1210 2 ---- DHANKUTA
 44478 2648 8727 72 72 0 ---- BIRATNAGAR AIRPORT
+44517 2786 9066 3708 0 255 ---- TSAMPA
 45004 2231 11417 66 65 0 T-T- KOWLOON
 45004 2233 11417 0 24 0 -P-P KOWLOON
 45005 2230 11417 40 32 0 ---- HONG KONG OBSERVATORY
@@ -6606,28 +6644,28 @@
 47086 3622 12653 0 4 0 P--- UNGCHEON
 47087 3657 12728 0 33 0 ---- JOCHIWON
 47088 3640 12828 0 90 0 P--- SANGJU RANGE
-47090 3825 12856 19 19 0 T-T- SOKCHO
+47090 3825 12856 19 19 0 ---- SOKCHO
 47091 3813 12860 13 11 0 ---- SOKCHO AIRPORT
-47092 3807 12866 72 74 0 ---- YANGYANG INT'L AIRPORT
+47092 3804 12866 74 73 0 ---- YANGYANG INT'L AIRPORT
 47094 3811 12743 0 1064 0 ---- GWANGDEOKSAN
 47095 3815 12730 155 154 0 ---- CHEORWON
 47097 3726 12748 79 79 0 ---- ICHEON
 47098 3790 12706 110 110 0 ---- DONGDUCHEON
-47099 3789 12677 31 30 0 ---- MUNSAN
+47099 3789 12677 31 30 0 ---- PAJU
 47100 3768 12872 774 773 0 ---- DAEGWALLYEONG
 47101 3790 12774 79 78 0 ---- CHUNCHEON
 47102 3797 12463 146 145 0 T-T- BAENGNYEONGDO
 47103 3793 12463 0 169 0 ---- BAENGNYEONGDO AB
-47104 3779 12886 80 79 0 ---- BUKGANGNEUNG
+47104 3779 12886 80 79 0 T-T- BUKGANGNEUNG
 47105 3775 12888 27 27 0 ---- GANGNEUNG
 47106 3751 12912 41 41 0 ---- DONGHAE
 47107 3772 12893 0 6 0 ---- GANGNEUNG AB
 47108 3757 12697 87 86 0 ---- SEOUL
 47109 3775 12865 0 1407 0 ---- HWANGBYEONGSAN
-47110 3754 12678 10 18 0 ---- GIMPO INT'L AIRPORT
+47110 3754 12680 10 18 0 ---- GIMPO INT'L AIRPORT
 47111 3745 12710 0 21 0 ---- SEOUL AB
 47112 3747 12662 69 69 0 ---- INCHEON
-47113 3747 12643 6 7 0 ---- INCHEON INT'L AIRPORT
+47113 3747 12643 7 7 0 ---- INCHEON INT'L AIRPORT
 47114 3734 12795 150 149 0 ---- WONJU
 47115 3747 13090 224 223 0 ---- ULLEUNGDO
 47116 3744 12696 0 641 0 ---- GWANAKSAN
@@ -6644,81 +6682,81 @@
 47127 3697 12795 117 116 0 ---- CHUNGJU
 47128 3672 12750 0 53 0 ---- CHEONGJU AB
 47129 3678 12649 30 29 0 ---- SEOSAN
-47130 3699 12941 51 51 0 ---- ULJIN
+47130 3699 12941 51 50 0 ---- ULJIN
 47131 3664 12744 59 58 0 ---- CHEONGJU
-47132 3652 12632 0 46 0 ---- KOREA GAW CENTER, ANMYEONDO
+47132 3652 12632 0 46 0 ----  ANMYEONDO
 47133 3636 12737 70 69 0 ---- DAEJEON
 47134 3661 12835 0 107 0 ---- YECHEON AB
 47135 3622 12799 246 245 0 ---- CHUPUNGNYEONG
-47136 3657 12871 142 141 0 ---- ANDONG
+47136 3657 12871 142 140 0 ---- ANDONG
 47137 3640 12816 98 97 0 ---- SANGJU
 47138 3603 12938 4 3 0 T-T- POHANG
 47139 3597 12941 20 21 0 ---- POHANG AB
 47140 3601 12676 25 24 0 ---- GUNSAN
 47141 3590 12662 10 9 0 ---- GUNSAN AB
 47142 3588 12866 0 36 0 ---- DAEGU AB
-47143 3589 12862 65 65 0 ---- DAEGU
+47143 3588 12865 55 53 0 ---- DAEGU
 47144 3601 12678 0 232 0 ---- OSUNGSAN
 47145 3678 12712 26 25 0 ---- CHEONAN
-47146 3582 12716 55 54 0 ---- JEONJU
+47146 3584 12712 63 61 0 ---- JEONJU
 47147 3629 12722 0 145 0 P--- GYERYONGDAE
 47148 3618 12900 0 1128 0 ---- MYONBONGSAN
 47149 3668 12648 0 12 0 ---- SEOSAN AB
 47150 3633 12656 17 16 0 ---- BORYEONG
-47151 3560 12935 9 13 0 ---- ULSAN AIRPORT
+47151 3558 12935 9 13 0 ---- ULSAN AIRPORT
 47152 3556 12932 36 35 0 ---- ULSAN
 47153 3517 12893 0 3 0 ---- GIMHAE AB
 47154 3613 12832 50 49 0 ---- GUMI
-47155 3517 12857 38 38 0 ---- CHANGWON
+47155 3517 12857 38 38 0 TTTT CHANGWON
 47156 3517 12689 74 73 0 ---- GWANGJU
-47157 3567 12791 222 222 0 ---- GEOCHANG
+47157 3567 12791 227 226 0 ---- GEOCHANG
 47158 3511 12680 13 13 0 TTTT GWANGJU AB
 47159 3510 12903 71 70 0 ---- BUSAN
 47160 3511 12900 0 547 0 ---- GUDEOKSAN
 47161 3507 12805 8 3 0 P--- SACHEON AB
-47162 3485 12844 34 33 0 ---- TONGYEONG
-47163 3497 12637 37 36 0 ---- MUAN INT'L AIRPORT
+47162 3485 12844 33 32 0 ---- TONGYEONG
+47163 3497 12638 9 16 0 ---- MUAN INT'L AIRPORT
 47165 3482 12638 39 39 0 ---- MOKPO
 47166 3477 12638 5 7 0 ---- MOKPO AIRPORT
-47167 3483 12762 21 20 0 ---- YEOSU AIRPORT
+47167 3483 12762 22 16 0 ---- YEOSU AIRPORT
 47168 3474 12774 66 65 0 ---- YEOSU
 47169 3469 12545 78 77 0 T-T- HEUKSANDO
 47170 3440 12670 37 36 0 ---- WANDO
 47171 3556 12687 46 45 0 ---- JEONGEUP
 47172 3535 12660 56 55 0 ---- GOCHANG
-47173 3540 12733 92 91 0 ---- NAMWON
-47174 3508 12724 76 75 0 ---- SUNCHEON
+47173 3542 12740 134 133 0 ---- NAMWON
+47174 3502 12737 167 165 0 ---- SUNCHEON
 47175 3447 12632 478 477 0 ---- JINDO
 47178 3767 12568 0 107 0 ---- YEONPYEONGDO
 47179 3750 13087 0 968 0 ---- ULLEUNGDO AB
 47180 3725 12608 0 123 0 ---- DEOKJEOKDO
-47182 3352 12650 24 36 0 ---- JEJU INT'L AIRPORT
+47182 3350 12648 24 36 0 ---- JEJU INT'L AIRPORT
 47184 3351 12653 22 21 0 ---- JEJU
 47185 3329 12616 76 75 0 T-T- GOSAN
 47187 3322 12625 0 181 0 ---- MOSEULPO
 47188 3339 12688 19 18 0 ---- SEONGSAN
 47189 3325 12657 50 50 0 ---- SEOGWIPO
-47192 3515 12804 32 31 0 ---- JINJU
+47192 3515 12804 30 29 0 ---- JINJU
 47401 4542 14168 12 3 0 T-T- WAKKANAI
 47402 4494 14258 8 7 0 ---- KITAMIESASHI
 47404 4436 14169 10 8 0 ---- HABORO
 47405 4458 14296 16 14 0 ---- OMU
-47406 4395 14163 24 24 0 ---- RUMOI
+47406 4395 14163 24 24 0 PPPP RUMOI
 47407 4376 14237 140 120 0 ---- ASAHIKAWA
 47409 4402 14428 44 38 0 ---- ABASHIRI
 47411 4318 14102 26 25 0 ---- OTARU
 47412 4306 14133 26 17 0 T-T- SAPPORO
 47413 4321 14179 52 42 0 ---- IWAMIZAWA
 47415 4314 14101 0 700 0 ---- SAPPORO/KENASHIYAMA
-47417 4292 14321 44 38 0 ---- OBIHIRO
+47417 4292 14321 44 38 0 PPPP OBIHIRO
 47418 4299 14438 40 5 0 ---- KUSHIRO
-47418 4295 14444 16 14 0 T-T- KUSHIRO
+47418 4295 14444 15 14 0 T-T- KUSHIRO
 47419 4296 14452 0 98 0 ---- KUSHIRO/KOMBUMORI
 47420 4333 14559 27 25 0 ---- NEMURO
 47421 4280 14022 35 33 0 ---- SUTTSU
 47422 4180 14007 0 32 0 ---- KAMINOKUNI
 47423 4231 14097 50 40 0 ---- MURORAN
-47423 4232 14097 0 3 0 ---- MURORAN
+47423 4232 14097 0 3 0 PPPP MURORAN
 47424 4262 14155 8 6 0 ---- TOMAKOMAI
 47425 4279 14166 30 27 0 ---- CHITOSE AB
 47426 4216 14278 38 37 0 ---- URAKAWA
@@ -6753,7 +6791,7 @@
 47557 3722 14043 375 372 0 ---- FUKUSHIMA AIRPORT
 47567 3824 14091 10 7 0 ---- KASUMINOME AB
 47569 3814 14091 5 2 0 ---- SENDAI AIRPORT
-47570 3749 13991 214 212 0 ---- WAKAMATSU
+47570 3749 13991 214 212 0 PPPP WAKAMATSU
 47572 3772 13882 0 633 0 ---- NIIGATA/YAHIKOYAMA
 47573 3796 13911 4 1 0 ---- NIIGATA AIRPORT
 47574 4065 13993 68 66 0 ---- FUKAURA
@@ -6765,10 +6803,10 @@
 47582 3972 14010 22 6 0 T-T- AKITA
 47583 4019 14037 87 84 0 ---- ODATE-NOSHIRO AIRPORT
 47584 3970 14116 155 155 0 ---- MORIOKA
-47585 3965 14197 47 42 0 ---- MIYAKO
-47587 3890 13984 5 3 0 ---- SAKATA
+47585 3965 14197 47 42 0 PPPP MIYAKO
+47587 3890 13984 5 3 0 PPPP SAKATA
 47588 3826 14035 154 153 0 ---- YAMAGATA
-47590 3826 14090 44 39 0 ---- SENDAI
+47590 3826 14090 44 39 0 PPPP SENDAI
 47590 3826 14090 0 38 0 ---- SENDAI
 47591 3840 14121 5 2 0 ---- MATSUSHIMA AB
 47592 3843 14130 43 43 0 ---- ISHINOMAKI
@@ -6784,28 +6822,28 @@
 47607 3671 13719 17 9 0 ---- TOYAMA
 47610 3665 13819 420 418 0 ---- NAGANO
 47611 3610 13819 0 1925 0 ---- NAGANO/KURUMAYAMA
-47612 3711 13825 19 13 0 ---- TAKADA
+47612 3711 13825 15 13 0 PPPP TAKADA
 47615 3654 13987 140 119 0 ---- UTSUNOMIYA
-47616 3606 13622 17 9 0 ---- FUKUI
+47616 3606 13622 17 9 0 PPPP FUKUI
 47617 3615 13725 562 560 0 ---- TAKAYAMA
 47618 3625 13797 612 610 0 ---- MATSUMOTO
 47620 3604 13811 763 760 0 ---- SUWA
 47622 3634 13855 1005 999 2 ---- KARUIZAWA
 47624 3640 13906 114 112 0 ---- MAEBASHI
 47625 3629 13908 92 0 1 ---- TAKASAKI
-47626 3615 13938 32 30 0 ---- KUMAGAYA
+47626 3615 13938 32 30 0 PPPP KUMAGAYA
 47628 3622 14019 0 36 0 ---- KAKIOKA
-47629 3638 14047 31 29 0 ---- MITO
+47629 3638 14047 31 29 0 PPPP MITO
 47631 3565 13606 12 2 0 ---- TSURUGA
 47632 3540 13676 17 13 0 ---- GIFU
 47634 3539 13687 42 39 0 ---- GIFU AB
 47635 3525 13691 17 14 0 ---- NAGOYA AIRPORT
-47636 3517 13697 56 51 0 ---- NAGOYA
+47636 3517 13697 56 51 0 PPPP NAGOYA
 47636 3517 13696 0 51 0 ---- NAGOYA
 47637 3552 13782 529 516 0 ---- IIDA
 47638 3567 13855 282 273 0 ---- KOFU
 47639 3536 13872 3778 3775 1 ---- FUJISAN
-47640 3550 13876 861 860 2 ---- KAWAGUCHIKO
+47640 3550 13876 861 860 2 PPPP KAWAGUCHIKO
 47641 3599 13907 234 232 0 ---- CHICHIBU
 47642 3575 13935 144 141 0 ---- YOKOTA
 47643 3584 13941 93 90 0 ---- IRUMA AB
@@ -6818,23 +6856,23 @@
 47653 3463 13709 8 6 0 ---- IRAKO
 47654 3475 13771 48 46 0 ---- HAMAMATSU
 47655 3460 13821 47 45 0 ---- OMAEZAKI
-47656 3497 13840 16 14 0 ---- SHIZUOKA
+47656 3497 13840 16 14 0 PPPP SHIZUOKA
 47657 3511 13893 22 21 0 ---- MISHIMA
 47658 3481 13830 10 7 0 ---- SHIZUHAMA AB
 47659 3474 13813 0 156 0 ---- SHIZUOKA/MAKINOHARA
 47660 3571 13940 98 95 0 ---- TACHIKAWA AB
 47661 3540 13991 6 3 0 ---- KISARAZU AB
 47662 3569 13975 24 25 0 ---- TOKYO
-47663 3407 13619 17 15 0 ---- OWASE
+47663 3407 13619 17 15 0 PPPP OWASE
 47666 3460 13884 53 52 0 ---- IROZAKI
 47668 3504 13909 68 67 0 ---- AJIRO
 47670 3544 13965 43 39 0 ---- YOKOHAMA
 47671 3554 13978 9 6 0 ---- TOKYO INTERNATIONAL AIRPORT
 47672 3499 13987 7 6 0 ---- TATEYAMA
-47674 3515 14031 14 12 0 ---- KATSUURA
+47674 3515 14031 14 12 0 PPPP KATSUURA
 47675 3475 13936 76 74 0 ---- OSHIMA
-47677 3411 13952 38 36 0 ---- MIYAKEJIMA
-47678 3311 13978 153 151 0 T-T- HACHIJOJIMA
+47677 3411 13952 40 38 0 ---- MIYAKEJIMA
+47678 3311 13978 153 151 0 PPPP HACHIJOJIMA
 47678 3311 13978 153 152 0 TPTP HACHIJOJIMA/OMURE
 47679 3545 13944 65 62 0 ---- ATSUGI NAS
 47680 3551 13938 115 112 0 ---- ZAMA/KASTNER
@@ -6871,12 +6909,12 @@
 47743 3549 13324 7 4 0 ---- MIHO AB
 47744 3543 13334 8 7 0 ---- YONAGO
 47746 3549 13424 16 7 0 ---- TOTTORI
-47746 3553 13419 0 6 0 ---- TOTTORI
+47746 3553 13419 0 6 0 PPPP TOTTORI
 47747 3554 13482 6 3 0 ---- TOYOOKA
 47749 3549 13538 9 6 0 -P-- MAIZURU AB
-47750 3545 13532 23 2 0 ---- MAIZURU
+47750 3545 13532 4 2 0 ---- MAIZURU
 47754 3440 13141 4 2 0 ---- HAGI
-47755 3490 13207 21 19 0 ---- HAMADA
+47755 3490 13207 21 19 0 PPPP HAMADA
 47756 3506 13401 148 146 0 ---- TSUYAMA
 47759 3501 13572 53 41 0 ---- KYOTO
 47761 3528 13624 93 87 0 ---- HIKONE
@@ -6884,8 +6922,8 @@
 47764 3415 13225 6 3 0 ---- IWAKUNI
 47765 3440 13246 54 4 0 ---- HIROSHIMA
 47766 3424 13255 5 4 0 ---- KURE
-47767 3445 13325 3 2 0 ---- FUKUYAMA
-47768 3465 13391 19 3 0 ---- OKAYAMA
+47767 3445 13325 4 2 0 ---- FUKUYAMA
+47768 3469 13393 7 5 0 ---- OKAYAMA
 47769 3484 13466 40 38 0 ---- HIMEJI
 47770 3470 13521 31 5 0 ---- KOBE
 47771 3478 13544 15 12 0 ---- OSAKA INTERNATIONAL AIRPORT
@@ -6895,7 +6933,7 @@
 47776 3434 13490 112 109 0 ---- SUMOTO
 47777 3422 13516 18 14 0 ---- WAKAYAMA
 47778 3345 13576 69 68 0 ---- SHIONOMISAKI
-47778 3345 13576 76 68 0 T-T- SHIONOMISAKI
+47778 3345 13576 69 68 0 T-T- SHIONOMISAKI
 47779 3460 13560 13 10 0 ---- YAO AIRPORT
 47780 3469 13583 109 104 0 ---- NARA
 47782 3365 13536 92 89 0 ---- NANKISHIRAHAMA AIRPORT
@@ -6910,13 +6948,13 @@
 47792 3427 13259 0 726 0 ---- HIROSHIMA/HAIGAMINE
 47793 3476 13386 242 239 0 ---- OKAYAMA AIRPORT
 47794 3553 13416 18 15 0 ---- TOTTORI AIRPORT
-47795 3390 13513 0 9 0 ---- WAKAYAMA/MIHAMA
-47796 3463 13522 10 7 0 ---- KOBE AIRPORT
+47795 3389 13512 0 9 0 PPPP WAKAYAMA/MIHAMA
+47796 3463 13522 8 5 0 ---- KOBE AIRPORT
 47799 3428 12933 66 63 0 ---- TSUSHIMA AIRPORT
 47800 3420 12929 4 4 0 ---- IZUHARA
-47800 3415 12922 0 130 0 ---- IZUHARA
+47800 3415 12922 0 130 0 PPPP IZUHARA
 47803 3388 13065 33 30 0 ---- ASHIYA AB
-47805 3336 12955 59 58 0 ---- HIRADO
+47805 3336 12955 59 58 0 PPPP HIRADO
 47806 3343 13036 0 970 0 ---- FUKUOKA/SEFURISAN
 47807 3358 13038 15 3 0 T-T- FUKUOKA
 47808 3358 13044 12 9 0 ---- FUKUOKA AIRPORT
@@ -6926,13 +6964,13 @@
 47812 3315 12972 6 4 0 ---- SASEBO
 47813 3327 13031 33 5 0 ---- SAGA
 47814 3332 13093 84 83 0 ---- HITA
-47815 3324 13162 13 5 0 ---- OITA
+47815 3324 13162 13 5 0 PPPP OITA
 47816 3344 12943 0 85 0 ---- IKITSUKIJIMA
 47817 3272 12987 36 27 0 ---- NAGASAKI
 47818 3274 13026 680 678 0 ---- UNZENDAKE
-47819 3281 13071 39 38 0 ---- KUMAMOTO
+47819 3281 13071 39 38 0 PPPP KUMAMOTO
 47821 3288 13107 1144 1142 2 ---- ASOSAN
-47822 3258 13166 21 19 0 ---- NOBEOKA
+47822 3258 13166 21 19 0 PPPP NOBEOKA
 47823 3203 13019 42 40 0 ---- AKUNE
 47824 3222 13076 148 146 0 ---- HITOYOSHI
 47827 3156 13055 32 4 0 T-T- KAGOSHIMA
@@ -6942,14 +6980,14 @@
 47833 3142 13088 0 107 0 ---- KANOYA
 47835 3158 13141 15 3 0 ---- ABURATSU
 47836 3039 13066 38 37 0 ---- YAKUSHIMA
-47836 3038 13066 0 36 0 ---- YAKUSHIMA
+47836 3038 13066 0 36 0 PPPP YAKUSHIMA
 47837 3072 13097 38 25 0 ---- TANEGASHIMA
 47838 3220 13003 15 3 0 ---- USHIBUKA
 47840 3368 13104 20 17 0 ---- TSUIKI AB
 47842 3198 12835 110 109 0 ---- MESHIMA
 47843 3269 12883 27 25 0 ---- FUKUE
 47844 3267 12883 80 77 0 ---- FUKUE AIRPORT
-47848 3172 13032 0 25 0 ---- KAGOSHIMA/ICHIKI
+47848 3171 13032 0 25 0 PPPP KAGOSHIMA/ICHIKI
 47850 3137 13084 68 65 0 ---- KANOYA AB
 47851 3180 13072 275 272 0 ---- KAGOSHIMA AIRPORT
 47852 3347 13174 8 5 0 ---- OITA AIRPORT
@@ -6971,20 +7009,20 @@
 47884 3401 13463 6 3 0 ---- KOMATSUSHIMA AB
 47887 3384 13278 34 32 0 ---- MATSUYAMA
 47890 3428 13375 5 4 0 ---- TADOTSU
-47891 3432 13405 14 9 0 ---- TAKAMATSU
+47891 3432 13405 14 9 0 PPPP TAKAMATSU
 47892 3322 13255 15 2 0 ---- UWAJIMA
 47893 3357 13355 5 1 0 ---- KOCHI
-47893 3357 13355 0 3 0 ---- KOCHI
+47893 3357 13355 0 3 0 PPPP KOCHI
 47895 3407 13457 6 2 0 ---- TOKUSHIMA
 47897 3292 13269 11 2 0 ---- SUKUMO
-47898 3272 13301 34 31 0 ---- SHIMIZU
+47898 3272 13301 34 31 0 PPPP SHIMIZU
 47899 3325 13418 187 185 0 ---- MUROTOMISAKI
 47899 3325 13418 0 185 0 ---- MUROTOMISAKI
 47907 2783 12888 5 2 0 ---- TOKUNOSHIMA AIRPORT
-47909 2838 12950 8 3 0 ---- NAZE
+47909 2838 12950 8 3 0 PPPP NAZE
 47909 2839 12955 295 294 0 T-T- NAZE/FUNCHATOGE
 47911 2447 12298 19 16 0 ---- YONAGUNI AIRPORT
-47912 2447 12301 36 30 0 ---- YONAGUNIJIMA
+47912 2447 12301 36 30 0 PPPP YONAGUNIJIMA
 47917 2443 12377 11 10 0 ---- IRIOMOTEJIMA
 47918 2434 12416 15 6 0 T-T- ISHIGAKIJIMA
 47919 2440 12424 34 31 0 ---- NEW ISHIGAKI AIRPORT
@@ -7003,7 +7041,7 @@
 47938 2672 12778 76 73 0 ---- IEJIMA (US BASE)
 47940 2659 12797 7 6 0 ---- NAGO
 47942 2743 12871 30 27 0 ---- OKINOERABU
-47945 2583 13122 21 15 0 T-T- MINAMIDAITOJIMA
+47945 2583 13122 21 15 0 TPTP MINAMIDAITOJIMA
 47946 2650 12790 106 0 1 ---- OKINAWA
 47971 2709 14219 8 3 0 T-T- CHICHIJIMA
 47981 2478 14132 120 117 0 T--- IWOTO
@@ -7125,6 +7163,7 @@
 48407 1525 10487 124 122 0 TPPP UBON RATCHATHANI
 48408 1523 10503 131 130 0 ---- UBON RATCHATHANI AGROMET
 48409 1509 10433 129 127 0 ---- SISAKET AGROMET
+48410 1537 10004 26 24 0 ---- UTHAITHANI
 48413 1566 10111 70 68 0 ---- WICHIAN BURI
 48415 1453 10072 10 8 0 ---- AYUTTHAYA AGROMET
 48416 1532 10368 129 128 0 ---- THA TUM
@@ -7144,6 +7183,7 @@
 48435 1464 10132 388 386 0 ---- PAK CHONG AGROMET
 48436 1463 10272 182 179 0 ---- NANG RONG
 48437 1523 10325 184 182 0 ---- BURIRAM
+48438 1341 10003 4 2 0 ---- SAMUTSONGKRAM
 48439 1399 10170 12 11 0 ---- KABIN BURI
 48440 1379 10203 43 41 0 ---- SRAKAEW
 48450 1402 9954 29 28 0 ---- KANCHANA BURI
@@ -7227,6 +7267,7 @@
 48803 2250 10397 97 104 0 ---- LAO CAI
 48806 2133 10390 676 675 0 ---- SON LA
 48808 2267 10625 243 244 0 ---- CAO BANG
+48811 2140 10301 491 491 0 T-T- DIEN BIEN PHU AP.
 48820 2103 10580 6 5 0 T-T- HA NOI
 48823 2043 10615 3 2 0 ---- NAM DINH
 48825 2097 10577 8 6 0 ---- HA DONG
@@ -7300,7 +7341,7 @@
 48995 1200 10545 14 14 0 ---- KOMPONG-CHAM
 48997 1147 10532 13 13 0 ---- PREY VENG
 48998 1108 10580 6 6 0 ---- SVAY RIENG
-50136 5213 12252 433 0 0 ---- MOHE
+50136 5297 12253 438 0 0 ---- MOHE
 50353 5173 12663 176 0 0 ---- HUMA
 50434 5048 12168 737 0 0 ---- TULIHE
 50468 5025 12745 166 0 0 ---- AIHUI
@@ -7344,9 +7385,9 @@
 51467 4267 8633 1733 0 0 ---- BALGUNTAY
 51495 4322 9173 732 0 0 ---- SHISANJIANFANG
 51542 4303 8415 2459 0 0 ---- BAYANBULAK
-51573 4293 8920 37 0 0 ---- TURPAN
+51573 4295 8923 39 0 0 ---- TURPAN
 51644 4172 8295 1084 0 0 T-T- KUQA
-51656 4175 8613 933 0 0 ---- KORLA
+51656 4173 8582 903 0 0 ---- KORLA
 51709 3947 7575 1387 0 0 T-T- KASHI
 51711 4093 7845 1986 0 0 ---- AKQI
 51716 3979 7856 1117 0 0 ---- BACHU
@@ -7389,7 +7430,7 @@
 53068 4363 11195 966 0 0 T-T- ERENHOT
 53083 4462 11415 1183 0 0 ---- NARAN BULAG
 53149 4253 11013 1223 0 0 ---- MANDAL
-53192 4402 11495 1127 0 0 ---- ABAG QI
+53192 4402 11500 1148 0 0 ---- ABAG QI
 53231 4145 10638 1510 0 0 ---- HAILS
 53276 4240 11290 1152 0 0 ---- JURH
 53336 4157 10852 1290 0 0 ---- HALIUT
@@ -7539,7 +7580,7 @@
 56671 2665 10225 1788 0 0 ---- HUILI
 56684 2640 10325 2189 0 0 ---- HUIZE
 56691 2687 10428 2236 0 0 T-T- WEINING
-56739 2498 9850 1697 0 0 ---- TENGCHONG
+56739 2498 9851 1697 0 0 T-T- TENGCHONG
 56739 2498 9851 1697 0 0 T-T- TENGCHONG
 56748 2512 9918 1649 0 0 ---- BAOSHAN
 56751 2570 10018 1992 0 0 ---- DALI
@@ -7557,7 +7598,7 @@
 56966 2360 10198 398 0 0 ---- YUANJIANG
 56969 2150 10158 633 0 0 ---- MENGLA
 56977 2262 10182 1121 0 0 ---- JIANGCHENG
-56985 2338 10338 1302 0 0 T-T- MENGZI
+56985 2344 10333 1314 0 0 T-T- MENGZI
 57006 3458 10575 1143 0 0 ---- TIANSHUI
 57014 3457 10587 1085 0 0 ---- BEIDAO
 57016 3435 10713 610 0 0 ---- BAOJI
@@ -7583,7 +7624,7 @@
 57348 3102 10953 303 0 0 ---- FENGJIE
 57378 3117 11257 66 0 0 ---- ZHONGXIANG
 57399 3113 11495 75 0 0 ---- MACHENG
-57411 3080 10608 310 0 0 ---- NANCHONG
+57411 3075 10613 347 0 0 ---- GAOPING
 57426 3068 10780 455 0 0 ---- LIANGPING
 57447 3028 10947 458 0 0 T-T- ENSHI
 57461 3073 11137 258 0 0 T-T- YICHANG
@@ -7623,7 +7664,7 @@
 57922 2583 10755 1016 0 0 ---- DUSHAN
 57932 2597 10853 287 0 0 ---- RONGJIANG
 57957 2533 11030 166 0 0 T-T- GUILIN
-57972 2580 11303 185 185 0 T-T- CHENZHOU
+57972 2574 11297 369 0 0 T-T- CHENZHOU
 57993 2587 11500 138 0 0 ---- GANZHOU
 57993 2587 11500 134 0 0 T-T- GANZHOU
 58027 3428 11715 42 0 0 T-T- XUZHOU
@@ -7807,7 +7848,7 @@
 60376 3678 325 0 0 0 ---- BORDJ EL BAHRI
 60379 3677 333 0 0 0 ---- REGHAIA
 60380 3661 292 0 0 0 ---- TESSALA EL MERDJA
-60381 3672 305 0 0 0 ---- EL HARRACH
+60381 3672 315 0 51 0 ---- EL HARRACH
 60387 3692 395 8 5 0 ---- DELLYS
 60390 3668 322 29 25 0 T-T- DAR-EL-BEIDA
 60393 3670 320 0 0 0 ---- DAR EL BEIDA VILLE
@@ -7840,7 +7881,7 @@
 60490 3563 -60 91 91 0 ---- ORAN-SENIA
 60492 3575 62 96 94 0 ---- RELIZANE
 60506 3560 30 476 474 0 ---- MASCARA-MATEMORE
-60507 3522 23 513 516 0 ---- MASCARA-GHRISS
+60507 3535 15 513 516 0 ---- MASCARA-GHRISS
 60511 3535 147 978 989 2 ---- TIARET
 60514 3517 231 800 801 2 ---- KSAR CHELLALA
 60515 3533 420 461 459 0 ---- BOU-SAADA
@@ -7852,7 +7893,7 @@
 60531 3502 -147 247 248 0 ---- TLEMCEN-ZENATA
 60535 3315 338 1185 1180 2 ---- DJELFA
 60536 3486 15 752 750 2 ---- SAIDA
-60540 3353 7 1001 1000 2 ---- EL-KHEITER
+60540 3415 7 1001 1000 2 ---- EL-KHEITER
 60545 3377 293 763 762 2 ---- LAGHOUAT
 60549 3353 -28 1124 1123 2 ---- MECHERIA
 60550 3367 100 1347 1341 2 ---- EL-BAYADH
@@ -7985,7 +8026,7 @@
 61415 2093 -1703 3 5 0 PPTP NOUADHIBOU
 61421 2052 -1307 224 226 0 PPPP ATAR
 61437 1975 -1437 120 123 0 ---- AKJOUJT
-61442 1810 -1595 3 2 0 PPPP NOUAKCHOTT
+61442 1810 -1595 3 2 0 PPTP NOUAKCHOTT
 61450 1857 -1143 402 396 0 ---- TIDJIKJA
 61461 1753 -1468 75 77 0 ---- BOUTILIMIT
 61470 1705 -1292 0 45 0 ---- ALEG
@@ -8009,7 +8050,7 @@
 61698 1288 -1497 0 8 0 ---- KOLDA
 61699 1257 -1222 0 165 0 ---- KEDOUGOU
 61701 1320 -1663 33 36 0 --P- BANJUL/YUNDUM
-61705 1322 -1620 0 0 0 ---- SIBANOR
+61705 1322 -1620 21 0 0 ---- SIBANOR
 61707 1348 -1557 11 11 0 ---- JENOI
 61711 1345 -1645 2 1 0 ---- BANJUL/HALF-DIE
 61712 1348 -1618 15 15 0 ---- KEREWAN
@@ -8018,7 +8059,7 @@
 61721 1353 -1477 1 1 0 ---- GEORGETOWN
 61722 1357 -1593 2 2 0 ---- SAPU
 61731 1332 -1422 4 4 0 --P- BASSE
-61733 1388 -1340 0 0 0 ---- FATOTO
+61733 1367 -1447 18 0 0 ---- FATOTO
 61766 1188 -1565 36 39 0 ---- BISSAU AEROPORTO
 61769 1158 -1548 20 18 0 ---- BOLAMA
 61770 1222 -1567 10 0 0 ---- BISSORA
@@ -8059,8 +8100,8 @@
 61972 -2234 4034 6 6 0 ---- ILE EUROPA
 61974 -1038 5660 4 3 4 ---- AGALEGA
 61976 -1589 5452 13 7 0 ---- SERGE-FROLOW (ILE TROMELIN)
-61978 -2119 5557 0 1712 0 ---- PITON VILLERS
-61979 -2091 5542 0 742 0 ---- LE COLORADO
+61978 -2119 5557 0 1712 0 ---- PITON VILLERS RADAR
+61979 -2091 5542 0 742 0 ---- LE COLORADO RADAR
 61980 -2089 5553 13 20 0 --T- SAINT-DENIS/GILLOT (REUNION)
 61982 -2091 5559 75 0 1 ---- ST. DENIS, REUNION
 61986 -1645 5962 4 2 4 ---- ST. BRANDON (RAPHAEL ISLAND)
@@ -8071,7 +8112,7 @@
 61996 -3779 7756 29 27 0 ---- MARTIN DE VIVIES (ILE AMSTERDAM)
 61997 -4643 5186 146 146 0 ---- ALFRED FAURE (ILES CROZET)
 61998 -4935 7023 30 29 0 --T- PORT-AUX-FRANCAIS (ILES KERGUELEN)
-62002 3187 1098 621 620 2 ---- NALUT
+62002 3187 1098 621 0 2 ---- NALUT
 62007 3288 1208 3 3 0 ---- ZUARA
 62008 3208 1255 691 691 2 ---- YEFREN
 62010 3270 1308 0 63 0 ---- TRIPOLI INTERNATIONAL AIRPORT
@@ -8079,7 +8120,7 @@
 62011 3215 1301 0 729 0 ---- GARIAN
 62012 3263 1430 22 21 0 ---- EL KHOMS
 62014 3173 1402 259 0 0 ---- BENWLID
-62016 3242 1505 32 32 0 ---- MISURATA
+62016 3242 1522 32 32 0 ---- MISURATA
 62018 3057 1572 90 0 0 ---- ABU NJAYM
 62019 3120 1657 14 13 0 ---- SIRTE
 62053 3210 2027 132 131 0 T-T- BENINA
@@ -8113,7 +8154,7 @@
 62332 3128 3224 6 2 0 ---- PORT SAID/EL GAMIL
 62335 3121 3421 75 73 0 ---- RAFAH-AGRIMET
 62336 3109 3382 17 27 0 ---- EL ARISH-AGRIMET
-62337 3107 3384 32 37 0 T--- EL ARISH
+62337 3107 3384 32 37 0 --T- EL ARISH
 62339 3103 3047 0 2 0 ---- DAMANHOUR
 62345 3065 3070 16 16 0 ---- TAHRIR
 62354 3058 3150 13 8 0 ---- ZAGAZIG
@@ -8123,7 +8164,7 @@
 62369 3014 3126 17 17 0 ---- BAHTIM AGRIMET
 62371 3008 3128 26 34 0 ---- CAIRO H.Q
 62375 3005 3122 23 19 0 ---- GIZA - AGRIMET
-62378 2986 3135 141 139 0 --T- HELWAN
+62378 2986 3135 141 139 0 T--- HELWAN
 62381 2930 3085 23 23 0 ---- FAYOUM
 62387 2808 3073 41 37 0 ---- MINYA
 62389 2770 3075 45 44 0 ---- MALWY - AGRIMET
@@ -8312,7 +8353,7 @@
 63971 -1027 4018 113 113 0 -PT- MTWARA
 63980 -467 5552 3 3 0 ---- SEYCHELLES INTERNATIONAL AIRPORT
 63981 -532 5568 3 3 0 ---- PRASLIN
-63985 -468 5552 4 4 0 T-T- SEYCHELLES INTER. AIRPORT (RAWINSONDE STATION)
+63985 -468 5552 4 4 0 --T- SEYCHELLES INTER. AIRPORT (RAWINSONDE STATION)
 63994 -569 5365 3 3 0 ---- DESROCHES
 63995 -935 4653 4 4 0 ---- ALDABRA
 63996 -1010 5117 3 3 0 ---- FARQUHAR
@@ -8396,7 +8437,7 @@
 64460 206 1403 550 549 0 ---- SOUANKE
 64462 10 1355 408 0 0 ---- KELLE
 64463 -558 1482 438 0 0 ---- EWO
-64500 45 942 15 12 0 ---- LIBREVILLE
+64500 45 942 15 12 0 --T- LIBREVILLE
 64501 -70 875 4 4 0 ---- PORT-GENTIL
 64503 -342 1065 34 31 0 ---- MAYUMBA
 64504 100 960 0 16 0 ---- COCOBEACH
@@ -8435,7 +8476,7 @@
 64707 1365 1650 0 301 0 ---- MOUSSORO
 64708 1238 1705 301 300 0 ---- BOKORO
 64709 936 1497 320 467 0 ---- PALA
-64750 915 1838 365 365 0 -PP- SARH
+64750 915 1838 365 365 0 -PT- SARH
 64751 1322 1832 334 333 0 ---- ATI
 64753 1800 1917 234 235 0 ---- FAYA
 64754 1103 2028 436 433 0 ---- AM-TIMAN
@@ -8507,7 +8548,7 @@
 65252 548 700 0 91 0 ---- OWERRI
 65254 548 755 0 122 0 ---- UMUAHIA
 65257 647 755 142 0 0 --T- ENUGU
-65260 550 792 38 0 0 ---- UYO
+65260 505 792 38 37 0 ---- UYO
 65264 497 835 0 62 0 ---- CALABAR
 65271 773 852 113 0 0 ---- MAKURDI
 65272 667 880 117 0 0 ---- OGOJA
@@ -8515,11 +8556,11 @@
 65274 660 932 0 285 0 ---- OBUDU
 65275 667 880 0 117 0 ---- OGOJA
 65306 1113 293 292 290 0 PPPP KANDI
-65319 1032 138 461 460 0 ---- NATITINGOU
+65319 1032 138 461 460 0 ---- PEPORIYAKOU-NATITINGOU
 65330 935 262 393 392 0 PPPP PARAKOU
 65335 802 247 200 199 0 ---- SAVE
 65338 717 206 167 166 0 ---- BOHICON
-65344 635 238 9 5 0 PPPP COTONOU
+65344 635 238 9 5 0 PPTP COTONOU
 65351 1087 25 330 329 0 ---- DAPAON
 65352 1037 47 146 145 0 ---- MANGO
 65355 977 110 343 342 0 ---- NIAMTOUGOU
@@ -8565,7 +8606,7 @@
 65528 950 -757 421 434 0 ---- ODIENNE
 65536 942 -562 381 381 0 ---- KORHOGO
 65545 805 -278 370 369 0 ---- BONDOUKOU
-65548 738 -752 340 339 0 PPPP MAN
+65548 738 -752 340 339 0 PPTP MAN
 65555 773 -507 376 376 0 ---- BOUAKE
 65557 613 -595 210 205 0 ---- GAGNOA
 65560 687 -647 277 276 0 ---- DALOA
@@ -8580,7 +8621,7 @@
 65660 625 -1035 18 8 0 ---- ROBERTS FIELD
 66104 -555 1218 20 25 0 ---- CABINDA
 66116 -587 1343 0 0 0 ---- NOQUI
-66118 -627 1425 0 0 0 ---- NBANZA-KONGO
+66118 -627 1425 567 0 0 ---- NBANZA-KONGO
 66121 -603 1512 920 920 2 ---- MAQUELA DO ZOMBO
 66130 -723 1287 17 18 0 ---- N'ZETO (AMBRIZETE)
 66136 -717 1427 0 540 0 ---- TOTO
@@ -8790,15 +8831,22 @@
 68018 -1792 1977 0 1102 2 ---- RUNDU
 68024 -2170 2165 1100 1131 2 ---- GHANZI
 68026 -1837 2185 1000 1032 2 ---- SHAKAWE
+68027 -1936 2228 970 0 0 ---- TUBU
+68028 -1902 2397 931 0 0 ---- MABABE
 68029 -1782 2515 1000 968 2 ---- KASANE
 68030 -1853 2563 1071 0 0 ---- PANDAMATENGA
 68031 -1932 2342 0 964 0 ---- MOREMI
 68032 -1998 2342 900 945 2 ---- MAUN
 68034 -2025 2508 0 927 0 ---- GWETA
-68038 -2056 2622 904 903 2 -PP- SUA-PAN
+68035 -2020 2526 998 0 0 ---- GWETA
+68037 -2013 2722 1045 0 0 ---- MAITENGWE
+68038 -2055 2608 904 903 2 -PP- SUA-PAN
 68040 -2142 2560 985 986 2 ---- LETLHAKANE
 68054 -2132 2747 0 1009 2 ---- FRANCISTOWN
 68070 -2205 2782 892 0 0 ---- SELEBI-PHIKWE
+68084 -2234 2303 996 0 0 ---- XADE
+68086 -2241 2672 1100 0 0 ---- SEROWE
+68088 -2249 2870 840 0 0 ---- BAINES DRIFT
 68098 -2298 1465 88 88 0 ---- WALVIS BAY AIRPORT
 68102 -2011 1614 0 1250 2 ---- OUTJO
 68104 -2288 1443 0 7 0 ---- WALVIS BAY (PELICAN POINT)
@@ -8809,6 +8857,7 @@
 68112 -2248 1747 0 1719 2 ---- HOSEA KUTAKO INTERNATIONAL AIRPORT
 68114 -2142 1593 1217 1217 2 ---- OMARURU
 68116 -2247 1897 0 1445 2 ---- GOBABIS
+68140 -2313 2027 1240 0 0 ---- NCOJANE
 68148 -2308 2680 1006 991 2 ---- MAHALAPYE
 68151 -2336 2585 0 1020 0 ---- LEPHEPE
 68155 -2368 2770 839 839 2 ---- LEPHALALE
@@ -8828,8 +8877,10 @@
 68194 -2245 3132 202 202 0 ---- PAFURI
 68196 -2268 3102 457 0 0 ---- PUNDA MARIA
 68212 -2450 1787 1100 1108 2 ---- MARIENTAL
+68218 -2371 2108 1172 0 0 ---- NGWATLE
 68220 -2367 2417 0 1100 0 ---- KHUTSE
 68226 -2402 2188 1100 1118 2 ---- TSHANE
+68228 -2406 2330 1096 0 0 ---- MOTOKWE
 68234 -2460 2467 1200 1189 2 ---- JWANENG
 68239 -2583 2353 1181 1182 2 ---- POMFRET
 68240 -2455 2592 0 1005 0 PPTP SERETSE KHAMA INTERNATIONAL AIRPORT
@@ -8866,6 +8917,7 @@
 68320 -2527 2325 1000 1046 2 ---- WERDA
 68322 -2647 2061 882 882 2 ---- TWEE RIVIEREN
 68325 -2545 2542 1000 1275 2 ---- GOOD HOPE
+68326 -2687 2071 863 0 0 ---- VAALHOEK
 68328 -2605 2245 1000 960 2 ---- TSABONG
 68329 -2688 2205 938 930 2 ---- VAN ZYLSRUS
 68331 -2767 2301 1186 1186 2 ---- KATHU
@@ -9044,76 +9096,77 @@
 68992 -5440 328 42 42 0 ---- BOUVET ISLAND
 68994 -4688 3786 24 0 0 T-T- MARION ISLAND
 68999 -3396 1860 46 46 0 ---- CT-AWS
-70026 7129 -15676 16 15 0 T-T- BARROW/W. POST W. ROGERS, AK
+70026 7129 -15678 12 12 0 T-T- BARROW/W. POST W. ROGERS
+70027 0 0 0 7 0 TTTT BARROW ARM,NSA
 70086 7013 -14363 15 2 0 ---- BARTER ISLAND
 70104 6888 -16613 0 3 0 ---- CAPE LISBURNE AFS
 70116 6562 -16805 5 9 0 ---- WALES
 70117 6556 -16792 0 83 0 ---- TIN CITY AFS
 70119 6525 -16687 5 3 0 ---- PORT CLARENCE
 70121 6981 -16291 0 0 0 ---- POINT LAY
-70133 6689 -16260 5 5 0 T-T- KOTZEBUE, RALPH WIEN
+70133 6689 -16261 5 5 0 T-T- KOTZEBUE, RALPH WIEN
 70162 6937 -15213 85 81 0 ---- UMIAT
 70173 6600 -15369 0 389 0 ---- INDIAN MOUNTAIN AFS
 70174 6692 -15152 196 196 0 ---- BETTLES
-70178 6518 -15211 67 69 0 ---- TANANA
+70178 6517 -15210 67 69 0 ---- TANANA
 70194 6656 -14527 135 0 0 ---- FORT YUKON
 70197 6548 -14466 252 0 0 PPPP CENTRAL, AK
-70200 6451 -16544 12 7 0 T-T- NOME, AK
+70200 6451 -16543 12 7 0 T-T- NOME, AK
 70207 6388 -16080 6 6 0 ---- UNALAKLEET
 70212 6178 -16603 0 146 0 ---- CAPE ROMANZOFF AFS
 70218 6000 -16600 0 0 0 ---- NUNIVAK
 70219 6078 -16184 42 33 0 T-T- BETHEL/BETHEL AIRPORT, AK
 70222 6473 -15693 49 46 0 ---- GALENA A.
-70231 6295 -15560 103 103 0 T-T- MCGRATH, AK
+70231 6296 -15560 103 103 0 T-T- MCGRATH, AK
 70232 6158 -15953 26 26 0 ---- ANIAK
 70235 6110 -15557 0 484 0 ---- SPARREVOHN AFS
 70246 6390 -15227 214 208 0 ---- MINCHUMINA
 70248 6252 -15388 458 468 0 ---- FAREWELL/INTERMEDIATE FIELD
 70249 6210 -15275 0 560 0 ---- PUNTILLA
-70251 6232 -15009 109 109 0 ---- TALKEETNA
+70251 6230 -15010 109 109 0 ---- TALKEETNA
 70252 6230 -15041 151 0 0 PPPP TALKEETNA, AK
-70259 6057 -15124 29 28 0 ---- KENAI, AK
-70260 6455 -14907 0 110 0 T-T- NENANA/MUN.
-70261 6481 -14786 135 134 0 T-T- FAIRBANKS/INT., AK
+70259 6057 -15125 29 28 0 ---- KENAI
+70260 6455 -14908 0 110 0 ---- NENANA/MUN.
+70261 6481 -14788 135 134 0 T-T- FAIRBANKS/INT., AK
 70264 6333 -14913 0 734 0 ---- SUMMIT
 70265 6465 -14707 167 0 0 ---- FAIRBANKS/EIELSON AFB
 70266 6397 -14569 398 0 0 T-TT FORT GREELY, AK
-70267 6399 -14572 391 0 0 ---- FORT GREELY/ALLEN AAF, AK
+70267 6400 -14572 391 0 0 ---- FORT GREELY/ALLEN AAF, AK
 70268 6210 -14597 573 0 0 PPPP GLENNALLEN, AK
 70270 6127 -14965 115 0 0 ---- FT. RICHARDSON/BRYANT AHP, AK
-70271 6215 -14546 481 481 0 ---- GULKANA/INTL. FLD, AK
+70271 6215 -14544 481 481 0 ---- GULKANA/INTL. FLD
 70272 6125 -14980 59 0 0 ---- ANCHORAGE/ELMENDORF AFB
-70273 6118 -14999 44 52 0 T-T- ANCHORAGE/INT., AK
-70274 6160 -14909 0 71 0 ---- PALMER
+70273 6116 -14999 44 52 0 T-T- ANCHORAGE/INT., AK
+70274 6160 -14908 0 71 0 ---- PALMER
 70275 6113 -14635 10 11 0 ---- VALDEZ
 70277 6012 -14944 18 9 0 ---- SEWARD
 70279 6023 -14665 56 56 0 ---- CAPE HINCHINBROOK
-70291 6296 -14193 525 523 0 ---- NORTHWAY
-70296 6049 -14547 13 12 0 ---- CORDOVA/MILE 13
+70291 6297 -14193 525 523 0 ---- NORTHWAY
+70296 6050 -14550 13 12 0 ---- CORDOVA/MILE 13
 70298 6008 -14250 11 4 0 ---- YAKATAGA
 70305 5865 -16207 0 161 0 ---- CAPE NEWENHAM AFS
-70308 5717 -17022 10 6 0 T-T- ST. PAUL ISLANDS, AK
-70316 5521 -16272 32 25 0 T-T- COLD BAY, AK
+70308 5715 -17022 9 10 0 T-T- ST. PAUL ISLANDS, AK
+70316 5520 -16272 32 25 0 T-T- COLD BAY, AK
 70321 5905 -15852 29 26 0 ---- DILLINGHAM MUNI, AK
-70326 5868 -15665 16 8 0 T-T- KING SALMON, AK
+70326 5868 -15666 16 8 0 T-T- KING SALMON, AK
 70333 5695 -15862 0 29 0 ---- PORT HEIDEN
-70340 5975 -15491 49 63 0 ---- ILIAMNA/ILIAMNA AIRPORT, AK
-70341 5965 -15147 22 24 0 ---- HOMER/MUNICIPAL, AK
+70340 5975 -15491 49 63 0 ---- ILIAMNA/ILIAMNA AIRPORT
+70341 5963 -15150 22 24 0 ---- HOMER/MUNICIPAL
 70343 5943 -14633 14 27 0 ---- MIDDLETON ISLAND, AK
-70350 5775 -15249 34 6 0 T-T- KODIAK, AK
-70361 5950 -13966 14 12 0 T-T- YAKUTAT, AK
-70362 5946 -13531 5 16 0 ---- SKAGWAY
+70350 5774 -15249 35 5 0 T-T- KODIAK, AK
+70361 5952 -13966 13 11 0 T-T- YAKUTAT, AK
+70362 5947 -13530 5 16 0 ---- SKAGWAY
 70367 5842 -13572 9 11 0 ---- GUSTAVUS
-70371 5705 -13536 20 6 0 ---- SITKA
-70381 5836 -13457 7 5 0 ---- JUNEAU
+70371 5707 -13535 20 6 0 ---- SITKA
+70381 5837 -13458 7 5 0 ---- JUNEAU
 70383 5750 -13458 11 0 0 ---- ANGOON
 70385 5727 -13362 11 0 0 ---- FIVE FINGER LIGHT
 70386 5682 -13297 0 0 0 ---- PETERSBURG
 70387 5648 -13237 13 13 0 ---- WRANGELL
-70395 5535 -13171 29 29 0 ---- KETCHIKAN, INTL.
-70398 5504 -13157 34 35 0 T-T- ANNETTE ISLAND, AK
+70395 5535 -13169 29 29 0 ---- KETCHIKAN, INTL.
+70398 5504 -13158 35 35 0 T-T- ANNETTE ISLAND, AK
 70409 5283 17318 0 21 0 ---- ATTU
-70414 5271 17411 31 29 0 T-T- SHEMYA AFB
+70414 5272 17410 31 29 0 T-T- SHEMYA AFB
 70482 5295 -16885 0 21 0 ---- NIKOLSKI
 71001 6137 -13904 0 805 0 ---- BURWASH A, YT
 71002 5356 -6411 0 440 0 ---- CHURCHILL FALLS A, NFLD
@@ -9237,6 +9290,7 @@
 71123 5332 -11358 0 723 0 ---- EDMONTON INT'L A, ALTA
 71124 5355 -11410 0 766 0 ---- EDMONTON STONY PLAIN CS, ALTA
 71125 5413 -10852 0 481 0 ---- MEADOW LAKE A, SASK
+71126 5355 -11411 0 766 0 T-T- EDMONTON STONY PLAIN, ALTA
 71127 5355 -11411 0 766 0 ---- EDMONTON STONY PLAIN CS, ALTA
 71129 5152 -10918 0 694 0 ---- KINDERSLEY A, SASK
 71130 5333 -10401 0 372 0 ---- NIPAWIN, SASK
@@ -10053,287 +10107,288 @@
 71989 7623 -11935 0 2 0 ---- MOULD BAY CS, NWT
 71990 6324 -13004 0 1379 0 ---- MACMILLAN PASS, YT
 71999 5068 -12193 243 240 0 ---- LILLOOET, BC
-72201 2456 -8176 6 2 0 T-T- KEY WEST/INT., FL
+72201 2455 -8179 5 13 0 T-T- KEY WEST/INT., FL
 72202 2575 -8038 5 4 0 ---- MIAMI, FL
 72202 2575 -8038 5 4 0 T-T- MIAMI, FL
-72203 2668 -8009 6 7 0 T-T- WEST PALM BEACH/ INT. FL.
-72205 2842 -8131 32 29 0 T-T- ORLANDO/JETPORT FL.
+72203 2668 -8009 6 7 0 ---- WEST PALM BEACH/ INT. FL.
+72205 2843 -8131 32 29 0 ---- ORLANDO/JETPORT FL.
 72206 3048 -8170 11 10 0 T-T- JACKSONVILLE/INTNL.,  FL.
-72207 3213 -8120 16 15 0 T-T- SAVANNAH/MUNICIPAL,  GA.
-72208 3290 -8004 14 13 0 T-T- CHARLESTON/MUN., SC.
+72207 3213 -8120 15 15 0 ---- SAVANNAH/MUNICIPAL,  GA.
+72208 3290 -8003 14 13 0 T-T- CHARLESTON/MUN., SC.
 72209 3188 -8156 14 14 0 TPTP FT. STEWART, GA
-72210 2771 -8240 15 13 0 T-T- TAMPA BAY, FL.
-72211 2798 -8253 0 8 0 T-T- TAMPA/INT., FL.
-72212 2963 -8311 13 13 0 T-T- CROSS CITY/CROSS CITY A., FL.
+72210 2771 -8240 15 13 0 T-T- TAMPA BAY AREA, FL.
+72211 2797 -8253 3 8 0 ---- TAMPA/INT., FL.
+72212 2962 -8310 13 13 0 ---- CROSS CITY/CROSS CITY A., FL.
 72213 3125 -8240 46 46 0 ---- WAYCROSS/WARE CO., GA
-72214 3039 -8435 53 53 0 T-T- TALLAHASSEE/MUN.,  FL.
-72215 3336 -8457 257 245 0 T-T- PEACHTREE CITY, GA.
-72216 3154 -8419 59 60 0 ---- ALBANY/MUN., GA
-72217 3269 -8365 110 108 0 T-T- MACON/LEWIS B.WILSON, GA.
-72218 3336 -8196 45 44 0 T-T- AUGUSTA/BUSH FIELD,  GA.
-72219 3364 -8443 315 312 0 T-T- ATLANTA/MUN., GA.
-72220 2973 -8502 6 6 0 ---- APALACHICOLA/MUN.,  FL.
+72214 3045 -8430 53 53 0 T-T- TALLAHASSEE/MUN.,  FL.
+72215 3336 -8457 245 245 0 T-T- PEACHTREE CITY, GA.
+72216 3153 -8418 59 60 0 ---- ALBANY/MUN., GA
+72217 3270 -8365 110 108 0 ---- MACON/LEWIS B.WILSON, GA.
+72218 3336 -8197 45 44 0 ---- AUGUSTA/BUSH FIELD,  GA.
+72219 3365 -8442 315 312 0 ---- ATLANTA/MUN., GA.
+72220 2973 -8503 6 6 0 ---- APALACHICOLA/MUN.,  FL.
 72221 3048 -8652 29 0 0 --T- VALPARAISO/EGLIN AFB, FL.
 72222 3048 -8718 38 36 0 ---- PENSACOLA, FL
-72223 3069 -8824 67 66 0 T-T- MOBILE/BATES FIELD,  AL.
+72223 3068 -8825 67 66 0 ---- MOBILE/BATES FIELD,  AL.
 72224 2968 -8537 0 2 0 P-T- CAPE SAN BLAS, FL.
 72225 3233 -8483 130 0 0 --TT FORT BENNING, GA (ARMY)
-72226 3229 -8641 62 67 0 T-T- MONTGOMERY/DANNELLY,  AL.
+72226 3229 -8640 62 67 0 ---- MONTGOMERY/DANNELLY,  AL.
 72227 3392 -8452 326 0 0 ---- MARIETTA/DOBBINS AFB, GA.
-72228 3357 -8674 192 196 0 T-T- BIRMINGHAM/MUN., AL.
+72228 3357 -8675 192 196 0 ---- BIRMINGHAM/MUN., AL.
 72229 3290 -8725 140 140 0 ---- CENTREVILLE, AL.
 72230 3318 -8678 175 174 0 T-T- BIRMINGHAM, AL
-72231 2999 -9026 7 1 0 T-T- NEW ORLEANS/MOISANT INT., LA.
+72231 2998 -9025 9 1 0 ---- NEW ORLEANS/MOISANT INT., LA.
 72232 3054 -9115 21 0 0 ---- BATON ROUGE, LA, BATON ROUGE METROPOLITAN, RYAN FIELD ARPT
 72233 3034 -8982 11 10 0 T-T- SLIDELL/MUN. LA
-72234 3233 -8874 94 91 0 T-T- MERIDIAN/KEY, MS.
+72234 3233 -8875 94 91 0 ---- MERIDIAN/KEY, MS.
 72235 3232 -9008 91 91 0 T-T- JACKSON/ALLEN C. THOMPSON FIELD, MS.
-72239 3104 -9319 3 0 0 --T- FORT POLK, LA. (ARMY)
-72240 3013 -9322 6 5 0 T-T- LAKE CHARLES/MUN.,  LA.
-72241 2995 -9402 5 5 0 T-T- PORT ARTHUR/JEFFERSON CO., TX.
-72242 2926 -9486 16 2 0 ---- GALVESTON, TX.
-72243 2998 -9534 33 30 0 T-T- HOUSTON/INTERCONTINENTAL, TX.
+72239 3103 -9303 110 0 0 --T- FORT POLK, LA. (ARMY)
+72240 3013 -9322 6 5 0 T-T- LAKE CHARLES/MUN., LA.
+72241 2995 -9402 7 5 0 ---- PORT ARTHUR/JEFFERSON CO., TX.
+72242 2930 -9480 16 2 0 ---- GALVESTON, TX.
+72243 2997 -9535 33 30 0 ---- HOUSTON/INTERCONTINENTAL, TX.
 72244 2964 -9528 15 0 0 ---- HOUSTON, TX WILLIAM P HOBBY ARPT
-72247 3238 -9471 0 124 0 T-T- LONGVIEW, TX.
-72248 3245 -9382 85 85 0 T-T- SHREVEPORT/REG., LA.
+72247 3235 -9465 124 124 0 ---- LONGVIEW, TX
+72248 3245 -9384 85 85 0 T-T- SHREVEPORT/REG., LA.
 72249 3284 -9730 199 195 0 T-T- FORT WORTH, TX.
-72250 2591 -9743 8 7 0 T-T- BROWNSVILLE/INT., TX
-72251 2778 -9751 15 15 0 T-T- CORPUS CHRISTI/INT.,  TX.
-72253 2953 -9847 242 247 0 T-T- SAN ANTONIO/INT.,  TX.
+72250 2592 -9742 8 7 0 T-T- BROWNSVILLE/INT., TX
+72251 2778 -9751 15 15 0 T-T- CORPUS CHRISTI/INT., TX.
+72253 2953 -9847 242 247 0 ---- SAN ANTONIO/INT., TX.
 72254 3030 -9770 189 193 0 ---- AUSTIN/CTY, TX.
-72255 2885 -9692 36 32 0 T-T- VICTORIA/VICTORIA REGIONAL, TX.
-72256 3161 -9723 155 157 0 T-T- WACO, MADISON-COOPER,  TX.
+72255 2885 -9692 36 32 0 ---- VICTORIA/VICTORIA REGIONAL, TX.
+72256 3162 -9722 155 157 0 ---- WACO, MADISON-COOPER, TX.
 72257 3110 -9733 270 0 0 --T- FORT HOOD, TX. (ARMY)
 72258 3285 -9685 156 0 0 ---- DALLAS, TX, DALLAS LOVE FIELD ARPT
-72259 3290 -9704 182 182 0 T-T- DALLAS-FORT WORTH/FORT WORTH REG.AIRPORT, TX.
+72259 3290 -9703 182 182 0 ---- DALLAS-FORT WORTH/FORT WORTH REG.AIRPORT, TX.
 72260 3222 -9818 402 402 0 ---- STEPHENVILLE/CLARK FIELD MUN., TX.
 72261 2937 -10092 315 314 0 T-T- DEL RIO/INT., TX.
-72262 3183 -10480 0 1662 0 T-T- GUADELUPE PASS, TX.
+72262 3183 -10480 0 1662 0 ---- GUADELUPE PASS, TX.
 72262 3183 -10481 0 1692 0 T-T- PINE SPRINGS, TX
-72263 3137 -10049 582 584 0 T-T- SAN ANGELO/MATHIS,  TX.
+72263 3137 -10050 582 584 0 ---- SAN ANGELO/MATHIS, TX.
 72264 3037 -10402 1481 1478 0 ---- MARFA/MUN., TX.
 72265 3194 -10219 874 875 0 T-T- MIDLAND/MIDLAND REG. AIR TERM., TX.
-72266 3240 -9968 546 542 0 T-T- ABILENE/MUN., TX.
-72267 3365 -10181 988 996 0 T-T- LUBBOCK/LUBBOCK INTERNATIONAL, TX.
-72268 3329 -10453 1118 1118 0 T-TP ROSWELL/INDUSTRIAL AIR CENTER, NM
+72266 3242 -9968 546 542 0 ---- ABILENE/MUN., TX.
+72267 3365 -10182 988 996 0 ---- LUBBOCK/LUBBOCK INTERNATIONAL, TX.
+72268 3329 -10453 1118 1118 0 ---P ROSWELL/INDUSTRIAL AIR CENTER, NM
 72269 3238 -10648 1244 0 0 -TTT WHITE SANDS, NM.
-72270 3181 -10638 1194 1206 0 T-T- EL PASO/INT., TX.
-72271 3324 -10727 1481 1481 0 ---- TRUTH OR CONSEQUENCES, NM
+72270 3180 -10640 1194 1206 0 ---- EL PASO/INT., TX.
+72271 3322 -10727 1481 1481 0 ---- TRUTH OR CONSEQUENCES, NM
 72272 3147 -10960 1251 0 0 ---- DOUGLAS BISBEE, AZ, BISBEE DOUGLAS INT. ARPT
 72273 3158 -11033 1428 0 0 ---P FORT HUACHUCA, AZ.
-72274 3213 -11096 747 741 0 T-T- TUCSON, AZ.
-72278 3343 -11200 337 344 0 T-T- PHOENIX/SKY HARBOR,  INT, AZ.
+72274 3222 -11096 747 751 0 T-T- TUCSON, AZ
+72278 3343 -11202 337 344 0 ---- PHOENIX/SKY HARBOR,  INT, AZ.
 72280 3265 -11460 34 0 0 --P- YUMA/YUMA INT., AZ.
 72281 3282 -11568 18 0 0 ---- EL CENTRO NAF, CA.
 72286 3390 -11725 468 0 0 ---- RIVERSIDE/MARCH AFB. CA.
 72288 3420 -11836 0 0 0 ---- BURBANK, CA
 72289 3422 -11807 0 1739 0 ---- MOUNT WILSON, CA.
-72290 3272 -11718 9 5 0 T-T- SAN DIEGO/LINDBERGH,  CA.
-72291 3325 -11945 174 153 0 ---T SAN NICOLAS IS./NF,  CA.
+72290 3272 -11717 9 5 0 ---- SAN DIEGO/LINDBERGH,  CA.
+72291 3327 -11955 9 9 0 ---T SAN NICOLAS IS./NF,  CA.
 72292 3340 -11842 0 0 0 ---- AVALON, CA
-72293 3286 -11714 135 137 0 T-T- SAN DIEGO/MIRAMAR,  NAS, CA.
-72295 3394 -11839 32 38 0 T-T- LOS ANGELES /INT.,  CA.
-72297 3381 -11815 12 18 0 T-T- LONG BEACH/LB AIRP. DAUGHERTY FIELD,  CA.
+72293 3283 -11712 134 134 0 T-T- SAN DIEGO/MIRAMAR,  NAS, CA.
+72295 3393 -11840 32 38 0 ---- LOS ANGELES /INT.,  CA.
+72297 3382 -11815 12 18 0 ---- LONG BEACH/LB AIRP. DAUGHERTY FIELD,  CA.
 72301 3574 -8139 357 0 0 ---- HICKORY, NC, HICKORY RGNL ARPT
 72302 3427 -7790 10 10 0 ---- WILMINGTON, NC.
 72303 3517 -7903 0 61 0 PPTT POPE AFB, NC.
 72304 3527 -7555 3 2 0 ---- CAPE HATTERAS, NC.
 72305 3478 -7688 11 11 0 T-T- NEWPORT, NC.
-72306 3588 -7879 134 132 0 T-T- RALEIGH/RALEIGH-DURHAM, NC.
+72306 3586 -7878 134 132 0 ---- RALEIGH/RALEIGH-DURHAM, NC.
 72307 3626 -7618 12 0 0 ---- ELIZABETH CITY, NC, ELIZABETH CITY CG AIR STATION-RGNL ARPT
-72308 3690 -7619 9 8 0 T-T- NORFOLK/INT., VA.
-72309 3485 -7688 13 0 0 ---- CHERRY POINT/MCAS,  NC.
-72310 3395 -8112 69 72 0 T-T- WEST COLUMBIA, SC.
-72311 3395 -8333 244 246 0 T-T- ATHENS/MUN., GA.
-72312 3490 -8221 296 293 0 T-T- GREER, SC.
-72314 3521 -8094 234 228 0 T-T- CHARLOTTE/DOUGLAS,  NC.
-72315 3543 -8254 661 659 0 ---- FLETCHER, NC
+72308 3690 -7620 9 8 0 ---- NORFOLK/INT., VA.
+72309 3485 -7688 13 0 0 ---- CHERRY POINT/MCAS, NC.
+72310 3395 -8112 69 72 0 ---- COLUMBIA, SC.
+72311 3395 -8332 247 246 0 ---- ATHENS/MUN., GA.
+72312 3490 -8222 296 293 0 ---- GREENVILLE/GREENVILLE SPARTANBURG, SC.
+72314 3522 -8093 234 228 0 ---- CHARLOTTE/DOUGLAS, NC.
+72315 3543 -8255 661 659 0 ---- ASHEVILLE/MUN., NC.
 72316 3154 -8251 44 0 0 ---- ALMA GA BACON COUNTY ARPT
 72317 3610 -7994 277 277 0 T-T- GREENSBORO/G.-HIGH PT., NC.
 72318 3720 -8041 642 639 0 T-T- BLACKSBURG, VA.
 72319 3449 -8270 240 0 0 ---- ANDERSON RGNL ARPT
 72320 3435 -8517 196 196 0 ---- ROME, GA
-72323 3464 -8679 196 191 0 T-T- HUNTSVILLE/MADISON CO., AL.
-72324 3502 -8520 210 208 0 T-T- CHATTANOOGA/LOVELL FIELD, TN.
+72323 3465 -8677 196 191 0 ---- HUNTSVILLE/MADISON CO., AL.
+72324 3503 -8520 210 208 0 ---- CHATTANOOGA/LOVELL FIELD, TN.
 72325 3595 -8508 571 0 0 ---- CROSSVILLE, TN, CROSVILLE MEMORIAL-WHITSON FIELD ARPT
-72326 3581 -8399 299 299 0 T-T- KNOXVILLE/MUN., TN.
+72326 3582 -8398 299 299 0 ---- KNOXVILLE/MUN., TN.
 72327 3622 -8655 173 180 0 ---- NASHVILLE/METROPOLITAN, TN.
 72327 3625 -8656 173 180 0 T-T- NASHVILLE/OLD HICKORY, TN.
 72328 3661 -8742 171 0 0 ---- CLARKSVILLE, TN OUTLASW FIELD ARPT
 72329 3722 -8957 103 0 0 ---- CAPE GIRARDEAU, MO, CAPE GIRARDEAU RGNL ARPT
 72330 3677 -9047 146 0 0 ---- POPLAR BLUFF, MO.
-72332 3427 -8877 110 110 0 ---- TUPELO/C.D. LEMONS MUN, MS
-72334 3506 -8998 87 101 0 T-T- MEMPHIS/INTNL., TN.
+72332 3427 -8877 0 110 0 ---- TUPELO/C.D. LEMONS MUN, MS
+72334 3504 -9000 87 101 0 ---- MEMPHIS/INTNL., TN.
 72335 3647 -8240 469 0 0 ---- BRISTOL-JOHNSON-KINGSPORT, TN, TRI-CITIES RGNL TN-VA ARPT
 72340 3484 -9226 173 173 0 T-T- LITTLE ROCK/ADAMS FLD,  AR.
 72341 3468 -9462 883 0 0 ---- PAGE, OK.
-72344 3533 -9436 141 143 0 T-T- FORT SMITH/MUN., AR.
+72344 3533 -9437 141 143 0 ---- FORT SMITH/MUN., AR.
 72345 3626 -9316 421 0 0 ---- HARRISON, AR, BOONE COUNTY ARPT
 72348 3672 -9185 308 307 0 ---- WEST PLAINS, MO
 72349 3690 -9402 437 437 0 ---- MONETTE, MO.
-72351 3399 -9849 314 309 0 T-T- WICHITA FALLS/SHEPS AFB/WICHITA FALLS/MUN., TX.
+72351 3397 -9848 314 309 0 ---- WICHITA FALLS/SHEPS AFB/WICHITA FALLS/MUN., TX.
 72352 3465 -9927 420 0 0 ---- ALTUS AFB, OK.
-72353 3539 -9760 397 395 0 T-T- OKLAHOMA CITY/W. ROGERS WORLD, OK.
+72353 3538 -9760 398 395 0 ---- OKLAHOMA CITY/W. ROGERS WORLD, OK.
 72354 3542 -9738 397 0 0 ---- TINKER AFB, OK.
 72355 3460 -9840 360 0 0 --TT FORT SILL, OK. (ARMY)
-72356 3620 -9589 195 207 0 T-T- TULSA/INT., OK.
+72356 3620 -9588 195 207 0 ---- TULSA/INT., OK.
 72357 3518 -9744 345 345 0 T-T- NORMAN/MAX WESTHEIMER A, OK.
-72360 3644 -10315 1515 1515 0 T-T- CLAYTON/MUN., NM.
+72360 3645 -10315 1515 1515 0 ---- CLAYTON/MUN., NM.
 72363 3522 -10171 1095 1095 0 T-T- AMARILLO/INTL., TX.
 72364 3187 -10670 1254 1254 0 T-T- SANTA TERESA, NM.
-72365 3504 -10661 1619 1619 0 T-T- ALBUQUERQUE/INT., NM.
+72365 3504 -10662 1619 1619 0 T-T- ALBUQUERQUE/INT., NM.
 72366 3443 -10029 595 0 0 ---- CHILDRESS, TX CHILDRESS MUNI ARPT
-72370 3526 -11394 1033 1050 0 T-T- KINGMAN/MOHAVE COUNTY A., AZ.
-72371 3694 -11145 1304 1314 0 T-T- PAGE/PAGE A., AZ
-72374 3503 -11072 1488 1505 0 T-T- WINSLOW, AZ.
-72376 3522 -11182 2182 2179 0 T-T- FLAGSTAFF, AZ
+72370 3527 -11393 1033 1050 0 ---- KINGMAN/MOHAVE COUNTY A., AZ.
+72371 3693 -11145 1304 1314 0 ---- PAGE/PAGE A., AZ
+72374 3502 -11073 1488 1505 0 ---- WINSLOW, AZ
+72376 3522 -11182 2181 2179 0 T-T- FLAGSTAFF, AZ
 72381 3492 -11790 705 0 0 ---- EDWARDS AFB, CA.
 72382 3463 -11808 774 775 0 ---- PALMDALE/INT., CA.
-72383 3474 -11872 1379 1377 0 T-T- SANDBERG, CA.
-72384 3543 -11905 150 149 0 T-T- BAKERSFIELD/MEADOWS,  CA.
-72386 3607 -11516 698 697 0 T-T- LAS VEGAS/MCCARRAN,  NV.
-72387 3661 -11602 1009 1006 0 T-T- MERCURY/DESERT ROCK,  NV.
-72389 3678 -11972 100 101 0 T-T- FRESNO/AIR TERM.,  CA.
+72383 3475 -11873 1379 1377 0 ---- SANDBERG, CA.
+72384 3543 -11905 150 149 0 ---- BAKERSFIELD/MEADOWS,  CA.
+72386 3608 -11517 664 662 0 ---- LAS VEGAS/MCCARRAN, NV.
+72387 3661 -11602 1006 1006 0 T-T- MERCURY/DESERT ROCK, NV.
+72388 3604 -11518 0 697 0 TTTT LAS VEGAS,NV
+72389 3677 -11972 100 101 0 ---- FRESNO/AIR TERM.,  CA.
 72390 3567 -12128 21 0 0 ---- SAN SIMEON/PT. PIEDRAS BLANCAS CGLS, CA.
 72391 3411 -11912 0 0 0 ---- POINT MUGU/NAS, CA.
 72393 3475 -12057 121 0 0 T-T- VANDENBERG AFB, CA.
 72394 3490 -12045 73 79 0 ---- SANTA MARIA,  CA.
 72398 3834 -7551 20 0 0 ---- SALISBURY, MD, WSALISBURY-OCEAN CITY WICOMICO RGNL ARPT
 72399 4019 -7676 96 0 0 ---- HARRISBURG, PA, HARRISBURG INT. ARPT
-72401 3751 -7731 50 51 0 T-T- RICHMOND/BYRD, VA.
+72401 3750 -7733 54 51 0 ---- RICHMOND/BYRD, VA.
 72402 3793 -7548 12 12 0 T-T- WALLOPS ISLAND, VA.
 72403 3895 -7745 98 95 0 ---- WASHINGTON/DULLES INT., VA.
 72403 3897 -7748 89 88 0 T-T- STERLING, VA.
-72404 3828 -7640 14 0 0 ---- PATUXENT RIVER/NAS,  MD.
-72405 3885 -7704 20 5 0 T-T- WASHINGTON/NAT., VA.
-72406 3917 -7667 47 48 0 T-T- BALTIMORE/BALTIMORE-WASHINGTON INT., MD.
-72407 3946 -7458 20 21 0 T-T- ATLANTIC CITY, NJ.
-72408 3986 -7525 9 4 0 T-T- PHILADELPHIA/INT.,  PA.
+72404 3828 -7640 14 0 0 ---- PATUXENT RIVER/NAS, MD.
+72405 3885 -7703 20 5 0 ---- WASHINGTON/NAT., VA.
+72406 3918 -7667 47 48 0 ---- BALTIMORE/BALTIMORE-WASHINGTON INT., MD.
+72407 3945 -7456 20 21 0 ---- ATLANTIC CITY, NJ.
+72408 3988 -7525 9 4 0 ---- PHILADELPHIA/INT., PA.
 72409 4003 -7431 24 0 0 ---- LAKEHURST/NAS, NJ.
-72410 3733 -7920 286 285 0 T-T- LYNCHBURG/MUN. P. GLENN, VA.
-72411 3733 -7998 358 358 0 T-T- ROANOKE/MUN., VA.
-72412 3779 -8112 766 763 0 T-T- BECKLEY (RALEIGH CTY. MEMORIAL AIRPORT),  WV.
-72414 3836 -8159 299 299 0 T-T- CHARLESTON/KANAWHA.,  WV.
-72417 3889 -7986 603 606 0 T-T- ELKINS/ELKINS-RANDOLPH CO., WV.
+72410 3733 -7920 286 285 0 ---- LYNCHBURG/MUN. P. GLENN, VA.
+72411 3732 -7997 358 358 0 ---- ROANOKE/MUN., VA.
+72412 3778 -8112 766 763 0 ---- BECKLEY (RALEIGH CTY. MEMORIAL AIRPORT), WV.
+72414 3836 -8159 299 299 0 ---- CHARLESTON/KANAWHA., WV.
+72417 3888 -7984 609 606 0 ---- ELKINS/ELKINS-RANDOLPH CO., WV.
 72418 3967 -7559 23 0 0 ---- WILMINGTON, DE, NEW CASTLE ARPT
 72419 3759 -8331 414 0 0 ---- JACKSON, KY, JULIAN CARROL ARPT
 72420 4082 -8252 396 0 0 ---- MANSFIELD, OH, MANSFIELD LAHM RGNL ARPT
-72421 3904 -8467 267 271 0 T-T- CINCINNATI/GREATER CINCINNATI, OH.
-72422 3804 -8461 301 298 0 T-T- LEXINGTON/BLUE GRASS, KY.
-72423 3817 -8574 149 151 0 T-T- LOUISVILLE/STANDIFORD, KY.
+72421 3904 -8467 267 271 0 ---- CINCINNATI/GREATER CINCINNATI, OH.
+72422 3803 -8460 301 298 0 ---- LEXINGTON/BLUE GRASS, KY.
+72423 3818 -8573 149 151 0 ---- LOUISVILLE/STANDIFORD, KY.
 72424 3790 -8597 230 0 0 --T- FT.KNOX, KY. (ARMY)
 72425 3836 -8255 255 252 0 ---- HUNTINGTON, WV.
-72426 3943 -8379 323 323 0 T-T- WILMINGTON, OH.
+72426 3942 -8382 323 323 0 T-T- WILMINGTON, OH.
 72427 3602 -8423 279 0 0 ---- OAK RIDGE, TN
-72428 4000 -8289 249 247 0 T-T- COLUMBUS/PORT COLUMBUS, OH.
-72429 3990 -8422 306 307 0 T-T- DAYTON/. COX, OH.
+72428 4000 -8288 254 247 0 ---- COLUMBUS/PORT COLUMBUS, OH.
+72429 3986 -8412 306 307 0 ---- DAYTON/. COX, OH.
 72429 3986 -8412 0 0 0 ---- SULPHUR GROVE, OH.
-72432 3804 -8753 118 127 0 T-T- EVANSVILLE/REG., IN.
-72434 3875 -9036 169 174 0 T-T- ST.LOUIS/LAMBERT,  ST.LOUIS INT., MO.
-72435 3707 -8877 126 0 0 T-T- PADUCAH, KY.
-72438 3972 -8629 246 243 0 T-T- INDIANAPOLIS/I.-MUN/WEIR COOK, IN.
-72439 3984 -8968 187 181 0 T-T- SPRINGFIELD/CAPITAL,  IL.
-72440 3724 -9340 390 391 0 T-T- SPRINGFIELD/MUN., MO.
+72432 3804 -8753 118 127 0 ---- EVANSVILLE/REG., IN.
+72434 3875 -9037 172 174 0 ---- ST.LOUIS/LAMBERT,  ST.LOUIS INT., MO.
+72435 3707 -8877 126 0 0 ---- PADUCAH, KY.
+72438 3972 -8627 246 243 0 ---- INDIANAPOLIS/I.-MUN/WEIR COOK, IN.
+72439 3985 -8967 187 181 0 ---- SPRINGFIELD/CAPITAL, IL.
+72440 3722 -9340 390 391 0 T-T- SPRINGFIELD/MUN., MO.
 72441 3977 -9491 252 0 0 ---- ST JOSEPH, MO, ROSECRANS MEMORIAL ARPT
 72442 3813 -9177 344 0 0 ---- ROLLA-VICHY, MO, ROLLA NATIONAL ARPT
 72443 3994 -9119 237 0 0 ---- QUINCY, IL, QUINCY RGNL-BALDWIN FIELD ARPT
-72445 3882 -9220 274 271 0 T-T- COLUMBIA/REGIONAL,  MO.
-72446 3929 -9472 312 316 0 T-T- KANSAS CITY,  INTNL., MO.
+72445 3882 -9222 274 271 0 ---- COLUMBIA/REGIONAL,  MO.
+72446 3928 -9475 313 316 0 ---- KANSAS CITY,  INTNL., MO.
 72449 3977 -9492 249 252 0 ---- ST. JOSEPH/ROSE-CRANS, MO.
-72450 3765 -9743 408 406 0 T-T- WICHITA/MID-CONTINENT, KS.
-72451 3777 -9997 790 790 0 T-T- DODGE CITY/MUN., KS.
-72452 3728 -9855 469 0 0 T-T- MEDICINE LODGE, KS
+72450 3765 -9743 409 406 0 ---- WICHITA/MID-CONTINENT, KS.
+72451 3776 -9997 790 786 0 T-T- DODGE CITY/MUN., KS.
+72452 3729 -9858 468 0 0 ---- MEDICINE LODGE, KS
 72453 3672 -9710 309 0 0 ---- PONCA CITY, OK PONCA CITY RGNL ARPT
 72455 3910 -9677 320 0 0 --TT FORT RILEY, KS. (ARMY)
 72456 3907 -9563 269 268 0 T-T- TOPEKA/MUN., KS.
-72458 3954 -9765 452 453 0 T-T- CONCORDIA/BLOSSER MUN., KS.
+72458 3954 -9765 452 453 0 ---- CONCORDIA/BLOSSER MUN., KS.
 72460 3700 -10188 1102 0 0 ---- ELKHART/ELKHART-MORTON COUNTY A., KS
-72462 3744 -10587 2299 2297 0 T-T- ALAMOSA, CO.
-72464 3828 -10452 1439 1441 0 T-T- PUEBLO/MEMORIAL, CO.
-72465 3936 -10170 1124 1114 0 T-T- GOODLAND/RENNER FIELD/GOODLAND/MUN. KS.
-72466 3881 -10470 1881 1873 0 T-T- COLORADO SPRINGS/MUNICIPAL, CO.
+72462 3743 -10587 2299 2297 0 ---- ALAMOSA, CO.
+72464 3828 -10450 1439 1441 0 ---- PUEBLO/MEMORIAL, CO.
+72465 3936 -10168 1124 1114 0 ---- GOODLAND/RENNER FIELD/GOODLAND/MUN. KS.
+72466 3882 -10472 1881 1873 0 ---- COLORADO SPRINGS/MUNICIPAL, CO.
 72468 3870 -10477 1789 0 0 --TT FORT CARSON, CO. (ARMY)
 72469 3977 -10487 1612 1611 0 T-T- DENVER/STAPLETON INT., CO.
-72470 3961 -11075 1785 1796 0 T-T- PRICE/CARBON COUNTY A., UT.
+72470 3961 -11075 1799 1796 0 ---- PRICE/CARBON COUNTY A., UT.
 72475 3842 -11302 1536 1536 0 ---- MILFORD MUNICIPAL, UT.
 72476 3911 -10852 1473 1474 0 T-T- GRAND JUNCTION/WALKER FIELD, CO.
 72477 3960 -11601 1811 0 0 ---- EUREKA, NV, RAMOS
-72480 3736 -11836 1263 1255 0 T-T- BISHOP, CA.
+72480 3736 -11837 1263 1255 0 ---- BISHOP, CA.
 72481 3736 -12057 60 0 0 PPPP MERCED/CASTLE AFB,  CA.
 72483 3852 -12150 8 6 0 ---- SACRAMENTO/EXECUTIVE CA.
 72486 3929 -11485 1908 1907 0 ---- ELY/YELLAND, NV.
 72487 3761 -11452 1335 0 0 ---- CALIENTE, NV.
-72488 3947 -11977 1341 1344 0 T-T- RENO/INT., NV.
+72488 3950 -11978 1341 1344 0 ---- RENO/INT., NV.
 72489 3957 -11980 1515 1518 0 T-T- RENO, NV.
 72491 3660 -12185 46 0 0 ---- MONTEREY/NAF, CA.
-72492 3789 -12123 8 9 0 T-T- STOCKTON/METROPOLITAN CA.
-72493 3772 -12222 4 3 0 T-T- OAKLAND/METROP. OAKLAND INT., CA.
-72494 3765 -12244 5 6 0 T-T- SAN FRANCISCO/INT.,  CA.
+72492 3790 -12125 8 9 0 ---- STOCKTON/METROPOLITAN CA.
+72493 3774 -12222 4 3 0 T-T- OAKLAND/METROP. OAKLAND INT., CA.
+72494 3761 -12238 5 6 0 ---- SAN FRANCISCO/INT.,  CA.
 72495 3799 -12205 12 0 0 ---- CONCORD, CA BUCHANAN FIELD ARPT
 72501 4086 -7286 26 20 0 T-T- UPTON, NY.
-72502 4069 -7417 9 5 0 ---- NEWARK/INT., NJ.
-72503 4078 -7387 9 7 0 T-T- NEW YORK/LA GUARDIA,  NY.
-72504 4116 -7313 5 3 0 ---- BRIDGEPORT/IGOR I. SIKORSKY MEM., CT.
+72502 4070 -7417 9 5 0 ---- NEWARK/INT., NJ.
+72503 4077 -7390 9 7 0 ---- NEW YORK/LA GUARDIA, NY.
+72504 4117 -7313 5 3 0 ---- BRIDGEPORT/IGOR I. SIKORSKY MEM., CT.
 72505 4079 -7309 44 0 0 ---- ISLIP, NY, LONG ISLAND ARTHUR ARPT
 72506 4078 -7397 48 0 0 ---- NEW YORK, NY, CENTRAL PARK
-72507 4172 -7143 19 17 0 T-T- PROVIDENCE/GREEN STATE, RI.
-72508 4194 -7268 55 53 0 T-T- WINDSOR LOCKS, CT.
-72509 4236 -7101 9 6 0 T-T- BOSTON/LOGAN INT.,  MA.
+72507 4173 -7143 19 17 0 ---- PROVIDENCE/GREEN STATE, RI.
+72508 4193 -7268 55 53 0 ---- HARTFORD/BRADLEY INTNL., CT
+72509 4237 -7103 9 6 0 ---- BOSTON/LOGAN INT., MA.
 72510 4227 -7188 306 0 0 ---- WORCESTER, MA, WORCESTER RGNL ARPT
-72513 4134 -7572 289 292 0 T-T- WILKES-BARRE-SCRANTON, PA.
-72514 4124 -7692 160 161 0 ---P WILLIAMSPORT/LYCOMING COUNTY, PA.
-72515 4221 -7598 499 497 0 T-T- BINGHAMTON/BROOME CO., NY.
+72513 4133 -7573 289 292 0 ---- WILKES-BARRE-SCRANTON, PA.
+72514 4125 -7692 160 161 0 ---P WILLIAMSPORT/LYCOMING COUNTY, PA.
+72515 4222 -7598 497 497 0 ---- BINGHAMTON/BROOME CO., NY.
 72516 4289 -7325 0 0 0 T-T- BENNINGTON, VT
-72517 4065 -7544 117 118 0 T-T- ALLENTOWN/A.-BETHLEHEM-EASTON, PA.
-72518 4275 -7380 89 88 0 ---- ALBANY COUNTY AIRPORT,  NY.
-72518 4269 -7383 89 93 0 T-T- ALBANY, NY.
-72519 4311 -7611 125 128 0 ---P SYRACUSE/HANCOCK,  NY.
+72517 4065 -7543 117 118 0 ---- ALLENTOWN/A.-BETHLEHEM-EASTON, PA.
+72518 4275 -7380 89 88 0 ---- ALBANY COUNTY AIRPORT, NY.
+72518 4269 -7383 92 95 0 T-T- ALBANY, NY.
+72519 4312 -7612 124 128 0 ---P SYRACUSE/HANCOCK, NY.
 72520 4052 -8022 359 361 0 ---- PITTSBURGH/GREATER PITTSBURGH INT., PA.
 72520 4053 -8022 359 361 0 T-T- PITTSBURGH, PA.
-72521 4092 -8144 377 374 0 T-T- AKRON/AKRON-CANTON REG. OH.
+72521 4092 -8143 377 374 0 ---- AKRON/AKRON-CANTON REG. OH.
 72522 4334 -7361 104 0 0 ---- GLENN FALLS, NY, FLOYD BENNETT MEMORIAL ARPT
-72523 4257 -7770 209 0 0 T-T- DANSVILLE/MUNICIPAL,  NY.
-72524 4141 -8184 245 241 0 T-T- CLEVELAND/CLEVELAND-HOPKINS, OH.
-72525 4126 -8068 361 365 0 T-T- YOUNGSTOWN, OH.
-72526 4208 -8018 225 223 0 T-T- ERIE/INT., PA.
+72523 4257 -7772 209 202 0 ---- DANSVILLE/MUNICIPAL, NY.
+72524 4142 -8187 245 241 0 ---- CLEVELAND/CLEVELAND-HOPKINS, OH.
+72525 4127 -8067 361 365 0 ---- YOUNGSTOWN, OH.
+72526 4208 -8018 225 223 0 ---- ERIE/INT., PA.
 72528 4294 -7872 218 218 0 T-T- BUFFALO/GREATER BUFFALO INT., NY.
-72529 4312 -7767 169 171 0 T-T- ROCHESTER/ROCHESTER-MONROE CO., NY.
-72530 4198 -8790 205 203 0 T-T- CHICAGO/O'HARE, IL.
-72531 4029 -8815 228 0 0 ---- RANTOUL/CHANUTE AFB,  IL.
-72532 4067 -8968 202 201 0 T-T- PEORIA/GREATER PEORIA MUN., IL.
-72533 4098 -8520 252 245 0 T-TP FORT WAYNE/MUN.,  BAER FLD., IN.
-72534 4179 -8775 190 189 0 ---- CHICAGO/MIDWAY, IL.
-72535 4171 -8632 236 241 0 T-T- SOUTH BEND/ST.JOSEPH CO., IN.
-72536 4159 -8381 211 208 0 T-T- TOLEDO/EXPRESS, OH.
-72537 4221 -8335 202 195 0 T-T- DETROIT/METROPOLITAN, MI.
-72539 4277 -8460 266 261 0 T-T- LANSING/CAPITAL CITY, MI.
+72529 4312 -7767 169 171 0 ---- ROCHESTER/ROCHESTER-MONROE CO., NY.
+72530 4198 -8790 205 203 0 ---- CHICAGO/O'HARE, IL.
+72531 4029 -8815 228 0 0 ---- RANTOUL/CHANUTE AFB, IL.
+72532 4067 -8968 202 201 0 ---- PEORIA/GREATER PEORIA MUN., IL.
+72533 4100 -8520 252 245 0 ---P FORT WAYNE/MUN.,  BAER FLD., IN.
+72534 4178 -8775 190 189 0 ---- CHICAGO/MIDWAY, IL.
+72535 4170 -8632 236 241 0 ---- SOUTH BEND/ST.JOSEPH CO., IN.
+72536 4160 -8380 211 208 0 ---- TOLEDO/EXPRESS, OH.
+72537 4223 -8333 202 195 0 ---- DETROIT/METROPOLITAN, MI.
+72539 4277 -8460 266 261 0 ---- LANSING/CAPITAL CITY, MI.
 72540 4025 -9372 270 271 0 ---- SPICKARD, MO.
 72542 4078 -9112 212 0 0 ---- BURLINGTON, IA SOUTHEAST IOWA RGNL ARPT
-72543 4220 -8909 226 224 0 T-T- ROCKFORD/GREATER ROCKFORD, IL.
-72544 4145 -9051 181 180 0 T-T- MOLINE/QUAD CITY,  IL.
-72545 4188 -9171 265 263 0 ---- CEDAR RAPIDS, IA.
-72546 4153 -9366 294 292 0 T-T- DES MOINES/MUN., IA.
-72547 4240 -9071 329 328 0 ---- DUBUQUE/MUN., IA.
-72548 4256 -9240 268 266 0 ---- WATERLOO/MUN., IA.
+72543 4220 -8910 226 224 0 ---- ROCKFORD/GREATER ROCKFORD, IL.
+72544 4145 -9052 181 180 0 ---- MOLINE/QUAD CITY, IL.
+72545 4188 -9170 265 263 0 ---- CEDAR RAPIDS, IA.
+72546 4153 -9365 294 292 0 ---- DES MOINES/MUN., IA.
+72547 4240 -9070 329 328 0 ---- DUBUQUE/MUN., IA.
+72548 4255 -9240 268 266 0 ---- WATERLOO/MUN., IA.
 72549 4255 -9418 355 354 0 ---- FORT DODGE, IA
-72550 4130 -9589 299 300 0 T-T- EPPLEY FIELD, OMAHA,  NE.
-72551 4085 -9676 362 365 0 T-T- LINCOLN/MUN., NE.
-72552 4097 -9831 566 563 0 T-T- GRAND ISLAND/GR. IS. COUNTY, NE.
+72550 4130 -9590 299 300 0 ---- EPPLEY FIELD, OMAHA,  NE.
+72551 4085 -9675 362 365 0 ---- LINCOLN/MUN., NE.
+72552 4095 -9832 566 563 0 ---- GRAND ISLAND/GR. IS. COUNTY, NE.
 72553 4137 -9602 406 399 0 ---- OMAHA, NE.
 72554 4112 -9590 315 0 0 ---- OMAHA/OFFUTT AFB,  NE.
-72556 4199 -9743 473 479 0 T-T- NORFOLK/KARL STEFAN,  NE.
-72557 4240 -9638 336 334 0 T-T- SIOUX CITY/MUN., IA.
+72556 4198 -9743 473 479 0 ---- NORFOLK/KARL STEFAN,  NE.
+72557 4240 -9638 336 334 0 ---- SIOUX CITY/MUN., IA.
 72558 4132 -9637 352 352 0 T-T- VALLEY, NE.
-72561 4110 -10298 1312 1314 0 T-T- SIDNEY/MUN., NE.
-72562 4113 -10070 846 849 0 T-T- NORTH PLATTE/LEE BIRD, NE.
-72564 4115 -10481 1872 1876 0 T-T- CHEYENNE, WY.
-72565 3986 -10467 1656 1656 0 T-T- DENVER INTERNATIONAL AIRPORT, CO.
+72561 4110 -10298 1312 1314 0 ---- SIDNEY/MUN., NE.
+72562 4113 -10070 848 849 0 T-T- NORTH PLATTE/LEE BIRD, NE.
+72564 4115 -10482 1872 1876 0 ---- CHEYENNE, WY.
+72565 3986 -10467 1656 1656 0 ---- DENVER INTERNATIONAL AIRPORT, CO.
 72566 4187 -10360 1206 1209 0 ---- SCOTTSBLUFF, COUNTY,  NE.
-72567 4288 -10055 792 788 0 T-T- VALENTINE/MILLER,  NE.
-72569 4291 -10646 1612 1630 0 T-T- CASPER/NATRONA COUNTY, INTNL, WY.
-72570 4050 -10752 1915 0 0 ---- CRAIG/CRAIG-MOFFAT A., CO.
-72572 4078 -11197 1289 1289 0 T-T- SALT LAKE CITY/INTNL UT.
-72575 4120 -11201 1353 0 0 T-T- OGDEN, UT
+72567 4287 -10055 792 788 0 ---- VALENTINE/MILLER,  NE.
+72569 4292 -10647 1612 1630 0 ---- CASPER/NATRONA COUNTY, INTNL, WY.
+72570 4050 -10753 1915 0 0 ---- CRAIG/CRAIG-MOFFAT A., CO.
+72572 4077 -11196 1289 1289 0 T-T- SALT LAKE CITY/INTNL UT.
+72575 4120 -11201 0 1353 0 T-T- OGDEN, UT
 72576 4282 -10873 1694 1703 0 ---- LANDER/HUNT, WY.
 72578 4292 -11260 1365 1355 0 ---- POCATELLO/MUN., ID.
 72581 4072 -11403 1292 1291 0 ---- WENDOVER/AF. AUX. FIELD, UT.
@@ -10344,14 +10399,14 @@
 72592 4050 -12230 0 153 0 ---- REDDING/MUN, CA
 72593 3665 -12160 24 0 0 ---- SALINAS, CA, SALINAS MUNI ARPT
 72594 4079 -12417 18 13 0 ---- EUREKA, CA.
-72597 4237 -12287 399 398 0 T-T- MEDFORD/MEDFORD-JACKSON COUNTY, OR.
+72597 4238 -12288 399 398 0 T-T- MEDFORD/MEDFORD-JACKSON COUNTY, OR.
 72604 4422 -7175 287 0 0 ---- FRANCONIA, NH
 72605 4320 -7150 105 103 0 ---- CONCORD/MUN., NH.
 72606 4365 -7031 19 23 0 ---- PORTLAND/INTNL. JET PORT, ME.
 72607 4481 -6881 60 0 0 ---- BANGOR, ME BANGOR INT. ARPT
 72608 4492 -6700 23 24 0 ---- EASTPORT, ME.
 72612 4493 -7220 233 233 0 ---- NEWPORT, VT.
-72613 4427 -7130 1910 1909 0 ---- MOUNT WASHINGTON,  NH.
+72613 4427 -7130 1910 1909 0 ---- MOUNT WASHINGTON, NH.
 72614 4442 -7202 217 203 0 ---- ST.JOHNSBURY, VT.
 72616 4458 -7118 0 0 0 ---- BERLIN, NH
 72617 4447 -7315 104 102 0 ---- BURLINGTON/INT., VT.
@@ -10362,7 +10417,7 @@
 72635 4288 -8552 245 242 0 ---- GRAND RAPIDS/KENT CO., MI.
 72636 4317 -8625 193 191 0 ---- MUSKEGON/COUNTY, MI.
 72637 4297 -8375 233 238 0 ---- FLINT/BISHOP, MI.
-72638 4435 -8467 354 351 0 ---- HOUGHTON LAKE/ROSCOMMON COUNTY,  MI.
+72638 4437 -8468 0 351 0 ---- HOUGHTON LAKE/ROSCOMMON COUNTY,  MI.
 72639 4507 -8357 211 210 0 ---- ALPENA/PHELPS COLLINS, MI.
 72640 4295 -8790 211 220 0 ---- MILWAUKEE/GEN. MITCHELL, WI.
 72641 4313 -8933 264 263 0 ---- MADISON/DANE COUNTY REGIONAL WI.
@@ -10376,56 +10431,56 @@
 72652 4307 -9853 453 453 0 ---- PICKSTOWN, SD.
 72653 4380 -9932 530 530 0 ---- CHAMBERLAIN, SD
 72654 4438 -9822 393 392 0 ---- HURON/HURON REGIONAL SD.
-72655 4554 -9405 312 313 0 ---- ST.CLOUD/WHITNEY,  MN.
+72655 4555 -9407 312 313 0 ---- ST.CLOUD/WHITNEY, MN.
 72656 4438 -10029 527 0 0 ---- PIERRE, SD, PIERRE RGNL ARPT
 72658 4488 -9322 255 256 0 ---- MINNEAPOLIS/ST.PAUL INT., MN.
 72659 4546 -9841 400 398 0 T-T- ABERDEEN/REG., SD.
 72661 4527 -10353 925 924 0 ---- REDIG, SD.
 72662 4407 -10320 1030 0 0 ---- RAPID CITY/REGIONAL AIRPORT, SD.
 72662 4407 -10321 1031 1029 0 T-T- RAPID CITY WFO, SD.
-72665 4435 -10553 1230 1230 0 ---- GILLETTE/GILLETTE-CAMPBELL COUNTY A.,  WY.
+72665 4435 -10553 1230 1230 0 ---- GILLETTE/GILLETTE-CAMPBELL COUNTY A., WY.
 72666 4477 -10697 1209 1226 0 ---- SHERIDAN/COUNTY, WY.
 72669 4181 -10720 2065 0 0 ---- RAWLINGS, WY, RAWLINGS MUNI-HARVEY FIELD ARPT
 72670 4452 -10902 1553 1551 0 ---- CODY/MUN., WY.
-72671 4258 -11011 2124 2124 0 ---- BIG PINEY, WY
-72672 4306 -10844 1698 1699 0 T-T- RIVERTON, WY.
+72671 4257 -11010 2124 2124 0 ---- BIG PINEY, WY
+72672 4307 -10848 1698 1699 0 T-T- RIVERTON, WY.
 72677 4580 -10853 1088 1099 0 ---- BILLINGS/LOGAN INT.,  MT
-72681 4357 -11624 873 873 0 T-T- BOISE/MUN., ID.
+72681 4357 -11621 873 873 0 T-T- BOISE/MUN., ID.
 72683 4358 -11895 1271 1265 0 ---- BURNS, OR.
 72688 4568 -11885 456 455 0 ---- PENDLETON, OR.
 72692 4425 -12115 936 0 0 ---- ROBERT FIELD ARPT
-72693 4412 -12322 114 111 0 ---- EUGENE/MAHLON SWEET,  OR.
-72694 4490 -12300 61 62 0 T-T- SALEM/MCNARY, OR.
+72693 4412 -12322 114 111 0 ---- EUGENE/MAHLON SWEET, OR.
+72694 4491 -12301 62 62 0 T-T- SALEM/MCNARY, OR.
 72698 4560 -12260 12 7 0 ---- PORTLAND/INT., OR.
-72712 4687 -6801 192 191 0 T-T- CARIBOU/MUN., ME.
+72712 4687 -6801 191 191 0 T-T- CARIBOU/MUN., ME.
 72713 4668 -6805 146 163 0 ---- PRESQUE ISLE, ME.
 72741 4593 -9045 469 462 0 ---- PARK FALLS, WI.
 72743 4653 -8755 434 434 0 ---- MARQUETTE, MI.
-72744 4717 -8850 329 333 0 ---- HOUGHTON/HOUGHTON COUNTY, MI.
+72744 4717 -8850 329 333 0 ---- HOUGHTON/HOUGHTON COUNTY, MI
 72745 4683 -9218 432 436 0 ---- DULUTH/INT., MN.
-72747 4857 -9340 362 357 0 T-T- INT.FALLS/FALLS INT. MN.
+72747 4856 -9340 362 357 0 T-T- INT.FALLS/FALLS INT. MN.
 72750 4660 -9432 390 0 0 ---- PEQUOT LAKE, MN
-72753 4692 -9681 274 274 0 ---- FARGO/HECTOR FIELD,  ND.
+72753 4690 -9680 274 274 0 ---- FARGO/HECTOR FIELD, ND.
 72755 4750 -9493 420 423 0 ---- BEMIDJI/MUN., MN.
 72756 4893 -9535 328 0 0 ---- WARROAD, MN
 72757 4795 -9718 257 0 0 ---- GRAND FORKS, ND, GRAND FORKS INT. ARPT
 72758 4810 -9887 443 439 0 ---- DEVILS LAKE, ND.
 72763 4680 -10280 791 0 0 ---- DICKINSON, ND, DICKINSON - THEODORE ROOSEVELT RGNL ARPT
-72764 4677 -10075 505 506 0 T-T- BISMARCK/MUN., ND.
+72764 4677 -10076 505 506 0 T-T- BISMARCK/MUN., ND.
 72765 4775 -10183 624 0 0 ---- ROSEGLEN, ND.
 72767 4818 -10363 581 592 0 ---- WILLISTON/SLOULIN FIELD INT., ND.
-72768 4821 -10662 694 693 0 T-T- GLASGOW/INT., MT.
+72768 4821 -10663 694 693 0 T-T- GLASGOW/INT., MT.
 72769 4861 -11238 1175 0 0 ---- CUT BANK, MT, CUT BANK MUNI ARPT
 72770 4526 -11255 1591 0 0 ---- DILLON, MT, DILLON ARPT
 72772 4660 -11200 1188 1186 0 ---- HELENA/COUNTY-CITY,  MT.
 72773 4692 -11408 972 976 0 ---- MISSOULA / JOHNSON-BELL FIELD, MT.
 72774 4595 -11251 1688 0 0 ---- BUTTE, MT BERT MOONEY ARPT
 72775 4748 -11137 1115 1118 0 ---- GREAT FALLS/INT.,  MT.
-72776 4746 -11138 1132 1134 0 T-T- GREAT FALLS, MT.
+72776 4746 -11138 1131 1132 0 T-T- GREAT FALLS, MT.
 72777 4855 -10977 792 789 0 ---- HAVRE/CITY COUNTY,  MT.
 72779 4830 -11427 906 906 0 ---- KALISPELL/GLACIER PARK INT., MT.
 72781 4657 -12053 325 332 0 ---- YAKIMA/YAKIMA AIR TERMINAL, WA.
-72783 4637 -11702 438 438 0 ---- LEWISTON/LEWISTON-NEZ PERCE CO., ID.
+72783 4638 -11702 438 438 0 ---- LEWISTON/LEWISTON-NEZ PERCE CO., ID.
 72784 4657 -11960 223 0 0 ---- HANFORD, WA.
 72785 4763 -11753 721 720 0 ---- SPOKANE/INT., WA.
 72786 4768 -11763 729 729 0 T-T- SPOKANE, WA.
@@ -10435,21 +10490,23 @@
 72790 4730 -11951 384 0 0 ---- EPHRATA, WA, EPHRATA MUNI ARPT
 72791 4615 -12388 0 7 0 ---- ASTORIA/CLATSOP, OR.
 72792 4697 -12290 61 62 0 ---- OLYMPIA, WA.
-72793 4745 -12230 137 130 0 ---- SEATTLE/S.-TACOMA,  WA.
-72797 4794 -12456 57 57 0 T-T- QUILLAYUTE, WA.
+72793 4745 -12230 137 130 0 ---- SEATTLE/S.-TACOMA, WA.
+72797 4793 -12456 57 57 0 T-T- QUILLAYUTE, WA.
 74001 3460 -8663 175 0 0 ---- REDSTONE ARSENAL, AL.
 74002 3950 -7617 5 0 0 ---- ABERDEEN PROVING GROUNDS, MD.
 74003 4017 -11293 1325 0 0 ---- DUGWAY PROVING GROUNDS, UT.
-74004 3250 -11400 231 0 0 ---- YUMA PROVING GROUNDS AZ.
-74201 4813 -12340 9 5 0 ---- PORT ANGELES/CGAS,  WA.
-74206 4715 -12248 87 0 0 ---- TACOMA/MC CHORD AFB,  WA.
-74207 4712 -12255 87 0 0 ---- FORT LEWIS/GRAY AAF,  WA.
-74230 4643 -10588 803 0 0 T-T- MILES CITY, MT
+74004 3286 -11433 0 131 0 TTTT YUMA PG, TOWER 3555
+74005 3286 -11403 0 231 0 TTTT YUMA PG,TOWER 31
+74006 3292 -11380 0 145 0 TTTT YUMA PG,TOWER M
+74201 4813 -12340 9 5 0 ---- PORT ANGELES/CGAS, WA.
+74206 4715 -12248 87 0 0 ---- TACOMA/MC CHORD AFB, WA.
+74207 4712 -12255 87 0 0 ---- FORT LEWIS/GRAY AAF, WA.
+74230 4643 -10587 801 0 0 ---- MILES CITY, MT
 74341 4467 -9545 0 319 0 PPPP WOOD LAKE, MN.
 74357 4322 -9053 0 226 0 PPPP BLUE RIVER, WI.
 74365 4483 -8455 387 0 0 ---- GRAYING AF RANGE,  MI.
 74370 4405 -7573 207 0 0 ---- FORT DRUM/WHEELER-SACK AAF, NY
-74389 4389 -7025 118 125 0 T-T- GRAY/PORTLAND, ME.
+74389 4389 -7026 118 125 0 T-T- GRAY, ME.
 74392 4388 -6993 24 0 0 ---- BRUNSWICK/NAS, ME.
 74393 4353 -7009 7 0 0 ---- PORTLAND, ME.
 74413 4253 -11570 1108 0 0 ---- SAYLOR CREEK GUNNERY RANGE, ID.
@@ -10461,7 +10518,7 @@
 74440 4010 -9733 0 433 0 PPPP FAIRBURY, NE.
 74445 4220 -9780 0 524 0 PPPP NELIGH, NE.
 74449 4190 -9370 0 315 0 PPPP SLATER, IA.
-74455 4161 -9059 231 231 0 T-T- QUAD CITY, IA.
+74455 4161 -9058 231 231 0 T-T- QUAD CITY, IA.
 74460 4137 -8868 225 223 0 ---- MARSEILLES, IL
 74465 4178 -8753 0 0 0 ---- DUNNE CRIB IL.
 74466 4082 -8705 0 212 0 PPPP WOLCOTT, IN.
@@ -10470,7 +10527,7 @@
 74483 4288 -7288 482 0 0 ---- WILMINGTON, VT.
 74484 4293 -7287 595 0 0 ---- WEST DOVER, VT.
 74486 4065 -7378 7 4 0 ---- NEW YORK/JOHN F. KENNEDY INT., NY.
-74490 4247 -7129 41 41 0 ---- BEDFORD/HANSCOM AFB,  MA.
+74490 4247 -7128 41 41 0 ---- BEDFORD/HANSCOM AFB, MA.
 74491 4220 -7253 75 0 0 ---- CHICOPEE FALLS/WESTOVER AFB, MA.
 74492 4222 -7112 0 195 0 ---- BLUE HILL OBS. MA.
 74494 4166 -6995 16 15 0 T-T- CHATHAM, MA.
@@ -10502,7 +10559,7 @@
 74606 3465 -12057 112 0 0 ---- SOUTH VANDENBERG AFB CA.
 74611 3528 -11662 716 0 0 ---- BICYCLE LAKE AAF, CA
 74612 3568 -11768 696 0 0 --P- CHINA LAKE, NAF, CA.
-74614 3624 -11503 952 0 0 ---- LAS VEGAS, NV.
+74614 3653 -11590 972 0 0 ---- INDIAN SPRINGS GUNNERY RANGE, NV.
 74618 3527 -11743 864 0 0 ---- CUDDLEBACK GUNNERY RANGE, CA.
 74619 3633 -11710 962 0 0 ---- SUPERIOR VALLEY GUNNERY RANGE, CA
 74626 3345 -11195 384 386 0 --P- WFO PHOENIX, AZ.
@@ -10518,10 +10575,10 @@
 74648 3579 -9578 0 212 0 PPPP HASKELL, OK.
 74649 3497 -9752 0 331 0 PPPP PURCELL, OK.
 74662 3688 -8997 0 130 0 PPPP BLOOMFIELD, MO.
-74671 3667 -8750 174 0 0 ---- FORT CAMPBELL AAF,  KY.
+74671 3667 -8750 174 0 0 ---- FORT CAMPBELL AAF, KY.
 74693 3513 -7893 74 0 0 ---- FORT BRAGG / SIMMONS AAF, NC.
 74695 3567 -7590 3 0 0 ---- DARE COUNTY GUNNERY RANGE, NC.
-74699 3347 -7758 0 0 0 ---- FRYING PAN SHOALS,  NC.
+74699 3347 -7758 0 0 0 ---- FRYING PAN SHOALS, NC.
 74702 3633 -11995 73 0 0 ---- LEMOORE, CA. (NAS)
 74718 3322 -11587 -69 0 0 T-T- SALTON SEA, CA. (AFS)
 74724 3243 -11268 269 0 0 ---- GILA BEND AAF, AZ.
@@ -10539,7 +10596,7 @@
 74750 3178 -9572 0 119 0 PPPP PALESTINE, TX.
 74752 3411 -9428 0 195 0 PPPP DEQUEEN, AR.
 74753 3190 -9278 141 93 0 PPPP WINNFIELD, LA.
-74754 3133 -9255 27 0 0 ---- ALEXANDRIA, LA.
+74754 3132 -9255 27 0 0 ---- ENGLAND AFB, LA.
 74755 3113 -9257 67 0 0 --PP CLAIBORNE RANGE, LA. (AFS)
 74756 2969 -8227 46 0 0 ---- GAINSVILLE, FL GAINSVILLE RGNL ARPT
 74757 3041 -8907 16 0 0 ---- GULFPORT, MS, GULFPORT-BILOXI INT. ARPT
@@ -10597,6 +10654,7 @@
 76499 2377 -9820 0 21 0 ---- SOTO LA MARINA,  TAMPS.
 76519 2210 -10327 0 1736 0 ---- COLOTLAN, JAL.
 76525 2278 -10257 0 2612 0 ---- ZACATECAS, ZAC. (LA BUFA, ZAC.)
+76526 2275 -10251 0 2257 0 T-T- ZACATECAS, ZAC.
 76539 2220 -10102 0 1883 1 ---- SAN LUIS POTOSI,  S.L.P.
 76543 2200 -9878 0 23 0 ---- TAMUIN, S.L.P.
 76548 2220 -9785 0 25 0 ---- TAMPICO, TAMPS
@@ -10651,7 +10709,7 @@
 76848 1623 -9213 0 1646 1 ---- COMITAN, CHIS.
 76855 1565 -9648 0 43 0 ---- PUERTO ANGEL, OAX.
 76903 1492 -9225 0 118 0 ---- TAPACHULA, CHIS
-78016 3236 -6468 130 0 0 T-T- L F WADE INTERNATIONAL AIRPORT
+78016 3236 -6468 4 0 0 T-T- L F WADE INTERNATIONAL AIRPORT
 78061 2670 -7897 4 2 0 ---- WEST END, GRAND BAHAMA
 78062 2655 -7870 11 2 0 ---- FREEPORT, GRAND BAHAMA
 78065 2652 -7706 3 0 0 ---- MARSH HARBOUR, ABACO
@@ -10865,21 +10923,24 @@
 78808 898 -7955 66 0 0 --T- ALBROOK
 78825 1029 -10923 2 1 0 ---- CLIPPERTON
 78846 1820 -6305 29 0 0 ---- ANGUILLA
+78850 1679 -6219 167 167 0 ---- JOHN A. OSBORNE AIRPORT
 78857 1728 -6273 9 30 0 ---- BASSETERRE
 78858 1730 -6272 67 67 0 ---- R.L. BRADSHAW INT'L AIRPORT
+78859 1721 -6259 17 17 0 ---- V.W AMORY INT'L AIRPORT
 78861 1712 -6178 10 0 0 --TP COOLIDGE FIELD,  ANTIGUA (AUX.AFB)
 78862 1712 -6178 10 8 0 ---- VC BIRD INT'L AIRPORT ANTIGUA
 78866 1803 -6312 4 3 0 T-T- JULIANA AIRPORT,  ST. MAARTEN
-78873 1748 -6298 40 39 0 ---- ROOSEVELT AIRPORT ST. EUSTATIUS
+78871 1764 -6322 32 42 0 ---- JUANCHO E. YRAUSQUIN AIRPORT, SABA
+78873 1750 -6298 37 40 0 ---- F.D. ROOSEVELT AIRPORT ST. EUSTATIUS
 78890 1634 -6100 27 27 0 ---- LA DESIRADE METEO
-78891 1630 -6135 0 25 0 ---- LE MOULE
+78891 1630 -6135 0 25 0 ---- LE MOULE RADAR
 78894 1789 -6285 45 44 0 ---- ST. BARTHELEMY METEO
 78896 1626 -6153 9 0 1 ---- POINTE-A-PITRE
 78897 1626 -6152 8 11 0 T-T- LE RAIZET AERO
 78905 1553 -6130 16 14 0 ---- MELVILLE HALL AIRPORT
 78906 1533 -6138 5 5 0 ---- CANEFIELD AIRPORT
 78922 1477 -6088 39 26 0 ---- TRINITE-CARAVELLE
-78924 1450 -6102 0 377 0 ---- LE DIAMANT
+78924 1450 -6102 0 377 0 ---- LE DIAMANT RADAR
 78925 1460 -6100 8 5 0 ---- LAMENTIN-AERO
 78947 1402 -6100 2 2 0 ---- GEORGE F.L. CHARLES AIRPORT
 78948 1375 -6095 10 3 0 ---- HEWANORRA INT'L AIRPORT
@@ -10985,6 +11046,7 @@
 80479 1030 -6823 0 1000 0 ---- PALMICHAL
 81001 680 -5815 2 1 0 ---- GEORGETOWN
 81002 650 -5825 30 28 0 ---- TIMEHRI/CHEDDI JAGAN INTERNATIONAL
+81003 657 -5813 1 0 0 ---- OGLE INTERNATIONAL AIRPORT
 81005 588 -6050 495 494 0 ---- KAMARANG
 81006 337 -5980 82 82 0 ---- LETHEM
 81010 557 -5778 29 28 0 ---- EBINI
@@ -11003,7 +11065,7 @@
 81403 521 -5275 17 12 0 ---- KOUROU CSG
 81405 482 -5237 9 8 0 T-T- CAYENNE MATOURY
 81406 517 -5269 9 0 1 ---- CAYENNE
-81408 389 -5180 7 6 0 ---- SAINT GEORGES
+81408 389 -5180 7 11 0 ---- SAINT GEORGES
 81415 364 -5403 107 106 0 ---- MARIPASOULA
 81609 381 -5186 21 19 0 ---- OIAPOQUE
 81615 280 -6065 96 94 0 ---- BOA VISTA
@@ -11728,7 +11790,7 @@
 84773 -1768 -7134 9 9 0 ---- ILO
 84775 -1770 -7138 50 0 1 ---- PUNTA COLES
 84782 -1805 -7027 469 468 0 ---- TACNA
-84950 -2299 -4342 7 0 0 ---- RIO DE JANEIRO
+84950 -2299 -4342 7 0 1 ---- RIO DE JANEIRO
 85033 -1082 -6534 0 130 0 ---- GUAYARAMERIN
 85041 -1103 -6878 0 235 0 ---- COBIJA
 85043 -1100 -6612 0 141 0 ---- RIBERALTA
@@ -11773,7 +11835,7 @@
 85448 -2992 -7120 0 146 0 ---- LA SERENA
 85460 -2632 -7062 0 30 0 ---- CHANARAL
 85467 -2726 -7078 0 210 0 ---- DESIERTO DE ATACAMA
-85469 -2716 -10943 0 172 0 T--- ISLA DE PASCUA
+85469 -2716 -10943 0 172 1 T--- ISLA DE PASCUA
 85470 -2730 -7042 0 290 0 ---- COPIAPO
 85486 -2860 -7077 0 526 0 ---- VALLENAR
 85488 -2992 -7120 0 142 0 ---- LA SERENA
@@ -11803,7 +11865,7 @@
 85896 -5238 -7512 0 56 0 ---- ISLOTES EVANGELISTAS
 85921 -5167 -7253 0 0 0 ---- PUERTO NATALES
 85930 -5240 -7509 52 0 0 ---- FARO EVANGELISTA
-85934 -5300 -7084 0 38 0 --T- PUNTA ARENAS
+85934 -5300 -7084 0 38 1 --T- PUNTA ARENAS
 85968 -5493 -6762 0 27 0 ---- PUERTO WILLIAMS
 85972 -5647 -6873 0 11 0 ---- ISLA DIEGO RAMIREZ
 86011 -1953 -5937 143 0 0 ---- BASE A. GRAL ADRIAN JARA
@@ -12298,6 +12360,7 @@
 89004 -7170 -280 817 815 0 ---- S.A.N.A.E. AWS
 89005 -7420 -975 1440 0 0 ---- KOTTAS ARGOS ID 3314
 89009 -9000 0 2835 0 0 T-T- AMUNDSEN-SCOTT
+89011 -7136 -1002 574 572 0 ---- SOERASEN
 89013 -8277 -1305 1968 0 0 ---- BALDRICK AWS
 89014 -7305 -1338 497 0 0 ---- NORDENSKIOLD BASE
 89016 -7309 -1315 363 0 0 ---- WASA EP5
@@ -12306,10 +12369,11 @@
 89022 -7544 -2622 0 30 0 --T- HALLEY
 89034 -7787 -3461 256 0 0 ---- BASE BELGRANO II
 89042 -6072 -4560 6 0 0 ---- SIGNY ISLAND
+89047 -8044 -4443 105 103 0 ---- FILCHNER
 89049 -8567 -4638 1860 0 0 ---- AGO-2
 89050 -6220 -5889 15 14 0 ---- BELLINGSHAUSEN
 89052 -6217 -5847 2 3 0 ---- ARCTOWSKI
-89053 -6223 -5863 11 0 0 ---- BASE JUBANY
+89053 -6223 -5863 11 0 0 ---- BASE CARLINI
 89054 -6218 -5885 17 0 0 ---- DINAMET-URUGUAY
 89055 -6423 -5672 200 208 0 --T- BASE MARAMBIO (CENTRO MET. ANTARTICO)
 89056 -6218 -5898 0 48 0 ---- CENTRO MET. ANTARTICO PDTE. EDUARDO FREI
@@ -12325,6 +12389,7 @@
 89066 -6812 -6713 7 0 0 ---- BASE SAN MARTIN
 89069 -6525 -6427 11 0 0 ---- FARADAY
 89070 -6298 -6068 0 12 0 ---- GABRIEL DE CASTILLA
+89079 -8400 -7948 1285 0 0 ---- CRIOSFERA 1
 89081 -8030 -8133 905 0 0 ---- PATRIOT HILLS AWS
 89083 -7592 -8392 914 0 0 ---- SIPLE STATION
 89087 -8520 -8788 1634 0 0 ---- THIEL MOUNTAINS AWS
@@ -12362,7 +12427,7 @@
 89507 -7500 0 2892 0 0 ---- KOHNEN EP9
 89512 -7077 1183 124 119 0 T--- NOVOLAZAREVSKAJA
 89514 -7077 1175 0 0 0 ---- MAITRI
-89526 -7195 2335 0 1397 0 --T- PRINCESS ELISABETH
+89526 -7195 2335 0 1397 0 --T- PRINCESS ELISABETH/UTSTEINEN
 89528 -8277 2858 2912 0 0 ---- AGO-3
 89532 -6901 3958 22 18 0 T-T- SYOWA
 89536 -7865 3564 3620 0 0 ---- PLATEAU STATION B EP12
@@ -12411,7 +12476,7 @@
 89757 -7383 5567 2741 2741 0 ---- MAWSON (LGB 20 AWS)
 89758 -7130 5922 2620 2617 0 ---- MAWSON (LGB10 AWS)
 89762 -6865 6112 1830 1830 0 ---- MAWSON (LGB 00 GE 03 AWS)
-89767 -7089 6987 84 84 0 ---- G3
+89767 -7089 6987 84 84 0 ---- AMERY ICE SHELF (G3)
 89768 -7855 16665 920 0 0 ---- MINNA BLUFF
 89769 -7847 16838 50 0 0 ---- LINDA
 89773 -6945 7142 0 65 0 ---- AMERY ICE SHELF AM01
@@ -12529,14 +12594,14 @@
 91371 947 17025 3 2 0 ---- WOTJE ATOLL, MARSHALL IS.
 91374 890 17085 0 3 0 ---- MALEOLAP, ATOLL AWS,  MARSHALL IS.
 91375 712 17135 0 0 0 ---- MAJURA, MARSHALL IS.
-91376 709 17139 3 3 0 T-T- MAJURO/MARSHALL IS. INTNL.
+91376 709 17129 3 3 0 T-T- MAJURO/MARSHALL IS. INTNL.
 91377 610 17140 0 2 0 ---- MILI ATOLL AWS, MARSHALL IS.
 91378 608 17173 4 3 0 ---- MILI ATOLL, MARSHALL IS.
 91385 588 -16205 2 0 0 ---- PALMYRA ISLAND
 91408 734 13449 30 30 0 T-T- WEATHER SERVICE OFFICE, KOROR, PALAU WCI.
 91410 302 13118 5 3 0 ---- TOBI ISLAND,  CAROLINE IS.
 91411 830 13747 0 3 0 ---- NGULU ATOLL AWS, CAROLINE IS.
-91413 950 13808 15 16 0 T-T- WEATHER SERVICE OFFICE, YAP, CAROLINE IS.
+91413 950 13808 28 27 0 T-T- WEATHER SERVICE OFFICE, YAP, CAROLINE IS.
 91425 385 15502 4 2 0 ---- NUKUORO ATOLL, CAROLINE IS.
 91434 108 15477 3 0 0 ---- KAPINGAMARANGI ATOLL, CAROLINE IS.
 91442 459 16868 0 3 0 ---- EBON ATOLL AWS,  MARSHALL IS.
@@ -12568,11 +12633,11 @@
 91565 -1945 16922 8 0 0 ---- WHITE GRASS AIRPORT
 91568 -2023 16977 7 6 0 ---- ANEITYUM
 91570 -1848 16309 4 4 0 ---- ILE SURPRISE
-91571 -2046 16422 0 595 0 ---- THIEBAGI RADAR
+91571 -2046 16422 0 595 0 ---- TIEBAGHI RADAR
 91573 -1972 16366 84 93 0 ---- ILE ART (BELEP)
 91574 -1997 15847 6 4 0 ---- ILE LOOP (CHESTERFIELD)
 91577 -2056 16428 19 25 0 ---- KOUMAC (NLLE-CALEDONIE)
-91579 -2064 16657 9 16 0 ---- OULOUP (ILE OUVEA)
+91579 -2064 16657 9 7 0 ---- OULOUP (ILE OUVEA)
 91582 -2078 16724 32 29 0 ---- OUANAHAM (ILE LIFOU)
 91583 -2093 16533 14 14 0 ---- POINDIMIE (NLLE-CALEDONIE)
 91587 -2148 16804 48 42 0 ---- LA ROCHE (ILE MARE)
@@ -12607,6 +12672,7 @@
 91680 -1775 17745 24 13 0 T-P- NADI AIRPORT
 91682 -1814 17742 9 8 0 ---- SIGATOKA
 91683 -1805 17857 7 5 0 ---- NAUSORI
+91688 -1776 17745 31 0 1 ---- NADI
 91689 -1813 17843 2 0 0 ---- SUVA
 91690 -1814 17845 9 6 0 ---- LAUTHALA BAY
 91691 -1823 -17880 3 2 0 ---- LAKEBA
@@ -12657,12 +12723,14 @@
 91812 -1088 -16582 0 0 0 ---- PUKAPUKA AWS*
 91819 -1323 -16308 0 3 0 ---- SUWARROW
 91822 -1907 -16992 22 20 0 ---- ALOFI
+91823 -1905 -16992 7 3 0 ---- ALOFI WHARF
 91824 -1907 -16993 59 59 0 ---- HANAN AIRPORT
 91826 -1807 -16318 4 3 0 ---- PALMERSTON *
 91831 -1882 -15977 0 5 0 ---- AITUTAKI AWS
 91841 -2017 -15735 0 25 0 ---- MAUKE AWS
 91843 -2120 -15982 7 7 0 T-P- RAROTONGA
 91844 -2120 -15978 0 0 0 ---- RAROTONGA
+91845 -2120 -15981 0 0 0 ---- RARATONGA AERO
 91848 -2192 -15794 0 41 0 ---- MANGAIA AWS
 91901 -38 -16002 2 0 0 ---- JARVIS ISLAND
 91902 -405 -15500 2 0 0 ---- MALDEN ISLAND (NORPAX)
@@ -12680,7 +12748,7 @@
 91945 -1991 -14494 3 2 0 ---- HEREHERETUE
 91948 -2313 -13497 89 91 0 T--- MANGAREVA
 91952 -2182 -13880 3 2 0 ---- MURUROA *
-91954 -2337 -14953 4 3 0 ---- TUBUAI AERO
+91954 -2337 -14953 6 5 0 ---- TUBUAI AERO
 91958 -2762 -14433 2 2 0 ---T RAPA
 91960 -2507 -13010 265 264 0 ---- PITCAIRN
 91961 -2507 -13010 265 264 0 ---- PITCAIRN ISLAND AWS A
@@ -13890,7 +13958,7 @@
 96615 -185 10997 9 0 0 ---- KETAPANG/RAHADI USMAN
 96633 -127 11690 3 0 0 P-P- BALIKPAPAN/SEPINGGAN
 96645 -270 11170 25 0 0 TPT- PANGKALAN BUN/ISKANDAR
-96655 -222 11400 27 0 0 P-P- PALANGKA RAYA/TJILIK RIWUT
+96655 -222 11394 27 0 0 P-P- PALANGKA RAYA/TJILIK RIWUT
 96685 -343 11475 20 0 0 TPTP BANJARMASIN/SYAMSUDIN NOOR
 96695 -340 11622 18 0 0 ---- KOTA BARU/STAGEN
 96737 -612 10613 40 0 0 PPP- SERANG
diff --git a/src/Thermo/BufrThermo.cc b/src/Thermo/BufrThermo.cc
index 4af2614..3fe7e4f 100644
--- a/src/Thermo/BufrThermo.cc
+++ b/src/Thermo/BufrThermo.cc
@@ -23,53 +23,49 @@ BufrThermo::BufrThermo() :
                    pCount_(0),
                    nlev_(0),
                    nTIME_STR_(13)
-{
-   //type_ = "MXSECTION";
-   //view_ = "MXSECTIONVIEW";
-}
+{ }
 
 BufrThermo::BufrThermo(const char* kw) :
                    Thermo(kw)
-{
-   //type_ = kw;
-   //view_ = "MXSECTIONVIEW";
-}
+{ }
 
 void
 BufrThermo::allocateDataMemory()
 {
-      pCount_ = 0;
-      T_.clear(); TD_.clear();
-      U_.clear(); V_.clear();
-      P_.clear();
+   pCount_ = 0;
+   T_.clear(); TD_.clear();
+   U_.clear(); V_.clear();
+   P_.clear();
 
-      // Allocate memory
-      if ( nlev_ > 0 )
-      {
-         T_.resize(nlev_);
-         TD_.resize(nlev_);
-         U_.resize(nlev_);
-         V_.resize(nlev_);
-         P_.resize(nlev_);
-      }
+   // Allocate memory
+   if ( nlev_ > 0 )
+   {
+      T_.resize(nlev_);
+      TD_.resize(nlev_);
+      U_.resize(nlev_);
+      V_.resize(nlev_);
+      P_.resize(nlev_);
+   }
 }
 
 void
 BufrThermo::initialiseDataMemory()
 {
-      pCount_ = 0;
-      for ( int i = 0; i < nlev_; i++ )
-      {
-         T_[i]  = MissingValue;
-         TD_[i] = MissingValue;
-         U_[i]  = MissingValue;
-         V_[i]  = MissingValue;
-         P_[i]  = MissingValue;
-      }
+   pCount_ = 0;
+   for ( int i = 0; i < nlev_; i++ )
+   {
+      T_[i]  = MissingValue;
+      TD_[i] = MissingValue;
+      U_[i]  = MissingValue;
+      V_[i]  = MissingValue;
+      P_[i]  = MissingValue;
+   }
 }
 
 bool BufrThermo::getAppParameters( MvRequest& in )
 {
+   // It is expected that the input request is expanded
+
    // Get station input parameter
    station_ = in.getSubrequest("STATION");
    if ( !station_ )
@@ -82,9 +78,10 @@ bool BufrThermo::getAppParameters( MvRequest& in )
 }
 
 // The data structure contains vectors for Temp, Td, Wind and Pressure.
-// There is only one Pressure vector related to the other 3 data. This means
-// that these 3 data may contain different number of Missing values, which will
-// be allocated in those positions when there is no Pressure level defined.
+// There is only one Pressure vector related to the other 3 data. This
+// means that these 3 data may contain different number of Missing 
+// values, which will be allocated in those positions when there is no
+// Pressure level defined.
 bool BufrThermo::processData()
 {
    // If it is not a BUFR data then it has been already processed
@@ -335,22 +332,12 @@ bool BufrThermo::ncInit(MvNetCDF &netcdf, MvObs& obs)
 
 bool BufrThermo::createOutputRequest(MvRequest& out)
 {
-   //MUDE ESTE TESTE PARA UMA FUNCAO. SUBSTITUA TAMBEM NA SUBROUTINA ACIMA
-   // If it is not a GRIB data then it has been already processed
-//   if ( strcmp(pars_.dataReq_.getVerb(),"GRIB") != 0 )
-//      return createSimpleOutputRequest(out);
-
    // Get default parameter to be plotted
    //ParamInfo* parInfo = plotVariable(params);
    //if ( !parInfo )
    //   return false;
 
    // Create netCDF data request
-   // Get action mode
-   string actionMode = this->actionMode();
-//(actionMode == "analyse" || actionMode == "prepare") )
-//verb = "NETCDF";
-
    MvRequest ncDataReq("NETCDF");
    ncDataReq("PATH") = this->ncFileName().c_str();
    ncDataReq("TEMPORARY") = 1;
@@ -371,10 +358,12 @@ bool BufrThermo::createOutputRequest(MvRequest& out)
    gReq("GRAPH_MISSING_DATA_THICKNESS") = 8;
    gReq("_CLASS") = "MGRAPH";
    gReq("_MODULEID") = thermoId;
+   gReq("_SKIP_MACRO") = 1;  // skip macro converter
    MvRequest dataReq = dReq + gReq;
 
    // Create Dewpoint output request
    dReq("NETCDF_X_VARIABLE") = sDEWPOINT.c_str();
+   dReq("_SKIP_MACRO") = 1;  // skip macro converter
 
    gReq("GRAPH_LINE_STYLE") = "dash",
    gReq("GRAPH_MISSING_DATA_STYLE") = "dash";
@@ -387,15 +376,21 @@ bool BufrThermo::createOutputRequest(MvRequest& out)
    wdReq("NETCDF_X_COMPONENT_VARIABLE") = sU.c_str();
    wdReq("NETCDF_Y_COMPONENT_VARIABLE") = sV.c_str();
    wdReq("_MODULEID") = thermoId;
+   wdReq("_SKIP_MACRO") = 1;  // skip macro converter
 
    MvRequest wReq("MWIND");
    wReq("WIND_FIELD_TYPE")  = "flags";
    wReq("WIND_FLAG_COLOUR") = "black";
    wReq("_CLASS") = "MWIND";
    wReq("_MODULEID") = thermoId;
+   wReq("_SKIP_MACRO") = 1;  // skip macro converter
 
    dataReq = dataReq + dReq + gReq + wdReq + wReq;
 
+   // Add information to help the Macro Converter to translate
+   // the output request to a Macro code
+   dataReq("_ORIGINAL_REQUEST") = this->buildMacroConverterRequest();
+
    // Create a default ThermoView request
    MvRequest viewReq("THERMOVIEW");
    //viewReq("X_AUTOMATIC") = "on";  //Not working 20140304, Sylvie is going to fixed.
@@ -403,6 +398,17 @@ bool BufrThermo::createOutputRequest(MvRequest& out)
    viewReq("MAXIMUM_TEMPERATURE") = -40;
    viewReq("_MODULEID") = thermoId;
 
+   // Add title information.
+   // It must be positioned before the Data+Visdef set of requests to avoid the
+   // following problem in uPlot: if another visdef (MGRAPH or MWIND) is defined
+   // after the GribThermo requests then it will not be associated to the GribThermo's
+   // output data because the existence of a MTEXT request between them.
+   MvRequest titleReq("MTEXT");
+   titleReq("TEXT_LINE_1") = this->title().c_str();
+   titleReq("TEXT_FONT_SIZE") = 0.5;
+   titleReq("_MODULEID") = thermoId;
+   titleReq("_SKIP_MACRO") = 1;  // skip macro converter
+
    // If action is not visualisation related then return the netcdf data.
    // Also, add the visualisation and original requests as hidden parameters.
    // These may be used later to help the visualisation of the netcdf data.
@@ -410,24 +416,13 @@ bool BufrThermo::createOutputRequest(MvRequest& out)
    {
       out = ncDataReq;
       out("_VIEW") = "THERMOVIEW";
-      out("_VISUALISE") = dataReq;
-      out("_CARTESIANVIEW") = viewReq;
-      out("_ORIGINAL_REQUEST") = origReq_;
+      out("_VISUALISE") = titleReq + dataReq;
+      out("_VIEW_REQUEST") = viewReq;
       out("_MODULEID") = thermoId;
 
       return true;
    }
 
-   // Add title information.
-   // It must be positioned before the Data+Visdef set of requests to avoid the
-   // following problem in uPlot: if another visdef (MGRAPH or MWIND) is defined
-   // after the GribThermo requests then it will not be associated to the GribThermo's
-   // output data because the existence of a MTEXT request between them.
-   MvRequest titleReq("MTEXT");
-   titleReq("TEXT_LINE_1") = this->title().c_str();
-   titleReq("TEXT_FONT_SIZE") = 0.5;
-   titleReq("_MODULEID") = thermoId;
-
    // Final output request
    out = viewReq + titleReq + dataReq;
 
diff --git a/src/Thermo/GribThermo.cc b/src/Thermo/GribThermo.cc
index 5dd9908..fd2112d 100644
--- a/src/Thermo/GribThermo.cc
+++ b/src/Thermo/GribThermo.cc
@@ -17,29 +17,18 @@ static const char* sPointSelection[] = { "AREA_AVERAGE", "COORDINATES", "STATION
 GribThermo::GribThermo() :
                Thermo("GRIB_THERMO"),
                windFlag_(false)
-{
-   //type_ = "MXSECTION";
-   //view_ = "MXSECTIONVIEW";
-}
+{ }
 
 GribThermo::GribThermo(const char*kw) :
                Thermo(kw),
                windFlag_(false)
-{
-   //type_ = kw;
-   //view_ = "MXSECTIONVIEW";
-}
+{ }
 
-GribThermo::~GribThermo()
-{
-}
+GribThermo::~GribThermo() {}
 
 bool GribThermo::getAppParameters( MvRequest& expReq )
 {
-//IMPORTANT: REVISE IF THIS EXPANSION IS NEEDED
-// Make sure that all parameters are defined
-//MvRequest expReq = in;
-//expReq = expReq.ExpandRequest("ThermoDataDef","ThermoDataRules",EXPAND_DEFAULTS);
+   // It is expected that the input request is expanded
 
    // Retrieve point selection
    string ps = (const char*)expReq("POINT_SELECTION");
@@ -313,11 +302,6 @@ bool GribThermo::createOutputRequest(MvRequest& out)
    //   return false;
 
    // Create netCDF data request
-   // Get action mode
-   string actionMode = this->actionMode();
-//(actionMode == "analyse" || actionMode == "prepare") )
-//verb = "NETCDF";
-
    MvRequest ncDataReq("NETCDF");
    ncDataReq("PATH") = this->ncFileName().c_str();
    ncDataReq("TEMPORARY") = 1;
@@ -335,6 +319,7 @@ bool GribThermo::createOutputRequest(MvRequest& out)
    gReq("GRAPH_LINE_THICKNESS") = 8;
    gReq("_CLASS") = "MGRAPH";
    gReq("_MODULEID") = thermoId;
+   gReq("_SKIP_MACRO") = 1;  // skip macro converter
    outd = outd + gReq;
 
    // Create Dewpoint output request
@@ -343,6 +328,7 @@ bool GribThermo::createOutputRequest(MvRequest& out)
    outtd("NETCDF_Y_VARIABLE") = sPRESSURE.c_str();
    outtd("NETCDF_X_VARIABLE") = sDEWPOINT.c_str();
    outtd("_MODULEID") = thermoId;
+   outtd("_SKIP_MACRO") = 1;  // skip macro converter
 
    gReq("GRAPH_LINE_COLOUR") = "red";
    gReq("GRAPH_LINE_STYLE") = "dash",
@@ -359,20 +345,37 @@ bool GribThermo::createOutputRequest(MvRequest& out)
       outw("NETCDF_X_COMPONENT_VARIABLE") = sU.c_str();
       outw("NETCDF_Y_COMPONENT_VARIABLE") = sV.c_str();
       outw("_MODULEID") = thermoId;
+      outw("_SKIP_MACRO") = 1;  // skip macro converter
 
       MvRequest wReq("MWIND");
       wReq("WIND_FIELD_TYPE")  = "flags";
       wReq("WIND_FLAG_COLOUR") = "black";
       wReq("_CLASS") = "MWIND";
       wReq("_MODULEID") = thermoId;
+      wReq("_SKIP_MACRO") = 1;  // skip macro converter
 
       outd = outd + outw + wReq;
    }
 
+   // Add information to help the Macro Converter to translate
+   // the output request to a Macro code
+   outd("_ORIGINAL_REQUEST") = this->buildMacroConverterRequest();
+
    // Create a default THERMOVIEW request
    MvRequest viewReq("THERMOVIEW");
    viewReq("_MODULEID") = thermoId;
 
+   // Add title information.
+   // It must be positioned before the Data+Visdef set of requests to avoid the
+   // following problem in uPlot: if another visdef (MGRAPH or MWIND) is defined
+   // after the GribThermo requests then it will not be associated to the GribThermo's
+   // output data because the existence of a MTEXT request between them.
+   MvRequest titleReq("MTEXT");
+   titleReq("TEXT_LINE_1") = title_.c_str();
+   titleReq("TEXT_FONT_SIZE") = 0.5;
+   titleReq("_MODULEID") = thermoId;
+   titleReq("_SKIP_MACRO") = 1;  // skip macro converter
+
    // If action is not visualisation related then return the netcdf data.
    // Also, add the visualisation and original requests as hidden parameters.
    // These may be used later to help the visualisation of the netcdf data.
@@ -380,24 +383,13 @@ bool GribThermo::createOutputRequest(MvRequest& out)
    {
       out = ncDataReq;
       out("_VIEW") = "THERMOVIEW";
-      out("_VISUALISE") = outd;
-      out("_CARTESIANVIEW") = viewReq;
-      out("_ORIGINAL_REQUEST") = origReq_;
+      out("_VISUALISE") = titleReq + outd;
+      out("_VIEW_REQUEST") = viewReq;
       out("_MODULEID") = thermoId;
 
       return true;
    }
 
-   // Add title information.
-   // It must be positioned before the Data+Visdef set of requests to avoid the
-   // following problem in uPlot: if another visdef (MGRAPH or MWIND) is defined
-   // after the GribThermo requests then it will not be associated to the GribThermo's
-   // output data because the existence of a MTEXT request between them.
-   MvRequest titleReq("MTEXT");
-   titleReq("TEXT_LINE_1") = title_.c_str();
-   titleReq("TEXT_FONT_SIZE") = 0.5;
-   titleReq("_MODULEID") = thermoId;
-
    // Final output request
    out = viewReq + titleReq + outd;
 
diff --git a/src/Thermo/MTHERMOGRIDDef b/src/Thermo/MTHERMOGRIDDef
index 511fe49..90ae603 100644
--- a/src/Thermo/MTHERMOGRIDDef
+++ b/src/Thermo/MTHERMOGRIDDef
@@ -1,7 +1,7 @@
 PARAMSHARE ; ParamShare; PARAMSHARE
 {
 	COLOUR {
-		%include MagicsColors.h
+		%include MagicsColours.txt
 	}
 	STYLE {
 		SOLID; SOLID
diff --git a/src/Thermo/MThermoDef b/src/Thermo/MThermoDef
index 173fc07..a83c9a3 100644
--- a/src/Thermo/MThermoDef
+++ b/src/Thermo/MThermoDef
@@ -1,7 +1,7 @@
 PARAMSHARE ; ParamShare; PARAMSHARE
 {
    COLOUR {
-      %include MagicsColors.h
+      %include MagicsColours.txt
    }
 
    STYLE {
diff --git a/src/Thermo/Thermo.cc b/src/Thermo/Thermo.cc
index 1000a4a..50bce25 100644
--- a/src/Thermo/Thermo.cc
+++ b/src/Thermo/Thermo.cc
@@ -204,6 +204,32 @@ void Thermo::createProcessedOutputRequest( MvRequest& out )
    out = viewReq + out1;
 }
 
+MvRequest Thermo::buildMacroConverterRequest()
+{
+   const char* caux = origReq_.getVerb();
+   MvRequest oreq( caux );
+   oreq("_MACRO_DECODE_TAG") = 1;  // extra info for the Macro Converter
+
+   oreq("_CLASS") = (const char*)origReq_("_CLASS") ? (const char*)origReq_("_CLASS") : caux;
+
+   oreq("_VERB") = (const char*)origReq_("_VERB") ? (const char*)origReq_("_VERB") : caux;
+
+   // Check if the input data is a MARS retrieval (RETRIEVE) 
+   // or a file (GRIB/BUFR)
+   if ( strcmp((const char*)oreq("_CLASS"),"RETRIEVE") == 0 ||
+        strcmp((const char*)oreq("_CLASS"),"GRIB") == 0     ||
+        strcmp((const char*)oreq("_CLASS"),"BUFR") == 0 )
+   {
+      MvRequest retReq = origReq_("DATA");
+      if ( (const char*)retReq("_NAME") )
+         oreq("_NAME") = (const char*)retReq("_NAME");
+   }
+   else if ( (const char*)origReq_("_NAME") )
+      oreq("_NAME") = (const char*)origReq_("_NAME");
+
+   return oreq;
+}
+
 //------------------------------------------------------------------------------
 
 int main(int argc,char **argv)
diff --git a/src/Thermo/Thermo.h b/src/Thermo/Thermo.h
index d284bd0..99d1ae4 100644
--- a/src/Thermo/Thermo.h
+++ b/src/Thermo/Thermo.h
@@ -64,6 +64,10 @@ public:
    // Get the application (original) view request
    MvRequest getAppView ( MvRequest& );
 
+   // Add information to help the Macro Converter to translate
+   // the output request to a Macro code
+   MvRequest buildMacroConverterRequest();
+
 protected:
 
    Thermo(const char*);
diff --git a/src/Thermo/ThermoDataDef b/src/Thermo/ThermoDataDef
index 73be07c..b66740a 100644
--- a/src/Thermo/ThermoDataDef
+++ b/src/Thermo/ThermoDataDef
@@ -75,6 +75,7 @@ GRIB_THERMO; Data Type Grib
    DEW_POINT_FORMULATION
    {
       SATURATION_OVER_WATER
+      SATURATION_OVER_ICE
       MIXED_PHASE_0_TO_-23
    } = SATURATION_OVER_WATER
 
diff --git a/src/XSection/Average.cc b/src/XSection/Average.cc
index 17d6e1f..d2c8f5e 100644
--- a/src/XSection/Average.cc
+++ b/src/XSection/Average.cc
@@ -184,23 +184,34 @@ MvRequest Average::createOutputRequest( ApplicationInfo& appInfo, ParamInfo* par
    // Create NetCDF output request
    string varname = getNetcdfVarname(parInfo->ParamName()).c_str();
    MvRequest out1("NETCDF_XY_MATRIX");
+   out1("NETCDF_DATA") = xs;
    out1("NETCDF_MISSING_ATTRIBUTE") = "_FillValue";
    out1("NETCDF_VALUE_VARIABLE") = varname.c_str();
    out1("NETCDF_Y_VARIABLE") = getNetcdfLevelVarname(varname).c_str();
    out1("NETCDF_X_VARIABLE") = (inputMode_ == AVERAGE_NS ) ? "lon" : "lat";
-   out1("NETCDF_DATA") = xs;
 
-   // Create customised Cartesian View request.
-   // If an icon was dropped into a view, uPlot will ignore it.
-   // Mode-specific options
-   MvRequest axis("HORIZONTAL_AXIS");
-   axis("AXIS_TICK_LABEL_TYPE") = (inputMode_ == AVERAGE_NS ) ? "longitude" : "latitude";
-   MvRequest viewReq("CARTESIANVIEW");
-   viewReq("X_AUTOMATIC") = "on";
-   viewReq("HORIZONTAL_AXIS") = axis;
-   viewReq("Y_AUTOMATIC") = "on";
-   if ( appInfo.levelType() != cML_UKMO_ND )  // UK MetOffice model levels are 'upside-down'
-      viewReq("Y_AUTOMATIC_REVERSE") = "on";
+   // Add information to help the Macro Converter to translate
+   // the output request to a Macro code
+   out1("_ORIGINAL_REQUEST") = buildMacroConverterRequest();
+
+   // Create View request using some parameters from the xaverage data request
+   MvRequest viewReq("MXAVERAGEVIEW");
+   if ( (const char*)origReq_("AREA") )
+   {
+      viewReq.addValue("AREA",(double)origReq_("AREA",0));
+      viewReq.addValue("AREA",(double)origReq_("AREA",1));
+      viewReq.addValue("AREA",(double)origReq_("AREA",2));
+      viewReq.addValue("AREA",(double)origReq_("AREA",3));
+   }
+   if ( (const char*)origReq_("DIRECTION") )
+      viewReq("DIRECTION") = origReq_("DIRECTION");
+
+   viewReq("_CLASS") = "MXAVERAGEVIEW";
+   viewReq("_DEFAULT") = true;
+   viewReq("_DATAATTACHED") = "YES";
+   if ( appInfo.levelType() != cML_UKMO_ND &&
+        appInfo.levelType() != XS_ML_GHBC )  // UK MetOffice model levels and GHBC fields are 'upside-down'
+      viewReq("_Y_AUTOMATIC_REVERSE") = "on";
 
    // If action is not visualisation related then return the netcdf data.
    // Also, add the visualisation and original requests as hidden parameters.
@@ -209,8 +220,7 @@ MvRequest Average::createOutputRequest( ApplicationInfo& appInfo, ParamInfo* par
    {
       xs("_VIEW") = view_.c_str();
       xs("_VISUALISE") = out1;
-      xs("_CARTESIANVIEW") = viewReq;
-      xs("_ORIGINAL_REQUEST") = origReq_;
+      xs("_VIEW_REQUEST") = viewReq;
       return xs;
    }
 
diff --git a/src/XSection/CrossS.cc b/src/XSection/CrossS.cc
index 5c9379e..ebba197 100644
--- a/src/XSection/CrossS.cc
+++ b/src/XSection/CrossS.cc
@@ -761,6 +761,7 @@ MvRequest CrossS::createOutputRequest( ApplicationInfo& appInfo, ParamInfo* parI
    // Create NetCDF output request
    string varname = getNetcdfVarname(parInfo->ParamName()).c_str();
    MvRequest out1("NETCDF_XY_MATRIX");
+   out1("NETCDF_DATA") = xs;
    out1("NETCDF_MISSING_ATTRIBUTE") = "_FillValue";
    out1("NETCDF_VALUE_VARIABLE") = varname.c_str();
    out1("NETCDF_Y_VARIABLE") = getNetcdfLevelVarname(varname).c_str();
@@ -788,7 +789,10 @@ MvRequest CrossS::createOutputRequest( ApplicationInfo& appInfo, ParamInfo* parI
       // Add flag to indicate that a MWIND visdef should be applied to this data
       out1("_VISDEF") = "MWIND";
    }
-   out1("NETCDF_DATA") = xs;
+
+   // Add information to help the Macro Converter to translate
+   // the output request to a Macro code
+   out1("_ORIGINAL_REQUEST") = buildMacroConverterRequest();
 
    // Add the orography curve visualiser
    if ( appInfo.haveLNSP() && (appInfo.levelType() == XS_ML_LNSP || appInfo.levelType() == XS_PL) )
@@ -800,6 +804,7 @@ MvRequest CrossS::createOutputRequest( ApplicationInfo& appInfo, ParamInfo* parI
       out_orog("NETCDF_X_VARIABLE")  = "orography_x_values";
       out_orog("NETCDF_X2_VARIABLE") = "orography_x_values";//"orography_x2_values";
       out_orog("NETCDF_MISSING_ATTRIBUTE") = "_FillValue";
+      out_orog("_SKIP_MACRO") = 1;  // tell MacroConverter to ignore this request
 
       // create Graph Plotting subrequest
       // OBS: itt should use a definition from the Default folder
@@ -820,8 +825,22 @@ MvRequest CrossS::createOutputRequest( ApplicationInfo& appInfo, ParamInfo* parI
       out1 = out1 + out_orog + empty;
    }
 
-   // Create View request
+   // Create View request using some parameters from the xsection data request
    MvRequest viewReq("MXSECTIONVIEW");
+   if ( (const char*)origReq_("LINE") )
+   {
+      viewReq.addValue("LINE",(double)origReq_("LINE",0));
+      viewReq.addValue("LINE",(double)origReq_("LINE",1));
+      viewReq.addValue("LINE",(double)origReq_("LINE",2));
+      viewReq.addValue("LINE",(double)origReq_("LINE",3));
+   }
+   if ( (const char*)origReq_("WIND_PARALLEL") )
+      viewReq("WIND_PARALLEL") = origReq_("WIND_PARALLEL");
+   if ( (const char*)origReq_("WIND_PERPENDICULAR") )
+      viewReq("WIND_PERPENDICULAR") = origReq_("WIND_PERPENDICULAR");
+   if ( (const char*)origReq_("WIND_INTENSITY") )
+      viewReq("WIND_INTENSITY") = origReq_("WIND_INTENSITY");
+
    viewReq("_CLASS") = "MXSECTIONVIEW";
    viewReq("_DEFAULT") = true;
    viewReq("_DATAATTACHED") = "YES";
@@ -839,9 +858,7 @@ MvRequest CrossS::createOutputRequest( ApplicationInfo& appInfo, ParamInfo* parI
    {
       xs("_VIEW") = view_.c_str();
       xs("_VISUALISE") = out1;
-      xs("_CARTESIANVIEW") = viewReq;
-      //xs("_VIEW_REQUEST") = viewReq;
-      xs("_ORIGINAL_REQUEST") = origReq_;
+      xs("_VIEW_REQUEST") = viewReq;
       return xs;
    }
 
diff --git a/src/XSection/MVProfileDef b/src/XSection/MVProfileDef
index 97a806c..a1e58de 100644
--- a/src/XSection/MVProfileDef
+++ b/src/XSection/MVProfileDef
@@ -19,10 +19,10 @@ MVPROFILE; Metview; Specific Application
 
     INPUT_MODE
     {
-        POINT             ; POINT
-        NEAREST_GRIDPOINT ; GPOINT
-        AREA              ; AREA
-        AREA_2            ; AREA2
+        POINT
+        NEAREST_GRIDPOINT
+        AREA
+        AREA_2
     } = POINT
 
     POINT [
diff --git a/src/XSection/MVProfileRules b/src/XSection/MVProfileRules
index e21fe00..b2fae2b 100644
--- a/src/XSection/MVProfileRules
+++ b/src/XSection/MVProfileRules
@@ -1,7 +1,7 @@
-%if INPUT_MODE = POINT %then
-    %unset AREA
+%if INPUT_MODE = POINT %or INPUT_MODE = NEAREST_GRIDPOINT %then
+   %unset AREA
 
-%if INPUT_MODE = AREA %then
+%if INPUT_MODE = AREA  %or INPUT_MODE = AREA_2 %then
    %unset POINT
 
 %if OUTPUT_MODE = NORMAL %then
diff --git a/src/XSection/MVProfileViewDef b/src/XSection/MVProfileViewDef
index 25458ae..ed92660 100644
--- a/src/XSection/MVProfileViewDef
+++ b/src/XSection/MVProfileViewDef
@@ -2,10 +2,10 @@ MVPROFILEVIEW; PlotMod Icon; Metview
 {
    INPUT_MODE
    {
-       POINT             ; POINT
-       NEAREST_GRIDPOINT ; GPOINT
-       AREA              ; AREA
-       AREA_2            ; AREA2
+       POINT
+       NEAREST_GRIDPOINT
+       AREA
+       AREA_2
    } = POINT
 
    POINT [
@@ -21,7 +21,7 @@ MVPROFILEVIEW; PlotMod Icon; Metview
 
    AREA [
           help = help_input,
-          help_icon = 'help_area',
+          help_icon = 'help_map',
           input_type = area,
           input_window = '/System/Defaults/Input Window'
         ]
diff --git a/src/XSection/MVProfileViewRules b/src/XSection/MVProfileViewRules
index 56b05f4..f889082 100644
--- a/src/XSection/MVProfileViewRules
+++ b/src/XSection/MVProfileViewRules
@@ -1,7 +1,7 @@
-%if INPUT_MODE = POINT %or INPUT_MODE = GPOINT %then
+%if INPUT_MODE = POINT %or INPUT_MODE = NEAREST_GRIDPOINT %then
    %unset AREA
 
-%if INPUT_MODE = AREA  %or INPUT_MODE = AREA2 %then
+%if INPUT_MODE = AREA  %or INPUT_MODE = AREA_2 %then
    %unset POINT
 
 %include PageFrameRules
diff --git a/src/XSection/MXAverageDef b/src/XSection/MXAverageDef
index ed36280..f22b944 100644
--- a/src/XSection/MXAverageDef
+++ b/src/XSection/MXAverageDef
@@ -25,7 +25,7 @@ MXAVERAGE; Metview; Specific Application
 
    AREA [
          help         = help_input,
-         help_icon    = 'help_area',
+         help_icon    = 'help_map',
          input_type   = area,
          input_window = '/System/Defaults/Input Window'
         ]
diff --git a/src/XSection/MXAverageViewDef b/src/XSection/MXAverageViewDef
index d8b34d5..c148fae 100644
--- a/src/XSection/MXAverageViewDef
+++ b/src/XSection/MXAverageViewDef
@@ -24,7 +24,7 @@ MXAVERAGEVIEW; uPlot Icon; Metview
 
    AREA [
           help         = help_input,
-          help_icon    = 'help_area',
+          help_icon    = 'help_map',
           input_type   = area,
           input_window = '/System/Defaults/Input Window'
         ]
@@ -35,14 +35,14 @@ MXAVERAGEVIEW; uPlot Icon; Metview
 
     DIRECTION
     {
-        NORTH SOUTH ; NS ; NS
-        EAST WEST   ; EW ; EW
+        NORTH SOUTH ; NS
+        EAST WEST   ; EW
     } = NS
 
-    MAP_PROJECTION  [ visible = false ]
-    {
-        cartesian
-    } = cartesian
+#    MAP_PROJECTION  [ visible = false ]
+#    {
+#        cartesian
+#    } = cartesian
 
     HORIZONTAL_AXIS [
                       interface       = icon,
diff --git a/src/XSection/MXSectionViewDef b/src/XSection/MXSectionViewDef
index 0e6cb76..713ef08 100644
--- a/src/XSection/MXSectionViewDef
+++ b/src/XSection/MXSectionViewDef
@@ -12,10 +12,10 @@ MXSECTIONVIEW; uPlot Icon; Metview
 
    %include MXSectionCommonDef
 
-   MAP_PROJECTION  [ visible = false ]
-   {
-      cartesian
-   } = cartesian
+#   MAP_PROJECTION  [ visible = false ]
+#   {
+#      cartesian
+#   } = cartesian
 
    HORIZONTAL_AXIS [interface       = icon,
                     class           = MAXIS,
diff --git a/src/XSection/VertProfDef b/src/XSection/VertProfDef
index f93d390..b98443b 100644
--- a/src/XSection/VertProfDef
+++ b/src/XSection/VertProfDef
@@ -20,10 +20,10 @@ PM_VPROF; Metview; Specific Application
 
    INPUT_MODE
    {
-      POINT             ; POINT
-      NEAREST_GRIDPOINT ; GPOINT
-      AREA              ; AREA
-      AREA_2            ; AREA2
+      POINT
+      NEAREST_GRIDPOINT
+      AREA
+      AREA_2
    } = POINT
 
    POINT
diff --git a/src/XSection/VertProfRules b/src/XSection/VertProfRules
index 938a4ec..d6af78e 100644
--- a/src/XSection/VertProfRules
+++ b/src/XSection/VertProfRules
@@ -1,5 +1,5 @@
-%if INPUT_MODE = POINT %or INPUT_MODE = GPOINT %then
+%if INPUT_MODE = POINT %or INPUT_MODE = NEAREST_GRIDPOINT %then
    %unset AREA
 
-%if INPUT_MODE = AREA  %or INPUT_MODE = AREA2 %then
+%if INPUT_MODE = AREA  %or INPUT_MODE = AREA_2 %then
    %unset POINT
diff --git a/src/XSection/VertProfViewDef b/src/XSection/VertProfViewDef
index 5e429d4..7b28e08 100644
--- a/src/XSection/VertProfViewDef
+++ b/src/XSection/VertProfViewDef
@@ -2,10 +2,10 @@ VERTPROFVIEW; PlotMod Icon; Metview
 {
    INPUT_MODE
    {
-      POINT             ; POINT
-      NEAREST_GRIDPOINT ; GPOINT
-      AREA              ; AREA
-      AREA_2            ; AREA2
+      POINT
+      NEAREST_GRIDPOINT
+      AREA
+      AREA_2
    } = POINT
 
    POINT
diff --git a/src/XSection/VertProfViewRules b/src/XSection/VertProfViewRules
index 3d08aeb..196e787 100644
--- a/src/XSection/VertProfViewRules
+++ b/src/XSection/VertProfViewRules
@@ -1,7 +1,7 @@
-%if INPUT_MODE = POINT %or INPUT_MODE = GPOINT %then
+%if INPUT_MODE = POINT %or INPUT_MODE = NEAREST_GRIDPOINT %then
    %unset AREA
 
-%if INPUT_MODE = AREA  %or INPUT_MODE = AREA2 %then
+%if INPUT_MODE = AREA  %or INPUT_MODE = AREA_2 %then
    %unset POINT
 
 %include PageFrameRules
diff --git a/src/XSection/Vprofile.cc b/src/XSection/Vprofile.cc
index 7934a01..39c61e7 100644
--- a/src/XSection/Vprofile.cc
+++ b/src/XSection/Vprofile.cc
@@ -600,14 +600,35 @@ MvRequest Vprofile::createOutputRequest( ApplicationInfo& appInfo, ParamInfo* pa
    out1("NETCDF_Y_VARIABLE") = XS_VARLEVEL.c_str();
    out1("NETCDF_X_VARIABLE") = parInfo->ParamName().c_str();
 
-   // Create customised Cartesian View request.
-   // If an icon was dropped into a view, uPlot will ignore it.
-   // Mode-specific options
-   MvRequest viewReq("CARTESIANVIEW");
-   viewReq("X_AXIS_TYPE") = "regular";
-   viewReq("X_AUTOMATIC") = "on";
-   viewReq("Y_AUTOMATIC") = "on";
-   viewReq("Y_AUTOMATIC_REVERSE") = "on";
+   // Add information to help the Macro Converter to translate
+   // the output request to a Macro code
+   out1("_ORIGINAL_REQUEST") = buildMacroConverterRequest();
+
+   // Create View request using some parameters from the vprofile data request
+   MvRequest viewReq("MVPROFILEVIEW");
+   if ( (const char*)origReq_("INPUT_MODE") )
+      viewReq("INPUT_MODE") = origReq_("INPUT_MODE");
+
+   if ( (const char*)origReq_("AREA") )
+   {
+      viewReq.addValue("AREA",(double)origReq_("AREA",0));
+      viewReq.addValue("AREA",(double)origReq_("AREA",1));
+      viewReq.addValue("AREA",(double)origReq_("AREA",2));
+      viewReq.addValue("AREA",(double)origReq_("AREA",3));
+   }
+
+   if ( (const char*)origReq_("POINT") )
+   {
+      viewReq.addValue("POINT",(double)origReq_("POINT",0));
+      viewReq.addValue("POINT",(double)origReq_("POINT",1));
+   }
+
+   viewReq("_CLASS") = "MVPROFILEVIEW";
+   viewReq("_DEFAULT") = true;
+   viewReq("_DATAATTACHED") = "YES";
+   if ( appInfo.levelType() != cML_UKMO_ND &&
+        appInfo.levelType() != XS_ML_GHBC )  // UK MetOffice model levels and GHBC fields are 'upside-down'
+      viewReq("_Y_AUTOMATIC_REVERSE") = "on";
 
    // If action is not visualisation related then return the netcdf data.
    // Also, add the visualisation and original requests as hidden parameters.
@@ -616,13 +637,11 @@ MvRequest Vprofile::createOutputRequest( ApplicationInfo& appInfo, ParamInfo* pa
    {
       xs("_VIEW") = view_.c_str();
       xs("_VISUALISE") = out1;
-      xs("_CARTESIANVIEW") = viewReq;
-      xs("_ORIGINAL_REQUEST") = origReq_;
+      xs("_VIEW_REQUEST") = viewReq;
       return xs;
    }
 
    // Final output request
-   out1("NETCDF_DATA") = xs;
    MvRequest out = viewReq + out1;
    return out;
 }
diff --git a/src/XSection/Xsect.cc b/src/XSection/Xsect.cc
index 4a079d6..399f369 100644
--- a/src/XSection/Xsect.cc
+++ b/src/XSection/Xsect.cc
@@ -120,7 +120,7 @@ bool Xsect::processData( MvRequest& data, ApplicationInfo& appInfo, MvRequest& o
       iparam = rq("PARAM");
       const char *lev = rq("LEVELIST");
       istep  = rq("STEP");
-      idate  = rq("DATE");
+      idate  = rq.getBaseDate();
       itime  = rq("TIME");
       expver = rq("EXPVER");
       isML = field.isModelLevel();
@@ -279,7 +279,7 @@ bool Xsect::processData( MvRequest& data, ApplicationInfo& appInfo, MvRequest& o
       currentGenerated++;
       MvRequest r = field.getRequest();
       iparam = r("PARAM");
-      idate  = r("DATE");
+      idate  = r.getBaseDate();
       itime  = r("TIME");
       istep  = r("STEP");
       expver = r("EXPVER");
@@ -941,9 +941,9 @@ MvRequest Xsect::createOutputRequest( MvRequest& in)
    // Create NetCDF output request
    MvRequest data = in.getSubrequest("DATA");
    MvRequest out1 = data.getSubrequest("_VISUALISE");
-   MvRequest viewReq = data.getSubrequest("_CARTESIANVIEW");
+   MvRequest viewReq = data.getSubrequest("_VIEW_REQUEST");
    data.unsetParam("_VISUALISE");        // to avoid duplication of info
-   data.unsetParam("_CARTESIANVIEW");    // to avoid duplication of info
+   data.unsetParam("_VIEW_REQUEST");    // to avoid duplication of info
    data.unsetParam("_ORIGINAL_REQUEST"); // to avoid duplication of info
    out1("NETCDF_DATA") = data;
 
@@ -1047,6 +1047,26 @@ MvNcVar* Xsect::getNetcdfVariableLevel( MvNetCDF& cdf, const string& varname, Ap
    return ncv;
 }
 
+MvRequest Xsect::buildMacroConverterRequest()
+{
+   const char* caux = origReq_.getVerb();
+   MvRequest oreq( caux );
+   oreq("_MACRO_DECODE_TAG") = 1;  // extra info for the Macro Converter
+   oreq("_CLASS") = (const char*)origReq_("_CLASS") ? (const char*)origReq_("_CLASS") : caux;
+   oreq("_VERB") = (const char*)origReq_("_VERB") ? (const char*)origReq_("_VERB") : caux;
+   if ( strcmp((const char*)oreq("_CLASS"),"RETRIEVE") == 0 ||
+        strcmp((const char*)oreq("_CLASS"),"GRIB") == 0 )
+   {
+      MvRequest retReq = origReq_("DATA");
+      if ( (const char*)retReq("_NAME") )
+         oreq("_NAME") = (const char*)retReq("_NAME");
+   }
+   else if ( (const char*)origReq_("_NAME") )
+      oreq("_NAME") = (const char*)origReq_("_NAME");
+
+   return oreq;
+}
+
 //------------------------------------------------------------------------------
 
 int main(int argc,char **argv)
diff --git a/src/XSection/Xsect.h b/src/XSection/Xsect.h
index 195bc64..1606a29 100644
--- a/src/XSection/Xsect.h
+++ b/src/XSection/Xsect.h
@@ -144,6 +144,10 @@ protected:
    // Free memory
    void deleteAuxiliaryMemory(double*, ParamMap&);
 
+   // Add information to help the Macro Converter to translate
+   // the output request to a Macro code
+   MvRequest buildMacroConverterRequest();
+
    // Variables
    MvRequest origReq_; // input request
    string type_;       // application type: MVPROFILE, MXSECTION, MXAVERAGE
diff --git a/src/libFTimeUtil/CMakeLists.txt b/src/libFTimeUtil/CMakeLists.txt
index 63b09b7..cb39afb 100644
--- a/src/libFTimeUtil/CMakeLists.txt
+++ b/src/libFTimeUtil/CMakeLists.txt
@@ -11,4 +11,5 @@ ecbuild_add_library( TARGET      FTimeUtil
                      INCLUDES    ${METVIEW_STANDARD_INCLUDES}
                      DEFINITIONS ${METVIEW_EXTRA_DEFINITIONS}
                      LIBS        ${METVIEW_EXTRA_LIBRARIES}
+                     DEPENDS     mvmarsxdr
                     )
diff --git a/src/libMars/CMakeLists.txt b/src/libMars/CMakeLists.txt
index e5a8407..3f1e193 100644
--- a/src/libMars/CMakeLists.txt
+++ b/src/libMars/CMakeLists.txt
@@ -83,7 +83,7 @@ endif()
 
 if ( NOT LIBEMOS_FOUND )
     add_definitions(-DNOPPROC)
-    message(FATAL_ERROR "No emoslib found - should not have got this far!")
+    ecbuild_critical("No emoslib found - should not have got this far!")
 endif()
 
 
diff --git a/src/libMarsClient/CMakeLists.txt b/src/libMarsClient/CMakeLists.txt
index 3f831a5..685ec8d 100644
--- a/src/libMarsClient/CMakeLists.txt
+++ b/src/libMarsClient/CMakeLists.txt
@@ -144,25 +144,32 @@ add_custom_command(
 add_custom_target(marsxdr DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.h ${CMAKE_CURRENT_BINARY_DIR}/marsxdr.c)
 add_custom_target(marslex DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/langy.c ${CMAKE_CURRENT_BINARY_DIR}/langl.c)
 
+#### TODO: Mechanism to choose ecCodes over grib_api -- REVIEW
+set( grib_handling_pkg grib_api )
+if( HAVE_ECCODES )
+    set( grib_handling_pkg eccodes )
+endif()
+####
+
 ecbuild_add_library(
 	TARGET      mars
     TYPE        STATIC
     GENERATED   mars_client_version.c
 	SOURCES     ${mars_client_src_files} mars_client_version.c
 	DEPENDS     marsxdr marslex
-    PUBLIC_INCLUDES
-        ${GRIB_API_INCLUDE_DIRS}
     PRIVATE_INCLUDES
+        ${GRIB_API_INCLUDE_DIRS}
         ${CURL_INCLUDE_DIRS}
     DEFINITIONS ${GRIB_API_DEFINITIONS}
-    LIBS        grib_api ${MARS_FEATURE_LIBRARIES} ${CURL_LIBRARIES} ${CMATH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
+    LIBS        ${grib_handling_pkg} ${MARS_FEATURE_LIBRARIES} ${CURL_LIBRARIES} ${CMATH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
 
 set_directory_properties( ADDITIONAL_MAKE_CLEAN_FILES rpcmars.h marsxdr.c langl.c langy.c )
 
 ecbuild_add_executable(
-	TARGET      mars.bin
+	TARGET    mars.bin
+  INCLUDES  ${GRIB_API_INCLUDE_DIRS}
 	SOURCES		mars.c
-    LIBS		mars
+  LIBS		  mars
 )
 
 add_subdirectory( tools )
diff --git a/src/libMarsClient/dhsbase.c b/src/libMarsClient/dhsbase.c
index bac6e4c..41a69de 100644
--- a/src/libMarsClient/dhsbase.c
+++ b/src/libMarsClient/dhsbase.c
@@ -92,6 +92,10 @@ typedef struct dhsdata {
 	mars_grib_index* head_idx;
 	mars_grib_index* tail_idx;
 
+	boolean          mars2mars;
+	request*         othermars;
+	long             expect;
+
 } dhsdata;
 
 static option opts[] = {
@@ -2305,6 +2309,10 @@ static err dhs_send(dhsdata *dhs,request *r,request *e)
 	/* send id */
 	stream_write_ulonglong(&dhs->s,0);
 
+	if(dhs->mars2mars) {
+		set_value(r, "_expect", "%d", dhs->expect);
+	}
+
 	/* Send requests */
 
 	send_request(&dhs->s,r);
@@ -2323,15 +2331,36 @@ static err dhs_send(dhsdata *dhs,request *r,request *e)
 
 	/* Send datahandle */
 
-	stream_write_start(&dhs->s,"MarsHandle");
+	if(dhs->mars2mars) {
+		request* req = empty_request("RETRIEVE");
+		stream_write_start(&dhs->s,"Mars2MarsHandle");
 
-	stream_write_string(&dhs->s,addr);
-	stream_write_int(&dhs->s,port);
-	stream_write_ulonglong(&dhs->s,dhs->id);
+		
+		reqcpy_no_underscores(req, r);
+		send_request(&dhs->s, req);
+		free_all_requests(req);
 
-	stream_write_int(&dhs->s,mars.crc);
+		send_request(&dhs->s, dhs->othermars);
+
+		stream_write_string(&dhs->s, no_quotes(get_value(r, "SOURCE", 0)) + 7);
+
+		stream_write_end(&dhs->s);
+
+	}
+	else {
+
+		stream_write_start(&dhs->s,"MarsHandle");
+
+		stream_write_string(&dhs->s,addr);
+		stream_write_int(&dhs->s,port);
+		stream_write_ulonglong(&dhs->s,dhs->id);
+
+		stream_write_int(&dhs->s,mars.crc);
+
+		stream_write_end(&dhs->s);
+
+	}
 
-	stream_write_end(&dhs->s);
 
 	stream_write_end(&dhs->s);
 
@@ -2438,65 +2467,110 @@ static err  dhs_open(void *data,request *r,request *e,int mode)
 			return -5;
 		}
 
-		if((error = sanity_check(dhs->req)) != NOERR)
-			return error;
+		if(strncmp(s, "mars://", 7) == 0) {
 
-		if((error = check_file_sizes(dhs->req) != NOERR))
-			return error;
+			request *setup = mars.setup;
+
+			dhs->expect = count_fields(r);
+			marslog(LOG_INFO,"Using MARS to MARS third party transfer, archiving %ld field(s)", dhs->expect);
+			if(count_values(r, "SOURCE") != 1) {
+				marslog(LOG_EROR,"Multi-source not supported for third party transfer");
+				return -5;
+			}
+
+            while(setup && !dhs->othermars) {
+                int i;
+                for(i=0; i<count_values(setup,"name"); i++) {
+                    if(EQ(get_value(setup, "name", i), s+7)) {
+                        dhs->othermars = setup;
+                    }
+                }
+				setup = setup->next;
+			}
+
+			if(!dhs->othermars || !EQ(get_value(dhs->othermars,"class", 0), "dhsbase")) {
+				marslog(LOG_EROR, "Invalid database for third party transfer: %s", s+7);
+				marslog(LOG_EROR, "Possible values are:");
+				setup = mars.setup;
+				while(setup) {
+					if(EQ(get_value(setup, "class", 0), "dhsbase")) {
+                        int i;
+                        for(i=0; i<count_values(setup,"name"); i++) {
+                            marslog(LOG_EROR, "  %s", get_value(setup, "name", i));
+                        }
+					}
+					setup = setup->next;
+				}
+				return -5;
+			}
+
+
+			dhs->mars2mars = true;
 
-		if(observation(r))
-		{
-			if((error = dhs_obs_check(dhs,r)))
-				return error;
-		}
-		/* Images should be checked as other GRIB, from grib_api 1.10.0 */
-		else if (image(r))
-		{
-			if( (error = dhs_image_check(dhs)) )
-				return error;
-		}
-		else if (feedback(r))
-		{
-			if( (error = dhs_fb_check(dhs,r)) )
-				return error;
-		}
-		else if (bias(r))
-		{
-			if( (error = dhs_bias_check(dhs,r)) )
-				return error;
-		}
-		else if (track(r))
-		{
-			if( (error = dhs_track_check(dhs,r)) )
-				return error;
 		}
-		else if (is_odb(r))
-		{
-			if( (error = dhs_odb_check(dhs,r)) )
+		else {
+
+			if((error = sanity_check(dhs->req)) != NOERR)
 				return error;
-		}
-		else
-		{
-			if( (error = dhs_grib_check(dhs,r)) )
+
+			if((error = check_file_sizes(dhs->req) != NOERR))
 				return error;
-		}
 
-		if(getenv("MARS_NO_ARCH"))
-		{
-			marslog(LOG_WARN,"'MARS_NO_ARCH' selected. Skipping archive");
-			dhs->finished = true;
-			return 0;
-		}
+			if(observation(r))
+			{
+				if((error = dhs_obs_check(dhs,r)))
+					return error;
+			}
+			/* Images should be checked as other GRIB, from grib_api 1.10.0 */
+			else if (image(r))
+			{
+				if( (error = dhs_image_check(dhs)) )
+					return error;
+			}
+			else if (feedback(r))
+			{
+				if( (error = dhs_fb_check(dhs,r)) )
+					return error;
+			}
+			else if (bias(r))
+			{
+				if( (error = dhs_bias_check(dhs,r)) )
+					return error;
+			}
+			else if (track(r))
+			{
+				if( (error = dhs_track_check(dhs,r)) )
+					return error;
+			}
+			else if (is_odb(r))
+			{
+				if( (error = dhs_odb_check(dhs,r)) )
+					return error;
+			}
+			else
+			{
+				if( (error = dhs_grib_check(dhs,r)) )
+					return error;
+			}
 
-		if(!mars.fields_are_ok)
-		{
-			FILE *f = mail_open(mars.dhsmail,"Mars ARCHIVE failure (dhsbase)");
-			mail_request(f,"MARS Request:",r);
-			mail_request(f,"MARS Environment:",e);
-			mail_close(f);
+			if(getenv("MARS_NO_ARCH"))
+			{
+				marslog(LOG_WARN,"'MARS_NO_ARCH' selected. Skipping archive");
+				dhs->finished = true;
+				return 0;
+			}
+
+			if(!mars.fields_are_ok)
+			{
+				FILE *f = mail_open(mars.dhsmail,"Mars ARCHIVE failure (dhsbase)");
+				mail_request(f,"MARS Request:",r);
+				mail_request(f,"MARS Environment:",e);
+				mail_close(f);
+
+				marslog(LOG_EROR,"Some of the fields are rejected by the new mars server");
+				return -1;
+			}
 
-			marslog(LOG_EROR,"Some of the fields are rejected by the new mars server");
-			return -1;
 		}
 
 	}
diff --git a/src/libMarsClient/environ.c b/src/libMarsClient/environ.c
index 4f94882..4f23bb6 100644
--- a/src/libMarsClient/environ.c
+++ b/src/libMarsClient/environ.c
@@ -244,7 +244,7 @@ request *get_environ(void)
 
 	if(env) return env;
 
-	if(EQ(who,"bamboo") || EQ(who,"deploy"))
+	if(EQ(who,"bamboo") || EQ(who,"deploy") || (EQ(who,"worker") && !mars.marslite_mode) )
 		who = user("max");
 
 	if(useTest && EQ(who,"max"))
diff --git a/src/libMarsClient/expand.c b/src/libMarsClient/expand.c
index 7fe7421..51fb541 100644
--- a/src/libMarsClient/expand.c
+++ b/src/libMarsClient/expand.c
@@ -822,7 +822,7 @@ static parameter* match_parameter(parameter *r,parameter *lang,boolean verbose)
 		boolean prio = prio1 && prio2 && atol(prio1) != atol(prio2);
 
 		if(verbose)
-			marslog(prio?LOG_WARN:LOG_EROR,
+			marslog(prio?LOG_DBUG:LOG_EROR,
 				"Ambiguous parameter: %s could be %s or %s",
 				r->name,
 				match1->name,
@@ -833,7 +833,7 @@ static parameter* match_parameter(parameter *r,parameter *lang,boolean verbose)
 			if(atol(prio1) > atol(prio2))
 				match2 = match1;
 			if(verbose)
-				marslog(LOG_WARN,"Assuming that '%s' means '%s'",r->name,match2->name);
+				marslog(LOG_DBUG,"Assuming that '%s' means '%s'",r->name,match2->name);
 		}
 		else {
 			return NULL;
@@ -1085,10 +1085,10 @@ static request *match_verb(const request* r,request *lang)
 
 		if(n > 1)
 		{
-			marslog(LOG_WARN,"Ambiguous verb: '%s' could be:",r->name);
+			marslog(LOG_DBUG,"Ambiguous verb: '%s' could be:",r->name);
 			for(i = 0; i < top; i++)
 				if(ok[i])
-					marslog(LOG_WARN,"  %s (%s)",matches[i]->name,matches[i]->kind);
+					marslog(LOG_DBUG,"  %s (%s)",matches[i]->name,matches[i]->kind);
 			tell = true;
 		}
 	}
@@ -1097,7 +1097,7 @@ static request *match_verb(const request* r,request *lang)
 		use = 0;
 
 	if(tell)
-		marslog(LOG_INFO,"Choosing %s (%s)", matches[use]->name, matches[use]->kind);
+		marslog(LOG_DBUG,"Choosing %s (%s)", matches[use]->name, matches[use]->kind);
 	return matches[use];
 }
 
diff --git a/src/libMarsClient/nfdbbase.c b/src/libMarsClient/nfdbbase.c
index b355885..4708d9e 100644
--- a/src/libMarsClient/nfdbbase.c
+++ b/src/libMarsClient/nfdbbase.c
@@ -1,9 +1,9 @@
 /*
  * © Copyright 1996-2012 ECMWF.
- * 
+ *
  * This software is licensed under the terms of the Apache Licence Version 2.0
- * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 
- * In applying this licence, ECMWF does not waive the privileges and immunities 
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ * In applying this licence, ECMWF does not waive the privileges and immunities
  * granted to it by virtue of its status as an intergovernmental organisation nor
  * does it submit to any jurisdiction.
  */
@@ -11,7 +11,7 @@
 #include "mars.h"
 #define HYPERCUBE
 
-#if defined(ECMWF) && !defined(NOFDB)
+#if !defined(NOFDB)
 
 #define PARAM_U  131
 #define PARAM_V  132
@@ -130,7 +130,7 @@ static err timed_readfdb(int *ref, void *buffer, int *length, timer *t)
 	return e;
 }
 
-/* 
+/*
    n=100000 for step range or fcperiod
    n=1000 for quantile
 */
@@ -148,7 +148,7 @@ static long range2fdb(const char *r, long n)
 		{
 			++p;
 			sr.to   = atol(p);
-			break;	
+			break;
 		}
 		--p;
 	}
@@ -198,7 +198,7 @@ static err  nfdb_open(void *data,request *r,request *ev,int mode)
 	fdb->expect_any = (p && (atol(p) == 0));
 
 	if(fdb->expect)
-		if(count_values(r,"DATABASE") == 1)	
+		if(count_values(r,"DATABASE") == 1)
 			marslog(LOG_INFO,"Trying to retrieve %d fields from the fdb",
 				fdb->expect);
 
@@ -512,7 +512,7 @@ static err setallvalues(fdbdata *fdb,request *s)
 	{
 		if(get_value(r,p->name,0) == 0)
 			valcpy(r,s,p->name,p->name);
-			
+
 		p = p->next;
 	}
 
@@ -591,7 +591,7 @@ static err setallvalues(fdbdata *fdb,request *s)
 				if(isrange(q))
 				{
 					char buf[12];
-					/* Once FP in FDB is like EFI (ranges), we can remove 
+					/* Once FP in FDB is like EFI (ranges), we can remove
 					   next test and only set ranges as p1*100000+p2 */
 					if(!fp)
 					{
@@ -663,7 +663,7 @@ static err setallvalues(fdbdata *fdb,request *s)
 					int n = 4-strlen(q);
 					strcpy(buf,q);
 					while(n-->0) strcat(buf,"0");
-				}	
+				}
 				setvalsfdb(&fdb->ref,"levelist",buf);
 			}
 		}
@@ -801,40 +801,40 @@ void request_to_fdb(int ref,request *r,int y2k)
 
 	while(p)
 	{
-		if((p->name[0] == '_') || 
+		if((p->name[0] == '_') ||
 			(strcmp(p->name,"REPRES") == 0))
 		{
 			/* Skip */
 		}
 		else if(strcmp(p->name,"STREAM") == 0)
 		{
-		 	if(strcmp(p->values->name,"DA") == 0) 
+		 	if(strcmp(p->values->name,"DA") == 0)
 				SETVALFDB(&ref,"stream","oper");
 			else
-		 	if(strcmp(p->values->name,"SD") == 0) 
+		 	if(strcmp(p->values->name,"SD") == 0)
 				SETVALFDB(&ref,"stream","supd");
 			else
-		 	if(strcmp(p->values->name,"WAVE") == 0) 
+		 	if(strcmp(p->values->name,"WAVE") == 0)
 			{
 				if(strcmp(get_value(r,"TYPE",0),"FG") == 0)
 					wave_fg = true;
 				SETVALFDB(&ref,"stream","wave");
 			}
 			else
-		 	if(strcmp(p->values->name,"SCWV") == 0) 
+		 	if(strcmp(p->values->name,"SCWV") == 0)
 			{
 				if(strcmp(get_value(r,"TYPE",0),"FG") == 0)
 					wave_fg = true;
 				SETVALFDB(&ref,"stream","scwv");
 			}
 			else
-		 	if(strcmp(p->values->name,"EF") == 0) 
+		 	if(strcmp(p->values->name,"EF") == 0)
 				SETVALFDB(&ref,"stream","enfo");
 			else
-		 	if(strcmp(p->values->name,"SF") == 0) 
+		 	if(strcmp(p->values->name,"SF") == 0)
 				SETVALFDB(&ref,"stream","sens");
 			else
-		 	if(strcmp(p->values->name,"MO") == 0) 
+		 	if(strcmp(p->values->name,"MO") == 0)
 			{
 				SETVALFDB(&ref,"stream","mnth");
 			}
@@ -883,7 +883,7 @@ void request_to_fdb(int ref,request *r,int y2k)
 				strcpy(buf,p->values->name);
 				while(n-->0) strcat(buf,"0");
 
-			}	
+			}
 			SETVALFDB(&ref,"levelist",buf);
 		}
 		else
@@ -974,7 +974,7 @@ static err  _nfdb_read(void *data,request *r,void *buffer,long *length)
 	request *z = get_cubelet(fdb->h,fdb->index++);
 	fdb->w = z;
 #endif
-	
+
 	if(fdb->retrieve)
 	{
 		long64 total = 0;
@@ -1006,7 +1006,7 @@ static err  _nfdb_read(void *data,request *r,void *buffer,long *length)
 #if 0
 	if(!fdb->leg_done)
 	{
-		if(isfdb_attribute(&ref,"leg")) 
+		if(isfdb_attribute(&ref,"leg"))
 			SETVALFDB(&ref,"leg","off");
 		fdb->leg_done = true;
 	}
@@ -1041,7 +1041,7 @@ static err  _nfdb_read(void *data,request *r,void *buffer,long *length)
 		}
 	}
 
-	if((ret == -1  || ret == -2) && (fdb->expect != 0 || fdb->expect_any)) 
+	if((ret == -1  || ret == -2) && (fdb->expect != 0 || fdb->expect_any))
 	    return -42;
 
 	if(ret == 0 && r && !observation(r) && !track(r))
diff --git a/src/libMarsClient/request.c b/src/libMarsClient/request.c
index c139afd..94ffe0a 100644
--- a/src/libMarsClient/request.c
+++ b/src/libMarsClient/request.c
@@ -452,6 +452,7 @@ static char *names[] = {
 
 	"IDENT",
 	"OBSTYPE",
+    "INSTRUMENT",
 	"REPORTYPE",
 
 	 /* For 2-d wave-spectra products */
@@ -507,6 +508,7 @@ static namecmp cmpnames[] = {
 
 	eq_integer,   /* IDENT */
 	eq_integer,   /* OBSTYPE */
+	eq_integer,   /* INSTRUMENT */
 	eq_integer,   /* REPORTYPE */
 
 	eq_integer,   /* FREQUENCY */
@@ -1658,7 +1660,7 @@ static boolean chk_152(int count,char *names[],char *vals[])
 			}
 		}
 
-		if(EQ(names[i],"LEVELIST") && vals[i] && !EQ(vals[i],"1"))
+		if(EQ(names[i],"LEVELIST") && vals[i] && !(EQ(vals[i],"1") || EQ(vals[i],"01")))
 			flg++;
 	}
 
@@ -2277,6 +2279,31 @@ void reqcpy(request *a,const request *b)
 	}
 }
 
+void reqcpy_no_underscores(request *a,const request *b)
+{
+	if(a && b)
+	{
+		parameter *p = b->params;
+
+		while(p)
+		{
+			if(*p->name != '_') {
+				boolean b = false;
+				value *v = p->values;
+
+				while(v)
+				{
+					put_value(a,p->name,v->name,b,false,false);
+					b = true;
+					v = v->next;
+				}
+			}
+
+			p = p->next;
+		}
+	}
+}
+
 static void _reqmerge(parameter *pa,const parameter *pb,request *a)
 {
 	const value *vb = pb->values;
diff --git a/src/libMarsClient/rpcmars.x b/src/libMarsClient/rpcmars.x
index 1b94271..0b4865b 100644
--- a/src/libMarsClient/rpcmars.x
+++ b/src/libMarsClient/rpcmars.x
@@ -2,7 +2,7 @@
 %#include <rpc/xdr.h>
 #ifdef RPC_HDR
 %typedef char *cache_t;
-%typedef void *void_t;
+%typedef void *voidp_t;
 #endif
 
 struct value {
@@ -31,7 +31,7 @@ struct request {
 	cache_t         kind;
 
 #ifdef RPC_HDR
-	void_t           data; /* user data */
+	voidp_t          data; /* user data */
 	long             order;
 #endif
 
diff --git a/src/libMarsClient/tools.c b/src/libMarsClient/tools.c
index 4e301a3..31c7c2c 100644
--- a/src/libMarsClient/tools.c
+++ b/src/libMarsClient/tools.c
@@ -122,7 +122,12 @@ long64 proc_mem()
 
 long64 proc_mem()
 {
-	return 0;
+    struct rusage rup;
+
+    if(getrusage(RUSAGE_SELF,&rup) != -1)
+        return rup.ru_maxrss*1024;
+
+    return 0;
 }
 
 #endif
@@ -1591,13 +1596,15 @@ long _readany(FILE *f, char *b, long *l)
 {
 	size_t len = *l;
 	long e =  wmo_read_any_from_file(f,(unsigned char*)b,&len);
-	*l = len;
 
-	if(e && e != GRIB_END_OF_FILE) 
-		marslog(LOG_EROR|LOG_PERR,"wmo_read_any_from_file: error %d (%s) l=%ld, len=%ld",e,
-			grib_get_error_message(e),len);
+    if(e && e != GRIB_END_OF_FILE) {
+        marslog(LOG_EROR|LOG_PERR,"wmo_read_any_from_file: error %d (%s) l=%ld, len=%ld", e,
+        grib_get_error_message(e), l, len);
+    }
 
-	return e;
+    *l = len;
+
+    return e;
 }
 
 long _readgrib(FILE *f, char *b, long *l)
diff --git a/src/libMetview/CMakeLists.txt b/src/libMetview/CMakeLists.txt
index 89c38e4..05fcd88 100644
--- a/src/libMetview/CMakeLists.txt
+++ b/src/libMetview/CMakeLists.txt
@@ -38,6 +38,7 @@ ecbuild_add_library( TARGET      Metview
                      INCLUDES    ${METVIEW_STANDARD_INCLUDES}
                      DEFINITIONS ${METVIEW_EXTRA_DEFINITIONS}
                      LIBS        ${METVIEW_EXTRA_LIBRARIES}
+                     DEPENDS     mvmarsxdr
                     )
 
 
diff --git a/src/libMetview/MvFieldSet.cc b/src/libMetview/MvFieldSet.cc
index 8285da6..fcb79f5 100644
--- a/src/libMetview/MvFieldSet.cc
+++ b/src/libMetview/MvFieldSet.cc
@@ -1688,7 +1688,7 @@ double MvField::yyyymmddFoh()
 
 	return 0;               //-- failed to extract date
 #endif
-	double dat = mvgrid_->getDouble("date");
+	double dat = mvgrid_->getDouble("dataDate");
 	double tim = mvgrid_->getDouble("time");
 
 	//nontested_grib_api_port("MvField::yyyymmddFoh()");
diff --git a/src/libMetview/MvGrid.cc b/src/libMetview/MvGrid.cc
index 2a4eedc..9aaf59d 100644
--- a/src/libMetview/MvGrid.cc
+++ b/src/libMetview/MvGrid.cc
@@ -1480,6 +1480,9 @@ MvLambertGrid::MvLambertGrid( field* myfield
        return;
    }
 
+   long jPositive = getLong("jScansPositively");      //-- points scan in +j dir
+   jPositive_ = (jPositive == 1);
+
    earthRadius_ = cEarthRadius;
 
    gridTanLat_ = getDouble("Latin1InDegrees") * 1000; // sec2_[cInterSecLat1];
@@ -1510,7 +1513,7 @@ MvLambertGrid::MvLambertGrid( field* myfield
    }
 
    earthRadiusPerDx_ = earthRadius_ / dx_;
-   cout << "R, dx, R/dx:\t" << earthRadius_ << "\t" << dx_ << "\t" << earthRadiusPerDx_ << endl;
+   //cout << "R, dx, R/dx:\t" << earthRadius_ << "\t" << dx_ << "\t" << earthRadiusPerDx_ << endl;
 
    hemiSphere_ = gridTanLat_ > 0 ? 1 : 0;
    gridTanLat_ = (gridTanLat_ / cGridScaling) * cToRadians;  //--aki cGridScaling--//
@@ -1613,7 +1616,7 @@ MvLambertGrid::computeLatLon( int ip, int jp )
 //--   PRGMMR: STACKPOLE        ORG: NMC42       DATE:88-11-28
 
     double XX = (double)ip - poleI_;
-    double YY = poleJ_ - (double)jp;
+    double YY = (jPositive_) ? poleJ_ - (double)jp : poleJ_ - (double)(1+horisLines_-jp);
     double R2 = XX*XX + YY*YY;
 //
 //        CHECK THAT THE REQUESTED I,J IS NOT IN THE FORBIDDEN ZONE
diff --git a/src/libMetview/MvGrid.h b/src/libMetview/MvGrid.h
index 9f1c8b5..bd7c4cd 100644
--- a/src/libMetview/MvGrid.h
+++ b/src/libMetview/MvGrid.h
@@ -437,6 +437,7 @@ class MvLambertGrid : public MvGridBase
 	double       theThing_;
 	int          currentI_;
 	int          currentJ_;
+	bool         jPositive_;
 };
 
 
diff --git a/src/libMetview/MvObs.cc b/src/libMetview/MvObs.cc
index e4a3f05..f093c97 100644
--- a/src/libMetview/MvObs.cc
+++ b/src/libMetview/MvObs.cc
@@ -2876,6 +2876,7 @@ MvObs::OperaRadarImage(  )
       throw MvException( "MvObs::OperaRadarImage: unable to get Row Number element!" );
    }
                                                      //-- "FortranIndex": 0,1,2,...
+   // the following line assigns an unused variable, but the line is still essential
    int rowRepeatCount = (*this)[firstRowStartIndex]; //-- operator[i], i=1,2,3,...
    long currentDescr = currentDescriptor();
    if( currentDescr != 31002 )
diff --git a/src/libMetview/MvObsSet.cc b/src/libMetview/MvObsSet.cc
index 74f3f09..701a530 100644
--- a/src/libMetview/MvObsSet.cc
+++ b/src/libMetview/MvObsSet.cc
@@ -207,92 +207,100 @@ MvObsSet :: rewind()
 MvObs
 MvObsSet::next()
 {
-   const int EOF_STATUS = -1;
+    const int EOF_STATUS = -1;
+    bool readAnotherMessage = true;
 
-   if( ! _bufrFile )
-     return MvObs( NULL );  // nothing if file not ok
+    if( ! _bufrFile )
+        return MvObs( NULL );  // nothing if file not ok
 
-   if( _IO_mode == WRITE )
-     return MvObs( NULL );  // no next when writing !
+    if( _IO_mode == WRITE )
+        return MvObs( NULL );  // no next when writing !
 
-   _msgLen = MAX_MESSAGE_LENGTH;
+    _msgLen = MAX_MESSAGE_LENGTH;
 
-   _msgNumber++;
+    _msgNumber++;
 
-   long lastPos = ftell(_bufrFile);
-   long myError = _readbufr( _bufrFile, _message, &_msgLen );
+    long lastPos = ftell(_bufrFile);
+    long myError = _readbufr( _bufrFile, _message, &_msgLen );
 
-   if ( myError == -3 )  // Bufr too small
-     {
 
-       // Go back to previous and allocate memory
-       fseek(_bufrFile,lastPos,SEEK_SET);
-       delete [] _message;
-       MAX_MESSAGE_LENGTH = _msgLen + 8;
-       _message = new char[ MAX_MESSAGE_LENGTH ];
-       _msgLen = MAX_MESSAGE_LENGTH;
+    while (readAnotherMessage)
+    {
+        readAnotherMessage = false;  // might be set to true in the PREPBufr part
 
-       if ( ! _message )
-	 {
-	   cerr << "MvObsSet::next: Cannot allocate memory for next BUFR message" << endl;
+        if ( myError == -3 )  // Bufr too small
+        {
+            // Go back to previous and allocate memory
+            fseek(_bufrFile,lastPos,SEEK_SET);
+            delete [] _message;
+            MAX_MESSAGE_LENGTH = _msgLen + 8;
+            _message = new char[ MAX_MESSAGE_LENGTH ];
+            _msgLen = MAX_MESSAGE_LENGTH;
+
+            if ( ! _message )
+            {
+                cerr << "MvObsSet::next: Cannot allocate memory for next BUFR message" << endl;
 #ifdef METVIEW
-	   marslog( LOG_EROR, "Cannot allocate memory for next BUFR message" );
+                marslog( LOG_EROR, "Cannot allocate memory for next BUFR message" );
 #endif
-	   _msgLen = MAX_MESSAGE_LENGTH  = 0;
-	   _IO_buffer_OK = false;
-	   return MvObs( NULL );
-	 }
-       else
-	 {
-	   cout << "MvObsSet::next: Allocated more memory for BUFR msg" << endl;
-	   myError = _readbufr( _bufrFile, _message, &_msgLen );
-	 }
-     }
+                _msgLen = MAX_MESSAGE_LENGTH  = 0;
+                _IO_buffer_OK = false;
+                return MvObs( NULL );
+            }
+            else
+            {
+                cout << "MvObsSet::next: Allocated more memory for BUFR msg" << endl;
+                myError = _readbufr( _bufrFile, _message, &_msgLen );
+            }
+        }
 
-   if( myError )
-     {
-       if( myError != EOF_STATUS )
-	 {
-	   cerr << "MvObsSet::next: Failed reading next BUFR msg, returned status=" << myError << endl;
+        if( myError )
+        {
+            if( myError != EOF_STATUS )
+            {
+                cerr << "MvObsSet::next: Failed reading next BUFR msg, returned status=" << myError << endl;
 #ifdef METVIEW
-	   marslog( LOG_EROR, "Failed reading next BUFR msg, status = %ld", myError );
+                marslog( LOG_EROR, "Failed reading next BUFR msg, status = %ld", myError );
 #endif
-	 }
-       _IO_buffer_OK = false;
-       return MvObs( NULL );
-     }
+            }
+            _IO_buffer_OK = false;
+            return MvObs( NULL );
+        }
 
 #ifdef METVIEW_PREPBUFR
-   //--
-   //-- NCEP PrepBUFR files may contain msgs with ZERO subsets!!!
-   //-- 'bufrex' cannot handle such illegal msgs, if so we must skip it
-   //--
-   MvBufr tmpBufr( _message, _msgLen, _msgNumber  ); //-- make BUFR octets into an object
-   if( tmpBufr.subsetCount() == 0 )
-     {
-       ostringstream os;
-       os << "Original BUFR msg " << _msgNumber
-          << " has ZERO subsets - ignoring (not counting) this illegal msg!"
-          << ends;
+        //--
+        //-- NCEP PrepBUFR files may contain msgs with ZERO subsets!!!
+        //-- 'bufrex' cannot handle such illegal msgs, if so we must skip it
+        //--
+        MvBufr tmpBufr( _message, _msgLen, _msgNumber  ); //-- make BUFR octets into an object
+        if( tmpBufr.subsetCount() == 0 )
+        {
+            ostringstream os;
+            os << "Original BUFR msg " << _msgNumber
+               << " has ZERO subsets - ignoring (not counting) this illegal msg!"
+               << ends;
 
-       cout << os.str() << endl;
+            cout << os.str() << endl;
 
 #ifdef METVIEW
-       //-- why this marslog crashes ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
-//       marslog( LOG_WARN, "%s", os.str().c_str() );
-       //-- why this marslog crashes ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
+            //-- why this marslog crashes ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
+    //          marslog( LOG_WARN, "%s", os.str().c_str() );
+            //-- why this marslog crashes ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
 #endif
 
-       //-- get next msg and cross your fingers it fits into current _message array
-       _msgLen = MAX_MESSAGE_LENGTH;
-       myError = _readbufr( _bufrFile, _message, &_msgLen );
+            //-- get next msg and cross your fingers it fits into current _message array
+            _msgLen = MAX_MESSAGE_LENGTH;
+            myError = _readbufr( _bufrFile, _message, &_msgLen );
+            lastPos = ftell(_bufrFile);
+            readAnotherMessage = true;
 
-       //_msgNumber++;
-     }
+            //_msgNumber++;
+         }
 #endif
+    }
 
-     _IO_buffer_OK = true;
-     return MvObs( new MvBufr( _message, _msgLen, _msgNumber ) );
+    _IO_buffer_OK = true;
+    return MvObs( new MvBufr( _message, _msgLen, _msgNumber ) );
 }
 
 //____________________________________________________________________ add
diff --git a/src/libMetview/MvRequest.cc b/src/libMetview/MvRequest.cc
index 1dab38a..68dc83f 100644
--- a/src/libMetview/MvRequest.cc
+++ b/src/libMetview/MvRequest.cc
@@ -9,6 +9,7 @@
 
 #include <Metview.h>
 #include <MvPath.hpp>
+#include <MvScanFileType.h>
 
 MvRequest::MvRequest(const char *verb)
 {
@@ -868,11 +869,11 @@ void MvRequest :: update_value(request *r,const char *parname,const char *valnam
 
 	if(append)
 	{
-		value *a = p->values,*b= NULL,*c=NULL;
+		value *a = p->values,*b= NULL;
 		while(a)
 		{
 			b = a;
-			c = b;
+//			c = b;
 			a = a->next;
 		}
 		v = new_value(strcache(valname));
@@ -939,15 +940,30 @@ bool MvRequest::getPath(const char* par,string &resPath,bool canBeEmpty,string &
 			if(callerIcon)
 			{
 	  			string callerDir(callerIcon);	  	
-		        	char *mvudir=getenv("METVIEW_USER_DIRECTORY");
-		        	if(mvudir)  
+
+				// special case: if callerDir is a path with "Process@" in it, then it
+				// very probably means that this was run from a macro - in this case, we can't
+				// use the returned path (because it's invalid) and instead a relative path should be
+				// considred relative to where the macro is run from; so in this case we would simply
+				// remove the path.
+
+				if(callerDir.find("Process@") != string::npos)
 				{
-	  				callerDir=string(mvudir) + "/" + callerDir;
-				}	
-				string::size_type pos=callerDir.find_last_of("/");
-	 			if(pos != string::npos)
+					// yes, it's called from Macro - files are relative to current dir
+					callerDir = ".";
+				}
+				else
 				{
-		 			callerDir=callerDir.substr(0,pos);
+					char *mvudir=getenv("METVIEW_USER_DIRECTORY");
+					if(mvudir)
+					{
+						callerDir=string(mvudir) + "/" + callerDir;
+					}	
+					string::size_type pos=callerDir.find_last_of("/");
+	 				if(pos != string::npos)
+					{
+		 				callerDir=callerDir.substr(0,pos);
+					}
 				}
 					
 				resPath=callerDir + "/" + resPath;
@@ -994,8 +1010,23 @@ bool MvRequest::getPath(const char* iconPar,const char* textPar,string &resPath,
 	
 	return true;
 }	
-  
-  
+
+
+
+// MvRequest::getBaseDate()
+// returns zero if neither HDATE nor DATE are present in the request
+int MvRequest::getBaseDate()
+{
+    int date = (*this)("HDATE");  // try HDATE first (will return 0 if not there)
+
+    if (date == 0)
+        date = (*this)("DATE");   // no HDATE? try DATE (will return 0 if not there)
+
+    return date;
+}
+
+
+
 bool MvRequest::getValueId(const char* par,string& value,const std::map<string,string>& idMap,bool canBeEmpty,string &errTxt)
 {	
         value.clear();
@@ -1155,42 +1186,83 @@ void MvRequest::importSubObjects(string& path, request* obj)
       return;
 
    // Read the definition file
-   request* l = read_language_file(defFile);
-   if ( !l )
+   request* rdef = read_language_file(defFile);
+   if ( !rdef )
       return;
 
-   // Skip auxiliary requests
-   while(l && (l->name != this->getVerb()))
-      l = l->next;
-
-   // Check each parameter to find out if it needs to be expanded
-   parameter* p = l->params;
-   MvRequest reqAux;
-   while (p)
+   // This request may be structured as a set of requests.
+   // Loop each request and expand all parameters that are subrequests.
+   this->rewind();
+   while (CurrentRequest)
    {
-      // Search for parameters that have an icon interface
-      const char *cicon = get_value(p->interface,"interface",0);
-      if (cicon && (strcmp(cicon,"icon") == 0))
+      // Find the correspondent definition request
+      request* rl = rdef;
+      while(rl && (rl->name != this->getVerb()))
+         rl = rl->next;
+
+      // Skip this request if there is no related definition request
+      if ( !rl )
+         continue;
+
+      // Check each parameter to find out if it needs to be expanded
+      parameter* p = rl->params;
+      MvRequest reqAux;
+      while (p)
       {
-         // Build all subrequests and add to this parameter
-         int i = 0;
-         const char *q;
-         while ( (q = get_value(CurrentRequest,p->name,i++)) )
-         {            
-            // Build subrequest
-            string fullPath = path + "/" + q;;
-            reqAux.read(fullPath.c_str(),true);
-
-            // Add subrequest to this parameter
-            if ( i == 1 )  // clean parameter values once
-               this->unsetParam(p->name);
-            
-            this->addValue(p->name,reqAux);
+         // Search for parameters that have an icon interface
+         const char *cicon = get_value(p->interface,"interface",0);
+         if (cicon && (strcmp(cicon,"icon") == 0))
+         {
+            // Build all subrequests and add to this parameter
+            const char* cclass = get_value(p->interface,"class",0);
+            const char *q;
+            for ( int i = 0; i < this->countValues(p->name); i++ )
+            {            
+               // Build subrequest
+               this->getValue(q,p->name,i);
+               string fullPath = (path[path.size()-1] == '/') ? path + q : path + "/" + q;
+               if ( !IsBinaryOrMissingFile(fullPath.c_str()) )
+               {
+                  // Read request from file and add parameter _CLASS.
+                  // Do not add parameter _NAME because this request
+                  // will be built by loading the contents of a file.
+                  // Adding parameter _NAME will make further routines to
+                  // read the file again.
+                  reqAux.read(fullPath.c_str(),true);
+                  reqAux("_CLASS") = reqAux.getVerb();
+               }
+               else
+               {
+                  // Build request manually
+                  reqAux.setVerb(cclass);
+
+                  // Add hidden parameters
+                  reqAux("_CLASS") = cclass;
+
+                  // Name without the Metview user directory path
+                  string user_dir = GetUserDirectory();
+                  std::size_t found = fullPath.find(user_dir);
+                  if (found != std::string::npos)
+                     reqAux("_NAME") = fullPath.substr(found+user_dir.size()).c_str();
+                  else
+                     reqAux("_NAME") = fullPath.c_str();
+               }
+
+               // Add subrequest to this parameter
+               if ( i == 0 )  // clean parameter values once
+                  this->unsetParam(p->name);
+
+               this->addValue(p->name,reqAux);
+            }
          }
+
+         p = p->next;
       }
 
-      p = p->next;
+      CurrentRequest = CurrentRequest->next;
    }
+
+   this->rewind();
 }
 
 request* MvRequest::findRequestObject()
@@ -1213,3 +1285,29 @@ request* MvRequest::findRequestObject()
 
    return NULL;
 }
+
+bool MvRequest::checkParameters( MvRequest& req, vector<string>& params )
+{
+   const char *par, *v1, *v2;
+   int i,j,cnt1,cnt2;
+
+   for (i = 0; i < (signed)params.size(); i++ )
+   {
+      par = params[i].c_str();
+      cnt1 = this->iterInit(par);
+      cnt2 = req.iterInit(par);
+      if ( cnt1 && (cnt1 == cnt2) )
+      {
+         for (j = 0; j < cnt1; j++)
+         {
+            this->iterGetNextValue( v1 );
+            req.iterGetNextValue( v2 );
+            if ( v1 != v2 )
+               return false;
+         }
+      }
+      
+   }
+
+   return true;
+}
diff --git a/src/libMetview/MvRequest.h b/src/libMetview/MvRequest.h
index 3f8d22d..5e59ba1 100644
--- a/src/libMetview/MvRequest.h
+++ b/src/libMetview/MvRequest.h
@@ -584,13 +584,18 @@ public:
 	MvRequest ExpandRequest ( const char*, const char*, long );
 	
 	
+	//  Get the base date from the request (specific to request from GRIB data)
+	int getBaseDate();
+
 	//Find out path (it can be relative path as well) stored in parameter par.
 	bool getPath(const char* par,string& resPath,bool canBeEmpty,string &errTxt);
 	bool getPath(const char* iconPar,const char* textPar,string &resPath,bool canBeEmpty,string &errTxt);
 	bool getValueId(const char* par,string& value,const std::map<string,string>& idMap,bool canBeEmpty,string &errTxt);
 	bool getValue(const char* par,string& value,bool canBeEmpty,string &errTxt);
 	bool getValue(const char* par,std::vector<string>& value,bool canBeEmpty,string &errTxt);
-	
+
+   // Check if the input request has the same contents given a set of parameters
+   bool checkParameters( MvRequest&, std::vector<string>& );
 };
 
 //! Convenience class (not used currently)
diff --git a/src/libMetview/MvScanFileType.cc b/src/libMetview/MvScanFileType.cc
index 595fe2a..1743956 100644
--- a/src/libMetview/MvScanFileType.cc
+++ b/src/libMetview/MvScanFileType.cc
@@ -94,7 +94,7 @@ static eFileType SearchMarsParserBreakers( const char* fileName )
    char buf;
    int  chr;
 
-   int readCount = fread(&buf, 1, 1, f.f_);
+   fread(&buf, 1, 1, f.f_);
    chr = (int) buf;
 
    for( int ci=0; ci<CHECKLEN; ++ci ) //-- look for "binary" chars
@@ -111,7 +111,7 @@ static eFileType SearchMarsParserBreakers( const char* fileName )
        if( isNumbersOnly )
            isNumbersOnly = isNumbersOnly && isValidForNumbersOnly(chr);
 
-       readCount = fread(&buf, 1, 1, f.f_);
+       fread(&buf, 1, 1, f.f_);
        chr = (int) buf;
      }
 
@@ -198,6 +198,9 @@ static const char *scan_file(const char *file)
   if (scan_file_extension (file, length, ".magml"))   return "MAGML";
   if (scan_file_extension (file, length, ".html"))    return "HTML";
   if (scan_file_extension (file, length, ".zip"))     return "ZIP";
+  if (scan_file_extension (file, length, ".pdf"))     return "PDF";
+  if (scan_file_extension (file, length, ".png"))     return "PNG";
+  if (scan_file_extension (file, length, ".ps"))      return "PSFILE";
   if (scan_file_extension (file, length, ".gif"))     return "GIF";
   if (scan_file_extension (file, length, ".tiff"))    return "TIFF";
   if (scan_file_extension (file, length, ".tif"))     return "TIFF";
@@ -400,8 +403,25 @@ static const char *scan_file(const char *file)
 
    //-- Check for IFS fortran namelists
   
-  
-  
+
+
+  // if it's binary then it might actually be a GRIB file with some extra
+  // header bits at the start e.g. GTS). GRIB_API has functionality to
+  // bypass these, so if it can get a GRIB handle then it must be a GRIB file.
+  // This may not be the most efficient way to find out, but it's a last resort.
+
+  if( fileType == eBinaryFile ) 
+  {  
+      grib_handle *gh;
+      int ge;
+      gh = grib_handle_new_from_file(NULL, f.f_, &ge);
+      if (gh != NULL)
+      {
+        grib_handle_delete(gh);
+        return "GRIB";
+      }
+  }
+
   
   //We have to do this check at this point, after
   //FLEXTRA was checked! 
diff --git a/src/libMvMotif/CMakeLists.txt b/src/libMvMotif/CMakeLists.txt
index 82251e7..558a89b 100644
--- a/src/libMvMotif/CMakeLists.txt
+++ b/src/libMvMotif/CMakeLists.txt
@@ -43,4 +43,5 @@ ecbuild_add_library( TARGET      MvMotif
                      INCLUDES    ${METVIEW_STANDARD_INCLUDES}
                      TEMPLATES   ${common_templates}
                      DEFINITIONS ${METVIEW_EXTRA_DEFINITIONS}
+                     DEPENDS     mvmarsxdr
 )
diff --git a/src/libMvNetCDF/CMakeLists.txt b/src/libMvNetCDF/CMakeLists.txt
index c9b1600..8a0c91a 100644
--- a/src/libMvNetCDF/CMakeLists.txt
+++ b/src/libMvNetCDF/CMakeLists.txt
@@ -12,4 +12,5 @@ ecbuild_add_library( TARGET      MvNetCDF
                      INCLUDES    ${METVIEW_STANDARD_INCLUDES}
                      DEFINITIONS ${METVIEW_EXTRA_DEFINITIONS}
                      LIBS        ${METVIEW_EXTRA_LIBRARIES}
+                     DEPENDS     mvmarsxdr
                     )
diff --git a/src/libMvQtGui/CMakeLists.txt b/src/libMvQtGui/CMakeLists.txt
index afba8d2..fe4dcce 100644
--- a/src/libMvQtGui/CMakeLists.txt
+++ b/src/libMvQtGui/CMakeLists.txt
@@ -152,4 +152,5 @@ ecbuild_add_library( TARGET      MvQtGui
                      TEMPLATES   ${common_templates}
                      INCLUDES    ${METVIEW_QT_INCLUDE_DIRS} ${X11_INCLUDE_DIR} ../uPlot  ${METVIEW_STANDARD_INCLUDES}
                      DEFINITIONS ${METVIEW_EXTRA_DEFINITIONS}
+                     DEPENDS     mvmarsxdr
 )
diff --git a/src/libMvQtGui/MvQAbout.cc b/src/libMvQtGui/MvQAbout.cc
index 52c13eb..27aa499 100644
--- a/src/libMvQtGui/MvQAbout.cc
+++ b/src/libMvQtGui/MvQAbout.cc
@@ -19,6 +19,10 @@
 #include "MvVersionInfo.h"
 #include "MvPath.hpp"
 
+#define QUOTE_PP(P) #P
+#define QUOTE_PPP(P) QUOTE_PP(P)
+
+
 MvQAbout::MvQAbout(QString title, QString description, Versions version,
 	           QMap<Version,QString> text) : QDialog(0)
 {
@@ -32,7 +36,7 @@ MvQAbout::MvQAbout(QString title, QString description, Versions version,
 	
 	if(version.testFlag(GribApiVersion))
 	{
-		str  << "<p><b>GRIB_API version:</b> ";
+		str  << "<p><b>" QUOTE_PPP(GRIB_HANDLING_PACKAGE) " version:</b> ";
 
 		if(text.contains(GribApiVersion))
 		{
@@ -90,6 +94,14 @@ MvQAbout::MvQAbout(QString title, QString description, Versions version,
 		}
 	}
 	
+	if(version.testFlag(OdbApiVersion))
+	{
+		if(text.contains(OdbApiVersion))
+		{
+			str << "<p><b>ODB_API version:</b> " << text[OdbApiVersion];
+		}
+	}
+
 	if(version.testFlag(NetcdfVersion))
 	{
 		str  << "<p><b>NetCDF version:</b> ";
diff --git a/src/libMvQtGui/MvQAbout.h b/src/libMvQtGui/MvQAbout.h
index 35004a6..30fa1a7 100644
--- a/src/libMvQtGui/MvQAbout.h
+++ b/src/libMvQtGui/MvQAbout.h
@@ -17,7 +17,8 @@
 class MvQAbout : public QDialog
 {
 public:
-	enum Version {NoVersion = 0x0, MetviewVersion = 0x1, GribApiVersion = 0x2, EmosVersion = 0x3, MagicsVersion = 0x4, NetcdfVersion = 0x5};
+	enum Version {NoVersion = 0x0, MetviewVersion = 0x1, GribApiVersion = 0x2, EmosVersion = 0x4, MagicsVersion = 0x8,
+		NetcdfVersion = 0x10, OdbApiVersion = 0x20};
 	Q_DECLARE_FLAGS(Versions,Version);
 
 	typedef QMap<Version,QString> VersionTextMap; 
diff --git a/src/libMvQtGui/MvQAbstractMessageExaminer.cc b/src/libMvQtGui/MvQAbstractMessageExaminer.cc
index 4343e57..e9fe108 100644
--- a/src/libMvQtGui/MvQAbstractMessageExaminer.cc
+++ b/src/libMvQtGui/MvQAbstractMessageExaminer.cc
@@ -39,7 +39,6 @@
 
 #include "MvQAbstractMessageExaminer.h"
 
-#include "MvFileInfo.h"
 #include "MvKeyProfile.h"
 #include "MvVersionInfo.h"
 #include "LogHandler.h"
diff --git a/src/libMvQtGui/MvQCheckBoxCombo.cc b/src/libMvQtGui/MvQCheckBoxCombo.cc
index 167eb6c..46e0f35 100644
--- a/src/libMvQtGui/MvQCheckBoxCombo.cc
+++ b/src/libMvQtGui/MvQCheckBoxCombo.cc
@@ -66,7 +66,7 @@ QWidget* MvQCheckBoxComboDelegate::createEditor(QWidget *parent,
 
 void MvQCheckBoxComboDelegate::slotCheckBoxStateChanged(int checked)
 {
-	bool b=checked;
+//	bool b=checked;
 //	qDebug() << b;
 
 	commmitAndCloseEditor();
diff --git a/src/libMvQtGui/MvQFileInfoLabel.cc b/src/libMvQtGui/MvQFileInfoLabel.cc
index 4e2251e..7a968bb 100644
--- a/src/libMvQtGui/MvQFileInfoLabel.cc
+++ b/src/libMvQtGui/MvQFileInfoLabel.cc
@@ -8,27 +8,27 @@
  ***************************** LICENSE END *************************************/
 
 #include "MvQFileInfoLabel.h"
-#include "MvFileInfo.h"
+#include "MvQFileInfo.h"
 
 MvQFileInfoLabel::MvQFileInfoLabel(QWidget* parent) : QLabel(parent)
 {
-	setObjectName(QString::fromUtf8("fileInfoLabel"));
+    setObjectName(QString::fromUtf8("fileInfoLabel"));
 
         //Set size policy
-	QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
+    QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
         sizePolicy.setHorizontalStretch(0);
         sizePolicy.setVerticalStretch(0);
         sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
         setSizePolicy(sizePolicy);
         //setMinimumSize(QSize(0, 60));
         //setMaximumSize(QSize(16777215, 45));
-	
-	setMargin(8);
-	setAlignment(Qt::AlignLeft| Qt::AlignVCenter);
 
-	//Other settings
+    setMargin(8);
+    setAlignment(Qt::AlignLeft| Qt::AlignVCenter);
+
+    //Other settings
         setAutoFillBackground(true);
-	//setFrameShape(QFrame::Box);
+    //setFrameShape(QFrame::Box);
         //setFrameShape(QFrame::StyledPanel);
         setTextInteractionFlags(Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse);
 
@@ -37,138 +37,138 @@ MvQFileInfoLabel::MvQFileInfoLabel(QWidget* parent) : QLabel(parent)
 
 QString MvQFileInfoLabel::buildTextLabel(QString fileName)
 {
-	QString s;
-	MvFileInfo info(fileName.toStdString());
-
-	s="<b><font color=#000000>File: </font></b>";
-	s+="<font color=000010>" + QString(info.name().c_str()) + "</font>";	
-	s+="<br>";
-	
-	if(info.permissions().find("l") != string::npos)
-	{
-		s+="<b><font color=#000000>Symlink target: </font></b>";	
-		s+="<font color=000010>" +QString(info.linkTo().c_str()) + "</font>";
-		s+="<br>";
-		
-		//Make the label bigger
-		//setMinimumSize(QSize(0, 70));
-	}
-
-	s+="<b><font color=#000000>Permissions: </font></b>";
-	s+="<font color=000010>" + QString(info.permissions().c_str()) + "</font>";
-	s+="<b><font color=#000000> Owner: </font></b>";
-	s+="<font color=000010>" + QString(info.owner().c_str()) + "</font>";
-	s+="<b><font color=#000000> Group:</font> </b>";
-	s+="<font color=000010>" + QString(info.group().c_str()) + "</font>";	
-	//s+="<b> Size: </b> <font color=#ff0000>";
-	s+="<b><font color=#000000> Size: </font></b>";
-	s+="<font color=000010>" + QString(info.size().c_str()) + "</font>";
-	s+="<font color=#000000><b> Modified:</font> </b>";
-	s+="<font color=000010>" + QString(info.modified().c_str()) + "</font>";
-	
-	return s;
+    QString s;
+    MvQFileInfo info(fileName);
+
+    s="<b><font color=#000000>File: </font></b>";
+    s+="<font color=000010>" + info.absoluteFilePath() + "</font>";
+    s+="<br>";
+
+    if(info.isSymLink())
+    {
+        s+="<b><font color=#000000>Symlink target: </font></b>";
+        s+="<font color=000010>" +info.symLinkTarget() + "</font>";
+        s+="<br>";
+
+        //Make the label bigger
+        //setMinimumSize(QSize(0, 70));
+    }
+
+    s+="<b><font color=#000000>Permissions: </font></b>";
+    s+="<font color=000010>" + info.formatPermissions() + "</font>";
+    s+="<b><font color=#000000> Owner: </font></b>";
+    s+="<font color=000010>" + info.owner() + "</font>";
+    s+="<b><font color=#000000> Group:</font> </b>";
+    s+="<font color=000010>" + info.group() + "</font>";
+    //s+="<b> Size: </b> <font color=#ff0000>";
+    s+="<b><font color=#000000> Size: </font></b>";
+    s+="<font color=000010>" + info.formatSize() + "</font>";
+    s+="<font color=#000000><b> Modified:</font> </b>";
+    s+="<font color=000010>" + info.formatModDate() + "</font>";
+
+    return s;
 }
 
 void MvQFileInfoLabel::setTextLabel(QString fileName)
 {
-	QString s=buildTextLabel(fileName);
-	setText(s);
-}		
+    QString s=buildTextLabel(fileName);
+    setText(s);
+}
 
 void MvQFileInfoLabel::setGribTextLabel(QString fileName,int messageNum,bool filtered,int filteredMessageNum,bool hasMultiMessage)
 {
-	QString s=buildTextLabel(fileName);
-	s+="<br>";
-
-	if(filtered)
-	{
-		s+="<b><font color=#000000>Number of filtered messages: </font></b>";
-		s+="<font color=000010>" + QString::number(filteredMessageNum);
-		s+=" (out of " + QString::number(messageNum) + ")</font>";
-	}	
-	else
-	{
-		s+="<b><font color=#000000>Total number of messages: </font></b>";		
-		s+="<font color=000010>" + QString::number(messageNum) + "</font>";
-		if(hasMultiMessage)
-		{
-			s+="<font color=#f4a119> (some messages contain multiple fields!) </font>";	
-		}
-		
-	}	
-	setText(s);
-}	
+    QString s=buildTextLabel(fileName);
+    s+="<br>";
+
+    if(filtered)
+    {
+        s+="<b><font color=#000000>Number of filtered messages: </font></b>";
+        s+="<font color=000010>" + QString::number(filteredMessageNum);
+        s+=" (out of " + QString::number(messageNum) + ")</font>";
+    }
+    else
+    {
+        s+="<b><font color=#000000>Total number of messages: </font></b>";
+        s+="<font color=000010>" + QString::number(messageNum) + "</font>";
+        if(hasMultiMessage)
+        {
+            s+="<font color=#f4a119> (some messages contain multiple fields!) </font>";
+        }
+
+    }
+    setText(s);
+}
 
 void MvQFileInfoLabel::setBufrTextLabel(QString fileName,int messageNum)
 {
-	QString s=buildTextLabel(fileName);
-	s+="<br>";
-	s+="<b><font color=#000000>Total number of messages: </font></b>";		
-	s+="<font color=000010>" + QString::number(messageNum) + "</font>";
-	
-	setText(s);
-}	
+    QString s=buildTextLabel(fileName);
+    s+="<br>";
+    s+="<b><font color=#000000>Total number of messages: </font></b>";
+    s+="<font color=000010>" + QString::number(messageNum) + "</font>";
+
+    setText(s);
+}
 
 void MvQFileInfoLabel::setObstatScatterTextLabel(QString fileName,int itemNum)
 {
-	QString s=buildTextLabel(fileName);
-	s+="<br>";
-	s+="<b><font color=#000000>Total number of items: </font></b>";
-	s+="<font color=000010>" + QString::number(itemNum) + "</font>";
+    QString s=buildTextLabel(fileName);
+    s+="<br>";
+    s+="<b><font color=#000000>Total number of items: </font></b>";
+    s+="<font color=000010>" + QString::number(itemNum) + "</font>";
 
-	setText(s);
+    setText(s);
 }
 
 void MvQFileInfoLabel::setOdbTextLabel(QString fileName,QString)
 {
-	QString s=buildTextLabel(fileName);
-	//s+="<br>";
-	//s+="<b>Version: </b>";
-	//s+=version;
+    QString s=buildTextLabel(fileName);
+    //s+="<br>";
+    //s+="<b>Version: </b>";
+    //s+=version;
 
-	setText(s);
+    setText(s);
 }
 
 void MvQFileInfoLabel::setGeopTextLabel(QString fileName, QString format, long itemNum)
 {
-	QString s=buildTextLabel(fileName);
-	s+="<br>";
+    QString s=buildTextLabel(fileName);
+    s+="<br>";
 
-	s+="<b><font color=#000000>Format: </font></b>";
-	s+="<font color=000010>" + format + "</font>";
-	s+="<br>";
+    s+="<b><font color=#000000>Format: </font></b>";
+    s+="<font color=000010>" + format + "</font>";
+    s+="<br>";
 
-	s+="<b><font color=#000000>Total number of points: </font></b>";
-	s+="<font color=000010>" + QString::number(itemNum) + "</font>";
+    s+="<b><font color=#000000>Total number of points: </font></b>";
+    s+="<font color=000010>" + QString::number(itemNum) + "</font>";
 
-	setText(s);
+    setText(s);
 }
 
 void MvQFileInfoLabel::setFlextraTextLabel(QString fileName, QString iconName, int itemNum)
 {
-	QString s;
-	s="<b><font color=#000000>Icon: </font></b>";
-	s+="<font color=000010>" + iconName + "</font>";
-	s+="<br>";
-  	s+=buildTextLabel(fileName);
-	s+="<br>";
-	s+="<b><font color=#000000>Total number of groups: </font></b>";
-	s+="<font color=000010>" + QString::number(itemNum) + "</font>";
-
-	setText(s);
+    QString s;
+    s="<b><font color=#000000>Icon: </font></b>";
+    s+="<font color=000010>" + iconName + "</font>";
+    s+="<br>";
+    s+=buildTextLabel(fileName);
+    s+="<br>";
+    s+="<b><font color=#000000>Total number of groups: </font></b>";
+    s+="<font color=000010>" + QString::number(itemNum) + "</font>";
+
+    setText(s);
 }
 
 void MvQFileInfoLabel::setProfileTextLabel(QString fileName,int stepNum, int levNum,QString id)
 {
-	QString s=buildTextLabel(fileName);
-	s+="<br>";
-	s+="<b><font color=#000000>Steps: </font></b>";		
-	s+="<font color=000010>" + QString::number(stepNum) + "</font>";
-	s+="<b><font color=#000000> Model levels: </font></b>";		
-	s+="<font color=000010>" + QString::number(levNum) + "</font>";
-	s+="<br>";
-	s+="<b><font color=#000000>Data type: </font></b>";		
-	s+="<font color=000010>" + id + "</font>";
-	
-	setText(s);
-}	
+    QString s=buildTextLabel(fileName);
+    s+="<br>";
+    s+="<b><font color=#000000>Steps: </font></b>";
+    s+="<font color=000010>" + QString::number(stepNum) + "</font>";
+    s+="<b><font color=#000000> Model levels: </font></b>";
+    s+="<font color=000010>" + QString::number(levNum) + "</font>";
+    s+="<br>";
+    s+="<b><font color=#000000>Data type: </font></b>";
+    s+="<font color=000010>" + id + "</font>";
+
+    setText(s);
+}
diff --git a/src/libMvQtGui/MvQKeyDialog.cc b/src/libMvQtGui/MvQKeyDialog.cc
index 81b66a9..bd0ffe8 100644
--- a/src/libMvQtGui/MvQKeyDialog.cc
+++ b/src/libMvQtGui/MvQKeyDialog.cc
@@ -41,8 +41,6 @@
 
 MvQKeyProfileDialog::MvQKeyProfileDialog(QString title,MvQKeyManager *manager,int currentRow,QWidget *parent) : QWidget(parent), manager_(manager)
 {
-	QLabel *label;
-	
 	QVBoxLayout *layout=new QVBoxLayout;
 	setLayout(layout);
 
@@ -853,8 +851,6 @@ void MvQKeyImportPage::slotImport()
 
 MvQKeyEditDialog::MvQKeyEditDialog(MvKey *key,QWidget *parent) : QDialog(parent), key_(key)
 {
-	QLabel *label;
-	
 	setWindowTitle(tr("Edit key"));
 
 	QVBoxLayout *layout=new QVBoxLayout;
diff --git a/src/libMvQtGui/MvQKeyProfileTree.cc b/src/libMvQtGui/MvQKeyProfileTree.cc
index a3258f1..f8778c2 100644
--- a/src/libMvQtGui/MvQKeyProfileTree.cc
+++ b/src/libMvQtGui/MvQKeyProfileTree.cc
@@ -104,7 +104,6 @@ void MvQKeyProfileTree::slotMessageTreeContextMenu(const QPoint &position)
 	if(prof==0 || section >= static_cast<int>(prof->size()))
 		return;
 
-	bool keyEditable=prof->at(section)->editable();
 		
 	QList<QAction*> actions;
 
@@ -124,6 +123,7 @@ void MvQKeyProfileTree::slotMessageTreeContextMenu(const QPoint &position)
 	//Edit
 	
 #ifdef METVIEW_EXPERIMENTAL
+	bool keyEditable=prof->at(section)->editable();
 	QAction *actionEdit;
 	if(keyEditable)
 	{
diff --git a/src/libMvQtUtil/CMakeLists.txt b/src/libMvQtUtil/CMakeLists.txt
index 2d094ba..654df1b 100644
--- a/src/libMvQtUtil/CMakeLists.txt
+++ b/src/libMvQtUtil/CMakeLists.txt
@@ -9,6 +9,7 @@ endif()
 
 
 set(libMvQtUtil_srcs
+    MvQFileInfo.cc
     MvQKeyManager.cc
     MvQNetworkAccessManager.cc
     MvQNetworkProxyFactory.cc
@@ -35,4 +36,5 @@ ecbuild_add_library( TARGET      MvQtUtil
                      TEMPLATES   ${common_templates}
                      INCLUDES    ${libmvqtutil_includes}
                      DEFINITIONS ${METVIEW_EXTRA_DEFINITIONS}
+                     DEPENDS     mvmarsxdr
 )
diff --git a/src/libMvQtUtil/MvQFileInfo.cc b/src/libMvQtUtil/MvQFileInfo.cc
new file mode 100644
index 0000000..888ffd6
--- /dev/null
+++ b/src/libMvQtUtil/MvQFileInfo.cc
@@ -0,0 +1,61 @@
+/***************************** LICENSE START ***********************************
+
+ Copyright 2016 ECMWF and INPE. This software is distributed under the terms
+ of the Apache License version 2.0. In applying this license, ECMWF does not
+ waive the privileges and immunities granted to it by virtue of its status as
+ an Intergovernmental Organization or submit itself to any jurisdiction.
+
+ ***************************** LICENSE END *************************************/
+
+#include "MvQFileInfo.h"
+
+#include <QDateTime>
+
+QString  MvQFileInfo::formatSize() const
+{
+    return formatSize(size());
+}
+
+QString  MvQFileInfo::formatModDate() const
+{
+    QDateTime dt=lastModified();
+    return dt.toString("yyyy-MM-dd hh:mm:ss");
+}
+
+QString  MvQFileInfo::formatPermissions() const
+{
+    QString str(permission(QFile::ReadOwner)?"r":"-");
+    str+=(permission(QFile::WriteOwner)?"w":"-");
+    str+=(permission(QFile::ExeOwner)?"x":"-");
+    str+=(permission(QFile::ReadGroup)?"r":"-");
+    str+=(permission(QFile::WriteGroup)?"w":"-");
+    str+=(permission(QFile::ExeGroup)?"x":"-");
+    str+=(permission(QFile::ReadOther)?"r":"-");
+    str+=(permission(QFile::WriteOther)?"w":"-");
+    str+=(permission(QFile::ExeOther)?"x":"-");
+
+    return str;
+}
+
+QString MvQFileInfo::formatSize(qint64 size)
+{
+    if(size < 1024)
+        return QString::number(size) + " B";
+    else if(size < 1024*1024)
+        return handleSizePrecision(((double)size)/1024, "KB");
+    else if(size < 1024*1024*1024)
+        return handleSizePrecision(((double)size)/(1024*1024), "MB");
+    else
+        return handleSizePrecision(((double)size)/(1024*1024*1024), "GB");
+
+    return QString();
+}
+
+QString MvQFileInfo::handleSizePrecision(double sizeInUnits, QString unitsString)
+{
+    // if less than 10, use one decimal place, otherwise round to the nearest int
+    if (sizeInUnits < 10)
+        return QString::number(sizeInUnits, 'f', 1) + " " + unitsString;
+    else
+        return QString::number((unsigned int)(sizeInUnits + 0.5)) + " " + unitsString;
+}
diff --git a/src/libMvQtUtil/MvQFileInfo.h b/src/libMvQtUtil/MvQFileInfo.h
new file mode 100644
index 0000000..a13b284
--- /dev/null
+++ b/src/libMvQtUtil/MvQFileInfo.h
@@ -0,0 +1,33 @@
+/***************************** LICENSE START ***********************************
+
+ Copyright 2016 ECMWF and INPE. This software is distributed under the terms
+ of the Apache License version 2.0. In applying this license, ECMWF does not
+ waive the privileges and immunities granted to it by virtue of its status as
+ an Intergovernmental Organization or submit itself to any jurisdiction.
+
+ ***************************** LICENSE END *************************************/
+
+#ifndef MVQFILEINFO_H
+#define MVQFILEINFO_H
+
+#include <string>
+#include <QFileInfo>
+
+class MvQFileInfo : public QFileInfo
+{
+public:
+    MvQFileInfo(const std::string& path) : QFileInfo(QString::fromStdString(path)) {}
+    MvQFileInfo(QString path) : QFileInfo(path) {}
+
+    QString formatSize() const;
+    QString formatModDate() const;
+    QString formatPermissions() const;
+
+    static QString formatSize(qint64);
+
+private:
+    static QString handleSizePrecision(double sizeInUnits, QString unitsString);
+};
+
+#endif // MVQFILEINFO_H
+
diff --git a/src/libUtil/CMakeLists.txt b/src/libUtil/CMakeLists.txt
index db80910..252a242 100644
--- a/src/libUtil/CMakeLists.txt
+++ b/src/libUtil/CMakeLists.txt
@@ -9,7 +9,6 @@ MtInputEvent.cc
 MvAlmostObsoleteRequest.cc
 MvElement.cc
 MvException.cc
-MvFileInfo.cc
 MvFlextra.cc
 MvKeyProfile.cc
 MvKeyManager.cc
@@ -30,7 +29,7 @@ TableReader.cc
 Tokenizer.cc
 UtilitiesC.c
 Cached.h GribMetaData.h LogHandler.h MagicsColours.h MtInputEvent.h MvException.h
-MvFileInfo.h MvFlextra.h MvGribParC.h MvKeyManager.h MvKeyProfile.h MvMessageMetaData.h MvMsg.h MvOdb.h
+MvFlextra.h MvGribParC.h MvKeyManager.h MvKeyProfile.h MvMessageMetaData.h MvMsg.h MvOdb.h
 MvSTL.h MvStopWatch.h MvVersionInfo.h Rectangle.h Request.h UtilitiesC.h auto_ptr.h
 bits.h gdefines.h inc_iostream.h inc_stl.h min_max_macros.h
 xec.h
@@ -43,6 +42,11 @@ Types.hpp griddoc.hpp imagedoc.hpp proj_braz.hpp stypes.hpp
 TableReader.h
 Tokenizer.h)
 
+if (ENABLE_URL_DOWNLOAD)
+    list (APPEND libUtil_srcs MvNetwork.cc)
+endif()
+
+
 
 #foreach( file ${_libUtil_srcs} )
 #  list( APPEND libUtil_srcs libUtil/${file} )
@@ -65,4 +69,5 @@ ecbuild_add_library( TARGET      Util
                      DEFINITIONS ${METVIEW_EXTRA_DEFINITIONS}
                      LIBS        ${METVIEW_EXTRA_LIBRARIES} 
 #                     LIBS        ${METVIEW_EXTRA_LIBRARIES} MvMars Metview ${GRIB_API_LIBRARIES} 
+                     DEPENDS     mvmarsxdr
 )
diff --git a/src/libUtil/Grib.cc b/src/libUtil/Grib.cc
index ef4a35c..243b919 100644
--- a/src/libUtil/Grib.cc
+++ b/src/libUtil/Grib.cc
@@ -1908,9 +1908,9 @@ void
 GribData :: SetScale ( double vmin, double vmax, int nbits)
 {
 	long	scale;
-	double	x;
+	//double	x;
 
-	x = log10((vmax - vmin) / (pow(2.,(double)(nbits+1.))-1.)) / log10(2.);
+	//x = log10((vmax - vmin) / (pow(2.,(double)(nbits+1.))-1.)) / log10(2.);
 
 	scale = (long) floor((log10(((double)vmax-(double)vmin) / (pow(2.,(double)nbits+1.) -1.)) / log10(2.)) +2);
 
diff --git a/src/libUtil/MvAlmostObsoleteRequest.cc b/src/libUtil/MvAlmostObsoleteRequest.cc
index 8093f14..e4c5ef5 100644
--- a/src/libUtil/MvAlmostObsoleteRequest.cc
+++ b/src/libUtil/MvAlmostObsoleteRequest.cc
@@ -39,7 +39,7 @@ MvDataGen :: MvDataGen (svcid *i,request* r, const char* typ)
 	set_value (req,"PATH","%s", datafile);
 
 	const char* tmp;
-	if (tmp = get_value (req, "_NAME", 0))
+	if ((tmp = get_value (req, "_NAME", 0)))
 		setElemName (tmp);
 	else
 		setElemName (datafile);
@@ -99,10 +99,10 @@ MvDataGen :: SendStatus (const char* st)
 	const char* tmp;
 
 	set_value (status, "STATUS", "%s", st);
-	if (tmp = get_value (req, "_NAME", 0))
+	if ((tmp = get_value (req, "_NAME", 0)))
 		set_value (status, "NAME", "%s", tmp);
 
-	if (tmp = get_value (req, "_ICON_CLASS", 0))
+	if ((tmp = get_value (req, "_ICON_CLASS", 0)))
 		set_value (status, "ICON_CLASS", "%s", tmp);
 
 	send_message (id->s, status);
@@ -150,12 +150,12 @@ MvDataVis :: MvDataVis (svcid *i,request* r)
 	unlink (tmpfile);
 
 	const char* tmp;
-	if (tmp = get_value (req, "_LOT_NAME", 0))
+	if ((tmp = get_value (req, "_LOT_NAME", 0)))
 		setElemName (tmp);
 	else
 		setElemName (tmpfile);
 
-	if (tmp = get_value (req, "_LOT_COUNT", 0))
+	if ((tmp = get_value (req, "_LOT_COUNT", 0)))
 		tasks = atoi (tmp);
 
 // Build the reply request.
diff --git a/src/libUtil/MvFileInfo.cc b/src/libUtil/MvFileInfo.cc
deleted file mode 100644
index 619258c..0000000
--- a/src/libUtil/MvFileInfo.cc
+++ /dev/null
@@ -1,113 +0,0 @@
-/***************************** LICENSE START ***********************************
-
- Copyright 2012 ECMWF and INPE. This software is distributed under the terms
- of the Apache License version 2.0. In applying this license, ECMWF does not
- waive the privileges and immunities granted to it by virtue of its status as
- an Intergovernmental Organization or submit itself to any jurisdiction.
-
- ***************************** LICENSE END *************************************/
-
-#include <sstream>
-#include <vector>
-#include <stdio.h>
-
-#include "MvFileInfo.h"
-
-MvFileInfo::MvFileInfo(string name)
-{
-	name_=name;
-
-	string buf="ls -lhd \"" + name_ + "\"";
-
-	FILE *in;
-	char cbuf[512];
-
-	if (!(in = popen(buf.c_str(),"r")) )
-	{
-		return;
-	}
-
-	if(fgets(cbuf, sizeof(cbuf), in) == NULL)
-	{
-		pclose(in);
-		return;
-	}	
-	
-	pclose(in);
-
-	stringstream ss(cbuf); 
-    	vector<string> tokens; 
-
-   	while (ss >> buf)
-        {			
-		tokens.push_back(buf);	
-	}
-	
-	if(tokens.size() < 7)	
-	{
-		return;
-	}  
-
-	permissions_=tokens[0];
-	owner_=tokens[2];
-	group_=tokens[3];
-	//size_=tokens[4];
-	size_=sizeInBytes(name_);
-	if(size_ != "???")
-	{
-	  	size_.append("B");
-	}
-	
-	modified_=tokens[5] + " " +tokens[6] ;
-
-	if(permissions_.find("l") != string::npos)
-	{
-		size_="???";
-	  	string sbuf(cbuf);
-		string::size_type pos;
-		if((pos=sbuf.find("->")) != string::npos)
-		{
-			linkTo_=sbuf.substr(pos+3);
-			if((pos=linkTo_.find('\n')) != string::npos)
-			{
-			  	linkTo_.erase(pos,1);	
-			}
-			
-			size_=sizeInBytes(linkTo_);
-			if(size_ != "???")
-			{
-	  			size_.append("B");
-			}
-		}
-	}
-}
-
-string MvFileInfo::sizeInBytes(string path)
-{
-	string buf="du -sh \"" + path + "\"";
-
-	FILE *in;
-	char cbuf[512];
-
-	if (!(in = popen(buf.c_str(),"r")) )
-	{
-		return string("???");
-	}
-
-	if(fgets(cbuf, sizeof(cbuf), in) == NULL)
-	{
-		pclose(in);
-		return string("???");
-	}	
-	
-	pclose(in);
-
-	stringstream ss(cbuf); 
-   
-   	while(ss >> buf)
-        {			
-		return buf;	
-	}
-	
-	return string("???");
-}	
\ No newline at end of file
diff --git a/src/libUtil/MvFileInfo.h b/src/libUtil/MvFileInfo.h
deleted file mode 100644
index 2d7b048..0000000
--- a/src/libUtil/MvFileInfo.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/***************************** LICENSE START ***********************************
-
- Copyright 2012 ECMWF and INPE. This software is distributed under the terms
- of the Apache License version 2.0. In applying this license, ECMWF does not
- waive the privileges and immunities granted to it by virtue of its status as
- an Intergovernmental Organization or submit itself to any jurisdiction.
-
- ***************************** LICENSE END *************************************/
-
-#ifndef MvFileInfo_H
-#define MvFileInfo_H
-
-#include <iostream>
-
-using namespace std;
-
-class MvFileInfo
-{
-public:
-	MvFileInfo(string);
-
-	const string& name() const {return name_;};
-	const string& permissions() const {return permissions_;};
-	const string& owner() const {return owner_;};
-	const string& group() const {return group_;};
-	const string& size() const {return size_;};
-	const string& modified() const {return modified_;};
-	const string& linkTo() const {return linkTo_;};
-	
-private:	
-	string sizeInBytes(string);
-
-	string name_;
-	string permissions_;
-	string owner_;
-	string group_;
-	string size_;
-	string modified_;
-	string linkTo_;
-};
-
-#endif
diff --git a/src/libUtil/MvFlextra.cc b/src/libUtil/MvFlextra.cc
index 34dc5e6..1795da3 100644
--- a/src/libUtil/MvFlextra.cc
+++ b/src/libUtil/MvFlextra.cc
@@ -682,7 +682,7 @@ void MvFlextra::decode()
 		string comment=blocks_[i]->comment();	
 		bool cstep=blocks_[i]->constantStep();
 		
-		pair<string,bool> p=make_pair<string,bool>(comment,cstep);
+		pair<string,bool> p=make_pair(comment,cstep);
 		
 		bool newRef=true;
 		for(unsigned int j=0; j < ref.size(); j++)
diff --git a/src/libUtil/MvMiscelaneous.cc b/src/libUtil/MvMiscelaneous.cc
index 25f7364..0712d36 100644
--- a/src/libUtil/MvMiscelaneous.cc
+++ b/src/libUtil/MvMiscelaneous.cc
@@ -269,6 +269,7 @@ double ozonePPMV(double r)
 double dewPointFromQ(double p, double t, double q, const string& formula)
 {
    const string cMixedFormula( "MIXED_PHASE_0_TO_-23" );
+   const string cSaturationIce( "SATURATION_OVER_ICE" );
    double ZCVM3, ZCVM4;
 
    if( formula == cMixedFormula )
@@ -280,7 +281,7 @@ double dewPointFromQ(double p, double t, double q, const string& formula)
       ZCVM3 = foealfa*cR3LES + (1.-foealfa)*cR3IES;
       ZCVM4 = foealfa*cR4LES + (1.-foealfa)*cR4IES;
    }
-   else
+   else if ( formula == cSaturationIce )
    {
       if( t > cTMELT )
       {
@@ -293,6 +294,11 @@ double dewPointFromQ(double p, double t, double q, const string& formula)
          ZCVM4=cR4IES;
       }
    }
+   else  // SATURATION OVER WATER
+   {
+      ZCVM3=cR3LES;
+      ZCVM4=cR4LES;
+   }
 
    double ZFRAC = log(p*q/(cR2ES*(1.+cVTMPC1*q)))/ZCVM3;
 
diff --git a/src/libUtil/MvNetwork.cc b/src/libUtil/MvNetwork.cc
new file mode 100644
index 0000000..d6f527b
--- /dev/null
+++ b/src/libUtil/MvNetwork.cc
@@ -0,0 +1,249 @@
+/***************************** LICENSE START ***********************************
+
+ Copyright 2016 ECMWF and INPE. This software is distributed under the terms
+ of the Apache License version 2.0. In applying this license, ECMWF does not
+ waive the privileges and immunities granted to it by virtue of its status as
+ an Intergovernmental Organization or submit itself to any jurisdiction.
+
+ ***************************** LICENSE END *************************************/
+
+#include <stdlib.h>
+#include <fstream>
+#include <sstream>
+#include <iostream>
+
+#include "MvApplication.h"
+#include "MvNetwork.h"
+
+
+using std::cout;
+using std::endl;
+
+// 7.21.0
+#define MINCURLVERSIONFORWILDCARD  0x071500
+
+// 7.14.1
+#define MINCURLVERSIONFORPROXY     0x070E01
+
+// 7.19.4
+#define MINCURLVERSIONFORNOPROXY   0x071304
+
+
+// ----------------------------------------------------------------------------
+// MvNetworkData
+// Holds and manages the buffer to store data resulting from a network transfer
+// ----------------------------------------------------------------------------
+
+MvNetworkData::~MvNetworkData()
+{
+    if(buffer_)
+        free(buffer_);
+}
+
+void MvNetworkData::clear()
+{
+    buffer_=0;
+    pos_=0;
+    len_=0;
+}    
+
+size_t MvNetworkData::add(char *ptr,size_t size)
+{
+    if(buffer_ == NULL)
+    {
+        pos_=0;
+        len_    = initialSize_;
+        buffer_ = static_cast<char*>(malloc(len_));
+    }
+
+    if(pos_ + size > len_) 
+    {
+        while(pos_ + size > len_) {
+            len_ *= 2;
+        }
+
+        buffer_ =static_cast<char*>(realloc(buffer_,len_));
+        if(!buffer_)
+        {
+            //error_++;
+            return 0;
+        }
+    }
+
+    memcpy(buffer_ + pos_, ptr, size);
+    pos_ += size;
+    
+    return size;
+}
+
+string MvNetworkData::toString()
+{
+    if(buffer_ && len_ >0 )
+    {          
+        return string(buffer_ + '\0');  
+    }
+    return string();
+}      
+
+
+
+// ---------------------------------------------------------------------- 
+// MvNetwork
+// Handles the data request and writes the data to the requested location
+// ---------------------------------------------------------------------- 
+
+MvNetwork::MvNetwork()
+{
+    ch_=curl_easy_init();
+//    curl_version_info_data *cvi = curl_version_info(CURLVERSION_NOW);
+    
+    curl_easy_setopt(ch_,CURLOPT_HEADER,1); 
+
+    curl_easy_setopt(ch_,CURLOPT_WRITEFUNCTION,MvNetwork::writeCb); 
+    curl_easy_setopt(ch_,CURLOPT_WRITEDATA,this); 
+    
+    curl_easy_setopt(ch_,CURLOPT_HEADER,0); 
+    curl_easy_setopt(ch_,CURLOPT_HEADERFUNCTION,MvNetwork::headerCb);
+    curl_easy_setopt(ch_,CURLOPT_HEADERDATA,this);    
+
+    curl_easy_setopt(ch_,CURLOPT_FOLLOWLOCATION,1); // some WMS servers redirect URLs   
+    curl_easy_setopt(ch_,CURLOPT_VERBOSE,1);
+
+
+    // long minVersionForWildcard = (7 << 16) | (21 << 8) | 0;
+//    if (cvi->version_num >= minVersionForWildcard)
+    #if LIBCURL_VERSION_NUM >= MINCURLVERSIONFORWILDCARD
+        curl_easy_setopt(ch_,CURLOPT_WILDCARDMATCH,0);  // don't try to match wildcard chars
+    #endif
+
+    setupProxy();
+}
+
+
+void MvNetwork::setupProxy()
+{
+
+    // get the Metview user preferences
+    MvRequest myPref = MvApplication::getExpandedPreferences();
+
+    bool use = false;
+    const char* useProxy = myPref("USE_NETWORK_PROXY");
+    if((useProxy != NULL))
+        use = ( strcmp(useProxy, "Yes") == 0 || 
+                strcmp(useProxy, "YES") == 0 ||
+                strcmp(useProxy, "yes") == 0 ) ? true : false;
+
+    if(use)
+    {
+#if LIBCURL_VERSION_NUM >= MINCURLVERSIONFORPROXY
+        const char* proxyUrl = myPref("PROXY_URL");
+        if (proxyUrl)
+        {
+            curl_easy_setopt(ch_, CURLOPT_PROXY, proxyUrl);
+            cout << "Using user proxy URL: " << proxyUrl << std::endl;
+        }
+#else
+        cout << "Curl version is not new enough to support CURLOPT_PROXY - proxy setting not applied." << std::endl;
+#endif
+
+        const char* proxyPort = myPref("PROXY_PORT");
+        if(proxyPort)
+        {
+            curl_easy_setopt(ch_, CURLOPT_PROXYPORT, atoi(proxyPort));
+            cout << "Using user proxy port: " << proxyPort << std::endl;
+        }
+
+
+#if LIBCURL_VERSION_NUM >= MINCURLVERSIONFORNOPROXY
+        const char* noProxy = myPref("NO_PROXY_FOR");  // comma-separated list
+        if(noProxy)
+        {
+            curl_easy_setopt(ch_, CURLOPT_NOPROXY, noProxy);
+            cout << "Using user no_proxy: " << noProxy << std::endl;
+        }
+#else
+        cout << "Curl version is not new enough to support CURLOPT_NOPROXY - no_proxy setting not applied." << std::endl;
+#endif
+    }
+}
+
+
+bool MvNetwork::get(const string& req, const string& outfile, const string mimeType, string &errorMsg)
+{
+    curl_easy_setopt(ch_,CURLOPT_URL,req.c_str());
+    outFile_=outFile_;
+
+    // perform the actual network transfer
+    CURLcode ret=curl_easy_perform(ch_);    
+
+    if (ret != CURLE_OK)
+    {
+        errorMsg = curl_easy_strerror(ret);
+        return false;
+    }
+
+    cout << "data size " << data_.len_ << endl;
+
+    if (data_.len_ == 0)
+    {
+        errorMsg = "No bytes received.";
+        return false;
+    }
+
+    // get the response code
+    curl_easy_getinfo(ch_, CURLINFO_RESPONSE_CODE, &responseCode_);
+
+
+    // write the data buffer to a file
+    std::ofstream out;                
+    out.open(outfile.c_str());
+
+    if(out.good())
+    {
+        out.write(data_.buffer_, data_.pos_);
+        out.close();
+        cout << "outfile " << outfile << endl;
+    }
+    else
+    {
+        errorMsg = "Could not open file for writing: " + outfile;
+        return false;
+    }
+    
+
+    // in case CURL did anything to change the URL...
+    const char *usedUrl;
+    curl_easy_getinfo(ch_, CURLINFO_EFFECTIVE_URL, &usedUrl); 
+    cout << "Used URL: " << usedUrl << endl;
+
+    data_.clear();  // clear the data buffer
+    return true;
+}  
+
+size_t MvNetwork::writeCb(char *ptr,size_t size,size_t nmemb,void *userdata)
+{
+    //cout << "writeCB " << size*nmemb <<  endl;    
+    if(!userdata)
+        return 0;
+    
+    if(MvNetwork* obj=static_cast<MvNetwork*>(userdata))
+    {
+        return obj->data_.add(ptr,size*nmemb);
+    }
+    
+    return 0;
+}
+
+size_t MvNetwork::headerCb(char *ptr,size_t size,size_t nmemb,void *userdata)
+{
+    if(!userdata)
+        return 0;
+    
+    if(MvNetwork* obj=static_cast<MvNetwork*>(userdata))
+    {
+        return obj->header_.add(ptr,size*nmemb);
+    }
+    
+    return 0;
+}
+
diff --git a/src/libUtil/MvNetwork.h b/src/libUtil/MvNetwork.h
new file mode 100644
index 0000000..f562b7c
--- /dev/null
+++ b/src/libUtil/MvNetwork.h
@@ -0,0 +1,69 @@
+/***************************** LICENSE START ***********************************
+
+ Copyright 2016 ECMWF and INPE. This software is distributed under the terms
+ of the Apache License version 2.0. In applying this license, ECMWF does not
+ waive the privileges and immunities granted to it by virtue of its status as
+ an Intergovernmental Organization or submit itself to any jurisdiction.
+
+ ***************************** LICENSE END *************************************/
+
+#ifndef MVNETWORK_H
+#define MVNETWORK_H
+
+
+#include <string.h>
+#include <curl/curl.h>  // needed because we use the CURL type in MvNetwork
+using std::string;
+
+
+// ----------------------------------------------------------------------------
+// MvNetworkData
+// Holds and manages the buffer to store data resulting from a network transfer
+// ----------------------------------------------------------------------------
+
+class MvNetworkData
+{
+public:
+    MvNetworkData() : buffer_(0),pos_(0),len_(0), initialSize_(10240) {}
+    ~MvNetworkData();
+    
+    void clear();
+    
+    size_t add(char *ptr,size_t size);
+    string toString();
+        
+    char* buffer_;
+    size_t pos_;
+    size_t len_;
+    const size_t initialSize_;
+};  
+
+
+
+// ---------------------------------------------------------------------- 
+// MvNetwork
+// Handles the data request and writes the data to the requested location
+// ---------------------------------------------------------------------- 
+
+class MvNetwork
+{
+public:
+    MvNetwork();
+    bool get(const string&, const string&, const string, string&);
+    string header() {return header_.toString();}
+    long   responseCode() {return responseCode_;}
+    
+protected:
+    void setupProxy();
+    static size_t writeCb(char *ptr,size_t size,size_t nmemb,void *userdata);
+    static size_t headerCb(char *ptr,size_t size,size_t nmemb,void *userdata);
+
+    CURL *ch_;
+    string outFile_;
+    MvNetworkData data_;
+    MvNetworkData header_;
+    long responseCode_;
+};
+
+
+#endif //MVNETWORK_H
diff --git a/src/libUtil/MvOdb.cc b/src/libUtil/MvOdb.cc
index b3e280f..af0ec5e 100644
--- a/src/libUtil/MvOdb.cc
+++ b/src/libUtil/MvOdb.cc
@@ -1033,7 +1033,6 @@ int MvOldOdb::findColumn(string cname)
 {
 	readMetaData();
 
-	int colPos=-1;
 	for(int i=0; i < static_cast<int>(column_.size()) ; i++)
 	{
 		if(cname == column_[i]->name())
diff --git a/src/libUtil/MvPath.cc b/src/libUtil/MvPath.cc
index 7fe19b5..2bbc754 100644
--- a/src/libUtil/MvPath.cc
+++ b/src/libUtil/MvPath.cc
@@ -14,51 +14,29 @@
 #include "MvPath.hpp"
 #include "UtilitiesC.h"
 
-static Cached user_dir = getenv("METVIEW_USER_DIRECTORY");
+static string user_dir = getenv("METVIEW_USER_DIRECTORY");
 static Cached tmp_dir  = getenv("METVIEW_TMPDIR");
 static Cached metv_dir = getenv("METVIEW_DIR_SHARE");
 
 string
 GetUserDirectory()
 {
-    return (const char*)user_dir;
+    return user_dir;
 }
 
-Cached
-MakeUserPath(const Cached& name)
-{
-// FII0710 I think this code is not correct. It should try
-// to build an absolute path taking into consideration the
-// relative part of the path "../"  Alternatively, leave
-// the relative part of the path as it is.
-#if 0
-  // Strip off any relative part of the name "../.. etc"
-  // to try to build a correct absolute path.
-  bool found = false;
-  const char *cptr = name;
-  int i;
-
-  if ( strlen(name) > 3 )
-    {
-      for ( i = strlen(name)-1; i >=2; i-- )
-	{
-	  if ( name[i] == '/' && name[i-1] == '.' && name[i-2] == '.' )
-	    {
-	      found = true;
-	      break;
-	    }
-	}
-    }
-
-  if ( found )
-    cptr += i;
-
-  Cached fname = user_dir + (Cached)"/" + Cached(cptr);
-#endif
+string
+MakeUserPath(const string& name)
+{
+   // If "user_dir" is already part of the input string then do nothing
+   std::size_t found = name.find(user_dir);
+   if (found != std::string::npos)
+      return name;
 
-  Cached fname = user_dir + (Cached)"/" + name;
+   // Build the output string taking into consideration 
+   // if the input string has already the character '/'
+   string fname = (name[0] == '/') ? user_dir + name : user_dir + "/" + name;
 
-  return fname;
+   return fname;
 }
 
 string
@@ -66,7 +44,7 @@ MakeUserDefPath(const char* name, bool absolutePath)
 {
     string fname;
     if ( absolutePath )
-        fname += (const char*)user_dir;
+        fname += user_dir;
 
     fname += "/System/Defaults/";
     fname += name;
@@ -77,7 +55,7 @@ MakeUserDefPath(const char* name, bool absolutePath)
 string
 MakeUserPrefPath(const char* name)
 {
-	string fname = (const char*)user_dir;
+	string fname = user_dir;
 	fname += "/System/Preferences/";
 	fname += name;
 
@@ -105,7 +83,7 @@ MakeTmpPath(const char* name)
 Cached
 MakeFilePath (const char* reqName )
 {
-	Cached path = user_dir + Cached("/") + Cached ( dirname ( reqName ));
+	Cached path = user_dir.c_str() + Cached("/") + Cached ( dirname ( reqName ));
 
 return path;
 }
@@ -117,6 +95,22 @@ MakeIconName ( const char* path, const char* iconPrefix )
 	return UtProgressiveName2 ( path, iconPrefix );
 }
 
+string
+MakeIconNameFromPath(const string& path)
+{
+   string name;
+
+   // If "user_dir" is not part of the input string then do nothing
+   std::size_t found = path.find(user_dir);
+   if (found == std::string::npos)
+      return name;
+
+   // Build the output string
+   name = path.substr(found+user_dir.size());
+
+   return name;
+}
+
 Cached
 MakePrinterFileName ( const Cached& path, const Cached& fileName )
 {
@@ -225,13 +219,43 @@ MakeProcessName (const char* name)
 string
 FullPathName( const char* filename )
 {
-	string fullPath( filename );
-	if( *filename != '/' )
-	{
-	   const char* pwd = getenv( "PWD" );
-	   //std::cout << "PWD = " << pwd << std::endl;
-	   fullPath = string( pwd ) + string( "/" ) + fullPath;
-	   //std::cout << "full path = " << fullPath << std::endl;
-	}
-	return fullPath;
+   string fullPath( filename );
+   if( *filename != '/' )
+   {
+      const char* pwd = getenv( "PWD" );
+      fullPath = string( pwd ) + string( "/" ) + fullPath;
+   }
+
+   return fullPath;
+}
+
+string
+UserTempCachePath()
+{
+   string tmpdir = getenv("MV_TMPDIR_LINK");
+   string fname = user_dir + "/System/" + tmpdir + "/";
+
+   return fname;
+}
+
+string
+MakeAbsolutePath( const char* path, const char* dir )
+{
+   // Consistency check
+   if ( !path )
+      return dir ? string(dir) : string("");
+
+   // If input parameter is already an absolute path then returns it.
+   // Make sure that the file exists
+   if ( path[0] == '/' && FileCanBeOpened(path,"r") )
+      return string(path);
+
+   // Build an absolute path
+   string upath;
+   if ( dir )
+      upath = dir + string("/") + path;
+   else
+      upath = user_dir + path;  // uses METVIEW_USER_DIRECTORY
+
+   return upath;
 }
diff --git a/src/libUtil/MvPath.hpp b/src/libUtil/MvPath.hpp
index f8d1e4d..5b1690a 100644
--- a/src/libUtil/MvPath.hpp
+++ b/src/libUtil/MvPath.hpp
@@ -15,7 +15,7 @@
 #include <string>
 using std::string;
 
-Cached MakeUserPath    ( const Cached& name );
+string MakeUserPath    ( const string& name );
 string MakeUserDefPath ( const char* name, bool absolutePath=true );
 string MakeUserPrefPath( const char* name );
 string MakeSystemEtcPath  ( const string& name );
@@ -35,4 +35,6 @@ string FullPathName( const char* filename );
 
 string GetUserDirectory();
 
+string MakeAbsolutePath( const char*, const char* = 0 );
+
 #endif
diff --git a/src/libUtil/TableReader.cc b/src/libUtil/TableReader.cc
index 48e2e11..ad27966 100644
--- a/src/libUtil/TableReader.cc
+++ b/src/libUtil/TableReader.cc
@@ -1,33 +1,12 @@
 /***************************** LICENSE START ***********************************
 
- Copyright 2012 ECMWF and INPE. This software is distributed under the terms
+ Copyright 2016 ECMWF and INPE. This software is distributed under the terms
  of the Apache License version 2.0. In applying this license, ECMWF does not
  waive the privileges and immunities granted to it by virtue of its status as
  an Intergovernmental Organization or submit itself to any jurisdiction.
 
  ***************************** LICENSE END *************************************/
 
-/*******************************  LICENSE  *******************************
-
-
- Copyright 2011 European Centre for Medium-Range Weather Forecasts (ECMWF)
- 
- Licensed under the Apache License, Version 2.0 (the "License"); 
- you may not use this file except in compliance with the License. 
- You may obtain a copy of the License at 
- 
- 	http://www.apache.org/licenses/LICENSE-2.0
- 
- Unless required by applicable law or agreed to in writing, software 
- distributed under the License is distributed on an "AS IS" BASIS, 
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- See the License for the specific language governing permissions and 
- limitations under the License.
-
-
- *******************************  LICENSE  *******************************/
-
-
 #include "TableReader.h"
 
 
diff --git a/src/libUtil/TableReader.h b/src/libUtil/TableReader.h
index 002c232..f999c10 100644
--- a/src/libUtil/TableReader.h
+++ b/src/libUtil/TableReader.h
@@ -1,32 +1,12 @@
 /***************************** LICENSE START ***********************************
 
- Copyright 2012 ECMWF and INPE. This software is distributed under the terms
+ Copyright 2016 ECMWF and INPE. This software is distributed under the terms
  of the Apache License version 2.0. In applying this license, ECMWF does not
  waive the privileges and immunities granted to it by virtue of its status as
  an Intergovernmental Organization or submit itself to any jurisdiction.
 
  ***************************** LICENSE END *************************************/
 
-/*******************************  LICENSE  *******************************
-
-
- Copyright 2011 European Centre for Medium-Range Weather Forecasts (ECMWF)
- 
- Licensed under the Apache License, Version 2.0 (the "License"); 
- you may not use this file except in compliance with the License. 
- You may obtain a copy of the License at 
- 
- 	http://www.apache.org/licenses/LICENSE-2.0
- 
- Unless required by applicable law or agreed to in writing, software 
- distributed under the License is distributed on an "AS IS" BASIS, 
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
- See the License for the specific language governing permissions and 
- limitations under the License.
-
-
- *******************************  LICENSE  *******************************/
-
 #ifndef TableReader_H
 #define TableReader_H
 
diff --git a/src/libUtil/proj_braz.cc b/src/libUtil/proj_braz.cc
index 8a1b358..9dec7ec 100644
--- a/src/libUtil/proj_braz.cc
+++ b/src/libUtil/proj_braz.cc
@@ -23,14 +23,15 @@
 static Datum			*D;
 static SProjection		*Sp1,*Sp2;
 static GeneralProjection	*Gp1,*Gp2;
-static CylindEquid		*Ce1,*Ce2;
-static PolarStereo		*Ps1,*Ps2;
+//static CylindEquid		*Ce1,*Ce2;
+//static PolarStereo		*Ps1,*Ps2;
 static Satellite		*Sat1,*Sat2;
 static SImage			*Imi,*Imo;
 static BBox				*B1,*B2;
 static CPoint				*P1,*P2,*P3,*P4;
+static int XXX = 0;
 
-static char		*txd,*tx1,*tx2,*tx3,*tx4,tmp1[M_NAME_MAX],tmp2[M_NAME_MAX];
+static char		*tx1,*tx2,*tx3,*tx4;
 
 Real pWidth(BBox *b)
 {
@@ -482,7 +483,6 @@ void pimin1_()
 
 void pimind_(int i1, char *tx, Real Pdx, Real Pdy, Real Pdz, double Prd, double Pflt)
 {
-	int		i;
 	short		Pcode;
 
 	/* Define and Initialize Datum and Projection */
@@ -895,7 +895,7 @@ void ChangeLL(SProjection *Sp, double *lon1, double *lat1)
 		z2,
 		d,lat2,	/* Ancillary variable */
 		lon2;
-	Real	Pdx,Pdy,Pdz,tmp;
+	Real	Pdx,Pdy,Pdz;
 	double	Prd,Pflt;
 
 	Pdx = Sp->Pdx;
@@ -1199,17 +1199,17 @@ CPoint pPolLL2PC (SProjection *Sp, CPoint ptll)
 		t,ro,aux1,aux2,aux3,ptllx,ptlly;
 	short	GPhemis;
 	double	Pflt,Prd;
-	double	GPlat0,GPlon0,GPstlat1,GPstlat2;
+	double	GPlon0;
 	CPoint ppc;
 	
 	ptllx = (double)ptll.X;
 	ptlly = (double)ptll.Y;
 
 	GPhemis = Sp->Proj.Gp->GPhemis;
-	GPlat0 = Sp->Proj.Gp->GPlat0;
+	//GPlat0 = Sp->Proj.Gp->GPlat0;
 	GPlon0 = Sp->Proj.Gp->GPlon0;
-	GPstlat1 = Sp->Proj.Gp->GPstlat1;
-	GPstlat2 = Sp->Proj.Gp->GPstlat2;
+	//GPstlat1 = Sp->Proj.Gp->GPstlat1;
+	//GPstlat2 = Sp->Proj.Gp->GPstlat2;
 
 	Pflt = Sp->Pflt;
 	Prd = Sp->Prd;
@@ -1255,7 +1255,7 @@ CPoint pPolPC2LL (SProjection *Sp, CPoint ptpc)
 		lon0,			/* auxilliary origin longitude */
 		ro,t,xx,aux1,aux2,aux3,aux4,aux5,ptpcx,ptpcy,px,py;
 	short	GPhemis;
-	double	GPlat0,GPlon0,GPstlat1,GPstlat2;
+	double	GPlon0;
 	double	Pflt,Prd;
 	CPoint ppc;
 
@@ -1263,10 +1263,10 @@ CPoint pPolPC2LL (SProjection *Sp, CPoint ptpc)
 	py = (double)ptpc.Y;
 
 	GPhemis = Sp->Proj.Gp->GPhemis;
-	GPlat0 = Sp->Proj.Gp->GPlat0;
+	//GPlat0 = Sp->Proj.Gp->GPlat0;
 	GPlon0 = Sp->Proj.Gp->GPlon0;
-	GPstlat1 = Sp->Proj.Gp->GPstlat1;
-	GPstlat2 = Sp->Proj.Gp->GPstlat2;
+	//GPstlat1 = Sp->Proj.Gp->GPstlat1;
+	//GPstlat2 = Sp->Proj.Gp->GPstlat2;
 
 	Pflt = Sp->Pflt;
 	Prd = Sp->Prd;
@@ -1347,19 +1347,19 @@ CPoint pMerLL2PC (SProjection *Sp, CPoint ptll)
 	double	equad,			/*Squared eccentricity  */
 		aux1,			/* Ancillary variables */
 		aux2,aux3,aux4,aux5,aux6,ptllx,ptlly;
-	short	GPhemis;
+	//short	GPhemis;
 	double	Pflt,Prd;
-	double	GPlat0,GPlon0,GPstlat1,GPstlat2;
+	double	GPlon0,GPstlat1;
 	CPoint	ppc;
 
 	ptllx = (double)ptll.X;
 	ptlly = (double)ptll.Y;
 
-	GPhemis = Sp->Proj.Gp->GPhemis;
-	GPlat0 = Sp->Proj.Gp->GPlat0;
+	//GPhemis = Sp->Proj.Gp->GPhemis;
+	//GPlat0 = Sp->Proj.Gp->GPlat0;
 	GPlon0 = Sp->Proj.Gp->GPlon0;
 	GPstlat1 = Sp->Proj.Gp->GPstlat1;
-	GPstlat2 = Sp->Proj.Gp->GPstlat2;
+	//GPstlat2 = Sp->Proj.Gp->GPstlat2;
 
 	Pflt = Sp->Pflt;
 	Prd = Sp->Prd;
@@ -1390,19 +1390,19 @@ CPoint pMerPC2LL (SProjection *Sp, CPoint ptpc)
 	double	equad,			/*Squared eccentricity  */
 		t,			/* Ancillary variables */
 		xx,aux1,aux2,aux3,aux4,aux5,ptpcx,ptpcy;
-	short	GPhemis;
-	double	GPlat0,GPlon0,GPstlat1,GPstlat2;
+	//short	GPhemis;
+	double	GPlon0,GPstlat1;
 	double	Pflt,Prd;
 	CPoint	ppc;
 
 	ptpcx = (double)ptpc.X;
 	ptpcy = (double)ptpc.Y;
 
-	GPhemis = Sp->Proj.Gp->GPhemis;
-	GPlat0 = Sp->Proj.Gp->GPlat0;
+	//GPhemis = Sp->Proj.Gp->GPhemis;
+	//GPlat0 = Sp->Proj.Gp->GPlat0;
 	GPlon0 = Sp->Proj.Gp->GPlon0;
 	GPstlat1 = Sp->Proj.Gp->GPstlat1;
-	GPstlat2 = Sp->Proj.Gp->GPstlat2;
+	//GPstlat2 = Sp->Proj.Gp->GPstlat2;
 
 	Pflt = Sp->Pflt;
 	Prd = Sp->Prd;
diff --git a/src/libUtil/proj_braz.hpp b/src/libUtil/proj_braz.hpp
index 5f78d0d..8fb05f2 100644
--- a/src/libUtil/proj_braz.hpp
+++ b/src/libUtil/proj_braz.hpp
@@ -254,7 +254,7 @@ typedef struct SProjection
 	rx,		/* / horizontal resolution in meters */
 	ry;		/*  vertical resolution in meters */
 } ImageDoc;
- static int XXX = 0;
+
 typedef struct
 {
         SProjection*    IProj;  /* pointer to projection */
diff --git a/src/uPlot/AverageView.cc b/src/uPlot/AverageView.cc
index 20e2976..3a5a69d 100644
--- a/src/uPlot/AverageView.cc
+++ b/src/uPlot/AverageView.cc
@@ -26,14 +26,8 @@ AverageViewFactory::Build ( Page& page,
                             const MvRequest& contextRequest,
                             const MvRequest& setupRequest )
 {
-   // Expand request
-   MvRequest expReq = ObjectList::ExpandRequest(contextRequest,EXPAND_DEFAULTS);
-
-   // Copy hidden parameters
-   expReq.mars_merge(contextRequest);
-
    // Instantiate a Average view
-   return new AverageView ( page, expReq, setupRequest );
+   return new AverageView ( page, contextRequest, setupRequest );
 }
 
 //--------------------------------------------------------
@@ -120,7 +114,7 @@ AverageView::DescribeYourself ( ObjectInfo& description )
 {
     // Convert my request to macro
     set<Cached> skipSet;
-    description.ConvertRequestToMacro ( viewRequest_, PUT_END,
+    description.ConvertRequestToMacro ( appViewReq_, PUT_END,
                                         MacroName().c_str(),"maverageview", skipSet);
 
     description.PutNewLine (" " );
@@ -255,3 +249,20 @@ void AverageView::ApplicationInfo ( const MvRequest& req )
    else if ( (const char*)req("_Y_AUTOMATIC_REVERSE") )
       yReverse_ = (const char*)req("_Y_AUTOMATIC_REVERSE");
 }
+
+bool AverageView::ConsistencyCheck( MvRequest& req1, MvRequest& req2 )
+{
+   // Build a list of parameters to be checked
+   vector<string> params;
+   params.push_back("AREA");
+   params.push_back("DIRECTION");
+
+   // Expand requests using the same expansion flag to avoid
+   // problems with parameters with multiple values (e.g.
+   // NS or NORTH_SOUTH are valid values for parameter DIRECTION
+   MvRequest t1 = ObjectList::ExpandRequest(req1,EXPAND_DEFAULTS);
+   MvRequest t2 = ObjectList::ExpandRequest(req2,EXPAND_DEFAULTS);
+
+   // Call a function to perform the consistency check
+   return t1.checkParameters(t2,params);
+}
diff --git a/src/uPlot/AverageView.h b/src/uPlot/AverageView.h
index 94195e6..794d2c5 100644
--- a/src/uPlot/AverageView.h
+++ b/src/uPlot/AverageView.h
@@ -112,6 +112,9 @@ public:
     // Update view
     virtual bool UpdateView ();
 
+   // Check consistency between the View and Data Module
+   virtual bool ConsistencyCheck( MvRequest&, MvRequest& );
+
 private:
 
     // Save some data specific to some DataApplication
diff --git a/src/uPlot/CMakeLists.txt b/src/uPlot/CMakeLists.txt
index dce9046..a128b8f 100644
--- a/src/uPlot/CMakeLists.txt
+++ b/src/uPlot/CMakeLists.txt
@@ -150,7 +150,7 @@ ecbuild_add_executable( TARGET       uPlot
                         LIBS         ${METVIEW_QT_LIBRARIES} ${STANDARD_METVIEW_LIBS} MagPlus MagWrapper ${METVIEW_ODB_API_LIBRARIES} ${X11_LIBRARIES}
                     )
 
-MESSAGE( STATUS "UPLOT CMAKE_INCLUDE_PATH: " ${CMAKE_INCLUDE_PATH} )
+ecbuild_debug("UPLOT CMAKE_INCLUDE_PATH: " ${CMAKE_INCLUDE_PATH})
 ###nodist_bin_uPlot_SOURCES = ${uPlot_COMMON_QT_SOURCES_nodist} ${uPlot_COMMON_UI_SOURCES_nodist} \
 ###                           uPlot.moc.cpp
 
diff --git a/src/uPlot/CommonXSectView.cc b/src/uPlot/CommonXSectView.cc
index 2cf1ee4..bdf67c0 100644
--- a/src/uPlot/CommonXSectView.cc
+++ b/src/uPlot/CommonXSectView.cc
@@ -28,8 +28,19 @@ CommonXSectView::CommonXSectView ( Page& owner,
                     PlotModService ( setupRequest("service"), this ),
                     appViewReq_    ( viewRequest )
 {
-    yMin_ = viewRequest_("BOTTOM_LEVEL");
-    yMax_ = viewRequest_("TOP_LEVEL");
+   // Get min/max values
+   if ( (const char*)viewRequest_("BOTTOM_LEVEL") && (const char*)viewRequest_("TOP_LEVEL") )
+   {
+      yMin_ = viewRequest_("BOTTOM_LEVEL");
+      yMax_ = viewRequest_("TOP_LEVEL");
+   }
+   else
+   {
+      // Expand request
+      MvRequest expReq = ObjectList::ExpandRequest(viewRequest_,EXPAND_DEFAULTS);
+      yMin_ = expReq("BOTTOM_LEVEL");
+      yMax_ = expReq("TOP_LEVEL");
+   }
 }
 
 CommonXSectView::CommonXSectView(const CommonXSectView &old) :
@@ -63,11 +74,24 @@ bool CommonXSectView::CallService(const MvRequest &dataReq, PmContext & context,
     if ( dataReq.getVerb() != GRIB && dataReq.getVerb() != NETCDF && dataReq.getVerb() != BUFR )
         return false;
 
+    // Build a request to send to the Service.
+    // The _CONTEXT subrequest is an important information to the Service and
+    // needs to be attached to the main request. To avoid duplication of messages
+    // remove the _CONTEXT subrequest from the DATA request, if it exists.
     MvRequest appRequest(ApplicationName().c_str());
-    appRequest("DATA")     = dataReq;
+    if ( (const char*)dataReq("_CONTEXT") )
+    {
+       MvRequest auxReq(dataReq.getVerb());
+       CopyAndRemoveParameters ( dataReq, auxReq, "_CONTEXT");
+       appRequest("DATA") = auxReq;
+    }
+    else
+       appRequest("DATA") = dataReq;
+
     appRequest("_CONTEXT") = viewRequest_;
     appRequest("_ACTION")  = (const char*)dataReq("_ACTION") ? (const char*)dataReq("_ACTION") : "prepare";
     appRequest("_VERB")    = (const char*)dataReq("_VERB") ? (const char*)dataReq("_VERB") : "";
+    appRequest("_CLASS")    = (const char*)dataReq("_CLASS") ? (const char*)dataReq("_CLASS") : "";
 
     //( new PlotModTask (this, context, serviceName_.c_str(), appRequest ) )->run();
     PlotModTask* pmt = new PlotModTask (this, context, serviceName_.c_str(), appRequest );
@@ -116,11 +140,12 @@ void CommonXSectView::Drop ( PmContext& context )
 
       // Process data coming from special Modules (i.e. tag _MODULEID)
       MvRequest replyRequest;
-
-      if ( this->DropFromModule(dropRequest,replyRequest) )
+      bool consistency_check;
+      if ( this->DropFromModule(dropRequest,replyRequest,consistency_check) )
       {
          // Insert reply request to the database
-         duList = this->InsertDataRequest ( replyRequest );
+         if ( consistency_check )
+            duList = this->InsertDataRequest ( replyRequest );
 
          //  The drop request has been already advanced
          continue;
@@ -214,21 +239,40 @@ void CommonXSectView::Drop ( PmContext& context )
 }
 
 bool
-CommonXSectView::DropFromModule ( MvRequest& dropRequest, MvRequest& replyRequest )
+CommonXSectView::DropFromModule ( MvRequest& dropRequest, MvRequest& replyRequest, bool& consistency_check )
 {
    // If a request comes from a Module, identified by a tag _MODULEID, then group
    // all the relative requests. These requests should be processed together.
    // There are two possible set of requests coming from a Module:
    // A) main verb is NETCDF: this is the case when the Module was called to
-   //    compute the data but not to visualise it. All the relevant visualisation
-   //    requests are under parameter _VISUALISE.
+   //    compute the data but not to visualise it. This happens, for instance, when
+   //    function mcross_sect is called inside a Macro and used in a PLOT command
+   //    afterwards. All the relevant visualisation data requests are under parameter
+   //    _VISUALISE.
+   //    If the request also contains a hidden parameter describing the internal VIEW
+   //    to be used with this dataunit, then it needs to be checked against the current
+   //    VIEW. This situation can happen, for instance, in a Macro program:
+   //        xs = mcross_sect ( line : [ 0,-180,0,10],... )
+   //        view = mxsectview( line : [10,-180,0,10],... )
+   //        plot(view, xs)
+   //    Output parameter consistency_check will indicate if the consistency check 
+   //    has failed.
+   //
    // B) others: group all subsequent requests with the same tag id.
 
+
    // Process option A
+   consistency_check = true;  // by default the consistency check returns true
    if ( (const char*)dropRequest.getVerb() == string("NETCDF") )
    {
       replyRequest = dropRequest.getSubrequest("_VISUALISE");
+
+      // Consistency check
+      MvRequest origReq = dropRequest.getSubrequest("_VIEW_REQUEST");
       dropRequest.advance();  
+      if ( origReq )
+         consistency_check = this->ConsistencyCheck(viewRequest_,origReq);
+
       return true;
    }
 
diff --git a/src/uPlot/CommonXSectView.h b/src/uPlot/CommonXSectView.h
index 5a4da98..335d57f 100644
--- a/src/uPlot/CommonXSectView.h
+++ b/src/uPlot/CommonXSectView.h
@@ -89,6 +89,9 @@ public:
 
     int ParentDataUnitId () { return parentDataUnitId_; }
 
+    virtual bool ConsistencyCheck( MvRequest&, MvRequest&)
+       { return true; }
+
 protected:
 
     void ApplicationName( const string& appname )
@@ -108,7 +111,7 @@ protected:
 
     // Get output requests from executing a Module (they all have the
     // same tag _MODULEID
-    bool DropFromModule ( MvRequest&, MvRequest& );
+    bool DropFromModule ( MvRequest&, MvRequest&, bool& );
 
 #if 0
     // Provide Axis information
diff --git a/src/uPlot/HovmoellerView.cc b/src/uPlot/HovmoellerView.cc
index 1031436..34c9e8a 100644
--- a/src/uPlot/HovmoellerView.cc
+++ b/src/uPlot/HovmoellerView.cc
@@ -64,31 +64,6 @@ HovmoellerViewM3Factory::Translate ( const MvRequest& in )
 
    // Copy Line parameter
    MvRequest viewReq("MHOVMOELLERVIEW");
-#if 0
-   viewReq.addValue("LINE",(double)req("LINE",0));
-   viewReq.addValue("LINE",(double)req("LINE",1));
-   viewReq.addValue("LINE",(double)req("LINE",2));
-   viewReq.addValue("LINE",(double)req("LINE",3));
-
-   // Translate Levels interval
-   viewReq("BOTTOM_LEVEL") = (double)req("BOTTOM_PRESSURE");
-   viewReq("TOP_LEVEL")    = (double)req("TOP_PRESSURE");
-
-   // Copy Wind parameters
-   viewReq("WIND_PARALLEL")      = (const char*)req("WIND_PARALLEL");
-   viewReq("WIND_PERPENDICULAR") = (const char*)req("WIND_PERPENDICULAR");
-   viewReq("WIND_INTENSITY")     = (const char*)req("WIND_INTENSITY");
-
-   // Translate Vertical scaling parameter
-   viewReq("VERTICAL_SCALING") = (const char*)req("PRESSURE_LEVEL_AXIS");
-
-   // Overlay Control parameter is not translated
-   PlotMod::Instance().MetviewError ("The Metview 3 CROSS SECTION VIEW icon is deprecated. Parameter OVERLAY CONTROL will not be internally translated.\n","WARNING");
-
-   // Copy Page and Subpage parameters
-   CopySomeParameters ( req,viewReq,"Subpage");
-   CopySomeParameters ( req,viewReq,"Page");
-#endif
 
    // Expand output request
    MvRequest out = ObjectList::ExpandRequest(viewReq,EXPAND_DEFAULTS);
@@ -101,7 +76,9 @@ HovmoellerViewM3Factory::Translate ( const MvRequest& in )
 HovmoellerView::HovmoellerView ( Page& owner,
                                  const MvRequest& viewRequest,
                                  const MvRequest& setupRequest ):
-                CommonXSectView ( owner, viewRequest, setupRequest )
+                CommonXSectView ( owner, viewRequest, setupRequest ),
+                bDataUnit_(false),
+                bUpdateDate_(true)
 {
    SetVariables(viewRequest,true);
    ApplicationName(type_.c_str());
@@ -110,11 +87,13 @@ HovmoellerView::HovmoellerView ( Page& owner,
 HovmoellerView::HovmoellerView ( const HovmoellerView &old ) :
                 CommonXSectView(old)
 {
-   type_     = old.type_;
-   bDateMin_ = old.bDateMin_;
-   bDateMax_ = old.bDateMax_;
-   dateMin_  = old.dateMin_;
-   dateMax_  = old.dateMax_;
+   type_      = old.type_;
+   dateMin_   = old.dateMin_;
+   dateMax_   = old.dateMax_;
+   bAutoDate_ = old.bAutoDate_;
+   swapAxes_  = old.swapAxes_;
+   bDataUnit_ = old.bDataUnit_;
+   bUpdateDate_ = old.bUpdateDate_;
 }
 
 string HovmoellerView::Name()
@@ -129,7 +108,7 @@ void HovmoellerView::DescribeYourself ( ObjectInfo& description )
 {
    // Convert my request to macro
    set<Cached> skipSet;
-   description.ConvertRequestToMacro ( viewRequest_, PUT_END, MacroName().c_str(),"hovmoellerview", skipSet);
+   description.ConvertRequestToMacro ( appViewReq_, PUT_END, MacroName().c_str(),"mhovmoellerview", skipSet);
    description.PutNewLine (" " );
 }
 
@@ -150,49 +129,120 @@ void HovmoellerView::SetVariables(const MvRequest &in, bool)
    lonMin_ = in(param,1);
    lonMax_ = in(param,3);
 
+   // Check if coordinates follow Mars rules (n/w/s/e)
+   bool swap = false;
+   if ( lonMin_ > lonMax_ )
+   {
+      double W = lonMin_;
+      lonMin_ = lonMax_;
+      lonMax_ = W;
+      swap = true;
+   }
+   if( latMin_ > latMax_ )
+   {
+      double W = latMin_;
+      latMin_ = latMax_;
+      latMax_ = W;
+      swap = true;
+   }
+
+   // Send a warning message
+   if ( swap )
+//      PlotMod::Instance().MetviewError ("Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped ","WARNING");
+      cout << "WARNING: Input geographical coordinates do not follow MARS rules (n/w/s/e). Values have been swapped " << endl;
+
    // Set date limits
+   bool bDateMin, bDateMax;
    if ( strcmp((const char*)in("DATE_MIN"),"AUTOMATIC") == 0 )
    {
-      bDateMin_ = true;
-      dateMin_  = "2013-01-01";
+      bDateMin = true;
+      dateMin_ = "2013-01-01";
    }
    else
    {
-      bDateMin_ = false;
-      dateMin_  = (const char*)in("DATE_MIN");
+      bDateMin = false;
+      dateMin_ = (const char*)in("DATE_MIN");
    }
 
    if ( strcmp((const char*)in("DATE_MAX"),"AUTOMATIC") == 0 )
    {
-      bDateMax_ = true;
-      dateMax_  = "2013-01-01 00:01:00";
+      bDateMax = true;
+      dateMax_ = "2013-01-01 00:01:00";
+   }
+   else
+   {
+      bDateMax = false;
+      dateMax_ = (const char*)in("DATE_MAX");
    }
+
+   // Both date values must be automatic or non-automatic
+   if ( bDateMin && bDateMax )
+      bAutoDate_ = true;
+   else if ( !bDateMin && !bDateMax )
+      bAutoDate_ = false;
    else
    {
-      bDateMax_ = false;
-      dateMax_  = (const char*)in("DATE_MAX");
+      PlotMod::Instance().MetviewError ("Hovmoeller Error: both parameters DATE_MIN and DATE_MAX must be automatic or non-automatic.\n","ERROR");
+      bAutoDate_ = false;
    }
+
+   // Set swapAxes flag
+   swapAxes_ = ( (const char*)in("SWAP_AXES") &&
+                 strcmp(in("SWAP_AXES"),"YES") == 0) ? true : false;
+
+   return;
 }
 
 bool HovmoellerView::UpdateView ()
 {
-   // It has already been updated
+   // Check if the View needs to be updated
    if ( string(viewRequest_.getVerb()) == CARTESIANVIEW )
+   {
+      // The View has already been updated to CARTESIANVIEW,
+      // but there is one case where the Date parameter needs to be
+      // updated again: when parameters DATE_MIN and DATE_MAX in the
+      // HovmoellerView were defined as AUTOMATIC and when the
+      // CARTESIANVIEW was first created with no DataUnit attached 
+      // (i.e. an empty View was plotted - in this case MAGICS needs to 
+      // receive a default X/Y_DATE_MIN/MAX values). This code would not
+      // be necessary if MAGICS was able to receive a AUTOMATIC value 
+      // without a DataUnit attached.
+      if ( bUpdateDate_ )
+      {
+         if ( (const char*)viewRequest_("X_AXIS_TYPE") && 
+           ( strcmp((const char*)viewRequest_("X_AXIS_TYPE"),"DATE") == 0 ) )
+         {
+            if ( bAutoDate_ )
+            {
+               viewRequest_("X_AUTOMATIC") = "ON";
+               viewRequest_.unsetParam("X_DATE_MIN");
+               viewRequest_.unsetParam("X_DATE_MAX");
+               bUpdateDate_ = false;
+            }
+         }
+         else if ( (const char*)viewRequest_("Y_AXIS_TYPE") && 
+           ( strcmp((const char*)viewRequest_("Y_AXIS_TYPE"),"DATE") == 0 ) )
+         {
+            if ( bAutoDate_ )
+            {
+               viewRequest_("Y_AUTOMATIC") = "ON";
+               viewRequest_.unsetParam("Y_DATE_MIN");
+               viewRequest_.unsetParam("Y_DATE_MAX");
+               bUpdateDate_ = false;
+            }
+         }
+      }
       return true;
-
-   // Translate common parameters
-   //GetCommonParameters ( req, cartView );
-   bool swapAxes = ( (const char*)viewRequest_("SWAP_AXES") &&
-                     strcmp(viewRequest_("SWAP_AXES"),"YES") == 0) ? true : false;
+   }
 
    // Translate specific parameters
    MvRequest cartView("CARTESIANVIEW");
    if ( type_ == HOVLINE )
-      UpdateViewLine( swapAxes, viewRequest_, cartView );
+      UpdateViewLine( cartView );
    else if ( type_ == HOVAREA )
-      UpdateViewArea( swapAxes, viewRequest_, cartView );
+      UpdateViewArea( cartView );
    else
-      UpdateViewVert( viewRequest_, cartView );
+      UpdateViewVert( cartView );
 
     // Copy PAGE and SUBPAGE definition
     CopySomeParameters( viewRequest_,cartView,"PAGE" );
@@ -220,89 +270,88 @@ void HovmoellerView::UpdateView ( MvRequest& view )
    this->ApplicationInfo(view);
 }
 
-void HovmoellerView::UpdateViewLine ( bool swapAxes, MvRequest& in, MvRequest& cartView )
+void HovmoellerView::UpdateViewLine ( MvRequest& cartView )
 {
-   // Check where the axes min/max values should be taken from
-   if ( (const char*)viewRequest_("_DEFAULT") &&
-        (int)viewRequest_("_DEFAULT") == 1 &&
-        (const char*)viewRequest_("_DATAATTACHED") &&
-        strcmp((const char*)viewRequest_("_DATAATTACHED"),"YES") == 0
-      )
-   {
-      cartView("X_AUTOMATIC") = "on";
-      cartView("Y_AUTOMATIC") = "on";
-   }
-   else
-   {
-      cartView("X_AUTOMATIC") = "off";
-      cartView("Y_AUTOMATIC") = "off";
-   }
-
    // Translate Geographical and Time coordinates
-   if ( swapAxes )
+   // IMPORTANT: 
+   // 1) The definition of the min/max/lat/lon coordinates must 
+   // match the organisation of the netCDF data matrix, which is:
+   // | [LatNorth,LonWest] ... [LatNorth,LonEast] |
+   // |          ...                              |
+   // | [LatSouth,LonWest] ... [LatSouth,LonEast] |
+   //
+   // 2) Hovmoeller computes values from North to South (first value
+   // in the netCDF matrix is [LatNorth,LonWest] and Magics plots them
+   // from bottom to top by default.
+   if ( swapAxes_ )
    {
-      cartView("Y_AXIS_TYPE")     = "geoline";
+      cartView("Y_AUTOMATIC")     = "OFF";
+      cartView("Y_AXIS_TYPE")     = "GEOLINE";
       cartView("Y_MIN_LATITUDE")  = latMin_;
       cartView("Y_MAX_LATITUDE")  = latMax_;
-      cartView("Y_MIN_LONGITUDE") = lonMin_;
-      cartView("Y_MAX_LONGITUDE") = lonMax_;
+      cartView("Y_MIN_LONGITUDE") = lonMax_;
+      cartView("Y_MAX_LONGITUDE") = lonMin_;
 
-      cartView("X_AXIS_TYPE")     = "date";
-      cartView("X_DATE_MIN")      = dateMin_.c_str();
-      cartView("X_DATE_MAX")      = dateMax_.c_str();
+      cartView("X_AXIS_TYPE") = "DATE";
+      if ( bAutoDate_ && bDataUnit_ )
+      {
+         cartView("X_AUTOMATIC") = "ON";
+         bUpdateDate_ = false;
+      }
+      else
+      {
+         cartView("X_AUTOMATIC") = "OFF";
+         cartView("X_DATE_MIN")  = dateMin_.c_str();
+         cartView("X_DATE_MAX")  = dateMax_.c_str();
+         if ( !bAutoDate_ )
+            bUpdateDate_ = false;
+      }
 
       // Copy axis definition
-      cartView.setValue("HORIZONTAL_AXIS",in.getSubrequest("TIME_AXIS"));
-      cartView.setValue("VERTICAL_AXIS",in.getSubrequest("GEO_AXIS"));
+      cartView.setValue("HORIZONTAL_AXIS",viewRequest_.getSubrequest("TIME_AXIS"));
+      cartView.setValue("VERTICAL_AXIS",viewRequest_.getSubrequest("GEO_AXIS"));
    }
    else
    {
-      cartView("X_AXIS_TYPE")     = "geoline";
-      cartView("X_MIN_LATITUDE")  = latMin_;
-      cartView("X_MAX_LATITUDE")  = latMax_;
+      cartView("X_AUTOMATIC")     = "OFF";
+      cartView("X_AXIS_TYPE")     = "GEOLINE";
+      cartView("X_MIN_LATITUDE")  = latMax_;
+      cartView("X_MAX_LATITUDE")  = latMin_;
       cartView("X_MIN_LONGITUDE") = lonMin_;
       cartView("X_MAX_LONGITUDE") = lonMax_;
 
-      cartView("Y_AXIS_TYPE")     = "date";
-      cartView("Y_DATE_MIN")      = dateMin_.c_str();
-      cartView("Y_DATE_MAX")      = dateMax_.c_str();
+      cartView("Y_AXIS_TYPE") = "DATE";
+      if ( bAutoDate_ && bDataUnit_ )
+      {
+         cartView("Y_AUTOMATIC") = "ON";
+         bUpdateDate_ = false;
+      }
+      else
+      {
+         cartView("Y_AUTOMATIC") = "OFF";
+         cartView("Y_DATE_MIN")  = dateMin_.c_str();
+         cartView("Y_DATE_MAX")  = dateMax_.c_str();
+         if ( !bAutoDate_ )
+            bUpdateDate_ = false;
+      }
 
       // Copy axis definition
-      cartView.setValue("HORIZONTAL_AXIS",in.getSubrequest("GEO_AXIS"));
-      cartView.setValue("VERTICAL_AXIS",in.getSubrequest("TIME_AXIS"));
+      cartView.setValue("HORIZONTAL_AXIS",viewRequest_.getSubrequest("GEO_AXIS"));
+      cartView.setValue("VERTICAL_AXIS",viewRequest_.getSubrequest("TIME_AXIS"));
    }
 }
 
-void HovmoellerView::UpdateViewArea ( bool swapAxes, MvRequest& in, MvRequest& cartView )
+void HovmoellerView::UpdateViewArea ( MvRequest& cartView )
 {
    // Get geo axis
-   MvRequest geoAxisReq = in.getSubrequest("GEO_AXIS");
+   MvRequest geoAxisReq = viewRequest_.getSubrequest("GEO_AXIS");
    if ( !geoAxisReq )
       geoAxisReq.setVerb("MAXIS");
 
-   // Check where the axes min/max values should be taken from
-   bool axisAuto;
-   if ( (const char*)viewRequest_("_DEFAULT") &&
-        (int)viewRequest_("_DEFAULT") == 1 &&
-        (const char*)viewRequest_("_DATAATTACHED") &&
-        strcmp((const char*)viewRequest_("_DATAATTACHED"),"YES") == 0
-      )
-   {
-      cartView("X_AUTOMATIC") = "on";
-      cartView("Y_AUTOMATIC") = "on";
-      axisAuto = true;
-   }
-   else
-   {
-      cartView("X_AUTOMATIC") = "off";
-      cartView("Y_AUTOMATIC") = "off";
-      axisAuto = false;
-   }
-
    // Translate Geographical and Time coordinates
-   string dir = (const char*)in("AVERAGE_DIRECTION");
+   string dir = (const char*)viewRequest_("AVERAGE_DIRECTION");
    int hAxis, vAxis;  // 1 - time, 2 - latitude, 3 - longitude
-   if ( swapAxes )
+   if ( swapAxes_ )
    {
       hAxis = ( dir == "EAST_WEST" ) ? 2 : 1;
       vAxis = ( dir == "EAST_WEST" ) ? 1 : 3;
@@ -315,21 +364,27 @@ void HovmoellerView::UpdateViewArea ( bool swapAxes, MvRequest& in, MvRequest& c
 
    if ( hAxis == 1 ) // Horizontal time axis
    {
-      cartView("X_AXIS_TYPE")     = "date";
-      cartView("X_DATE_MIN")      = dateMin_.c_str();
-      cartView("X_DATE_MAX")      = dateMax_.c_str();
+      cartView("X_AXIS_TYPE") = "DATE";
+      if ( bAutoDate_ && bDataUnit_ )
+      {
+         cartView("X_AUTOMATIC") = "ON";
+         bUpdateDate_ = false;
+      }
+      else
+      {
+         cartView("X_AUTOMATIC") = "OFF";
+         cartView("X_DATE_MIN")  = dateMin_.c_str();
+         cartView("X_DATE_MAX")  = dateMax_.c_str();
+         if ( !bAutoDate_ )
+            bUpdateDate_ = false;
+      }
 
       geoAxisReq("AXIS_ORIENTATION") = "VERTICAL";
       if ( vAxis == 2 ) // vertical latitude axis
       {
          geoAxisReq("AXIS_TICK_LABEL_TYPE") = "LATITUDE";
-         if ( axisAuto )
-            cartView("Y_AUTOMATIC_REVERSE") = "on";
-         else
-         {
-            cartView("Y_MIN")  = latMin_;
-            cartView("Y_MAX")  = latMax_;
-         }
+         cartView("Y_MIN") = latMin_;
+         cartView("Y_MAX") = latMax_;
       }
       else // vertical longitude axis
       {
@@ -339,7 +394,7 @@ void HovmoellerView::UpdateViewArea ( bool swapAxes, MvRequest& in, MvRequest& c
       }
 
       // Set axes definitions
-      cartView.setValue("HORIZONTAL_AXIS",in.getSubrequest("TIME_AXIS"));
+      cartView.setValue("HORIZONTAL_AXIS",viewRequest_.getSubrequest("TIME_AXIS"));
       cartView.setValue("VERTICAL_AXIS",geoAxisReq);
    }
    else if ( hAxis == 2 ) // Horizontal latitude axis
@@ -349,13 +404,24 @@ void HovmoellerView::UpdateViewArea ( bool swapAxes, MvRequest& in, MvRequest& c
       geoAxisReq("AXIS_ORIENTATION")     = "HORIZONTAL";
       geoAxisReq("AXIS_TICK_LABEL_TYPE") = "LATITUDE";
 
-      cartView("Y_AXIS_TYPE")     = "date";
-      cartView("Y_DATE_MIN")      = dateMin_.c_str();
-      cartView("Y_DATE_MAX")      = dateMax_.c_str();
+      cartView("Y_AXIS_TYPE") = "DATE";
+      if ( bAutoDate_ && bDataUnit_ )
+      {
+         cartView("Y_AUTOMATIC") = "ON";
+         bUpdateDate_ = false;
+      }
+      else
+      {
+         cartView("Y_AUTOMATIC") = "OFF";
+         cartView("Y_DATE_MIN")  = dateMin_.c_str();
+         cartView("Y_DATE_MAX")  = dateMax_.c_str();
+         if ( !bAutoDate_ )
+            bUpdateDate_ = false;
+      }
 
       // Set axes definitions
       cartView.setValue("HORIZONTAL_AXIS",geoAxisReq);
-      cartView.setValue("VERTICAL_AXIS",in.getSubrequest("TIME_AXIS"));
+      cartView.setValue("VERTICAL_AXIS",viewRequest_.getSubrequest("TIME_AXIS"));
    }
    else   // Horizontal longitude axis
    {
@@ -364,87 +430,74 @@ void HovmoellerView::UpdateViewArea ( bool swapAxes, MvRequest& in, MvRequest& c
       geoAxisReq("AXIS_ORIENTATION")     = "HORIZONTAL";
       geoAxisReq("AXIS_TICK_LABEL_TYPE") = "LONGITUDE";
 
-      cartView("Y_AXIS_TYPE")     = "date";
-      cartView("Y_DATE_MIN")      = dateMin_.c_str();
-      cartView("Y_DATE_MAX")      = dateMax_.c_str();
+      cartView("Y_AXIS_TYPE") = "DATE";
+      if ( bAutoDate_ && bDataUnit_ )
+      {
+         cartView("Y_AUTOMATIC") = "ON";
+         bUpdateDate_ = false;
+      }
+      else
+      {
+         cartView("Y_AUTOMATIC") = "OFF";
+         cartView("Y_DATE_MIN")  = dateMin_.c_str();
+         cartView("Y_DATE_MAX")  = dateMax_.c_str();
+         if ( !bAutoDate_ )
+            bUpdateDate_ = false;
+      }
 
       // Set axes definitions
       cartView.setValue("HORIZONTAL_AXIS",geoAxisReq);
-      cartView.setValue("VERTICAL_AXIS",in.getSubrequest("TIME_AXIS"));
+      cartView.setValue("VERTICAL_AXIS",viewRequest_.getSubrequest("TIME_AXIS"));
    }
 }
 
-void HovmoellerView::UpdateViewVert ( MvRequest& in, MvRequest& cartView )
+void HovmoellerView::UpdateViewVert ( MvRequest& cartView )
 {
    // Vertical scaling mode
-   const char* vs = "regular";
-   if ( (const char*)in("VERTICAL_SCALING") && strcmp((const char*)in("VERTICAL_SCALING"),"LOG") == 0 )
-      vs = "logarithmic";
-
-   // Check where the axes min/max values should be taken from
-   if ( (const char*)viewRequest_("_DEFAULT") &&
-        (int)viewRequest_("_DEFAULT") == 1 &&
-        (const char*)viewRequest_("_DATAATTACHED") &&
-        strcmp((const char*)viewRequest_("_DATAATTACHED"),"YES") == 0
-      )
+   const char* vs = "REGULAR";
+   if ( (const char*)viewRequest_("VERTICAL_SCALING") && strcmp((const char*)viewRequest_("VERTICAL_SCALING"),"LOG") == 0 )
+      vs = "LOGARITHMIC";
+
+   // Translate Vertical and Time coordinates
+   cartView("X_AXIS_TYPE") = "DATE";
+   if ( bAutoDate_ && bDataUnit_ )
    {
-      cartView("X_AUTOMATIC") = "on";
-      cartView("Y_AUTOMATIC") = "on";
+      cartView("X_AUTOMATIC") = "ON";
+      bUpdateDate_ = false;
    }
    else
    {
-      cartView("X_AUTOMATIC") = "off";
-      cartView("Y_AUTOMATIC") = "off";
+      cartView("X_AUTOMATIC") = "OFF";
+      cartView("X_DATE_MIN")  = dateMin_.c_str();
+      cartView("X_DATE_MAX")  = dateMax_.c_str();
+      if ( !bAutoDate_ )
+         bUpdateDate_ = false;
    }
 
-   // Translate Vertical and Time coordinates
-   cartView("X_AXIS_TYPE") = "date";
-   cartView("X_DATE_MIN")  = dateMin_.c_str();
-   cartView("X_DATE_MAX")  = dateMax_.c_str();
-
+   cartView("Y_AUTOMATIC") = "OFF";
    cartView("Y_AXIS_TYPE") = vs;
    cartView("Y_MIN")       = yMin_;
    cartView("Y_MAX")       = yMax_;
 
    // Copy axis definition
-   cartView.setValue("HORIZONTAL_AXIS",in.getSubrequest("TIME_AXIS"));
-   cartView.setValue("VERTICAL_AXIS",in.getSubrequest("VERTICAL_AXIS"));
+   cartView.setValue("HORIZONTAL_AXIS",viewRequest_.getSubrequest("TIME_AXIS"));
+   cartView.setValue("VERTICAL_AXIS",viewRequest_.getSubrequest("VERTICAL_AXIS"));
 }
 
-void HovmoellerView::ApplicationInfo( const MvRequest& req)
+void HovmoellerView::ApplicationInfo( const MvRequest& in)
 {
-   // If it is not a VIEW request, try to find a hidden VIEW in the request
-   MvRequest viewReq;
-   if ( ObjectList::IsView(req.getVerb()) )
-      viewReq = req;
-   else
+   // Check if there is a Data Unit attached
+   MvRequest req = in;
+   while (req)
    {
-      MvRequest aux = req.getSubrequest("NETCDF_DATA");
-      if ( (const char*)aux("_CARTESIANVIEW") )
-         viewReq = aux.getSubrequest("_CARTESIANVIEW");
-      else
+      if ( ObjectList::IsDataUnit(req.getVerb()) )
       {
-         PlotMod::Instance().MetviewError ("Missing View Request in HovmoellerView::ApplicationInfo","WARNING");
+         bDataUnit_ = true;
          return;
       }
+      req.advance();
    }
-
-   // Update the DATE_MIN/MAX parameters in the View if the original values
-   // were AUTOMATIC and the Hovmoeller application provided new values
-   if ( bDateMin_ )
-   {
-      string str = (const char*)viewReq("X_DATE_MIN") ? "X_DATE_MIN" : "Y_DATE_MIN";
-      dateMin_ = (const char*)viewReq(str.c_str());
-      viewRequest_(str.c_str()) = dateMin_.c_str();
-      bDateMin_ = false;
-   }
-   if ( bDateMax_ )
-   {
-      string str = (const char*)viewReq("X_DATE_MAX") ? "X_DATE_MAX" : "Y_DATE_MAX";
-      dateMax_ = (const char*)viewReq(str.c_str());
-      viewRequest_(str.c_str()) = dateMax_.c_str();
-      bDateMax_ = false;
-   }
-
+   
+   bDataUnit_ = false;
    return;
 }
diff --git a/src/uPlot/HovmoellerView.h b/src/uPlot/HovmoellerView.h
index 393a430..e498620 100644
--- a/src/uPlot/HovmoellerView.h
+++ b/src/uPlot/HovmoellerView.h
@@ -117,16 +117,21 @@ private:
    void ApplicationInfo( const MvRequest& );
 
    // Update View according to the Hovmoeller type
-   void UpdateViewLine ( bool, MvRequest&, MvRequest& );
-   void UpdateViewArea ( bool, MvRequest&, MvRequest& );
-   void UpdateViewVert ( MvRequest&, MvRequest& );
+   void UpdateViewLine ( MvRequest& );
+   void UpdateViewArea ( MvRequest& );
+   void UpdateViewVert ( MvRequest& );
 
    // Variable members
-   string type_;         // Line, Area, Vertical
-   string dateMin_;      // date 1 current used in the axis
-   string dateMax_;      // date 2 current used in the axis
-   bool   bDateMin_;     // true: date 1 has a default value 'automatic'
-   bool   bDateMax_;     // true: date 2 has a default value 'automatic'
+   string type_;      // Line, Area, Vertical
+   string dateMin_;   // date 1 current used in the axis
+   string dateMax_;   // date 2 current used in the axis
+   bool bAutoDate_;   // true: dates min&max have a default value 'automatic'
+   bool swapAxes_;    // true: vertical axis is geoline
+   bool bDataUnit_;   // true: there is a DU to be plotted (e.g. plot is not 
+                      //       empty). If there is no DU, default Date values 
+                      //       must be assigned to dateMin_/dateMax_ because
+                      //       Magics do not accept value AUTOMATIC.
+   bool bUpdateDate_; // true: parameter Date needs to be updated
 };
 
 #endif
diff --git a/src/uPlot/MacroConverter.cc b/src/uPlot/MacroConverter.cc
index 7f82938..7de639d 100644
--- a/src/uPlot/MacroConverter.cc
+++ b/src/uPlot/MacroConverter.cc
@@ -22,17 +22,28 @@ DefaultMacroConverter defaultConverterInstance("Default");
 ReadMacroConverter readConverterInstance("READ");
 
 // Family converter
-FamilyMacroConverter familyConverterInstance("FAMILY");
-CurveFamilyMacroConverter curvefamilyConverterInstance("CURVES_FAMILY");
-FamilyMacroConverter divrotfamilyConverterInstance("DIVROT_FAMILY");
-FamilyMacroConverter vectorsfamilyConverterInstance("VECTORS_FAMILY");
-FamilyMacroConverter spectrafamilyConverterInstance("SPECTRA_FAMILY");
-FamilyMacroConverter pottfamilyConverterInstance("POTT_FAMILY");
-FamilyMacroConverter velstrfamilyConverterInstance("VELSTR_FAMILY");
-FamilyMacroConverter tephigramfamilyConverterInstance("TEPHIGRAM_FAMILY");
-FamilyMacroConverter tephidatafamilyConverterInstance("TEPHIDATA_FAMILY");
-FamilyMacroConverter odbManagerFamilyConverterInstance("ODBVISUALISER_FAMILY");
-FamilyMacroConverter netcdfManagerFamilyConverterInstance("NETCDFPLUS_FAMILY");
+FamilyMacroConverter familyFMC    ("FAMILY");
+FamilyMacroConverter divrotFMC    ("DIVROT_FAMILY");
+FamilyMacroConverter vectorsFMC   ("VECTORS_FAMILY");
+FamilyMacroConverter spectraFMC   ("SPECTRA_FAMILY");
+FamilyMacroConverter pottFMC      ("POTT_FAMILY");
+FamilyMacroConverter velstrFMC    ("VELSTR_FAMILY");
+FamilyMacroConverter tephigramFMC ("TEPHIGRAM_FAMILY");
+FamilyMacroConverter tephidataFMC ("TEPHIDATA_FAMILY");
+FamilyMacroConverter odbFMC       ("ODBVISUALISER_FAMILY");
+FamilyMacroConverter netcdfFMC    ("NETCDFPLUS_FAMILY");
+
+// Hovmoeller application uses the Family converter
+FamilyMacroConverter lineHFMC     ("LINE_HOVM");
+FamilyMacroConverter areaHFMC     ("AREA_HOVM");
+FamilyMacroConverter verticalHFMC ("VERTICAL_HOVM");
+FamilyMacroConverter expandHFMC   ("EXPAND_HOVM");
+
+// Thermo dynamics application uses the Family converter
+FamilyMacroConverter gribThermo ("GRIB_THERMO");
+FamilyMacroConverter bufrThermo ("BUFR_THERMO");
+
+CurveFamilyMacroConverter curveMC("CURVES_FAMILY");
 
 // Simple Formula Family converter
 FormulaFamilyMacroConverter simpleformulafamilyConverterInstance("SIMPLE_FORMULA_FAMILY");
@@ -65,9 +76,8 @@ ConverterTraits::DefaultObject()
 /////////////// DefaultMacroConverter ///////////////
 Cached DefaultMacroConverter::Convert(MvRequest &req,ObjectInfo *oi )
 {
-  // Convert the request and return the object name.
+  // Convert the request and return the object name
   Cached duName = ObjectInfo::GenerateName(req);
-
   Cached macroName = ObjectList::MacroName(req.getVerb());
 
   oi->ConvertRequestToMacro ( req, PUT_END,duName,macroName );
@@ -84,26 +94,35 @@ Cached ReadMacroConverter::Convert(MvRequest &req,ObjectInfo *oi )
 
 Cached FamilyMacroConverter::Convert(MvRequest &req,ObjectInfo *oi )
 {
-	Cached returnName;
-	MvRequest tmpReq = req;
+   Cached returnName;
+   MvRequest tmpReq = req;
 
-	const char *name = tmpReq("_NAME");
-	Cached duName = ObjectInfo::GenerateName(req);
+   const char *name = tmpReq("_NAME");
+   Cached duName = ObjectInfo::GenerateName(req);
 
-	// First request contains just the family part, so skip it
-	tmpReq.advance();
+   // Usually, first request contains just the family part.
+   // If this is the case then skip it
+   string sverb = (const char*)tmpReq.getVerb();
+   if ( sverb.empty() )
+   {
+      oi->PutNewLine("# ERROR: Could not convert the Family icon");
+      returnName = "error";
+   }
+   std::size_t found = sverb.find("_FAMILY");
+   if ( found != std::string::npos )
+      tmpReq.advance();
 
-	if ( name && ! (const char *)tmpReq("_NAME") )
-		tmpReq("_NAME") = name;
+   if ( name && ! (const char *)tmpReq("_NAME") )
+      tmpReq("_NAME") = name;
 
-	// Get the macroname to call and convert it to lowercase.
-	Cached familyType = ObjectList::MacroName(tmpReq.getVerb() );
+   // Get the macroname to call and convert it to lowercase.
+   Cached familyType = ObjectList::MacroName(tmpReq.getVerb() );
 
-	returnName = ObjectInfo::SpaceToUnderscore ( duName );
+   returnName = ObjectInfo::SpaceToUnderscore ( duName );
 
-	oi->ConvertRequestToMacro ( tmpReq, PUT_END, returnName,familyType);
+   oi->ConvertRequestToMacro ( tmpReq, PUT_END, returnName,familyType);
 
-	return returnName;
+   return returnName;
 }
 
 Cached FormulaFamilyMacroConverter::Convert(MvRequest &req,ObjectInfo *oi )
@@ -339,23 +358,32 @@ Cached ComputeMacroConverter::Convert(MvRequest & req,ObjectInfo *oi )
 }
 
 
-Cached DataMacroConverter::Convert(MvRequest &req,ObjectInfo *oi)
+Cached DataMacroConverter::Convert(MvRequest &req, ObjectInfo *oi)
 {
    // Obtain the object name
    Cached duName = ObjectInfo::GenerateName(req);
 
    // Obtain the fully qualified path to the object
-   const char* mvPath = req( "_NAME" );
+   string filename;
+   const char* mvPath = req("_PATH");
+   if ( mvPath )
+      filename = mvPath;
+   else
+   {
+      mvPath = req( "_NAME" );
+      if ( mvPath )
+         filename = MakeUserPath(mvPath);
+   }
+      
    if ( mvPath )
    {
       // Get the full path and check if it can be opened
-      Cached filename = MakeUserPath(mvPath);
-      if ( !FileCanBeOpened(filename,"r") )
-         filename = Cached("Please provide here an input filename");
+      if ( !FileCanBeOpened(filename.c_str(),"r") )
+         filename = "Please provide here an input filename";
 
       oi->PutNewLine ( "" );
       oi->PutNewLine ( Cached ( "# Importing ") + duName );
-      oi->PutNewLine ( duName + Cached("  = read  ( \"")  + filename  + Cached("\")") );
+      oi->PutNewLine ( duName + Cached("  = read  ( \"")  + filename.c_str()  + Cached("\")") );
    }
    else
       duName = "";
diff --git a/src/uPlot/MagPlusBatchService.cc b/src/uPlot/MagPlusBatchService.cc
index f5b88ae..47e9d68 100644
--- a/src/uPlot/MagPlusBatchService.cc
+++ b/src/uPlot/MagPlusBatchService.cc
@@ -8,6 +8,7 @@
  ***************************** LICENSE END *************************************/
 
 #include "MagPlusBatchService.h"
+#include "PlotMod.h"
 
 void
 MagPlusBatchService::CallMagPlus ( MvRequest& in )
@@ -17,7 +18,16 @@ MagPlusBatchService::CallMagPlus ( MvRequest& in )
 
     MvMagRequest request(in);
 
-	magplus_->execute(request);
+    try
+    {
+	    magplus_->execute(request);
+    }
+    catch (exception e)
+    {
+        std::string errorMsg("Could not produce plot: ");
+        errorMsg += e.what();
+        PlotMod::Instance().MetviewError (errorMsg, "Error");
+    }
 	//thread_.render(in,magplus_);
 
 	// the Magics log messages are not broadcast until the next log event - therefore, the
diff --git a/src/uPlot/MagicsTranslator.cc b/src/uPlot/MagicsTranslator.cc
index a54640f..47357ae 100644
--- a/src/uPlot/MagicsTranslator.cc
+++ b/src/uPlot/MagicsTranslator.cc
@@ -433,6 +433,12 @@ PageTranslator::Execute ( const MvRequest& viewRequest )
          magicsRequest( "SUBPAGE_UPPER_RIGHT_LONGITUDE")= (double)metviewRequest ( "AREA", 3 );
       }
 
+      // Magics sets SUBPAGE_MINIMAL_AREA to 0.1 degrees to avoid issues with zooming into infinitesimally
+      // small areas in ecCharts, but we don't need to be so cautious in Metview and at least one user
+      // has requested the ability to zoom into smaller areas, so we set this to 0.001.
+      magicsRequest( "SUBPAGE_MINIMAL_AREA" ) = 0.001;
+
+
       // Translate MAP to SUBPAGE_MAP parameters
       CopySomeParameters ( metviewRequest,magicsRequest,"MAP_","SUBPAGE_MAP_" );
    }
diff --git a/src/uPlot/MapView.cc b/src/uPlot/MapView.cc
index 52e03c8..49ee639 100644
--- a/src/uPlot/MapView.cc
+++ b/src/uPlot/MapView.cc
@@ -217,6 +217,7 @@ void MapView::DecodeDataUnit ( MvIcon& dataUnit )
     // retrieve the data offset and matching info
     // Pass this information to the page for matching
     int dimFlag = 0;
+    bool swap;
     while ( decoder->ReadNextData() )
     {
         long offset = decoder->CurrentOffset();
@@ -233,7 +234,7 @@ void MapView::DecodeDataUnit ( MvIcon& dataUnit )
                 MatchingInfo nextDataInfo = decoder->CreateMatchingInfo();
 
                 // Are they companions ?
-                if ( !matchingCriteria_.IsPair( dataInfo, nextDataInfo ) ||
+                if ( !matchingCriteria_.IsPair( dataInfo, nextDataInfo, swap ) ||
                     !matchingCriteria_.Match ( dataInfo, nextDataInfo ))
                 {
                     // No, so plot them separately
@@ -244,9 +245,18 @@ void MapView::DecodeDataUnit ( MvIcon& dataUnit )
                 }
                 else
                 {
-                    // Yes, so plot them together
+                    // Yes, so plot them together.
+                    // Insert dataunit using the correct order of the offsets
+                    // (i.e. u/v not v/u). This is a Magics requirement.
                     dimFlag = dimFlag | 2;
-                    if ( Owner().InsertDataUnit ( dataUnit.Id(), offset, nextDataOffset, dataInfo, subpageId) == false ) break;
+                    bool flag;
+                    if ( swap )
+                       flag = Owner().InsertDataUnit ( dataUnit.Id(), nextDataOffset, offset, dataInfo, subpageId );
+                    else
+                       flag = Owner().InsertDataUnit ( dataUnit.Id(), offset, nextDataOffset, dataInfo, subpageId );
+
+                    if ( flag == false )
+                       break;
                 }
             }
             else // An isolated field, who just happens to have a companion defined.
diff --git a/src/uPlot/MatchingCriteria.cc b/src/uPlot/MatchingCriteria.cc
index 2720c20..b6da0cc 100644
--- a/src/uPlot/MatchingCriteria.cc
+++ b/src/uPlot/MatchingCriteria.cc
@@ -64,17 +64,33 @@ MatchingCriteria::~MatchingCriteria ()
 }
 
 // Match
-// compare two matching informations
-//
+// Compare two matching informations.
+// In case the two input arguments are considered a pair, also checks if
+// they are given in the correct order, i.e., the first input argument is
+// expected to be the "first" companion (e.g. pair u/v the u is the first
+// companion)
 bool
-MatchingCriteria::IsPair(const MatchingInfo& lhs, const MatchingInfo& rhs) const
+MatchingCriteria::IsPair(const MatchingInfo& arg1, const MatchingInfo& arg2, bool& swap) const
 {
-	MvRequest lhsRequest = lhs.matchingRequest_;
-	MvRequest rhsRequest = rhs.matchingRequest_;
-	Cached companionExpected = lhsRequest( "MY_COMPANION" );
-	Cached         parameter = rhsRequest( "PARAM" );
-
-	return ( companionExpected == parameter );
+   MvRequest req1 = arg1.matchingRequest_;
+   MvRequest req2 = arg2.matchingRequest_;
+   string companionExpected = (const char*)req1( "MY_COMPANION" );
+   string         parameter = (const char*)req2( "PARAM" );
+
+   // The elements are companions
+   // Check if they are given in the correct order
+   if ( companionExpected == parameter )
+   {
+      if ( (const char*)req1("FIRST_COMPANION") &&
+           (int)req1("FIRST_COMPANION") == 1 )
+         swap =  false;
+      else
+         swap = true;
+
+      return true;
+   }
+
+   return false;
 }
 
 bool 
diff --git a/src/uPlot/MatchingCriteria.h b/src/uPlot/MatchingCriteria.h
index f47b340..9b7017f 100644
--- a/src/uPlot/MatchingCriteria.h
+++ b/src/uPlot/MatchingCriteria.h
@@ -56,14 +56,14 @@ class MatchingInfo;
 class MatchingCriteria {
 public:
 
-	MatchingCriteria ( const MvRequest& matchingRequest );
-	~MatchingCriteria();
+   MatchingCriteria ( const MvRequest& matchingRequest );
+   ~MatchingCriteria();
 
-	bool Match ( const MatchingInfo&, const MatchingInfo& ) const;
-	bool IsPair( const MatchingInfo&, const MatchingInfo& ) const;
+   bool Match ( const MatchingInfo&, const MatchingInfo& ) const;
+   bool IsPair( const MatchingInfo&, const MatchingInfo&, bool& ) const;
 
 private:
 
-	MvRequest  matchingRequest_;
+   MvRequest  matchingRequest_;
 };
 #endif
diff --git a/src/uPlot/MvGribDecoder.cc b/src/uPlot/MvGribDecoder.cc
index 468f6ff..f6c645b 100644
--- a/src/uPlot/MvGribDecoder.cc
+++ b/src/uPlot/MvGribDecoder.cc
@@ -101,30 +101,34 @@ GribDecoder::CreateMatchingInfo ()
 	// we will later need to decide whether to apply automatic scaling or not
 	//ir matchingRequest("DERIVED") = metadataRequest_("DERIVED");
 
-	// Is it an image field?
-	const char* repres = metadataRequest_("REPRES");
-	if ( ObjectList::IsImage( repres ) ) 
-		matchingRequest( "DATA_TYPE" ) = "IMAGE";
-	else
-	{
-		// Get parameter name
-		char acc0[64];
-		size_t nsize;
-		field* ff = currentField_.libmars_field();
-		grib_get_string( ff->handle, "shortName", acc0, &nsize );
-		matchingRequest ( "PARAM" ) = acc0;
-		matchingRequest( "DATA_TYPE" ) = "GRIB";
-
-		// Has this parameter a companion?
-        string pair,mode;
-		ObjectList::GetCompanion( string(acc0), pair, mode );
-		if ( pair != "no_pair" )
-        {
-			matchingRequest ( "MY_COMPANION" ) = pair.c_str();
-            if ( !mode.empty() )
-               matchingRequest ( "WIND_MODE" ) = mode.c_str();
-        }
-	}
-
-	return MatchingInfo( matchingRequest );
+   // Is it an image field?
+   const char* repres = metadataRequest_("REPRES");
+   if ( ObjectList::IsImage( repres ) ) 
+      matchingRequest( "DATA_TYPE" ) = "IMAGE";
+   else
+   {
+      // Get parameter name
+      const size_t cMaxBuf = 99;
+      char acc0[cMaxBuf+1];
+      size_t nsize = cMaxBuf;
+
+      field* ff = currentField_.libmars_field();
+      grib_get_string( ff->handle, "shortName", acc0, &nsize );
+      matchingRequest ( "PARAM" ) = acc0;
+      matchingRequest( "DATA_TYPE" ) = "GRIB";
+
+      // Has this parameter a companion?
+      string pair,mode;
+      bool first_companion;
+      ObjectList::GetCompanion( string(acc0), pair, mode, first_companion );
+      if ( pair != "no_pair" )
+      {
+         matchingRequest ( "MY_COMPANION" ) = pair.c_str();
+         matchingRequest ( "FIRST_COMPANION" ) = first_companion;
+         if ( !mode.empty() )
+            matchingRequest ( "WIND_MODE" ) = mode.c_str();
+      }
+   }
+
+   return MatchingInfo( matchingRequest );
 }
diff --git a/src/uPlot/MvIconDataBase.cc b/src/uPlot/MvIconDataBase.cc
index e25b0de..6dcc214 100644
--- a/src/uPlot/MvIconDataBase.cc
+++ b/src/uPlot/MvIconDataBase.cc
@@ -1197,37 +1197,53 @@ bool MvIconDataBase::ExistsInRelation ( MvRelation &relation, const int firstId,
 
 void MvIconDataBase::CreateLink (MvRequest& req)
 {
-    // If there is no path, do no create a link
-    const char* mpath = (const char*)(req("PATH"));
-    if ( mpath == 0) return;
+   // If there is no path, do no create a link
+   const char* mpath = (const char*)(req("PATH"));
+   if ( mpath == 0)
+      return;
 
-    // Check if the link has to be created
-    const char* createLink = (const char*)req("_CREATE_LINK");
-    if ( createLink && strcmp(createLink,"NO") == 0 )
-        return;
+   // Check if the link has to be created
+   const char* createLink = (const char*)req("_CREATE_LINK");
+   if ( createLink && strcmp(createLink,"NO") == 0 )
+      return;
 
-    string spath = (const char*)mpath;
-    string slink = tempnam(getenv("METVIEW_TMPDIR"),"link");
+   string spath = (const char*)mpath;
+   string slink = tempnam(getenv("METVIEW_TMPDIR"),"link");
 
-    if ( symlink(spath.c_str(),slink.c_str()) != 0 ) //-- create a soft link
-    {
-        marslog(LOG_WARN,(char*)"MvIconDataBase::CreateLink: unable to create a link");
+   if ( symlink(spath.c_str(),slink.c_str()) != 0 ) //-- create a soft link
+   {
+      marslog(LOG_WARN,(char*)"MvIconDataBase::CreateLink: unable to create a link");
 
-        return; //-- nothing to do => bail out!
-    }
+      return; //-- nothing to do => bail out!
+   }
 
-    //-- make sure that soft link is not a dangling ptr!
-    if( !FileCanBeOpened( slink.c_str(), "r" ) )
-    {
-        marslog(LOG_WARN,(char*)"Created soft link is dangling: %s", slink.c_str());
+   //-- make sure that soft link is not a dangling ptr!
+   bool flag = true;
+   if( !FileCanBeOpened( slink.c_str(), "r" ) )
+   {
+      // Try to use parameter _PATH
+      if ( (const char*)req("_PATH") )
+      {
+         remove(slink.c_str());
+         spath = (const char*)req("_PATH");
+         symlink(spath.c_str(),slink.c_str());
+         if ( !FileCanBeOpened( slink.c_str(), "r" ) )
+            flag = false;
+      }
+      else
+        flag = false;
+   }
+   if ( !flag )
+   {
+      marslog(LOG_WARN,(char*)"Created soft link is dangling: %s", slink.c_str());
 
-        return; //-- nothing to do => bail out!
-    }
+      return; //-- nothing to do => bail out!
+   }
 
-    req("PATH") = slink.c_str();
-    linkList_.push_back(slink.c_str());
+   req("PATH") = slink.c_str();
+   linkList_.push_back(slink.c_str());
 
-    return;
+   return;
 }
 
 void MvIconDataBase::DeleteLink ()
diff --git a/src/uPlot/MvMain.cc b/src/uPlot/MvMain.cc
index 798c152..15ff397 100644
--- a/src/uPlot/MvMain.cc
+++ b/src/uPlot/MvMain.cc
@@ -11,6 +11,7 @@
 #include "MvRequest.h"
 #include "Root.h"
 #include "MvDebugPrintControl.h"
+#include "MvScanFileType.h"
 #include "PlotModInteractive.h"
 #include "uPlotApp.h"
 #include "MagPlusInteractiveService.h"
@@ -19,33 +20,79 @@
 
 using namespace std;
 
-bool SetUplotEnv (int argc, char **argv, MvRequest &req, bool &reqExists)
-{
-	// Create Root instance
-	Root::Create();
-
-	// Initialize Mars communication
-	marsinit(&argc,argv,0,0,0);
-	mvSetMarslogLevel();
-
-	// Read the input request, if available
-	reqExists = false;
-	if (argc > 1)
-	{
-		//Check if the input request exists
-		if ( access(argv[1],F_OK) == 0 )
-		{
-			//Read the initial input request saved by uPlotManager
-			req.read(argv[1]);
-			req.print();
+const string PLOT_STAND_ALONE = "plotSA";
 
-			// Skip UPLOT_MANAGER request
-			if ( strcmp(req.getVerb(),"UPLOT_MANAGER") == 0)
-				req.advance();
-
-			reqExists = true;
-		}
-	}
+bool SetUplotEnv (int argc, char **argv, string& mode, MvRequest &req, bool &reqExists, string& errorMessage)
+{
+   // Create Root instance
+   Root::Create();
+
+   // Initialize Mars communication
+   marsinit(&argc,argv,0,0,0);
+   mvSetMarslogLevel();
+
+   // Check if the input filename exists.
+   // If the filename does not exist then uPlot is running in the
+   // INTERACTIVE mode and should continue running.
+   // If uPlot is running STANDALONE mode then the filename does exist
+   // because this is checked in the Metview initialisation script.
+   reqExists = false;
+   if (argc <= 1 || access(argv[1],F_OK) != 0 )
+      return true;
+
+   // Read the input file or request
+   if ( mode == PLOT_STAND_ALONE )
+   {
+      // uPlot is running stand alone.
+      // First, find out the type of the input filename
+      const char* filename = (const char*)argv[1];
+      string stype = ScanFileType(filename);
+      if ( stype == string("BAD") )
+      {
+         errorMessage = "<<< METVIEW ERROR >>>\n\n\nInput file type not recognised!\n\nFilename: ";
+         errorMessage += string(filename) + "\n\nFile type: ";
+         errorMessage += stype + "\n";
+         return false;
+      }
+
+      // Only file types GRIB/BUFR/GEOPOINTS can be directly visualised
+      if ( stype == "GRIB" || stype == "BUFR" || stype == "GEOPOINTS" )
+      {
+         // Build a request
+         req.setVerb( stype.c_str() );
+         req.setValue( "PATH", filename );
+         req.setValue( "_NAME",filename );
+         req.setValue( "_CLASS",stype.c_str() );
+         req.setValue( "_PATH",filename );
+
+         // Use contour ecChart convention
+         if ( stype == "GRIB" )
+         {
+            MvRequest req1("MCONT");
+            req1("CONTOUR_AUTOMATIC_SETTING") = "ECCHART";
+
+            req = req + req1;
+         }
+      }
+      else
+      {
+         errorMessage = "<<< METVIEW ERROR >>>\n\n\nOnly file types GRIB/BUFR/GEOPOINTS can be directly visualised!\n\nFilename: ";
+         errorMessage += string(filename) + "\n\nFile type: ";
+         errorMessage += stype + "\n";
+         return false;
+      }
+   }
+   else
+   {
+      //Read the initial input request saved by uPlotManager
+      req.read(argv[1]);
+
+      // Skip UPLOT_MANAGER request
+      if ( strcmp(req.getVerb(),"UPLOT_MANAGER") == 0)
+         req.advance();
+   }
+
+   reqExists = true;
 
 //DOES IT NEED TO TEST FOR INTERACTIVE MODE?????
 // CHECK THIS CODE LATER WHEN THE EXPORT BUTTON IS ACTIVATED
@@ -75,75 +122,91 @@ bool SetUplotEnv (int argc, char **argv, MvRequest &req, bool &reqExists)
 
 	return PlotMod::Instance().IsWindow();
 #endif
-	return true;
+
+   return true;
 }
 
-string GetProcessName ()
+string GetProcessName (string& mode)
 {
-	// Build a process name according to the process id
-	char name[64];
-	sprintf(name,"uPlot%ld",(long int)getpid());
-
-	return string(name);
+   // Build process name: a) stand alone plotting or
+   // b) according to the process id
+   string name;
+   if ( mode == PLOT_STAND_ALONE )
+      name = "uPlot";
+   else
+   {
+      char cname[64];
+      sprintf(cname,"uPlot%ld",(long int)getpid());
+      name = string(cname);
+   }
+
+   return name;
 }
 
 int main(int argc, char **argv)
 {
-	// Get process name
-	string name = GetProcessName();
-
-	MvRequest req;
-	bool reqExists;
-
-	// Setup uPlot environment
-	if ( SetUplotEnv(argc,argv,req,reqExists) )
-	{
-		//Initialise resorces from a static library (libMvQtGui)
-		Q_INIT_RESOURCE(window);
-		Q_INIT_RESOURCE(keyDialog);
-
-		// Start uPlot interactively with Qt facilities
-		uPlotApp app(argc, argv, name.c_str());
-		MagPlusInteractiveService* magplus = new MagPlusInteractiveService();
-		MagPlusService::Instance(magplus);
-				
-		PlotModInteractive* pm = new PlotModInteractive();
-		PlotMod::Instance(pm);
-
-		// Instantiate uPlot Display Window
-		uPlotBase *pw = new uPlot;
-		magplus->setPlotApplication(pw);
-		SuperPage::setPlotApplication(pw);		
-		pm->setPlotApplication(pw);
-		
-		//PlotModInteractive* pm = new PlotModInteractive();
-		//PlotMod::Instance(pm);
-
-		// Instantiate uPlot Display Window
-		//uPlot *pw = new uPlot;
-
-		// Initialize plotting dimension
-		double x = 29.7;
-		double y = 21.;
-		pw->setPlotWidgetSize(x,y);
-
-		// Enable Drag and Drop
-		pw->EnableDropAction(name);
-
-		// Call myself to execute the initial request
-		// It needs to be execute after uPlot window has been created
-		if(reqExists)
-			MvApplication::callService ( name.c_str(),req,0 );
-
-		// Show uPlot
-		pw->show();
-		
-		return app.exec();
-	}
+   // Retrieve the processing mode
+   string metviewMode = (const char*)getenv("METVIEW_MODE");
+   string name = GetProcessName(metviewMode);
+
+   MvRequest req;
+   bool reqExists;
+
+   // Setup uPlot environment
+   string errorMessage;
+   bool ok = SetUplotEnv(argc,argv,metviewMode,req,reqExists,errorMessage);
+
+   //Initialise resorces from a static library (libMvQtGui)
+   Q_INIT_RESOURCE(window);
+   Q_INIT_RESOURCE(keyDialog);
+
+   // Start uPlot interactively with Qt facilities
+   uPlotApp app(argc, argv, name.c_str());
+   MagPlusInteractiveService* magplus = new MagPlusInteractiveService();
+   MagPlusService::Instance(magplus);
+
+   PlotModInteractive* pm = new PlotModInteractive();
+   PlotMod::Instance(pm);
+
+   // If function SetUplotEnv returned an error then send an error
+   // message and abort uPlot.
+   // This test is performed here because class PlotMod needs to be 
+   // intantiated before function errorMessage can be used. This error
+   // message is issued when uPlot is running in the standalone mode and
+   // there is a problem in the input filename. In this case, function 
+   // errorMessage must be called, instead of "exit(0)" for instance, 
+   // because Event needs also to be terminated.
+   if ( !ok )
+      PlotMod::Instance().errorMessage(errorMessage.c_str());
+
+   // Instantiate uPlot Display Window
+   uPlotBase *pw = new uPlot;
+   magplus->setPlotApplication(pw);
+   SuperPage::setPlotApplication(pw);		
+   pm->setPlotApplication(pw);
+
+   // Initialize plotting dimension
+   double x = 29.7;
+   double y = 21.;
+   pw->setPlotWidgetSize(x,y);
+
+   // Enable Drag and Drop
+   pw->EnableDropAction(name);
+
+   // Call myself to execute the initial request
+   // It needs to be execute after uPlot window has been created
+   if(reqExists)
+      MvApplication::callService ( name.c_str(),req,0 );
+
+   // Show uPlot
+   pw->show();
+
+   return app.exec();
 
 //DOES IT NEED TO TEST FOR INTERACTIVE MODE?????
 // CHECK THIS CODE LATER WHEN THE EXPORT BUTTON IS ACTIVATED
 
+#if 0
 	else
 	{
 		// Start uPlot without a window (eg. batch mode or interactive mode
@@ -156,6 +219,7 @@ int main(int argc, char **argv)
 
 //		app.run();
 	}
+#endif
 
- 	Root::ServerDead(0,0);
+   Root::ServerDead(0,0);
 }
diff --git a/src/uPlot/MvQLayerContentsIcon.cc b/src/uPlot/MvQLayerContentsIcon.cc
index 94a47b1..b853f88 100644
--- a/src/uPlot/MvQLayerContentsIcon.cc
+++ b/src/uPlot/MvQLayerContentsIcon.cc
@@ -97,7 +97,7 @@ void  MvQLayerContentsIcon::startEditor()
 	//MvRequest iconRequest = icon_.Request();
 
 	MvRequest req;
-	req.read(MakeUserPath(path_.toStdString().c_str()));
+	req.read(MakeUserPath(path_.toStdString().c_str()).c_str());
 
 	//cout << "ContentsItem::Edit " << endl;
 	req.print();
diff --git a/src/uPlot/ObjectInfo.cc b/src/uPlot/ObjectInfo.cc
index 73e8caf..a0101bd 100644
--- a/src/uPlot/ObjectInfo.cc
+++ b/src/uPlot/ObjectInfo.cc
@@ -92,8 +92,8 @@ ObjectInfo::ConvertRequestToMacro( MvRequest& inRequest,
 			// Can we follow subRequest also ?
 			if ( (const char *)subRequest("_NAME") )
 			{
-				Cached fullName = MakeUserPath(subRequest("_NAME") );
-				if ( FileCanBeOpened(fullName,"r") )
+				string fullName = MakeUserPath((const char*)subRequest("_NAME") );
+				if ( FileCanBeOpened(fullName.c_str(),"r") )
 				{
 					Cached returnName = Convert(subRequest);
 					if ( strcmp(returnName,"") )
@@ -120,22 +120,22 @@ ObjectInfo::ConvertRequestToMacro( MvRequest& inRequest,
 		{
 			// Try to find out if this is a file reference.
 			// We need to get the full path
-			Cached tmpName = value;
+			string tmpName = value;
 			if ( IsParameterSet(inRequest,"_NAME") )
-				tmpName = dirname(inRequest("_NAME")) + Cached("/") + value;
+				tmpName = string(dirname(inRequest("_NAME"))) + "/" + value;
 
-			Cached refName =  MakeUserPath(tmpName);
-			if ( access( refName, R_OK )  == 0 )
+			string refName = MakeUserPath(tmpName);
+			if ( access( refName.c_str(), R_OK )  == 0 )
 			{
 				// If it is a DATA (binary) file, creates a dummy request.
 				// The crucial information needed is parameter _NAME
-				if ( ! IsBinaryOrMissingFile( refName ) )
-					subRequest.read  ( (const char*) refName);
+				if ( ! IsBinaryOrMissingFile(refName.c_str()) )
+					subRequest.read(refName.c_str());
 				else
 					subRequest.setVerb("DATA");
 
 				if ( ! IsParameterSet(subRequest,"_NAME") )
-				subRequest("_NAME") = tmpName;
+				subRequest("_NAME") = tmpName.c_str();
 
 				Cached returnName = Convert(subRequest);
 				if ( strcmp(returnName,"") )
@@ -155,10 +155,10 @@ ObjectInfo::ConvertRequestToMacro( MvRequest& inRequest,
 		// Convert macroName to lower case.
 		char *macrolower = new char[ strlen(macroName) + 1];
 		strcpy(macrolower,macroName);
-
 		for (i = 0; i < (int)strlen(macrolower); i++ )
-		macrolower[i] = tolower(macrolower[i]);
+         macrolower[i] = tolower(macrolower[i]);
 
+      PutNewLine("");
 		PutNewLine( ObjectInfo::SpaceToUnderscore(varName) + Cached(" = ") +  Cached(macrolower) + Cached("(") );
 
 		delete [] macrolower;
@@ -260,13 +260,17 @@ ObjectInfo::ConvertDataUnitToMacro ( MvIcon& dataUnit )
       }
    }
 
-  int use_mode = duRequest("_USE_MODE");
-
-  if ( ! use_mode )
-    objectName = Convert(duRequest);
-
-  else
-    {
+   int use_mode = duRequest("_USE_MODE");
+   if ( ! use_mode )
+   {
+      MvRequest reqAux = duRequest.getSubrequest("_ORIGINAL_REQUEST");
+      if ( reqAux && (const char*)reqAux("_MACRO_DECODE_TAG") )
+         objectName = Convert(reqAux);
+      else
+         objectName = Convert(duRequest);
+   }
+   else
+   {
       MvRequest modeRequest = duRequest.getSubrequest("_MODE");
       if ( (const char *) duRequest("_NAME") )
          modeRequest("_NAME") = duRequest("_NAME");
@@ -275,10 +279,10 @@ ObjectInfo::ConvertDataUnitToMacro ( MvIcon& dataUnit )
       if ( (const char *) duRequest("_APPL") )
          modeRequest("_APPL") = duRequest("_APPL");
 
-      MvIcon tmpIcon(modeRequest);
       // Call itself with the mode request.
+      MvIcon tmpIcon(modeRequest);
       objectName = ConvertDataUnitToMacro(tmpIcon);
-    }
+   }
 
    return objectName;
 }
@@ -366,9 +370,6 @@ ObjectInfo::ObjectPath ( const MvRequest& request )
   Cached path;
 
   const char* mPath = request( "_PATH" );
-//  if ( ! mPath )
-//    mPath = request( "_PATH" );
-
   if ( mPath )
     //              Path contains file name, it shouldn't but .....
     //              If it's been corrected, use following commented line
@@ -389,7 +390,7 @@ ObjectInfo::ObjectPath ( const MvRequest& request )
     {
       // Obtain the fully qualified path to the object
       const char* mvPath = request ( "_NAME" );
-      path               = MakeUserPath ( dirname ( mvPath  ) );
+      path = MakeUserPath( dirname(mvPath) ).c_str();
     }
 
   // Try to open a directory - if failed, set the path to METVIEW_USER_DIR
@@ -515,36 +516,13 @@ ObjectInfo::CalledFromMacro ( const MvRequest& request )
 //
 // -- PURPOSE:  Indicate the icon Class
 //
-// -- INPUT  :  a fully-qualified path 
-//              the name of the icon
+// -- INPUT  :  Request
 //
 // -- OUTPUT :  The class of the icon
 //
-// -- NOTES  :  This method uses the "hidden" user interface
-//              requestes, which are also used by MetvuewUI
-//              to identify the objects
 Cached
 ObjectInfo::IconClass ( const MvRequest &req )
 {
-    Cached path = ObjectPath(req);
-    Cached iconName = ObjectName(req);
-
-    // Create a path to a hidden file (MetviewUI)
-    Cached hiddenFileName = path + Cached("/.") + iconName;
-
-    // If the file exists, read it (MetviewUI)
-    if ( FileCanBeOpened ( hiddenFileName, "r" )  == true )
-    {
-        MvRequest uiRequest;
-        uiRequest.read  ( (const char*) hiddenFileName );
-
-        // Obtain the value of the icon class
-        Cached iconClass;
-        uiRequest.getValue ( iconClass, "ICON_CLASS", 0 );
-
-        return iconClass;
-    }
-
     // Get info from parameter _CLASS (Desktop)
     if ( (const char*)req("_CLASS") )
         return (const char*)req("_CLASS");
@@ -656,46 +634,52 @@ ObjectInfo::CheckVisDefClass (const MvRequest& req1, const MvRequest& req2)
 Cached
 ObjectInfo::Convert(MvRequest &req)
 {
-  int first = 0;
-  Cached returnName, oneReqName;
+   int first = 0;
+   Cached returnName, oneReqName;
 
-  while ( req )
-    {
+   while ( req )
+   {
       Cached iconClass = ObjectInfo::IconClass ( req );
       MacroConverter & converter = MacroConverter::Find(iconClass );
 
-      Cached fileName = ObjectInfo::ObjectPath(req) + Cached("/") + 
-	ObjectInfo::ObjectName(req);
+      string objName  = (const char*)ObjectInfo::ObjectName(req);
+      string fileName = (const char*)ObjectInfo::ObjectPath(req);
+      fileName += (fileName[fileName.size()-1] == '/') ? objName :  "/" + objName;
+
       oneReqName = "";
-      if ( ! IsBinaryOrMissingFile( fileName ) )
-	{
-	  MvRequest fileReq;
-	  fileReq.read(fileName);
+      if ( ! IsBinaryOrMissingFile( fileName.c_str() ) )
+      {
+         MvRequest fileReq;
+         fileReq.read(fileName.c_str(),true);
 
-	  // Just in case further expansion is needed.
-	  fileReq("_NAME") = req("_NAME");
-	  oneReqName = converter.Convert(fileReq, this);
-	}
+         // Just in case further expansion is needed
+         if ( !(const char*)fileReq("_PATH") && (const char*)req("_PATH") )
+            fileReq("_PATH") = req("_PATH");
+         if ( !(const char*)fileReq("_NAME") && (const char*)req("_NAME") )
+            fileReq("_NAME") = req("_NAME");
+
+         oneReqName = converter.Convert(fileReq, this);
+      }
 
       if ( oneReqName == Cached("") )
-	oneReqName = converter.Convert(req, this);
+         oneReqName = converter.Convert(req, this);
 
       if ( first == 1 )
-	returnName = Cached("[") + returnName;
+         returnName = Cached("[") + returnName;
 
       if ( first > 0 )
-	returnName = returnName + Cached(", ");
+         returnName = returnName + Cached(", ");
 
       returnName = returnName + oneReqName;
       first++;
 
       req.advance();
-    }
+   }
 
-  if ( first > 1 )
-	returnName = returnName + Cached("] ");
+   if ( first > 1 )
+      returnName = returnName + Cached("] ");
 
-  return returnName;
+   return returnName;
 }
 
 void ObjectInfo::FormatLine(const Cached &param, const Cached &val, const Cached &comma, int width)
diff --git a/src/uPlot/ObjectList.cc b/src/uPlot/ObjectList.cc
index fe6baee..599df7b 100644
--- a/src/uPlot/ObjectList.cc
+++ b/src/uPlot/ObjectList.cc
@@ -798,31 +798,45 @@ ObjectList::CalledFromMacro ( const MvRequest& request )
 // -- PURPOSE:  Return the expected parameter to make a pair in a vector field.
 //              ex. U/V, D/T... and the correspondent wind mode
 //
-// -- INPUT  :  A parameter (the first in the pair)
+// -- INPUT  :  param: parameter name
 //
-// -- OUTPUT :  The second parameter of the pair and the related wind mode plotting
-//              or "no_pair" for scalar data 
-//
-void ObjectList::GetCompanion ( const string& param, string& pair, string& mode )
+// -- OUTPUT :  pair : pair name ("no_pair" for scalar data)
+//              mode : wind mode plotting
+//              first: true - if there is a companion and the input parameter 
+//                            is the primarely/first element, i.e. it is not 
+//                            the friend element
+void ObjectList::GetCompanion ( const string& param, string& pair, string& mode, bool& first )
 {
-	MvRequest& objectList = ObjectList::Instance();
+   MvRequest& objectList = ObjectList::Instance();
+   objectList.rewind();
 
-	objectList.rewind();
-	string comp("companion");
-	while ( objectList )
-	{
-		if ( objectList.getVerb() == comp  && (const char*)objectList("class") == param )
-        {
+   string comp("companion");
+   while ( objectList )
+   {
+      if ( objectList.getVerb() == comp )
+      {
+         if ( (const char*)objectList("class") == param )
+         {
             pair = (const char*)objectList( "friend" );
             mode = (const char*)objectList("mode") ? (const char*)objectList("mode") : "";
+            first = true;
             return;
-        }
-		objectList.advance();
-	}
+         }
+         else if ( (const char*)objectList("friend") == param )
+         {
+            pair = (const char*)objectList( "class" );
+            mode = (const char*)objectList("mode") ? (const char*)objectList("mode") : "";
+            first = false;
+            return;
+         }
+      }
+      objectList.advance();
+   }
 
-    pair = "no_pair";
-    mode = "";
-	return;
+   pair = "no_pair";
+   mode = "";
+   first= false;
+   return;
 }
 
 // Check if two variables are companions
diff --git a/src/uPlot/ObjectList.h b/src/uPlot/ObjectList.h
index 3029f15..0e413b8 100644
--- a/src/uPlot/ObjectList.h
+++ b/src/uPlot/ObjectList.h
@@ -116,7 +116,7 @@ public:
 
 
    static Cached MacroName ( const Cached& iconClass   );
-   static void GetCompanion ( const string&, string&, string& );
+   static void GetCompanion ( const string&, string&, string&, bool& );
 
 private:
 
diff --git a/src/uPlot/Presentable.cc b/src/uPlot/Presentable.cc
index 1e8e105..15bda70 100644
--- a/src/uPlot/Presentable.cc
+++ b/src/uPlot/Presentable.cc
@@ -1127,31 +1127,32 @@ Presentable::DescribeDrops ( ObjectInfo& myDescription, MacroVisDefMap& vdMap )
    while ( du != dataUnitList.end() )
    {
       MvIcon currentDataUnit = *du;
-      if ( (int)currentDataUnit.Request()("_SKIP_MACRO")  )
+      if ( !(int)currentDataUnit.Request()("_SKIP_MACRO")  )
       {
-         ++du;
-         continue;
-      }
-
-      int use_mode = currentDataUnit.Request()("_USE_MODE");
-
-      // Convert the data unit to macro
-      string dataUnitName = (const char*)myDescription.ConvertDataUnitToMacro ( currentDataUnit );
-      if ( dataUnitName.empty() )
-      {
-         ++du;
-         continue;
-      }
-
-      listDrops = listDrops + string(", ") + dataUnitName;
-
-      if ( use_mode )
-      {
-         ++du;
-         continue;
+         // Convert the data unit to macro
+         string dataUnitName = (const char*)myDescription.ConvertDataUnitToMacro ( currentDataUnit );
+         if ( dataUnitName.empty() )
+         {
+            ++du;
+            continue;
+         }
+
+         listDrops = listDrops + string(", ") + dataUnitName;
+
+         int use_mode = currentDataUnit.Request()("_USE_MODE");
+         if ( use_mode )
+         {
+            ++du;
+            continue;
+         }
       }
 
-      // Find all visdefs associated to the data unit
+      // Find all visdefs associated to the data unit even if it
+      // is tagged as _SKIP_MACRO. This is to cope with requests
+      // built by some applications, e.g., XSection:
+      // (netcdf_xy_matrix, mcont, netcdf_xy_points, mgraph).
+      // In this case, althought the netcdf_xy_points request has 
+      // a tag _SKIP_MACRO, the mgraph request must be processed.
       visdefList.erase(visdefList.begin(),visdefList.end() );
       dataBase.RetrieveVisDefList ( (*du) , visdefList );
       DescribeVisDefList(myDescription,visdefList,*du,listDrops,true,vdMap );
diff --git a/src/uPlot/ThermoView.cc b/src/uPlot/ThermoView.cc
index 4b93ac0..2a27de6 100644
--- a/src/uPlot/ThermoView.cc
+++ b/src/uPlot/ThermoView.cc
@@ -56,14 +56,14 @@ ThermoViewFactory::Build ( Page& page,
 ThermoView::ThermoView ( Page& owner,
                          const MvRequest& viewRequest,
                          const MvRequest& setupRequest ):
-                              CommonXSectView ( owner, viewRequest, setupRequest ),
-                              type_     ("TEPHIGRAM")
+               CommonXSectView ( owner, viewRequest, setupRequest ),
+               type_("TEPHIGRAM")
 {
    SetVariables(viewRequest,true);
 }
 
 ThermoView::ThermoView ( const ThermoView &old ) :
-                              CommonXSectView(old)
+               CommonXSectView(old)
 {
    type_ = old.type_;
 }
@@ -80,7 +80,7 @@ void ThermoView::DescribeYourself ( ObjectInfo& description )
 {
    // Convert my request to Macro
    set<Cached> skipSet;
-   description.ConvertRequestToMacro ( viewRequest_, PUT_END, MacroName().c_str(),"thermoview", skipSet);
+   description.ConvertRequestToMacro ( appViewReq_, PUT_END, MacroName().c_str(),"thermoview", skipSet);
    description.PutNewLine (" " );
 }
 
@@ -96,14 +96,16 @@ bool ThermoView::UpdateView ()
    if ( string(viewRequest_.getVerb()) == CARTESIANVIEW )
       return true;
 
-   // Translate common parameters
-   //GetCommonParameters ( req, cartView );
-
-   // Translate axes min/max values
+   // Create a Cartesian View request related to Tephigram
+   // Magics requires that the value for parameter map_projection be 
+   // in lower case
    MvRequest cartView("CARTESIANVIEW");
-   cartView("MAP_PROJECTION") = "tephigram";
+   string sdata = type_;
+   std::transform(sdata.begin(), sdata.end(), sdata.begin(), ::tolower);
+   cartView("MAP_PROJECTION") = sdata.c_str();
 
-   // Check where the axes min/max values should be taken from
+   // Translate axes min/max values
+   // Check where the values should be taken from
    if ( (const char*)viewRequest_("_DEFAULT") &&
         (int)viewRequest_("_DEFAULT") == 1 &&
         (const char*)viewRequest_("_DATAATTACHED") &&
@@ -117,16 +119,14 @@ bool ThermoView::UpdateView ()
    {
       cartView("X_AUTOMATIC") = "off";
       cartView("Y_AUTOMATIC") = "off";
+
+      // Get min/max axes coordinates
       cartView("X_MIN") = viewRequest_("MINIMUM_TEMPERATURE");
       cartView("X_MAX") = viewRequest_("MAXIMUM_TEMPERATURE");
       cartView("Y_MIN") = viewRequest_("BOTTOM_PRESSURE");
       cartView("Y_MAX") = viewRequest_("TOP_PRESSURE");
    }
 
-//ostringstream oss;
-//oss << "Thermo: Diagram type not implemented yet: " << type_;
-//PlotMod::Instance().MetviewError (oss.str().c_str(),"WARNING");
-
    // Copy ThermoGrid definition
    MvRequest reqGrid = viewRequest_.getSubrequest("THERMO_GRID");
    if ( reqGrid )
@@ -200,42 +200,23 @@ void ThermoView::UpdateView ( MvRequest& viewRequest )
    //Owner().InitZoomStacks();
 }
 
-void ThermoView::ApplicationInfo( const MvRequest& )
+void ThermoView::ApplicationInfo( const MvRequest& req)
 {
- #if 0
-  // If it is not a VIEW request, try to find a hidden VIEW in the request
+   // Get the VIEW request
    MvRequest viewReq;
    if ( ObjectList::IsView(req.getVerb()) )
       viewReq = req;
    else
    {
-      MvRequest aux = req.getSubrequest("NETCDF_DATA");
-      if ( (const char*)aux("_CARTESIANVIEW") )
-         viewReq = aux.getSubrequest("_CARTESIANVIEW");
-      else
+      // Try to find a hidden VIEW in the request
+      viewReq = req.getSubrequest("_VIEW_REQUEST");
+      if ( !viewReq )
       {
-         PlotMod::Instance().MetviewError ("Missing View Request in ThermoView::ApplicationInfo","WARNING");
+         // Nothing to be done
          return;
       }
    }
 
-   // Update the DATE_MIN/MAX parameters in the View if the original values
-   // were AUTOMATIC and the Thermo application provided new values
-   if ( bDateMin_ )
-   {
-      string str = (const char*)viewReq("X_DATE_MIN") ? "X_DATE_MIN" : "Y_DATE_MIN";
-      dateMin_ = (const char*)viewReq(str.c_str());
-      viewRequest_(str.c_str()) = dateMin_.c_str();
-      bDateMin_ = false;
-   }
-   if ( bDateMax_ )
-   {
-      string str = (const char*)viewReq("X_DATE_MAX") ? "X_DATE_MAX" : "Y_DATE_MAX";
-      dateMax_ = (const char*)viewReq(str.c_str());
-      viewRequest_(str.c_str()) = dateMax_.c_str();
-      bDateMax_ = false;
-   }
-#endif
    return;
 }
 
diff --git a/src/uPlot/VertProfView.cc b/src/uPlot/VertProfView.cc
index 1883b12..7a05704 100644
--- a/src/uPlot/VertProfView.cc
+++ b/src/uPlot/VertProfView.cc
@@ -21,14 +21,7 @@ VertProfViewFactory::Build ( Page& page,
                              const MvRequest& contextRequest,
                              const MvRequest& setupRequest )
 {
-   // Expand request
-   MvRequest expReq = ObjectList::ExpandRequest(contextRequest,EXPAND_DEFAULTS);
-
-   // Copy hidden parameters
-   expReq.mars_merge(contextRequest);
-
-   // Instantiate a VerticalProfile view
-   return new VertProfView ( page, expReq, setupRequest );
+   return new VertProfView ( page, contextRequest, setupRequest );
 }
 
 //--------------------------------------------------------
@@ -195,14 +188,14 @@ bool VertProfView::UpdateView ()
       return true;
    }
 
-    // Check where the axes min/max values should be taken from
-    bool axisAuto = false;
-    if ( (const char*)viewRequest_("_DEFAULT") &&
-         (int)viewRequest_("_DEFAULT") == 1 &&
-         (const char*)viewRequest_("_DATAATTACHED") &&
-         strcmp((const char*)viewRequest_("_DATAATTACHED"),"YES") == 0
-       )
-          axisAuto = true;
+   // Check where the axes min/max values should be taken from
+   bool axisAuto = false;
+   if ( (const char*)viewRequest_("_DEFAULT") &&
+        (int)viewRequest_("_DEFAULT") == 1 &&
+        (const char*)viewRequest_("_DATAATTACHED") &&
+        strcmp((const char*)viewRequest_("_DATAATTACHED"),"YES") == 0
+      )
+         axisAuto = true;
 
    // Translate X coordinates
    bool ierror = false;
@@ -214,18 +207,30 @@ bool VertProfView::UpdateView ()
    {
       cartView("X_AUTOMATIC") = "OFF";
       int nvals = viewRequest_.countValues("X_MIN_MAX");
-      if ( nvals != 2 )
+      if ( nvals != 0 && nvals != 2 )
          ierror = true;
       else
       {
-         // Read X values
-         string sx1 = (const char*)viewRequest_("X_MIN_MAX",0);
-         string sx2 = (const char*)viewRequest_("X_MIN_MAX",1);
+         string sx1,sx2;
+         if ( nvals == 0 )
+         {
+            sx1 = "AUTO";
+            sx2 = "AUTO";
+         }
+         else
+         {
+            // Read X values
+            sx1 = (const char*)viewRequest_("X_MIN_MAX",0);
+            sx2 = (const char*)viewRequest_("X_MIN_MAX",1);
+         }
+
          if ( sx1 == "AUTO" && sx2 == "AUTO" )
          {
             xValuesAuto_ = true;
-            if ( (const char*)viewRequest_("_DATAATTACHED") &&
-                 strcmp((const char*)viewRequest_("_DATAATTACHED"),"YES") == 0 )
+
+            // it seems that this is no longer needed
+            //if ( (const char*)viewRequest_("_DATAATTACHED") &&
+                 //strcmp((const char*)viewRequest_("_DATAATTACHED"),"YES") == 0 )
                      cartView("X_AUTOMATIC") = "ON";
          }
          else if ( sx1 == "AUTO" || sx2 == "AUTO" )
@@ -271,12 +276,7 @@ bool VertProfView::UpdateView ()
    CopySomeParameters( viewRequest_,cartView,"PAGE" );
    CopySomeParameters( viewRequest_,cartView,"SUBPAGE" );
 
-   // Copy the original request without certain parameteres (to avoid duplication)
-//    RemoveParameters( viewRequest_, "VALUE_AXIS" );
-//    RemoveParameters( viewRequest_, "LEVEL_AXIS" );
-   RemoveParameters( viewRequest_, "PAGE" );
-   RemoveParameters( viewRequest_, "SUBPAGE" );
-//    RemoveParameters( viewRequest_, "_" );
+   // Save the original request
    cartView("_ORIGINAL_REQUEST") = viewRequest_;
 
     // Update request
@@ -296,3 +296,17 @@ void VertProfView::ApplicationInfo ( const MvRequest& req )
    else if ( (const char*)req("_Y_AUTOMATIC_REVERSE") )
       yReverse_ = (const char*)req("_Y_AUTOMATIC_REVERSE");
 }
+
+bool VertProfView::ConsistencyCheck( MvRequest& req1, MvRequest& req2 )
+{
+   // Build a list of parameters to be checked
+   vector<string> params;
+   params.push_back("INPUT_MODE");
+   if ( (const char*)req1("POINT") )
+      params.push_back("POINT");
+   else
+      params.push_back("AREA");
+
+   // Call a function to perform the consistency check
+   return req1.checkParameters(req2,params);
+}
\ No newline at end of file
diff --git a/src/uPlot/VertProfView.h b/src/uPlot/VertProfView.h
index 4965055..c898f06 100644
--- a/src/uPlot/VertProfView.h
+++ b/src/uPlot/VertProfView.h
@@ -109,6 +109,9 @@ public:
     // Update the current view
     virtual bool UpdateView ();
 
+    // Check consistency between the View and Data Module
+    virtual bool ConsistencyCheck( MvRequest&, MvRequest& );
+
 private:
 
    // Save some data specific to some DataApplication
diff --git a/src/uPlot/XSectView.cc b/src/uPlot/XSectView.cc
index 8da4b6b..5b9a46f 100644
--- a/src/uPlot/XSectView.cc
+++ b/src/uPlot/XSectView.cc
@@ -27,14 +27,8 @@ XSectViewFactory::Build ( Page& page,
                           const MvRequest& contextRequest,
                           const MvRequest& setupRequest )
 {
-   // Expand request
-   MvRequest expReq = ObjectList::ExpandRequest(contextRequest,EXPAND_DEFAULTS);
-
-   // Copy hidden parameters
-   expReq.mars_merge(contextRequest);
-
    // Instantiate a Xsection view
-   return new XSectView ( page, expReq, setupRequest );
+   return new XSectView ( page, contextRequest, setupRequest );
 }
 
 //--------------------------------------------------------
@@ -241,3 +235,16 @@ void XSectView::ApplicationInfo ( const MvRequest& req )
    else if ( (const char*)req("_Y_AUTOMATIC_REVERSE") )
       yReverse_ = (const char*)req("_Y_AUTOMATIC_REVERSE");
 }
+
+bool XSectView::ConsistencyCheck( MvRequest& req1, MvRequest& req2 )
+{
+   // Build a list of parameters to be checked
+   vector<string> params;
+   params.push_back("LINE");
+   params.push_back("WIND_PARALLEL");
+   params.push_back("WIND_PERPENDICULAR");
+   params.push_back("WIND_INTENSITY");
+
+   // Call a function to perform the consistency check
+   return req1.checkParameters(req2,params);
+}
diff --git a/src/uPlot/XSectView.h b/src/uPlot/XSectView.h
index 20d998b..e371094 100644
--- a/src/uPlot/XSectView.h
+++ b/src/uPlot/XSectView.h
@@ -111,6 +111,10 @@ public:
     // Update view
     virtual bool UpdateView ();
 
+    // Check consistency between the View and Data Module
+    virtual bool ConsistencyCheck( MvRequest&, MvRequest& );
+
+
 private:
 
     // Save some data specific to some DataApplication
diff --git a/src/uPlot/uPlotBase.cc b/src/uPlot/uPlotBase.cc
index a7a6852..f4b0133 100644
--- a/src/uPlot/uPlotBase.cc
+++ b/src/uPlot/uPlotBase.cc
@@ -54,6 +54,11 @@
 #include <X11/Xatom.h>
 #endif
  
+#ifdef METVIEW_ODB_NEW
+    #include "odb_api/odbcapi.h"
+#endif
+
+ 
 #include "MagPlusService.h"
 #include "ObjectList.h"
 #include "Root.h"
@@ -1026,8 +1031,14 @@ void uPlotBase::slotShowAboutBox()
    	QMap<MvQAbout::Version,QString> text;
   	text[MvQAbout::MagicsVersion]=magicsVersion;	
 
+#if defined METVIEW_ODB
+   	const char *odbapi_version = odb_api_version();
+   	QString odbapiVersion(odbapi_version);
+  	text[MvQAbout::OdbApiVersion]=odbapiVersion;	
+#endif
+
    	MvQAbout about("uPlot","",
-		  MvQAbout::GribApiVersion | MvQAbout::MetviewVersion | MvQAbout::MagicsVersion,
+		  MvQAbout::GribApiVersion | MvQAbout::MetviewVersion | MvQAbout::MagicsVersion | MvQAbout::OdbApiVersion,
 		  text);
 		  
 	about.exec();	  
diff --git a/test/data/fc_data.grib b/test/data/fc_data.grib
new file mode 100644
index 0000000..5354bae
Binary files /dev/null and b/test/data/fc_data.grib differ
diff --git a/test/data/gpt_to_grib_exp_mean_reference.grb b/test/data/gpt_to_grib_exp_mean_reference.grb
new file mode 100644
index 0000000..b7967df
Binary files /dev/null and b/test/data/gpt_to_grib_exp_mean_reference.grb differ
diff --git a/test/data/gpt_to_grib_exp_sum_reference.grb b/test/data/gpt_to_grib_exp_sum_reference.grb
new file mode 100644
index 0000000..8e45d5a
Binary files /dev/null and b/test/data/gpt_to_grib_exp_sum_reference.grb differ
diff --git a/test/data/gpt_to_grib_nearest_count_reference.grb b/test/data/gpt_to_grib_nearest_count_reference.grb
new file mode 100644
index 0000000..fe54020
Binary files /dev/null and b/test/data/gpt_to_grib_nearest_count_reference.grb differ
diff --git a/test/data/gpt_to_grib_nearest_mean_reference.grb b/test/data/gpt_to_grib_nearest_mean_reference.grb
new file mode 100644
index 0000000..649d715
Binary files /dev/null and b/test/data/gpt_to_grib_nearest_mean_reference.grb differ
diff --git a/test/data/gpt_to_grib_nearest_sum_reference.grb b/test/data/gpt_to_grib_nearest_sum_reference.grb
new file mode 100644
index 0000000..2b8d368
Binary files /dev/null and b/test/data/gpt_to_grib_nearest_sum_reference.grb differ
diff --git a/test/data/gpt_to_grib_reciprocal_reference.grb b/test/data/gpt_to_grib_reciprocal_reference.grb
new file mode 100644
index 0000000..1a1e8e3
Binary files /dev/null and b/test/data/gpt_to_grib_reciprocal_reference.grb differ
diff --git a/test/data/hindcast.grib b/test/data/hindcast.grib
new file mode 100644
index 0000000..d6ac5a0
Binary files /dev/null and b/test/data/hindcast.grib differ
diff --git a/test/data/odb_test_set.odb b/test/data/odb_test_set.odb
new file mode 100644
index 0000000..dcf46e2
Binary files /dev/null and b/test/data/odb_test_set.odb differ
diff --git a/test/data/t1000_LL_7x7.grb b/test/data/t1000_LL_7x7.grb
new file mode 100644
index 0000000..bbda7ab
Binary files /dev/null and b/test/data/t1000_LL_7x7.grb differ
diff --git a/test/macros/CMakeLists.txt b/test/macros/CMakeLists.txt
index 98cd93e..9d6ac14 100644
--- a/test/macros/CMakeLists.txt
+++ b/test/macros/CMakeLists.txt
@@ -34,6 +34,11 @@ if(ENABLE_PLOTTING)
                        RESOURCES set_output.mv ../data/z500.grb)
 endif()
 
+
+metview_macro_test(MACRO     grib_dates.mv
+                   RESOURCES  ../data/fc_data.grib
+                              ../data/hindcast.grib)
+
 metview_macro_test(MACRO     grib_nearest_gridpoint.mv
                    RESOURCES  ../data/t1000_LL_1x1.grb
                               ../data/t1000_LL_1x1_subarea.grb
@@ -51,9 +56,22 @@ metview_macro_test(MACRO     interpolation_rgg_to_ll.mv
 metview_macro_test(MACRO     grib_to_gpt.mv
                    RESOURCES  ../data/t1000_LL_2x2.grb)
 
+metview_macro_test(MACRO     gpt_to_grib_core.mv
+                   RESOURCES  ../data/bufr_obs_filter_reference.gpt
+                              ../data/gpt_to_grib_reciprocal_reference.grb
+                              ../data/gpt_to_grib_exp_mean_reference.grb
+                              ../data/gpt_to_grib_exp_sum_reference.grb)
+
 metview_macro_test(MACRO     gpt_to_grib_with_template.mv
                    RESOURCES  ../data/t1000_LL_2x2.grb ../data/10U_GG.grb)
 
+metview_macro_test(MACRO     gpt_to_grib_nearest.mv
+                   RESOURCES  ../data/t1000_LL_7x7.grb
+                              ../data/example_XYLDTZ.geo
+                              ../data/gpt_to_grib_nearest_sum_reference.grb
+                              ../data/gpt_to_grib_nearest_mean_reference.grb
+                              ../data/gpt_to_grib_nearest_count_reference.grb)
+
 #metview_macro_test(MACRO     interpolation_gg_to_subarea.mv
 #                   RESOURCES  ../data/10U_GG.grb)
 
@@ -71,12 +89,23 @@ metview_macro_test(MACRO     inline_fortran.mv
 
 metview_macro_test(MACRO     station.mv)
 
+metview_macro_test(MACRO     vectors.mv)
+
+metview_macro_test(MACRO     lists.mv)
+
+metview_macro_test(MACRO     fieldsets.mv)
+
 if(ENABLE_MARS)
     metview_macro_test(MACRO      MarsAccess.mv
                        RESOURCES  ../data/10U_GG.grb )
 endif()
 
 
+if(METVIEW_ODB)
+    metview_macro_test(MACRO      odb_read.mv
+                       RESOURCES  ../data/odb_test_set.odb )
+endif()
+
 # generate a script which can be used to run the tests on the installed version
 set(METVIEW_COMMAND "${CMAKE_INSTALL_PREFIX}/bin/${METVIEW_SCRIPT}")
 set(TESTS_DIR       "${CMAKE_CURRENT_BINARY_DIR}")
diff --git a/test/macros/HelloWorld.mv b/test/macros/HelloWorld.mv
index 02e41d6..7602120 100644
--- a/test/macros/HelloWorld.mv
+++ b/test/macros/HelloWorld.mv
@@ -17,7 +17,8 @@ data = read("z500.grb")
 
 set_output("HelloWorld")
 
-plot(data)
+# we add an empty mcont() definition to bypass any custom defaults the user has
+plot(data, mcont())
 
 wait_for_output()
 check_if_expected_output_files_exist()
diff --git a/test/macros/fieldsets.mv b/test/macros/fieldsets.mv
new file mode 100644
index 0000000..645d0da
--- /dev/null
+++ b/test/macros/fieldsets.mv
@@ -0,0 +1,51 @@
+# Metview Macro
+
+# **************************** LICENSE START ***********************************
+#
+# Copyright 2016 ECMWF. This software is distributed under the terms
+# of the Apache License version 2.0. In applying this license, ECMWF does not
+# waive the privileges and immunities granted to it by virtue of its status as
+# an Intergovernmental Organization or submit itself to any jurisdiction.
+#
+# ***************************** LICENSE END ************************************
+
+# perform some basic operations on the 'fieldset' Macro data type
+
+a = read('hindcast.grib')
+steps = [0,6,24,36,48,72]
+
+assert(steps_equal(a, steps),                'all fields')
+assert(step_equal(a[1], 0),                  'first field')
+assert(step_equal(a[count(a)], 72),          'last field')
+assert(steps_equal(a[1,3],   [0,6,24]),      '2 indexes (1)')
+assert(steps_equal(a[3,6],   [24,36,48,72]), '2 indexes (2)')
+assert(steps_equal(a[2,6,2], [6,36,72]),     '3 indexes')
+
+i = |2, 3, 6, 2|
+assert(steps_equal(a[i], [6,24,72,6]),       'vector index (1)')
+i = |5|
+assert(step_equal(a[i], 48),                 'vector index (2)')
+
+# ---------------------------------------------------
+
+function step_equal(fs:fieldset, refstep:number)
+    s = grib_get_long(fs, 'step')
+    return (s = refstep)
+end steps_equal
+
+function steps_equal(fs:fieldset, refsteps:list)
+    s = grib_get_long(fs, 'step')
+    return equal(s, refsteps)
+end steps_equal
+
+
+function equal(l1: list, l2:list)
+    return (not 0 in (l1 = l2))
+end equal
+
+function assert(test:number, msg:string)
+    if (not(test)) then
+        fail(msg)
+    end if
+end assert
+
diff --git a/test/macros/gpt_to_grib_core.mv b/test/macros/gpt_to_grib_core.mv
new file mode 100644
index 0000000..9548681
--- /dev/null
+++ b/test/macros/gpt_to_grib_core.mv
@@ -0,0 +1,59 @@
+# Metview Macro
+
+# **************************** LICENSE START ***********************************
+#
+# Copyright 2016 ECMWF. This software is distributed under the terms
+# of the Apache License version 2.0. In applying this license, ECMWF does not
+# waive the privileges and immunities granted to it by virtue of its status as
+# an Intergovernmental Organization or submit itself to any jurisdiction.
+#
+# ***************************** LICENSE END ************************************
+
+
+# read the source geopoints
+gpt = read('bufr_obs_filter_reference.gpt')
+
+
+# test the 'core' gpt-grib modes
+check_gpt_to_grib(gpt, "reciprocal",       "gpt_to_grib_reciprocal_reference.grb")
+check_gpt_to_grib(gpt, "exponential_mean", "gpt_to_grib_exp_mean_reference.grb")
+check_gpt_to_grib(gpt, "exponential_sum",  "gpt_to_grib_exp_sum_reference.grb")
+
+
+function check_gpt_to_grib(gpt:geopoints, method:string, ref_result:string)
+
+    grib = geo_to_grib
+    (
+        interpolation_method : method,
+        grid                 : [1.8,1.8],
+        tolerance            : 1,
+        geopoints            : gpt
+    )
+
+    ref = read(ref_result)
+
+    compare_vectors("latitudes",  latitudes(ref),  latitudes(grib))
+    compare_vectors("longitudes", longitudes(ref), longitudes(grib))
+    compare_vectors("values",     values(ref),     values(grib))
+
+end check_gpt_to_grib
+
+
+
+
+# compare a pair of vectors (e.g. 'values') and fail if the difference is
+# a large enough proportion of the max value of the original data
+
+function compare_vectors(vname: string, v1:vector, v2:vector)
+
+    maxdiff  = maxvalue(abs(v1-v2))
+    maxdiff_as_proportion_of_max = maxdiff / maxvalue(abs(v1))
+    print(vname, ' maxdiff: ', maxdiff, ' prop: ', maxdiff_as_proportion_of_max)
+
+    if maxdiff > 0.001 then # more then 0.1 percent difference
+        msg = vname & " has proportional max difference of " & maxdiff_as_proportion_of_max
+        fail(msg)
+    end if
+
+end compare_vectors
+
diff --git a/test/macros/gpt_to_grib_nearest.mv b/test/macros/gpt_to_grib_nearest.mv
new file mode 100644
index 0000000..309352e
--- /dev/null
+++ b/test/macros/gpt_to_grib_nearest.mv
@@ -0,0 +1,74 @@
+# Metview Macro
+
+# **************************** LICENSE START ***********************************
+#
+# Copyright 2016 ECMWF. This software is distributed under the terms
+# of the Apache License version 2.0. In applying this license, ECMWF does not
+# waive the privileges and immunities granted to it by virtue of its status as
+# an Intergovernmental Organization or submit itself to any jurisdiction.
+#
+# ***************************** LICENSE END ************************************
+
+
+# read the source geopoints
+gpt = read('example_XYLDTZ.geo')
+
+
+# read the GRIB whose grid we will use as a template for the result
+template_grib = read('t1000_LL_7x7.grb')
+
+
+check_gpt_to_grib(gpt, template_grib, "nearest_gridpoint_sum",  "gpt_to_grib_nearest_sum_reference.grb")
+check_gpt_to_grib(gpt, template_grib, "nearest_gridpoint_mean", "gpt_to_grib_nearest_mean_reference.grb")
+
+
+gpt_c      = read('bufr_obs_filter_reference.gpt')
+template_c = read('gpt_to_grib_exp_mean_reference.grb')
+check_gpt_to_grib(gpt_c, template_c, "nearest_gridpoint_count", "gpt_to_grib_nearest_count_reference.grb")
+
+
+
+function check_gpt_to_grib(gpt:geopoints, template_grib:fieldset, method:string, ref_result:string)
+
+    print('Checking interpolation method ', method)
+
+    grib = geo_to_grib
+    (
+        interpolation_method : method,
+        geopoints            : gpt,
+        grid_definition_mode : "grib",
+        template_grib        : template_grib
+    )
+
+    # space-saving - bitmap out all the zero values
+    #grib = bitmap(grib, 0)
+    #write(ref_result, grib)
+
+
+    ref = read(ref_result)
+    ref = nobitmap(ref, 0)
+
+    compare_vectors("latitudes",  latitudes(ref),  latitudes(grib))
+    compare_vectors("longitudes", longitudes(ref), longitudes(grib))
+    compare_vectors("values",     values(ref),     values(grib))
+
+end check_gpt_to_grib
+
+
+
+# compare a pair of vectors (e.g. 'values') and fail if the difference is
+# a large enough proportion of the max value of the original data
+
+function compare_vectors(vname: string, v1:vector, v2:vector)
+
+    maxdiff  = maxvalue(abs(v1-v2))
+    maxdiff_as_proportion_of_max = maxdiff / maxvalue(abs(v1))
+    print(vname, ' maxdiff: ', maxdiff, ' prop: ', maxdiff_as_proportion_of_max)
+
+    if maxdiff > 0.001 then # more then 0.1 percent difference
+        msg = vname & " has proportional max difference of " & maxdiff_as_proportion_of_max
+        fail(msg)
+    end if
+
+end compare_vectors
+
diff --git a/test/macros/grib_dates.mv b/test/macros/grib_dates.mv
new file mode 100644
index 0000000..9282217
--- /dev/null
+++ b/test/macros/grib_dates.mv
@@ -0,0 +1,79 @@
+# Metview Macro
+
+# **************************** LICENSE START ***********************************
+#
+# Copyright 2016 ECMWF. This software is distributed under the terms
+# of the Apache License version 2.0. In applying this license, ECMWF does not
+# waive the privileges and immunities granted to it by virtue of its status as
+# an Intergovernmental Organization or submit itself to any jurisdiction.
+#
+# ***************************** LICENSE END ************************************
+
+
+# read the original data file
+data  = read('fc_data.grib')
+
+# these are what the results should be
+correct_bdate = [2016-04-15 12:00:00, 2016-04-15 12:00:00, 2016-04-15 12:00:00, 2016-04-15 12:00:00]
+correct_vdate = [2016-04-15 12:00:00, 2016-04-15 18:00:00, 2016-04-16 00:00:00, 2016-04-20 12:00:00]
+
+check_dates(data, correct_bdate, correct_vdate)
+
+
+# same for hindcast data
+data  = read('hindcast.grib')
+
+# these are what the results should be
+correct_bdate = [2013-05-12 00:00:00, 2013-05-12 00:00:00, 2013-05-12 00:00:00,
+                 2013-05-12 00:00:00, 2013-05-12 00:00:00, 2013-05-12 00:00:00]
+correct_vdate = [2013-05-12 00:00:00, 2013-05-12 06:00:00, 2013-05-13 00:00:00,
+                 2013-05-13 12:00:00, 2013-05-14 00:00:00, 2013-05-15 00:00:00]
+
+check_dates(data, correct_bdate, correct_vdate)
+
+
+
+# ----------------------------------------------------------------------------
+# Function : check_dates
+# ----------------------------------------------------------------------------
+
+function check_dates (data: fieldset, correct_bdate: list, correct_vdate: list)
+
+    bdate = base_date(data)
+    vdate = valid_date(data)
+
+    # check whether the computed results are correct - note that we can't just say
+    # "if bdate <>correct_bdate" because of how these operators work on lists
+    if 0 in (bdate = correct_bdate) then
+        print('base dates are not the same:')
+        print('reference: ', correct_bdate)
+        print('computed : ', bdate)
+        fail()
+    end if
+
+    if 0 in (vdate = correct_vdate) then
+        print('valid dates are not the same:')
+        print('reference: ', correct_vdate)
+        print('computed : ', vdate)
+        fail()
+    end if
+
+
+    # quick check to make sure that we return single dates if given single fields
+    bdate1 = base_date(data[1])
+    if (type(bdate1) <> 'date' or (bdate1 <> correct_bdate[1])) then
+        print('single base date is not the same:')
+        print('reference: ', correct_bdate[1])
+        print('computed : ', bdate1)
+        fail()
+    end if
+
+    vdate1 = valid_date(data[1])
+    if (type(vdate1) <> 'date' or (vdate1 <> correct_vdate[1])) then
+        print('single valid date is not the same:')
+        print('reference: ', correct_vdate[1])
+        print('computed : ', vdate1)
+        fail()
+    end if
+
+end check_dates
diff --git a/test/macros/layoutx3.mv b/test/macros/layoutx3.mv
index c965bbf..e79eefb 100644
--- a/test/macros/layoutx3.mv
+++ b/test/macros/layoutx3.mv
@@ -56,9 +56,10 @@ dw = plot_superpage
 )
 
 
-plot (dw[1], data)
-plot (dw[2], data*10)
-plot (dw[3], data*20)
+# we add an empty mcont() definition to bypass any custom defaults the user has
+plot (dw[1], data,    mcont())
+plot (dw[2], data*10, mcont())
+plot (dw[3], data*20, mcont())
 
 wait_for_output()
 check_if_expected_output_files_exist()
diff --git a/test/macros/lists.mv b/test/macros/lists.mv
new file mode 100644
index 0000000..2e5779f
--- /dev/null
+++ b/test/macros/lists.mv
@@ -0,0 +1,36 @@
+# Metview Macro
+
+# **************************** LICENSE START ***********************************
+#
+# Copyright 2016 ECMWF. This software is distributed under the terms
+# of the Apache License version 2.0. In applying this license, ECMWF does not
+# waive the privileges and immunities granted to it by virtue of its status as
+# an Intergovernmental Organization or submit itself to any jurisdiction.
+#
+# ***************************** LICENSE END ************************************
+
+# perform some basic operations on the 'list' Macro data type
+
+a = [10, 20, 30, 'a', 'b', 'c']
+
+assert(a[1] = 10,         'first element')
+assert(a[count(a)] = 'c', 'last element')
+assert(equal(a[1,2], [10,20]), '2 indexes')
+assert(equal(a[1,5,2], [10, 30, 'b']), '2 indexes')
+
+i = |2,1,5|  #  use a vector as an index
+assert(equal(a[i], [20, 10, 'b']), 'vector index')
+
+
+# ---------------------------------------------------
+
+function equal(l1: list, l2:list)
+    return (not 0 in (l1 = l2))
+end equal
+
+function assert(test:number, msg:string)
+    if (not(test)) then
+        fail(msg)
+    end if
+end assert
+
diff --git a/test/macros/odb_read.mv b/test/macros/odb_read.mv
new file mode 100644
index 0000000..167ba4e
--- /dev/null
+++ b/test/macros/odb_read.mv
@@ -0,0 +1,53 @@
+# Metview Macro
+
+# **************************** LICENSE START ***********************************
+#
+# Copyright 2016 ECMWF. This software is distributed under the terms
+# of the Apache License version 2.0. In applying this license, ECMWF does not
+# waive the privileges and immunities granted to it by virtue of its status as
+# an Intergovernmental Organization or submit itself to any jurisdiction.
+#
+# ***************************** LICENSE END ************************************
+
+
+# read the original data file
+f = read('odb_test_set.odb')
+
+
+# check it is the correct type
+t = type(f)
+if (t <> 'odb') then
+    fail('Type of ODB file is "' & t & '" instead of "odb"')
+else
+    print('Correct type: ', t)
+end if
+
+
+
+# check that there are the right number of data points
+numrows = count(f)
+if (numrows <> 717) then
+    fail('ODB file is reported has having ' & numrows & ' points instead of 717')
+else
+    print('Correct num rows: ', numrows)
+end if
+
+lats = values(f, 'lat')
+numpoints = count(lats)
+if (numpoints <> 717) then
+    fail('ODB file is reported has having ' & numpoints & ' points instead of 717')
+else
+    print('Correct num points: ', numpoints)
+end if
+
+
+
+# check some statistics on the values
+
+minlat = minvalue(lats)
+maxlat = maxvalue(lats)
+if (minlat < 30) or (maxlat > 75) then
+    fail('lat range is wrong: ' & minlat & ' to ' & maxlat & ' (should be between 30 and 75)')
+else
+    print('Correct lat range: ' & minlat & ' to ' & maxlat)
+end if
diff --git a/test/macros/plot_coast_order.mv b/test/macros/plot_coast_order.mv
deleted file mode 100644
index 810e2cc..0000000
--- a/test/macros/plot_coast_order.mv
+++ /dev/null
@@ -1 +0,0 @@
-#Metview Macro
\ No newline at end of file
diff --git a/test/macros/set_output.mv b/test/macros/set_output.mv
index 8fc24dd..d95c484 100644
--- a/test/macros/set_output.mv
+++ b/test/macros/set_output.mv
@@ -22,9 +22,7 @@ function set_output(namex)
  if mode = "batch" then 
 
      out = ps_output(
-      output_name : namex,
-      output_ps_scale : 0.5,
-      OUTPUT_PS_COLOUR_MODEL : "RGB"
+      output_name : namex
      )
      svg = svg_output(
       output_name : namex
diff --git a/test/macros/vectors.mv b/test/macros/vectors.mv
new file mode 100644
index 0000000..1419d6a
--- /dev/null
+++ b/test/macros/vectors.mv
@@ -0,0 +1,78 @@
+# Metview Macro
+
+# **************************** LICENSE START ***********************************
+#
+# Copyright 2016 ECMWF. This software is distributed under the terms
+# of the Apache License version 2.0. In applying this license, ECMWF does not
+# waive the privileges and immunities granted to it by virtue of its status as
+# an Intergovernmental Organization or submit itself to any jurisdiction.
+#
+# ***************************** LICENSE END ************************************
+
+# perform some basic operations on the 'vector' Macro data type
+
+v = | 1, 2, 3, 4, 5, 6, 7, 8, 9,10,
+     11,12,13,14,15,16,17,18,19,20,
+     21,22,23,24,25,26,27,28,29,30,
+     31,32,33,34,35,36,37,38,39,40|
+
+
+assert(v[1]        = 1,  'first element')
+assert(v[count(v)] = 40, 'last element')
+
+#v2 = v[2,2]
+#assert(type(v2)  = 'vector', 'second element as vector - type')
+#assert(count(v2) = 1,        'second element as vector - count')
+#assert(v2[1]     = 2,        'second element as vector - value')
+
+v3 = v[4,7]
+assert(count(v3) = 4, 'elements 4,7 - count')
+v3bool = (v3 = |4,5,6,7|)
+assert(sum(v3bool) = 4, 'elements 4,7 - values')
+
+v4 = v[4,7,2]
+assert(count(v4) = 2, 'elements 4,7,2 - count')
+v4bool = (v4 = |4,6|)
+assert(sum(v4bool) = 2, 'elements 4,7,2 - values')
+
+v5 = v[4,40,10,3]
+assert(count(v5) = 12, 'elements 4,40,10,3 - count')
+v5bool = (v5 = |4,5,6,14,15,16,24,25,26,34,35,36|)
+assert(sum(v5bool) = 12, 'elements 4,40,10,3 - values')
+
+vv = |4,40,10,3|
+vi = |2, 3, 1|
+v6 = vv[vi]
+v6bool = (v6 = |40, 10, 4|)
+assert(sum(v6bool) = 3, 'elements 4,40,10,3 - values with vector indexing')
+
+assert(minvalue(v) = 1,  'minvalue')
+assert(maxvalue(v) = 40, 'maxvalue')
+assert(sum(v)      = 820, 'sum')
+assert(sum(v+10)   = 820+(10*count(v)), 'sum v+10')
+
+
+# find
+vf = |2, 3, 4, 5, 6, 3, 4, 3|
+f = find(vf, 0) # look for something not in the vector
+assert(f = nil, 'find not found should return nil')
+f = find(vf, 0, 'all') # look for something not in the vector
+assert(f = nil, 'find not found should return nil (multiple)')
+f = find(vf, 3) # find single occurrence
+assert(f = 2, 'find 3')
+f = find(vf, 2, 'all') # find all occurrences when there is only one
+assert(type(f)='vector' and f[1] = 1, 'find 2 all')
+f = find(vf, 3, 'all') # find all occurrences when there are multiple matches
+assert(type(f)='vector' and maxvalue(abs(f-|2,6,8|))=0, 'find 3 all')
+
+vf = |2, 3, 4, vector_missing_value, 6, 3, vector_missing_value, 3|
+f = find(vf, vector_missing_value, 'all') # find all missing values
+assert(type(f)='vector' and maxvalue(abs(f-|4,7|))=0, 'find vector_missing_value all')
+
+
+function assert(test:number, msg:string)
+    if (not(test)) then
+        fail(msg)
+    end if
+end assert
+

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



More information about the debian-science-commits mailing list