mirror of https://github.com/ecmwf/eccodes.git
Merge branch 'ecmwf:develop' into feature/destine-layout
This commit is contained in:
commit
a0af1467ae
|
@ -22,14 +22,15 @@
|
|||
# libaec_DIR
|
||||
# LIBAEC_PATH
|
||||
# libaec_PATH
|
||||
# libaec_ROOT
|
||||
|
||||
find_path( AEC_INCLUDE_DIR libaec.h
|
||||
PATHS ${AEC_DIR} ${AEC_PATH} ${LIBAEC_DIR} ${libaec_DIR} ${LIBAEC_PATH} ${libaec_PATH} ENV AEC_DIR ENV AEC_PATH ENV LIBAEC_DIR ENV libaec_DIR ENV LIBAEC_PATH ENV libaec_PATH
|
||||
PATHS ${AEC_DIR} ${AEC_PATH} ${LIBAEC_DIR} ${libaec_DIR} ${LIBAEC_PATH} ${libaec_PATH} ${libaec_ROOT} ENV AEC_DIR ENV AEC_PATH ENV LIBAEC_DIR ENV libaec_DIR ENV LIBAEC_PATH ENV libaec_PATH ENV libaec_ROOT
|
||||
PATH_SUFFIXES include include/aec NO_DEFAULT_PATH )
|
||||
find_path( AEC_INCLUDE_DIR libaec.h PATH_SUFFIXES include include/aec )
|
||||
|
||||
find_library( AEC_LIBRARY NAMES aec
|
||||
PATHS ${AEC_DIR} ${AEC_PATH} ${LIBAEC_DIR} ${libaec_DIR} ${LIBAEC_PATH} ${libaec_PATH} ENV AEC_DIR ENV AEC_PATH ENV LIBAEC_DIR ENV libaec_DIR ENV LIBAEC_PATH ENV libaec_PATH
|
||||
PATHS ${AEC_DIR} ${AEC_PATH} ${LIBAEC_DIR} ${libaec_DIR} ${LIBAEC_PATH} ${libaec_PATH} ${libaec_ROOT} ENV AEC_DIR ENV AEC_PATH ENV LIBAEC_DIR ENV libaec_DIR ENV LIBAEC_PATH ENV libaec_PATH ENV libaec_ROOT
|
||||
PATH_SUFFIXES lib lib64 lib/aec lib64/aec NO_DEFAULT_PATH )
|
||||
find_library( AEC_LIBRARY NAMES aec PATH_SUFFIXES lib lib64 lib/aec lib64/aec )
|
||||
|
||||
|
|
|
@ -23,15 +23,14 @@ section_length[3] section1Length;
|
|||
meta section1Pointer section_pointer(offsetSection1,section1Length,1);
|
||||
constant wrongPadding=0;
|
||||
|
||||
# GRIB tables Version No.
|
||||
# GRIB tables Version No.
|
||||
# (currently 3 for international exchange)
|
||||
unsigned[1] table2Version : edition_specific,dump;
|
||||
unsigned[1] table2Version : edition_specific,dump;
|
||||
alias gribTablesVersionNo=table2Version;
|
||||
|
||||
|
||||
#assert(section1Length > 5);
|
||||
|
||||
# Identification of originating/generating centre
|
||||
# Identification of originating/generating centre
|
||||
codetable[1] centre 'common/c-1.table' : dump,string_type;
|
||||
alias identificationOfOriginatingGeneratingCentre=centre;
|
||||
meta centreDescription codetable_title(centre);
|
||||
|
@ -40,8 +39,7 @@ alias parameter.centre=centre;
|
|||
alias originatingCentre=centre;
|
||||
alias ls.centre = centre;
|
||||
|
||||
# Generating process identification number
|
||||
# (allocated by originating centre)
|
||||
# Generating process identification number
|
||||
unsigned[1] generatingProcessIdentifier : dump;
|
||||
alias generatingProcessIdentificationNumber=generatingProcessIdentifier;
|
||||
alias process=generatingProcessIdentifier;
|
||||
|
@ -269,7 +267,6 @@ if(((section1Length > 40) or new() or setLocalDefinition> 0) and deleteLocalDefi
|
|||
}
|
||||
|
||||
template_nofail marsKeywords "mars/grib.[stream:s].[type:s].def";
|
||||
#template marsKeywords "mars/grib.[stream:s].[type:s].def";
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -286,13 +283,12 @@ if(((section1Length > 40) or new() or setLocalDefinition> 0) and deleteLocalDefi
|
|||
else
|
||||
{
|
||||
constant localUsePresent = 0 : edition_specific;
|
||||
# template defaultMarsLabeling "mars/default_labeling.def";
|
||||
}
|
||||
|
||||
section_padding section1Padding : read_only;
|
||||
|
||||
#if (!wrongPadding) {
|
||||
# padtoeven evenpadding_sec1(offsetSection1,section1Length);
|
||||
# padtoeven evenpadding_sec1(offsetSection1,section1Length);
|
||||
#}
|
||||
|
||||
concept shortNameECMF (defaultShortName,"shortName.def",conceptsMasterDir,conceptsLocalDirECMF) : no_copy;
|
||||
|
|
|
@ -165,8 +165,9 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len)
|
|||
size_t i = 0, slen = strlen(val);
|
||||
|
||||
if (slen != expected_slen || *len != expected_slen) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR,"pack_string: key %s is %lu bytes. Expected a string with %lu characters",
|
||||
a->name, expected_blen, expected_slen);
|
||||
grib_context_log(c, GRIB_LOG_ERROR,
|
||||
"%s: Key %s is %lu bytes. Expected a string with %lu characters (actual length=%zu)",
|
||||
__func__, a->name, expected_blen, expected_slen, *len);
|
||||
return GRIB_WRONG_ARRAY_SIZE;
|
||||
}
|
||||
|
||||
|
@ -176,7 +177,7 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len)
|
|||
for (i = 0; i < (slen/2); i++) {
|
||||
unsigned int byteVal = 0;
|
||||
if (sscanf(val + 2*i, "%02x", &byteVal) != 1) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR,"pack_string: Invalid hex byte specfication '%.2s'",val + 2*i);
|
||||
grib_context_log(c, GRIB_LOG_ERROR,"%s: Invalid hex byte specfication '%.2s'", __func__, val + 2*i);
|
||||
grib_context_free(c, bytearray);
|
||||
return GRIB_INVALID_KEY_VALUE;
|
||||
}
|
||||
|
|
|
@ -469,7 +469,10 @@ static int pack_long(grib_accessor* a, const long* v, size_t* len)
|
|||
grib_context_free(c, val);
|
||||
return ret;
|
||||
}
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Should not grib_pack %s as long", a->name);
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Should not pack '%s' as an integer", a->name);
|
||||
if (a->cclass->pack_string && a->cclass->pack_string != &pack_string) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Try packing as a string");
|
||||
}
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -507,7 +510,10 @@ static int pack_double(grib_accessor* a, const double* v, size_t* len)
|
|||
if (do_pack_as_long) {
|
||||
return pack_double_array_as_long(a, v, len);
|
||||
}
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Should not grib_pack %s as double", a->name);
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Should not pack '%s' as a double", a->name);
|
||||
if (a->cclass->pack_string && a->cclass->pack_string != &pack_string) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "Try packing as a string");
|
||||
}
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
* 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.
|
||||
*/
|
||||
/***********************************************************
|
||||
* Enrico Fucile
|
||||
***********************************************************/
|
||||
|
||||
#include "grib_api_internal.h"
|
||||
/*
|
||||
|
@ -181,13 +178,13 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len)
|
|||
|
||||
static int pack_long(grib_accessor* a, const long* v, size_t* len)
|
||||
{
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, " Should not pack %s as long", a->name);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as an integer", a->name);
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static int pack_double(grib_accessor* a, const double* v, size_t* len)
|
||||
{
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, " Should not pack %s as double", a->name);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as a double", a->name);
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
* 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.
|
||||
*/
|
||||
/***********************************************************
|
||||
* Enrico Fucile
|
||||
***********************************************************/
|
||||
|
||||
#include "grib_api_internal.h"
|
||||
/*
|
||||
|
@ -206,13 +203,13 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len)
|
|||
|
||||
static int pack_long(grib_accessor* a, const long* v, size_t* len)
|
||||
{
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, " Should not pack %s as long", a->name);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as an integer", a->name);
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static int pack_double(grib_accessor* a, const double* v, size_t* len)
|
||||
{
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, " Should not pack %s as double", a->name);
|
||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as a double", a->name);
|
||||
return GRIB_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ grib_check_key_equals $temp2 uuidOfHGrid '10991111111111111111115000110000'
|
|||
|
||||
|
||||
# Test errors
|
||||
# --------------
|
||||
set +e
|
||||
# Invalid HEX
|
||||
${tools_dir}/grib_set -s uuidOfHGrid=DEZZBEef10203040b00b1e50001100FF $temp1 $temp2 2>$errlog
|
||||
|
@ -40,6 +41,15 @@ set -e
|
|||
[ $status -ne 0 ]
|
||||
grep -q "Invalid hex byte specfication 'ZZ'" $errlog
|
||||
|
||||
# Packing as an integer
|
||||
set +e
|
||||
${tools_dir}/grib_set -s uuidOfHGrid=12345 $temp1 $temp2 2>$errlog
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
grep -q "Should not pack 'uuidOfHGrid' as an integer" $errlog
|
||||
grep -q "Try packing as a string" $errlog
|
||||
|
||||
|
||||
# Clean up
|
||||
rm -f $temp1 $temp2 $errlog
|
||||
|
|
Loading…
Reference in New Issue