Merge branch 'develop' into feature/modernisation_merge_accessor_classes

This commit is contained in:
Eugen Betke 2024-09-13 15:02:27 +02:00
commit 0627b526fe
46 changed files with 176 additions and 149 deletions

View File

@ -18,7 +18,16 @@
cmake_minimum_required( VERSION 3.12 FATAL_ERROR )
find_package( ecbuild 3.7 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild)
find_package( ecbuild 3.7 HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild)
if(NOT ecbuild_FOUND)
message(STATUS "Fetching ecbuild...")
include(FetchContent)
FetchContent_Populate(ecbuild
GIT_REPOSITORY https://github.com/ecmwf/ecbuild.git
GIT_TAG 3.8.5
)
find_package( ecbuild 3.7 REQUIRED HINTS ${ecbuild_SOURCE_DIR})
endif()
# Initialise project
project( eccodes LANGUAGES CXX )

View File

@ -4,5 +4,6 @@ alias mars.fcmonth = marsForecastMonth;
unalias mars.step;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -6,7 +6,10 @@ if (class is "od") { alias mars.system = systemNumber; }
if (class is "c3") { alias mars.system = systemNumber; }
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}
if (class is "ci") { unalias mars.method; }

View File

@ -8,7 +8,10 @@ if (class is "od") { alias mars.system = systemNumber; }
if (class is "c3") { alias mars.system = systemNumber; }
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}
if (class is "ci") { unalias mars.method; }

View File

@ -15,7 +15,7 @@ if (class isnot "gw") { # ECC-1448
}
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}

View File

@ -18,7 +18,7 @@ if (class isnot "gw") { # ECC-1448
}
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}

View File

@ -5,13 +5,15 @@ unalias mars.step;
alias mars.origin = centre;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "c3") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en" || class is "c3") {
alias mars.system = systemNumber;
}
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}
if (class is "ci") { unalias mars.method; }

View File

@ -6,13 +6,15 @@ alias mars.number = perturbationNumber;
alias mars.origin = centre;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "c3") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en" || class is "c3") {
alias mars.system = systemNumber;
}
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}
if (class is "ci") { unalias mars.method; }

View File

@ -6,14 +6,12 @@ alias mars.method = methodNumber;
unalias mars.step;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "c3") { alias mars.system = systemNumber; }
if (class is "ci") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en" || class is "c3" || class is "ci") {
alias mars.system = systemNumber;
}
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}

View File

@ -5,14 +5,14 @@ alias mars.number = perturbationNumber;
alias mars.origin = centre;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "c3") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en" || class is "c3") {
alias mars.system = systemNumber;
}
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}
if (class is "ci") { unalias mars.method; }

View File

@ -7,13 +7,14 @@ unalias mars.step;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "c3") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en" || class is "c3") {
alias mars.system = systemNumber;
}
# See ECC-624
if (centre == 80 && subCentre == 98 && class is "c3") {
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}
if (class is "ci") { unalias mars.method; }

View File

@ -1 +0,0 @@
grib.msmm.em.def

View File

@ -0,0 +1,18 @@
# assert(16);
alias mars.fcmonth = marsForecastMonth;
unalias mars.step;
alias mars.origin = centre;
alias mars.method = methodNumber;
if (class is "od" || class is "me" || class is "en" || class is "c3") {
alias mars.system = systemNumber;
}
# See ECC-624
if (centre == 80 && subCentre == 98 && (class is "c3" || class is "ci")) {
constant cnmc_cmcc = 'cmcc';
alias mars.origin = cnmc_cmcc;
}
if (class is "ci") { unalias mars.method; }

View File

@ -1,5 +1,6 @@
alias mars.number = perturbationNumber;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -1,5 +1,5 @@
alias mars.number = perturbationNumber;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -1,5 +1,5 @@
alias mars.number = perturbationNumber;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -1,5 +1,5 @@
alias mars.number = perturbationNumber;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -1,5 +1,5 @@
alias mars.number = perturbationNumber;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -4,6 +4,6 @@ alias mars.number = perturbationNumber;
unalias mars.step;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -4,6 +4,6 @@ alias mars.number = perturbationNumber;
unalias mars.step;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -4,6 +4,6 @@ alias mars.number = perturbationNumber;
unalias mars.step;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -4,6 +4,6 @@ alias mars.number = perturbationNumber;
unalias mars.step;
alias mars.method = methodNumber;
if (class is "od") { alias mars.system = systemNumber; }
if (class is "me") { alias mars.system = systemNumber; }
if (class is "en") { alias mars.system = systemNumber; }
if (class is "od" || class is "me" || class is "en") {
alias mars.system = systemNumber;
}

