mirror of https://github.com/ecmwf/eccodes.git
Merge branch 'develop' into feature/modernisation_merge_accessor_classes
This commit is contained in:
commit
0627b526fe
|
@ -18,7 +18,16 @@
|
||||||
|
|
||||||
cmake_minimum_required( VERSION 3.12 FATAL_ERROR )
|
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
|
# Initialise project
|
||||||
project( eccodes LANGUAGES CXX )
|
project( eccodes LANGUAGES CXX )
|
||||||
|
|
|
@ -4,5 +4,6 @@ alias mars.fcmonth = marsForecastMonth;
|
||||||
unalias mars.step;
|
unalias mars.step;
|
||||||
|
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
if (class is "od") { alias mars.system = systemNumber; }
|
if (class is "od" || class is "en") {
|
||||||
if (class is "en") { alias mars.system = systemNumber; }
|
alias mars.system = systemNumber;
|
||||||
|
}
|
||||||
|
|
|
@ -6,7 +6,10 @@ if (class is "od") { alias mars.system = systemNumber; }
|
||||||
if (class is "c3") { alias mars.system = systemNumber; }
|
if (class is "c3") { alias mars.system = systemNumber; }
|
||||||
|
|
||||||
# See ECC-624
|
# 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';
|
constant cnmc_cmcc = 'cmcc';
|
||||||
alias mars.origin = cnmc_cmcc;
|
alias mars.origin = cnmc_cmcc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (class is "ci") { unalias mars.method; }
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,10 @@ if (class is "od") { alias mars.system = systemNumber; }
|
||||||
if (class is "c3") { alias mars.system = systemNumber; }
|
if (class is "c3") { alias mars.system = systemNumber; }
|
||||||
|
|
||||||
# See ECC-624
|
# 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';
|
constant cnmc_cmcc = 'cmcc';
|
||||||
alias mars.origin = cnmc_cmcc;
|
alias mars.origin = cnmc_cmcc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (class is "ci") { unalias mars.method; }
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ if (class isnot "gw") { # ECC-1448
|
||||||
}
|
}
|
||||||
|
|
||||||
# See ECC-624
|
# 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';
|
constant cnmc_cmcc = 'cmcc';
|
||||||
alias mars.origin = cnmc_cmcc;
|
alias mars.origin = cnmc_cmcc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ if (class isnot "gw") { # ECC-1448
|
||||||
}
|
}
|
||||||
|
|
||||||
# See ECC-624
|
# 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';
|
constant cnmc_cmcc = 'cmcc';
|
||||||
alias mars.origin = cnmc_cmcc;
|
alias mars.origin = cnmc_cmcc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,15 @@ unalias mars.step;
|
||||||
alias mars.origin = centre;
|
alias mars.origin = centre;
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
|
|
||||||
if (class is "od") { alias mars.system = systemNumber; }
|
if (class is "od" || class is "me" || class is "en" || class is "c3") {
|
||||||
if (class is "me") { alias mars.system = systemNumber; }
|
alias mars.system = systemNumber;
|
||||||
if (class is "en") { alias mars.system = systemNumber; }
|
}
|
||||||
if (class is "c3") { alias mars.system = systemNumber; }
|
|
||||||
|
|
||||||
# See ECC-624
|
# 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';
|
constant cnmc_cmcc = 'cmcc';
|
||||||
alias mars.origin = cnmc_cmcc;
|
alias mars.origin = cnmc_cmcc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (class is "ci") { unalias mars.method; }
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,15 @@ alias mars.number = perturbationNumber;
|
||||||
alias mars.origin = centre;
|
alias mars.origin = centre;
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
|
|
||||||
if (class is "od") { alias mars.system = systemNumber; }
|
if (class is "od" || class is "me" || class is "en" || class is "c3") {
|
||||||
if (class is "me") { alias mars.system = systemNumber; }
|
alias mars.system = systemNumber;
|
||||||
if (class is "en") { alias mars.system = systemNumber; }
|
}
|
||||||
if (class is "c3") { alias mars.system = systemNumber; }
|
|
||||||
|
|
||||||
# See ECC-624
|
# 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';
|
constant cnmc_cmcc = 'cmcc';
|
||||||
alias mars.origin = cnmc_cmcc;
|
alias mars.origin = cnmc_cmcc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (class is "ci") { unalias mars.method; }
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,12 @@ alias mars.method = methodNumber;
|
||||||
|
|
||||||
unalias mars.step;
|
unalias mars.step;
|
||||||
|
|
||||||
if (class is "od") { alias mars.system = systemNumber; }
|
if (class is "od" || class is "me" || class is "en" || class is "c3" || class is "ci") {
|
||||||
if (class is "me") { alias mars.system = systemNumber; }
|
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; }
|
|
||||||
|
|
||||||
# See ECC-624
|
# 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';
|
constant cnmc_cmcc = 'cmcc';
|
||||||
alias mars.origin = cnmc_cmcc;
|
alias mars.origin = cnmc_cmcc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,14 @@ alias mars.number = perturbationNumber;
|
||||||
alias mars.origin = centre;
|
alias mars.origin = centre;
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
|
|
||||||
|
if (class is "od" || class is "me" || class is "en" || class is "c3") {
|
||||||
if (class is "od") { alias mars.system = systemNumber; }
|
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; }
|
|
||||||
|
|
||||||
# See ECC-624
|
# 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';
|
constant cnmc_cmcc = 'cmcc';
|
||||||
alias mars.origin = cnmc_cmcc;
|
alias mars.origin = cnmc_cmcc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (class is "ci") { unalias mars.method; }
|
||||||
|
|
|
@ -7,13 +7,14 @@ unalias mars.step;
|
||||||
|
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
|
|
||||||
if (class is "od") { alias mars.system = systemNumber; }
|
if (class is "od" || class is "me" || class is "en" || class is "c3") {
|
||||||
if (class is "me") { alias mars.system = systemNumber; }
|
alias mars.system = systemNumber;
|
||||||
if (class is "en") { alias mars.system = systemNumber; }
|
}
|
||||||
if (class is "c3") { alias mars.system = systemNumber; }
|
|
||||||
|
|
||||||
# See ECC-624
|
# 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';
|
constant cnmc_cmcc = 'cmcc';
|
||||||
alias mars.origin = cnmc_cmcc;
|
alias mars.origin = cnmc_cmcc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (class is "ci") { unalias mars.method; }
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
grib.msmm.em.def
|
|
|
@ -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; }
|
|
@ -1,5 +1,6 @@
|
||||||
alias mars.number = perturbationNumber;
|
alias mars.number = perturbationNumber;
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
if (class is "od") { alias mars.system = systemNumber; }
|
|
||||||
if (class is "me") { alias mars.system = systemNumber; }
|
if (class is "od" || class is "me" || class is "en") {
|
||||||
if (class is "en") { alias mars.system = systemNumber; }
|
alias mars.system = systemNumber;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
alias mars.number = perturbationNumber;
|
alias mars.number = perturbationNumber;
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
if (class is "od") { alias mars.system = systemNumber; }
|
if (class is "od" || class is "me" || class is "en") {
|
||||||
if (class is "me") { alias mars.system = systemNumber; }
|
alias mars.system = systemNumber;
|
||||||
if (class is "en") { alias mars.system = systemNumber; }
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
alias mars.number = perturbationNumber;
|
alias mars.number = perturbationNumber;
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
if (class is "od") { alias mars.system = systemNumber; }
|
if (class is "od" || class is "me" || class is "en") {
|
||||||
if (class is "me") { alias mars.system = systemNumber; }
|
alias mars.system = systemNumber;
|
||||||
if (class is "en") { alias mars.system = systemNumber; }
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
alias mars.number = perturbationNumber;
|
alias mars.number = perturbationNumber;
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
if (class is "od") { alias mars.system = systemNumber; }
|
if (class is "od" || class is "me" || class is "en") {
|
||||||
if (class is "me") { alias mars.system = systemNumber; }
|
alias mars.system = systemNumber;
|
||||||
if (class is "en") { alias mars.system = systemNumber; }
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
alias mars.number = perturbationNumber;
|
alias mars.number = perturbationNumber;
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
if (class is "od") { alias mars.system = systemNumber; }
|
if (class is "od" || class is "me" || class is "en") {
|
||||||
if (class is "me") { alias mars.system = systemNumber; }
|
alias mars.system = systemNumber;
|
||||||
if (class is "en") { alias mars.system = systemNumber; }
|
}
|
||||||
|
|
|
@ -4,6 +4,6 @@ alias mars.number = perturbationNumber;
|
||||||
unalias mars.step;
|
unalias mars.step;
|
||||||
|
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
if (class is "od") { alias mars.system = systemNumber; }
|
if (class is "od" || class is "me" || class is "en") {
|
||||||
if (class is "me") { alias mars.system = systemNumber; }
|
alias mars.system = systemNumber;
|
||||||
if (class is "en") { alias mars.system = systemNumber; }
|
}
|
||||||
|
|
|
@ -4,6 +4,6 @@ alias mars.number = perturbationNumber;
|
||||||
unalias mars.step;
|
unalias mars.step;
|
||||||
|
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
if (class is "od") { alias mars.system = systemNumber; }
|
if (class is "od" || class is "me" || class is "en") {
|
||||||
if (class is "me") { alias mars.system = systemNumber; }
|
alias mars.system = systemNumber;
|
||||||
if (class is "en") { alias mars.system = systemNumber; }
|
}
|
||||||
|
|
|
@ -4,6 +4,6 @@ alias mars.number = perturbationNumber;
|
||||||
unalias mars.step;
|
unalias mars.step;
|
||||||
|
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
if (class is "od") { alias mars.system = systemNumber; }
|
if (class is "od" || class is "me" || class is "en") {
|
||||||
if (class is "me") { alias mars.system = systemNumber; }
|
alias mars.system = systemNumber;
|
||||||
if (class is "en") { alias mars.system = systemNumber; }
|
}
|
||||||
|
|
|
@ -4,6 +4,6 @@ alias mars.number = perturbationNumber;
|
||||||
unalias mars.step;
|
unalias mars.step;
|
||||||
|
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
if (class is "od") { alias mars.system = systemNumber; }
|
if (class is "od" || class is "me" || class is "en") {
|
||||||
if (class is "me") { alias mars.system = systemNumber; }
|
alias mars.system = systemNumber;
|
||||||
if (class is "en") { alias mars.system = systemNumber; }
|
}
|
||||||
|
|
|
@ -357,7 +357,6 @@ list( APPEND eccodes_src_files
|
||||||
eccodes_prototypes.h
|
eccodes_prototypes.h
|
||||||
grib_dumper_class.h
|
grib_dumper_class.h
|
||||||
grib_dumper_factory.h
|
grib_dumper_factory.h
|
||||||
grib_emoslib.h
|
|
||||||
grib_iterator_class.h
|
grib_iterator_class.h
|
||||||
grib_iterator_factory.h
|
grib_iterator_factory.h
|
||||||
grib_nearest_class.h
|
grib_nearest_class.h
|
||||||
|
|
|
@ -106,9 +106,8 @@ int grib_accessor_g1end_of_interval_monthly_t::compare(grib_accessor* b)
|
||||||
long count = 0;
|
long count = 0;
|
||||||
size_t alen = 0;
|
size_t alen = 0;
|
||||||
size_t blen = 0;
|
size_t blen = 0;
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
err = value_count(&count);
|
int err = value_count(&count);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
alen = count;
|
alen = count;
|
||||||
|
@ -128,7 +127,10 @@ int grib_accessor_g1end_of_interval_monthly_t::compare(grib_accessor* b)
|
||||||
dirty_ = 1;
|
dirty_ = 1;
|
||||||
|
|
||||||
err = unpack_double(aval, &alen);
|
err = unpack_double(aval, &alen);
|
||||||
|
if (err) return err;
|
||||||
err = b->unpack_double(bval, &blen);
|
err = b->unpack_double(bval, &blen);
|
||||||
|
if (err) return err;
|
||||||
|
|
||||||
for (size_t i = 0; i < alen && retval == GRIB_SUCCESS; ++i) {
|
for (size_t i = 0; i < alen && retval == GRIB_SUCCESS; ++i) {
|
||||||
if (aval[i] != bval[i]) retval = GRIB_DOUBLE_VALUE_MISMATCH;
|
if (aval[i] != bval[i]) retval = GRIB_DOUBLE_VALUE_MISMATCH;
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ long grib_accessor_gen_t::byte_offset()
|
||||||
|
|
||||||
int grib_accessor_gen_t::unpack_bytes(unsigned char* val, size_t* len)
|
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 length = byte_count();
|
||||||
const long offset = byte_offset();
|
const long offset = byte_offset();
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ void grib_accessor_getenv_t::init(const long l, grib_arguments* args)
|
||||||
grib_accessor_ascii_t::init(l, args);
|
grib_accessor_ascii_t::init(l, args);
|
||||||
static char undefined[] = "undefined";
|
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);
|
default_value_ = grib_arguments_get_string(grib_handle_of_accessor(this), args, 1);
|
||||||
if (!default_value_)
|
if (!default_value_)
|
||||||
default_value_ = undefined;
|
default_value_ = undefined;
|
||||||
|
@ -36,7 +36,7 @@ int grib_accessor_getenv_t::unpack_string(char* val, size_t* len)
|
||||||
size_t l = 0;
|
size_t l = 0;
|
||||||
|
|
||||||
if (!value_) {
|
if (!value_) {
|
||||||
v = getenv(name_);
|
v = getenv(envvar_);
|
||||||
if (!v)
|
if (!v)
|
||||||
v = (char*)default_value_;
|
v = (char*)default_value_;
|
||||||
value_ = v;
|
value_ = v;
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// TODO(maee): shadows name_?
|
// TODO(maee): shadows name_?
|
||||||
const char* name_;
|
const char* envvar_;
|
||||||
char* value_;
|
char* value_;
|
||||||
const char* default_value_;
|
const char* default_value_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,7 +16,7 @@ grib_accessor* grib_accessor_group = &_grib_accessor_group;
|
||||||
void grib_accessor_group_t::init(const long len, grib_arguments* arg)
|
void grib_accessor_group_t::init(const long len, grib_arguments* arg)
|
||||||
{
|
{
|
||||||
grib_accessor_gen_t::init(len, 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;
|
size_t i = 0;
|
||||||
unsigned char* v;
|
unsigned char* v;
|
||||||
|
|
|
@ -56,6 +56,6 @@ int grib_accessor_gts_header_t::value_count(long* count)
|
||||||
|
|
||||||
size_t grib_accessor_gts_header_t::string_length()
|
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;
|
return h->gts_header_len;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@ void grib_accessor_md5_t::init(const long len, grib_arguments* arg)
|
||||||
grib_string_list* current = 0;
|
grib_string_list* current = 0;
|
||||||
grib_context* context = context_;
|
grib_context* context = context_;
|
||||||
|
|
||||||
offset_ = grib_arguments_get_name(grib_handle_of_accessor(this), arg, n++);
|
offset_key_ = grib_arguments_get_name(grib_handle_of_accessor(this), arg, n++);
|
||||||
length_ = grib_arguments_get_expression(grib_handle_of_accessor(this), arg, n++);
|
length_key_ = grib_arguments_get_expression(grib_handle_of_accessor(this), arg, n++);
|
||||||
blocklist_ = NULL;
|
blocklist_ = NULL;
|
||||||
while ((b = (char*)grib_arguments_get_name(grib_handle_of_accessor(this), arg, n++)) != NULL) {
|
while ((b = (char*)grib_arguments_get_name(grib_handle_of_accessor(this), arg, n++)) != NULL) {
|
||||||
if (!blocklist_) {
|
if (!blocklist_) {
|
||||||
|
@ -97,9 +97,9 @@ int grib_accessor_md5_t::unpack_string(char* v, size_t* len)
|
||||||
return GRIB_BUFFER_TOO_SMALL;
|
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;
|
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;
|
return ret;
|
||||||
mess = (unsigned char*)grib_context_malloc(context_, length);
|
mess = (unsigned char*)grib_context_malloc(context_, length);
|
||||||
memcpy(mess, grib_handle_of_accessor(this)->buffer->data + offset, length);
|
memcpy(mess, grib_handle_of_accessor(this)->buffer->data + offset, length);
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
int compare(grib_accessor*) override;
|
int compare(grib_accessor*) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char* offset_;
|
const char* offset_key_;
|
||||||
grib_expression* length_;
|
grib_expression* length_key_;
|
||||||
grib_string_list* blocklist_;
|
grib_string_list* blocklist_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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)
|
void grib_accessor_non_alpha_t::init(const long len, grib_arguments* arg)
|
||||||
{
|
{
|
||||||
grib_accessor_gen_t::init(len, 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;
|
size_t i = 0;
|
||||||
unsigned char* v;
|
|
||||||
|
|
||||||
v = buffer->data + offset_;
|
|
||||||
i = 0;
|
|
||||||
while ((*v < 33 || *v > 126) && i <= buffer->ulength) {
|
while ((*v < 33 || *v > 126) && i <= buffer->ulength) {
|
||||||
v++;
|
v++;
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -193,17 +193,16 @@ long grib_accessor_signed_t::next_offset()
|
||||||
|
|
||||||
int grib_accessor_signed_t::is_missing()
|
int grib_accessor_signed_t::is_missing()
|
||||||
{
|
{
|
||||||
int i = 0;
|
|
||||||
unsigned char ff = 0xff;
|
unsigned char ff = 0xff;
|
||||||
unsigned long offset = offset_;
|
unsigned long offset = offset_;
|
||||||
grib_handle* hand = grib_handle_of_accessor(this);
|
const grib_handle* hand = grib_handle_of_accessor(this);
|
||||||
|
|
||||||
if (length_ == 0) {
|
if (length_ == 0) {
|
||||||
Assert(vvalue_ != NULL);
|
Assert(vvalue_ != NULL);
|
||||||
return vvalue_->missing;
|
return vvalue_->missing;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < length_; i++) {
|
for (long i = 0; i < length_; i++) {
|
||||||
if (hand->buffer->data[offset] != ff)
|
if (hand->buffer->data[offset] != ff)
|
||||||
return 0;
|
return 0;
|
||||||
offset++;
|
offset++;
|
||||||
|
|
|
@ -17,7 +17,7 @@ int grib_accessor_uint64_t::unpack_long(long* val, size_t* len)
|
||||||
{
|
{
|
||||||
long value = 0;
|
long value = 0;
|
||||||
long pos = offset_;
|
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;
|
unsigned long long result = 0, tmp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -17,15 +17,14 @@ int grib_accessor_uint64_little_endian_t::unpack_long(long* val, size_t* len)
|
||||||
{
|
{
|
||||||
long value = 0;
|
long value = 0;
|
||||||
long pos = offset_;
|
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;
|
unsigned long long result = 0, tmp;
|
||||||
int i;
|
|
||||||
|
|
||||||
if (*len < 1) {
|
if (*len < 1) {
|
||||||
return GRIB_ARRAY_TOO_SMALL;
|
return GRIB_ARRAY_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 7; i >= 0; i--) {
|
for (int i = 7; i >= 0; i--) {
|
||||||
result <<= 8;
|
result <<= 8;
|
||||||
result |= data[pos + i];
|
result |= data[pos + i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,9 @@ grib_accessor* grib_accessor_uint8 = &_grib_accessor_uint8;
|
||||||
|
|
||||||
int grib_accessor_uint8_t::unpack_long(long* val, size_t* len)
|
int grib_accessor_uint8_t::unpack_long(long* val, size_t* len)
|
||||||
{
|
{
|
||||||
long value = 0;
|
long value = 0;
|
||||||
long pos = offset_;
|
long pos = offset_;
|
||||||
unsigned char* data = grib_handle_of_accessor(this)->buffer->data;
|
const unsigned char* data = grib_handle_of_accessor(this)->buffer->data;
|
||||||
|
|
||||||
if (*len < 1) {
|
if (*len < 1) {
|
||||||
return GRIB_ARRAY_TOO_SMALL;
|
return GRIB_ARRAY_TOO_SMALL;
|
||||||
|
|
|
@ -238,9 +238,9 @@ long grib_accessor_unsigned_t::next_offset()
|
||||||
|
|
||||||
int grib_accessor_unsigned_t::is_missing()
|
int grib_accessor_unsigned_t::is_missing()
|
||||||
{
|
{
|
||||||
unsigned char ff = 0xff;
|
const unsigned char ff = 0xff;
|
||||||
unsigned long offset = offset_;
|
unsigned long offset = offset_;
|
||||||
grib_handle* hand = grib_handle_of_accessor(this);
|
const grib_handle* hand = grib_handle_of_accessor(this);
|
||||||
|
|
||||||
if (length_ == 0) {
|
if (length_ == 0) {
|
||||||
Assert(vvalue_ != NULL);
|
Assert(vvalue_ != NULL);
|
||||||
|
|
|
@ -65,7 +65,7 @@ static void init_class(grib_action_class* c)
|
||||||
}
|
}
|
||||||
/* END_CLASS_IMP */
|
/* 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];
|
char buf[1024];
|
||||||
grib_action_close* a;
|
grib_action_close* a;
|
||||||
|
|
|
@ -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);
|
grib_action* grib_action_create_print(grib_context* context, const char* name, char* outname);
|
||||||
|
|
||||||
/* action_class_close.cc */
|
/* 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 */
|
/* 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);
|
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);
|
||||||
|
|
|
@ -810,14 +810,14 @@ void grib_context_reset(grib_context* c)
|
||||||
|
|
||||||
if (c->grib_definition_files_dir) {
|
if (c->grib_definition_files_dir) {
|
||||||
grib_string_list* next = 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) {
|
while (next) {
|
||||||
cur = next;
|
cur = next;
|
||||||
next = next->next;
|
next = next->next;
|
||||||
grib_context_free(c, cur->value);
|
grib_context_free(c, cur->value);
|
||||||
grib_context_free(c, cur);
|
grib_context_free(c, cur);
|
||||||
}
|
}
|
||||||
c->grib_definition_files_dir=0;
|
c->grib_definition_files_dir = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->multi_support_on)
|
if (c->multi_support_on)
|
||||||
|
|
|
@ -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);
|
|
|
@ -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)
|
static void grib_fieldset_delete_columns(grib_fieldset* set)
|
||||||
{
|
{
|
||||||
int i = 0;
|
|
||||||
grib_context* c;
|
|
||||||
|
|
||||||
if (!set)
|
if (!set)
|
||||||
return;
|
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;
|
int j = 0;
|
||||||
switch (set->columns[i].type) {
|
switch (set->columns[i].type) {
|
||||||
case GRIB_TYPE_LONG:
|
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)
|
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)
|
if (!set || !set->columns)
|
||||||
return GRIB_INVALID_ARGUMENT;
|
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)
|
if (newsize <= set->columns[0].values_array_size)
|
||||||
return 0;
|
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) {
|
switch (set->columns[i].type) {
|
||||||
case GRIB_TYPE_LONG:
|
case GRIB_TYPE_LONG:
|
||||||
newlongs = (long*)grib_context_realloc(c, set->columns[i].long_values,
|
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)
|
static void grib_fieldset_delete_int_array(grib_int_array* f)
|
||||||
{
|
{
|
||||||
grib_context* c = NULL;
|
if (!f) return;
|
||||||
|
|
||||||
if (!f)
|
|
||||||
return;
|
|
||||||
c = f->context;
|
|
||||||
|
|
||||||
|
const grib_context* c = f->context;
|
||||||
grib_context_free(c, f->el);
|
grib_context_free(c, f->el);
|
||||||
grib_context_free(c, f);
|
grib_context_free(c, f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,8 +287,8 @@ void grib_file_pool_delete_file(grib_file* file)
|
||||||
|
|
||||||
void grib_file_close(const char* filename, int force, int* err)
|
void grib_file_close(const char* filename, int force, int* err)
|
||||||
{
|
{
|
||||||
grib_file* file = NULL;
|
grib_file* file = NULL;
|
||||||
grib_context* context = grib_context_get_default();
|
const grib_context* context = grib_context_get_default();
|
||||||
|
|
||||||
/* Performance: keep the files open to avoid opening and closing files when writing the output. */
|
/* 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. */
|
/* So only call fclose() when too many files are open. */
|
||||||
|
|
|
@ -143,8 +143,8 @@ static int compute_gaussian_latitudes(long trunc, double* lats)
|
||||||
lats[nlat - 1 - jlat] = -lats[jlat];
|
lats[nlat - 1 - jlat] = -lats[jlat];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nlat != (trunc * 2))
|
//if (nlat != (trunc * 2))
|
||||||
lats[trunc + 1] = 0.0;
|
// lats[trunc + 1] = 0.0;
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,8 +96,13 @@ else()
|
||||||
endif()
|
endif()
|
||||||
########################################
|
########################################
|
||||||
|
|
||||||
configure_file( codes_config.in codes_config @ONLY )
|
configure_file( codes_config.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/codes_config @ONLY )
|
||||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/codes_config
|
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}
|
DESTINATION ${INSTALL_BIN_DIR}
|
||||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
||||||
GROUP_EXECUTE GROUP_READ
|
GROUP_EXECUTE GROUP_READ
|
||||||
|
|
|
@ -33,10 +33,10 @@ print_feature()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
build_type="@CMAKE_BUILD_TYPE@"
|
||||||
info()
|
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 ""
|
||||||
echo "Build:"
|
echo "Build:"
|
||||||
echo " build type : @CMAKE_BUILD_TYPE@"
|
echo " build type : @CMAKE_BUILD_TYPE@"
|
||||||
|
@ -45,16 +45,24 @@ info()
|
||||||
echo " processor : @CMAKE_SYSTEM_PROCESSOR@"
|
echo " processor : @CMAKE_SYSTEM_PROCESSOR@"
|
||||||
echo " sources : @PROJECT_SOURCE_DIR@"
|
echo " sources : @PROJECT_SOURCE_DIR@"
|
||||||
echo " c++ compiler : @CMAKE_CXX_COMPILER_ID@ @CMAKE_CXX_COMPILER_VERSION@"
|
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 " fortran compiler: @CMAKE_Fortran_COMPILER_ID@ @CMAKE_Fortran_COMPILER_VERSION@"
|
||||||
# echo " flags : @ECCODES_Fortran_FLAGS@"
|
# echo " flags : @ECCODES_Fortran_FLAGS@"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Features:"
|
echo "Features:"
|
||||||
echo " AEC : $(print_feature @HAVE_AEC@)"
|
echo " FORTRAN : $(print_feature @HAVE_FORTRAN@)"
|
||||||
echo " MEMFS : $(print_feature @HAVE_MEMFS@)"
|
echo " AEC : $(print_feature @HAVE_AEC@)"
|
||||||
echo " NETCDF : $(print_feature @HAVE_NETCDF@)"
|
echo " MEMFS : $(print_feature @HAVE_MEMFS@)"
|
||||||
echo " JPG : $(print_feature @HAVE_JPEG@)"
|
echo " ECCODES_THREADS : $(print_feature @GRIB_PTHREADS@)"
|
||||||
echo " PNG : $(print_feature @HAVE_PNG@)"
|
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 ""
|
||||||
# echo "Dependencies: "
|
# echo "Dependencies: "
|
||||||
# if [ -n "@ECCODES_HAVE_ECKIT@" ]; then
|
# if [ -n "@ECCODES_HAVE_ECKIT@" ]; then
|
||||||
|
|
|
@ -371,10 +371,6 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!json_latlon && options->json_output) {
|
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) {
|
if (!first_handle && options->handle_count > 1) {
|
||||||
fprintf(stdout, ",\n");
|
fprintf(stdout, ",\n");
|
||||||
}
|
}
|
||||||
|
@ -383,6 +379,12 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
|
||||||
first_handle = 0;
|
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,";
|
new_handle = "\n,";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue