2013-03-25 12:04:10 +00:00
|
|
|
#!/bin/sh
|
2020-01-28 14:32:34 +00:00
|
|
|
# (C) Copyright 2005- ECMWF.
|
2013-03-25 12:04:10 +00:00
|
|
|
#
|
|
|
|
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
|
|
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
2013-03-25 14:23:07 +00:00
|
|
|
#
|
2013-03-25 12:04:10 +00:00
|
|
|
# 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.
|
|
|
|
|
2017-06-13 16:33:06 +00:00
|
|
|
set -e
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2018-01-22 17:38:52 +00:00
|
|
|
if [ -z "$ECCODES_DEFINITION_PATH" ]; then
|
|
|
|
ECCODES_DEFINITION_PATH=`${tools_dir}/codes_info -d`
|
|
|
|
fi
|
|
|
|
|
|
|
|
GRIB_LIST_KEYS=${tools_dir}/grib_list_keys
|
|
|
|
if [ ! -x $GRIB_LIST_KEYS ]; then
|
|
|
|
# Get it from environment variable
|
|
|
|
GRIB_LIST_KEYS=$GRIB_LIST_KEYS_EXE
|
|
|
|
fi
|
2013-03-25 12:04:10 +00:00
|
|
|
|
2019-05-16 12:51:11 +00:00
|
|
|
set +x
|
2013-03-25 12:04:10 +00:00
|
|
|
touch tmp$$
|
2022-05-11 12:15:00 +00:00
|
|
|
echo "Process all files in $ECCODES_DEFINITION_PATH using $GRIB_LIST_KEYS ..."
|
|
|
|
for file in `find $ECCODES_DEFINITION_PATH/ -name '*.def' -print`
|
2013-03-25 12:04:10 +00:00
|
|
|
do
|
2018-01-22 17:38:52 +00:00
|
|
|
${GRIB_LIST_KEYS} $file >> tmp$$
|
2013-03-25 12:04:10 +00:00
|
|
|
done
|
2019-05-16 12:51:11 +00:00
|
|
|
set -x
|
2014-08-28 09:52:28 +00:00
|
|
|
|
2013-03-25 12:04:10 +00:00
|
|
|
cat >keys <<EOF
|
|
|
|
%{
|
|
|
|
#include "grib_api_internal.h"
|
|
|
|
%}
|
2024-03-04 10:25:52 +00:00
|
|
|
struct grib_keys_hash { const char* name; int id;};
|
2013-03-25 12:04:10 +00:00
|
|
|
%%
|
|
|
|
EOF
|
|
|
|
cat tmp$$ | sort | uniq | awk 'BEGIN{x=0;}{print $1","++x}' >> keys
|
|
|
|
#cat tmp$$ | sort | uniq >> keys
|
|
|
|
rm -f tmp$$
|