View File

@ -357,7 +357,6 @@ list( APPEND eccodes_src_files
eccodes_prototypes.h
grib_dumper_class.h
grib_dumper_factory.h
grib_emoslib.h
grib_iterator_class.h
grib_iterator_factory.h
grib_nearest_class.h

View File

@ -106,9 +106,8 @@ int grib_accessor_g1end_of_interval_monthly_t::compare(grib_accessor* b)
long count = 0;
size_t alen = 0;
size_t blen = 0;
int err = 0;
err = value_count(&count);
int err = value_count(&count);
if (err)
return err;
alen = count;
@ -128,7 +127,10 @@ int grib_accessor_g1end_of_interval_monthly_t::compare(grib_accessor* b)
dirty_ = 1;
err = unpack_double(aval, &alen);
if (err) return err;
err = b->unpack_double(bval, &blen);
if (err) return err;
for (size_t i = 0; i < alen && retval == GRIB_SUCCESS; ++i) {
if (aval[i] != bval[i]) retval = GRIB_DOUBLE_VALUE_MISMATCH;
}

View File

@ -123,7 +123,7 @@ long grib_accessor_gen_t::byte_offset()
int grib_accessor_gen_t::unpack_bytes(unsigned char* val, size_t* len)
{
unsigned char* buf = grib_handle_of_accessor(this)->buffer->data;
const unsigned char* buf = grib_handle_of_accessor(this)->buffer->data;
const long length = byte_count();
const long offset = byte_offset();

View File

@ -18,7 +18,7 @@ void grib_accessor_getenv_t::init(const long l, grib_arguments* args)
grib_accessor_ascii_t::init(l, args);
static char undefined[] = "undefined";
name_ = grib_arguments_get_string(grib_handle_of_accessor(this), args, 0);
envvar_ = grib_arguments_get_string(grib_handle_of_accessor(this), args, 0);
default_value_ = grib_arguments_get_string(grib_handle_of_accessor(this), args, 1);
if (!default_value_)
default_value_ = undefined;
@ -36,7 +36,7 @@ int grib_accessor_getenv_t::unpack_string(char* val, size_t* len)
size_t l = 0;
if (!value_) {
v = getenv(name_);
v = getenv(envvar_);
if (!v)
v = (char*)default_value_;
value_ = v;

View File

@ -26,7 +26,7 @@ public:
private:
// TODO(maee): shadows name_?
const char* name_;
const char* envvar_;
char* value_;
const char* default_value_;
};

View File

@ -16,7 +16,7 @@ grib_accessor* grib_accessor_group = &_grib_accessor_group;
void grib_accessor_group_t::init(const long len, grib_arguments* arg)
{
grib_accessor_gen_t::init(len, arg);
grib_buffer* buffer = grib_handle_of_accessor(this)->buffer;
const grib_buffer* buffer = grib_handle_of_accessor(this)->buffer;
size_t i = 0;
unsigned char* v;

View File

@ -56,6 +56,6 @@ int grib_accessor_gts_header_t::value_count(long* count)
size_t grib_accessor_gts_header_t::string_length()
{
grib_handle* h = grib_handle_of_accessor(this);
const grib_handle* h = grib_handle_of_accessor(this);
return h->gts_header_len;
}

View File

@ -23,8 +23,8 @@ void grib_accessor_md5_t::init(const long len, grib_arguments* arg)
grib_string_list* current = 0;
grib_context* context = context_;
offset_ = grib_arguments_get_name(grib_handle_of_accessor(this), arg, n++);
length_ = grib_arguments_get_expression(grib_handle_of_accessor(this), arg, n++);
offset_key_ = grib_arguments_get_name(grib_handle_of_accessor(this), arg, n++);
length_key_ = grib_arguments_get_expression(grib_handle_of_accessor(this), arg, n++);
blocklist_ = NULL;
while ((b = (char*)grib_arguments_get_name(grib_handle_of_accessor(this), arg, n++)) != NULL) {
if (!blocklist_) {
@ -97,9 +97,9 @@ int grib_accessor_md5_t::unpack_string(char* v, size_t* len)
return GRIB_BUFFER_TOO_SMALL;
}
if ((ret = grib_get_long_internal(grib_handle_of_accessor(this), offset_, &offset)) != GRIB_SUCCESS)
if ((ret = grib_get_long_internal(grib_handle_of_accessor(this), offset_key_, &offset)) != GRIB_SUCCESS)
return ret;
if ((ret = grib_expression_evaluate_long(grib_handle_of_accessor(this), length_, &length)) != GRIB_SUCCESS)
if ((ret = grib_expression_evaluate_long(grib_handle_of_accessor(this), length_key_, &length)) != GRIB_SUCCESS)
return ret;
mess = (unsigned char*)grib_context_malloc(context_, length);
memcpy(mess, grib_handle_of_accessor(this)->buffer->data + offset, length);

View File

@ -27,7 +27,7 @@ public:
int compare(grib_accessor*) override;
private:
const char* offset_;
grib_expression* length_;
const char* offset_key_;
grib_expression* length_key_;
grib_string_list* blocklist_;
};

View File

@ -16,12 +16,9 @@ grib_accessor* grib_accessor_non_alpha = &_grib_accessor_non_alpha;
void grib_accessor_non_alpha_t::init(const long len, grib_arguments* arg)
{
grib_accessor_gen_t::init(len, arg);
grib_buffer* buffer = grib_handle_of_accessor(this)->buffer;
const grib_buffer* buffer = grib_handle_of_accessor(this)->buffer;
unsigned char* v = buffer->data + offset_;
size_t i = 0;
unsigned char* v;
v = buffer->data + offset_;
i = 0;
while ((*v < 33 || *v > 126) && i <= buffer->ulength) {
v++;
i++;

View File

@ -193,17 +193,16 @@ long grib_accessor_signed_t::next_offset()
int grib_accessor_signed_t::is_missing()
{
int i = 0;
unsigned char ff = 0xff;
unsigned long offset = offset_;
grib_handle* hand = grib_handle_of_accessor(this);
const grib_handle* hand = grib_handle_of_accessor(this);
if (length_ == 0) {
Assert(vvalue_ != NULL);
return vvalue_->missing;
}
for (i = 0; i < length_; i++) {
for (long i = 0; i < length_; i++) {
if (hand->buffer->data[offset] != ff)
return 0;
offset++;

View File

@ -17,7 +17,7 @@ int grib_accessor_uint64_t::unpack_long(long* val, size_t* len)
{
long value = 0;
long pos = offset_;
unsigned char* data = grib_handle_of_accessor(this)->buffer->data;
const unsigned char* data = grib_handle_of_accessor(this)->buffer->data;
unsigned long long result = 0, tmp;
int i;

View File

@ -17,15 +17,14 @@ int grib_accessor_uint64_little_endian_t::unpack_long(long* val, size_t* len)
{
long value = 0;
long pos = offset_;
unsigned char* data = grib_handle_of_accessor(this)->buffer->data;
const unsigned char* data = grib_handle_of_accessor(this)->buffer->data;
unsigned long long result = 0, tmp;
int i;
if (*len < 1) {
return GRIB_ARRAY_TOO_SMALL;
}
for (i = 7; i >= 0; i--) {
for (int i = 7; i >= 0; i--) {
result <<= 8;
result |= data[pos + i];
}

View File

@ -15,9 +15,9 @@ grib_accessor* grib_accessor_uint8 = &_grib_accessor_uint8;
int grib_accessor_uint8_t::unpack_long(long* val, size_t* len)
{
long value = 0;
long pos = offset_;
unsigned char* data = grib_handle_of_accessor(this)->buffer->data;
long value = 0;
long pos = offset_;
const unsigned char* data = grib_handle_of_accessor(this)->buffer->data;
if (*len < 1) {
return GRIB_ARRAY_TOO_SMALL;

View File

@ -238,9 +238,9 @@ long grib_accessor_unsigned_t::next_offset()
int grib_accessor_unsigned_t::is_missing()
{
unsigned char ff = 0xff;
unsigned long offset = offset_;
grib_handle* hand = grib_handle_of_accessor(this);
const unsigned char ff = 0xff;
unsigned long offset = offset_;
const grib_handle* hand = grib_handle_of_accessor(this);
if (length_ == 0) {
Assert(vvalue_ != NULL);

View File

@ -65,7 +65,7 @@ static void init_class(grib_action_class* c)
}
/* END_CLASS_IMP */
grib_action* grib_action_create_close(grib_context* context, char* filename)
grib_action* grib_action_create_close(grib_context* context, const char* filename)
{
char buf[1024];
grib_action_close* a;

View File

@ -86,7 +86,7 @@ grib_action* grib_action_create_write(grib_context* context, const char* name, i
grib_action* grib_action_create_print(grib_context* context, const char* name, char* outname);
/* action_class_close.cc */
grib_action* grib_action_create_close(grib_context* context, char* filename);
grib_action* grib_action_create_close(grib_context* context, const char* filename);
/* action_class_variable.cc */
grib_action* grib_action_create_variable(grib_context* context, const char* name, const char* op, const long len, grib_arguments* params, grib_arguments* default_value, int flags, const char* name_space);

View File

@ -810,14 +810,14 @@ void grib_context_reset(grib_context* c)
if (c->grib_definition_files_dir) {
grib_string_list* next = c->grib_definition_files_dir;
grib_string_list* cur = NULL;
grib_string_list* cur = NULL;
while (next) {
cur = next;
next = next->next;
grib_context_free(c, cur->value);
grib_context_free(c, cur);
}
c->grib_definition_files_dir=0;
c->grib_definition_files_dir = 0;
}
if (c->multi_support_on)

View File

@ -1,13 +0,0 @@
/*
* (C) Copyright 2005- 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.
*/
int igglat_(long* KLAT, float* PGAUSS, long* KPR, long* KERR);
void gribex_(long* KSEC0, long* KSEC1, long* KSEC2, double* PSEC2, long* KSEC3, double* PSEC3, long* KSEC4,
double* PSEC4, long* KLENP, void* KGRIB, long* KLENG, long* KWORD, char* HOPER, long* KRET);

View File

@ -113,14 +113,12 @@ static int grib_fieldset_new_column(grib_fieldset* set, int id, char* key, int t
static void grib_fieldset_delete_columns(grib_fieldset* set)
{
int i = 0;
grib_context* c;
if (!set)
return;
c = set->context;
for (i = 0; i < set->columns_size; i++) {
const grib_context* c = set->context;
for (size_t i = 0; i < set->columns_size; i++) {
int j = 0;
switch (set->columns[i].type) {
case GRIB_TYPE_LONG:
@ -146,22 +144,19 @@ static void grib_fieldset_delete_columns(grib_fieldset* set)
static int grib_fieldset_columns_resize(grib_fieldset* set, size_t newsize)
{
double* newdoubles;
long* newlongs;
char** newstrings;
int* newerrors;
int i = 0;
grib_context* c;
if (!set || !set->columns)
return GRIB_INVALID_ARGUMENT;
c = set->context;
double* newdoubles = NULL;
long* newlongs = NULL;
char** newstrings = NULL;
int* newerrors = NULL;
const grib_context* c = set->context;
if (newsize <= set->columns[0].values_array_size)
return 0;
for (i = 0; i < set->columns_size; i++) {
for (size_t i = 0; i < set->columns_size; i++) {
switch (set->columns[i].type) {
case GRIB_TYPE_LONG:
newlongs = (long*)grib_context_realloc(c, set->columns[i].long_values,
@ -818,12 +813,9 @@ static int grib_fieldset_resize_int_array(grib_int_array* a, size_t newsize)
static void grib_fieldset_delete_int_array(grib_int_array* f)
{
grib_context* c = NULL;
if (!f)
return;
c = f->context;
if (!f) return;
const grib_context* c = f->context;
grib_context_free(c, f->el);
grib_context_free(c, f);
}

View File

@ -287,8 +287,8 @@ void grib_file_pool_delete_file(grib_file* file)
void grib_file_close(const char* filename, int force, int* err)
{
grib_file* file = NULL;
grib_context* context = grib_context_get_default();
grib_file* file = NULL;
const grib_context* context = grib_context_get_default();
/* Performance: keep the files open to avoid opening and closing files when writing the output. */
/* So only call fclose() when too many files are open. */

View File

@ -143,8 +143,8 @@ static int compute_gaussian_latitudes(long trunc, double* lats)
lats[nlat - 1 - jlat] = -lats[jlat];
}
if (nlat != (trunc * 2))
lats[trunc + 1] = 0.0;
//if (nlat != (trunc * 2))
// lats[trunc + 1] = 0.0;
return GRIB_SUCCESS;
}

View File

@ -96,8 +96,13 @@ else()
endif()
########################################
configure_file( codes_config.in codes_config @ONLY )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/codes_config
configure_file( codes_config.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/codes_config @ONLY )
file(COPY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/codes_config
DESTINATION ${CMAKE_BINARY_DIR}/bin
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install( FILES ${CMAKE_BINARY_DIR}/bin/codes_config
DESTINATION ${INSTALL_BIN_DIR}
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
GROUP_EXECUTE GROUP_READ

View File

@ -33,10 +33,10 @@ print_feature()
fi
}
build_type="@CMAKE_BUILD_TYPE@"
info()
{
echo "ecCodes version (${ECCODES_VERSION_STR}), git-sha1 ${ECCODES_GIT_SHA1}"
echo "ecCodes version ${ECCODES_VERSION_STR}, git-sha1 ${ECCODES_GIT_SHA1}"
echo ""
echo "Build:"
echo " build type : @CMAKE_BUILD_TYPE@"
@ -45,16 +45,24 @@ info()
echo " processor : @CMAKE_SYSTEM_PROCESSOR@"
echo " sources : @PROJECT_SOURCE_DIR@"
echo " c++ compiler : @CMAKE_CXX_COMPILER_ID@ @CMAKE_CXX_COMPILER_VERSION@"
echo " flags : @CMAKE_CXX_FLAGS@"
# Add the most common build type
if [ $build_type = "RelWithDebInfo" ]; then
echo " flags : @CMAKE_CXX_FLAGS_RELWITHDEBINFO@"
else
echo " flags : @CMAKE_CXX_FLAGS@"
fi
# echo " fortran compiler: @CMAKE_Fortran_COMPILER_ID@ @CMAKE_Fortran_COMPILER_VERSION@"
# echo " flags : @ECCODES_Fortran_FLAGS@"
echo ""
echo "Features:"
echo " AEC : $(print_feature @HAVE_AEC@)"
echo " MEMFS : $(print_feature @HAVE_MEMFS@)"
echo " NETCDF : $(print_feature @HAVE_NETCDF@)"
echo " JPG : $(print_feature @HAVE_JPEG@)"
echo " PNG : $(print_feature @HAVE_PNG@)"
echo " FORTRAN : $(print_feature @HAVE_FORTRAN@)"
echo " AEC : $(print_feature @HAVE_AEC@)"
echo " MEMFS : $(print_feature @HAVE_MEMFS@)"
echo " ECCODES_THREADS : $(print_feature @GRIB_PTHREADS@)"
echo " ECCODES_OMP_THREADS : $(print_feature @GRIB_OMP_THREADS@)"
echo " JPG : $(print_feature @HAVE_JPEG@)"
echo " PNG : $(print_feature @HAVE_PNG@)"
echo " NETCDF : $(print_feature @HAVE_NETCDF@)"
echo ""
# echo "Dependencies: "
# if [ -n "@ECCODES_HAVE_ECKIT@" ]; then

View File

@ -371,10 +371,6 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
}
if (!json_latlon && options->json_output) {
if (options->current_infile && options->current_infile->name) {
size_t len = strlen(options->current_infile->name);
grib_set_string(h, "file", options->current_infile->name, &len);
}
if (!first_handle && options->handle_count > 1) {
fprintf(stdout, ",\n");
}
@ -383,6 +379,12 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
first_handle = 0;
}
}
if (options->current_infile && options->current_infile->name) {
size = strlen(options->current_infile->name);
grib_set_string(h, "file", options->current_infile->name, &size);
}
new_handle = "\n,";
return 0;
}