[emos] 03/14: Upstream 4.3.7
Alastair McKinstry
mckinstry at moszumanska.debian.org
Wed Mar 2 11:41:28 UTC 2016
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to branch debian/master
in repository emos.
commit 6c0a6dc2db233dad22fe7be3a41a4e0eb96e0526
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Wed Feb 3 12:11:55 2016 +0000
Upstream 4.3.7
---
CMakeLists.txt | 20 +-
ChangeLog | 47 +++-
VERSION.cmake | 2 +-
bamboo/flags.cmake | 16 +-
bin/ecbuild | 2 +-
bufrtables/VERSION.cmake | 2 +-
bufrtables/links.sh | 12 ++
cmake/FindLibGFortran.cmake | 14 +-
cmake/FindNetCDF.cmake | 44 ++--
cmake/FindPango.cmake | 14 +-
cmake/FindPangoCairo.cmake | 12 +-
cmake/FindProj4.cmake | 10 +-
cmake/FindREADLINE.cmake | 4 +-
cmake/Findgrib_api.cmake | 42 ++--
cmake/VERSION.cmake | 6 +-
cmake/contrib/FindNetCDF4.cmake | 14 +-
cmake/ecbuild_add_executable.cmake | 121 +++--------
cmake/ecbuild_add_extra_search_paths.cmake | 2 +-
cmake/ecbuild_add_library.cmake | 128 ++---------
cmake/ecbuild_add_option.cmake | 12 +-
cmake/ecbuild_add_persistent.cmake | 12 +-
cmake/ecbuild_add_test.cmake | 14 +-
cmake/ecbuild_bundle.cmake | 32 +--
cmake/ecbuild_check_cxx_source_return.cmake | 40 ++--
cmake/ecbuild_check_functions.cmake | 14 +-
cmake/ecbuild_debug_var.cmake | 47 ++++
cmake/ecbuild_declare_project.cmake | 22 +-
cmake/ecbuild_echo_targets.cmake | 6 +-
cmake/ecbuild_features.cmake | 32 +--
cmake/ecbuild_find_package.cmake | 2 +-
cmake/ecbuild_find_python.cmake | 69 +++---
cmake/ecbuild_generate_fortran_interfaces.cmake | 115 ----------
cmake/ecbuild_get_resources.cmake | 14 +-
cmake/ecbuild_get_test_data.cmake | 24 +--
cmake/ecbuild_links_target.cmake | 8 +-
cmake/ecbuild_list_add_pattern.cmake | 94 --------
cmake/ecbuild_list_exclude_pattern.cmake | 88 --------
cmake/ecbuild_list_extra_search_paths.cmake | 6 +-
cmake/ecbuild_list_macros.cmake | 38 +++-
cmake/ecbuild_log.cmake | 66 +-----
cmake/ecbuild_policies.cmake | 8 +-
cmake/ecbuild_print_summary.cmake | 2 +-
cmake/ecbuild_project_files.cmake | 8 +-
cmake/ecbuild_separate_sources.cmake | 8 +-
cmake/ecbuild_setup_test_framework.cmake | 6 +-
cmake/ecbuild_source_flags.cmake | 30 ---
cmake/ecbuild_system.cmake | 7 +-
cmake/ecbuild_use_package.cmake | 21 +-
cmake/gen_source_flags.py | 70 ------
data/intf2_O640_to_F48.grib | Bin 36976 -> 36976 bytes
data/intf2_O640_to_F80.grib | Bin 102512 -> 102512 bytes
data/intf2_O640_to_regular_ll.grib | Bin 519952 -> 519952 bytes
...h_vod_to_F48.grib => intf2_sh_vo-d_to_F48.grib} | Bin
...h_vod_to_F80.grib => intf2_sh_vo-d_to_F80.grib} | Bin
...h_vod_to_N80.grib => intf2_sh_vo-d_to_N80.grib} | Bin
...h_vod_to_O80.grib => intf2_sh_vo-d_to_O80.grib} | Bin
...ar_ll.grib => intf2_sh_vo-d_to_regular_ll.grib} | Bin
...ib => intf2_sh_vo-d_to_rotated_regular_ll.grib} | Bin
...vod_to_F80.grib => intuvp2_sh_vo-d_to_F80.grib} | Bin
...vod_to_N80.grib => intuvp2_sh_vo-d_to_N80.grib} | Bin
...vod_to_O80.grib => intuvp2_sh_vo-d_to_O80.grib} | Bin
..._ll.grib => intuvp2_sh_vo-d_to_regular_ll.grib} | Bin
data/intuvp2_sh_vo-d_to_rotated_regular_ll.grib | Bin 0 -> 29760 bytes
data/{sh_vod.grib => sh_vo-d.grib} | Bin
interpolation/0-INDEX-0 | 6 +-
interpolation/CMakeLists.txt | 4 +
interpolation/gasetup.F | 12 +-
interpolation/gglonlat.F | 236 +++++++++++++++++++++
interpolation/hgetlsm.F | 1 -
interpolation/hntfaph.F | 4 +-
interpolation/hntfauh.F | 4 +-
interpolation/hntfaus.F | 2 -
interpolation/hsh2gg.F | 4 +-
interpolation/hsp2gg.F | 75 +++++++
interpolation/hsp2gg2.F | 75 +++++++
interpolation/hsp2gg3.F | 76 +++++++
interpolation/igdiwe.F | 80 +++++--
interpolation/iglsmb.F | 175 ++++++++-------
interpolation/igsetup.F | 91 ++++----
interpolation/intfap.F | 1 +
interpolation/intfb.F | 4 -
interpolation/intin.F | 3 +-
interpolation/intocn.F | 35 ++-
interpolation/intocnu.F | 43 ++--
interpolation/intout.F | 3 +-
interpolation/intuvgh.F | 1 -
interpolation/intuvxh.F | 2 +-
interpolation/intvecy.F | 10 +-
interpolation/irlsmb.F | 124 +++++------
interpolation/issame.F | 10 +-
interpolation/jmemhan2.F | 7 +-
interpolation/jsgggp.F | 2 -
interpolation/juvpole.F | 7 +-
interpolation/krg2rgu.F | 1 -
interpolation/krg2rgz.F | 1 -
interpolation/lsm_red.F | 1 -
interpolation/mkbitmp.F | 19 +-
interpolation/pddefs.F | 4 +-
interpolation/wv2dint.F | 14 +-
pbio/emosnum.F | 6 +-
share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake | 4 +-
tests/CMakeLists.txt | 154 +++++++++-----
tests/example_intf2.F | 157 ++++++++++++++
tests/example_intuvp2.F | 147 +++++++++++++
tests/hsp2gg.F | 68 ++++++
tests/regress/CMakeLists.txt | 147 +++++++++++++
tests/regress/download_tests_regress_ref_files.txt | 110 ++++++++++
tests/regress/download_tests_regress_src_files.txt | 18 ++
tools/CMakeLists.txt | 16 ++
tools/bufrtools_wmo/bufr_add_bias.F90 | 11 +
tools/gg_latitudes.F | 2 +-
tools/gg_single.c | 231 ++++++++++++++++++++
tools/int.F | 78 ++++++-
113 files changed, 2357 insertions(+), 1356 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 754e82a..314e285 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,12 +27,14 @@ ecbuild_add_option( FEATURE FORTRAN90 DESCRIPTION "enable tools which nee
ecbuild_add_option( FEATURE SINGLE_PRECISION DESCRIPTION "enable single precision version of library (in addition to double precision)" DEFAULT ON )
ecbuild_add_option( FEATURE GRIBEX_ABORT DESCRIPTION "abort execution on GRIBex calls" DEFAULT ON )
-ecbuild_add_option( FEATURE FFTW DESCRIPTION "Fastest Fourier Transform in the West" DEFAULT ON REQUIRED_PACKAGES FFTW )
+ecbuild_add_option( FEATURE REQUIRE_FFTW DESCRIPTION "require package: Fastest Fourier Transform in the West" DEFAULT ON )
+ecbuild_add_option( FEATURE FFTW DESCRIPTION "Fastest Fourier Transform in the West" DEFAULT ON REQUIRED_PACKAGES FFTW )
set_package_properties( FFTW PROPERTIES TYPE RECOMMENDED PURPOSE "allows interpolation of spectral to octahedral reduced Gaussian grid" )
ecbuild_add_option( FEATURE LIBEMOS_BUFRDC DESCRIPTION "enable BUFR decoding functionality" DEFAULT ON )
ecbuild_add_option( FEATURE LIBEMOS_INTERPOLATION DESCRIPTION "enable interpolation functionality" DEFAULT ON )
ecbuild_add_option( FEATURE LIBEMOS_GRIBEX DESCRIPTION "enable GRIBex functionality" DEFAULT ON )
+ecbuild_add_option( FEATURE LIBEMOS_TESTS_REGRESS DESCRIPTION "additional tests: regression" DEFAULT OFF )
################################################################################
@@ -62,10 +64,12 @@ endif()
# build type flags
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
ecbuild_add_fortran_flags("-ffixed-line-length-none -fcray-pointer -fno-second-underscore -Wuninitialized -Wunused-variable -DSHAREDMEMORY")
- ecbuild_add_fortran_flags("-O2 -mtune=native" BUILD RELEASE)
- ecbuild_add_fortran_flags("-g -O2 -mtune=native" BUILD RELWITHDEBINFO)
- ecbuild_add_fortran_flags("-g" BUILD DEBUG)
- set(emos_special_compiler_def "gfortran")
+ ecbuild_add_fortran_flags("-O2 -mtune=native" BUILD RELEASE)
+ ecbuild_add_fortran_flags("-O2 -mtune=native" BUILD RELWITHDEBINFO)
+ ecbuild_add_fortran_flags("-g" BUILD RELWITHDEBINFO)
+ ecbuild_add_fortran_flags("-g" BUILD DEBUG)
+# ecbuild_remove_fortran_flags("-fcheck=bounds" BUILD DEBUG)
+ set(emos_special_compiler_def "gfortran")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
ecbuild_add_fortran_flags("-DSHAREDMEMORY")
ecbuild_add_fortran_flags("-f77rtl" BUILD RELEASE)
@@ -119,6 +123,8 @@ include_directories( ${LIBEMOS_INCLUDE_DIRS} )
include_directories( ${GRIB_API_INCLUDE_DIRS} )
if( HAVE_FFTW )
include_directories( ${FFTW_INCLUDES} )
+elseif( HAVE_REQUIRE_FFTW )
+ message( FATAL_ERROR "\nCannot build without FFTW support (support is required)!")
endif()
if( BUFR_TABLES_PATH )
@@ -174,7 +180,9 @@ if( ENABLE_INSTALL_TOOLS )
add_subdirectory( tools )
endif()
-add_subdirectory( tests )
+if( HAVE_TESTS )
+ add_subdirectory( tests )
+endif()
#DEFINITIONS FORTRAN_NO_UNDERSCORE
diff --git a/ChangeLog b/ChangeLog
index 8ffdd3c..51e9f4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,13 +1,56 @@
+000437
+
+ Notes
+ * This release is part of ECMWF Development Section Synchronised Release 2016.01
+ * This version of libemos was tested against BUFR tables version 000407, please check also changes of the previous version 000420
+
+ Improvement
+ * [EMOS-244] - BUFR tables 000407
+
+ Bug fixes
+ * [EMOS-238/EMOS-247] - interpolation from reduced_gg to regular_gg/regular_ll with sub-areas including the 0-meridian
+
+000436
+
+ Notes
+ * Default cmake behaviour now requires FFTW package unless configured with -DENABLE_REQUIRE_FFTW=OFF
+
+ Improvement
+ * [DAPP-284] - bufr_add_bias now handles 181 and 182 subtypes
+ * [EMOS-231] - regression tests suite activated with -DLIBEMOS_TESTS_REGRESS=ON (currently holding only EMOS-216 tests)
+ * [EMOS-223] - default cmake behaviour new requires FFTW package unless configured with -DENABLE_REQUIRE_FFTW=OFF
+ * [EMOS-223] - build options synchronized with ecbuild/develop
+
+ Bug Fixes
+ * [EMOS-238] - fixed longitude increment accumulation for interpolations of Gaussian grids to sub-area regular grids (see also EMOS-216)
+
+000435
+
+ Improvement
+ * [EMOS-234] - internal testing of reduced_gg to lat/lon single-point interpolation
+
+ Bug Fixes
+ * [EMOS-216] - improved longitude increment calculation precision for LSM (affects reduced_gg to regular_ll/regular_gg interpolations)
+
+000434
+
+ Improvement
+ * [EMOS-236] - re-implemented HSP2GG, HSP2GG2 and HSP2GG3 based on HSH2GG, to control SH interpolation to Gaussian grids
+
+ Bug Fixes
+ * [EMOS-233] - corrected encoding of -90/0 rotation
+ * [EMOS-235] - wrong behaviour of configuration option -DENABLE_TESTS=OFF
+
000433
Improvement
- * [EMOS-232 - include climate.v014 land-sea masks
+ * [EMOS-232] - include climate.v014 land-sea masks
000432
Bug Fixes
* [EMOS-216] - interpolations from regular/reduced global grids to regular (lat/lon and F-grids) local grids use old algorithm
- * [EMOS-230] - fixed some tests failure when calling grib_compare, when grib_api is not installed
+ * [EMOS-230] - fixed some tests failure when calling grib_compare, when grib_api is not installed
000431
diff --git a/VERSION.cmake b/VERSION.cmake
index 1c8fa0c..35be6c5 100644
--- a/VERSION.cmake
+++ b/VERSION.cmake
@@ -2,4 +2,4 @@
# Do NOT forget to update pbio/emosnum.F
#
#
-set( ${PROJECT_NAME}_VERSION_STR "4.3.3" )
+set( ${PROJECT_NAME}_VERSION_STR "4.3.7" )
diff --git a/bamboo/flags.cmake b/bamboo/flags.cmake
index 2b2f117..cef9de3 100644
--- a/bamboo/flags.cmake
+++ b/bamboo/flags.cmake
@@ -1,10 +1,12 @@
-set( BUFR_TABLES_PATH "bufr/text" CACHE STRING "" )
-SET(CMAKE_C_FLAGS
- "-Dlinux -DREAL_8 -DREAL_BIGGER_THAN_INTEGER -DINTEGER_IS_INT -DLITTLE_ENDIAN"
- CACHE STRING "C flags")
+set( ENABLE_LIBEMOS_TESTS_REGRESS ON CACHE STRING "additional tests: regression" )
+set( BUFR_TABLES_PATH "bufr/text" CACHE STRING "" )
-SET(CMAKE_Fortran_FLAGS
- "-fcray-pointer -fdefault-real-8 -fdefault-double-8 -Dlinux -DREAL_8 -DREAL_BIGGER_THAN_INTEGER -DINTEGER_IS_INT -DLITTLE_ENDIAN"
- CACHE STRING "Fortran flags")
+set( CMAKE_C_FLAGS
+ "-Dlinux -DREAL_8 -DREAL_BIGGER_THAN_INTEGER -DINTEGER_IS_INT -DLITTLE_ENDIAN"
+ CACHE STRING "C flags" )
+
+set( CMAKE_Fortran_FLAGS
+ "-fcray-pointer -fdefault-real-8 -fdefault-double-8 -Dlinux -DREAL_8 -DREAL_BIGGER_THAN_INTEGER -DINTEGER_IS_INT -DLITTLE_ENDIAN"
+ CACHE STRING "Fortran flags" )
diff --git a/bin/ecbuild b/bin/ecbuild
index 1876fbd..b327cde 100755
--- a/bin/ecbuild
+++ b/bin/ecbuild
@@ -3,7 +3,7 @@
set -eua
CMAKE_MIN_REQUIRED=2.8.10
-CMAKE_BUILD_VERSION=3.3.2
+CMAKE_BUILD_VERSION=3.2.3
usage()
{
diff --git a/bufrtables/VERSION.cmake b/bufrtables/VERSION.cmake
index a04687c..fc3a67b 100644
--- a/bufrtables/VERSION.cmake
+++ b/bufrtables/VERSION.cmake
@@ -1 +1 @@
-set( ${PROJECT_NAME}_VERSION_STR "4.0.6" )
+set( ${PROJECT_NAME}_VERSION_STR "4.0.7" )
diff --git a/bufrtables/links.sh b/bufrtables/links.sh
index 7d396ff..1fd89a7 100755
--- a/bufrtables/links.sh
+++ b/bufrtables/links.sh
@@ -20,6 +20,7 @@ ln -s B_ebc7e71fcb4772e2325cb4f40621ee4b.distinct B0000000000000021000.TXT
ln -s B_050f4028a43495e52440d17656e5700c.distinct B0000000000000022000.TXT
ln -s B_365ab9afedb6b68f014f6b4c4e95310b.distinct B0000000000000023000.TXT
ln -s B_9bfcb1e96d7c2e6025837b0885b7f1e4.distinct B0000000000000024000.TXT
+ln -s B_4851e63ae80dfa0465a5c0accadb59c7.distinct B0000000000000025000.TXT
ln -s B_47972c7924f05d5facc57044fc806c61.distinct B0000000000001010001.TXT
ln -s B_47972c7924f05d5facc57044fc806c61.distinct B0000000000001011001.TXT
ln -s B_47972c7924f05d5facc57044fc806c61.distinct B0000000000001012001.TXT
@@ -855,6 +856,9 @@ ln -s B_e8f55a23bedb304f90efcb46fed782bf.distinct B0000000000098024001.TXT
ln -s B_d519a21cc26558fbfbcae5e5aae942dd.distinct B0000000000098024002.TXT
ln -s B_4c2fd16b160e3e8368bae800b4737531.distinct B0000000000098024003.TXT
ln -s B_ddbe264d6831c71bf60f55118905d5eb.distinct B0000000000098024101.TXT
+ln -s B_447ec2596e66dd32d2e9f75206ecf377.distinct B0000000000098025001.TXT
+ln -s B_743c8d7004186d6caa4cc90f3b2fada1.distinct B0000000000098025002.TXT
+ln -s B_f10ebfdd137c45c773fb05ae41c11aac.distinct B0000000000098025101.TXT
ln -s B_47972c7924f05d5facc57044fc806c61.distinct B0000000000099010001.TXT
ln -s B_47972c7924f05d5facc57044fc806c61.distinct B0000000000099011001.TXT
ln -s B_47972c7924f05d5facc57044fc806c61.distinct B0000000000099012001.TXT
@@ -2383,6 +2387,7 @@ ln -s C_9c9f7e17ae667a48f6240fe428ec92e9.distinct C0000000000000021000.TXT
ln -s C_b7fa1a7727369ecf09b368eae9f63585.distinct C0000000000000022000.TXT
ln -s C_8aa5c5c950f5d48836a11233c86a362d.distinct C0000000000000023000.TXT
ln -s C_116764873185b2db63915296e10b6177.distinct C0000000000000024000.TXT
+ln -s C_cbbfb0961719d91837e879725606f888.distinct C0000000000000025000.TXT
ln -s C_09898434dcb4dc98ec72b1bc92727b4c.distinct C0000000000001010001.TXT
ln -s C_09898434dcb4dc98ec72b1bc92727b4c.distinct C0000000000001011001.TXT
ln -s C_09898434dcb4dc98ec72b1bc92727b4c.distinct C0000000000001012001.TXT
@@ -3212,6 +3217,9 @@ ln -s C_e684b84693944aad209ef258bc0a38f3.distinct C0000000000098024001.TXT
ln -s C_6c72ae004019317bfff1a124a7d22982.distinct C0000000000098024002.TXT
ln -s C_6471810f3864afa93fb3e1759e4b2415.distinct C0000000000098024003.TXT
ln -s C_dd5c45a988eac89a8e8e692d3ec13ad3.distinct C0000000000098024101.TXT
+ln -s C_28dcf02601e27183968edca962cea54b.distinct C0000000000098025001.TXT
+ln -s C_0af6a5953f106b2e629790deb9e5d160.distinct C0000000000098025002.TXT
+ln -s C_52e7c7c26f18619d3a5aab4622ff5ded.distinct C0000000000098025101.TXT
ln -s C_09898434dcb4dc98ec72b1bc92727b4c.distinct C0000000000099010001.TXT
ln -s C_09898434dcb4dc98ec72b1bc92727b4c.distinct C0000000000099011001.TXT
ln -s C_09898434dcb4dc98ec72b1bc92727b4c.distinct C0000000000099012001.TXT
@@ -4691,6 +4699,7 @@ ln -s D_34d8eded2acfd064517d900818528d60.distinct D0000000000000021000.TXT
ln -s D_bb99e30d62bf95ef8f97567958d44e1c.distinct D0000000000000022000.TXT
ln -s D_8329c50ae1dd4e0c1c9a5060a5b9e0b1.distinct D0000000000000023000.TXT
ln -s D_4cf72028cf96f271998949b4ff6b275e.distinct D0000000000000024000.TXT
+ln -s D_b907356b269f584470d86dd66c0c511b.distinct D0000000000000025000.TXT
ln -s D_df21a931ba159c58c3b9b00236baac59.distinct D0000000000001010001.TXT
ln -s D_df21a931ba159c58c3b9b00236baac59.distinct D0000000000001011001.TXT
ln -s D_df21a931ba159c58c3b9b00236baac59.distinct D0000000000001012001.TXT
@@ -5526,6 +5535,9 @@ ln -s D_a315a8ea0a25105ecc2beed878b20d2c.distinct D0000000000098024001.TXT
ln -s D_d1336aa38690b760533d2b96352e2130.distinct D0000000000098024002.TXT
ln -s D_ef9057f8866d2ad1d22cfc09fd15cd2a.distinct D0000000000098024003.TXT
ln -s D_d87c60652ddb0d347b093ac29d37caad.distinct D0000000000098024101.TXT
+ln -s D_37330e819864b322b4bd32c5637e6c3f.distinct D0000000000098025001.TXT
+ln -s D_30035205012784a0c6916eebd0384d27.distinct D0000000000098025002.TXT
+ln -s D_67aa10c5ca69200995cb56453d1af238.distinct D0000000000098025101.TXT
ln -s D_df21a931ba159c58c3b9b00236baac59.distinct D0000000000099010001.TXT
ln -s D_df21a931ba159c58c3b9b00236baac59.distinct D0000000000099011001.TXT
ln -s D_df21a931ba159c58c3b9b00236baac59.distinct D0000000000099012001.TXT
diff --git a/cmake/FindLibGFortran.cmake b/cmake/FindLibGFortran.cmake
index 95b6036..200ffcb 100644
--- a/cmake/FindLibGFortran.cmake
+++ b/cmake/FindLibGFortran.cmake
@@ -1,8 +1,8 @@
# © 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
+# 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)
-# ecbuild_debug_var(_GFORTRAN_SEARCH_SUCCESS)
-# ecbuild_debug_var(_GFORTRAN_VALUES_OUTPUT)
-# ecbuild_debug_var(_GFORTRAN_ERROR_VALUE)
+# debug_var(_GFORTRAN_SEARCH_SUCCESS)
+# debug_var(_GFORTRAN_VALUES_OUTPUT)
+# 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()
- ecbuild_debug_var( _gfortran_hints )
+ debug_var( _gfortran_hints )
endif()
diff --git a/cmake/FindNetCDF.cmake b/cmake/FindNetCDF.cmake
index 822ecf0..89af114 100644
--- a/cmake/FindNetCDF.cmake
+++ b/cmake/FindNetCDF.cmake
@@ -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}]")
- # ecbuild_debug_var( NETCDF_ROOT )
- # ecbuild_debug_var( NETCDF_FIND_COMPONENTS )
- # ecbuild_debug_var( NETCDF_FIND_QUIETLY )
- # ecbuild_debug_var( NETCDF_FIND_REQUIRED )
+ # debug_var( NETCDF_ROOT )
+ # debug_var( NETCDF_FIND_COMPONENTS )
+ # debug_var( NETCDF_FIND_QUIETLY )
+ # debug_var( NETCDF_FIND_REQUIRED )
find_package( NetCDF4 COMPONENTS ${NETCDF_FIND_COMPONENTS} )
- # ecbuild_debug_var( NETCDF4_FOUND )
- # ecbuild_debug_var( NETCDF_FOUND )
- # ecbuild_debug_var( NETCDF_LIBRARIES )
- # ecbuild_debug_var( NETCDF_INCLUDE_DIRS )
+ # debug_var( NETCDF4_FOUND )
+ # debug_var( NETCDF_FOUND )
+ # debug_var( NETCDF_LIBRARIES )
+ # 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()
- # ecbuild_debug_var( NETCDF_Fortran_LIBRARIES )
- # ecbuild_debug_var( NETCDF_C_LIBRARIES )
- # ecbuild_debug_var( NETCDF_CXX_LIBRARIES )
+ # debug_var( NETCDF_Fortran_LIBRARIES )
+ # debug_var( NETCDF_C_LIBRARIES )
+ # 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()
- #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 )
+ #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 )
endif()
@@ -131,9 +131,9 @@ if( PREFER_NETCDF3 )
ecbuild_debug( "FindNetCDF: looking for NetCDF3" )
- # ecbuild_debug_var( NetCDF_FIND_COMPONENTS )
- # ecbuild_debug_var( NetCDF_FIND_QUIETLY )
- # ecbuild_debug_var( NetCDF_FIND_REQUIRED )
+ # debug_var( NetCDF_FIND_COMPONENTS )
+ # debug_var( NetCDF_FIND_QUIETLY )
+ # debug_var( NetCDF_FIND_REQUIRED )
list(FIND NetCDF_FIND_COMPONENTS "CXX" _index)
if(${_index} GREATER -1)
diff --git a/cmake/FindPango.cmake b/cmake/FindPango.cmake
index 9f183b9..811cdf9 100644
--- a/cmake/FindPango.cmake
+++ b/cmake/FindPango.cmake
@@ -1,8 +1,8 @@
# (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
+# 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,10 +17,10 @@ find_package(PkgConfig)
pkg_check_modules(PC_LIBPANGO QUIET pango)
-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 )
+debug_var( PC_LIBPANGO_FOUND )
+debug_var( PC_LIBPANGO_VERSION )
+debug_var( PC_LIBPANGO_LIBRARIES )
+debug_var( PC_LIBPANGO_INCLUDE_DIRS )
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args( pango DEFAULT_MSG PC_LIBPANGO_LIBRARIES PC_LIBPANGO_INCLUDE_DIRS )
diff --git a/cmake/FindPangoCairo.cmake b/cmake/FindPangoCairo.cmake
index 7d7750e..7445754 100644
--- a/cmake/FindPangoCairo.cmake
+++ b/cmake/FindPangoCairo.cmake
@@ -18,12 +18,12 @@ find_package(PkgConfig)
pkg_check_modules(PC_LIBPANGOCAIRO QUIET pangocairo)
-#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 )
+#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 )
if(PC_LIBPANGOCAIRO_FOUND)
diff --git a/cmake/FindProj4.cmake b/cmake/FindProj4.cmake
index 64eab79..6774b6e 100644
--- a/cmake/FindProj4.cmake
+++ b/cmake/FindProj4.cmake
@@ -38,9 +38,9 @@ if( NOT PROJ4_PATH )
endif()
-# ecbuild_debug_var( PKG_CONFIG_FOUND )
-# ecbuild_debug_var( PKPROJ4_FOUND )
-# ecbuild_debug_var( PROJ4_MIN_VERSION )
+# debug_var( PKG_CONFIG_FOUND )
+# debug_var( PKPROJ4_FOUND )
+# debug_var( PROJ4_MIN_VERSION )
endif()
@@ -55,8 +55,8 @@ find_path(PROJ4_INCLUDE_DIR NAMES proj_api.h PATHS PATH_SUFFIXES proj4 )
find_library( PROJ4_LIBRARY NAMES proj PATHS PATH_SUFFIXES proj4 )
-# ecbuild_debug_var( PROJ4_INCLUDE_DIR )
-# ecbuild_debug_var( PROJ4_LIBRARY )
+# debug_var( PROJ4_INCLUDE_DIR )
+# debug_var( PROJ4_LIBRARY )
# handle the QUIETLY and REQUIRED arguments and set GRIBAPI_FOUND
include(FindPackageHandleStandardArgs)
diff --git a/cmake/FindREADLINE.cmake b/cmake/FindREADLINE.cmake
index c6ae778..bbabe15 100644
--- a/cmake/FindREADLINE.cmake
+++ b/cmake/FindREADLINE.cmake
@@ -47,8 +47,8 @@ cmake_push_check_state()
cmake_pop_check_state()
-# ecbuild_debug_var( readline_version )
-# ecbuild_debug_var( __readline_version_out )
+# debug_var( readline_version )
+# debug_var( __readline_version_out )
set( __readline_fail 0 )
if( __readline_version_out )
diff --git a/cmake/Findgrib_api.cmake b/cmake/Findgrib_api.cmake
index 3150039..8b6cb43 100644
--- a/cmake/Findgrib_api.cmake
+++ b/cmake/Findgrib_api.cmake
@@ -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 )
-
- # ecbuild_debug_var( _grib_info_out )
-
+
+ # 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/VERSION.cmake b/cmake/VERSION.cmake
index e7ac9ad..a07bd4a 100644
--- a/cmake/VERSION.cmake
+++ b/cmake/VERSION.cmake
@@ -1,7 +1,7 @@
-set( ECBUILD_MAJOR_VERSION "2" )
-set( ECBUILD_MINOR_VERSION "0" )
+set( ECBUILD_MAJOR_VERSION "1" )
+set( ECBUILD_MINOR_VERSION "9" )
set( ECBUILD_PATCH_VERSION "0" )
-set( ECBUILD_VERSION_STR "2.0.0" )
+set( ECBUILD_VERSION_STR "1.9.0" )
set( ECBUILD_MACRO_VERSION "${ECBUILD_MAJOR_VERSION}.${ECBUILD_MINOR_VERSION}" )
diff --git a/cmake/contrib/FindNetCDF4.cmake b/cmake/contrib/FindNetCDF4.cmake
index 2afff21..89b0337 100644
--- a/cmake/contrib/FindNetCDF4.cmake
+++ b/cmake/contrib/FindNetCDF4.cmake
@@ -158,7 +158,7 @@ else()
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} )
find_path( NETCDF_${INC}_INCLUDE_DIR ${INC}
@@ -170,7 +170,7 @@ else()
Include
)
mark_as_advanced( NETCDF_${INC}_INCLUDE_DIR )
- # ecbuild_debug_var( NETCDF_${INC}_INCLUDE_DIR)
+ # debug_var( NETCDF_${INC}_INCLUDE_DIR)
if (NETCDF_${INC}_INCLUDE_DIR)
list( APPEND NETCDF_INCLUDE_DIRS ${NETCDF_${INC}_INCLUDE_DIR} )
else()
@@ -249,19 +249,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()
- # ecbuild_debug_var( NETCDF_${LANGUAGE}_LIBRARIES )
+ # debug_var( NETCDF_${LANGUAGE}_LIBRARIES )
list( APPEND NETCDF_FOUND_REQUIRED_VARS NETCDF_${LANGUAGE}_FOUND )
endforeach()
diff --git a/cmake/ecbuild_add_executable.cmake b/cmake/ecbuild_add_executable.cmake
index 9cc3d30..e4e39a1 100644
--- a/cmake/ecbuild_add_executable.cmake
+++ b/cmake/ecbuild_add_executable.cmake
@@ -16,9 +16,6 @@
#
# 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> ...] ]
@@ -44,16 +41,6 @@
# 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)
@@ -82,7 +69,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
#
@@ -98,6 +85,7 @@
# 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
#
@@ -110,7 +98,7 @@ 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 SOURCES_GLOB SOURCES_EXCLUDE_REGEX OBJECTS TEMPLATES LIBS INCLUDES DEPENDS PERSISTENT DEFINITIONS CFLAGS CXXFLAGS FFLAGS GENERATED CONDITION )
+ set( multi_value_args SOURCES 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} )
@@ -122,8 +110,8 @@ macro( ecbuild_add_executable )
message(FATAL_ERROR "The call to ecbuild_add_executable() doesn't specify the TARGET.")
endif()
- if( NOT _PAR_SOURCES AND NOT _PAR_OBJECTS AND NOT _PAR_SOURCES_GLOB )
- message(FATAL_ERROR "The call to ecbuild_add_executable() specifies neither SOURCES nor OBJECTS nor SOURCES_GLOB.")
+ if( NOT _PAR_SOURCES )
+ message(FATAL_ERROR "The call to ecbuild_add_executable() doesn't specify the SOURCES.")
endif()
### conditional build
@@ -171,25 +159,8 @@ macro( ecbuild_add_executable )
add_custom_target( ${_PAR_TARGET}_templates SOURCES ${_PAR_TEMPLATES} )
endif()
- # glob sources
- unset( _glob_srcs )
- foreach( pattern ${_PAR_SOURCES_GLOB} )
- ecbuild_list_add_pattern( LIST _glob_srcs GLOB "${pattern}" )
- endforeach()
-
- foreach( pattern ${_PAR_SOURCES_EXCLUDE_REGEX} )
- ecbuild_list_exclude_pattern( LIST _glob_srcs REGEX "${pattern}" )
- endforeach()
-
- # insert already compiled objects (from OBJECT libraries)
- unset( _all_objects )
- foreach( _obj ${_PAR_OBJECTS} )
- list( APPEND _all_objects $<TARGET_OBJECTS:${_obj}> )
- endforeach()
-
- add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} ${_glob_srcs} ${_all_objects} )
-
- # ecbuild_echo_target( ${_PAR_TARGET} )
+ # add the executable target
+ add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} )
# set OUTPUT_NAME
@@ -220,71 +191,24 @@ macro( ecbuild_add_executable )
endif()
# filter sources
-
ecbuild_separate_sources( TARGET ${_PAR_TARGET} SOURCES ${_PAR_SOURCES} )
- # ecbuild_debug_var( ${_PAR_TARGET}_h_srcs )
- # ecbuild_debug_var( ${_PAR_TARGET}_c_srcs )
- # ecbuild_debug_var( ${_PAR_TARGET}_cxx_srcs )
- # ecbuild_debug_var( ${_PAR_TARGET}_f_srcs )
-
# add local flags
-
- if( ${_PAR_TARGET}_c_srcs )
-
- if( ECBUILD_SOURCE_FLAGS )
- ecbuild_source_flags( ${_PAR_TARGET}_C_SOURCE_FLAGS
- ${_PAR_TARGET}_c
- "${_PAR_CFLAGS}"
- "${${_PAR_TARGET}_c_srcs}" )
-
- ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): setting source file C flags from ${${_PAR_TARGET}_C_SOURCE_FLAGS}")
- include( ${${_PAR_TARGET}_C_SOURCE_FLAGS} )
-
- elseif( 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_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( ${_PAR_TARGET}_cxx_srcs )
-
- if( ECBUILD_SOURCE_FLAGS )
- ecbuild_source_flags( ${_PAR_TARGET}_CXX_SOURCE_FLAGS
- ${_PAR_TARGET}_cxx
- "${_PAR_CXXFLAGS}"
- "${${_PAR_TARGET}_cxx_srcs}" )
-
- ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): setting source file CXX flags from ${${_PAR_TARGET}_CXX_SOURCE_FLAGS}")
- include( ${${_PAR_TARGET}_CXX_SOURCE_FLAGS} )
-
- elseif( 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_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( ${_PAR_TARGET}_f_srcs )
-
- if( ECBUILD_SOURCE_FLAGS )
- ecbuild_source_flags( ${_PAR_TARGET}_Fortran_SOURCE_FLAGS
- ${_PAR_TARGET}_f
- "${_PAR_FFLAGS}"
- "${${_PAR_TARGET}_f_srcs}" )
-
- ecbuild_debug("ecbuild_add_executable(${_PAR_TARGET}): setting source file Fortran flags from ${${_PAR_TARGET}_Fortran_SOURCE_FLAGS}")
- include( ${${_PAR_TARGET}_Fortran_SOURCE_FLAGS} )
-
- elseif( 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_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()
# define VERSION if requested
@@ -298,6 +222,11 @@ 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 )
diff --git a/cmake/ecbuild_add_extra_search_paths.cmake b/cmake/ecbuild_add_extra_search_paths.cmake
index 9404f74..fac96ba 100644
--- a/cmake/ecbuild_add_extra_search_paths.cmake
+++ b/cmake/ecbuild_add_extra_search_paths.cmake
@@ -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 )
- # ecbuild_debug_var( CMAKE_PREFIX_PATH )
+ # debug_var( CMAKE_PREFIX_PATH )
endfunction()
diff --git a/cmake/ecbuild_add_library.cmake b/cmake/ecbuild_add_library.cmake
index 2a047e9..dc47956 100644
--- a/cmake/ecbuild_add_library.cmake
+++ b/cmake/ecbuild_add_library.cmake
@@ -16,10 +16,7 @@
#
# ecbuild_add_library( TARGET <name>
# SOURCES <source1> [<source2> ...]
-# [ SOURCES_GLOB <glob1> [<glob2> ...] ]
-# [ SOURCES_EXCLUDE_REGEX <regex1> [<regex2> ...] ]
-# [ TYPE SHARED|STATIC|MODULE|OBJECT ]
-# [ OBJECTS <obj1> [<obj2> ...] ]
+# [ TYPE SHARED|STATIC|MODULE ]
# [ TEMPLATES <template1> [<template2> ...] ]
# [ LIBS <library1> [<library2> ...] ]
# [ INCLUDES <path1> [<path2> ...] ]
@@ -58,17 +55,6 @@
# :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
@@ -149,7 +135,7 @@ 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 SOURCES_GLOB SOURCES_EXCLUDE_REGEX OBJECTS TEMPLATES LIBS INCLUDES PRIVATE_INCLUDES PUBLIC_INCLUDES DEPENDS PERSISTENT DEFINITIONS INSTALL_HEADERS_LIST CFLAGS CXXFLAGS FFLAGS GENERATED CONDITION )
+ set( multi_value_args SOURCES 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} )
@@ -161,8 +147,8 @@ function( ecbuild_add_library_impl )
message(FATAL_ERROR "The call to ecbuild_add_library() doesn't specify the TARGET.")
endif()
- if( NOT _PAR_SOURCES AND NOT _PAR_OBJECTS AND NOT _PAR_SOURCES_GLOB )
- message(FATAL_ERROR "The call to ecbuild_add_library() specifies neither SOURCES nor OBJECTS nor SOURCES_GLOB")
+ if( NOT _PAR_SOURCES )
+ message(FATAL_ERROR "The call to ecbuild_add_library() doesn't specify the SOURCES.")
endif()
### conditional build
@@ -186,9 +172,8 @@ 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 | OBJECT ]" )
+ message( FATAL_ERROR "library type must be one of [ STATIC | SHARED | MODULE ]" )
endif()
ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): library type is ${_PAR_TYPE}")
endif()
@@ -210,25 +195,7 @@ function( ecbuild_add_library_impl )
add_custom_target( ${_PAR_TARGET}_templates SOURCES ${_PAR_TEMPLATES} )
endif()
- # glob sources
- unset( _glob_srcs )
- foreach( pattern ${_PAR_SOURCES_GLOB} )
- ecbuild_list_add_pattern( LIST _glob_srcs GLOB "${pattern}" )
- endforeach()
-
- foreach( pattern ${_PAR_SOURCES_EXCLUDE_REGEX} )
- ecbuild_list_exclude_pattern( LIST _glob_srcs REGEX "${pattern}" )
- endforeach()
-
- # insert already compiled objects (from OBJECT libraries)
- unset( _all_objects )
- foreach( _obj ${_PAR_OBJECTS} )
- list( APPEND _all_objects $<TARGET_OBJECTS:${_obj}> )
- endforeach()
-
- add_library( ${_PAR_TARGET} ${_PAR_TYPE} ${_PAR_SOURCES} ${_glob_srcs} ${_all_objects} )
-
- # ecbuild_echo_target( ${_PAR_TARGET} )
+ add_library( ${_PAR_TARGET} ${_PAR_TYPE} ${_PAR_SOURCES} )
# set OUTPUT_NAME
@@ -339,74 +306,27 @@ function( ecbuild_add_library_impl )
# filter sources
- if( _PAR_SOURCES )
- ecbuild_separate_sources( TARGET ${_PAR_TARGET} SOURCES ${_PAR_SOURCES} )
- endif()
+ ecbuild_separate_sources( TARGET ${_PAR_TARGET} SOURCES ${_PAR_SOURCES} )
- # ecbuild_debug_var( ${_PAR_TARGET}_h_srcs )
- # ecbuild_debug_var( ${_PAR_TARGET}_c_srcs )
- # ecbuild_debug_var( ${_PAR_TARGET}_cxx_srcs )
- # ecbuild_debug_var( ${_PAR_TARGET}_f_srcs )
+ # debug_var( ${_PAR_TARGET}_h_srcs )
+ # debug_var( ${_PAR_TARGET}_c_srcs )
+ # debug_var( ${_PAR_TARGET}_cxx_srcs )
+ # debug_var( ${_PAR_TARGET}_f_srcs )
# add local flags
- if( ${_PAR_TARGET}_c_srcs )
-
- if( ECBUILD_SOURCE_FLAGS )
- ecbuild_source_flags( ${_PAR_TARGET}_C_SOURCE_FLAGS
- ${_PAR_TARGET}_c
- "${_PAR_CFLAGS}"
- "${${_PAR_TARGET}_c_srcs}" )
-
- ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): setting source file C flags from ${${_PAR_TARGET}_C_SOURCE_FLAGS}")
- include( ${${_PAR_TARGET}_C_SOURCE_FLAGS} )
-
- elseif( 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_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( ${_PAR_TARGET}_cxx_srcs )
-
- if( ECBUILD_SOURCE_FLAGS )
- ecbuild_source_flags( ${_PAR_TARGET}_CXX_SOURCE_FLAGS
- ${_PAR_TARGET}_cxx
- "${_PAR_CXXFLAGS}"
- "${${_PAR_TARGET}_cxx_srcs}" )
-
- ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): setting source file CXX flags from ${${_PAR_TARGET}_CXX_SOURCE_FLAGS}")
- include( ${${_PAR_TARGET}_CXX_SOURCE_FLAGS} )
-
- elseif( 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_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( ${_PAR_TARGET}_f_srcs )
-
- if( ECBUILD_SOURCE_FLAGS )
- ecbuild_source_flags( ${_PAR_TARGET}_Fortran_SOURCE_FLAGS
- ${_PAR_TARGET}_f
- "${_PAR_FFLAGS}"
- "${${_PAR_TARGET}_f_srcs}" )
-
- ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): setting source file Fortran flags from ${${_PAR_TARGET}_Fortran_SOURCE_FLAGS}")
- include( ${${_PAR_TARGET}_Fortran_SOURCE_FLAGS} )
-
- elseif( 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_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 )
@@ -418,9 +338,9 @@ function( ecbuild_add_library_impl )
set_property( TARGET ${_PAR_TARGET} PROPERTY LINKER_LANGUAGE ${_PAR_LINKER_LANGUAGE} )
endif()
- # installation (except for OBJECT libraries)
+ # installation
- if( NOT _PAR_NOINSTALL AND NOT _PAR_TYPE MATCHES "OBJECT" )
+ if( NOT _PAR_NOINSTALL )
ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): installing to ${INSTALL_LIB_DIR}")
# and associate with defined component
@@ -501,9 +421,7 @@ function( ecbuild_add_library_impl )
endif()
# make sure target is removed before - some problems with AIX
- if( NOT _PAR_TYPE MATCHES "OBJECT" )
- add_custom_command( TARGET ${_PAR_TARGET} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E remove $<TARGET_FILE:${_PAR_TARGET}> )
- endif()
+ add_custom_command( TARGET ${_PAR_TARGET} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E remove $<TARGET_FILE:${_PAR_TARGET}> )
# for the links target
if( NOT _PAR_NOINSTALL )
diff --git a/cmake/ecbuild_add_option.cmake b/cmake/ecbuild_add_option.cmake
index 0590bab..7728716 100644
--- a/cmake/ecbuild_add_option.cmake
+++ b/cmake/ecbuild_add_option.cmake
@@ -167,9 +167,9 @@ macro( ecbuild_add_option )
set( pkgproject 0 )
endif()
- # ecbuild_debug_var( pkg )
- # ecbuild_debug_var( pkglist )
- # ecbuild_debug_var( pkgname )
+ # debug_var( pkg )
+ # debug_var( pkglist )
+ # debug_var( pkgname )
string( TOUPPER ${pkgname} pkgUPPER )
string( TOLOWER ${pkgname} pkgLOWER )
@@ -223,9 +223,9 @@ macro( ecbuild_add_option )
endif()
- # ecbuild_debug_var( ${pkgname}_FOUND )
- # ecbuild_debug_var( ${pkgLOWER}_FOUND )
- # ecbuild_debug_var( ${pkgUPPER}_FOUND )
+ # debug_var( ${pkgname}_FOUND )
+ # debug_var( ${pkgLOWER}_FOUND )
+ # debug_var( ${pkgUPPER}_FOUND )
# we have feature if all required packages were FOUND
diff --git a/cmake/ecbuild_add_persistent.cmake b/cmake/ecbuild_add_persistent.cmake
index 0e1fdbf..96c160d 100644
--- a/cmake/ecbuild_add_persistent.cmake
+++ b/cmake/ecbuild_add_persistent.cmake
@@ -1,8 +1,8 @@
# (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
+# 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,7 +44,7 @@ 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} )
@@ -71,7 +71,7 @@ macro( ecbuild_add_persistent )
set( file ${_file_dir}/${_file_we} )
endif()
- # ecbuild_debug_var(file)
+ # 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_test.cmake b/cmake/ecbuild_add_test.cmake
index b9b93ec..6ae839a 100644
--- a/cmake/ecbuild_add_test.cmake
+++ b/cmake/ecbuild_add_test.cmake
@@ -16,7 +16,6 @@
#
# ecbuild_add_test( [ TARGET <name> ]
# [ SOURCES <source1> [<source2> ...] ]
-# [ OBJECTS <obj1> [<obj2> ...] ]
# [ COMMAND <executable> ]
# [ TYPE EXE|SCRIPT|PYTHON ]
# [ ARGS <argument1> [<argument2> ...] ]
@@ -49,9 +48,6 @@
# 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)
#
@@ -131,7 +127,7 @@ 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 OBJECTS LIBS INCLUDES TEST_DEPENDS DEPENDS ARGS
+ set( multi_value_args SOURCES LIBS INCLUDES TEST_DEPENDS DEPENDS ARGS
PERSISTENT DEFINITIONS RESOURCES TEST_DATA CFLAGS
CXXFLAGS FFLAGS GENERATED CONDITION ENVIRONMENT )
@@ -270,13 +266,9 @@ macro( ecbuild_add_test )
endif()
endif()
- # insert already compiled objects (from OBJECT libraries)
- unset( _all_objects )
- foreach( _obj ${_PAR_OBJECTS} )
- list( APPEND _all_objects $<TARGET_OBJECTS:${_obj}> )
- endforeach()
+ # add the test target
- add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} ${_all_objects} )
+ add_executable( ${_PAR_TARGET} ${_PAR_SOURCES} )
# add extra dependencies
if( DEFINED _PAR_DEPENDS)
diff --git a/cmake/ecbuild_bundle.cmake b/cmake/ecbuild_bundle.cmake
index 3e1af0d..2d9b779 100644
--- a/cmake/ecbuild_bundle.cmake
+++ b/cmake/ecbuild_bundle.cmake
@@ -61,7 +61,7 @@ endmacro()
# Declare a subproject to be built as part of this bundle. ::
#
# ecbuild_bundle( PROJECT <name>
-# STASH <repository> | GIT <giturl> | SOURCE <path>
+# STASH <repository> | GIT <giturl>
# [ BRANCH <gitbranch> | TAG <gittag> ]
# [ UPDATE | NOREMOTE ] )
# [ MANUAL ] )
@@ -72,15 +72,12 @@ endmacro()
# PROJECT : required
# project name for the Git repository to be managed
#
-# STASH : cannot be combined with GIT or SOURCE
+# STASH : cannot be combined with GIT, either is required
# Stash repository in the form <project>/<repository>
#
-# GIT : cannot be combined with STASH or SOURCE
+# URL : cannot be combined with STASH, either is required
# 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
#
@@ -107,10 +104,6 @@ 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
@@ -126,28 +119,23 @@ endmacro()
macro( ecbuild_bundle )
set( options )
- set( single_value_args PROJECT STASH GIT SOURCE )
+ set( single_value_args PROJECT STASH GIT )
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}" )
+ message( STATUS "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} )
- elseif( _PAR_SOURCE )
- if( DEFINED ${PNAME}_SOURCE )
- ecbuild_critical( "ecbuild_bundle called with SOURCE for project ${_PAR_PROJECT} but ${PNAME}_SOURCE is defined" )
+ 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} )
endif()
- execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink ${_PAR_SOURCE} ${PROJECT_SOURCE_DIR}/${_PAR_PROJECT} )
- endif()
- ecbuild_use_package( PROJECT ${_PAR_PROJECT} )
+ ecbuild_use_package( PROJECT ${_PAR_PROJECT} )
endif()
endmacro()
diff --git a/cmake/ecbuild_check_cxx_source_return.cmake b/cmake/ecbuild_check_cxx_source_return.cmake
index 8f96f61..e364918 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.
-#
+#
# This software is 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.
@@ -93,9 +93,9 @@ 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}" )
@@ -107,11 +107,11 @@ 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 )
-
- # ecbuild_debug_var( ${_p_VAR}_COMPILED )
- # ecbuild_debug_var( ${_p_VAR}_EXITCODE )
+
+ # debug_var( ${_p_VAR}_COMPILED )
+ # debug_var( ${_p_VAR}_EXITCODE )
# if it did not compile make the return value fail code of 1
@@ -125,21 +125,21 @@ macro( ecbuild_check_cxx_source_return SOURCE )
# 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
+ 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
+ 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_functions.cmake b/cmake/ecbuild_check_functions.cmake
index 25f9d62..a3ed7a1 100644
--- a/cmake/ecbuild_check_functions.cmake
+++ b/cmake/ecbuild_check_functions.cmake
@@ -1,8 +1,8 @@
# (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
+# 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.
@@ -73,10 +73,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 +114,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 +164,8 @@ if( ENABLE_OS_FUNCTIONS_TEST )
endif()
ecbuild_cache_var( EC_HAVE_PROCFS )
-# ecbuild_debug_var(EC_HAVE_PROCFS)
-# ecbuild_debug_var(EC_HAVE_PROCFS_OUTPUT)
+# debug_var(EC_HAVE_PROCFS)
+# debug_var(EC_HAVE_PROCFS_OUTPUT)
endif()
diff --git a/cmake/ecbuild_debug_var.cmake b/cmake/ecbuild_debug_var.cmake
new file mode 100644
index 0000000..9bb3499
--- /dev/null
+++ b/cmake/ecbuild_debug_var.cmake
@@ -0,0 +1,47 @@
+# (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 23e835d..11052c6 100644
--- a/cmake/ecbuild_declare_project.cmake
+++ b/cmake/ecbuild_declare_project.cmake
@@ -69,8 +69,8 @@ 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 )
- # ecbuild_debug_var( ${PNAME}_GIT_SHA1 )
- # ecbuild_debug_var( ${PNAME}_GIT_SHA1_SHORT )
+ # debug_var( ${PNAME}_GIT_SHA1 )
+ # debug_var( ${PNAME}_GIT_SHA1_SHORT )
else()
message( STATUS "Could not get git-sha1 for project ${PNAME}")
endif()
@@ -101,11 +101,11 @@ macro( ecbuild_declare_project )
set( ${PNAME}_VERSION_STR "${${PROJECT_NAME}_VERSION_STR}"
CACHE INTERNAL "package ${PNAME} version string" ) # ignore caps
- # 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 )
+ # debug_var( ${PNAME}_VERSION )
+ # debug_var( ${PNAME}_VERSION_STR )
+ # debug_var( ${PNAME}_MAJOR_VERSION )
+ # debug_var( ${PNAME}_MINOR_VERSION )
+ # debug_var( ${PNAME}_PATCH_VERSION )
# install dirs for this project
@@ -151,7 +151,7 @@ macro( ecbuild_declare_project )
CACHE INTERNAL "${PNAME} ${p} full install path" )
endif()
- # ecbuild_debug_var( ${PNAME}_FULL_INSTALL_${p}_DIR )
+ # debug_var( ${PNAME}_FULL_INSTALL_${p}_DIR )
endforeach()
@@ -162,7 +162,7 @@ macro( ecbuild_declare_project )
if( ENABLE_RELATIVE_RPATHS )
file( RELATIVE_PATH relative_rpath ${${PNAME}_FULL_INSTALL_BIN_DIR} ${${PNAME}_FULL_INSTALL_LIB_DIR} )
- # ecbuild_debug_var( relative_rpath )
+ # debug_var( relative_rpath )
ecbuild_append_to_rpath( ${relative_rpath} )
@@ -171,14 +171,14 @@ 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()
- # ecbuild_debug_var( CMAKE_INSTALL_RPATH )
+ # debug_var( CMAKE_INSTALL_RPATH )
# print project header
diff --git a/cmake/ecbuild_echo_targets.cmake b/cmake/ecbuild_echo_targets.cmake
index 217a196..ddaa2e4 100644
--- a/cmake/ecbuild_echo_targets.cmake
+++ b/cmake/ecbuild_echo_targets.cmake
@@ -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)
+ #if(s)
message("tgt='${tgt}' prop='${prop}'")
message(" value='${v}'")
message(" defined='${d}'")
message(" set='${s}'")
message("")
- endif()
+ #endif()
cmake_policy(POP)
@@ -207,7 +207,7 @@ XCODE_ATTRIBUTE_WHATEVER
message("======================== ${tgt} ========================")
foreach(p ${props})
- ecbuild_echo_target_property("${tgt}" "${p}")
+ ecbuild_echo_target_property("${t}" "${p}")
endforeach()
message("")
endfunction()
diff --git a/cmake/ecbuild_features.cmake b/cmake/ecbuild_features.cmake
index 7c7bafa..5d619a5 100644
--- a/cmake/ecbuild_features.cmake
+++ b/cmake/ecbuild_features.cmake
@@ -10,6 +10,10 @@
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 )
@@ -22,17 +26,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}" )
@@ -43,21 +47,21 @@ 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)
+function( ecbuild_set_feature_description _name _desc)
set_property(GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION "${_desc}" )
endfunction()
@@ -77,11 +81,11 @@ function( ecbuild_set_feature _name )
set(multiValueArgs ) # none
CMAKE_PARSE_ARGUMENTS( _PAR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
-
- get_property( _feature_desc GLOBAL PROPERTY _CMAKE_${_name}_DESCRIPTION )
+
+ 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_enable_feature( ${_name} )
@@ -89,7 +93,7 @@ function( ecbuild_set_feature _name )
ecbuild_disable_feature( ${_name} )
endif()
endif()
-
+
ecbuild_enabled_features( _enabled_features )
list (FIND _enabled_features "${_name}" _index)
if (${_index} GREATER -1)
@@ -101,15 +105,15 @@ 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} )
endif()
diff --git a/cmake/ecbuild_find_package.cmake b/cmake/ecbuild_find_package.cmake
index 9616720..b67b51d 100644
--- a/cmake/ecbuild_find_package.cmake
+++ b/cmake/ecbuild_find_package.cmake
@@ -103,7 +103,7 @@ macro( ecbuild_find_package )
message(FATAL_ERROR "Call to ecbuild_find_package() requests EXACT but doesn't specify VERSION.")
endif()
- # ecbuild_debug_var( _PAR_NAME )
+ # debug_var( _PAR_NAME )
string( TOUPPER ${_PAR_NAME} pkgUPPER )
string( TOLOWER ${_PAR_NAME} pkgLOWER )
diff --git a/cmake/ecbuild_find_python.cmake b/cmake/ecbuild_find_python.cmake
index dde6c06..c001a7b 100644
--- a/cmake/ecbuild_find_python.cmake
+++ b/cmake/ecbuild_find_python.cmake
@@ -28,12 +28,11 @@
# Output variables
# ----------------
#
-# The following CMake variables are set if python was found:
+# The following CMake variables are set if perl 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
@@ -65,7 +64,7 @@ macro( ecbuild_find_python )
find_package( PythonInterp )
if( NOT PYTHONINTERP_FOUND AND _p_REQUIRED )
- ecbuild_error( "Failed to find any Python interpreter (REQUIRED)" )
+ message( FATAL_ERROR "Failed to find any Python interpreter (REQUIRED)" )
endif()
# find python version
@@ -75,10 +74,10 @@ macro( ecbuild_find_python )
# endif()
# endif()
- # ecbuild_debug( "Python version ${PYTHON_VERSION_STRING}" )
- # ecbuild_debug_var(PYTHON_VERSION_MAJOR)
- # ecbuild_debug_var(PYTHON_VERSION_MINOR)
- # ecbuild_debug_var(PYTHON_VERSION_PATCH)
+ # 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}" )
@@ -103,16 +102,14 @@ macro( ecbuild_find_python )
find_program( PYTHON_CONFIG NAMES python-config python-config${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} )
endif()
- ecbuild_debug_var( PYTHON_CONFIG )
-
# 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
@@ -125,12 +122,12 @@ macro( ecbuild_find_python )
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}")
@@ -141,22 +138,18 @@ macro( ecbuild_find_python )
# Remove duplicate include directories
list(REMOVE_DUPLICATES PYTHON_INCLUDE_DIR)
+ # 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} )
- if( PYTHON_LIBRARIES AND PYTHON_INCLUDE_DIR )
- # 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 output variables
- # set output variables
-
- 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}" )
-
- endif()
+ 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}" )
set( PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR} )
set( PYTHON_INCLUDE_PATH ${PYTHON_INCLUDE_DIR} )
@@ -169,22 +162,16 @@ macro( ecbuild_find_python )
# 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()
+ 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()
- ecbuild_debug_var( PYTHONINTERP_FOUND )
- ecbuild_debug_var( PYTHON_FOUND )
- ecbuild_debug_var( PYTHON_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 )
+# 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 )
diff --git a/cmake/ecbuild_generate_fortran_interfaces.cmake b/cmake/ecbuild_generate_fortran_interfaces.cmake
deleted file mode 100644
index d57d89a..0000000
--- a/cmake/ecbuild_generate_fortran_interfaces.cmake
+++ /dev/null
@@ -1,115 +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.
-
-##############################################################################
-#.rst:
-#
-# ecbuild_generate_fortran_interfaces
-# ===================================
-#
-# Generates interfaces form 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 )
- message( FATAL_ERROR "ecbuild_generate_fortran_interfaces: fcm executable not found." )
- endif()
-
- set( FCM_CONFIG_FILE "${PROJECT_SOURCE_DIR}/cmake/fcm-make-interfaces.cfg")
-
- if( NOT EXISTS ${FCM_CONFIG_FILE} )
- message( FATAL_ERROR "ecbuild_generate_fortran_interfaces: needs fcm configuration in ${FCM_CONFIG_FILE}" )
- endif()
-
- set( options )
- set( single_value_args TARGET DESTINATION PARALLEL INCLUDE_DIRS GENERATED SOURCE_DIR )
- set( multi_value_args DIRECTORIES )
-
- cmake_parse_arguments( P "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
-
- if( NOT DEFINED P_TARGET )
- message( FATAL_ERROR "ecbuild_generate_fortran_interfaces: TARGET argument missing" )
- endif()
-
- if( NOT DEFINED P_DESTINATION )
- message( FATAL_ERROR "ecbuild_generate_fortran_interfaces: DESTINATION argument missing" )
- endif()
-
- if( NOT DEFINED P_DIRECTORIES )
- message( FATAL_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()
-
- if( NOT DEFINED P_SOURCE_DIR )
- message( FATAL_ERROR "ecbuild_generate_fortran_interfaces: SOURCE_DIR argument missing")
- 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_get_resources.cmake b/cmake/ecbuild_get_resources.cmake
index d79ee59..da824d9 100644
--- a/cmake/ecbuild_get_resources.cmake
+++ b/cmake/ecbuild_get_resources.cmake
@@ -1,8 +1,8 @@
# (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
+# 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.
@@ -29,7 +29,7 @@ macro( ecbuild_get_resources )
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 )
-# ecbuild_debug_var( r )
-# ecbuild_debug_var( rh )
+# debug_var( r )
+# 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 0920133..8106c65 100644
--- a/cmake/ecbuild_get_test_data.cmake
+++ b/cmake/ecbuild_get_test_data.cmake
@@ -151,10 +151,10 @@ function( ecbuild_get_test_data )
set( _p_DIRNAME ${PROJECT_NAME}/${currdir} )
endif()
-# ecbuild_debug_var( _p_TARGET )
-# ecbuild_debug_var( _p_NAME )
-# ecbuild_debug_var( _p_URL )
-# ecbuild_debug_var( _p_DIRNAME )
+# debug_var( _p_TARGET )
+# debug_var( _p_NAME )
+# debug_var( _p_URL )
+# debug_var( _p_DIRNAME )
# download the data
@@ -326,9 +326,9 @@ function( ecbuild_get_test_multidata )
message(FATAL_ERROR "ecbuild_get_test_data() expects a TARGET")
endif()
-# ecbuild_debug_var( _p_TARGET )
-# ecbuild_debug_var( _p_NAME )
-# ecbuild_debug_var( _p_DIRNAME )
+# debug_var( _p_TARGET )
+# debug_var( _p_NAME )
+# debug_var( _p_DIRNAME )
if( _p_EXTRACT )
set( _extract EXTRACT )
@@ -372,11 +372,11 @@ endfunction()\n\n" )
set( _md5 MD5 ${_md5} )
endif()
- #ecbuild_debug_var(_f)
- #ecbuild_debug_var(_file)
- #ecbuild_debug_var(_dirname)
- #ecbuild_debug_var(_name)
- #ecbuild_debug_var(_md5)
+ #debug_var(_f)
+ #debug_var(_file)
+ #debug_var(_dirname)
+ #debug_var(_name)
+ #debug_var(_md5)
ecbuild_get_test_data(
TARGET __get_data_${_p_TARGET}_${_name}
diff --git a/cmake/ecbuild_links_target.cmake b/cmake/ecbuild_links_target.cmake
index bd9fe6c..c881c0d 100644
--- a/cmake/ecbuild_links_target.cmake
+++ b/cmake/ecbuild_links_target.cmake
@@ -63,11 +63,11 @@ macro( ecbuild_define_links_target )
add_custom_target( links DEPENDS ${ec_link_libs} ${ec_link_exes} )
- # ecbuild_debug_var( EC_ALL_EXES )
- # ecbuild_debug_var( ec_link_exes )
+ # debug_var( EC_ALL_EXES )
+ # debug_var( ec_link_exes )
- # ecbuild_debug_var( EC_ALL_LIBS )
- # ecbuild_debug_var( ec_link_libs )
+ # debug_var( EC_ALL_LIBS )
+ # debug_var( ec_link_libs )
endif()
diff --git a/cmake/ecbuild_list_add_pattern.cmake b/cmake/ecbuild_list_add_pattern.cmake
deleted file mode 100644
index 382b0c3..0000000
--- a/cmake/ecbuild_list_add_pattern.cmake
+++ /dev/null
@@ -1,94 +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.
-
-##############################################################################
-#.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} )
- file( GLOB_RECURSE matched_files ${pattern} )
- else()
-
- if(_p_SOURCE_DIR)
- if( IS_ABSOLUTE ${_p_SOURCE_DIR} )
- file( GLOB_RECURSE matched_files ${_p_SOURCE_DIR}/${pattern} )
- else()
- file( GLOB_RECURSE matched_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${_p_SOURCE_DIR}/${pattern} )
- endif()
- else()
- file( GLOB_RECURSE matched_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${pattern} )
- endif()
-
- endif()
-
- endforeach()
-
- if(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 ${_p_GLOB}" )
- endif()
- endif()
-
-endfunction(ecbuild_list_add_pattern)
diff --git a/cmake/ecbuild_list_exclude_pattern.cmake b/cmake/ecbuild_list_exclude_pattern.cmake
deleted file mode 100644
index 399f7f1..0000000
--- a/cmake/ecbuild_list_exclude_pattern.cmake
+++ /dev/null
@@ -1,88 +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.
-
-##############################################################################
-#.rst:
-#
-# ecbuild_list_exclude_pattern
-# ============================
-#
-# Exclude items from a list that match a list of patterns. ::
-#
-# ecbuild_list_remove_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)
- message(FATAL_ERROR "Unknown keywords given to ecbuild_list_exclude_pattern(): \"${_p_UNPARSED_ARGUMENTS}\"")
- endif()
-
- if( NOT _p_LIST )
- message(FATAL_ERROR "The call to ecbuild_list_exclude_pattern() doesn't specify the LIST.")
- endif()
-
- if( NOT _p_REGEX )
- message(FATAL_ERROR "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)
\ No newline at end of file
diff --git a/cmake/ecbuild_list_extra_search_paths.cmake b/cmake/ecbuild_list_extra_search_paths.cmake
index c120b40..0768a48 100644
--- a/cmake/ecbuild_list_extra_search_paths.cmake
+++ b/cmake/ecbuild_list_extra_search_paths.cmake
@@ -17,8 +17,8 @@ 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_debug_var( pkg )
- # ecbuild_debug_var( var )
+ # debug_var( pkg )
+ # 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 )
-# ecbuild_debug_var( ${var} )
+# debug_var( ${var} )
endfunction()
diff --git a/cmake/ecbuild_list_macros.cmake b/cmake/ecbuild_list_macros.cmake
index 95d9512..a4152c7 100644
--- a/cmake/ecbuild_list_macros.cmake
+++ b/cmake/ecbuild_list_macros.cmake
@@ -1,8 +1,8 @@
# (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
+# 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,3 +56,35 @@ 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 b398ade..fbb2349 100644
--- a/cmake/ecbuild_log.cmake
+++ b/cmake/ecbuild_log.cmake
@@ -70,7 +70,7 @@ set(ECBUILD_ERROR 40)
set(ECBUILD_CRITICAL 50)
if( NOT DEFINED ECBUILD_LOG_LEVEL )
- set(ECBUILD_LOG_LEVEL ${ECBUILD_INFO})
+ set(ECBUILD_LOG_LEVEL ${ECBUILD_WARN})
elseif( NOT ECBUILD_LOG_LEVEL )
set(ECBUILD_LOG_LEVEL 60)
elseif( ECBUILD_LOG_LEVEL STREQUAL "DEBUG" )
@@ -127,67 +127,3 @@ macro( ecbuild_critical MSG )
message(FATAL_ERROR "${BoldMagenta}CRITICAL - ${MSG}${ColourReset}")
endif()
endmacro( ecbuild_critical )
-
-##############################################################################
-# macro for debugging a cmake variable
-
-macro( ecbuild_debug_var VAR )
- if( ECBUILD_LOG_LEVEL LESS 11)
- message(STATUS "${Blue}DEBUG - ${VAR} : ${${VAR}}${ColourReset}")
- endif()
-endmacro()
-
-##############################################################################
-# macro for debugging a cmake variable
-
-macro( ecbuild_debug_list VAR )
- if( ECBUILD_LOG_LEVEL LESS 11)
- message( STATUS "${Blue}DEBUG - ${VAR}" )
- foreach( _elem ${${VAR}} )
- message( STATUS " ${_elem}" )
- endforeach()
- message(STATUS "${ColourReset}")
- endif()
-endmacro()
-
-##############################################################################
-# macro for debugging a environment variable within cmake
-
-macro( ecbuild_debug_env_var VAR )
- if( ECBUILD_LOG_LEVEL LESS 11)
- message(STATUS "${Blue}DEBUG - ENV ${VAR} [$ENV{${VAR}}]${ColourReset}")
- endif()
-endmacro()
-
-##############################################################################
-# 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_policies.cmake b/cmake/ecbuild_policies.cmake
index e420e81..06f856b 100644
--- a/cmake/ecbuild_policies.cmake
+++ b/cmake/ecbuild_policies.cmake
@@ -6,17 +6,13 @@
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.
-##############################################################################
-#
-# ecBuild Policies
-# ================
+###############################################################################
+# define cmake 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 5394ad8..d4bffba 100644
--- a/cmake/ecbuild_print_summary.cmake
+++ b/cmake/ecbuild_print_summary.cmake
@@ -89,7 +89,7 @@ macro( ecbuild_print_summary )
### FEATURE SUMMARY
- # ecbuild_debug_var( CMAKE_VERSION )
+ # debug_var( CMAKE_VERSION )
if( ${CMAKE_VERSION} VERSION_LESS "2.8.6" )
feature_summary( WHAT ALL )
else()
diff --git a/cmake/ecbuild_project_files.cmake b/cmake/ecbuild_project_files.cmake
index 537556a..fbf3015 100644
--- a/cmake/ecbuild_project_files.cmake
+++ b/cmake/ecbuild_project_files.cmake
@@ -1,8 +1,8 @@
# (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
+# 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} )
- # ecbuild_debug_var( _afile )
+ # debug_var( _afile )
get_property( _src_gen SOURCE ${_afile} PROPERTY GENERATED )
diff --git a/cmake/ecbuild_separate_sources.cmake b/cmake/ecbuild_separate_sources.cmake
index 3f930b3..55c6d8f 100644
--- a/cmake/ecbuild_separate_sources.cmake
+++ b/cmake/ecbuild_separate_sources.cmake
@@ -83,9 +83,9 @@ macro( ecbuild_separate_sources )
endif()
endforeach()
-# 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}_f_srcs )
+# debug_var( ${_PAR_TARGET}_h_srcs )
+# debug_var( ${_PAR_TARGET}_c_srcs )
+# debug_var( ${_PAR_TARGET}_cxx_srcs )
+# debug_var( ${_PAR_TARGET}_f_srcs )
endmacro( ecbuild_separate_sources )
diff --git a/cmake/ecbuild_setup_test_framework.cmake b/cmake/ecbuild_setup_test_framework.cmake
index f38bafb..538a433 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 AND CMAKE_CXX_COMPILER_LOADED )
+if( ENABLE_TESTS )
# Try to find compiled boost
@@ -39,7 +39,3 @@ if( ENABLE_TESTS AND CMAKE_CXX_COMPILER_LOADED )
endif()
endif()
-
-if( NOT ENABLE_TESTS )
- ecbuild_info("Tests have been disabled")
-endif()
\ No newline at end of file
diff --git a/cmake/ecbuild_source_flags.cmake b/cmake/ecbuild_source_flags.cmake
deleted file mode 100644
index 325a941..0000000
--- a/cmake/ecbuild_source_flags.cmake
+++ /dev/null
@@ -1,30 +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.
-
-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}" )
-
- set( ${OUT} ${OUTFILE} PARENT_SCOPE )
-
-endfunction()
diff --git a/cmake/ecbuild_system.cmake b/cmake/ecbuild_system.cmake
index 02f23ef..ca4f4fa 100644
--- a/cmake/ecbuild_system.cmake
+++ b/cmake/ecbuild_system.cmake
@@ -28,7 +28,7 @@ endif()
########################################################################################################
# ecbuild versioning support
-set( ECBUILD_CMAKE_MINIMUM "2.8.10" )
+set( ECBUILD_CMAKE_MINIMUM "2.8.4" )
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()
@@ -152,10 +152,9 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
############################################################################################
# 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 )
@@ -168,7 +167,6 @@ 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 )
@@ -204,7 +202,6 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
include( ecbuild_find_fortranlibs )
include( ecbuild_git )
include( ecbuild_enable_fortran )
- include( ecbuild_source_flags )
include( ecbuild_bundle )
include( ecbuild_pkgconfig )
include( ecbuild_cache )
diff --git a/cmake/ecbuild_use_package.cmake b/cmake/ecbuild_use_package.cmake
index c34f07d..acbe495 100644
--- a/cmake/ecbuild_use_package.cmake
+++ b/cmake/ecbuild_use_package.cmake
@@ -105,7 +105,6 @@ 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 )
@@ -120,7 +119,7 @@ macro( ecbuild_use_package )
if( DEFINED ${pkgUPPER}_SOURCE )
if( NOT EXISTS ${${pkgUPPER}_SOURCE} OR NOT EXISTS ${${pkgUPPER}_SOURCE}/CMakeLists.txt )
- ecbuild_critical("User defined source directory '${${pkgUPPER}_SOURCE}' for project '${_p_PROJECT}' does not exist or does not contain a CMakeLists.txt file.")
+ message( FATAL_ERROR "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}" )
@@ -222,15 +221,15 @@ macro( ecbuild_use_package )
# test version for Cases 1,2,3
- # 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_ )
+ # 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_ )
if( _p_VERSION AND _do_version_check )
if( _p_EXACT )
diff --git a/cmake/gen_source_flags.py b/cmake/gen_source_flags.py
deleted file mode 100644
index 26073c3..0000000
--- a/cmake/gen_source_flags.py
+++ /dev/null
@@ -1,70 +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.
-
-"""
-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 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(source)
- flags = default_flags.split()
- for pattern, op in rules:
- if fnmatch(source, pattern):
-
- log.debug(' -> %10s matches %20s with %s', pattern, source, op[1:])
-
- if op[0] == "+":
- log.debug(' appending %s', op[1:])
- flags += [flag for flag in op[1:] if flag not in flags]
-
- if op[0] == "=":
- log.debug(' setting %s', op[1:])
- flags = []
- flags += [flag for flag in op[1:] if flag not in flags]
-
- if op[0] == "/":
- log.debug(' removing %s', op[1:])
- for flag in op[1:]:
- flags.remove(flag)
-
- 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)))
-
-
-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/data/intf2_O640_to_F48.grib b/data/intf2_O640_to_F48.grib
index 2b07975..9c24dc2 100644
Binary files a/data/intf2_O640_to_F48.grib and b/data/intf2_O640_to_F48.grib differ
diff --git a/data/intf2_O640_to_F80.grib b/data/intf2_O640_to_F80.grib
index 138c437..d089784 100644
Binary files a/data/intf2_O640_to_F80.grib and b/data/intf2_O640_to_F80.grib differ
diff --git a/data/intf2_O640_to_regular_ll.grib b/data/intf2_O640_to_regular_ll.grib
index 8696042..72b3eec 100644
Binary files a/data/intf2_O640_to_regular_ll.grib and b/data/intf2_O640_to_regular_ll.grib differ
diff --git a/data/intf2_sh_vod_to_F48.grib b/data/intf2_sh_vo-d_to_F48.grib
similarity index 100%
rename from data/intf2_sh_vod_to_F48.grib
rename to data/intf2_sh_vo-d_to_F48.grib
diff --git a/data/intf2_sh_vod_to_F80.grib b/data/intf2_sh_vo-d_to_F80.grib
similarity index 100%
rename from data/intf2_sh_vod_to_F80.grib
rename to data/intf2_sh_vo-d_to_F80.grib
diff --git a/data/intf2_sh_vod_to_N80.grib b/data/intf2_sh_vo-d_to_N80.grib
similarity index 100%
rename from data/intf2_sh_vod_to_N80.grib
rename to data/intf2_sh_vo-d_to_N80.grib
diff --git a/data/intf2_sh_vod_to_O80.grib b/data/intf2_sh_vo-d_to_O80.grib
similarity index 100%
rename from data/intf2_sh_vod_to_O80.grib
rename to data/intf2_sh_vo-d_to_O80.grib
diff --git a/data/intf2_sh_vod_to_regular_ll.grib b/data/intf2_sh_vo-d_to_regular_ll.grib
similarity index 100%
rename from data/intf2_sh_vod_to_regular_ll.grib
rename to data/intf2_sh_vo-d_to_regular_ll.grib
diff --git a/data/intf2_sh_vod_to_rotated_regular_ll.grib b/data/intf2_sh_vo-d_to_rotated_regular_ll.grib
similarity index 100%
rename from data/intf2_sh_vod_to_rotated_regular_ll.grib
rename to data/intf2_sh_vo-d_to_rotated_regular_ll.grib
diff --git a/data/intuvp2_sh_vod_to_F80.grib b/data/intuvp2_sh_vo-d_to_F80.grib
similarity index 100%
rename from data/intuvp2_sh_vod_to_F80.grib
rename to data/intuvp2_sh_vo-d_to_F80.grib
diff --git a/data/intuvp2_sh_vod_to_N80.grib b/data/intuvp2_sh_vo-d_to_N80.grib
similarity index 100%
rename from data/intuvp2_sh_vod_to_N80.grib
rename to data/intuvp2_sh_vo-d_to_N80.grib
diff --git a/data/intuvp2_sh_vod_to_O80.grib b/data/intuvp2_sh_vo-d_to_O80.grib
similarity index 100%
rename from data/intuvp2_sh_vod_to_O80.grib
rename to data/intuvp2_sh_vo-d_to_O80.grib
diff --git a/data/intuvp2_sh_vod_to_regular_ll.grib b/data/intuvp2_sh_vo-d_to_regular_ll.grib
similarity index 100%
rename from data/intuvp2_sh_vod_to_regular_ll.grib
rename to data/intuvp2_sh_vo-d_to_regular_ll.grib
diff --git a/data/intuvp2_sh_vo-d_to_rotated_regular_ll.grib b/data/intuvp2_sh_vo-d_to_rotated_regular_ll.grib
new file mode 100644
index 0000000..bab7561
Binary files /dev/null and b/data/intuvp2_sh_vo-d_to_rotated_regular_ll.grib differ
diff --git a/data/sh_vod.grib b/data/sh_vo-d.grib
similarity index 100%
rename from data/sh_vod.grib
rename to data/sh_vo-d.grib
diff --git a/interpolation/0-INDEX-0 b/interpolation/0-INDEX-0
index 13044be..19b9b06 100644
--- a/interpolation/0-INDEX-0
+++ b/interpolation/0-INDEX-0
@@ -25,6 +25,7 @@ getconf.F mac Decides how to handle legendre coefficien
gettru.F
gghtype.F mac Return Gaussian grid type, from field representation, grid number and array with the number of points at each latitude
ggintrp.F mac Finds value at a point by interpolation in a gaussian field
+gglonlat.F mac Returns the bilinear/nearest neighbour-interpolated value at a specific position, given a global, unrotated Gaussian grid description. Weights/distances are calculated in lon/lat space.
ggrotat.F mac Generates a rotated gaussian grid
ggvalue.F mac Rotates one line of latitude in a gaussian grid
global.F
@@ -55,6 +56,9 @@ hpshgpw.F mac Rotates grid about y-axis and calculates
hrg2gg.F mac Rotated gauss from reduced gauss using 12-point interpolation
hrg2ggw.F mac Rotated U and V gauss from reduced gauss using 12-point interpolation
hsh2gg.F mac Finds a suitable Gaussian grid and/or spectral truncation for a given spectral truncation and/or lat/long increments
+hsp2gg.F mac This routine finds a suitable Gaussian grid for a given spectral truncation
+hsp2gg2.F mac This routine finds a suitable Gaussian grid and spectral truncation for given North-South/East-West increments
+hsp2gg3.F mac This routine finds a suitable spectral truncation for a given Gaussian grid description
hwts12.F mac Interpolation weightings for horizontal interpolation
hwtsll.F mac Interpolation lat/lon weightings for horizontal interpolation
hwtslsm.F mac As hwts12.F but using land-sea masks
@@ -115,7 +119,6 @@ intuvxh.F mac Interpolate wind component spectral field
intuvy.F
intvecy.F
intwave2.F
-isggvalid.F mac Checks if a Gaussian grid definition is valid
intwavu.F
irdiwe.F mac Calculate distance between points in long array and its W/E neighbours for a quasi regular input and regular field
irgmem.F mac Acquires heap space for quasi regular to regular
@@ -127,6 +130,7 @@ irlsmb.F mac Calculate effects of land-sea mask on unn
irprec.F mac Extra interpolation for precipitation when input is quasi regular
irsize.F mac Evaluate array sizes for a quasi reg gaussian
iscrsz.F mac Calculate scratch space size for unpacking GRIBs
+isggvalid.F mac Checks if a Gaussian grid definition is valid
islproc.F mac Generates point from four neighbours using lsm types
issame.F mac Check whether input and output fields are same
issameiarray.F mac Check if two integer arrays have the same entries
diff --git a/interpolation/CMakeLists.txt b/interpolation/CMakeLists.txt
index d92f13a..fffceb6 100644
--- a/interpolation/CMakeLists.txt
+++ b/interpolation/CMakeLists.txt
@@ -31,6 +31,7 @@ list( APPEND interpolation_src_files
gettru.F
gghtype.F
ggintrp.F
+ gglonlat.F
ggrotat.F
ggvalue.F
global.F
@@ -57,6 +58,9 @@ list( APPEND interpolation_src_files
hrg2gg.F
hrg2ggw.F
hsh2gg.F
+ hsp2gg.F
+ hsp2gg2.F
+ hsp2gg3.F
hwts12.F
hwtsll.F
hwtslsm.F
diff --git a/interpolation/gasetup.F b/interpolation/gasetup.F
index 09c4041..d05a11e 100644
--- a/interpolation/gasetup.F
+++ b/interpolation/gasetup.F
@@ -85,7 +85,7 @@ C
C Local variables
C
LOGICAL LIROTAT, LOROTAT
- INTEGER ILOOP, ITEMP
+ INTEGER ITEMP
REAL RTEMP
C
C***********************************************************************
@@ -117,6 +117,10 @@ C
C
LOROTAT = ((NOROTA(1).NE.-9000000).AND.(NOROTA(1).NE.0)).OR.
X (NOROTA(2).NE.0)
+ X .OR. (NOREPR.EQ.JPSPHROT .OR.
+ X NOREPR.EQ.JPREGROT .OR.
+ X NOREPR.EQ.JPFGGROT .OR.
+ X NOREPR.EQ.JPQGGROT)
C
C***********************************************************************
C Section 2. Setup output product section 2.
@@ -217,7 +221,7 @@ C
KSEC2(4) = ITEMP
RTEMP = RSEC2(7)
RSEC2(7) = RSEC2(4)
- RSEC2(4) = ITEMP
+ RSEC2(4) = RTEMP
KSEC2(11) = 0
ELSE
KSEC2(11) = 64
@@ -428,8 +432,8 @@ C For reduced grid, move in number of points along each parallel
C
IF( (NOREPR.EQ.JPQUASI) .OR.
X (NOREPR.EQ.JPQGGROT) ) THEN
- DO ILOOP = 1, KSEC2(3)
- KSEC2(22+ILOOP) = NOLPTS(ILOOP)
+ DO ITEMP = 1, KSEC2(3)
+ KSEC2(22+ITEMP) = NOLPTS(ITEMP)
ENDDO
ENDIF
C
diff --git a/interpolation/gglonlat.F b/interpolation/gglonlat.F
new file mode 100644
index 0000000..d7f11eb
--- /dev/null
+++ b/interpolation/gglonlat.F
@@ -0,0 +1,236 @@
+C Copyright 1981-2015 ECMWF.
+C
+C This software is licensed under the terms of the Apache Licence
+C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+C
+C In applying this licence, ECMWF does not waive the privileges and immunities
+C granted to it by virtue of its status as an intergovernmental organisation
+C nor does it submit to any jurisdiction.
+C
+
+ REAL FUNCTION GGLONLAT(KNUM,PLAT,KPTS,FIELD,MISSVALUE,NN,LON,LAT)
+C
+C---->
+C**** GGLONLAT
+C
+C PURPOSE
+C _______
+C
+C Returns the bilinear/nearest neighbour-interpolated value at a
+C specific position, given a global, unrotated Gaussian grid
+C description. Weights/distances are calculated in lon/lat space.
+C
+C
+C INTERFACE
+C _________
+C
+C RRET = GGLONLAT(KNUM,PLAT,KPTS,FIELD,MISSVALUE,NN,LON,LAT)
+C
+C
+C Input parameters
+C ________________
+C
+C KNUM - Gaussian grid number
+C PLAT - ... latitudes array (length 2*KNUM), both hemispheres
+C KPTS - ... number of points array at each latitude (length
+C 2*KNUM), both hemispheres
+C FIELD - Gaussian field values array (length SUM(KPTS(:)))
+C MISSVALUE - Value to return if interpolation fails
+C NN - If non-zero, perform nearest neighbour interpolation
+C LON - Requested interpolation point longitude
+C LAT - ... latitude
+C
+C Return value
+C ____________
+C
+C Bilinear/nearest neighbour interpolated value, missing value if
+C not successful or any interpolating values missing.
+C
+C
+C----<
+ IMPLICIT NONE
+
+C Arguments
+ INTEGER KNUM, KPTS(*)
+ INTEGER NN
+ REAL PLAT(*), FIELD(*), MISSVALUE, LON, LAT
+
+C Local variables
+ INTEGER J1, J3, I, J, M
+ REAL DLAT1, DLAT3, PLON(4), A, B, ZSOUTH, ZNORTH
+ REAL V(4), W(4) ! field values and weights around int. point
+
+
+C Initialize
+ GGLONLAT = MISSVALUE
+ V = MISSVALUE
+ PLON = 0.
+
+
+C Set North-neighboring indices:
+C row idices J1: LAT <= PLAT(J1)
+C abs indices I1/I2: LON(I1) <= LON <= LON(I2)
+C longitudes: PLON(1) <= LON <= PLON(2)
+ I = 1
+ J1 = 1
+ DO J = 2, KNUM*2
+ IF (PLAT(J)<LAT) GOTO 100
+ I = I + KPTS(J-1)
+ J1 = J
+ ENDDO
+100 CONTINUE
+
+ A = REAL(360.)/REAL(KPTS(J1)) ! increment length
+ M = FLOOR(LON/A) ! n. full increments up to LON
+ DO WHILE (M.GE.KPTS(J1))
+ M = M - KPTS(J1) ! guarantee M*increment < 360.
+ ENDDO
+ PLON(1) = REAL( M )*A
+ PLON(2) = REAL(M+1)*A
+
+ V(1) = FIELD( I+M )
+ V(2) = FIELD( I+MOD(M+1,KPTS(J1)) )
+
+
+C Set South-neighboring indices (start with previous row results):
+C row idices J3: PLAT(J3) <= LAT
+C abs indices I3/I4: LON(I3) <= LON <= LON(I4)
+C longitudes: PLON(3) <= LON <= PLON(4)
+ J3 = J1
+ PLON(3:4) = PLON(1:2)
+ V (3:4) = V (1:2)
+ IF ( LAT.LT.PLAT(J1) .AND. LAT.GT.PLAT(MIN(J1+1,2*KNUM)) ) THEN
+ I = I + KPTS(J1)
+ J3 = MIN(J1+1,2*KNUM)
+
+ A = REAL(360.)/REAL(KPTS(J3)) ! increment length
+ M = FLOOR(LON/A)
+ DO WHILE (M.GE.KPTS(J3))
+ M = M - KPTS(J3) ! guarantee M*increment < 360.
+ ENDDO
+ PLON(3) = REAL( M )*A
+ PLON(4) = REAL(M+1)*A
+
+ V(3) = FIELD( I+M )
+ V(4) = FIELD( I+MOD(M+1,KPTS(J3)) )
+ ENDIF
+
+
+C Calculate weights (nn/any-missing/bilinear/linear cases)
+ IF (NN.NE.0) THEN
+
+C Nearest neighbour interpolation
+ W(1:2) = (PLAT(J1)-LAT)**2 + (PLON(1:2)-LON)**2 ! sq. distance
+ W(3:4) = (PLAT(J3)-LAT)**2 + (PLON(3:4)-LON)**2 ! ...
+ J = 1
+ DO I = 2, 4
+ IF ( V(I).NE.MISSVALUE .AND. W(I).LT.W(J) ) J = I
+ ENDDO
+ GGLONLAT = V(J)
+
+ ELSEIF ( V(1).EQ.MISSVALUE .OR. V(2).EQ.MISSVALUE .OR.
+ . V(3).EQ.MISSVALUE .OR. V(4).EQ.MISSVALUE ) THEN
+
+C (some values are missing, nothing to do)
+
+ ELSEIF (J1.NE.J3) THEN
+
+#if 0
+C Method 1:
+C Bi-linear interpolation is calculated in lon/lat space, with the
+C following distribution of weights:
+C
+C
+C (V(1))--------(X12)------------(V(2)) (row J1)
+C / W(4) | W(3) \
+C (X13)--------(LON,LAT)-----------(X24)
+C / | \
+C / W(2) | W(1) \
+C / | \
+C (V(3))-------------(X34)--------------------(V(4)) (row J3)
+C
+C with weights corresponding to the relative areas of the opposite
+C quadrilateral subdivisions:
+C W(1) = A( P, X(2,4), X(3,4), 4 ) / A(1,2,3,4)
+C W(2) = A( X(1,3), P, 3, X(3,4) ) / A(1,2,3,4)
+C W(3) = A( X(1,2), 2, P, X(2,4) ) / A(1,2,3,4)
+C W(4) = A( 1, X(1,2), X(1,3), P ) / A(1,2,3,4)
+
+ A = (PLON(2)-PLON(4))/(PLAT(J1)-PLAT(J3))
+ B = (PLAT(J1)*PLON(4)-PLAT(J3)*PLON(2))/(PLAT(J1)-PLAT(J3))
+ W(1) = (LAT-PLAT(J3)) * (A*(LAT+PLAT(J3))/2.+B-LON)
+ W(3) = (PLAT(J1)-LAT) * (A*(LAT+PLAT(J1))/2.+B-LON)
+
+ A = (PLON(1)-PLON(3))/(PLAT(J1)-PLAT(J3))
+ B = (PLAT(J1)*PLON(3)-PLAT(J3)*PLON(1))/(PLAT(J1)-PLAT(J3))
+ W(2) = (LAT-PLAT(J3)) * (LON-A*(LAT+PLAT(J3))/2.+B)
+ W(4) = (PLAT(J1)-LAT) * (LON-A*(LAT+PLAT(J1))/2.+B)
+#elif 0
+C Method 2:
+C Bi-linear interpolation is calculated in lon/lat space, with the
+C following distribution of weights:
+C
+C
+C (V(1))----------+--------------(V(2)) (row J1)
+C | W(4) | W(3) |
+C +---+---------(LON,LAT)-------------+------+
+C | | |
+C | W(2) | W(1) |
+C | | |
+C (V(3))---------------+----------------------(V(4)) (row J3)
+C
+C with weights corresponding to the relative areas of the opposite
+C quadrilateral subdivisions.
+
+ W(1) = (LAT-PLAT(J3))*(PLON(4)-LON)
+ W(2) = (LAT-PLAT(J3))*(LON-PLON(3))
+ W(3) = (PLAT(J1)-LAT)*(PLON(2)-LON)
+ W(4) = (PLAT(J1)-LAT)*(LON-PLON(1))
+#else
+C Method 3:
+C Bi-linear interpolation is calculated in lon/lat space, with the
+C following distribution of weights (Emoslib emulation):
+C
+C
+C (V(1))----------+--------------(V(2)) (row J1)
+C | W(4) | W(3) |
+C +---+---------(LON,LAT)-------------+------+
+C | | |
+C | W(2) | W(1) |
+C | | |
+C (V(3))---------------+----------------------(V(4)) (row J3)
+C
+C with weights corresponding to the relative areas of the opposite
+C quadrilateral subdivisions.
+
+ DLAT1 = REAL(NINT( PLAT(J1) * 100000 )) !PLAT(J1)
+ DLAT3 = REAL(NINT( PLAT(J3) * 100000 )) !PLAT(J3)
+ DLAT1 = DLAT1 - REAL(NINT( LAT * 100000 ))
+ DLAT3 = REAL(NINT( LAT * 100000 )) - DLAT3
+
+ ZSOUTH = PLON(4)-PLON(3)
+ ZNORTH = PLON(2)-PLON(1)
+
+ W(1) = DLAT3 * (PLON(4)-LON) !* ZSOUTH
+ W(2) = DLAT3 * (LON-PLON(3)) !* ZSOUTH
+ W(3) = DLAT1 * (PLON(2)-LON) !* ZNORTH
+ W(4) = DLAT1 * (LON-PLON(1)) !* ZNORTH
+
+#endif
+
+ A = W(1)+W(2)+W(3)+W(4)
+ W = W/A
+ GGLONLAT = V(1)*W(1) + V(2)*W(2) + V(3)*W(3) + V(4)*W(4)
+
+ ELSE
+
+C Linear interpolation
+ W(1) = (PLON(2)-LON) / (PLON(2)-PLON(1))
+ W(2) = 1-W(1)
+
+ GGLONLAT = V(1)*W(1) + V(2)*W(2)
+
+ ENDIF
+
+
+ END
diff --git a/interpolation/hgetlsm.F b/interpolation/hgetlsm.F
index cc0afa5..5210907 100644
--- a/interpolation/hgetlsm.F
+++ b/interpolation/hgetlsm.F
@@ -57,7 +57,6 @@ C
C Externals
C ---------
C
-C GETENV - Read environment variable
C INTLOG - Log error message.
C PBOPEN - Open land-sea mask file
C PBREAD - Read land-sea mask file
diff --git a/interpolation/hntfaph.F b/interpolation/hntfaph.F
index 6fb27be..bf0b840 100644
--- a/interpolation/hntfaph.F
+++ b/interpolation/hntfaph.F
@@ -150,11 +150,11 @@ C
C Externals
C
CHARACTER*1 GGHTYPE
- INTEGER HSH2GG, HIRLAM, HIRLSM, HRG2GG, FIXAREA, PDDEFS, AURESOL
+ INTEGER HSH2GG, HIRLAM, HIRLSM, HRG2GG, FIXAREA, PDDEFS
INTEGER HLL2LL
LOGICAL LSMFLD
EXTERNAL GGHTYPE
- EXTERNAL HSH2GG, HIRLAM, HIRLSM, HRG2GG, FIXAREA, PDDEFS, AURESOL
+ EXTERNAL HSH2GG, HIRLAM, HIRLSM, HRG2GG, FIXAREA, PDDEFS
EXTERNAL HLL2LL
EXTERNAL LSMFLD
C
diff --git a/interpolation/hntfauh.F b/interpolation/hntfauh.F
index 0c5b56c..a29de6e 100644
--- a/interpolation/hntfauh.F
+++ b/interpolation/hntfauh.F
@@ -147,10 +147,10 @@ C
C Externals
C
CHARACTER*1 GGHTYPE
- INTEGER HSH2GG, HIRLAM, HIRLSM, HRG2GG, FIXAREA, PDDEFS, AURESOL
+ INTEGER HSH2GG, HIRLAM, HIRLSM, HRG2GG, FIXAREA, PDDEFS
LOGICAL LSMFLD
EXTERNAL GGHTYPE
- EXTERNAL HSH2GG, HIRLAM, HIRLSM, HRG2GG, FIXAREA, PDDEFS, AURESOL
+ EXTERNAL HSH2GG, HIRLAM, HIRLSM, HRG2GG, FIXAREA, PDDEFS
EXTERNAL LSMFLD
C
diff --git a/interpolation/hntfaus.F b/interpolation/hntfaus.F
index 311a1e4..3017410 100644
--- a/interpolation/hntfaus.F
+++ b/interpolation/hntfaus.F
@@ -66,8 +66,6 @@ C
C Externals
C ---------
C
-C GRIBEX - Decode/encode GRIB product.
-C GRSVCK - Turn off GRIB checking
C INTLOG - Log error message.
C INTLOGR - Log error message.
C RPHI - Rotate a spectral field by longitude.
diff --git a/interpolation/hsh2gg.F b/interpolation/hsh2gg.F
index 4f95f18..3d8910b 100644
--- a/interpolation/hsh2gg.F
+++ b/interpolation/hsh2gg.F
@@ -195,7 +195,7 @@ C from a given Gaussian number (KNUM) find a truncation (KTRUNC)
IF( KNUM.NE. 48 .AND. KNUM.NE. 80 .AND. KNUM.NE. 96 .AND.
. KNUM.NE. 128 .AND. KNUM.NE. 160 .AND. KNUM.NE. 200 .AND.
. KNUM.NE. 256 .AND. KNUM.NE. 320 .AND. KNUM.NE. 400 .AND.
- . KNUM.NE. 640 .AND. KNUM.NE.1024 ) THEN
+ . KNUM.NE. 640 .AND. KNUM.NE.1024 .AND. KNUM.NE.1280 ) THEN
CALL INTLOG(JP_ERROR,'HSH2GG: Gaussian number unsupported',KNUM)
HSH2GG = 2
GOTO 900
@@ -224,6 +224,8 @@ C KTRUNC = 213
KTRUNC = 1279 ! Jan Haseler
ELSEIF( KNUM.EQ.1024 ) THEN
KTRUNC = 2047 ! Mariano
+ ELSEIF( KNUM.EQ.1280 ) THEN
+ KTRUNC = 1279 ! (cubic octahedral)
ENDIF
ENDIF
diff --git a/interpolation/hsp2gg.F b/interpolation/hsp2gg.F
new file mode 100644
index 0000000..3d68dbc
--- /dev/null
+++ b/interpolation/hsp2gg.F
@@ -0,0 +1,75 @@
+C Copyright 1981-2015 ECMWF.
+C
+C This software is licensed under the terms of the Apache Licence
+C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+C
+C In applying this licence, ECMWF does not waive the privileges and immunities
+C granted to it by virtue of its status as an intergovernmental organisation
+C nor does it submit to any jurisdiction.
+C
+
+ INTEGER FUNCTION HSP2GG(KTRUNC,KGAUSS,KPTS,PLATS,KSIZE)
+C
+C---->
+C**** HSP2GG
+C
+C Purpose
+C -------
+C This routine finds a suitable Gaussian grid for a given
+C spectral truncation.
+C
+C
+C Interface
+C ---------
+C IRET = HSP2GG(KTRUNC,KGAUSS,KPTS,PLATS,KSIZE)
+C
+C
+C Input parameters
+C ----------------
+C KTRUNC - spectral truncation
+C
+C
+C Output parameters
+C -----------------
+C KGAUSS - Gaussian grid number
+C HTYPE - Gaussian grid type
+C = 'R' for reduced ("quasi-regular"),
+C = 'O' for reduced/octahedral,
+C = 'F' for full,
+C = 'U' for a user-defined Gaussian grid
+C KPTS - array giving number of points along each line of latitude
+C in the reduced Gaussian grid (both hemispheres)
+C PLATS - array giving Gaussian latitudes (both hemispheres)
+C KSIZE - number of points in the reduced Gaussian grid
+C
+C Returns 0 if all OK, otherwise there is an error.
+C
+C
+C Externals
+C ---------
+C HSH2GG - Finds a suitable Gaussian grid and/or spectral truncation
+C for a given spectral truncation and/or lat/long increments.
+C
+C----<
+ IMPLICIT NONE
+
+!#include "parim.h"
+
+C Arguments
+ INTEGER KTRUNC, KGAUSS, KPTS(*), KSIZE
+ REAL PLATS(*)
+
+C Externals
+ INTEGER HSH2GG
+
+C Local variables
+ REAL NS, EW
+ CHARACTER*1 HTYPE
+
+ NS = 0.
+ EW = 0.
+
+ KGAUSS = 0 ! output
+ HTYPE = '' ! output
+ HSP2GG = HSH2GG(NS,EW,KTRUNC,KGAUSS,HTYPE,KPTS,PLATS,KSIZE)
+ END
diff --git a/interpolation/hsp2gg2.F b/interpolation/hsp2gg2.F
new file mode 100644
index 0000000..8549647
--- /dev/null
+++ b/interpolation/hsp2gg2.F
@@ -0,0 +1,75 @@
+C Copyright 1981-2015 ECMWF.
+C
+C This software is licensed under the terms of the Apache Licence
+C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+C
+C In applying this licence, ECMWF does not waive the privileges and immunities
+C granted to it by virtue of its status as an intergovernmental organisation
+C nor does it submit to any jurisdiction.
+C
+
+ INTEGER FUNCTION HSP2GG2(KTRUNC,NS,EW,KGAUSS,KPTS,PLATS,KSIZE)
+C
+C---->
+C**** HSP2GG2
+C
+C Purpose
+C -------
+C This routine finds a suitable Gaussian grid and spectral
+C truncation for given North-South/East-West increments.
+C
+C
+C Interface
+C ---------
+C IRET = HSP2GG2(KTRUNC,NS,EW,KGAUSS,KPTS,PLATS,KSIZE)
+C
+C
+C Input parameters
+C ----------------
+C NS - North-South increment
+C EW - East-West increment
+C
+C
+C Output parameters
+C -----------------
+C KTRUNC - spectral truncation
+C KGAUSS - Gaussian grid number
+C HTYPE - Gaussian grid type
+C = 'R' for reduced ("quasi-regular"),
+C = 'O' for reduced/octahedral,
+C = 'F' for full,
+C = 'U' for a user-defined Gaussian grid
+C KPTS - array giving number of points along each line of latitude
+C in the reduced Gaussian grid (both hemispheres)
+C PLATS - array giving Gaussian latitudes (both hemispheres)
+C KSIZE - number of points in the reduced Gaussian grid
+C
+C Returns 0 if all OK, otherwise there is an error.
+C
+C
+C Externals
+C ---------
+C HSH2GG - Finds a suitable Gaussian grid and/or spectral truncation
+C for a given spectral truncation and/or lat/long increments.
+C
+C----<
+ IMPLICIT NONE
+
+!#include "parim.h"
+!#include "jparams.h"
+
+C Arguments
+ INTEGER KTRUNC, KGAUSS, KPTS(*), KSIZE
+ REAL NS, EW, PLATS(*)
+
+C Externals
+ INTEGER HSH2GG
+
+C Local variables
+ CHARACTER*1 HTYPE
+
+ KTRUNC = 0 ! output
+ KGAUSS = 0 ! output
+ HTYPE = '' ! output
+ HSP2GG2 = HSH2GG(NS,EW,KTRUNC,KGAUSS,HTYPE,KPTS,PLATS,KSIZE)
+ END
diff --git a/interpolation/hsp2gg3.F b/interpolation/hsp2gg3.F
new file mode 100644
index 0000000..8dec55c
--- /dev/null
+++ b/interpolation/hsp2gg3.F
@@ -0,0 +1,76 @@
+C Copyright 1981-2015 ECMWF.
+C
+C This software is licensed under the terms of the Apache Licence
+C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+C
+C In applying this licence, ECMWF does not waive the privileges and immunities
+C granted to it by virtue of its status as an intergovernmental organisation
+C nor does it submit to any jurisdiction.
+C
+
+ INTEGER FUNCTION HSP2GG3(KTRUNC,KGAUSS,KPTS,PLATS,KSIZE)
+C
+C---->
+C**** HSP2GG3
+C
+C Purpose
+C -------
+C This routine finds a suitable spectral truncation for a given
+C Gaussian grid description.
+C
+C
+C Interface
+C ---------
+C IRET = HSP2GG3(KTRUNC,KGAUSS,KPTS,PLATS,KSIZE)
+C
+C
+C Input parameters
+C ----------------
+C KGAUSS - Gaussian grid number
+C HTYPE - Gaussian grid type
+C = 'R' for reduced ("quasi-regular"),
+C = 'O' for reduced/octahedral,
+C = 'F' for full,
+C = 'U' for a user-defined Gaussian grid
+C
+C
+C Output parameters
+C -----------------
+C KTRUNC - spectral truncation
+C KPTS - array giving number of points along each line of latitude
+C in the reduced Gaussian grid (both hemispheres)
+C PLATS - array giving Gaussian latitudes (both hemispheres)
+C KSIZE - number of points in the reduced Gaussian grid
+C
+C Returns 0 if all OK, otherwise there is an error.
+C
+C
+C Externals
+C ---------
+C HSH2GG - Finds a suitable Gaussian grid and/or spectral truncation
+C for a given spectral truncation and/or lat/long increments.
+C
+C----<
+ IMPLICIT NONE
+
+!#include "parim.h"
+!#include "jparams.h"
+
+C Arguments
+ INTEGER KTRUNC, KGAUSS, KPTS(*), KSIZE
+ REAL PLATS(*)
+
+C Externals
+ INTEGER HSH2GG
+
+C Local variables
+ REAL NS, EW
+ CHARACTER*1 HTYPE
+
+ NS = 0.
+ EW = 0.
+ HTYPE = 'R'
+
+ KTRUNC = 0 ! output
+ HSP2GG3 = HSH2GG(NS,EW,KTRUNC,KGAUSS,HTYPE,KPTS,PLATS,KSIZE)
+ END
diff --git a/interpolation/igdiwe.F b/interpolation/igdiwe.F
index c1f8b6f..c7c0a05 100644
--- a/interpolation/igdiwe.F
+++ b/interpolation/igdiwe.F
@@ -78,22 +78,27 @@ C Arguments
C Local variables
INTEGER I, J, IA, IB
- LOGICAL LSTAGGL, LSUBAR ! (to avoid globals)
+ LOGICAL LSTAGGL, LSUBAR, LSUBARO ! (to avoid globals)
C Arguments & local variables (FIXME: remove)
INTEGER KILONG(KIWE+1), KOLONG(KOWE)
LOGICAL OWEGLOBE
INTEGER IBASE, ILOW, IUP
- REAL LO, LO1, LO2
+ REAL LO, LO1, LO2, IDELTA, ODELTA
C NOTE: subarea/staggered definition copied from areachk.F:218
+C testing shows that:
+C LGLOBL = .NOT. LSUBARO
+C OWEGLOBE = .NOT. LSUBAR
+ LSUBARO = (OAREA(1).NE.0) .AND. (OAREA(2).NE.0) .AND.
+ . (OAREA(3).NE.0) .AND. (OAREA(4).NE.0)
LSUBAR = (IAREA(1).NE.0) .AND. (IAREA(2).NE.0) .AND.
. (IAREA(3).NE.0) .AND. (IAREA(4).NE.0)
LSTAGGL = (LSUBAR) .AND.
. (IABS(JP360 - IAREA(4) - IAREA(2)).LT.1000)
- IF( LSTAGGL .OR. LSUBAR .OR. .NOT. LGLOBL ) THEN
+ IF( LSTAGGL .OR. LSUBAR ) THEN
! CALL INTLOG(JP_DEBUG,
! . 'IGDIWE: Staggered grids not supported', JPQUIET )
@@ -249,29 +254,64 @@ C fit within the input grid.
CALL INTLOG(JP_DEBUG,'IGDIWE: algorithm: new :-)',JPQUIET)
- DO J = 1, KOWE
+ IF( LGLOBL ) THEN
- I = FLOOR( REAL((J-1)*KIWE)/REAL(KOWE) ) + 1
- KWEIND (JP_I_W,J) = I
- KWEIND (JP_I_E,J) = MOD(I,KIWE)+1
+ DO J = 1, KOWE
+
+ I = FLOOR( REAL((J-1)*KIWE)/REAL(KOWE) ) + 1
+ KWEIND (JP_I_W,J) = I
+ KWEIND (JP_I_E,J) = MOD(I,KIWE)+1
+
+!C original:
+! IKIWE = JP360 / KIWE
+! IKOWE = JP360 / KOWE
+! IA = (J-1)*IKOWE - (I-1)*IKIWE
+! IB = ( I )*IKIWE - (J-1)*IKOWE ! (same as: IKIWE - A)
-!C original:
-! IKIWE = JP360 / KIWE
-! IKOWE = JP360 / KOWE
-! IA = (J-1)*IKOWE - (I-1)*IKIWE
-! IB = ( I )*IKIWE - (J-1)*IKOWE ! (same as: IKIWE - A)
+ IA = (J-1)*KIWE - (I-1)*KOWE
+ IB = ( I )*KOWE - (J-1)*KIWE
- IA = (J-1)*KIWE - (I-1)*KOWE
- IB = ( I )*KOWE - (J-1)*KIWE
+!C adimensionalize from KIWE*KOWE space (optional):
+! IA = INT( REAL(IA*JP360)*REAL(KIWE*KOWE) )
+! IB = INT( REAL(IB*JP360)*REAL(KIWE*KOWE) )
-!C adimensionalize from KIWE*KOWE space (optional):
-! IA = INT( REAL(IA*JP360)*REAL(KIWE*KOWE) )
-! IB = INT( REAL(IB*JP360)*REAL(KIWE*KOWE) )
+ KWEDIST(JP_I_W,J) = IA
+ KWEDIST(JP_I_E,J) = IB
+
+ ENDDO
- KWEDIST(JP_I_W,J) = IA
- KWEDIST(JP_I_E,J) = IB
+ ELSE
+
+C (this also works globally, but it isn't precision-independent)
+C set grid increments
+ IDELTA = REAL(360)/REAL(KIWE)
+ ODELTA = REAL(360)/REAL(KOWE)
+ IF( .NOT.LGLOBL ) THEN
+ ODELTA = REAL(OAREA(4)-OAREA(2))/REAL(JPMULT*(KOWE-1))
+ ENDIF
+
+ LO1 = REAL(OAREA(2))/REAL(JPMULT)
+ DO J = 1, KOWE
- ENDDO
+ LO = REAL(J-1)*ODELTA + LO1
+ DO WHILE (LO.LT.0.)
+ LO = LO + 360.
+ ENDDO
+
+ I = MOD(FLOOR( LO/IDELTA ),KIWE) + 1
+ KWEIND (JP_I_W,J) = I
+ KWEIND (JP_I_E,J) = MOD(I,KIWE)+1
+
+ IA = INT(REAL(JPMULT)*(LO-REAL(I-1)*IDELTA ))
+ !IB = INT(REAL(JPMULT)*( REAL( I )*IDELTA-LO)) (same as below)
+ IB = INT(REAL(JPMULT)*IDELTA) - IA
+
+ KWEDIST(JP_I_W,J) = IA
+ KWEDIST(JP_I_E,J) = IB
+
+ ENDDO
+
+ ENDIF
IGDIWE = 0
ENDIF
diff --git a/interpolation/iglsmb.F b/interpolation/iglsmb.F
index 2207d77..00c91ac 100644
--- a/interpolation/iglsmb.F
+++ b/interpolation/iglsmb.F
@@ -8,10 +8,8 @@ C granted to it by virtue of its status as an intergovernmental organisation
C nor does it submit to any jurisdiction.
C
- INTEGER FUNCTION IGLSMB(
- X OISTAND, HIFILE, KIREC, KIGRID, KILINE,
- X OOSTAND, HOFILE, KOREC, KOGRID, KOLINE,
- X KPR, KERR )
+ INTEGER FUNCTION IGLSMB( OISTAND, HIFILE, KIREC, KIGRID, KILINE,
+ X OOSTAND, HOFILE, KOREC, KOGRID, KOLINE, KPR, KERR)
C
C---->
C**** *IGLSMB*
@@ -26,10 +24,8 @@ C
C INTERFACE
C ---------
C
-C IERR = IGLSMB(
-C X OISTAND, HIFILE, KIREC, KIGRID, KILINE,
-C X OOSTAND, HOFILE, KOREC, KOGRID, KOLINE,
-C X KPR, KERR )
+C IERR = IGLSMB( OISTAND, HIFILE, KIREC, KIGRID, KILINE, OOSTAND,
+C X HOFILE, KOREC, KOGRID, KOLINE, KPR, KERR)
C
C
C Input parameters
@@ -138,16 +134,17 @@ C
C Externals
C ---------
C
+C ABORTX - Standard routine to kill task.
C IGLSM01 - Read and process one latitude row from the 10
C minute land sea mask.
-C IGLSMR - Calculate the effects of the land-sea masks for
-C one line of latitude on the unnormalised
-C interpolation weights.
+C IGLSMR - Calculate the effects of the land-sea masks for one
+C line of latitude on the unnormalised interpolation
+C weights.
C IGLSMST - Read and process one line of latitude from a
C standard land sea mask file.
C PBCLOSE - Close a land sea mask file after processing.
C PBOPEN - Open a land sea mask file for processing.
-C INTLOG(R) - Log messages.
+C INTLOG(R) - Logs messages.
C JINDEX - Returns length of character string
C
C
@@ -167,13 +164,11 @@ C
C
C Reference
C ---------
-C
C None
C
C
C Comments
C --------
-C
C None
C
C
@@ -202,35 +197,27 @@ C
#include "nofld.common"
#include "grspace.h"
C
-C Parameters
-C
- INTEGER JPROUTINE
- PARAMETER (JPROUTINE = 22400)
-C
-C Function arguments
-C
- LOGICAL OISTAND, OOSTAND
- CHARACTER*256 HIFILE, HOFILE
- INTEGER KIREC, KOREC
- INTEGER KIGRID(2), KOGRID(2)
- INTEGER KILINE(2), KOLINE(2)
- INTEGER KPR, KERR
+C Dummy arguments
+ LOGICAL OISTAND, OOSTAND
+ CHARACTER *(*) HIFILE, HOFILE
+ INTEGER KIREC, KOREC, KPR, KERR
+ INTEGER KIGRID(2), KILINE(2), KOGRID(2), KOLINE(2)
C
C Local variables
-C
- INTEGER IIUNIT, IOUNIT, IIFILE, IOFILE, ILATN, ILATS
- INTEGER IOFF, IPR, IERR, JOLAT, I
- CHARACTER*2 NEWFILE, MSKFILE
-
+ INTEGER IIUNIT, IOUNIT, IIFILE, IOFILE
+ INTEGER ILATN, ILATS, IISTRIDE, IOSTRIDE, IOFF, IPR, IERR
+ INTEGER JOLAT
CHARACTER*256 XHIFILE, XHOFILE
- SAVE XHIFILE, XHOFILE
-
- INTEGER XIIUNIT, XIOUNIT
- DATA XIIUNIT/0/, XIOUNIT/0/
- SAVE XIIUNIT, XIOUNIT
+ CHARACTER*2 NEWFILE, MSKFILE
+ INTEGER XIIUNIT, XIOUNIT, II
+ DATA XIIUNIT/0/
+ DATA XIOUNIT/0/
+ SAVE XHIFILE, XHOFILE, XIIUNIT, XIOUNIT
C
-C External functions
+ INTEGER JPROUTINE
+ PARAMETER (JPROUTINE = 22400)
C
+C External functions
INTEGER IGLSMR, IGLSMST, IGLSM01, JINDEX
C
C -----------------------------------------------------------------|
@@ -247,33 +234,45 @@ C
IOFILE = JINDEX(HOFILE)
C
IF( KPR.GE.1 ) THEN
- CALL INTLOG(JP_DEBUG,'IGLSMB: Input parameters.',JPQUIET)
- CALL INTLOG(JP_DEBUG,'IGLSMB: LSM filename:',JPQUIET)
- CALL INTLOG(JP_DEBUG,HIFILE(1:IIFILE),JPQUIET)
+ CALL INTLOG(JP_DEBUG,'IGLSMB: Input parameters are:',JPQUIET)
+ CALL INTLOG(JP_DEBUG,'IGLSMB: Land sea mask file name:',JPQUIET)
+ CALL INTLOG(JP_DEBUG,HIFILE(1: IIFILE),JPQUIET)
IF( OISTAND ) THEN
- CALL INTLOG(JP_DEBUG,'IGLSMB: Standard fld: TRUE',JPQUIET)
+ CALL INTLOG(JP_DEBUG,'IGLSMB: Stnd fld flag = TRUE',JPQUIET)
ELSE
- CALL INTLOG(JP_DEBUG,'IGLSMB: Standard fld: FALSE',JPQUIET)
+ CALL INTLOG(JP_DEBUG,'IGLSMB: Stnd fld flag = FALSE',JPQUIET)
ENDIF
CALL INTLOG(JP_DEBUG,'IGLSMB: LSM file rec len = ',KIREC)
- CALL INTLOG(JP_DEBUG,'IGLSMB: Grid stride WE = ',KIGRID(1))
- CALL INTLOG(JP_DEBUG,'IGLSMB: Grid stride NS = ',KIGRID(2))
- CALL INTLOG(JP_DEBUG,'IGLSMB: Grid start N = ',KILINE(1))
- CALL INTLOG(JP_DEBUG,'IGLSMB: Grid start W = ',KILINE(2))
-C
- CALL INTLOG(JP_DEBUG,'IGLSMB: Output parameters.',JPQUIET)
- CALL INTLOG(JP_DEBUG,'IGLSMB: LSM filename:',JPQUIET)
- CALL INTLOG(JP_DEBUG,HOFILE(1:IOFILE),JPQUIET)
+ CALL INTLOG(JP_DEBUG,'IGLSMB: The grid stride WE = ',KIGRID(1))
+ CALL INTLOG(JP_DEBUG,'IGLSMB: The grid stride NS = ',KIGRID(2))
+ CALL INTLOG(JP_DEBUG,'IGLSMB: The grid start N = ',KILINE(1))
+ CALL INTLOG(JP_DEBUG,'IGLSMB: The grid start W = ',KILINE(2))
+C
+ CALL INTLOG(JP_DEBUG,'IGLSMB: Output parameters are:',JPQUIET)
+ CALL INTLOG(JP_DEBUG,'IGLSMB: Land sea mask file name:',JPQUIET)
+ CALL INTLOG(JP_DEBUG,HOFILE(1: IIFILE),JPQUIET)
IF( OOSTAND ) THEN
- CALL INTLOG(JP_DEBUG,'IGLSMB: Standard fld: TRUE',JPQUIET)
+ CALL INTLOG(JP_DEBUG,'IGLSMB: Stnd fld flag = TRUE',JPQUIET)
ELSE
- CALL INTLOG(JP_DEBUG,'IGLSMB: Standard fld: FALSE',JPQUIET)
+ CALL INTLOG(JP_DEBUG,'IGLSMB: Stnd fld flag = FALSE',JPQUIET)
ENDIF
CALL INTLOG(JP_DEBUG,'IGLSMB: LSM file rec len = ',KOREC)
- CALL INTLOG(JP_DEBUG,'IGLSMB: Grid stride WE = ',KOGRID(1))
- CALL INTLOG(JP_DEBUG,'IGLSMB: Grid stride NS = ',KOGRID(2))
- CALL INTLOG(JP_DEBUG,'IGLSMB: Grid start N = ',KOLINE(1))
- CALL INTLOG(JP_DEBUG,'IGLSMB: Grid start W = ',KOLINE(2))
+ CALL INTLOG(JP_DEBUG,'IGLSMB: The grid stride WE = ',KOGRID(1))
+ CALL INTLOG(JP_DEBUG,'IGLSMB: The grid stride NS = ',KOGRID(2))
+ CALL INTLOG(JP_DEBUG,'IGLSMB: The grid start N = ',KOLINE(1))
+ CALL INTLOG(JP_DEBUG,'IGLSMB: The grid start W = ',KOLINE(2))
+ ENDIF
+C
+ IF( MILONG(2).GE.MILONG(1) ) THEN
+ IISTRIDE = MILONG(2) - MILONG(1)
+ ELSE
+ IISTRIDE = MILONG(2) + JP360 - MILONG(1)
+ ENDIF
+C
+ IF( MOLONG(2).GE.MOLONG(1) ) THEN
+ IOSTRIDE = MOLONG(2) - MOLONG(1)
+ ELSE
+ IOSTRIDE = MOLONG(2) + JP360 - MOLONG(1)
ENDIF
C
C -----------------------------------------------------------------|
@@ -287,28 +286,28 @@ C
C See if first time through or input land sea mask filename has
C changed since last access
C
- I = JINDEX(HIFILE)
- IF( XHIFILE(1:I).NE.HIFILE(1:I) ) THEN
+ II = JINDEX(HIFILE)
+ IF( XHIFILE(1:II).NE.HIFILE(1:II) ) THEN
C
C Open input land sea mask file
C
- IF(XIIUNIT.NE.0) CALL PBCLOSE(XIIUNIT,IERR)
+ IF( XIIUNIT.NE.0 ) CALL PBCLOSE(XIIUNIT,IERR)
CALL PBOPEN(IIUNIT, HIFILE, 'r', IERR)
IF( IERR.NE.0 ) THEN
IGLSMB = JPROUTINE + 1
C
IF( KERR.GE.0 ) THEN
- CALL INTLOG(JP_ERROR,'IGLSMB: PBOPEN return code = ',IERR)
- CALL INTLOG(JP_ERROR,'IGLSMB: trying to open file',JPQUIET)
- CALL INTLOG(JP_ERROR, HIFILE(1:IIFILE),JPQUIET)
- ENDIF
+ CALL INTLOG(JP_ERROR,'IGLSMB: PBOPEN error = ',IERR)
+ CALL INTLOG(JP_ERROR,'IGLSMB: trying to open file:',JPQUIET)
+ CALL INTLOG(JP_ERROR, HIFILE(1:IIFILE) ,JPQUIET)
C
- IF( KERR.EQ.0 ) CALL INTLOG(JP_FATAL,
- X 'IGLSMB: Interpolation failed.',JPQUIET)
+ IF( KERR.EQ.0 ) CALL INTLOG(JP_FATAL,
+ X 'IGLSMB: Interpolation failed.',JPQUIET)
+ ENDIF
GOTO 900
ENDIF
XIIUNIT = IIUNIT
- XHIFILE(1:I) = HIFILE(1:I)
+ XHIFILE(1:II) = HIFILE(1:II)
NEWFILE(1:1) = 'Y'
C
C Just rewind if same file still in use
@@ -321,29 +320,28 @@ C
C See if first time through or output land sea mask filename has
C changed since last access
C
- I = JINDEX(HOFILE)
- IF( XHOFILE(1:I).NE.HOFILE(1:I) ) THEN
+ II = JINDEX(HOFILE)
+ IF( XHOFILE(1:II).NE.HOFILE(1:II) ) THEN
C
C Open output land sea mask file
C
- IF(XIOUNIT.NE.0) CALL PBCLOSE(XIOUNIT,IERR)
+ IF( XIOUNIT.NE.0 ) CALL PBCLOSE(XIOUNIT,IERR)
CALL PBOPEN(IOUNIT, HOFILE, 'r', IERR)
IF( IERR.NE.0 ) THEN
IGLSMB = JPROUTINE + 1
C
IF( KERR.GE.0 ) THEN
- CALL INTLOG(JP_ERROR,'IGLSMB: PBOPEN return code = ',IERR)
- CALL INTLOG(JP_ERROR,'IGLSMB: trying to open file',JPQUIET)
- CALL INTLOG(JP_ERROR, HOFILE(1:IOFILE),JPQUIET)
+ CALL INTLOG(JP_ERROR,'IGLSMB: PBOPEN error = ',IERR)
+ CALL INTLOG(JP_ERROR,'IGLSMB: trying to open file:',JPQUIET)
+ CALL INTLOG(JP_ERROR, HOFILE(1:IOFILE) ,JPQUIET)
C
+ IF( KERR.EQ.0 ) CALL INTLOG(JP_FATAL,
+ X 'IGLSMB: Interpolation failed.',JPQUIET)
+ GOTO 900
ENDIF
-C
- IF( KERR.EQ.0 ) CALL INTLOG(JP_FATAL,
- X 'IGLSMB: Interpolation failed.',JPQUIET)
- GOTO 900
ENDIF
XIOUNIT = IOUNIT
- XHOFILE(1:I) = HOFILE(1:I)
+ XHOFILE(1:II) = HOFILE(1:II)
NEWFILE(2:2) = 'Y'
C
C Just rewind if same file still in use
@@ -352,7 +350,6 @@ C
IOUNIT = XIOUNIT
NEWFILE(2:2) = 'N'
ENDIF
-C
C -----------------------------------------------------------------|
C* Section 3. Calculate arrays of weights
C -----------------------------------------------------------------|
@@ -375,12 +372,12 @@ C
MSKFILE(2:2) = 'O'
MSKFILE(1:1) = NEWFILE(2:2)
IERR = IGLSMST(IOUNIT, IOFF, NOWE, KOLINE(JPWEST),
- X KOGRID(JPWESTEP), KOREC, MOLSM, MSKFILE)
+ X KOGRID(JPWESTEP), KOREC, MOLSM, MSKFILE)
NEWFILE(2:2) = 'N'
C
ELSE
IERR = IGLSM01(IOUNIT, NOWE, MOLONG, MOLATG(JOLAT),
- X MEXPAND, KOREC, MOLSM)
+ X MEXPAND, KOREC, MOLSM)
ENDIF
C
IF( IERR.GT.0 ) THEN
@@ -401,8 +398,7 @@ C
MSKFILE(2:2) = 'I'
MSKFILE(1:1) = NEWFILE(1:1)
IERR = IGLSMST(IIUNIT, IOFF, NIWE, KILINE(JPWEST),
- X KIGRID(JPWESTEP), KIREC,
- X MILSM(1, JP_I_N), MSKFILE)
+ X KIGRID(JPWESTEP), KIREC, MILSM(1, JP_I_N), MSKFILE)
NEWFILE(1:1) = 'N'
C
IF( IERR.GT.0 ) THEN
@@ -416,8 +412,7 @@ C
MSKFILE(2:2) = 'I'
MSKFILE(1:1) = NEWFILE(1:1)
IERR = IGLSMST(IIUNIT, IOFF, NIWE, KILINE(JPWEST),
- X KIGRID(JPWESTEP), KIREC,
- X MILSM(1, JP_I_S), MSKFILE)
+ X KIGRID(JPWESTEP), KIREC, MILSM(1, JP_I_S), MSKFILE)
NEWFILE(1:1) = 'N'
C
ELSE
@@ -442,9 +437,9 @@ C
C
C Now modify the unormalised weight for land-sea mask
C
- IERR = IGLSMR(MILSM(1, JP_I_N), MILSM(1, JP_I_S),
- X MOLSM, MWEIND, MWEIND, NOWE,
- X WFACT(1,(JOLAT - 1) * NOWE + 1), IPR, KERR)
+ IERR = IGLSMR(MILSM(1, JP_I_N), MILSM(1, JP_I_S), MOLSM,
+ X MWEIND, MWEIND, NOWE, WFACT(1,(JOLAT - 1) * NOWE + 1),
+ X IPR, KERR)
C
IF( IERR.GT.0 ) THEN
IGLSMB = IERR
@@ -463,5 +458,9 @@ C
C
IF( KPR.GE.1 ) CALL INTLOG(JP_DEBUG,'IGLSMB: Section 9.',JPQUIET)
C
+ 9001 FORMAT(' IGLSMB ERROR', I6, ' - ', A, ' returned code', I6 /
+ 1 21X, ' when ', A, 'ing file - ', A)
+C
+C
RETURN
END
diff --git a/interpolation/igsetup.F b/interpolation/igsetup.F
index 9b48888..c865499 100644
--- a/interpolation/igsetup.F
+++ b/interpolation/igsetup.F
@@ -78,8 +78,9 @@ C
C Local variables
C
LOGICAL LIROTAT, LOROTAT
- INTEGER ILOOP, ITEMP
- REAL RSEC2(JPGRIB_ISEC2) ! (not an argument, not necessary ouside)
+ INTEGER ITEMP
+ REAL RTEMP
+ REAL RSEC2(JPGRIB_ISEC2) ! (not an argument, not necessary outside)
C
C***********************************************************************
C Section 1. Startup.
@@ -109,6 +110,10 @@ C
C
LOROTAT = ((NOROTA(1).NE.-9000000).AND.(NOROTA(1).NE.0)).OR.
X (NOROTA(2).NE.0)
+ X .OR. (NOREPR.EQ.JPSPHROT .OR.
+ X NOREPR.EQ.JPREGROT .OR.
+ X NOREPR.EQ.JPFGGROT .OR.
+ X NOREPR.EQ.JPQGGROT)
C
C***********************************************************************
C Section 2. Setup output product section 1.
@@ -254,7 +259,14 @@ C Number of points along a meridian
C
KSEC2(3) = NONS
C
-C Latitude and longitude of first grid point
+C Resolution flag, increments are given
+C
+ KSEC2(6) = 128
+C
+C Latitude and longitude of first/last grid point
+C La1/Lo1 - NOAREA(1): north, NOAREA(2): west
+C La2/Lo2 - NOAREA(3): south, NOAREA(4): east
+C EMOS-214: store REAL values in parallel data structure (real precision), for values that requiring sub-millidegree precision
C
IF( NOAREA(1).GE.0 ) THEN
KSEC2(4) = (NOAREA(1)+(JPMICRO/2)) / JPMICRO
@@ -266,13 +278,6 @@ C
ELSE
KSEC2(5) = (NOAREA(2)-(JPMICRO/2)) / JPMICRO
ENDIF
-C
-C Resolution flag, increments are given
-C
- KSEC2(6) = 128
-C
-C Latitude and longitude of last grid point
-C
IF( NOAREA(3).GE.0 ) THEN
KSEC2(7) = (NOAREA(3)+(JPMICRO/2)) / JPMICRO
ELSE
@@ -283,6 +288,8 @@ C
ELSE
KSEC2(8) = (NOAREA(4)-(JPMICRO/2)) / JPMICRO
ENDIF
+ RSEC2(4:5) = FLOAT(NOAREA(1:2))/JPMULT
+ RSEC2(7:8) = FLOAT(NOAREA(3:4))/JPMULT
C
C Flip latitudes if they run from south to north
C Set scanning mode flags
@@ -292,6 +299,9 @@ C
ITEMP = KSEC2(7)
KSEC2(7) = KSEC2(4)
KSEC2(4) = ITEMP
+ RTEMP = RSEC2(7)
+ RSEC2(7) = RSEC2(4)
+ RSEC2(4) = RTEMP
KSEC2(11) = 0
ELSE
KSEC2(11) = 64
@@ -299,22 +309,22 @@ C
ELSE
KSEC2(11) = NOSCNM
ENDIF
-
-
+C
C i and j direction increments
C EMOS-214: store REAL values in parallel data structure (real precision), for values that requiring sub-millidegree precision
+C
KSEC2( 9) = (NOGRID(1) + (JPMICRO/2)) / JPMICRO
KSEC2(10) = (NOGRID(2) + (JPMICRO/2)) / JPMICRO
- RSEC2( 9) = NOGRID(1)/JPMULT
- RSEC2(10) = NOGRID(2)/JPMULT
-
-
+ RSEC2( 9) = FLOAT(NOGRID(1))/JPMULT
+ RSEC2(10) = FLOAT(NOGRID(2))/JPMULT
+C
C Following left same as for input product
C - no.of vertical coordinate parameters,
C - lat/long of southern pole of rotation
C - lat/long of pole of stretching
C
C If rotated, put in new lat/long of southern pole of rotation
+C EMOS-214: store REAL values in parallel data structure (real precision), for values that requiring sub-millidegree precision
C
IF( LIROTAT.OR.LOROTAT ) THEN
IF( NOROTA(1).GE.0 ) THEN
@@ -327,6 +337,7 @@ C
ELSE
KSEC2(14) = (NOROTA(2) - (JPMICRO/2)) / JPMICRO
ENDIF
+ RSEC2(13:14) = FLOAT(NOROTA(1:2))/JPMULT
ENDIF
C
C Regular grid flag
@@ -346,10 +357,8 @@ C***********************************************************************
C
320 CONTINUE
C
- IF ( (NOREPR.EQ.JPGAUSSIAN).OR.
- X (NOREPR.EQ.JPFGGROT).OR.
- X (NOREPR.EQ.JPQUASI).OR.
- X (NOREPR.EQ.JPQGGROT) ) THEN
+ IF ( NOREPR.EQ.JPQUASI .OR. NOREPR.EQ.JPQGGROT .OR.
+ X NOREPR.EQ.JPGAUSSIAN .OR. NOREPR.EQ.JPFGGROT ) THEN
C
C Number of points along a parallel
C
@@ -364,7 +373,19 @@ C Number of points along a meridian
C
KSEC2(3) = NONS
C
-C Latitude and longitude of first grid point
+C Resolution flag
+C For a regular gaussian grid only, increments are given
+C
+ IF( (NOREPR.EQ.JPGAUSSIAN).OR.(NOREPR.EQ.JPFGGROT) ) THEN
+ KSEC2(6) = 128
+ ELSE
+ KSEC2(6) = 0
+ ENDIF
+C
+C Latitude and longitude of first/last grid point
+C La1/Lo1 - NOAREA(1): north, NOAREA(2): west
+C La2/Lo2 - NOAREA(3): south, NOAREA(4): east
+C EMOS-214: store REAL values in parallel data structure (real precision), for values that requiring sub-millidegree precision
C
IF( NOAREA(1).GE.0 ) THEN
KSEC2(4) = (NOAREA(1)+(JPMICRO/2)) / JPMICRO
@@ -376,19 +397,6 @@ C
ELSE
KSEC2(5) = (NOAREA(2)-(JPMICRO/2)) / JPMICRO
ENDIF
-C
-C Resolution flag
-C
-C For a regular gaussian grid only, increments are given
-C
- IF( (NOREPR.EQ.JPGAUSSIAN).OR.(NOREPR.EQ.JPFGGROT) ) THEN
- KSEC2(6) = 128
- ELSE
- KSEC2(6) = 0
- ENDIF
-C
-C Latitude and longitude of last grid point
-C
IF( NOAREA(3).GE.0 ) THEN
KSEC2(7) = (NOAREA(3)+(JPMICRO/2)) / JPMICRO
ELSE
@@ -399,15 +407,18 @@ C
ELSE
KSEC2(8) = (NOAREA(4)-(JPMICRO/2)) / JPMICRO
ENDIF
+ RSEC2(4:5) = FLOAT(NOAREA(1:2))/JPMULT
+ RSEC2(7:8) = FLOAT(NOAREA(3:4))/JPMULT
C
C i direction increment
C
C For a regular gaussian grid, only
C
+ KSEC2(9) = 0
+ RSEC2(9) = 0.
IF( (NOREPR.EQ.JPGAUSSIAN).OR.(NOREPR.EQ.JPFGGROT) ) THEN
KSEC2(9) = (((JP90)/NOGAUSS)+(JPMICRO/2)) / JPMICRO
- ELSE
- KSEC2(9) = 0
+ RSEC2(9) = (FLOAT(JP90)/FLOAT(NOGAUSS))/JPMULT
ENDIF
C
C Number of parallels between a pole and the Equator
@@ -424,6 +435,7 @@ C - lat/long of southern pole of rotation
C - lat/long of pole of stretching
C
C If rotated, put in new lat/long of southern pole of rotation
+C EMOS-214: store REAL values in parallel data structure (real precision), for values that requiring sub-millidegree precision
C
IF( LIROTAT.OR.LOROTAT ) THEN
IF( NOROTA(1).GE.0 ) THEN
@@ -436,6 +448,7 @@ C
ELSE
KSEC2(14) = (NOROTA(2) - (JPMICRO/2)) / JPMICRO
ENDIF
+ RSEC2(13:14) = FLOAT(NOROTA(1:2))/JPMULT
ENDIF
C
C Regular grid flag
@@ -455,8 +468,8 @@ C For reduced grid, move in number of points along each parallel
C
IF( (NOREPR.EQ.JPQUASI) .OR.
X (NOREPR.EQ.JPQGGROT) ) THEN
- DO ILOOP = 1, KSEC2(3)
- KSEC2(22+ILOOP) = NOLPTS(ILOOP+NO1NS-1)
+ DO ITEMP = 1, KSEC2(3)
+ KSEC2(22+ITEMP) = NOLPTS(ITEMP+NO1NS-1)
ENDDO
ENDIF
C
@@ -492,6 +505,7 @@ C - lat/long of pole of stretching
C - reserved words 17-22
C
C If rotated, put in new lat/long of southern pole of rotation
+C EMOS-214: store REAL values in parallel data structure (real precision), for values that requiring sub-millidegree precision
C
IF( LIROTAT.OR.LOROTAT ) THEN
IF( NOROTA(1).GE.0 ) THEN
@@ -504,6 +518,7 @@ C
ELSE
KSEC2(14) = (NOROTA(2) - (JPMICRO/2)) / JPMICRO
ENDIF
+ RSEC2(13:14) = FLOAT(NOROTA(1:2))/JPMULT
ENDIF
ENDIF
C
diff --git a/interpolation/intfap.F b/interpolation/intfap.F
index d12e5b7..9562390 100644
--- a/interpolation/intfap.F
+++ b/interpolation/intfap.F
@@ -155,6 +155,7 @@ C
C
C Externals
INTEGER NGROTAT
+ EXTERNAL NGROTAT
LOGICAL JACOBI
EXTERNAL JACOBI
C
diff --git a/interpolation/intfb.F b/interpolation/intfb.F
index b378feb..65769e4 100644
--- a/interpolation/intfb.F
+++ b/interpolation/intfb.F
@@ -54,15 +54,12 @@ C ---------
C
C IARCNTL - Control interp. quasi reg.Gauss -> Gaussian or lat/long
C IAGCNTL - Control interpolation reg.Gaussian or lat/long fields.
-C JSH2SH - Changes resolution of a field of spectral coefficients.
C JALLGP - Converts spectral fields to lat/long grid fields.
C JALLWN - Converts spectral wind fields to lat/long grids.
C JSLLGP - Converts strectched spectral fields to lat/long grid fields.
C JAGGGP - Converts spectral fields to a gaussian grid field.
C JSGGGP - Converts strectched spectral fields to a gaussian grid field.
-C IBASINI - Ensure basic interpolation setup is done.
C GRIBEX - Decode/encode GRIB product.
-C GRSVCK - Turn off GRIB checking
C IGSETUP - Setup GRIB sections for the output product.
C JMEMHAN - Handles memory allocation.
C IGLSIZE - Evaluate array sizes for reg. lat/long and area.
@@ -72,7 +69,6 @@ C FIXAREA - Fixup area definition to correspond to grid definitions
C ISCRSZ - Calculate number of values in generated field.
C JDEBUG - Checks environment to switch on/off debug
C INTLOG - Log error message.
-C INTLOGR - Log error message (real value).
C OCEANP - Interpolate GRIB ocean field.
C MKBITMP - Apply a bitmap to a rectangular field.
C MKFRAME - Create a 'frame' from a rectangular field.
diff --git a/interpolation/intin.F b/interpolation/intin.F
index b1b255b..45bb83c 100644
--- a/interpolation/intin.F
+++ b/interpolation/intin.F
@@ -144,8 +144,7 @@ C Make sure we read a grid type and grid number from input
203 IF( ITEMP.EQ.0 ) READ(CTEMP8,'(A1,I3)',ERR=204) CTEMP, ITEMP
204 IF( ITEMP.EQ.0 ) READ(CTEMP8,'(A1,I2)',ERR=205) CTEMP, ITEMP
205 IF( ITEMP.EQ.0 ) READ(CTEMP8,'(A1,I1)',ERR=206) CTEMP, ITEMP
- IF( ITEMP.EQ.0 ) THEN
- 206 CONTINUE
+ 206 IF( ITEMP.EQ.0 ) THEN
PRINT *, "INTIN: Invalid gridname (interpreting CHARV)"
PRINT *, " CHARV='"//CHARV//"'"
PRINT *, " CTEMP8='"//CTEMP8//"'"
diff --git a/interpolation/intocn.F b/interpolation/intocn.F
index c55e6c1..19bc02d 100644
--- a/interpolation/intocn.F
+++ b/interpolation/intocn.F
@@ -1,10 +1,10 @@
C Copyright 1981-2012 ECMWF.
C
-C This software is licensed under the terms of the Apache Licence
+C This software is licensed under the terms of the Apache Licence
C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
C
-C In applying this licence, ECMWF does not waive the privileges and immunities
-C granted to it by virtue of its status as an intergovernmental organisation
+C In applying this licence, ECMWF does not waive the privileges and immunities
+C granted to it by virtue of its status as an intergovernmental organisation
C nor does it submit to any jurisdiction.
C
@@ -156,7 +156,7 @@ C Local variables
INTEGER IPOSP1M, JMIN, JMAX, JLEFT, JJP, JJEFF
INTEGER NYLEFTI, NYLEFT, NYRIGH
REAL XUNIT, YUNIT, RRVAL, RLVAL, RUVAL, RDVAL, RXIRES
- REAL XSIGN, XRSIGN, XFPREV, XFPOSN, RPOS, RVALL, RVALR
+ REAL XSIGN, XRSIGN, XFPREV, XFPOSN, RPOS, RVALL, RVALR
REAL XVAL, XOWEST, XORES, XPSIGN, RVAL, RYIRES, YFPREV, YFPOSN
REAL YSIGN, YPSIGN, YRSIGN, RMISS, EPS
REAL RVALB, RVALT, XOSOUT
@@ -164,12 +164,12 @@ C Local variables
C
C YSIGN Flag for direction of y co-ords in data:
C +1 if co-ords are increasing with index of PSEC4,
-C -1 if decreasing.
+C -1 if decreasing.
C YPSIGN Flag for direction of y co-ords in output field:
C +1 if co-ords are increasing up the page,
-C -1 if decreasing.
+C -1 if decreasing.
C YRSIGN Flag for direction of y co-ords in output field relative
-C to that in data: YSIGN*YPSIGN
+C to that in data: YSIGN*YPSIGN
C IINTPOL Flag for interpolation:
C 0 = none,
C 1 = x only,
@@ -179,9 +179,8 @@ C RMISS Value for missing data
C EPS Tolerance on missing data flag
C
C
- EXTERNAL INTUP, INTDN, LENA, HDEGS, HMETRES
- INTEGER INTUP, INTDN, LENA
- CHARACTER*6 HDEGS, HMETRES
+ INTEGER INTUP, INTDN
+ EXTERNAL INTUP, INTDN
C
C Inline function - tests TRUE if A is a missing value
REAL A
@@ -235,17 +234,17 @@ C ------------------------------------------------------------------
C
200 CONTINUE
C
-C The approach in this section is to replace the staggered grid by
+C The approach in this section is to replace the staggered grid by
C a non-staggered version, either by interpolating the data onto new
-C grid points or by simply dropping half of the data points. A new
+C grid points or by simply dropping half of the data points. A new
C version of PSEC4 is created, and parts of KSEC1 are modified.
C This enables the rest of INTOCN to treat the field in a consistent
C manner, BUT it means that KSEC1 and PSEC4 will be altered on
C leaving this subroutine (and presently in an inconsistent way).
-C
+C
C The interpolations coded in this section ignore the metric of the
C staggered grid, that is they simply average neighbouring values to
-C find a new grid point value. The more general case can be added
+C find a new grid point value. The more general case can be added
C later if desired.
C
C Note: we prefer to drop odd points and keep even points, because
@@ -406,7 +405,7 @@ C First the even rows...
TARRAY(I*2+(NY-1)*NX) = (RRVAL+RLVAL)*0.5
TARRAY(I*2-1+(NY-1)*NX) = PSEC4(I+(NY-1)*NX/2)
231 CONTINUE
-C
+C
C Then the odd rows
DO 232 J = 3,NY-1,2
RUVAL = PSEC4(NX/2+(J-2)*NX/2)
@@ -835,7 +834,7 @@ C
INTOCN = JPROUTINE + 11
GOTO 900
ENDIF
-C
+C
NYP = (JMAX-JMIN)+1
NYLEFT = JMIN
DO 411 JI = 1,NYP
@@ -916,9 +915,9 @@ C
* ((IIRREG.EQ.2).OR.(IIRREG.EQ.3)) ) THEN
YPSIGN = SIGN(1.0,(RTOP-RBOTT))
IF( YPSIGN.GT.0 ) THEN
- NYP = NINT((RTOP-RBOTT+ 0.0001)/RYRES)+1
+ NYP = NINT((RTOP-RBOTT+ 0.0001)/RYRES)+1
ELSE
- NYP = NINT((RBOTT-RTOP + 0.0001)/RYRES)+1
+ NYP = NINT((RBOTT-RTOP + 0.0001)/RYRES)+1
ENDIF
Cjdc NYP = NINT((RTOP-RBOTT)/RYRES*YPSIGN)+1
IF((NXP*NYP).GT.KLENI) THEN
diff --git a/interpolation/intocnu.F b/interpolation/intocnu.F
index badc9f9..8592da2 100644
--- a/interpolation/intocnu.F
+++ b/interpolation/intocnu.F
@@ -1,10 +1,10 @@
C Copyright 1981-2012 ECMWF.
C
-C This software is licensed under the terms of the Apache Licence
+C This software is licensed under the terms of the Apache Licence
C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
C
-C In applying this licence, ECMWF does not waive the privileges and immunities
-C granted to it by virtue of its status as an intergovernmental organisation
+C In applying this licence, ECMWF does not waive the privileges and immunities
+C granted to it by virtue of its status as an intergovernmental organisation
C nor does it submit to any jurisdiction.
C
@@ -155,7 +155,7 @@ C Local variables
INTEGER IPOSP1M, JMIN, JMAX, JLEFT, JJP, JJEFF
INTEGER NYLEFTI, NYLEFT, NYRIGH
REAL XUNIT, YUNIT, RRVAL, RLVAL, RUVAL, RDVAL, RXIRES
- REAL XSIGN, XRSIGN, XFPREV, XFPOSN, RPOS, RVALL, RVALR
+ REAL XSIGN, XRSIGN, XFPREV, XFPOSN, RPOS, RVALL, RVALR
REAL XVAL, XOWEST, XORES, XPSIGN, RVAL, RYIRES, YFPREV, YFPOSN
REAL YSIGN, YPSIGN, YRSIGN, RMISS, EPS
REAL RVALB, RVALT, XOSOUT
@@ -163,12 +163,12 @@ C Local variables
C
C YSIGN Flag for direction of y co-ords in data:
C +1 if co-ords are increasing with index of INOCEAN
-C -1 if decreasing.
+C -1 if decreasing.
C YPSIGN Flag for direction of y co-ords in output field:
C +1 if co-ords are increasing up the page,
-C -1 if decreasing.
+C -1 if decreasing.
C YRSIGN Flag for direction of y co-ords in output field relative
-C to that in data: YSIGN*YPSIGN
+C to that in data: YSIGN*YPSIGN
C IINTPOL Flag for interpolation:
C 0 = none,
C 1 = x only,
@@ -178,9 +178,8 @@ C RMISS Value for missing data
C EPS Tolerance on missing data flag
C
C
- EXTERNAL INTUP, INTDN, LENA, HDEGS, HMETRES
- INTEGER INTUP, INTDN, LENA
- CHARACTER*6 HDEGS, HMETRES
+ INTEGER INTUP, INTDN
+ EXTERNAL INTUP, INTDN
C
C Inline function - tests TRUE if A is a missing value
REAL A
@@ -206,14 +205,14 @@ cs Coordinate 4 of last grid point
KLAT2 = NIOCO4L
cs Coordinate 3 of first grid point
KLON1 = NIOCO3F
-cs i-increment
+cs i-increment
KXINC = NIOIINC
-cs j-increment
+cs j-increment
KYINC = NIOJINC
C
-cs Flag for normal or staggered grid
+cs Flag for normal or staggered grid
ISTAG = NIONOST
-cs Flag for irregular grid coordinate list
+cs Flag for irregular grid coordinate list
IIRREG = NIOIRGR
cs 71 Number of entries in the horizontal coordinate definition
cs 72 Number of entries in mixed coordinate definition
@@ -249,17 +248,17 @@ C ------------------------------------------------------------------
C
200 CONTINUE
C
-C The approach in this section is to replace the staggered grid by
+C The approach in this section is to replace the staggered grid by
C a non-staggered version, either by interpolating the data onto new
-C grid points or by simply dropping half of the data points. A new
+C grid points or by simply dropping half of the data points. A new
C version of INOCEAN is created, and parts of KSEC1 are modified.
C This enables the rest of INTOCNU to treat the field in a consistent
C manner, BUT it means that KSEC1 and INOCEAN will be altered on
C leaving this subroutine (and presently in an inconsistent way).
-C
+C
C The interpolations coded in this section ignore the metric of the
C staggered grid, that is they simply average neighbouring values to
-C find a new grid point value. The more general case can be added
+C find a new grid point value. The more general case can be added
C later if desired.
C
C Note: we prefer to drop odd points and keep even points, because
@@ -421,7 +420,7 @@ C First the even rows...
TARRAY(I*2+(NY-1)*NX) = (RRVAL+RLVAL)*0.5
TARRAY(I*2-1+(NY-1)*NX) = INOCEAN(I+(NY-1)*NX/2)
231 CONTINUE
-C
+C
C Then the odd rows
DO 232 J = 3,NY-1,2
RUVAL = INOCEAN(NX/2+(J-2)*NX/2)
@@ -853,7 +852,7 @@ C
INTOCNU = JPROUTINE + 11
GOTO 900
ENDIF
-C
+C
NYP = (JMAX-JMIN)+1
NYLEFT = JMIN
DO 411 JI = 1,NYP
@@ -934,9 +933,9 @@ C
* ((IIRREG.EQ.2).OR.(IIRREG.EQ.3)) ) THEN
YPSIGN = SIGN(1.0,(RTOP-RBOTT))
IF( YPSIGN.GT.0 ) THEN
- NYP = NINT((RTOP-RBOTT+ 0.0001)/RYRES)+1
+ NYP = NINT((RTOP-RBOTT+ 0.0001)/RYRES)+1
ELSE
- NYP = NINT((RBOTT-RTOP + 0.0001)/RYRES)+1
+ NYP = NINT((RBOTT-RTOP + 0.0001)/RYRES)+1
ENDIF
Cjdc NYP = NINT((RTOP-RBOTT)/RYRES*YPSIGN)+1
IF((NXP*NYP).GT.KLENI) THEN
diff --git a/interpolation/intout.F b/interpolation/intout.F
index 49112db..c16f98a 100644
--- a/interpolation/intout.F
+++ b/interpolation/intout.F
@@ -136,8 +136,7 @@ C Make sure we read a grid type and grid number from input
203 IF( ITEMP.EQ.0 ) READ(CTEMP8,'(A1,I3)',ERR=204) CTEMP, ITEMP
204 IF( ITEMP.EQ.0 ) READ(CTEMP8,'(A1,I2)',ERR=205) CTEMP, ITEMP
205 IF( ITEMP.EQ.0 ) READ(CTEMP8,'(A1,I1)',ERR=206) CTEMP, ITEMP
- IF( ITEMP.EQ.0 ) THEN
- 206 CONTINUE
+ 206 IF( ITEMP.EQ.0 ) THEN
PRINT *, "INTOUT: Invalid gridname (interpreting CHARV)"
PRINT *, " CHARV='"//CHARV//"'"
PRINT *, " CTEMP8='"//CTEMP8//"'"
diff --git a/interpolation/intuvgh.F b/interpolation/intuvgh.F
index 39ce12a..bccff84 100644
--- a/interpolation/intuvgh.F
+++ b/interpolation/intuvgh.F
@@ -58,7 +58,6 @@ C
C IBASINI - Ensure basic interpolation setup is done.
C INTUVDH - Encodes/decodes data into/from GRIB code.
C JMEMHAN - Allocate scratch memory.
-C GRIBEX - GRIB decoding/encoding.
C FIXAREA - Fixup area definition to correspond to grid definitions
C INTLOG - Log error message.
C MKFRAME - Create a 'frame' from a rectangular field.
diff --git a/interpolation/intuvxh.F b/interpolation/intuvxh.F
index 1e1b36e..77fb58e 100644
--- a/interpolation/intuvxh.F
+++ b/interpolation/intuvxh.F
@@ -301,7 +301,7 @@ C
HTYPE = ''
NS = 0.
EW = 0.
- IRET = HSH2GG(NTRUNC,NGAUSS,HTYPE,KPTS,GLATS,ISIZE)
+ IRET = HSH2GG(NS,EW,NTRUNC,NGAUSS,HTYPE,KPTS,GLATS,ISIZE)
IF( IRET.NE.0 ) THEN
CALL INTLOG(JP_ERROR,
X 'INTUVXH: problem getting data for reduced grid',NTRUNC)
diff --git a/interpolation/intvecy.F b/interpolation/intvecy.F
index 43754fc..e6630b7 100644
--- a/interpolation/intvecy.F
+++ b/interpolation/intvecy.F
@@ -108,8 +108,10 @@ C
LOGICAL LSPECUV
REAL AREA(4)
REAL EAST
+ REAL EW
REAL GLATS(JPGTRUNC*2)
REAL GRID(2)
+ REAL NS
REAL OLDGRID(2)
REAL POLE(2)
REAL RGGRID
@@ -126,11 +128,11 @@ C Externals
C
CHARACTER*1 GGHTYPE
INTEGER FIXAREA, INTFAU, INTFBU, HSH2GG, IBASINI
- INTEGER HIRLAMW, INSANE, INTUVGH !, RESET_C
+ INTEGER HIRLAMW, INSANE !, RESET_C
INTEGER HRG2GGW, HLL2LLW
EXTERNAL GGHTYPE
EXTERNAL FIXAREA, INTFAU, INTFBU, HSH2GG, IBASINI
- EXTERNAL HIRLAMW, INSANE, INTUVGH !, RESET_C
+ EXTERNAL HIRLAMW, INSANE !, RESET_C
EXTERNAL HRG2GGW, HLL2LLW
C
DATA IRGGRID/0/, ISWORK/0/, ITWORK/0/
@@ -333,7 +335,9 @@ C
NTRUNC = NIRESO
NGAUSS = 0
HTYPE = ''
- IRET = HSH2GG(NTRUNC,NGAUSS,HTYPE,KPTS,GLATS,ISIZE)
+ NS = 0.
+ EW = 0.
+ IRET = HSH2GG(NS,EW,NTRUNC,NGAUSS,HTYPE,KPTS,GLATS,ISIZE)
IF( IRET.NE.0 ) THEN
CALL INTLOG(JP_ERROR,
X 'INTVECY: problem getting data for reduced grid',NTRUNC)
diff --git a/interpolation/irlsmb.F b/interpolation/irlsmb.F
index b627beb..dcd847d 100644
--- a/interpolation/irlsmb.F
+++ b/interpolation/irlsmb.F
@@ -8,15 +8,13 @@ C granted to it by virtue of its status as an intergovernmental organisation
C nor does it submit to any jurisdiction.
C
- INTEGER FUNCTION IRLSMB(
- X OISTAND, HIFILE, KIREC, KIGRID, KILINE,
- X OOSTAND, HOFILE, KOREC, KOGRID, KOLINE,
- X KPR, KERR )
+ INTEGER FUNCTION IRLSMB (OISTAND, HIFILE, KIREC, KIGRID, KILINE,
+ X OOSTAND, HOFILE, KOREC, KOGRID, KOLINE, KPR, KERR)
C
C---->
C**** *IRLSMB*
C
-C PURPOSE
+C Purpose
C -------
C
C Calculate the effects of the land-sea masks on the unnormalised
@@ -24,13 +22,11 @@ C interpolation weights for a quasi regular input field and a
C regular output field.
C
C
-C INTERFACE
+C Interface
C ---------
C
-C IERR = IRLSMB(
-C X OISTAND, HIFILE, KIREC, KIGRID, KILINE,
-C X OOSTAND, HOFILE, KOREC, KOGRID, KOLINE,
-C X KPR, KERR )
+C IERR = IRLSMB (OISTAND, HIFILE, KIREC, KIGRID, KILINE,
+C X OOSTAND, HOFILE, KOREC, KOGRID, KOLINE, KPR, KERR)
C
C
C Input parameters
@@ -110,15 +106,13 @@ C grspace.h - This file contains all the work space array
C definitions for grid point to grid point
C interpolation.
C
-C MEXPAND - Array used to
-C expand one latitude line of the 10 minute land
-C sea mask file to have one word per bit for
-C improved efficiency.
+C MEXPAND - Array used to expand one latitude line of the
+C 10 minute land sea mask file to have one word
+C per bit for improved efficiency.
C MILLEN - Array containing a quasi regular line length
C definition.
-C MWORK - Array used to
-C read one latitude line of a standard land sea
-C mask file.
+C MWORK - Array used to read one latitude line of a
+C standard land sea mask file.
C
C MILATG - The input field latitudes.
C MILONG - The input field longitudes.
@@ -182,11 +176,10 @@ C
C None
C
C
-C AUTHOR
+C Author
C ------
C K. Fielding *ECMWF* Nov 1993
C
-C
C Modifications
C -------------
C
@@ -194,12 +187,10 @@ C J.D.Chambers ECMWF Oct 1996
C Reduced number of parameters in call to IGLSMST and IGLSM01
C
C----<
-C
C -----------------------------------------------------------------|
C* Section 0. Definition of variables.
C -----------------------------------------------------------------|
C
-C
IMPLICIT NONE
C
#include "parim.h"
@@ -207,35 +198,28 @@ C
#include "nofld.common"
#include "grspace.h"
C
-C Parameters
-C
- INTEGER JPROUTINE
- PARAMETER (JPROUTINE = 23400)
-C
C Function arguments
C
- LOGICAL OISTAND, OOSTAND
- CHARACTER*256 HIFILE, HOFILE
- INTEGER KIREC, KOREC
- INTEGER KIGRID(2), KOGRID(2)
- INTEGER KILINE(2), KOLINE(2)
- INTEGER KPR, KERR
+ LOGICAL OISTAND, OOSTAND
+ CHARACTER *(*) HIFILE, HOFILE
+ INTEGER KIREC, KOREC, KPR, KERR
+ INTEGER KIGRID (2), KILINE (2), KOGRID (2), KOLINE (2)
C
C Local variables
C
- INTEGER IIUNIT, IOUNIT, IIFILE, IOFILE, ILATN, ILATS
- INTEGER IOFF, IPR, IERR, JOLAT, I
- CHARACTER*2 NEWFILE, MSKFILE
-c INTEGER ISTRIDEN, ISTRIDES
- INTEGER ILINEN, ILINES, INDEXN, INDEXS, JLON
- REAL RSTRIDEN, RSTRIDES
-
+ INTEGER IIUNIT, IOUNIT, IIFILE, IOFILE
+ INTEGER ILATN, ILATS, ILINEN, ILINES, ISTRIDEN, ISTRIDES
+ INTEGER IOSTRIDE, INDEXN, INDEXS, IZERO, IOFF, IPR, IERR
+ INTEGER JLON, JOLAT
CHARACTER*256 XHIFILE, XHOFILE
- SAVE XHIFILE, XHOFILE
-
- INTEGER XIIUNIT, XIOUNIT
- DATA XIIUNIT/0/, XIOUNIT/0/
- SAVE XIIUNIT, XIOUNIT
+ CHARACTER*2 NEWFILE, MSKFILE
+ INTEGER XIIUNIT, XIOUNIT, II
+ DATA XIIUNIT/0/
+ DATA XIOUNIT/0/
+ SAVE XHIFILE, XHOFILE, XIIUNIT, XIOUNIT
+C
+ INTEGER JPROUTINE
+ PARAMETER (JPROUTINE = 23400)
C
C External functions
C
@@ -255,13 +239,13 @@ C
IOFILE = JINDEX(HOFILE)
C
IF( KPR.GE.1 ) THEN
- CALL INTLOG(JP_DEBUG,'IRLSMB: Input parameters.',JPQUIET)
- CALL INTLOG(JP_DEBUG,'IRLSMB: LSM filename:',JPQUIET)
- CALL INTLOG(JP_DEBUG,HIFILE(1:IIFILE),JPQUIET)
+ CALL INTLOG(JP_DEBUG,'IRLSMB: Input field parameters.',JPQUIET)
+ CALL INTLOG(JP_DEBUG,'IRLSMB: LSM filename is.',JPQUIET)
+ CALL INTLOG(JP_DEBUG, HIFILE(1:IIFILE), JPQUIET)
IF( OISTAND ) THEN
- CALL INTLOG(JP_DEBUG,'IRLSMB: Standard fld: TRUE',JPQUIET)
+ CALL INTLOG(JP_DEBUG,'IRLSMB: Standard fld: TRUE',JPQUIET)
ELSE
- CALL INTLOG(JP_DEBUG,'IRLSMB: Standard fld: FALSE',JPQUIET)
+ CALL INTLOG(JP_DEBUG,'IRLSMB: Standard fld: FALSE',JPQUIET)
ENDIF
CALL INTLOG(JP_DEBUG,'IRLSMB: LSM file rec len = ',KIREC)
CALL INTLOG(JP_DEBUG,'IRLSMB: Grid stride WE = ',KIGRID(1))
@@ -269,13 +253,12 @@ C
CALL INTLOG(JP_DEBUG,'IRLSMB: Grid start N = ',KILINE(1))
CALL INTLOG(JP_DEBUG,'IRLSMB: Grid start W = ',KILINE(2))
C
- CALL INTLOG(JP_DEBUG,'IRLSMB: Output parameters.',JPQUIET)
- CALL INTLOG(JP_DEBUG,'IRLSMB: LSM filename:',JPQUIET)
- CALL INTLOG(JP_DEBUG,HOFILE(1:IOFILE),JPQUIET)
+ CALL INTLOG(JP_DEBUG,'IRLSMB: Output field parameters.',JPQUIET)
+ CALL INTLOG(JP_DEBUG, HOFILE(1:IOFILE),JPQUIET)
IF( OOSTAND ) THEN
- CALL INTLOG(JP_DEBUG,'IRLSMB: Standard fld: TRUE',JPQUIET)
+ CALL INTLOG(JP_DEBUG,'IRLSMB: Standard fld: TRUE',JPQUIET)
ELSE
- CALL INTLOG(JP_DEBUG,'IRLSMB: Standard fld: FALSE',JPQUIET)
+ CALL INTLOG(JP_DEBUG,'IRLSMB: Standard fld: FALSE',JPQUIET)
ENDIF
CALL INTLOG(JP_DEBUG,'IRLSMB: LSM file rec len = ',KOREC)
CALL INTLOG(JP_DEBUG,'IRLSMB: Grid stride WE = ',KOGRID(1))
@@ -284,6 +267,12 @@ C
CALL INTLOG(JP_DEBUG,'IRLSMB: Grid start W = ',KOLINE(2))
ENDIF
C
+ IF( MOLONG(2).GE.MOLONG(1) ) THEN
+ IOSTRIDE = MOLONG(2) - MOLONG(1)
+ ELSE
+ IOSTRIDE = MOLONG(2) + JP360 - MOLONG(1)
+ ENDIF
+C
C -----------------------------------------------------------------|
C* Section 2. Open files for input and output land sea masks
C -----------------------------------------------------------------|
@@ -295,8 +284,8 @@ C
C See if first time through or input land sea mask filename has
C changed since last access
C
- I = JINDEX(HIFILE)
- IF( XHIFILE(1:I).NE.HIFILE(1:I) ) THEN
+ II = JINDEX(HIFILE)
+ IF( XHIFILE(1:II).NE.HIFILE(1:II) ) THEN
C
C Open input land sea mask file
C
@@ -316,7 +305,7 @@ C
GOTO 900
ENDIF
XIIUNIT = IIUNIT
- XHIFILE(1:I) = HIFILE(1:I)
+ XHIFILE(1:II) = HIFILE(1:II)
NEWFILE(1:1) = 'Y'
C
C Just rewind if same file still in use
@@ -329,8 +318,8 @@ C
C See if first time through or output land sea mask filename has
C changed since last access
C
- I = JINDEX(HOFILE)
- IF( XHOFILE(1:I).NE.HOFILE(1:I) ) THEN
+ II = JINDEX(HOFILE)
+ IF( XHOFILE(1:II).NE.HOFILE(1:II) ) THEN
C
C Open output land sea mask file
C
@@ -343,7 +332,6 @@ C
CALL INTLOG(JP_ERROR,'IRLSMB: PBOPEN return code = ',IERR)
CALL INTLOG(JP_ERROR,'IRLSMB: trying to open file',JPQUIET)
CALL INTLOG(JP_ERROR, HOFILE(1:IOFILE),JPQUIET)
-C
ENDIF
C
IF( KERR.EQ.0 ) CALL INTLOG(JP_FATAL,
@@ -351,7 +339,7 @@ C
GOTO 900
ENDIF
XIOUNIT = IOUNIT
- XHOFILE(1:I) = HOFILE(1:I)
+ XHOFILE(1:II) = HOFILE(1:II)
NEWFILE(2:2) = 'Y'
C
C Just rewind if same file still in use
@@ -403,12 +391,12 @@ C
ILATS = MNSIND(JP_I_S, JOLAT)
C
ILINEN = MILLEN(ILATN)
-c ISTRIDEN = JP360 / ILINEN
- RSTRIDEN = 360./REAL(ILINEN)
+ ISTRIDEN = JP360 / ILINEN
C
ILINES = MILLEN(ILATS)
-c ISTRIDES = JP360 / ILINES
- RSTRIDES = 360./REAL(ILINEN)
+ ISTRIDES = JP360 / ILINES
+C
+ IZERO = 0
C
C Get lines for input array
C
@@ -436,8 +424,7 @@ C
ELSE
C
DO JLON = 0, ILINEN - 1
-c MILONG(JLON + 1) = ISTRIDEN * JLON
- MILONG(JLON + 1) = INT(RSTRIDEN * REAL(JLON))
+ MILONG(JLON + 1) = ISTRIDEN * JLON
ENDDO
C
IERR = IGLSM01(IIUNIT, ILINEN, MILONG, MILATG(ILATN),
@@ -449,8 +436,7 @@ C
ENDIF
C
DO JLON = 0, ILINES - 1
-c MILONG(JLON + 1) = ISTRIDES * JLON
- MILONG(JLON + 1) = INT(RSTRIDES * REAL(JLON))
+ MILONG(JLON + 1) = ISTRIDES * JLON
ENDDO
C
IERR = IGLSM01(IIUNIT, ILINES, MILONG, MILATG(ILATS),
diff --git a/interpolation/issame.F b/interpolation/issame.F
index 4faf1fc..9beded6 100644
--- a/interpolation/issame.F
+++ b/interpolation/issame.F
@@ -1,10 +1,10 @@
C Copyright 1981-2012 ECMWF.
C
-C This software is licensed under the terms of the Apache Licence
+C This software is licensed under the terms of the Apache Licence
C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
C
-C In applying this licence, ECMWF does not waive the privileges and immunities
-C granted to it by virtue of its status as an intergovernmental organisation
+C In applying this licence, ECMWF does not waive the privileges and immunities
+C granted to it by virtue of its status as an intergovernmental organisation
C nor does it submit to any jurisdiction.
C
@@ -52,7 +52,7 @@ C Author
C ------
C
C J.D.Chambers ECMWF
-C
+C
C----<
C -----------------------------------------------------------------|
C
@@ -71,7 +71,7 @@ C
C Externals
C
LOGICAL ISSAMEIARRAY, ISSAMERARRAY
- EXTERNAL ISSAMEIARRAY, ISSAMERAARAY
+ EXTERNAL ISSAMEIARRAY, ISSAMERARRAY
C
C -----------------------------------------------------------------|
C
diff --git a/interpolation/jmemhan2.F b/interpolation/jmemhan2.F
index 50bdcb2..6682af0 100644
--- a/interpolation/jmemhan2.F
+++ b/interpolation/jmemhan2.F
@@ -1,10 +1,10 @@
C Copyright 1981-2012 ECMWF.
C
-C This software is licensed under the terms of the Apache Licence
+C This software is licensed under the terms of the Apache Licence
C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
C
-C In applying this licence, ECMWF does not waive the privileges and immunities
-C granted to it by virtue of its status as an intergovernmental organisation
+C In applying this licence, ECMWF does not waive the privileges and immunities
+C granted to it by virtue of its status as an intergovernmental organisation
C nor does it submit to any jurisdiction.
C
@@ -80,7 +80,6 @@ C Externals
C _________
C
C JDEBUG - Checks environment variable to switch on/off debug
-C JMALLOC - Allocate heap space
C JFREE - Deallocate heap space
C INTLOG - Output log message
C IAFREE - Deallocate heap space used by grid-pt to grid-pt
diff --git a/interpolation/jsgggp.F b/interpolation/jsgggp.F
index 459909e..da2c2ac 100644
--- a/interpolation/jsgggp.F
+++ b/interpolation/jsgggp.F
@@ -80,8 +80,6 @@ C JJSET99 - Sets up FFT
C JNORSGG - Determines which latitude row in a gaussian grid is
C north or south of a given latitude
C JSYMGG - Generate symmetric grid from spherical harmonics
-C JWSCAL - Apply latitude correction to wind component field
-C JMVUGG - Moves grid point data to output array
C JMKOFGG - Builds offsets into storage array
C JDEBUG - Checks environment variable to switch on/off debug
C INTLOG - Logs output messages
diff --git a/interpolation/juvpole.F b/interpolation/juvpole.F
index 74c3c99..f8f7ba9 100644
--- a/interpolation/juvpole.F
+++ b/interpolation/juvpole.F
@@ -1,10 +1,10 @@
C Copyright 1981-2012 ECMWF.
C
-C This software is licensed under the terms of the Apache Licence
+C This software is licensed under the terms of the Apache Licence
C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
C
-C In applying this licence, ECMWF does not waive the privileges and immunities
-C granted to it by virtue of its status as an intergovernmental organisation
+C In applying this licence, ECMWF does not waive the privileges and immunities
+C granted to it by virtue of its status as an intergovernmental organisation
C nor does it submit to any jurisdiction.
C
@@ -54,7 +54,6 @@ C Externals
C ---------
C JAGGGP - converts spectral input to a gaussian grid
C INTLOG - Output log message
-C INTLOGR - Output log message (with real value)
C
C
C Reference
diff --git a/interpolation/krg2rgu.F b/interpolation/krg2rgu.F
index 94c7600..5d31ef3 100644
--- a/interpolation/krg2rgu.F
+++ b/interpolation/krg2rgu.F
@@ -53,7 +53,6 @@ C Externals
C ---------
C
C KINTRG - Interpolate reduced gaussian field to reduced gaussian
-C JMALLOC - Dynamically allocate memory
C INTLOG - Log messages
C
C
diff --git a/interpolation/krg2rgz.F b/interpolation/krg2rgz.F
index 81cbb3a..cfd27be 100644
--- a/interpolation/krg2rgz.F
+++ b/interpolation/krg2rgz.F
@@ -53,7 +53,6 @@ C Externals
C ---------
C
C KINTRG - Interpolate reduced gaussian field to reduced gaussian
-C JMALLOC - Dynamically allocate memory
C INTLOG - Log messages
C
C
diff --git a/interpolation/lsm_red.F b/interpolation/lsm_red.F
index fd32b0e..2cf415e 100644
--- a/interpolation/lsm_red.F
+++ b/interpolation/lsm_red.F
@@ -55,7 +55,6 @@ C ---------
C
C GETENV - Standard routine to get environmental variable.
C INDEX - Intrinsic routine to find position of substring.
-C LEN - Intrinsic routine to find length of string.
C EMOSNUM - Gives current EMOSLIB version number.
C
C
diff --git a/interpolation/mkbitmp.F b/interpolation/mkbitmp.F
index d948609..579c109 100644
--- a/interpolation/mkbitmp.F
+++ b/interpolation/mkbitmp.F
@@ -1,10 +1,10 @@
C Copyright 1981-2012 ECMWF.
C
-C This software is licensed under the terms of the Apache Licence
+C This software is licensed under the terms of the Apache Licence
C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
C
-C In applying this licence, ECMWF does not waive the privileges and immunities
-C granted to it by virtue of its status as an intergovernmental organisation
+C In applying this licence, ECMWF does not waive the privileges and immunities
+C granted to it by virtue of its status as an intergovernmental organisation
C nor does it submit to any jurisdiction.
C
@@ -53,7 +53,6 @@ C Externals
C ---------
C
C INTLOG - Log error message.
-C INTLOGR - Log error message.
C MAKEMAP - Build a bitmap from definition in a file.
C GMAPBIT - Get the bit value from a given position in a bitmap.
C JFREE - Frees dynamically allocated memory.
@@ -123,7 +122,7 @@ C
C
IRET = MAKEMAP(NOBITMP,NROWS,NCOLS,BITMAP)
IF( IRET.NE.0 ) THEN
- CALL INTLOG(JP_WARN,'MKBITMP: Failed to make bitmap',IRET)
+ CALL INTLOG(JP_WARN,'MKBITMP: Failed to make bitmap',IRET)
CALL INTLOG(JP_WARN,'MKBITMP: BITMAP NOT APPLIED',JPQUIET)
DO LOOP = 1, 256
OLDFILE(LOOP:LOOP) = ' '
@@ -139,11 +138,11 @@ C
ENDIF
C
IF( (NROWS.NE.KNS).OR.(NCOLS.NE.KWE) ) THEN
- CALL INTLOG(JP_WARN,'MKBITMP: Bitmap invalid for area',JPQUIET)
- CALL INTLOG(JP_WARN,'MKBITMP: No. of subarea rows = ',KNS)
- CALL INTLOG(JP_WARN,'MKBITMP: No. of subarea columns = ',KWE)
- CALL INTLOG(JP_WARN,'MKBITMP: No. of bitmap rows = ',NROWS)
- CALL INTLOG(JP_WARN,'MKBITMP: No. of bitmap columns = ',NCOLS)
+ CALL INTLOG(JP_WARN,'MKBITMP: Bitmap invalid for area',JPQUIET)
+ CALL INTLOG(JP_WARN,'MKBITMP: No. of subarea rows = ',KNS)
+ CALL INTLOG(JP_WARN,'MKBITMP: No. of subarea columns = ',KWE)
+ CALL INTLOG(JP_WARN,'MKBITMP: No. of bitmap rows = ',NROWS)
+ CALL INTLOG(JP_WARN,'MKBITMP: No. of bitmap columns = ',NCOLS)
CALL INTLOG(JP_WARN,'MKBITMP: BITMAP NOT APPLIED',JPQUIET)
MKBITMP = JPROUTINE + 3
GOTO 900
diff --git a/interpolation/pddefs.F b/interpolation/pddefs.F
index 01dc114..e8685f8 100644
--- a/interpolation/pddefs.F
+++ b/interpolation/pddefs.F
@@ -76,7 +76,6 @@ C
C INTLOG - Logs messages.
C GETENV - Gets environment variable information.
C INDEX - Locates a character in a character variable.
-C EMOSNUM - Gives current EMOSLIB version number.
C PRECIP - Says if field is to have 'precipitation' treatment
C
C
@@ -177,9 +176,8 @@ C
C
C External functions
C
- INTEGER EMOSNUM
LOGICAL PRECIP
- EXTERNAL EMOSNUM, PRECIP
+ EXTERNAL PRECIP
C
C Statement function
C
diff --git a/interpolation/wv2dint.F b/interpolation/wv2dint.F
index e4b48ee..1bdc87b 100644
--- a/interpolation/wv2dint.F
+++ b/interpolation/wv2dint.F
@@ -1,10 +1,10 @@
C Copyright 1981-2012 ECMWF.
C
-C This software is licensed under the terms of the Apache Licence
+C This software is licensed under the terms of the Apache Licence
C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
C
-C In applying this licence, ECMWF does not waive the privileges and immunities
-C granted to it by virtue of its status as an intergovernmental organisation
+C In applying this licence, ECMWF does not waive the privileges and immunities
+C granted to it by virtue of its status as an intergovernmental organisation
C nor does it submit to any jurisdiction.
C
@@ -42,7 +42,7 @@ C OLDWAVE - Original wave field
C NORTH - Output grid northernmost latitude (degree)
C WEST - Output grid westernmost longitude (degree)
C KNSPEC - Number of 2D spectra values at each wave point
-C PMISS - Missing data value
+C PMISS - Missing data value
C RNS - Difference in degrees in NS disrection
C
C Output arguments
@@ -76,7 +76,7 @@ C SUBROUTINE INTERPOLATE
C Peter Janssen ECMWF September 1995
C and:
C SUBROUTINE EXPOINT
-C Heinz Gunther ECMWF December 1989
+C Heinz Gunther ECMWF December 1989
C
C
C Author.
@@ -129,8 +129,8 @@ C
C
REAL OLDLATS(JPLLMAX), OLDEAST
INTEGER NEXT, NUMNEW(JPLLMAX)
- INTEGER IRET, WV2DIDX,W251IDX
- EXTERNAL WV2DIDX, W251IDX
+ INTEGER IRET, W251IDX
+ EXTERNAL W251IDX
INTEGER XKNUM,XKE_W,XKN_S
DATA XKNUM/-1/,XKE_W/-1/,XKN_S/-1/
REAL XRESON,XNORTH,XWEST
diff --git a/pbio/emosnum.F b/pbio/emosnum.F
index abfef8a..c171e52 100644
--- a/pbio/emosnum.F
+++ b/pbio/emosnum.F
@@ -83,12 +83,12 @@ C
C
C Local variables
C
- INTEGER INUMBER, ICOUNT, IOFFSET
+ INTEGER INUMBER, ICOUNT !, IOFFSET
SAVE INUMBER, ICOUNT
CHARACTER*35 CMESS
- CHARACTER*20 YNUMBER
+C CHARACTER*20 YNUMBER
C
- DATA INUMBER/000433/, ICOUNT/0/
+ DATA INUMBER/000437/, ICOUNT/0/
DATA CMESS/'* EMOSLIB version number = ****** *'/
C
C ------------------------------------------------------------------
diff --git a/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake b/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
index 341b894..1e12d66 100644
--- a/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
+++ b/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
@@ -9,8 +9,8 @@ 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("$ENV{MPICH_DIR}/lib/libmpichf90_cray.so")
-link_libraries("$ENV{MPICH_DIR}/lib/libmpichcxx_cray.so")
+link_libraries("-lmpichf90_cray")
+link_libraries("-lmpichcxx_cray")
set( ECBUILD_FIND_MPI OFF )
set( ECBUILD_TRUST_FLAGS ON )
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 3faf2e1..6d15e3b 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,11 +1,12 @@
-# tools to help testing:
+# set testing tools:
# - int (internal)
# - gg_gridname (internal)
# - grib_compare (bundle, on provided path, or on system path)
# - cmp (strict binary comparison)
-get_target_property( CMD_INT int LOCATION )
+
if( ENABLE_INSTALL_TOOLS )
+ get_target_property( CMD_INT int LOCATION )
get_target_property( CMD_GG_GRIDNAME gg_gridname LOCATION )
endif()
@@ -18,27 +19,17 @@ endif()
if( NOT CMD_GRIB_COMPARE )
find_program( CMD_GRIB_COMPARE grib_compare )
endif()
-if( NOT CMD_GRIB_COMPARE )
- set( CMD_GRIB_COMPARE_MSG "(some tests disabled!)" )
-endif()
find_program( CMD_CMP cmp )
-# define the grib & emos runtime environment
+# set testing environments (grib_api, libemos)
if( NOT grib_api_BASE_DIR AND CMD_GRIB_COMPARE )
get_filename_component( _grib_compare_dir "${CMD_GRIB_COMPARE}" PATH )
get_filename_component( grib_api_BASE_DIR "${_grib_compare_dir}" ABSOLUTE )
set( grib_api_BASE_DIR "${grib_api_BASE_DIR}/../" )
endif()
-message( STATUS "Testing with grib_api: ${grib_api_BASE_DIR}" )
-message( STATUS "Testing with grib_compare: ${CMD_GRIB_COMPARE} ${CMD_GRIB_COMPARE_MSG}" )
-message( STATUS "Testing with cmp: ${CMD_CMP}" )
-if( NOT CMD_GRIB_COMPARE OR NOT CMD_CMP )
- message( WARNING "Some tools not found in PATH: turning off some tests." )
-endif()
-
if( grib_api_BASE_DIR )
set( _grib_environment
GRIB_DEFINITION_PATH=${grib_api_BASE_DIR}/share/grib_api/definitions/:${grib_api_BASE_DIR}/share/grib_api/definitions/grib1/
@@ -54,50 +45,70 @@ set( _emos_environment
LOCAL_DEFINITION_TEMPLATES=${PROJECT_SOURCE_DIR}/gribtemplates )
+# log information
+ecbuild_info( "Test tool int: ${CMD_INT}" )
+ecbuild_info( "Test tool gg_gridname: ${CMD_GG_GRIDNAME}" )
+ecbuild_info( "Test tool grib_compare: ${CMD_GRIB_COMPARE}" )
+ecbuild_info( "Test tool cmp: ${CMD_CMP}" )
+if( NOT CMD_INT OR NOT CMD_GG_GRIDNAME OR NOT CMD_GRIB_COMPARE OR NOT CMD_CMP )
+ ecbuild_info( "(some tools not found, some tests disabled)" )
+endif()
+ecbuild_debug( "Test _grib_environment: ${_grib_environment}" )
+ecbuild_debug( "Test _emos_environment: ${_emos_environment}" )
+
+
# configure Fortran-based targets for double precision (compilation & linking)
ecbuild_add_fortran_flags(${emos_double_precision_flags})
################ I N T E R P O L A T I O N ################
-if( HAVE_TESTS AND HAVE_LIBEMOS_INTERPOLATION )
+if( HAVE_LIBEMOS_INTERPOLATION )
# intuvp2: interpolation to different formats
- foreach( out "regular_ll" "F80" "N80" "O80" )
- set( in "sh_vod" )
- set( test "${in}_to_${out}" )
- if( NOT (test MATCHES "^sh_.*_to_O" AND NOT HAVE_FFTW) )
- set( input "${PROJECT_SOURCE_DIR}/data/${in}.grib" )
- set( output "intuvp2_${test}.grib" )
- if( out MATCHES "^regular_ll" )
- set( grid "--grid=3.0/3.0" )
- else()
- set( grid "--gridname=${out}" )
+ foreach( rotated "" "rotated_" )
+ foreach( out "regular_ll" "F80" "N80" "O80" )
+ set( in "sh_vo-d" )
+ set( test "${in}_to_${rotated}${out}" )
+ set( rot "--rotation=30/30" )
+ if( "${rotated}" STREQUAL "" )
+ set( rot "" )
endif()
+ if( NOT (test MATCHES "^sh_.*_to_O" AND NOT HAVE_FFTW)
+ AND NOT (test MATCHES "^.*_to_rotated_[NOF]") )
+ set( input "${PROJECT_SOURCE_DIR}/data/${in}.grib" )
+ set( output "intuvp2_${test}.grib" )
+ if( out MATCHES "^regular_ll" )
+ set( grid "--grid=3.0/3.0" )
+ else()
+ set( grid "--gridname=${out}" )
+ endif()
- # interpolate
- ecbuild_add_test(
- TARGET intuvp2_${test}_interpol
- DEPENDS int
- COMMAND ${CMD_INT}
- ARGS ${grid} --input=${input} --output=${output} --int=intuvp2
- ENVIRONMENT ${_emos_environment} )
+ # interpolate
+ ecbuild_add_test(
+ TARGET intuvp2_${test}_interpol
+ DEPENDS int
+ COMMAND ${CMD_INT}
+ ARGS ${grid} ${rot} --input=${input} --output=${output} --int=intuvp2
+ ENVIRONMENT ${_emos_environment} )
- # compare results to reference data
- ecbuild_add_test(
- TARGET intuvp2_${test}_compare
- TEST_DEPENDS intuvp2_${test}_interpol
- CONDITION CMD_GRIB_COMPARE
- COMMAND ${CMD_GRIB_COMPARE}
- ARGS ${PROJECT_SOURCE_DIR}/data/${output} ${output}
- ENVIRONMENT ${_grib_environment} )
+ # compare results to reference data
+ ecbuild_add_test(
+ TARGET intuvp2_${test}_compare
+ TEST_DEPENDS intuvp2_${test}_interpol
+ CONDITION CMD_GRIB_COMPARE
+ COMMAND ${CMD_GRIB_COMPARE}
+ ARGS ${PROJECT_SOURCE_DIR}/data/${output} ${output}
+ ENVIRONMENT ${_grib_environment} )
- unset( grid )
- unset( output )
- unset( input )
- endif()
- unset( test )
- unset( in )
+ unset( grid )
+ unset( output )
+ unset( input )
+ endif()
+ unset( rot )
+ unset( test )
+ unset( in )
+ endforeach()
endforeach()
# intf2: interpolation to different formats
@@ -107,7 +118,7 @@ if( HAVE_TESTS AND HAVE_LIBEMOS_INTERPOLATION )
# - any to rotated reduced/regular G
# - regular_ll to rotated regular_ll
foreach( rotated "" "rotated_" )
- foreach( in "sh_vod" "sh_z" "regular_ll" "N640" "O640" "F640" )
+ foreach( in "sh_vo-d" "sh_z" "regular_ll" "N640" "O640" "F640" )
foreach( out "regular_ll" "F80" "N80" "O80" "F48" )
set( test "${in}_to_${rotated}${out}" )
set( rot "--rotation=30/30" )
@@ -146,12 +157,10 @@ if( HAVE_TESTS AND HAVE_LIBEMOS_INTERPOLATION )
ENVIRONMENT ${_grib_environment} )
endif()
- # compare results to reference data, strict comparison except:
- # - for PGI Fortran (lxab, opensuse113, lxc/pgi, opensuse131/pgi)
- # - for N640_to_O80 (minor numeric issues, within 2x packing error)
+ # compare results to reference data, strict comparison except in some cases
if( NOT CMD_CMP
- OR test MATCHES "^(regular_ll|N640)_to_regular_ll$"
- OR test MATCHES "^N640_to_O80$" )
+ OR test MATCHES "^regular_ll_to_regular_ll$" # opensuse131/pgi, lxc/pgi
+ OR test MATCHES "^N640_to_O80$" ) # (minor numeric issues, within 2x packing error)
ecbuild_add_test(
TARGET intf2_${test}_compare
TEST_DEPENDS intf2_${test}_interpol
@@ -300,7 +309,7 @@ if( HAVE_TESTS AND HAVE_LIBEMOS_INTERPOLATION )
# intf2: compare FFT99 vs FFTW exactly (no tolerance!)
- foreach( in "sh_vod" "sh_z" )
+ foreach( in "sh_vo-d" "sh_z" )
set( output_fftw "intf2_${in}_to_N80-fftw.grib" )
set( output_fft99 "intf2_${in}_to_N80.grib" )
@@ -329,7 +338,7 @@ if( HAVE_TESTS AND HAVE_LIBEMOS_INTERPOLATION )
# intf2: test SH
- set( in "sh_vod" )
+ set( in "sh_vo-d" )
set( test "${in}_to_${in}_trunc" )
set( input "${PROJECT_SOURCE_DIR}/data/${in}.grib" )
set( output "intf2_${test}.grib" )
@@ -350,12 +359,12 @@ if( HAVE_TESTS AND HAVE_LIBEMOS_INTERPOLATION )
ecbuild_add_test( TARGET fftw SOURCES fftw.F LIBS emos CONDITION HAVE_FFTW )
-endif( HAVE_TESTS AND HAVE_LIBEMOS_INTERPOLATION )
+endif( HAVE_LIBEMOS_INTERPOLATION )
####################### G R I B E X #######################
-if( HAVE_TESTS AND HAVE_LIBEMOS_GRIBEX )
+if( HAVE_LIBEMOS_GRIBEX )
foreach( test "gribex_demo" "gribex_abort" )
ecbuild_add_test(
@@ -367,12 +376,12 @@ if( HAVE_TESTS AND HAVE_LIBEMOS_GRIBEX )
set_tests_properties( ${test} PROPERTIES WILL_FAIL ${HAVE_GRIBEX_ABORT} )
endforeach()
-endif( HAVE_TESTS AND HAVE_LIBEMOS_GRIBEX )
+endif( HAVE_LIBEMOS_GRIBEX )
######################### B U F R #########################
-if( HAVE_TESTS AND HAVE_LIBEMOS_BUFRDC )
+if( HAVE_LIBEMOS_BUFRDC )
# set bufr tables path (for testing):
# (check if bufrtables/ is bundled, otherwise set to best guess)
@@ -447,7 +456,7 @@ if( HAVE_TESTS AND HAVE_LIBEMOS_BUFRDC )
endif()
-endif( HAVE_TESTS AND HAVE_LIBEMOS_BUFRDC )
+endif( HAVE_LIBEMOS_BUFRDC )
################ L I N K I N G T E S T S ################
@@ -467,3 +476,32 @@ ecbuild_add_executable(
CONDITION HAVE_LIBEMOS_INTERPOLATION
LIBS emos )
+
+###################### H S P 2 G G * ######################
+
+ecbuild_add_test(TARGET hsp2gg SOURCES hsp2gg.F LIBS emos)
+
+
+##################### E X A M P L E S #####################
+
+ecbuild_add_executable(
+ TARGET example_intf2 NOINSTALL
+ SOURCES example_intf2.F
+ CONDITION HAVE_LIBEMOS_INTERPOLATION
+ LIBS emos )
+
+ecbuild_add_executable(
+ TARGET example_intuvp2 NOINSTALL
+ SOURCES example_intuvp2.F
+ CONDITION HAVE_LIBEMOS_INTERPOLATION
+ LIBS emos )
+
+
+############ T E S T S : R E G R E S S I O N ############
+
+if( HAVE_LIBEMOS_INTERPOLATION )
+if( HAVE_LIBEMOS_TESTS_REGRESS )
+ add_subdirectory( regress )
+endif()
+endif( HAVE_LIBEMOS_INTERPOLATION )
+
diff --git a/tests/example_intf2.F b/tests/example_intf2.F
new file mode 100644
index 0000000..ac37e61
--- /dev/null
+++ b/tests/example_intf2.F
@@ -0,0 +1,157 @@
+C
+C Copyright 2015 ECMWF.
+C
+C This software is licensed under the terms of the Apache Licence
+C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+C
+C Unless required by applicable law or agreed to in writing, software
+C distributed under the License is distributed on an "AS IS" BASIS,
+C WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+C
+C In applying this licence, ECMWF does not waive the privileges and immunities
+C granted to it by virtue of its status as an intergovernmental organisation
+C nor does it submit to any jurisdiction.
+C
+
+ PROGRAM EXAMPLE_INTF2
+ IMPLICIT NONE
+
+
+C Parameters
+ INTEGER JPGRIB ! GRIB size (up to 1/16 deg)
+ INTEGER JPBYTES ! bytes/integer
+ PARAMETER (JPGRIB = 33190420)
+#ifdef INTEGER_8
+ PARAMETER (JPBYTES = 8)
+#else
+ PARAMETER (JPBYTES = 4)
+#endif
+
+
+C Local variables
+ INTEGER INTV(4)
+ REAL REALV(4)
+ CHARACTER*20 CHARV
+
+ CHARACTER*128 INFILE, OUTFILE, ARG
+ INTEGER INLEN, OUTLEN, U1, U2, IRET, N
+ INTEGER INGRIB(JPGRIB), OUTGRIB(JPGRIB)
+
+
+C Externals
+ INTEGER INTOUT, INTF2, IARGC
+
+
+C ------------------------------------------------------------------
+
+
+C Pick up file names from command line
+ INFILE = ' '
+ OUTFILE = ' '
+ IF( IARGC().EQ.4 ) THEN
+ DO N = 1, 4, 2
+ CALL GETARG(N,ARG)
+ IF (ARG.EQ.'-i') THEN
+ CALL GETARG(N+1,INFILE)
+ ELSEIF (ARG.EQ.'-o') THEN
+ CALL GETARG(N+1,OUTFILE)
+ ENDIF
+ ENDDO
+ ENDIF
+ CALL CHECK(
+ _ INDEX(INFILE,' ').EQ.1 .OR. INDEX(OUTFILE,' ').EQ.1,
+ _ 'Usage: example_intf2 -i infile -o outfile' )
+
+ INTV = 0
+ REALV = 0.
+ CHARV = ''
+
+
+C Define the packing accuracy for the new field(s)
+ INTV(1) = 24
+ IRET = INTOUT('accuracy', INTV, REALV, CHARV)
+ CALL CHECK(IRET.NE.0, 'INTOUT (accuracy) failed')
+ INTV(1) = 0
+
+
+C Define the geographical area for the new field(s)
+ REALV(1) = 60.
+ REALV(2) = -10.
+ REALV(3) = 40.
+ REALV(4) = 15.
+ IRET = INTOUT('area', INTV, REALV, CHARV)
+ CALL CHECK(IRET.NE.0, 'INTOUT (area) failed')
+ REALV = 0.
+
+
+C Define the grid interval for the new field(s)
+ REALV(1) = 1.5
+ REALV(2) = 1.5
+ IRET = INTOUT('grid', INTV, REALV, CHARV)
+ CALL CHECK(IRET.NE.0, 'INTOUT (grid) failed')
+ REALV = 0.
+
+
+C Open input and output files
+ CALL PBOPEN(U1, INFILE, 'r', IRET)
+ CALL CHECK(IRET.NE.0, 'PBOPEN failed (r)')
+ CALL PBOPEN(U2, OUTFILE, 'w', IRET)
+ CALL CHECK(IRET.NE.0, 'PBOPEN failed (w)')
+
+
+C Start of loop on input fields
+ PRINT *, 'Start interpolation...'
+ N = 0
+ 220 CONTINUE
+ N = N + 1
+
+C Read next field
+ CALL PBGRIB(U1, INGRIB, JPGRIB*JPBYTES, INLEN, IRET)
+ IF (IRET.EQ.-1) THEN
+ IRET = 0
+ GOTO 290
+ ENDIF
+ CALL CHECK(IRET.NE.0, 'PBGRIB failed')
+
+C Interpolate
+ PRINT *, 'Interpolate field #', N
+ OUTLEN = JPGRIB
+ IRET = INTF2(INGRIB,INLEN,OUTGRIB,OUTLEN)
+ CALL CHECK(IRET.NE.0, 'INTF failed')
+
+C Write the new field to file
+ IF (OUTLEN.GT.0) THEN
+ CALL PBWRITE(U2, OUTGRIB, OUTLEN, IRET)
+ ELSE
+ PRINT *, 'Output same as input'
+ CALL PBWRITE(U2, INGRIB, INLEN, IRET)
+ ENDIF
+ CALL CHECK(IRET.LT.0, 'PBWRITE failed')
+
+
+C Loop back for next field
+ GOTO 220
+
+
+C Close
+ 290 CONTINUE
+ CALL PBCLOSE(U1, IRET)
+ CALL PBCLOSE(U2, IRET)
+
+ PRINT *, 'Interpolated ', (N-1), ' field(s).'
+ END
+
+
+C ------------------------------------------------------------------
+
+
+ SUBROUTINE CHECK(OOPS,MSG)
+ IMPLICIT NONE
+ LOGICAL OOPS
+ CHARACTER MSG*(*)
+ IF (OOPS) THEN
+ PRINT *, MSG
+ CALL EXIT(3)
+ ENDIF
+ END
+
diff --git a/tests/example_intuvp2.F b/tests/example_intuvp2.F
new file mode 100644
index 0000000..b2f4163
--- /dev/null
+++ b/tests/example_intuvp2.F
@@ -0,0 +1,147 @@
+C
+C Copyright 2015 ECMWF.
+C
+C This software is licensed under the terms of the Apache Licence
+C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+C
+C Unless required by applicable law or agreed to in writing, software
+C distributed under the License is distributed on an "AS IS" BASIS,
+C WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+C
+C In applying this licence, ECMWF does not waive the privileges and immunities
+C granted to it by virtue of its status as an intergovernmental organisation
+C nor does it submit to any jurisdiction.
+C
+
+ PROGRAM EXAMPLE_INTUVP2
+ IMPLICIT NONE
+
+
+C Parameters
+ INTEGER JPGRIB ! GRIB size (up to 1/16 deg)
+ INTEGER JPBYTES ! bytes/integer
+ PARAMETER (JPGRIB = 33190420)
+#ifdef INTEGER_8
+ PARAMETER (JPBYTES = 8)
+#else
+ PARAMETER (JPBYTES = 4)
+#endif
+
+
+C Local variables
+ INTEGER INTV(4)
+ REAL REALV(4)
+ CHARACTER*20 CHARV
+
+ CHARACTER*128 INFILE, OUTFILE, ARG
+ INTEGER INLEN, OUTLEN, U1, U2, IRET, N
+ INTEGER IVOGRIB(JPGRIB), IDVGRIB(JPGRIB)
+ INTEGER IUGRIB(JPGRIB), IVGRIB(JPGRIB)
+
+
+C Externals
+ INTEGER INTOUT, INTUVP2, IARGC
+
+
+C ------------------------------------------------------------------
+
+
+C Pick up file names from command line
+ INFILE = ' '
+ OUTFILE = ' '
+ IF( IARGC().EQ.4 ) THEN
+ DO N = 1, 4, 2
+ CALL GETARG(N,ARG)
+ IF (ARG.EQ.'-i') THEN
+ CALL GETARG(N+1,INFILE)
+ ELSEIF (ARG.EQ.'-o') THEN
+ CALL GETARG(N+1,OUTFILE)
+ ENDIF
+ ENDDO
+ ENDIF
+ CALL CHECK(
+ _ INDEX(INFILE,' ').EQ.1 .OR. INDEX(OUTFILE,' ').EQ.1,
+ _ 'Usage: example_intuvp2 -i infile -o outfile' )
+
+ INTV = 0
+ REALV = 0.
+ CHARV = ''
+
+
+C Define the grid interval for the output
+ REALV(1) = 3.0
+ REALV(2) = 3.0
+ IRET = INTOUT('grid', INTV, REALV, CHARV)
+ CALL CHECK(IRET.NE.0, 'INTOUT (grid) failed')
+ REALV = 0.
+
+
+C Open input and output files
+ CALL PBOPEN(U1, INFILE, 'r', IRET)
+ CALL CHECK(IRET.NE.0, 'PBOPEN failed (r)')
+ CALL PBOPEN(U2, OUTFILE, 'w', IRET)
+ CALL CHECK(IRET.NE.0, 'PBOPEN failed (w)')
+
+
+C Start of loop on input vo/d pairs
+ PRINT *, 'Start interpolation...'
+ N = 0
+ 220 CONTINUE
+ N = N + 1
+
+C Read next vo/d pair
+ CALL PBGRIB(U1, IVOGRIB, JPGRIB * JPBYTES, INLEN, IRET)
+ IF (IRET.EQ.-1) THEN
+ IRET = 0
+ GOTO 290
+ ENDIF
+ CALL CHECK(IRET.NE.0, 'PBGRIB failed (vo)')
+
+ CALL PBGRIB(U1, IDVGRIB, JPGRIB * JPBYTES, INLEN, IRET)
+ IF (IRET.EQ.-1) THEN
+ IRET = 0
+ GOTO 290
+ ENDIF
+ CALL CHECK(IRET.NE.0, 'PBGRIB failed (d)')
+
+C Interpolate
+ PRINT *, 'Interpolate vo/d pair #', N
+ OUTLEN = JPGRIB
+ IRET = INTUVP2(IVOGRIB, IDVGRIB, JPGRIB, IUGRIB, IVGRIB, OUTLEN)
+ CALL CHECK(IRET.NE.0, 'INTUVP failed')
+
+C Write the new u/v to file
+ IF (OUTLEN.GT.0) THEN
+ CALL PBWRITE(U2, IUGRIB, OUTLEN, IRET)
+ CALL CHECK(IRET.LT.OUTLEN,'PBWRITE failed (vo)')
+ CALL PBWRITE(U2, IVGRIB, OUTLEN, IRET)
+ CALL CHECK(IRET.LT.OUTLEN,'PBWRITE failed (d)')
+ ENDIF
+
+
+C Loop back for next vo/d pair
+ GOTO 220
+
+
+C Close
+ 290 CONTINUE
+ CALL PBCLOSE(U1, IRET)
+ CALL PBCLOSE(U2, IRET)
+
+ PRINT *, 'Interpolated ', (N-1), ' vo/d pair(s).'
+ END
+
+
+C ------------------------------------------------------------------
+
+
+ SUBROUTINE CHECK(OOPS,MSG)
+ IMPLICIT NONE
+ LOGICAL OOPS
+ CHARACTER MSG*(*)
+ IF (OOPS) THEN
+ PRINT *, MSG
+ CALL EXIT(3)
+ ENDIF
+ END
+
diff --git a/tests/hsp2gg.F b/tests/hsp2gg.F
new file mode 100644
index 0000000..465c1d8
--- /dev/null
+++ b/tests/hsp2gg.F
@@ -0,0 +1,68 @@
+C Copyright 1981-2015 ECMWF.
+C
+C This software is licensed under the terms of the Apache Licence
+C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+C
+C In applying this licence, ECMWF does not waive the privileges and immunities
+C granted to it by virtue of its status as an intergovernmental organisation
+C nor does it submit to any jurisdiction.
+C
+ PROGRAM HSP2GG_TESTS
+ IMPLICIT NONE
+
+C Externals
+ INTEGER HSP2GG, HSP2GG2, HSP2GG3
+
+C Local variables
+ CHARACTER*1 HTYPE
+ INTEGER IRET(3)
+ INTEGER KTRUNC, KGAUSS, KSIZE
+ INTEGER KPTS(96)
+ REAL LL(2), PLATS(96)
+
+ IRET = 0
+
+ KTRUNC = 63 ! input
+ KGAUSS = 0 ! output
+ KPTS = 0
+ PLATS = 0.
+ IRET(1) = HSP2GG(KTRUNC,KGAUSS,KPTS,PLATS,KSIZE)
+ IF (IRET(1).EQ.0) THEN
+ PRINT *, 'HSP2GG in: KTRUNC = ', KTRUNC
+ PRINT *, 'HSP2GG out: KGAUSS = ', KGAUSS
+ IF (KGAUSS.NE.48) IRET(1) = -1
+ IF (KSIZE.NE.13280) IRET(1) = -2
+ ENDIF
+
+ LL(:) = 2.5 ! input
+ KGAUSS = 0 ! output
+ KTRUNC = 0 ! output
+ KPTS = 0
+ PLATS = 0.
+ IRET(2) = HSP2GG2(KTRUNC,LL(1),LL(2),KGAUSS,KPTS,PLATS,KSIZE)
+ IF (IRET(2).EQ.0) THEN
+ PRINT *, 'HSP2GG2 in: NS/EW = ', LL(1:2)
+ PRINT *, 'HSP2GG2 out: KGAUSS = ', KGAUSS
+ PRINT *, 'HSP2GG2 out: KTRUNC = ', KTRUNC
+ IF (KTRUNC.NE.63) IRET(2) = -3
+ IF (KGAUSS.NE.48) IRET(2) = -4
+ IF (KSIZE.NE.13280) IRET(1) = -2
+ ENDIF
+
+ KGAUSS = 48 ! input
+ KTRUNC = 0 ! output
+ KPTS = 0
+ PLATS = 0.
+ IRET(3) = HSP2GG3(KTRUNC,KGAUSS,KPTS,PLATS,KSIZE)
+ IF (IRET(3).EQ.0) THEN
+ PRINT *, 'HSP2GG3 in: KGAUSS = ', KGAUSS
+ PRINT *, 'HSP2GG3 out: KTRUNC = ', KTRUNC
+ IF (KTRUNC.NE.95) IRET(3) = -6
+ IF (KSIZE.NE.13280) IRET(1) = -2
+ ENDIF
+
+ IF ( IRET(1).NE.0 .OR.
+ . IRET(2).NE.0 .OR.
+ . IRET(3).NE.0 ) CALL EXIT(-1)
+ END
+
diff --git a/tests/regress/CMakeLists.txt b/tests/regress/CMakeLists.txt
new file mode 100644
index 0000000..917003e
--- /dev/null
+++ b/tests/regress/CMakeLists.txt
@@ -0,0 +1,147 @@
+
+######################### D A T A #########################
+
+file(READ "download_tests_regress_src_files.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+ecbuild_get_test_multidata( TARGET download_tests_regress_src_files NOCHECK NAMES ${files} )
+
+file(READ "download_tests_regress_ref_files.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+ecbuild_get_test_multidata( TARGET download_tests_regress_ref_files NOCHECK NAMES ${files} )
+
+
+######################## EMOS-216 #########################
+
+# tests with intuvp2
+set( basen "regress_EMOS-216_intuvp2" )
+foreach( area "" "_sub-area" )
+ foreach( out "regular_ll" "F80" "N80" "O80" )
+ set( in "vo-d_sh" )
+ set( test "${basen}_${in}_to_${out}${area}" )
+ set( input "${in}.grib" )
+ set( output "${test}.grib" )
+ if( NOT (test MATCHES "_sh_.+_to_O" AND NOT HAVE_FFTW) )
+ unset( opt )
+ if( out MATCHES "^regular_ll" )
+ list( APPEND opt "--grid=3/3" )
+ else()
+ list( APPEND opt "--gridname=${out}" )
+ endif()
+ if( "${area}" STREQUAL "_sub-area" )
+ list( APPEND opt "--area=70/-60/20/60" )
+ endif()
+
+ # interpolate
+ ecbuild_add_test(
+ TARGET ${test}_interpol
+ DEPENDS int
+ TEST_DEPENDS download_tests_regress_src_files
+ COMMAND ${CMD_INT}
+ ARGS --input=${input} --output=${output} ${opt} --int=intuvp2
+ ENVIRONMENT ${_emos_environment} )
+
+ # compare results to reference data
+ ecbuild_add_test(
+ TARGET ${test}_compare
+ TEST_DEPENDS ${test}_interpol download_tests_regress_ref_files
+ CONDITION CMD_GRIB_COMPARE
+ COMMAND ${CMD_GRIB_COMPARE}
+ ARGS ${output}.ref ${output}
+ ENVIRONMENT ${_grib_environment} )
+
+ unset( opt )
+ endif()
+ unset( output )
+ unset( input )
+ unset( test )
+ unset( in )
+ endforeach()
+endforeach()
+unset( basen )
+
+# tests with intf2
+# not possible:
+# - regular_ll to reduced_gg (but regular_ll to regular_gg is possible)
+# - regular_gg to reduced_gg
+# - any to rotated reduced_gg/regular_gg
+# - regular_ll to rotated regular_ll
+# - ... weird HIRLAM restrictions?
+# - any to octahedral without FFTW
+# - swh_reduced_ll interpolations (SIGFPE, Arithmetic exception in INTIN) (FIXME: temporary disabling)
+set( basen "regress_EMOS-216_intf2" )
+foreach( area "" "_sub-area" )
+ foreach( rotated "" "rotated_" "hirlam_non-rotated_" )
+ foreach( in "2t_F640" "2t_F640_sub-area" "2t_N640" "2t_O1280" "2t_regular_ll" "2t_regular_ll_staggered" "2t_regular_ll_sub-area" "msl_F640" "msl_F640_sub-area" "msl_N640" "msl_O1280" "msl_regular_ll" "msl_regular_ll_sub-area" "swh_reduced_ll" "swh_reduced_ll_sub-area" "u-v_sh" "z_sh" )
+ foreach( out "regular_ll" "F80" "N80" "O80" "F48" )
+ set( test "${basen}_${in}_to_${rotated}${out}${area}" )
+ set( input "${in}.grib" )
+ set( output "${test}.grib" )
+ if( NOT (test MATCHES "_sub-area_to_" AND NOT test MATCHES "_to_.*_sub-area")
+ AND NOT (test MATCHES "_regular_ll.*_to_[NO]")
+ AND NOT (test MATCHES "_F.+_to_[NO]")
+ AND NOT (test MATCHES "(F.+|reduced_ll)_to_.*rotated_regular_ll")
+ AND NOT (test MATCHES "_to_[NO].*_sub-area")
+ AND NOT (test MATCHES "_to_.*rotated_[NOF]")
+ AND NOT (test MATCHES "_to_.*rotated_.*sub-area")
+ AND NOT (test MATCHES "_regular_ll.*_to_.*rotated_regular_ll$")
+ AND NOT (test MATCHES "_sh.*_to_O" AND NOT HAVE_FFTW)
+ AND NOT (input MATCHES "swh_reduced_ll.*") ) #(FIXME)
+ unset( opt )
+ if( out MATCHES "^regular_ll" )
+ list( APPEND opt "--grid=3/3" )
+ else()
+ list( APPEND opt "--gridname=${out}" )
+ endif()
+ if( "${rotated}" STREQUAL "hirlam_non-rotated_" )
+ list( APPEND opt "--rotation=-90/0" )
+ elseif( "${rotated}" STREQUAL "rotated_" )
+ list( APPEND opt "--rotation=30/30" )
+ endif()
+ if( "${area}" STREQUAL "_sub-area" )
+ list( APPEND opt "--area=70/-60/20/60" )
+ endif()
+
+ # interpolate
+ ecbuild_add_test(
+ TARGET ${test}_interpol
+ DEPENDS int
+ TEST_DEPENDS download_tests_regress_src_files
+ COMMAND ${CMD_INT}
+ ARGS --input=${input} --output=${output} ${opt} --int=intf2
+ ENVIRONMENT ${_emos_environment} )
+
+ # compare results to reference data, strict comparison except in some cases
+ if( (test MATCHES "_F640_to_regular_ll")
+ OR (test MATCHES "_N640_to_(regular_ll|O80|F80|F48)")
+ OR (test MATCHES "_O1280_to_(regular_ll|N80)") )
+ ecbuild_add_test(
+ TARGET ${test}_compare
+ TEST_DEPENDS ${test}_interpol download_tests_regress_ref_files
+ CONDITION CMD_GRIB_COMPARE
+ COMMAND ${CMD_GRIB_COMPARE}
+ ARGS -P -T 2 ${output}.ref ${output}
+ ENVIRONMENT ${_grib_environment} )
+ else()
+ ecbuild_add_test(
+ TARGET ${test}_compare
+ TEST_DEPENDS ${test}_interpol download_tests_regress_ref_files
+ CONDITION CMD_GRIB_COMPARE
+ COMMAND ${CMD_GRIB_COMPARE}
+ ARGS ${output}.ref ${output}
+ ENVIRONMENT ${_grib_environment} )
+ endif()
+
+ unset( opt )
+ endif()
+ unset( output )
+ unset( input )
+ unset( test )
+ endforeach()
+ endforeach()
+ endforeach()
+endforeach()
+unset( basen )
+
+
+###########################################################
+
diff --git a/tests/regress/download_tests_regress_ref_files.txt b/tests/regress/download_tests_regress_ref_files.txt
new file mode 100644
index 0000000..0e0d71d
--- /dev/null
+++ b/tests/regress/download_tests_regress_ref_files.txt
@@ -0,0 +1,110 @@
+regress_EMOS-216_intf2_2t_F640_sub-area_to_F48_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_F640_sub-area_to_F80_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_F640_sub-area_to_regular_ll_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_F640_to_F48.grib.ref
+regress_EMOS-216_intf2_2t_F640_to_F48_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_F640_to_F80.grib.ref
+regress_EMOS-216_intf2_2t_F640_to_F80_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_F640_to_regular_ll.grib.ref
+regress_EMOS-216_intf2_2t_F640_to_regular_ll_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_N640_to_F48.grib.ref
+regress_EMOS-216_intf2_2t_N640_to_F48_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_N640_to_F80.grib.ref
+regress_EMOS-216_intf2_2t_N640_to_F80_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_N640_to_N80.grib.ref
+regress_EMOS-216_intf2_2t_N640_to_O80.grib.ref
+regress_EMOS-216_intf2_2t_N640_to_hirlam_non-rotated_regular_ll.grib.ref
+regress_EMOS-216_intf2_2t_N640_to_regular_ll.grib.ref
+regress_EMOS-216_intf2_2t_N640_to_regular_ll_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_N640_to_rotated_regular_ll.grib.ref
+regress_EMOS-216_intf2_2t_O1280_to_F48.grib.ref
+regress_EMOS-216_intf2_2t_O1280_to_F48_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_O1280_to_F80.grib.ref
+regress_EMOS-216_intf2_2t_O1280_to_F80_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_O1280_to_N80.grib.ref
+regress_EMOS-216_intf2_2t_O1280_to_O80.grib.ref
+regress_EMOS-216_intf2_2t_O1280_to_hirlam_non-rotated_regular_ll.grib.ref
+regress_EMOS-216_intf2_2t_O1280_to_regular_ll.grib.ref
+regress_EMOS-216_intf2_2t_O1280_to_regular_ll_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_O1280_to_rotated_regular_ll.grib.ref
+regress_EMOS-216_intf2_2t_regular_ll_staggered_to_F48.grib.ref
+regress_EMOS-216_intf2_2t_regular_ll_staggered_to_F48_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_regular_ll_staggered_to_F80.grib.ref
+regress_EMOS-216_intf2_2t_regular_ll_staggered_to_F80_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_regular_ll_staggered_to_regular_ll.grib.ref
+regress_EMOS-216_intf2_2t_regular_ll_staggered_to_regular_ll_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_regular_ll_sub-area_to_F48_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_regular_ll_sub-area_to_F80_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_regular_ll_sub-area_to_regular_ll_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_regular_ll_to_F48.grib.ref
+regress_EMOS-216_intf2_2t_regular_ll_to_F48_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_regular_ll_to_F80.grib.ref
+regress_EMOS-216_intf2_2t_regular_ll_to_F80_sub-area.grib.ref
+regress_EMOS-216_intf2_2t_regular_ll_to_regular_ll.grib.ref
+regress_EMOS-216_intf2_2t_regular_ll_to_regular_ll_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_F640_sub-area_to_F48_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_F640_sub-area_to_F80_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_F640_sub-area_to_regular_ll_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_F640_to_F48.grib.ref
+regress_EMOS-216_intf2_msl_F640_to_F48_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_F640_to_F80.grib.ref
+regress_EMOS-216_intf2_msl_F640_to_F80_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_F640_to_regular_ll.grib.ref
+regress_EMOS-216_intf2_msl_F640_to_regular_ll_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_N640_to_F48.grib.ref
+regress_EMOS-216_intf2_msl_N640_to_F48_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_N640_to_F80.grib.ref
+regress_EMOS-216_intf2_msl_N640_to_F80_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_N640_to_N80.grib.ref
+regress_EMOS-216_intf2_msl_N640_to_O80.grib.ref
+regress_EMOS-216_intf2_msl_N640_to_hirlam_non-rotated_regular_ll.grib.ref
+regress_EMOS-216_intf2_msl_N640_to_regular_ll.grib.ref
+regress_EMOS-216_intf2_msl_N640_to_regular_ll_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_N640_to_rotated_regular_ll.grib.ref
+regress_EMOS-216_intf2_msl_O1280_to_F48.grib.ref
+regress_EMOS-216_intf2_msl_O1280_to_F48_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_O1280_to_F80.grib.ref
+regress_EMOS-216_intf2_msl_O1280_to_F80_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_O1280_to_N80.grib.ref
+regress_EMOS-216_intf2_msl_O1280_to_O80.grib.ref
+regress_EMOS-216_intf2_msl_O1280_to_hirlam_non-rotated_regular_ll.grib.ref
+regress_EMOS-216_intf2_msl_O1280_to_regular_ll.grib.ref
+regress_EMOS-216_intf2_msl_O1280_to_regular_ll_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_O1280_to_rotated_regular_ll.grib.ref
+regress_EMOS-216_intf2_msl_regular_ll_sub-area_to_F48_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_regular_ll_sub-area_to_F80_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_regular_ll_sub-area_to_regular_ll_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_regular_ll_to_F48.grib.ref
+regress_EMOS-216_intf2_msl_regular_ll_to_F48_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_regular_ll_to_F80.grib.ref
+regress_EMOS-216_intf2_msl_regular_ll_to_F80_sub-area.grib.ref
+regress_EMOS-216_intf2_msl_regular_ll_to_regular_ll.grib.ref
+regress_EMOS-216_intf2_msl_regular_ll_to_regular_ll_sub-area.grib.ref
+regress_EMOS-216_intf2_u-v_sh_to_F48.grib.ref
+regress_EMOS-216_intf2_u-v_sh_to_F48_sub-area.grib.ref
+regress_EMOS-216_intf2_u-v_sh_to_F80.grib.ref
+regress_EMOS-216_intf2_u-v_sh_to_F80_sub-area.grib.ref
+regress_EMOS-216_intf2_u-v_sh_to_N80.grib.ref
+regress_EMOS-216_intf2_u-v_sh_to_O80.grib.ref
+regress_EMOS-216_intf2_u-v_sh_to_hirlam_non-rotated_regular_ll.grib.ref
+regress_EMOS-216_intf2_u-v_sh_to_regular_ll.grib.ref
+regress_EMOS-216_intf2_u-v_sh_to_regular_ll_sub-area.grib.ref
+regress_EMOS-216_intf2_u-v_sh_to_rotated_regular_ll.grib.ref
+regress_EMOS-216_intf2_z_sh_to_F48.grib.ref
+regress_EMOS-216_intf2_z_sh_to_F48_sub-area.grib.ref
+regress_EMOS-216_intf2_z_sh_to_F80.grib.ref
+regress_EMOS-216_intf2_z_sh_to_F80_sub-area.grib.ref
+regress_EMOS-216_intf2_z_sh_to_N80.grib.ref
+regress_EMOS-216_intf2_z_sh_to_O80.grib.ref
+regress_EMOS-216_intf2_z_sh_to_hirlam_non-rotated_regular_ll.grib.ref
+regress_EMOS-216_intf2_z_sh_to_regular_ll.grib.ref
+regress_EMOS-216_intf2_z_sh_to_regular_ll_sub-area.grib.ref
+regress_EMOS-216_intf2_z_sh_to_rotated_regular_ll.grib.ref
+regress_EMOS-216_intuvp2_vo-d_sh_to_F80.grib.ref
+regress_EMOS-216_intuvp2_vo-d_sh_to_F80_sub-area.grib.ref
+regress_EMOS-216_intuvp2_vo-d_sh_to_N80.grib.ref
+regress_EMOS-216_intuvp2_vo-d_sh_to_N80_sub-area.grib.ref
+regress_EMOS-216_intuvp2_vo-d_sh_to_O80.grib.ref
+regress_EMOS-216_intuvp2_vo-d_sh_to_O80_sub-area.grib.ref
+regress_EMOS-216_intuvp2_vo-d_sh_to_regular_ll.grib.ref
+regress_EMOS-216_intuvp2_vo-d_sh_to_regular_ll_sub-area.grib.ref
diff --git a/tests/regress/download_tests_regress_src_files.txt b/tests/regress/download_tests_regress_src_files.txt
new file mode 100644
index 0000000..5b7cefc
--- /dev/null
+++ b/tests/regress/download_tests_regress_src_files.txt
@@ -0,0 +1,18 @@
+2t_F640.grib
+2t_F640_sub-area.grib
+2t_N640.grib
+2t_O1280.grib
+2t_regular_ll.grib
+2t_regular_ll_staggered.grib
+2t_regular_ll_sub-area.grib
+msl_F640.grib
+msl_F640_sub-area.grib
+msl_N640.grib
+msl_O1280.grib
+msl_regular_ll.grib
+msl_regular_ll_sub-area.grib
+swh_reduced_ll.grib
+swh_reduced_ll_sub-area.grib
+u-v_sh.grib
+vo-d_sh.grib
+z_sh.grib
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index adad6ac..435f3c3 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -20,6 +20,7 @@ if( HAVE_LIBEMOS_INTERPOLATION )
LIBS emos )
if( CMAKE_Fortran_COMPILER_ID MATCHES "PGI" )
+
set_source_files_properties( gg_gridname.c PROPERTIES COMPILE_DEFINITIONS "FORTRAN_LINKER_PGI" )
ecbuild_add_executable(
TARGET gg_gridname NOINSTALL
@@ -29,6 +30,15 @@ if( HAVE_LIBEMOS_INTERPOLATION )
LIBS emos
LINKER_LANGUAGE Fortran )
+ set_source_files_properties( gg_single.c PROPERTIES COMPILE_DEFINITIONS "FORTRAN_LINKER_PGI" )
+ ecbuild_add_executable(
+ TARGET gg_single NOINSTALL
+ SOURCES gg_single.c
+ DEFINITIONS ${LIBEMOS_DEFINITIONS}
+ INCLUDES ${GRIB_API_INCLUDE_DIRS}
+ LIBS emos
+ LINKER_LANGUAGE Fortran )
+
else()
ecbuild_add_executable(
TARGET gg_gridname NOINSTALL
@@ -36,6 +46,12 @@ if( HAVE_LIBEMOS_INTERPOLATION )
DEFINITIONS ${LIBEMOS_DEFINITIONS}
INCLUDES ${GRIB_API_INCLUDE_DIRS}
LIBS emos )
+ ecbuild_add_executable(
+ TARGET gg_single NOINSTALL
+ SOURCES gg_single.c
+ DEFINITIONS ${LIBEMOS_DEFINITIONS}
+ INCLUDES ${GRIB_API_INCLUDE_DIRS}
+ LIBS emos )
endif()
ecbuild_add_executable(
diff --git a/tools/bufrtools_wmo/bufr_add_bias.F90 b/tools/bufrtools_wmo/bufr_add_bias.F90
index 080c4a4..1d1f6d8 100644
--- a/tools/bufrtools_wmo/bufr_add_bias.F90
+++ b/tools/bufrtools_wmo/bufr_add_bias.F90
@@ -558,6 +558,17 @@
call exit(2)
end if
end if
+ elseif((ksec1(7).eq.181).or.(ksec1(7).eq.182)) then
+ cident=' '
+ if(values(1).eq.rvind) then
+ cident=' '
+ else
+ write(cident,'(i7.7)',iostat=ios) nint(values(1))
+ if(ios.ne.0) then
+ print*,'internal write error=',ios
+ call exit(2)
+ end if
+ end if
elseif(ksec1(7).eq.140.OR.ksec1(7).eq.147) then
cident=' '
cident=cvals(1)
diff --git a/tools/gg_latitudes.F b/tools/gg_latitudes.F
index bc4523e..6605bfb 100644
--- a/tools/gg_latitudes.F
+++ b/tools/gg_latitudes.F
@@ -32,7 +32,7 @@ C Declarations
INTEGER IARGC
! local variables
- INTEGER I, J, K
+ INTEGER I, J
CHARACTER*5 ARG, GRID
! global variables (all this to get to NGSPEC)
diff --git a/tools/gg_single.c b/tools/gg_single.c
new file mode 100644
index 0000000..f1bd2cf
--- /dev/null
+++ b/tools/gg_single.c
@@ -0,0 +1,231 @@
+/*
+ * Copyright 2015-2015 ECMWF.
+ *
+ * This software is licensed under the terms of the Apache Licence Version 2.0
+ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
+ *
+ * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
+ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
+ */
+
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "grib_api.h"
+
+
+double gglonlat_(int *knum_, double plat_[], int kpts_[], double field_[], double *badvalue_, int *nn_, double *lon_, double *lat_);
+int jgglat_(int *knum_, double pgauss_[]);
+#ifdef FORTRAN_UPPERCASE
+#define gglonlat_ GGLONLAT
+#define jgglat_ JGGLAT
+#endif
+#ifdef FORTRAN_NO_UNDERSCORE
+#define gglonlat_ gglonlat
+#define jgglat_ jgglat
+#endif
+
+
+#ifdef FORTRAN_LINKER_PGI
+#define main_ MAIN_
+#else
+#define main_ main
+#endif
+
+
+int main_(int argc, char** argv) {
+
+ int err = 0; /* error status */
+ int i; /* argument index */
+ FILE *f = NULL; /* lat/lon file handler */
+ char line[100]; /* text line buffer */
+ int nn = 0; /* if nearest neighbour interpolation is requested */
+
+
+ /* check arguments */
+ if (argc<=1) {
+ fprintf(stdout,
+ "Returns the bilinear-interpolated value at a specific position,\n"
+ "given a global, unrotated Gaussian grid description (from GRIB file).\n"
+ "Usage: %s [--lat=<real> --lon=<real>|--file=<file>] [-n|] grib1 [grib2 [...]]\n"
+ "with file containing \"lat lon\" pair lines.\n"
+ , argv[0] );
+ return 0;
+ }
+
+ double
+ lon = 0.,
+ lat = 0.;
+ for (i=1; i<argc; ++i) {
+ const char *a = argv[i];
+ if (strlen(a)>6 && (!strncmp("--lon=",a,6))) { lon = atof(&a[6]); }
+ else if (strlen(a)>6 && (!strncmp("--lat=",a,6))) { lat = atof(&a[6]); }
+ else if (strlen(a)==2 && (!strncmp("-n",a,2))) { nn = 1; }
+ else if (strlen(a)>7 && (!strncmp("--file=",a,7))) {
+ f = fopen(&a[7],"r");
+ if (f==NULL) {
+ fprintf(stderr,"cannot open file \"%s\".\n",&a[7]);
+ return 1;
+ }
+ }
+ }
+
+
+ /* turn on support for multi fields messages */
+ grib_multi_support_on(0);
+
+
+#if 0
+ /* print GeoPoints header */
+ fprintf(stdout,
+ "#GEO\n"
+ "#FORMAT XYV\n"
+ "x/long y/lat value\n"
+ "#DATA\n");
+#endif
+
+
+ /* for all lat/lon pairs, for all file arguments... */
+ do {
+
+ /* ... update lat/lon with pair from file */
+ if (f!=NULL) {
+ err = (NULL==fgets(line,100,f))
+ || (2!=sscanf(line,"%lf %lf",&lat,&lon));
+ }
+
+ /* check bounds */
+ if (lat>90. || lat<-90. || lon!=lon || lat!=lat || isinf(lon) || isinf(lat)) {
+ fprintf(stderr,"latitude/longitude not usable, (lat,lon)=(%f,%f).\n",lat,lon);
+ err = 2;
+ }
+ else {
+ while (lon>=360.) { lon -= 360.; }
+ while (lon< 0.) { lon += 360.; }
+ }
+
+ /* ... for all grib files, interpolate */
+ for (i=1; !err && i<argc; ++i) {
+ const char *a = argv[i];
+ if ( !strncmp("--lon=", a,6) ||
+ !strncmp("--lat=", a,6) ||
+ !strncmp("-n", a,2) ||
+ !strncmp("--file=",a,7) ) {
+ continue;
+ }
+
+ /* initialize and open file */
+ FILE *g = NULL; /* file handle */
+ grib_handle *h = NULL; /* grib handle */
+ if ((NULL==(g = fopen(a,"r")))) {
+ fprintf(stderr,"unable to open file \"%s\" (argument #%i).\n", a, i);
+ return 2;
+ }
+
+ /* iterate on file grib_handle messages, while failures don't happen */
+ while (NULL!=(h = grib_handle_new_from_file(0,g,&err))) {
+ GRIB_CHECK(err,0);
+
+ /* get gridType */
+ char gridType[80] = "";
+ size_t size = sizeof(gridType);
+ if ((err = grib_get_string(h,"gridType",gridType,&size))) {
+ fprintf(stderr,"cannot get gridType, %s\n",grib_get_error_message(err));
+ break;
+ }
+
+ /* get grid N, Nj, missing value */
+ long N = 0;
+ long Nj = 0;
+ GRIB_CHECK(grib_get_long(h,"N",&N), 0);
+ GRIB_CHECK(grib_get_long(h,"Nj",&Nj), 0);
+ assert(N > 0);
+ assert(Nj > 0);
+
+ /* initialize interfacing structures */
+ int knum = (int) N;
+ int kpts[4000] = {0,};
+ double plat[4000] = {0,};
+ double missingValue = 0.;
+ GRIB_CHECK(grib_get_double(h,"missingValue",&missingValue), 0);
+
+ /* get pl */
+ if (!strcmp(gridType,"regular_gg")) {
+
+ long j;
+ for (j=0; j<Nj; ++j)
+ kpts[j] = (int) (4*N);
+
+ }
+ else if (!strcmp(gridType,"reduced_gg")) {
+
+ size_t pl_len = 0;
+ GRIB_CHECK(grib_get_size(h, "pl", &pl_len), 0);
+ assert(pl_len > 0);
+ if (pl_len != Nj || pl_len != 2*N) {
+ fprintf(stderr, "ERROR: pl array length is %ld but should be 2*N (%ld)!\n", pl_len, 2*N);
+ err = -1;
+ break;
+ }
+
+ long j;
+ long *pl = (long*)malloc(pl_len * sizeof(long));
+ assert(pl);
+ GRIB_CHECK(grib_get_long_array(h, "pl", pl, &pl_len), 0);
+ for (j=0; j<pl_len; ++j)
+ kpts[j] = (int) pl[j];
+ free(pl);
+
+ }
+ else {
+ fprintf(stderr, "ERROR: only regular_gg or reduced_gg supported.\n");
+ err = -2;
+ break;
+ }
+
+ /* get grid Gaussian latitudes */
+ int Nj_ = (int) Nj;
+ GRIB_CHECK(jgglat_(&Nj_,plat), 0);
+
+ /* get (suitable format) field values and interpolate */
+ {
+ size_t values_len = 0;
+ GRIB_CHECK(grib_get_size(h,"values",&values_len),0);
+ assert(values_len > 0);
+
+ double *field = (double*) malloc(values_len*sizeof(double));
+ GRIB_CHECK(grib_get_double_array(h,"values",field,&values_len),0);
+
+ const double value = gglonlat_(&knum,plat,kpts,field,&missingValue,&nn,&lon,&lat);
+ fprintf(stdout, /*value==missingValue? "%f\t%f\tMISS\n":*/ "%f\t%f\t%f\n", lat, lon, value);
+
+ free(field);
+ }
+
+ /* close handle */
+ grib_handle_delete(h);
+
+ }
+
+ /* close grib file */
+ fclose(g);
+
+ }
+
+ } while (!err && f!=NULL); /* ... for all lat/lon, grib files */
+
+
+ /* close lat/lon file if open */
+ if (f!=NULL) {
+ err = err || !feof(f);
+ fclose(f);
+ }
+
+
+ /* return wether all went as expected */
+ return err;
+
+}
diff --git a/tools/int.F b/tools/int.F
index cc7fa8e..07be973 100644
--- a/tools/int.F
+++ b/tools/int.F
@@ -37,7 +37,7 @@ C Locals
C Internals & externals
LOGICAL SPLITARGS
- INTEGER WRAP_INT, WRAP_INTF2, WRAP_INTUVP2
+ INTEGER WRAP_INT, WRAP_INTF2, WRAP_INTUVP2 !, WRAP_INTVECT2
INTEGER IARGC
@@ -77,8 +77,9 @@ C TODO: distinguish INTIN/OUT proper from the command line
IF (KEY.EQ.'regular') R=WRAP_INT(OUT,KEY,VAL,1,0)
IF (KEY.EQ.'int'.AND.F1(1:1).NE.' '.AND.F2(1:1).NE.' ') THEN
- IF (VAL.EQ.'intf2') R=WRAP_INTF2 (F1,F2,JPGRIB,JPBYTES)
- IF (VAL.EQ.'intuvp2') R=WRAP_INTUVP2(F1,F2,JPGRIB,JPBYTES)
+ IF (VAL.EQ.'intf2') R=WRAP_INTF2 (F1,F2,JPGRIB,JPBYTES)
+ IF (VAL.EQ.'intuvp2') R=WRAP_INTUVP2 (F1,F2,JPGRIB,JPBYTES)
+C IF (VAL.EQ.'intvect2') R=WRAP_INTVECT2(F1,F2,JPGRIB,JPBYTES)
ENDIF
ENDIF
@@ -104,11 +105,13 @@ C TODO: distinguish INTIN/OUT proper from the command line
.//' I: points between equator and poles (N)'//N
.//N
.//'with the interpolation function:'//N
- .//' --int=[intf2,intuvp2]: with:'//N
+ .//' --int=[intf2,intuvp2]: with:'//N !,intvect2
.//' intf2: general interpolation'//N
.//' (allows multiple GRIB input)'//N
.//' intuvp2: u/v fields interpolation'//N
.//' (requires vo/d or u/v pair on GRIB input)'//N
+C .//' intvect2: u/v fields interpolation'//N
+C .//' (requires u/v pair on GRIB input)'//N
.//N
.//'and any of the INTIN/INTOUT options (interpreted in order,'//N
.//'some combinations are inconsistent):'//N
@@ -331,6 +334,73 @@ C Closedown
C ------------------------------------------------------------------
+#if 0
+ INTEGER FUNCTION WRAP_INTVECT2(INFILE,OUTFILE,LENGRIB,LENBYTES)
+ IMPLICIT NONE
+ CHARACTER*256 INFILE, OUTFILE
+ INTEGER LENGRIB, LENBYTES
+
+ INTEGER IIAGRIB(LENGRIB), IIBGRIB(LENGRIB)
+ INTEGER IOAGRIB(LENGRIB), IOBGRIB(LENGRIB)
+ INTEGER U1, U2, N, LENINT, IREC, IRET
+
+ INTEGER INTVECT2
+ EXTERNAL INTVECT2
+
+C Open input and output files
+ CALL PBOPEN(U1, INFILE, 'r', IRET)
+ CALL CHECK(IRET.NE.0, 'PBOPEN failed (r).')
+ CALL PBOPEN(U2, OUTFILE, 'w', IRET)
+ CALL CHECK(IRET.NE.0, 'PBOPEN failed (w).')
+
+C Start of loop on input u/v fields
+ N = 0
+ 220 CONTINUE
+ N = N + 1
+
+C Read next u/v
+ CALL PBGRIB(U1, IIAGRIB, LENGRIB*LENBYTES, IREC, IRET)
+ IF (IRET.EQ.-1) THEN
+ IRET = 0
+ GOTO 290
+ ENDIF
+ CALL CHECK(IRET.NE.0, 'PBGRIB failed (u).')
+ CALL PBGRIB(U1, IIBGRIB, LENGRIB*LENBYTES, IREC, IRET)
+ IF (IRET.EQ.-1) THEN
+ IRET = 0
+ GOTO 290
+ ENDIF
+ CALL CHECK(IRET.NE.0, 'PBGRIB failed (v).')
+
+C Interpolate
+ PRINT *, 'Interpolate u/v #', N
+ LENINT = LENGRIB
+ IRET = INTVECT2(IIAGRIB,IIBGRIB,LENGRIB,IOAGRIB,IOBGRIB,LENINT)
+ CALL CHECK(IRET.NE.0, 'INTVECT2 failed.')
+
+C Write the new u/v fields to file
+ IF (LENINT.GT.0) THEN
+ CALL PBWRITE(U2, IOAGRIB, LENINT, IRET)
+ CALL CHECK(IRET.LT.LENINT, 'PBWRITE failed.')
+ CALL PBWRITE(U2, IOBGRIB, LENINT, IRET)
+ CALL CHECK(IRET.LT.LENINT, 'PBWRITE failed.')
+ IRET = 0
+ ENDIF
+
+C Loop back for next field
+ IF (IRET.EQ.0) GOTO 220
+
+C Closedown
+ 290 CONTINUE
+ WRAP_INTVECT2 = IRET
+ CALL PBCLOSE(U1, IRET)
+ CALL PBCLOSE(U2, IRET)
+ PRINT *, 'All done.'
+ ENDFUNCTION
+#endif
+
+
+C ------------------------------------------------------------------
SUBROUTINE CHECK(OOPS,MSG)
IMPLICIT NONE
LOGICAL OOPS
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/emos.git
More information about the debian-science-commits
mailing list