From 6dcb518b5fb3fe9cf7550f200ef715fb90d2b62b Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 22 Jan 2015 16:44:59 +0000 Subject: [PATCH] ECC-19: Rename grib_info to codes_info --- .gitignore | 2 +- definitions/installDefinitions.sh | 6 +- doxygen/conversion.dox | 4 +- examples/C/include.sh | 2 +- examples/C/set_data.c | 2 +- examples/F77/include.sh | 2 - examples/F90/samples.f90 | 2 +- examples/extra/include.sh | 3 - examples/include.sh | 2 +- fortran/grib_f90_tail.f90 | 2 +- mars_tests/include.sh | 3 - python/gribapi.py | 14 ++-- tests/definitions.sh | 2 +- tests/list_all_keys.ksh | 2 +- tools/CMakeLists.txt | 2 +- tools/Makefile.am | 6 +- tools/grib_info.c | 117 ------------------------------ 17 files changed, 24 insertions(+), 149 deletions(-) delete mode 100644 tools/grib_info.c diff --git a/.gitignore b/.gitignore index 65f3cfb40..13c20701c 100644 --- a/.gitignore +++ b/.gitignore @@ -47,7 +47,7 @@ tools/grib_get tools/grib_get_data tools/grib_histogram tools/grib_index_build -tools/grib_info +tools/codes_info tools/grib_keys tools/grib_list_keys tools/grib_ls diff --git a/definitions/installDefinitions.sh b/definitions/installDefinitions.sh index 8f348df7e..b76d58188 100755 --- a/definitions/installDefinitions.sh +++ b/definitions/installDefinitions.sh @@ -24,7 +24,7 @@ grib_api_bin=$1/bin definitions=$2 -if [ ! -f $grib_api_bin/grib_info ] +if [ ! -f $grib_api_bin/codes_info ] then echo " Unable to find grib_api tools in $grib_api_bin @@ -33,8 +33,8 @@ exit 1 fi set -e -version=`$grib_api_bin/grib_info -v` -defaultDefinitions=`$grib_api_bin/grib_info -d` +version=`$grib_api_bin/codes_info -v` +defaultDefinitions=`$grib_api_bin/codes_info -d` set +e if [ $version != $requiredLibVersion ] diff --git a/doxygen/conversion.dox b/doxygen/conversion.dox index d1be37a6b..4534141c9 100644 --- a/doxygen/conversion.dox +++ b/doxygen/conversion.dox @@ -108,12 +108,12 @@ the environment variable GRIB_DEFINITION_PATH can be used. To set properly this environment variable we have first to find the definitions files directory used by GRIB API. -At this aim we can use the tool grib_info which is providing some configuration +At this aim we can use the tool codes_info which is providing some configuration information about the library. \verbatim -> grib_info +> codes_info grib_api Version 1.8.0 diff --git a/examples/C/include.sh b/examples/C/include.sh index b06de2877..43476b161 100644 --- a/examples/C/include.sh +++ b/examples/C/include.sh @@ -49,6 +49,6 @@ else # Download the data needed for tests ${data_dir}/download.sh "${data_dir}" - #${tools_dir}grib_info + #${tools_dir}codes_info set -u fi diff --git a/examples/C/set_data.c b/examples/C/set_data.c index 673858627..0aba19679 100644 --- a/examples/C/set_data.c +++ b/examples/C/set_data.c @@ -32,7 +32,7 @@ int main(int argc, char** argv) size_t values_len= 0; /* Note: the full name of the sample file is "regular_ll_pl_grib1.tmpl" */ - /* Sample files are stored in the samples directory (use grib_info to */ + /* Sample files are stored in the samples directory (use codes_info to */ /* see where that is). The default sample path can be changed by */ /* setting the environment variable GRIB_SAMPLES_PATH */ const char* sample_filename = "regular_ll_pl_grib1"; diff --git a/examples/F77/include.sh b/examples/F77/include.sh index 9ef3d854c..e3e4e99c6 100644 --- a/examples/F77/include.sh +++ b/examples/F77/include.sh @@ -34,7 +34,5 @@ fi # Download the data needed for tests ${data_dir}/download.sh "${data_dir}" -#${tools_dir}grib_info - set -u diff --git a/examples/F90/samples.f90 b/examples/F90/samples.f90 index 61d8c6060..9db893652 100644 --- a/examples/F90/samples.f90 +++ b/examples/F90/samples.f90 @@ -31,7 +31,7 @@ program sample decimalPrecision = 2 ! A new grib message is loaded from an existing sample. - ! Samples are searched in a default sample path (use grib_info + ! Samples are searched in a default sample path (use codes_info ! to see where that is). The default sample path can be changed by ! setting the environment variable GRIB_SAMPLES_PATH call codes_new_from_samples(igribsample, "regular_latlon_surface.grib1") diff --git a/examples/extra/include.sh b/examples/extra/include.sh index 72d2fe7ea..3b4272a73 100755 --- a/examples/extra/include.sh +++ b/examples/extra/include.sh @@ -31,7 +31,4 @@ then GRIB_API_LIB=`pwd`/src fi -#${tools_dir}grib_info - set -u - diff --git a/examples/include.sh b/examples/include.sh index c00b931d8..d19998d5b 100644 --- a/examples/include.sh +++ b/examples/include.sh @@ -31,7 +31,7 @@ then GRIB_API_LIB=`pwd`/src fi -#${tools_dir}grib_info +#${tools_dir}codes_info set -u diff --git a/fortran/grib_f90_tail.f90 b/fortran/grib_f90_tail.f90 index c0ec31841..e2f41004a 100644 --- a/fortran/grib_f90_tail.f90 +++ b/fortran/grib_f90_tail.f90 @@ -1360,7 +1360,7 @@ !> Create a new valid gribid from a sample contained in a samples directory pointed !> by the environment variable GRIB_SAMPLES_PATH. - !> To know where the samples directory is run the grib_info tool.\n + !> To know where the samples directory is run the codes_info tool.\n !> !> In case of error, if the status parameter (optional) is not given, the program will !> exit with an error message.\n Otherwise the error message can be diff --git a/mars_tests/include.sh b/mars_tests/include.sh index 54ddc063c..d646b369d 100644 --- a/mars_tests/include.sh +++ b/mars_tests/include.sh @@ -44,10 +44,7 @@ then GRIB_API_LIB=`pwd`/src fi -#${tools_dir}grib_info - # go back to current working dir cd $save set -u - diff --git a/python/gribapi.py b/python/gribapi.py index 6178100db..3283e7afb 100644 --- a/python/gribapi.py +++ b/python/gribapi.py @@ -679,17 +679,17 @@ def grib_set_double(gribid,key,value): @require(samplename=str) def grib_new_from_samples(samplename): """ - @brief Create a new valid gribid from a sample. - + @brief Create a new valid gribid from a sample. + The available samples are picked up from the directory pointed to by the environment variable GRIB_SAMPLES_PATH. - To know where the samples directory is run the grib_info tool.\n - + To know where the samples directory is run the codes_info tool.\n + \b Examples: \ref samples.py "samples.py" - + @param samplename name of the sample to be used @return id of the grib loaded in memory - @exception GribInternalError + @exception GribInternalError """ err,gribid = _internal.grib_c_new_from_samples(0,samplename) GRIB_CHECK(err) @@ -699,7 +699,7 @@ def grib_new_from_samples(samplename): def grib_clone(gribid_src): """ @brief Create a copy of a message. - + Create a copy of a given message (\em gribid_src) resulting in a new message in memory (\em gribid_dest) identical to the original one. diff --git a/tests/definitions.sh b/tests/definitions.sh index 5a7836764..fe68d7c1e 100755 --- a/tests/definitions.sh +++ b/tests/definitions.sh @@ -13,7 +13,7 @@ REDIRECT=/dev/null -[ -z "$GRIB_DEFINITION_PATH" ] | GRIB_DEFINITION_PATH=`${tools_dir}grib_info -d` +[ -z "$GRIB_DEFINITION_PATH" ] | GRIB_DEFINITION_PATH=`${tools_dir}codes_info -d` for file in `find $GRIB_DEFINITION_PATH -name '*.def' -print` do diff --git a/tests/list_all_keys.ksh b/tests/list_all_keys.ksh index 6fac0a08e..0f5535bed 100755 --- a/tests/list_all_keys.ksh +++ b/tests/list_all_keys.ksh @@ -9,7 +9,7 @@ . ./include.sh -[ -z "$GRIB_DEFINITION_PATH" ] | GRIB_DEFINITION_PATH=`${tools_dir}grib_info -d` +[ -z "$GRIB_DEFINITION_PATH" ] | GRIB_DEFINITION_PATH=`${tools_dir}codes_info -d` touch tmp$$ for file in `find $GRIB_DEFINITION_PATH -name '*.def' -print` diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 668b13714..1d4bc08bc 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -10,7 +10,7 @@ ecbuild_add_library( TARGET grib_tools list( APPEND grib_tools_bins grib_keys grib_histogram grib_error grib_add big2gribex - grib_info grib_filter grib_ls grib_dump grib_merge + codes_info grib_filter grib_ls grib_dump grib_merge grib2ppm grib_set grib_get grib_get_data grib_copy grib_repair grib_packing grib_distance grib_corruption_check grib_compare parser grib_count grib_index_build diff --git a/tools/Makefile.am b/tools/Makefile.am index fb71b3e45..5fb19c48c 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -14,7 +14,7 @@ libgrib_tools_la_SOURCES = grib_tools.c \ dist_bin_SCRIPTS = bufr_compare_dir bin_PROGRAMS = grib_keys grib_histogram grib_error grib_add big2gribex \ - grib_info grib_filter grib_ls grib_dump grib_merge \ + codes_info grib_filter grib_ls grib_dump grib_merge \ grib2ppm grib_set grib_get grib_get_data grib_copy grib_repair \ grib_packing grib_distance grib_corruption_check\ grib_compare grib_list_keys parser grib_count grib_index_build grib1to2 \ @@ -40,12 +40,12 @@ grib_count_SOURCES = grib_count.c grib_packing_SOURCES = grib_packing.c grib_histogram_SOURCES = grib_histogram.c grib_distance_SOURCES = grib_distance.c -#grib_debug_SOURCES = grib_debug.c +#grib_debug_SOURCES = grib_debug.c parser_SOURCES = parser.c grib_list_keys_SOURCES = list_keys.c all_keys_SOURCES = all_keys.c grib2ppm_SOURCES = grib2ppm.c -grib_info_SOURCES = grib_info.c +codes_info_SOURCES = codes_info.c grib_keys_SOURCES = grib_keys.c grib_ls_SOURCES = grib_ls.c grib_copy_SOURCES = grib_copy.c diff --git a/tools/grib_info.c b/tools/grib_info.c deleted file mode 100644 index 23d0a547e..000000000 --- a/tools/grib_info.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2005-2015 ECMWF. - * - * This software is licensed under the terms of the Apache Licence Version 2.0 - * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. - * - * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by - * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. - */ - -/* - * C Implementation: grib_info - * - * Description: - * - */ - -#include "grib_tools.h" - -void usage( char*); - -#define INFO_PRINT_ALL 0 -#define INFO_PRINT_VERSION (1<<0) -#define INFO_PRINT_DEFINITION_PATH (1<<1) -#define INFO_PRINT_SAMPLES_PATH (1<<2) - -int main( int argc,char* argv[]) { - char* path=NULL; - int c=0; - int nfiles=0; - unsigned long print_flags=0; - int major=GRIB_API_MAJOR_VERSION; - int minor=GRIB_API_MINOR_VERSION; - int revision=GRIB_API_REVISION_VERSION; - - while (1) { - - c = getopt (argc, argv, "vdt"); - - if (c == -1) - break; - - switch (c) { - case 'v': - print_flags|=INFO_PRINT_VERSION; - break; - case 'd': - print_flags|=INFO_PRINT_DEFINITION_PATH; - break; - case 't': - print_flags|=INFO_PRINT_SAMPLES_PATH; - break; - default: - usage(argv[0]); - } - } - - nfiles=argc-optind; - if (nfiles != 0) usage(argv[0]); - - if (print_flags == INFO_PRINT_ALL) { - printf("\n"); - printf("grib_api Version %d.%d.%d", - major,minor,revision); - if (GRIB_API_MAJOR_VERSION < 1) printf(" PRE-RELEASE"); - printf("\n"); - printf("\n"); - - - if ((path=getenv("GRIB_DEFINITION_PATH")) != NULL) { - printf("Definition files path from environment variable"); - printf(" GRIB_DEFINITION_PATH=%s\n",path); - } else { - printf("Default definition files path is used: %s\n",GRIB_DEFINITION_PATH); - printf("Definition files path can be changed setting GRIB_DEFINITION_PATH environment variable\n"); - } - printf("\n"); - - if ((path=getenv("GRIB_SAMPLES_PATH")) != NULL) { - printf("SAMPLES path from environment variable"); - printf(" GRIB_SAMPLES_PATH=%s\n",path); - } else { - printf("Default SAMPLES path is used: %s\n",GRIB_SAMPLES_PATH); - printf("SAMPLES path can be changed setting GRIB_SAMPLES_PATH environment variable\n"); - } - printf("\n"); - return 0; - } - - if (print_flags & INFO_PRINT_VERSION) - printf("%d.%d.%d ",major,minor,revision); - - if (print_flags & INFO_PRINT_DEFINITION_PATH) { - if ((path=getenv("GRIB_DEFINITION_PATH")) != NULL) { - printf("%s",path); - } else { - printf("%s",GRIB_DEFINITION_PATH); - } - } - - if (print_flags & INFO_PRINT_SAMPLES_PATH) { - if ((path=getenv("GRIB_SAMPLES_PATH")) != NULL) { - printf("%s",path); - } else { - printf("%s",GRIB_SAMPLES_PATH); - } - } - - return 0; -} - - - -void usage(char* progname) { - printf("\nUsage: %s [-v] [-d] [-t]\n",progname); - exit(1); -}