mirror of https://github.com/ecmwf/eccodes.git
Merge develop
This commit is contained in:
commit
928e3eb4a5
|
@ -14,13 +14,13 @@ module load python3
|
||||||
|
|
||||||
version=$(cat $TMPDIR/eccodes/VERSION)
|
version=$(cat $TMPDIR/eccodes/VERSION)
|
||||||
|
|
||||||
regression_suite_dir=$TMPDIR/eccodes-regression-tests
|
# regression_suite_dir=$TMPDIR/eccodes-regression-tests
|
||||||
mkdir -p $regression_suite_dir
|
# mkdir -p $regression_suite_dir
|
||||||
git clone git@github.com:ecmwf/eccodes-regression-tests.git $regression_suite_dir
|
# git clone git@github.com:ecmwf/eccodes-regression-tests.git $regression_suite_dir
|
||||||
# cd $regression_suite_dir
|
# cd $regression_suite_dir
|
||||||
|
|
||||||
cd ~masn/REGRESSION_TESTING/ecCodes
|
cd ~masn/REGRESSION_TESTING/ecCodes
|
||||||
./par-suite.sh -w $TMPDIR/install/eccodes/$version
|
./par-suite.sh -w $TMPDIR/install/eccodes/$version
|
||||||
|
|
||||||
# For debugging specific test(s)
|
# For debugging specific test(s)
|
||||||
# ./seq-suite.sh -w $TMPDIR/install/eccodes/$version -d -t py_
|
# ./seq-suite.sh -w $TMPDIR/install/eccodes/$version -d -t $test_name
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
if (centre is "ecmf" or datasetForLocal is "era6") {
|
if (centre is "ecmf" or datasetForLocal is "era6") {
|
||||||
concept modelName(unknown, "modelNameConcept.def", conceptsMasterDir, conceptsLocalDirAll): no_copy, dump, read_only;
|
concept modelName(unknown, "modelNameConcept.def", conceptsMasterDir, conceptsLocalDirAll): no_copy, dump, read_only;
|
||||||
|
|
||||||
if (!(modelName is "unknown")) {
|
if (modelName isnot "unknown") {
|
||||||
concept modelVersion(unknown, "modelVersionConcept_[modelName].def", conceptsMasterDir, conceptsLocalDirAll): no_copy, dump, read_only;
|
concept modelVersion(unknown, "modelVersionConcept_[modelName].def", conceptsMasterDir, conceptsLocalDirAll): no_copy, dump, read_only;
|
||||||
# alias ls.model = modelName;
|
# alias ls.model = modelName;
|
||||||
# alias mars.model = modelName;
|
# alias mars.model = modelName;
|
||||||
|
|
|
@ -9,6 +9,6 @@ concept destineOrigin(unknown, "destineOriginConcept.def", conceptsDir2, concept
|
||||||
unalias mars.domain;
|
unalias mars.domain;
|
||||||
|
|
||||||
# ECC-1796: stepRange indexing for DestinE ExtremesDT and On-Demand ExtremesDT data
|
# ECC-1796: stepRange indexing for DestinE ExtremesDT and On-Demand ExtremesDT data
|
||||||
if ( defined(dataset) && !(dataset is "climate-dt") ) {
|
if ( defined(dataset) && dataset isnot "climate-dt" ) {
|
||||||
alias mars.step=stepRange;
|
alias mars.step=stepRange;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ concept datasetForLocal(unknown) {
|
||||||
"unknown" = { dummy=1; }
|
"unknown" = { dummy=1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(datasetForLocal is "unknown")) {
|
if (datasetForLocal isnot "unknown") {
|
||||||
constant conceptsDir2 = "grib2/localConcepts/[datasetForLocal]": hidden;
|
constant conceptsDir2 = "grib2/localConcepts/[datasetForLocal]": hidden;
|
||||||
constant conceptsDir1 = "grib2": hidden;
|
constant conceptsDir1 = "grib2": hidden;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
# (C) Copyright 2005- ECMWF.
|
# (C) Copyright 2005- ECMWF.
|
||||||
|
|
||||||
# Resolution and component flags
|
|
||||||
flags[1] resolutionAndComponentFlags 'grib2/tables/[tablesVersion]/3.3.table' : edition_specific,no_copy;
|
flags[1] resolutionAndComponentFlags 'grib2/tables/[tablesVersion]/3.3.table' : edition_specific,no_copy;
|
||||||
|
|
||||||
# Note our flagbit numbers run from 7 to 0, while WMO convention uses 1 to 8
|
# Note our flagbit numbers run from 7 to 0, while WMO convention uses 1 to 8
|
||||||
# (most significant to least significant)
|
# (most significant to least significant)
|
||||||
|
|
||||||
flagbit resolutionAndComponentFlags1(resolutionAndComponentFlags,7) = 0: read_only;
|
flagbit resolutionAndComponentFlags1(resolutionAndComponentFlags,7) = 0: read_only; #Reserved
|
||||||
flagbit resolutionAndComponentFlags2(resolutionAndComponentFlags,6) = 0: read_only;
|
flagbit resolutionAndComponentFlags2(resolutionAndComponentFlags,6) = 0: read_only; #Reserved
|
||||||
flagbit iDirectionIncrementGiven(resolutionAndComponentFlags,5);
|
flagbit iDirectionIncrementGiven(resolutionAndComponentFlags,5);
|
||||||
flagbit jDirectionIncrementGiven(resolutionAndComponentFlags,4);
|
flagbit jDirectionIncrementGiven(resolutionAndComponentFlags,4);
|
||||||
flagbit uvRelativeToGrid(resolutionAndComponentFlags,3);
|
flagbit uvRelativeToGrid(resolutionAndComponentFlags,3);
|
||||||
flagbit resolutionAndComponentFlags6(resolutionAndComponentFlags,7) = 0: read_only;
|
flagbit resolutionAndComponentFlags6(resolutionAndComponentFlags,2) = 0: read_only; #Reserved
|
||||||
flagbit resolutionAndComponentFlags7(resolutionAndComponentFlags,6) = 0: read_only;
|
flagbit resolutionAndComponentFlags7(resolutionAndComponentFlags,1) = 0: read_only; #Reserved
|
||||||
flagbit resolutionAndComponentFlags8(resolutionAndComponentFlags,6) = 0: read_only;
|
flagbit resolutionAndComponentFlags8(resolutionAndComponentFlags,0) = 0: read_only; #Reserved
|
||||||
|
|
||||||
concept ijDirectionIncrementGiven {
|
concept ijDirectionIncrementGiven {
|
||||||
'1' = {
|
'1' = {
|
||||||
|
|
|
@ -23,10 +23,11 @@ alias geography.jPointsAreConsecutive=jPointsAreConsecutive;
|
||||||
transient iScansPositively = !iScansNegatively : constraint, read_only;
|
transient iScansPositively = !iScansNegatively : constraint, read_only;
|
||||||
transient jScansNegatively = !jScansPositively : constraint, read_only;
|
transient jScansNegatively = !jScansPositively : constraint, read_only;
|
||||||
|
|
||||||
flagbit scanningMode5(scanningMode,3) = 0: read_only;
|
# The following modes are not yet supported
|
||||||
flagbit scanningMode6(scanningMode,2) = 0: read_only;
|
flagbit scanningMode5(scanningMode,3) = 0: read_only; #Points within odd rows...
|
||||||
flagbit scanningMode7(scanningMode,1) = 0: read_only;
|
flagbit scanningMode6(scanningMode,2) = 0: read_only; #Points within even rows...
|
||||||
flagbit scanningMode8(scanningMode,0) = 0: read_only;
|
flagbit scanningMode7(scanningMode,1) = 0: read_only; #Points offset
|
||||||
|
flagbit scanningMode8(scanningMode,0) = 0: read_only; #Rows have Ni grid points...
|
||||||
|
|
||||||
meta swapScanningX change_scanning_direction(
|
meta swapScanningX change_scanning_direction(
|
||||||
values,Ni,Nj,
|
values,Ni,Nj,
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
#no step in type an
|
#no step in type an
|
||||||
unalias mars.step;
|
unalias mars.step;
|
||||||
|
|
||||||
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; }
|
class is "c3" || class is "ci")
|
||||||
if (class is "en") { alias mars.system = systemNumber; }
|
{
|
||||||
if (class is "c3") { alias mars.system = systemNumber; }
|
alias mars.system = systemNumber;
|
||||||
if (class is "ci") { alias mars.system = systemNumber; }
|
}
|
||||||
|
|
||||||
alias mars.number = perturbationNumber;
|
alias mars.number = perturbationNumber;
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
|
|
||||||
if (!(class is "gw")) { # ECC-1448
|
if (class isnot "gw") { # ECC-1448
|
||||||
alias mars.origin = centre;
|
alias mars.origin = centre;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,4 +21,3 @@ if (centre == 80 && subCentre == 98 && class is "c3") {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (class is "ci") { unalias mars.method; }
|
if (class is "ci") { unalias mars.method; }
|
||||||
|
|
||||||
|
|
|
@ -4,15 +4,16 @@ if (levtype is "o2d" || levtype is "o3d") {
|
||||||
alias mars.step = endStep;
|
alias mars.step = endStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
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; }
|
class is "c3" || class is "ci")
|
||||||
if (class is "en") { alias mars.system = systemNumber; }
|
{
|
||||||
if (class is "c3") { alias mars.system = systemNumber; }
|
alias mars.system = systemNumber;
|
||||||
if (class is "ci") { alias mars.system = systemNumber; }
|
}
|
||||||
|
|
||||||
alias mars.number = perturbationNumber;
|
alias mars.number = perturbationNumber;
|
||||||
alias mars.method = methodNumber;
|
alias mars.method = methodNumber;
|
||||||
|
|
||||||
if (!(class is "gw")) { # ECC-1448
|
if (class isnot "gw") { # ECC-1448
|
||||||
alias mars.origin = centre;
|
alias mars.origin = centre;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,4 +24,3 @@ if (centre == 80 && subCentre == 98 && class is "c3") {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (class is "ci") { unalias mars.method; }
|
if (class is "ci") { unalias mars.method; }
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2005- ECMWF.
|
* (C) Copyright 2005- ECMWF.
|
||||||
*
|
*
|
||||||
|
@ -101,6 +100,7 @@ static int extra_set(grib_accessor* a, long val)
|
||||||
long is_chemical_srcsink = 0;
|
long is_chemical_srcsink = 0;
|
||||||
long is_aerosol = 0;
|
long is_aerosol = 0;
|
||||||
long is_aerosol_optical = 0;
|
long is_aerosol_optical = 0;
|
||||||
|
long is_wave = 0, is_wave_prange = 0;
|
||||||
|
|
||||||
grib_get_long(hand, "is_chemical", &is_chemical);
|
grib_get_long(hand, "is_chemical", &is_chemical);
|
||||||
grib_get_long(hand, "is_chemical_srcsink", &is_chemical_srcsink);
|
grib_get_long(hand, "is_chemical_srcsink", &is_chemical_srcsink);
|
||||||
|
@ -108,6 +108,9 @@ static int extra_set(grib_accessor* a, long val)
|
||||||
grib_get_long(hand, "is_aerosol", &is_aerosol);
|
grib_get_long(hand, "is_aerosol", &is_aerosol);
|
||||||
grib_get_long(hand, "is_aerosol_optical", &is_aerosol_optical);
|
grib_get_long(hand, "is_aerosol_optical", &is_aerosol_optical);
|
||||||
|
|
||||||
|
is_wave = grib_is_defined(hand, "waveDirectionNumber");
|
||||||
|
is_wave_prange = grib_is_defined(hand, "typeOfWavePeriodInterval");
|
||||||
|
|
||||||
switch (self->index) {
|
switch (self->index) {
|
||||||
case 0:
|
case 0:
|
||||||
/* class */
|
/* class */
|
||||||
|
@ -287,6 +290,11 @@ static int extra_set(grib_accessor* a, long val)
|
||||||
return GRIB_INTERNAL_ERROR;
|
return GRIB_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_wave || is_wave_prange) {
|
||||||
|
// ECC-1867
|
||||||
|
productDefinitionTemplateNumberNew = -1; // disable PDT selection
|
||||||
|
}
|
||||||
|
|
||||||
if (productDefinitionTemplateNumberNew >= 0) {
|
if (productDefinitionTemplateNumberNew >= 0) {
|
||||||
grib_get_long(hand, self->productDefinitionTemplateNumber, &productDefinitionTemplateNumber);
|
grib_get_long(hand, self->productDefinitionTemplateNumber, &productDefinitionTemplateNumber);
|
||||||
if (productDefinitionTemplateNumber != productDefinitionTemplateNumberNew)
|
if (productDefinitionTemplateNumber != productDefinitionTemplateNumberNew)
|
||||||
|
|
|
@ -202,13 +202,11 @@ void grib_accessor_gen_t::destroy(grib_context* ct)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ======================== grib_accessor_class_gen ========================
|
// ======================== grib_accessor_class_gen ========================
|
||||||
|
|
||||||
|
|
||||||
grib_accessor_class_gen_t _grib_accessor_class_gen = grib_accessor_class_gen_t("gen");
|
grib_accessor_class_gen_t _grib_accessor_class_gen = grib_accessor_class_gen_t("gen");
|
||||||
grib_accessor_class* grib_accessor_class_gen = &_grib_accessor_class_gen;
|
grib_accessor_class* grib_accessor_class_gen = &_grib_accessor_class_gen;
|
||||||
|
|
||||||
void grib_accessor_class_gen_t::init(grib_accessor* a, const long len, grib_arguments* param)
|
void grib_accessor_class_gen_t::init(grib_accessor* a, const long len, grib_arguments* param)
|
||||||
{
|
{
|
||||||
|
@ -229,7 +227,7 @@ void grib_accessor_class_gen_t::init(grib_accessor* a, const long len, grib_argu
|
||||||
grib_expression* expression = grib_arguments_get_expression(grib_handle_of_accessor(a), act->default_value, 0);
|
grib_expression* expression = grib_arguments_get_expression(grib_handle_of_accessor(a), act->default_value, 0);
|
||||||
int type = grib_expression_native_type(grib_handle_of_accessor(a), expression);
|
int type = grib_expression_native_type(grib_handle_of_accessor(a), expression);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
// TODO(maee): add single-precision case
|
// TODO(maee): add single-precision case
|
||||||
|
|
||||||
case GRIB_TYPE_DOUBLE:
|
case GRIB_TYPE_DOUBLE:
|
||||||
grib_expression_evaluate_double(grib_handle_of_accessor(a), expression, &d);
|
grib_expression_evaluate_double(grib_handle_of_accessor(a), expression, &d);
|
||||||
|
@ -313,8 +311,8 @@ long grib_accessor_class_gen_t::byte_offset(grib_accessor* a)
|
||||||
int grib_accessor_class_gen_t::unpack_bytes(grib_accessor* a, unsigned char* val, size_t* len)
|
int grib_accessor_class_gen_t::unpack_bytes(grib_accessor* a, unsigned char* val, size_t* len)
|
||||||
{
|
{
|
||||||
unsigned char* buf = grib_handle_of_accessor(a)->buffer->data;
|
unsigned char* buf = grib_handle_of_accessor(a)->buffer->data;
|
||||||
const long length = a->byte_count();
|
const long length = a->byte_count();
|
||||||
const long offset = a->byte_offset();
|
const long offset = a->byte_offset();
|
||||||
|
|
||||||
if (*len < length) {
|
if (*len < length) {
|
||||||
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it is %ld bytes long", a->name, length);
|
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it is %ld bytes long", a->name, length);
|
||||||
|
@ -331,8 +329,8 @@ int grib_accessor_class_gen_t::unpack_bytes(grib_accessor* a, unsigned char* val
|
||||||
int grib_accessor_class_gen_t::clear(grib_accessor* a)
|
int grib_accessor_class_gen_t::clear(grib_accessor* a)
|
||||||
{
|
{
|
||||||
unsigned char* buf = grib_handle_of_accessor(a)->buffer->data;
|
unsigned char* buf = grib_handle_of_accessor(a)->buffer->data;
|
||||||
const long length = a->byte_count();
|
const long length = a->byte_count();
|
||||||
const long offset = a->byte_offset();
|
const long offset = a->byte_offset();
|
||||||
|
|
||||||
memset(buf + offset, 0, length);
|
memset(buf + offset, 0, length);
|
||||||
|
|
||||||
|
@ -342,7 +340,7 @@ int grib_accessor_class_gen_t::clear(grib_accessor* a)
|
||||||
int grib_accessor_class_gen_t::unpack_long(grib_accessor* a, long* v, size_t* len)
|
int grib_accessor_class_gen_t::unpack_long(grib_accessor* a, long* v, size_t* len)
|
||||||
{
|
{
|
||||||
is_overridden_[UNPACK_LONG] = 0;
|
is_overridden_[UNPACK_LONG] = 0;
|
||||||
int type = GRIB_TYPE_UNDEFINED;
|
int type = GRIB_TYPE_UNDEFINED;
|
||||||
if (is_overridden_[UNPACK_DOUBLE] == 1) {
|
if (is_overridden_[UNPACK_DOUBLE] == 1) {
|
||||||
double val = 0.0;
|
double val = 0.0;
|
||||||
size_t l = 1;
|
size_t l = 1;
|
||||||
|
@ -398,7 +396,7 @@ int grib_accessor_class_gen_t::unpack_string(grib_accessor* a, char* v, size_t*
|
||||||
if (is_overridden_[UNPACK_DOUBLE] == 1) {
|
if (is_overridden_[UNPACK_DOUBLE] == 1) {
|
||||||
double val = 0.0;
|
double val = 0.0;
|
||||||
size_t l = 1;
|
size_t l = 1;
|
||||||
err = a->unpack_double(&val, &l);
|
err = a->unpack_double(&val, &l);
|
||||||
if (is_overridden_[UNPACK_DOUBLE] == 1) {
|
if (is_overridden_[UNPACK_DOUBLE] == 1) {
|
||||||
if (err) return err;
|
if (err) return err;
|
||||||
snprintf(v, 64, "%g", val);
|
snprintf(v, 64, "%g", val);
|
||||||
|
@ -411,7 +409,7 @@ int grib_accessor_class_gen_t::unpack_string(grib_accessor* a, char* v, size_t*
|
||||||
if (is_overridden_[UNPACK_LONG] == 1) {
|
if (is_overridden_[UNPACK_LONG] == 1) {
|
||||||
long val = 0;
|
long val = 0;
|
||||||
size_t l = 1;
|
size_t l = 1;
|
||||||
err = a->unpack_long(&val, &l);
|
err = a->unpack_long(&val, &l);
|
||||||
if (is_overridden_[UNPACK_LONG] == 1) {
|
if (is_overridden_[UNPACK_LONG] == 1) {
|
||||||
if (err) return err;
|
if (err) return err;
|
||||||
snprintf(v, 64, "%ld", val);
|
snprintf(v, 64, "%ld", val);
|
||||||
|
@ -432,7 +430,7 @@ int grib_accessor_class_gen_t::unpack_string_array(grib_accessor* a, char** v, s
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
v[0] = (char*)grib_context_malloc_clear(a->context, length);
|
v[0] = (char*)grib_context_malloc_clear(a->context, length);
|
||||||
a->unpack_string(v[0], &length); // TODO(masn): check return value
|
a->unpack_string(v[0], &length); // TODO(masn): check return value
|
||||||
*len = 1;
|
*len = 1;
|
||||||
|
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
|
@ -497,7 +495,7 @@ int grib_accessor_class_gen_t::pack_expression(grib_accessor* a, grib_expression
|
||||||
int grib_accessor_class_gen_t::pack_long(grib_accessor* a, const long* v, size_t* len)
|
int grib_accessor_class_gen_t::pack_long(grib_accessor* a, const long* v, size_t* len)
|
||||||
{
|
{
|
||||||
is_overridden_[PACK_LONG] = 0;
|
is_overridden_[PACK_LONG] = 0;
|
||||||
grib_context* c = a->context;
|
grib_context* c = a->context;
|
||||||
if (is_overridden_[PACK_DOUBLE]) {
|
if (is_overridden_[PACK_DOUBLE]) {
|
||||||
double* val = (double*)grib_context_malloc(c, *len * (sizeof(double)));
|
double* val = (double*)grib_context_malloc(c, *len * (sizeof(double)));
|
||||||
if (!val) {
|
if (!val) {
|
||||||
|
@ -541,7 +539,7 @@ int pack_double_array_as_long(grib_accessor* a, const double* v, size_t* len)
|
||||||
int grib_accessor_class_gen_t::pack_double(grib_accessor* a, const double* v, size_t* len)
|
int grib_accessor_class_gen_t::pack_double(grib_accessor* a, const double* v, size_t* len)
|
||||||
{
|
{
|
||||||
is_overridden_[PACK_DOUBLE] = 0;
|
is_overridden_[PACK_DOUBLE] = 0;
|
||||||
grib_context* c = a->context;
|
grib_context* c = a->context;
|
||||||
|
|
||||||
if (is_overridden_[PACK_LONG] || strcmp(a->cclass->name, "codetable") == 0) {
|
if (is_overridden_[PACK_LONG] || strcmp(a->cclass->name, "codetable") == 0) {
|
||||||
/* ECC-648: Special case of codetable */
|
/* ECC-648: Special case of codetable */
|
||||||
|
@ -561,7 +559,7 @@ int grib_accessor_class_gen_t::pack_string_array(grib_accessor* a, const char**
|
||||||
size_t length = 0;
|
size_t length = 0;
|
||||||
grib_accessor* as = 0;
|
grib_accessor* as = 0;
|
||||||
|
|
||||||
as = a;
|
as = a;
|
||||||
long i = (long)*len - 1;
|
long i = (long)*len - 1;
|
||||||
while (as && i >= 0) {
|
while (as && i >= 0) {
|
||||||
length = strlen(v[i]);
|
length = strlen(v[i]);
|
||||||
|
@ -578,9 +576,9 @@ int grib_accessor_class_gen_t::pack_string(grib_accessor* a, const char* v, size
|
||||||
{
|
{
|
||||||
is_overridden_[PACK_STRING] = 0;
|
is_overridden_[PACK_STRING] = 0;
|
||||||
if (is_overridden_[PACK_DOUBLE]) {
|
if (is_overridden_[PACK_DOUBLE]) {
|
||||||
size_t l = 1;
|
size_t l = 1;
|
||||||
char* endPtr = NULL; /* for error handling */
|
char* endPtr = NULL; /* for error handling */
|
||||||
double val = strtod(v, &endPtr);
|
double val = strtod(v, &endPtr);
|
||||||
if (*endPtr) {
|
if (*endPtr) {
|
||||||
grib_context_log(a->context, GRIB_LOG_ERROR,
|
grib_context_log(a->context, GRIB_LOG_ERROR,
|
||||||
"%s: Invalid value (%s) for key '%s'. String cannot be converted to a double",
|
"%s: Invalid value (%s) for key '%s'. String cannot be converted to a double",
|
||||||
|
@ -593,7 +591,7 @@ int grib_accessor_class_gen_t::pack_string(grib_accessor* a, const char* v, size
|
||||||
if (is_overridden_[PACK_LONG]) {
|
if (is_overridden_[PACK_LONG]) {
|
||||||
size_t l = 1;
|
size_t l = 1;
|
||||||
long val = atol(v);
|
long val = atol(v);
|
||||||
int err = a->pack_long(&val, &l);
|
int err = a->pack_long(&val, &l);
|
||||||
if (is_overridden_[PACK_LONG]) {
|
if (is_overridden_[PACK_LONG]) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -721,31 +719,37 @@ grib_accessor* grib_accessor_class_gen_t::make_clone(grib_accessor* a, grib_sect
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
grib_accessor_class_gen_t::~grib_accessor_class_gen_t() {};
|
||||||
|
|
||||||
|
void grib_accessor_class_gen_t::post_init(grib_accessor*)
|
||||||
grib_accessor_class_gen_t::~grib_accessor_class_gen_t(){};
|
{
|
||||||
|
|
||||||
void grib_accessor_class_gen_t::post_init(grib_accessor*){
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
int grib_accessor_class_gen_t::pack_missing(grib_accessor*) {
|
int grib_accessor_class_gen_t::pack_missing(grib_accessor*)
|
||||||
|
{
|
||||||
throw std::runtime_error("grib_accessor_class_gen_t::pack_missing not implemented");
|
throw std::runtime_error("grib_accessor_class_gen_t::pack_missing not implemented");
|
||||||
};
|
};
|
||||||
int grib_accessor_class_gen_t::pack_float(grib_accessor*, const float*, size_t* len) {
|
int grib_accessor_class_gen_t::pack_float(grib_accessor*, const float*, size_t* len)
|
||||||
|
{
|
||||||
throw std::runtime_error("grib_accessor_class_gen_t::pack_float not implemented");
|
throw std::runtime_error("grib_accessor_class_gen_t::pack_float not implemented");
|
||||||
};
|
};
|
||||||
void grib_accessor_class_gen_t::resize(grib_accessor*, size_t) {
|
void grib_accessor_class_gen_t::resize(grib_accessor*, size_t)
|
||||||
|
{
|
||||||
throw std::runtime_error("grib_accessor_class_gen_t::resize not implemented");
|
throw std::runtime_error("grib_accessor_class_gen_t::resize not implemented");
|
||||||
};
|
};
|
||||||
int grib_accessor_class_gen_t::nearest_smaller_value(grib_accessor*, double, double*) {
|
int grib_accessor_class_gen_t::nearest_smaller_value(grib_accessor*, double, double*)
|
||||||
|
{
|
||||||
throw std::runtime_error("grib_accessor_class_gen_t::nearest_smaller_value not implemented");
|
throw std::runtime_error("grib_accessor_class_gen_t::nearest_smaller_value not implemented");
|
||||||
};
|
};
|
||||||
int grib_accessor_class_gen_t::unpack_float_element(grib_accessor*, size_t, float*) {
|
int grib_accessor_class_gen_t::unpack_float_element(grib_accessor*, size_t, float*)
|
||||||
|
{
|
||||||
throw std::runtime_error("grib_accessor_class_gen_t::unpack_float_element not implemented");
|
throw std::runtime_error("grib_accessor_class_gen_t::unpack_float_element not implemented");
|
||||||
};
|
};
|
||||||
int unpack_element_set(grib_accessor*, const size_t*, size_t, double*) {
|
int unpack_element_set(grib_accessor*, const size_t*, size_t, double*)
|
||||||
|
{
|
||||||
throw std::runtime_error("grib_accessor_class_gen_t::unpack_element_set not implemented");
|
throw std::runtime_error("grib_accessor_class_gen_t::unpack_element_set not implemented");
|
||||||
};
|
};
|
||||||
int grib_accessor_class_gen_t::unpack_float_element_set(grib_accessor*, const size_t*, size_t, float*) {
|
int grib_accessor_class_gen_t::unpack_float_element_set(grib_accessor*, const size_t*, size_t, float*)
|
||||||
|
{
|
||||||
throw std::runtime_error("grib_accessor_class_gen_t::unpack_float_element_set not implemented");
|
throw std::runtime_error("grib_accessor_class_gen_t::unpack_float_element_set not implemented");
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2005- ECMWF.
|
* (C) Copyright 2005- ECMWF.
|
||||||
*
|
*
|
||||||
|
@ -11,14 +10,15 @@
|
||||||
|
|
||||||
#include "grib_accessor_class_getenv.h"
|
#include "grib_accessor_class_getenv.h"
|
||||||
|
|
||||||
grib_accessor_class_getenv_t _grib_accessor_class_getenv{"getenv"};
|
grib_accessor_class_getenv_t _grib_accessor_class_getenv{ "getenv" };
|
||||||
grib_accessor_class* grib_accessor_class_getenv = &_grib_accessor_class_getenv;
|
grib_accessor_class* grib_accessor_class_getenv = &_grib_accessor_class_getenv;
|
||||||
|
|
||||||
|
|
||||||
void grib_accessor_class_getenv_t::init(grib_accessor* a, const long l, grib_arguments* args){
|
void grib_accessor_class_getenv_t::init(grib_accessor* a, const long l, grib_arguments* args)
|
||||||
|
{
|
||||||
grib_accessor_class_ascii_t::init(a, l, args);
|
grib_accessor_class_ascii_t::init(a, l, args);
|
||||||
grib_accessor_getenv_t* self = (grib_accessor_getenv_t*)a;
|
grib_accessor_getenv_t* self = (grib_accessor_getenv_t*)a;
|
||||||
static char undefined[] = "undefined";
|
static char undefined[] = "undefined";
|
||||||
|
|
||||||
self->name = grib_arguments_get_string(grib_handle_of_accessor(a), args, 0);
|
self->name = grib_arguments_get_string(grib_handle_of_accessor(a), args, 0);
|
||||||
self->default_value = grib_arguments_get_string(grib_handle_of_accessor(a), args, 1);
|
self->default_value = grib_arguments_get_string(grib_handle_of_accessor(a), args, 1);
|
||||||
|
@ -27,14 +27,16 @@ void grib_accessor_class_getenv_t::init(grib_accessor* a, const long l, grib_arg
|
||||||
self->value = 0;
|
self->value = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_getenv_t::pack_string(grib_accessor* a, const char* val, size_t* len){
|
int grib_accessor_class_getenv_t::pack_string(grib_accessor* a, const char* val, size_t* len)
|
||||||
|
{
|
||||||
return GRIB_NOT_IMPLEMENTED;
|
return GRIB_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_getenv_t::unpack_string(grib_accessor* a, char* val, size_t* len){
|
int grib_accessor_class_getenv_t::unpack_string(grib_accessor* a, char* val, size_t* len)
|
||||||
|
{
|
||||||
grib_accessor_getenv_t* self = (grib_accessor_getenv_t*)a;
|
grib_accessor_getenv_t* self = (grib_accessor_getenv_t*)a;
|
||||||
char* v = 0;
|
char* v = 0;
|
||||||
size_t l = 0;
|
size_t l = 0;
|
||||||
|
|
||||||
if (!self->value) {
|
if (!self->value) {
|
||||||
v = getenv(self->name);
|
v = getenv(self->name);
|
||||||
|
@ -52,11 +54,13 @@ int grib_accessor_class_getenv_t::unpack_string(grib_accessor* a, char* val, siz
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_getenv_t::value_count(grib_accessor* a, long* count){
|
int grib_accessor_class_getenv_t::value_count(grib_accessor* a, long* count)
|
||||||
|
{
|
||||||
*count = 1;
|
*count = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t grib_accessor_class_getenv_t::string_length(grib_accessor* a){
|
size_t grib_accessor_class_getenv_t::string_length(grib_accessor* a)
|
||||||
|
{
|
||||||
return 1024;
|
return 1024;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2005- ECMWF.
|
* (C) Copyright 2005- ECMWF.
|
||||||
*
|
*
|
||||||
|
@ -11,15 +10,16 @@
|
||||||
|
|
||||||
#include "grib_accessor_class_global_gaussian.h"
|
#include "grib_accessor_class_global_gaussian.h"
|
||||||
|
|
||||||
grib_accessor_class_global_gaussian_t _grib_accessor_class_global_gaussian{"global_gaussian"};
|
grib_accessor_class_global_gaussian_t _grib_accessor_class_global_gaussian{ "global_gaussian" };
|
||||||
grib_accessor_class* grib_accessor_class_global_gaussian = &_grib_accessor_class_global_gaussian;
|
grib_accessor_class* grib_accessor_class_global_gaussian = &_grib_accessor_class_global_gaussian;
|
||||||
|
|
||||||
|
|
||||||
void grib_accessor_class_global_gaussian_t::init(grib_accessor* a, const long l, grib_arguments* c){
|
void grib_accessor_class_global_gaussian_t::init(grib_accessor* a, const long l, grib_arguments* c)
|
||||||
|
{
|
||||||
grib_accessor_class_long_t::init(a, l, c);
|
grib_accessor_class_long_t::init(a, l, c);
|
||||||
grib_accessor_global_gaussian_t* self = (grib_accessor_global_gaussian_t*)a;
|
grib_accessor_global_gaussian_t* self = (grib_accessor_global_gaussian_t*)a;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
grib_handle* h = grib_handle_of_accessor(a);
|
grib_handle* h = grib_handle_of_accessor(a);
|
||||||
|
|
||||||
self->N = grib_arguments_get_name(h, c, n++);
|
self->N = grib_arguments_get_name(h, c, n++);
|
||||||
self->Ni = grib_arguments_get_name(h, c, n++);
|
self->Ni = grib_arguments_get_name(h, c, n++);
|
||||||
|
@ -34,9 +34,10 @@ void grib_accessor_class_global_gaussian_t::init(grib_accessor* a, const long l,
|
||||||
self->subdivision = grib_arguments_get_name(h, c, n++);
|
self->subdivision = grib_arguments_get_name(h, c, n++);
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_global_gaussian_t::unpack_long(grib_accessor* a, long* val, size_t* len){
|
int grib_accessor_class_global_gaussian_t::unpack_long(grib_accessor* a, long* val, size_t* len)
|
||||||
|
{
|
||||||
grib_accessor_global_gaussian_t* self = (grib_accessor_global_gaussian_t*)a;
|
grib_accessor_global_gaussian_t* self = (grib_accessor_global_gaussian_t*)a;
|
||||||
int ret = GRIB_SUCCESS;
|
int ret = GRIB_SUCCESS;
|
||||||
long latfirst, latlast, lonfirst, lonlast, basic_angle, subdivision, N, Ni;
|
long latfirst, latlast, lonfirst, lonlast, basic_angle, subdivision, N, Ni;
|
||||||
double dlatfirst, dlatlast, dlonfirst, dlonlast;
|
double dlatfirst, dlatlast, dlonfirst, dlonlast;
|
||||||
double angular_precision = 0;
|
double angular_precision = 0;
|
||||||
|
@ -140,9 +141,10 @@ int grib_accessor_class_global_gaussian_t::unpack_long(grib_accessor* a, long* v
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_global_gaussian_t::pack_long(grib_accessor* a, const long* val, size_t* len){
|
int grib_accessor_class_global_gaussian_t::pack_long(grib_accessor* a, const long* val, size_t* len)
|
||||||
|
{
|
||||||
grib_accessor_global_gaussian_t* self = (grib_accessor_global_gaussian_t*)a;
|
grib_accessor_global_gaussian_t* self = (grib_accessor_global_gaussian_t*)a;
|
||||||
int ret = GRIB_SUCCESS;
|
int ret = GRIB_SUCCESS;
|
||||||
long latfirst, latlast, lonfirst, lonlast, di, diold, basic_angle = 0, N, Ni;
|
long latfirst, latlast, lonfirst, lonlast, di, diold, basic_angle = 0, N, Ni;
|
||||||
long factor;
|
long factor;
|
||||||
double* lats;
|
double* lats;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2005- ECMWF.
|
* (C) Copyright 2005- ECMWF.
|
||||||
*
|
*
|
||||||
|
@ -11,16 +10,16 @@
|
||||||
|
|
||||||
#include "grib_accessor_class_julian_date.h"
|
#include "grib_accessor_class_julian_date.h"
|
||||||
|
|
||||||
grib_accessor_class_julian_date_t _grib_accessor_class_julian_date{"julian_date"};
|
grib_accessor_class_julian_date_t _grib_accessor_class_julian_date{ "julian_date" };
|
||||||
grib_accessor_class* grib_accessor_class_julian_date = &_grib_accessor_class_julian_date;
|
grib_accessor_class* grib_accessor_class_julian_date = &_grib_accessor_class_julian_date;
|
||||||
|
|
||||||
|
|
||||||
|
void grib_accessor_class_julian_date_t::init(grib_accessor* a, const long l, grib_arguments* c)
|
||||||
void grib_accessor_class_julian_date_t::init(grib_accessor* a, const long l, grib_arguments* c){
|
{
|
||||||
grib_accessor_class_double_t::init(a, l, c);
|
grib_accessor_class_double_t::init(a, l, c);
|
||||||
grib_accessor_julian_date_t* self = (grib_accessor_julian_date_t*)a;
|
grib_accessor_julian_date_t* self = (grib_accessor_julian_date_t*)a;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
grib_handle* h = grib_handle_of_accessor(a);
|
grib_handle* h = grib_handle_of_accessor(a);
|
||||||
|
|
||||||
self->year = grib_arguments_get_name(h, c, n++);
|
self->year = grib_arguments_get_name(h, c, n++);
|
||||||
self->month = grib_arguments_get_name(h, c, n++);
|
self->month = grib_arguments_get_name(h, c, n++);
|
||||||
|
@ -51,15 +50,17 @@ void grib_accessor_class_julian_date_t::init(grib_accessor* a, const long l, gri
|
||||||
a->length = 0;
|
a->length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void grib_accessor_class_julian_date_t::dump(grib_accessor* a, grib_dumper* dumper){
|
void grib_accessor_class_julian_date_t::dump(grib_accessor* a, grib_dumper* dumper)
|
||||||
|
{
|
||||||
grib_dump_string(dumper, a, NULL);
|
grib_dump_string(dumper, a, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_julian_date_t::unpack_double(grib_accessor* a, double* val, size_t* len){
|
int grib_accessor_class_julian_date_t::unpack_double(grib_accessor* a, double* val, size_t* len)
|
||||||
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
long hour, minute, second;
|
long hour, minute, second;
|
||||||
long year, month, day, ymd, hms;
|
long year, month, day, ymd, hms;
|
||||||
grib_handle* h = grib_handle_of_accessor(a);
|
grib_handle* h = grib_handle_of_accessor(a);
|
||||||
grib_accessor_julian_date_t* self = (grib_accessor_julian_date_t*)a;
|
grib_accessor_julian_date_t* self = (grib_accessor_julian_date_t*)a;
|
||||||
|
|
||||||
if (self->ymd == NULL) {
|
if (self->ymd == NULL) {
|
||||||
|
@ -108,12 +109,14 @@ int grib_accessor_class_julian_date_t::unpack_double(grib_accessor* a, double* v
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_julian_date_t::pack_double(grib_accessor* a, const double* val, size_t* len){
|
int grib_accessor_class_julian_date_t::pack_double(grib_accessor* a, const double* val, size_t* len)
|
||||||
|
{
|
||||||
grib_accessor_julian_date_t* self = (grib_accessor_julian_date_t*)a;
|
grib_accessor_julian_date_t* self = (grib_accessor_julian_date_t*)a;
|
||||||
int ret = 0;
|
|
||||||
long hour = 0;
|
int ret = 0;
|
||||||
long minute = 0;
|
long hour = 0;
|
||||||
long second = 0;
|
long minute = 0;
|
||||||
|
long second = 0;
|
||||||
long ymd = 0, hms = 0;
|
long ymd = 0, hms = 0;
|
||||||
long year, month, day;
|
long year, month, day;
|
||||||
grib_handle* h = grib_handle_of_accessor(a);
|
grib_handle* h = grib_handle_of_accessor(a);
|
||||||
|
@ -157,13 +160,14 @@ int grib_accessor_class_julian_date_t::pack_double(grib_accessor* a, const doubl
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_julian_date_t::unpack_string(grib_accessor* a, char* val, size_t* len){
|
int grib_accessor_class_julian_date_t::unpack_string(grib_accessor* a, char* val, size_t* len)
|
||||||
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
long hour, minute, second;
|
long hour, minute, second;
|
||||||
long year, month, day, ymd, hms;
|
long year, month, day, ymd, hms;
|
||||||
grib_accessor_julian_date_t* self = (grib_accessor_julian_date_t*)a;
|
grib_accessor_julian_date_t* self = (grib_accessor_julian_date_t*)a;
|
||||||
char* sep = self->sep;
|
char* sep = self->sep;
|
||||||
grib_handle* h = grib_handle_of_accessor(a);
|
grib_handle* h = grib_handle_of_accessor(a);
|
||||||
|
|
||||||
if (*len < 15)
|
if (*len < 15)
|
||||||
return GRIB_BUFFER_TOO_SMALL;
|
return GRIB_BUFFER_TOO_SMALL;
|
||||||
|
@ -210,7 +214,8 @@ int grib_accessor_class_julian_date_t::unpack_string(grib_accessor* a, char* val
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sep[1] != 0 && sep[2] != 0 && sep[3] != 0 && sep[4] != 0) {
|
if (sep[1] != 0 && sep[2] != 0 && sep[3] != 0 && sep[4] != 0) {
|
||||||
snprintf(val, 1024, "%04ld%c%02ld%c%02ld%c%02ld%c%02ld%c%02ld", year, sep[0], month, sep[1], day, sep[2], hour, sep[3], minute, sep[4], second);
|
snprintf(val, 1024, "%04ld%c%02ld%c%02ld%c%02ld%c%02ld%c%02ld",
|
||||||
|
year, sep[0], month, sep[1], day, sep[2], hour, sep[3], minute, sep[4], second);
|
||||||
}
|
}
|
||||||
else if (sep[0] != 0) {
|
else if (sep[0] != 0) {
|
||||||
snprintf(val, 1024, "%04ld%02ld%02ld%c%02ld%02ld%02ld", year, month, day, sep[0], hour, minute, second);
|
snprintf(val, 1024, "%04ld%02ld%02ld%c%02ld%02ld%02ld", year, month, day, sep[0], hour, minute, second);
|
||||||
|
@ -218,19 +223,21 @@ int grib_accessor_class_julian_date_t::unpack_string(grib_accessor* a, char* val
|
||||||
else {
|
else {
|
||||||
snprintf(val, 1024, "%04ld%02ld%02ld%02ld%02ld%02ld", year, month, day, hour, minute, second);
|
snprintf(val, 1024, "%04ld%02ld%02ld%02ld%02ld%02ld", year, month, day, hour, minute, second);
|
||||||
}
|
}
|
||||||
*len = strlen(val)+1;
|
*len = strlen(val) + 1;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_julian_date_t::pack_string(grib_accessor* a, const char* val, size_t* len){
|
int grib_accessor_class_julian_date_t::pack_string(grib_accessor* a, const char* val, size_t* len)
|
||||||
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
long hour, minute, second;
|
long hour, minute, second;
|
||||||
long year, month, day, ymd, hms;
|
long year, month, day, ymd, hms;
|
||||||
grib_accessor_julian_date_t* self = (grib_accessor_julian_date_t*)a;
|
grib_accessor_julian_date_t* self = (grib_accessor_julian_date_t*)a;
|
||||||
char* sep = self->sep;
|
char* sep = self->sep;
|
||||||
grib_handle* h = grib_handle_of_accessor(a);
|
grib_handle* h = grib_handle_of_accessor(a);
|
||||||
|
|
||||||
ret = sscanf(val, "%04ld%c%02ld%c%02ld%c%02ld%c%02ld%c%02ld", &year, &sep[0], &month, &sep[1], &day, &sep[2], &hour, &sep[3], &minute, &sep[4], &second);
|
ret = sscanf(val, "%04ld%c%02ld%c%02ld%c%02ld%c%02ld%c%02ld",
|
||||||
|
&year, &sep[0], &month, &sep[1], &day, &sep[2], &hour, &sep[3], &minute, &sep[4], &second);
|
||||||
if (ret != 11) {
|
if (ret != 11) {
|
||||||
if (strlen(val) == 15) {
|
if (strlen(val) == 15) {
|
||||||
ret = sscanf(val, "%04ld%02ld%02ld%c%02ld%02ld%02ld", &year, &month, &day, &sep[0], &hour, &minute, &second);
|
ret = sscanf(val, "%04ld%02ld%02ld%c%02ld%02ld%02ld", &year, &month, &day, &sep[0], &hour, &minute, &second);
|
||||||
|
@ -292,16 +299,19 @@ int grib_accessor_class_julian_date_t::pack_string(grib_accessor* a, const char*
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_julian_date_t::unpack_long(grib_accessor* a, long* val, size_t* len){
|
int grib_accessor_class_julian_date_t::unpack_long(grib_accessor* a, long* val, size_t* len)
|
||||||
|
{
|
||||||
grib_context_log(a->context, GRIB_LOG_ERROR, " Cannot unpack %s as long", a->name);
|
grib_context_log(a->context, GRIB_LOG_ERROR, " Cannot unpack %s as long", a->name);
|
||||||
return GRIB_NOT_IMPLEMENTED;
|
return GRIB_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
int grib_accessor_class_julian_date_t::pack_long(grib_accessor* a, const long* v, size_t* len){
|
int grib_accessor_class_julian_date_t::pack_long(grib_accessor* a, const long* v, size_t* len)
|
||||||
|
{
|
||||||
grib_context_log(a->context, GRIB_LOG_ERROR, " Cannot pack %s as long", a->name);
|
grib_context_log(a->context, GRIB_LOG_ERROR, " Cannot pack %s as long", a->name);
|
||||||
return GRIB_NOT_IMPLEMENTED;
|
return GRIB_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_julian_date_t::pack_expression(grib_accessor* a, grib_expression* e){
|
int grib_accessor_class_julian_date_t::pack_expression(grib_accessor* a, grib_expression* e)
|
||||||
|
{
|
||||||
size_t len = 1;
|
size_t len = 1;
|
||||||
long lval = 0;
|
long lval = 0;
|
||||||
double dval = 0;
|
double dval = 0;
|
||||||
|
@ -319,14 +329,16 @@ int grib_accessor_class_julian_date_t::pack_expression(grib_accessor* a, grib_ex
|
||||||
}
|
}
|
||||||
/*if (hand->context->debug)
|
/*if (hand->context->debug)
|
||||||
printf("ECCODES DEBUG grib_accessor_class_gen::pack_expression %s %ld\n", a->name,lval);*/
|
printf("ECCODES DEBUG grib_accessor_class_gen::pack_expression %s %ld\n", a->name,lval);*/
|
||||||
return a->pack_long(&lval, &len); }
|
return a->pack_long(&lval, &len);
|
||||||
|
}
|
||||||
|
|
||||||
case GRIB_TYPE_DOUBLE: {
|
case GRIB_TYPE_DOUBLE: {
|
||||||
len = 1;
|
len = 1;
|
||||||
ret = grib_expression_evaluate_double(hand, e, &dval);
|
ret = grib_expression_evaluate_double(hand, e, &dval);
|
||||||
/*if (hand->context->debug)
|
/*if (hand->context->debug)
|
||||||
printf("ECCODES DEBUG grib_accessor_class_gen::pack_expression %s %g\n", a->name, dval);*/
|
printf("ECCODES DEBUG grib_accessor_class_gen::pack_expression %s %g\n", a->name, dval);*/
|
||||||
return a->pack_double(&dval, &len); }
|
return a->pack_double(&dval, &len);
|
||||||
|
}
|
||||||
|
|
||||||
case GRIB_TYPE_STRING: {
|
case GRIB_TYPE_STRING: {
|
||||||
char tmp[1024];
|
char tmp[1024];
|
||||||
|
@ -339,7 +351,8 @@ int grib_accessor_class_julian_date_t::pack_expression(grib_accessor* a, grib_ex
|
||||||
len = strlen(cval);
|
len = strlen(cval);
|
||||||
/*if (hand->context->debug)
|
/*if (hand->context->debug)
|
||||||
printf("ECCODES DEBUG grib_accessor_class_gen::pack_expression %s %s\n", a->name, cval);*/
|
printf("ECCODES DEBUG grib_accessor_class_gen::pack_expression %s %s\n", a->name, cval);*/
|
||||||
return a->pack_string(cval, &len); }
|
return a->pack_string(cval, &len);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GRIB_NOT_IMPLEMENTED;
|
return GRIB_NOT_IMPLEMENTED;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2005- ECMWF.
|
* (C) Copyright 2005- ECMWF.
|
||||||
*
|
*
|
||||||
|
@ -11,14 +10,15 @@
|
||||||
|
|
||||||
#include "grib_accessor_class_julian_day.h"
|
#include "grib_accessor_class_julian_day.h"
|
||||||
|
|
||||||
grib_accessor_class_julian_day_t _grib_accessor_class_julian_day{"julian_day"};
|
grib_accessor_class_julian_day_t _grib_accessor_class_julian_day{ "julian_day" };
|
||||||
grib_accessor_class* grib_accessor_class_julian_day = &_grib_accessor_class_julian_day;
|
grib_accessor_class* grib_accessor_class_julian_day = &_grib_accessor_class_julian_day;
|
||||||
|
|
||||||
|
|
||||||
void grib_accessor_class_julian_day_t::init(grib_accessor* a, const long l, grib_arguments* c){
|
void grib_accessor_class_julian_day_t::init(grib_accessor* a, const long l, grib_arguments* c)
|
||||||
|
{
|
||||||
grib_accessor_class_double_t::init(a, l, c);
|
grib_accessor_class_double_t::init(a, l, c);
|
||||||
grib_accessor_julian_day_t* self = (grib_accessor_julian_day_t*)a;
|
grib_accessor_julian_day_t* self = (grib_accessor_julian_day_t*)a;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
self->date = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
self->date = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
||||||
self->hour = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
self->hour = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
||||||
|
@ -28,22 +28,26 @@ void grib_accessor_class_julian_day_t::init(grib_accessor* a, const long l, grib
|
||||||
a->length = 0;
|
a->length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void grib_accessor_class_julian_day_t::dump(grib_accessor* a, grib_dumper* dumper){
|
void grib_accessor_class_julian_day_t::dump(grib_accessor* a, grib_dumper* dumper)
|
||||||
|
{
|
||||||
grib_dump_string(dumper, a, NULL);
|
grib_dump_string(dumper, a, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_julian_day_t::pack_long(grib_accessor* a, const long* val, size_t* len){
|
int grib_accessor_class_julian_day_t::pack_long(grib_accessor* a, const long* val, size_t* len)
|
||||||
|
{
|
||||||
const double v = *val;
|
const double v = *val;
|
||||||
return pack_double(a, &v, len);
|
return pack_double(a, &v, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_julian_day_t::pack_double(grib_accessor* a, const double* val, size_t* len){
|
int grib_accessor_class_julian_day_t::pack_double(grib_accessor* a, const double* val, size_t* len)
|
||||||
|
{
|
||||||
grib_accessor_julian_day_t* self = (grib_accessor_julian_day_t*)a;
|
grib_accessor_julian_day_t* self = (grib_accessor_julian_day_t*)a;
|
||||||
int ret = 0;
|
|
||||||
long hour = 0;
|
int ret = 0;
|
||||||
long minute = 0;
|
long hour = 0;
|
||||||
long second = 0;
|
long minute = 0;
|
||||||
long date = 0;
|
long second = 0;
|
||||||
|
long date = 0;
|
||||||
long year, month, day;
|
long year, month, day;
|
||||||
|
|
||||||
ret = grib_julian_to_datetime(*val, &year, &month, &day, &hour, &minute, &second);
|
ret = grib_julian_to_datetime(*val, &year, &month, &day, &hour, &minute, &second);
|
||||||
|
@ -66,17 +70,18 @@ int grib_accessor_class_julian_day_t::pack_double(grib_accessor* a, const double
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_julian_day_t::unpack_long(grib_accessor* a, long* val, size_t* len){
|
int grib_accessor_class_julian_day_t::unpack_long(grib_accessor* a, long* val, size_t* len)
|
||||||
int ret = 0;
|
{
|
||||||
double v = 0;
|
double v = 0;
|
||||||
|
|
||||||
ret = unpack_double(a, &v, len);
|
int ret = unpack_double(a, &v, len);
|
||||||
*val = (long)v;
|
*val = (long)v;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_julian_day_t::unpack_double(grib_accessor* a, double* val, size_t* len){
|
int grib_accessor_class_julian_day_t::unpack_double(grib_accessor* a, double* val, size_t* len)
|
||||||
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
long date, hour, minute, second;
|
long date, hour, minute, second;
|
||||||
long year, month, day;
|
long year, month, day;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2005- ECMWF.
|
* (C) Copyright 2005- ECMWF.
|
||||||
*
|
*
|
||||||
|
@ -11,15 +10,16 @@
|
||||||
|
|
||||||
#include "grib_accessor_class_local_definition.h"
|
#include "grib_accessor_class_local_definition.h"
|
||||||
|
|
||||||
grib_accessor_class_local_definition_t _grib_accessor_class_local_definition{"local_definition"};
|
grib_accessor_class_local_definition_t _grib_accessor_class_local_definition{ "local_definition" };
|
||||||
grib_accessor_class* grib_accessor_class_local_definition = &_grib_accessor_class_local_definition;
|
grib_accessor_class* grib_accessor_class_local_definition = &_grib_accessor_class_local_definition;
|
||||||
|
|
||||||
|
|
||||||
void grib_accessor_class_local_definition_t::init(grib_accessor* a, const long l, grib_arguments* c){
|
void grib_accessor_class_local_definition_t::init(grib_accessor* a, const long l, grib_arguments* c)
|
||||||
|
{
|
||||||
grib_accessor_class_unsigned_t::init(a, l, c);
|
grib_accessor_class_unsigned_t::init(a, l, c);
|
||||||
grib_accessor_local_definition_t* self = (grib_accessor_local_definition_t*)a;
|
grib_accessor_local_definition_t* self = (grib_accessor_local_definition_t*)a;
|
||||||
grib_handle* hand = grib_handle_of_accessor(a);
|
grib_handle* hand = grib_handle_of_accessor(a);
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
self->grib2LocalSectionNumber = grib_arguments_get_name(hand, c, n++);
|
self->grib2LocalSectionNumber = grib_arguments_get_name(hand, c, n++);
|
||||||
self->productDefinitionTemplateNumber = grib_arguments_get_name(hand, c, n++);
|
self->productDefinitionTemplateNumber = grib_arguments_get_name(hand, c, n++);
|
||||||
|
@ -32,15 +32,18 @@ void grib_accessor_class_local_definition_t::init(grib_accessor* a, const long l
|
||||||
self->derivedForecast = grib_arguments_get_name(hand, c, n++);
|
self->derivedForecast = grib_arguments_get_name(hand, c, n++);
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_local_definition_t::unpack_long(grib_accessor* a, long* val, size_t* len){
|
int grib_accessor_class_local_definition_t::unpack_long(grib_accessor* a, long* val, size_t* len)
|
||||||
|
{
|
||||||
grib_accessor_local_definition_t* self = (grib_accessor_local_definition_t*)a;
|
grib_accessor_local_definition_t* self = (grib_accessor_local_definition_t*)a;
|
||||||
|
|
||||||
return grib_get_long(grib_handle_of_accessor(a), self->grib2LocalSectionNumber, val);
|
return grib_get_long(grib_handle_of_accessor(a), self->grib2LocalSectionNumber, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_local_definition_t::pack_long(grib_accessor* a, const long* val, size_t* len){
|
int grib_accessor_class_local_definition_t::pack_long(grib_accessor* a, const long* val, size_t* len)
|
||||||
grib_accessor_local_definition_t* self = (grib_accessor_local_definition_t*)a;
|
{
|
||||||
|
grib_accessor_local_definition_t* self = (grib_accessor_local_definition_t*)a;
|
||||||
grib_handle* hand = grib_handle_of_accessor(a);
|
grib_handle* hand = grib_handle_of_accessor(a);
|
||||||
|
|
||||||
long productDefinitionTemplateNumber = -1;
|
long productDefinitionTemplateNumber = -1;
|
||||||
long productDefinitionTemplateNumberInternal = -1;
|
long productDefinitionTemplateNumberInternal = -1;
|
||||||
long productDefinitionTemplateNumberNew = -1;
|
long productDefinitionTemplateNumberNew = -1;
|
||||||
|
@ -90,8 +93,8 @@ int grib_accessor_class_local_definition_t::pack_long(grib_accessor* a, const lo
|
||||||
if (grib_is_defined(hand, "perturbationNumber")) {
|
if (grib_is_defined(hand, "perturbationNumber")) {
|
||||||
eps = 1;
|
eps = 1;
|
||||||
}
|
}
|
||||||
//if (grib2_is_PDTN_EPS(productDefinitionTemplateNumber))
|
// if (grib2_is_PDTN_EPS(productDefinitionTemplateNumber))
|
||||||
// eps = 1;
|
// eps = 1;
|
||||||
|
|
||||||
switch (localDefinitionNumber) {
|
switch (localDefinitionNumber) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -107,10 +110,10 @@ int grib_accessor_class_local_definition_t::pack_long(grib_accessor* a, const lo
|
||||||
productDefinitionTemplateNumberNew = 0;
|
productDefinitionTemplateNumberNew = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // MARS labelling
|
case 1: // MARS labelling
|
||||||
case 36: // MARS labelling for long window 4Dvar system
|
case 36: // MARS labelling for long window 4Dvar system
|
||||||
case 40: // MARS labeling with domain and model (for LAM)
|
case 40: // MARS labeling with domain and model (for LAM)
|
||||||
case 42: // LC-WFV: Wave forecast verification
|
case 42: // LC-WFV: Wave forecast verification
|
||||||
if (isInstant) {
|
if (isInstant) {
|
||||||
// type=em || type=es
|
// type=em || type=es
|
||||||
if (type == 17) {
|
if (type == 17) {
|
||||||
|
@ -148,7 +151,7 @@ int grib_accessor_class_local_definition_t::pack_long(grib_accessor* a, const lo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 41: // EFAS: uses post-processing templates
|
case 41: // EFAS: uses post-processing templates
|
||||||
if (isInstant) {
|
if (isInstant) {
|
||||||
if (eps == 1)
|
if (eps == 1)
|
||||||
productDefinitionTemplateNumberNew = 71;
|
productDefinitionTemplateNumberNew = 71;
|
||||||
|
@ -164,12 +167,12 @@ int grib_accessor_class_local_definition_t::pack_long(grib_accessor* a, const lo
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 15: // Seasonal forecast data
|
case 15: // Seasonal forecast data
|
||||||
case 16: // Seasonal forecast monthly mean data
|
case 16: // Seasonal forecast monthly mean data
|
||||||
case 12: // Seasonal forecast monthly mean data for lagged systems
|
case 12: // Seasonal forecast monthly mean data for lagged systems
|
||||||
case 18: // Multianalysis ensemble data
|
case 18: // Multianalysis ensemble data
|
||||||
case 26: // MARS labelling or ensemble forecast data
|
case 26: // MARS labelling or ensemble forecast data
|
||||||
case 30: // Forecasting Systems with Variable Resolution
|
case 30: // Forecasting Systems with Variable Resolution
|
||||||
if (isInstant) {
|
if (isInstant) {
|
||||||
productDefinitionTemplateNumberNew = 1;
|
productDefinitionTemplateNumberNew = 1;
|
||||||
}
|
}
|
||||||
|
@ -178,21 +181,21 @@ int grib_accessor_class_local_definition_t::pack_long(grib_accessor* a, const lo
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5: // Forecast probability data
|
case 5: // Forecast probability data
|
||||||
case 7: // Sensitivity data
|
case 7: // Sensitivity data
|
||||||
case 9: // Singular vectors and ensemble perturbations
|
case 9: // Singular vectors and ensemble perturbations
|
||||||
case 11: // Supplementary data used by the analysis
|
case 11: // Supplementary data used by the analysis
|
||||||
case 14: // Brightness temperature
|
case 14: // Brightness temperature
|
||||||
case 20: // 4D variational increments
|
case 20: // 4D variational increments
|
||||||
case 21: // Sensitive area predictions
|
case 21: // Sensitive area predictions
|
||||||
case 23: // Coupled atmospheric, wave and ocean means
|
case 23: // Coupled atmospheric, wave and ocean means
|
||||||
case 24: // Satellite Channel Number Data
|
case 24: // Satellite Channel Number Data
|
||||||
case 25:
|
case 25:
|
||||||
case 28: // COSMO local area EPS
|
case 28: // COSMO local area EPS
|
||||||
case 38: // 4D variational increments for long window 4Dvar system
|
case 38: // 4D variational increments for long window 4Dvar system
|
||||||
case 39: // 4DVar model errors for long window 4Dvar system
|
case 39: // 4DVar model errors for long window 4Dvar system
|
||||||
case 60: // Ocean data analysis
|
case 60: // Ocean data analysis
|
||||||
case 192: // Multiple ECMWF local definitions
|
case 192: // Multiple ECMWF local definitions
|
||||||
if (isInstant) {
|
if (isInstant) {
|
||||||
productDefinitionTemplateNumberNew = 0;
|
productDefinitionTemplateNumberNew = 0;
|
||||||
}
|
}
|
||||||
|
@ -279,13 +282,13 @@ int grib_accessor_class_local_definition_t::pack_long(grib_accessor* a, const lo
|
||||||
productDefinitionTemplateNumberNew = 45;
|
productDefinitionTemplateNumberNew = 45;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//productDefinitionTemplateNumberNew = 47; This PDT is deprecated
|
// productDefinitionTemplateNumberNew = 47; This PDT is deprecated
|
||||||
productDefinitionTemplateNumberNew = 85;
|
productDefinitionTemplateNumberNew = 85;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (isInstant) {
|
if (isInstant) {
|
||||||
productDefinitionTemplateNumberNew = 48; //44 is deprecated*/
|
productDefinitionTemplateNumberNew = 48; // 44 is deprecated*/
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
productDefinitionTemplateNumberNew = 46;
|
productDefinitionTemplateNumberNew = 46;
|
||||||
|
@ -309,7 +312,7 @@ int grib_accessor_class_local_definition_t::pack_long(grib_accessor* a, const lo
|
||||||
if (productDefinitionTemplateNumber != productDefinitionTemplateNumberNew) {
|
if (productDefinitionTemplateNumber != productDefinitionTemplateNumberNew) {
|
||||||
if (a->context->debug) {
|
if (a->context->debug) {
|
||||||
fprintf(stderr, "ECCODES DEBUG grib_accessor_local_definition_t: ldNumber=%d, newPDTN=%ld\n",
|
fprintf(stderr, "ECCODES DEBUG grib_accessor_local_definition_t: ldNumber=%d, newPDTN=%ld\n",
|
||||||
localDefinitionNumber, productDefinitionTemplateNumberNew);
|
localDefinitionNumber, productDefinitionTemplateNumberNew);
|
||||||
}
|
}
|
||||||
if (tooEarly)
|
if (tooEarly)
|
||||||
grib_set_long(hand, self->productDefinitionTemplateNumberInternal, productDefinitionTemplateNumberNew);
|
grib_set_long(hand, self->productDefinitionTemplateNumberInternal, productDefinitionTemplateNumberNew);
|
||||||
|
@ -324,7 +327,8 @@ int grib_accessor_class_local_definition_t::pack_long(grib_accessor* a, const lo
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_local_definition_t::value_count(grib_accessor* a, long* count){
|
int grib_accessor_class_local_definition_t::value_count(grib_accessor* a, long* count)
|
||||||
|
{
|
||||||
*count = 1;
|
*count = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2005- ECMWF.
|
* (C) Copyright 2005- ECMWF.
|
||||||
*
|
*
|
||||||
|
@ -13,11 +12,12 @@
|
||||||
#include "step.h"
|
#include "step.h"
|
||||||
#include "step_utilities.h"
|
#include "step_utilities.h"
|
||||||
|
|
||||||
grib_accessor_class_optimal_step_units_t _grib_accessor_class_optimal_step_units{"optimal_step_units"};
|
grib_accessor_class_optimal_step_units_t _grib_accessor_class_optimal_step_units{ "optimal_step_units" };
|
||||||
grib_accessor_class* grib_accessor_class_optimal_step_units = &_grib_accessor_class_optimal_step_units;
|
grib_accessor_class* grib_accessor_class_optimal_step_units = &_grib_accessor_class_optimal_step_units;
|
||||||
|
|
||||||
|
|
||||||
void grib_accessor_class_optimal_step_units_t::init(grib_accessor* a, const long l, grib_arguments* c){
|
void grib_accessor_class_optimal_step_units_t::init(grib_accessor* a, const long l, grib_arguments* c)
|
||||||
|
{
|
||||||
grib_accessor_class_gen_t::init(a, l, c);
|
grib_accessor_class_gen_t::init(a, l, c);
|
||||||
grib_accessor_optimal_step_units_t* self = (grib_accessor_optimal_step_units_t*)a;
|
grib_accessor_optimal_step_units_t* self = (grib_accessor_optimal_step_units_t*)a;
|
||||||
grib_handle* hand = grib_handle_of_accessor(a);
|
grib_handle* hand = grib_handle_of_accessor(a);
|
||||||
|
@ -27,72 +27,78 @@ void grib_accessor_class_optimal_step_units_t::init(grib_accessor* a, const long
|
||||||
self->forecast_time_unit = grib_arguments_get_name(hand, c, n++);
|
self->forecast_time_unit = grib_arguments_get_name(hand, c, n++);
|
||||||
self->time_range_value = grib_arguments_get_name(hand, c, n++);
|
self->time_range_value = grib_arguments_get_name(hand, c, n++);
|
||||||
self->time_range_unit = grib_arguments_get_name(hand, c, n++);
|
self->time_range_unit = grib_arguments_get_name(hand, c, n++);
|
||||||
a->length = 0;
|
a->length = 0;
|
||||||
self->overwriteStepUnits = eccodes::Unit{eccodes::Unit::Value::MISSING}.value<long>();
|
self->overwriteStepUnits = eccodes::Unit{ eccodes::Unit::Value::MISSING }.value<long>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void grib_accessor_class_optimal_step_units_t::dump(grib_accessor* a, grib_dumper* dumper){
|
void grib_accessor_class_optimal_step_units_t::dump(grib_accessor* a, grib_dumper* dumper)
|
||||||
|
{
|
||||||
grib_dump_string(dumper, a, NULL);
|
grib_dump_string(dumper, a, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t grib_accessor_class_optimal_step_units_t::string_length(grib_accessor* a){
|
size_t grib_accessor_class_optimal_step_units_t::string_length(grib_accessor* a)
|
||||||
|
{
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_optimal_step_units_t::pack_expression(grib_accessor* a, grib_expression* e){
|
int grib_accessor_class_optimal_step_units_t::pack_expression(grib_accessor* a, grib_expression* e)
|
||||||
const char* cval = NULL;
|
{
|
||||||
int ret = 0;
|
const char* cval = NULL;
|
||||||
long lval = 0;
|
int ret = 0;
|
||||||
size_t len = 1;
|
long lval = 0;
|
||||||
grib_handle* hand = grib_handle_of_accessor(a);
|
size_t len = 1;
|
||||||
|
grib_handle* hand = grib_handle_of_accessor(a);
|
||||||
const char* cclass_name = a->cclass->name;
|
const char* cclass_name = a->cclass->name;
|
||||||
|
|
||||||
if (strcmp(e->cclass->name, "long") == 0) {
|
if (strcmp(e->cclass->name, "long") == 0) {
|
||||||
grib_expression_evaluate_long(hand, e, &lval); /* TODO: check return value */
|
grib_expression_evaluate_long(hand, e, &lval); // TODO: check return value
|
||||||
ret = a->pack_long(&lval, &len); }
|
ret = a->pack_long(&lval, &len);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
char tmp[1024];
|
char tmp[1024];
|
||||||
len = sizeof(tmp);
|
len = sizeof(tmp);
|
||||||
cval = grib_expression_evaluate_string(hand, e, tmp, &len, &ret);
|
cval = grib_expression_evaluate_string(hand, e, tmp, &len, &ret);
|
||||||
if (ret != GRIB_SUCCESS) {
|
if (ret != GRIB_SUCCESS) {
|
||||||
grib_context_log(a->context, GRIB_LOG_ERROR,
|
grib_context_log(a->context, GRIB_LOG_ERROR,
|
||||||
"%s.%s: Unable to evaluate string %s to be set in %s",
|
"%s.%s: Unable to evaluate string %s to be set in %s",
|
||||||
cclass_name, __func__, grib_expression_get_name(e), a->name);
|
cclass_name, __func__, grib_expression_get_name(e), a->name);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
len = strlen(cval) + 1;
|
len = strlen(cval) + 1;
|
||||||
//if (hand->context->debug)
|
// if (hand->context->debug)
|
||||||
// printf("ECCODES DEBUG grib_accessor_class_codetable::pack_expression %s %s\n", a->name, cval);
|
// printf("ECCODES DEBUG grib_accessor_class_codetable::pack_expression %s %s\n", a->name, cval);
|
||||||
ret = a->pack_string(cval, &len); }
|
ret = a->pack_string(cval, &len);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_optimal_step_units_t::pack_long(grib_accessor* a, const long* val, size_t* len){
|
int grib_accessor_class_optimal_step_units_t::pack_long(grib_accessor* a, const long* val, size_t* len)
|
||||||
|
{
|
||||||
grib_handle* h = grib_handle_of_accessor(a);
|
grib_handle* h = grib_handle_of_accessor(a);
|
||||||
grib_accessor_optimal_step_units_t* self = (grib_accessor_optimal_step_units_t*)a;
|
grib_accessor_optimal_step_units_t* self = (grib_accessor_optimal_step_units_t*)a;
|
||||||
|
|
||||||
long start_step = 0;
|
long start_step = 0;
|
||||||
long start_step_unit = 0;
|
long start_step_unit = 0;
|
||||||
long end_step = 0;
|
long end_step = 0;
|
||||||
long end_step_unit = 0;
|
long end_step_unit = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
auto supported_units = eccodes::Unit::list_supported_units();
|
auto supported_units = eccodes::Unit::list_supported_units();
|
||||||
try {
|
try {
|
||||||
eccodes::Unit unit{*val}; // throws if not supported
|
eccodes::Unit unit{ *val }; // throws if not supported
|
||||||
auto iter = std::find(supported_units.begin(), supported_units.end(), unit);
|
auto iter = std::find(supported_units.begin(), supported_units.end(), unit);
|
||||||
if (iter == supported_units.end()) {
|
if (iter == supported_units.end()) {
|
||||||
throw std::runtime_error{"eccodes::Unit not supported"};
|
throw std::runtime_error{ "eccodes::Unit not supported" };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception& e) {
|
catch (std::exception& e) {
|
||||||
std::string supported_units_str;
|
std::string supported_units_str;
|
||||||
for (auto& u : supported_units)
|
for (auto& u : supported_units)
|
||||||
supported_units_str += eccodes::Unit{u}.value<std::string>() + ",";
|
supported_units_str += eccodes::Unit{ u }.value<std::string>() + ",";
|
||||||
supported_units_str.pop_back();
|
supported_units_str.pop_back();
|
||||||
|
|
||||||
std::string msg = std::string{"Invalid unit: "} + std::to_string(*val) + " (" + e.what() + ")" +
|
std::string msg = std::string{ "Invalid unit: " } + std::to_string(*val) + " (" + e.what() + ")" +
|
||||||
". Available units are: " + supported_units_str;
|
". Available units are: " + supported_units_str;
|
||||||
grib_context_log(a->context, GRIB_LOG_ERROR, "%s", msg.c_str());
|
grib_context_log(a->context, GRIB_LOG_ERROR, "%s", msg.c_str());
|
||||||
return GRIB_INVALID_ARGUMENT;
|
return GRIB_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
@ -115,9 +121,9 @@ int grib_accessor_class_optimal_step_units_t::pack_long(grib_accessor* a, const
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
eccodes::Step start{start_step, start_step_unit};
|
eccodes::Step start{ start_step, start_step_unit };
|
||||||
start.set_unit(*val);
|
start.set_unit(*val);
|
||||||
eccodes::Step end{end_step, end_step_unit};
|
eccodes::Step end{ end_step, end_step_unit };
|
||||||
end.set_unit(*val);
|
end.set_unit(*val);
|
||||||
|
|
||||||
if ((ret = grib_set_long_internal(h, "startStepUnit", start.unit().value<long>())) != GRIB_SUCCESS)
|
if ((ret = grib_set_long_internal(h, "startStepUnit", start.unit().value<long>())) != GRIB_SUCCESS)
|
||||||
|
@ -130,7 +136,7 @@ int grib_accessor_class_optimal_step_units_t::pack_long(grib_accessor* a, const
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
catch (std::exception& e) {
|
catch (std::exception& e) {
|
||||||
std::string msg = std::string{"Failed to convert steps to: "} + std::to_string(*val) + " (" + e.what() + ")";
|
std::string msg = std::string{ "Failed to convert steps to: " } + std::to_string(*val) + " (" + e.what() + ")";
|
||||||
grib_context_log(a->context, GRIB_LOG_ERROR, "%s", msg.c_str());
|
grib_context_log(a->context, GRIB_LOG_ERROR, "%s", msg.c_str());
|
||||||
return GRIB_INTERNAL_ERROR;
|
return GRIB_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -144,17 +150,17 @@ int grib_accessor_class_optimal_step_units_t::unpack_long(grib_accessor* a, long
|
||||||
grib_handle* h = grib_handle_of_accessor(a);
|
grib_handle* h = grib_handle_of_accessor(a);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (eccodes::Unit{self->overwriteStepUnits} != eccodes::Unit{eccodes::Unit::Value::MISSING}) {
|
if (eccodes::Unit{ self->overwriteStepUnits } != eccodes::Unit{ eccodes::Unit::Value::MISSING }) {
|
||||||
*val = self->overwriteStepUnits;
|
*val = self->overwriteStepUnits;
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto forecast_time_opt = get_step(h, self->forecast_time_value, self->forecast_time_unit);
|
auto forecast_time_opt = get_step(h, self->forecast_time_value, self->forecast_time_unit);
|
||||||
auto time_range_opt = get_step(h, self->time_range_value, self->time_range_unit);
|
auto time_range_opt = get_step(h, self->time_range_value, self->time_range_unit);
|
||||||
|
|
||||||
if (forecast_time_opt && time_range_opt) {
|
if (forecast_time_opt && time_range_opt) {
|
||||||
auto [step_a, step_b] = find_common_units(forecast_time_opt.value().optimize_unit(),
|
auto [step_a, step_b] = find_common_units(forecast_time_opt.value().optimize_unit(),
|
||||||
(forecast_time_opt.value() + time_range_opt.value()).optimize_unit());
|
(forecast_time_opt.value() + time_range_opt.value()).optimize_unit());
|
||||||
*val = step_a.unit().value<long>();
|
*val = step_a.unit().value<long>();
|
||||||
}
|
}
|
||||||
else if (forecast_time_opt && !time_range_opt) {
|
else if (forecast_time_opt && !time_range_opt) {
|
||||||
|
@ -164,7 +170,7 @@ int grib_accessor_class_optimal_step_units_t::unpack_long(grib_accessor* a, long
|
||||||
*val = time_range_opt.value().optimize_unit().unit().value<long>();
|
*val = time_range_opt.value().optimize_unit().unit().value<long>();
|
||||||
}
|
}
|
||||||
else if (!forecast_time_opt && !time_range_opt) {
|
else if (!forecast_time_opt && !time_range_opt) {
|
||||||
*val = eccodes::Unit{eccodes::Unit::Value::HOUR}.value<long>();
|
*val = eccodes::Unit{ eccodes::Unit::Value::HOUR }.value<long>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception& e) {
|
catch (std::exception& e) {
|
||||||
|
@ -175,16 +181,17 @@ int grib_accessor_class_optimal_step_units_t::unpack_long(grib_accessor* a, long
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_optimal_step_units_t::pack_string(grib_accessor* a, const char* val, size_t* len){
|
int grib_accessor_class_optimal_step_units_t::pack_string(grib_accessor* a, const char* val, size_t* len)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
long unit = eccodes::Unit{val}.value<long>();
|
long unit = eccodes::Unit{ val }.value<long>();
|
||||||
pack_long(a, &unit, len);
|
pack_long(a, &unit, len);
|
||||||
}
|
}
|
||||||
catch (std::exception& e) {
|
catch (std::exception& e) {
|
||||||
auto supported_units = eccodes::Unit::list_supported_units();
|
auto supported_units = eccodes::Unit::list_supported_units();
|
||||||
std::string supported_units_str;
|
std::string supported_units_str;
|
||||||
for (auto& u : supported_units)
|
for (auto& u : supported_units)
|
||||||
supported_units_str += eccodes::Unit{u}.value<std::string>() + ",";
|
supported_units_str += eccodes::Unit{ u }.value<std::string>() + ",";
|
||||||
supported_units_str.pop_back();
|
supported_units_str.pop_back();
|
||||||
|
|
||||||
std::string msg = "Invalid unit: " + std::string(val) + " (" + e.what() + ")" + ". Available units are: " + supported_units_str;
|
std::string msg = "Invalid unit: " + std::string(val) + " (" + e.what() + ")" + ". Available units are: " + supported_units_str;
|
||||||
|
@ -195,22 +202,25 @@ int grib_accessor_class_optimal_step_units_t::pack_string(grib_accessor* a, cons
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_optimal_step_units_t::unpack_string(grib_accessor* a, char* val, size_t* len){
|
int grib_accessor_class_optimal_step_units_t::unpack_string(grib_accessor* a, char* val, size_t* len)
|
||||||
int ret = 0;
|
{
|
||||||
long unit = 0;
|
int ret = 0;
|
||||||
|
long unit = 0;
|
||||||
size_t unit_len = 0;
|
size_t unit_len = 0;
|
||||||
if ((ret = unpack_long(a, &unit, &unit_len)) != GRIB_SUCCESS)
|
if ((ret = unpack_long(a, &unit, &unit_len)) != GRIB_SUCCESS)
|
||||||
return ret;
|
return ret;
|
||||||
*len = snprintf(val, *len, "%s", eccodes::Unit{unit}.value<std::string>().c_str());
|
*len = snprintf(val, *len, "%s", eccodes::Unit{ unit }.value<std::string>().c_str());
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step units are never missing
|
// Step units are never missing
|
||||||
// If the user does not specify a step unit, we default to hours
|
// If the user does not specify a step unit, we default to hours
|
||||||
int grib_accessor_class_optimal_step_units_t::is_missing(grib_accessor* a){
|
int grib_accessor_class_optimal_step_units_t::is_missing(grib_accessor* a)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_optimal_step_units_t::get_native_type(grib_accessor* a){
|
int grib_accessor_class_optimal_step_units_t::get_native_type(grib_accessor* a)
|
||||||
|
{
|
||||||
return GRIB_TYPE_LONG;
|
return GRIB_TYPE_LONG;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2005- ECMWF.
|
* (C) Copyright 2005- ECMWF.
|
||||||
*
|
*
|
||||||
|
@ -11,13 +10,14 @@
|
||||||
|
|
||||||
#include "grib_accessor_class_packing_type.h"
|
#include "grib_accessor_class_packing_type.h"
|
||||||
|
|
||||||
grib_accessor_class_packing_type_t _grib_accessor_class_packing_type{"packing_type"};
|
grib_accessor_class_packing_type_t _grib_accessor_class_packing_type{ "packing_type" };
|
||||||
grib_accessor_class* grib_accessor_class_packing_type = &_grib_accessor_class_packing_type;
|
grib_accessor_class* grib_accessor_class_packing_type = &_grib_accessor_class_packing_type;
|
||||||
|
|
||||||
|
|
||||||
void grib_accessor_class_packing_type_t::init(grib_accessor* a, const long l, grib_arguments* args){
|
void grib_accessor_class_packing_type_t::init(grib_accessor* a, const long l, grib_arguments* args)
|
||||||
|
{
|
||||||
grib_accessor_class_gen_t::init(a, l, args);
|
grib_accessor_class_gen_t::init(a, l, args);
|
||||||
int n = 0;
|
int n = 0;
|
||||||
grib_accessor_packing_type_t* self = (grib_accessor_packing_type_t*)a;
|
grib_accessor_packing_type_t* self = (grib_accessor_packing_type_t*)a;
|
||||||
self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++);
|
self->values = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++);
|
||||||
self->packing_type = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++);
|
self->packing_type = grib_arguments_get_name(grib_handle_of_accessor(a), args, n++);
|
||||||
|
@ -25,21 +25,25 @@ void grib_accessor_class_packing_type_t::init(grib_accessor* a, const long l, gr
|
||||||
a->length = 0;
|
a->length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t grib_accessor_class_packing_type_t::string_length(grib_accessor* a){
|
size_t grib_accessor_class_packing_type_t::string_length(grib_accessor* a)
|
||||||
|
{
|
||||||
return 1024;
|
return 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_packing_type_t::get_native_type(grib_accessor* a){
|
int grib_accessor_class_packing_type_t::get_native_type(grib_accessor* a)
|
||||||
|
{
|
||||||
return GRIB_TYPE_STRING;
|
return GRIB_TYPE_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_packing_type_t::pack_string(grib_accessor*a, const char* sval, size_t* len){
|
int grib_accessor_class_packing_type_t::pack_string(grib_accessor* a, const char* sval, size_t* len)
|
||||||
|
{
|
||||||
grib_accessor_packing_type_t* self = (grib_accessor_packing_type_t*)a;
|
grib_accessor_packing_type_t* self = (grib_accessor_packing_type_t*)a;
|
||||||
grib_handle* h = grib_handle_of_accessor(a);
|
|
||||||
double* values = NULL;
|
grib_handle* h = grib_handle_of_accessor(a);
|
||||||
|
double* values = NULL;
|
||||||
grib_context* c = a->context;
|
grib_context* c = a->context;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if ((err = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS)
|
if ((err = grib_get_size(h, self->values, &size)) != GRIB_SUCCESS)
|
||||||
return err;
|
return err;
|
||||||
|
@ -66,9 +70,10 @@ int grib_accessor_class_packing_type_t::pack_string(grib_accessor*a, const char*
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_packing_type_t::unpack_string(grib_accessor* a, char* val, size_t* len){
|
int grib_accessor_class_packing_type_t::unpack_string(grib_accessor* a, char* val, size_t* len)
|
||||||
|
{
|
||||||
grib_accessor_packing_type_t* self = (grib_accessor_packing_type_t*)a;
|
grib_accessor_packing_type_t* self = (grib_accessor_packing_type_t*)a;
|
||||||
grib_handle* h = grib_handle_of_accessor(a);
|
grib_handle* h = grib_handle_of_accessor(a);
|
||||||
|
|
||||||
return grib_get_string(h, self->packing_type, val, len);
|
return grib_get_string(h, self->packing_type, val, len);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2005- ECMWF.
|
* (C) Copyright 2005- ECMWF.
|
||||||
*
|
*
|
||||||
|
@ -12,7 +11,7 @@
|
||||||
#include "grib_accessor_class_second_order_bits_per_value.h"
|
#include "grib_accessor_class_second_order_bits_per_value.h"
|
||||||
#include "grib_scaling.h"
|
#include "grib_scaling.h"
|
||||||
|
|
||||||
grib_accessor_class_second_order_bits_per_value_t _grib_accessor_class_second_order_bits_per_value{"second_order_bits_per_value"};
|
grib_accessor_class_second_order_bits_per_value_t _grib_accessor_class_second_order_bits_per_value{ "second_order_bits_per_value" };
|
||||||
grib_accessor_class* grib_accessor_class_second_order_bits_per_value = &_grib_accessor_class_second_order_bits_per_value;
|
grib_accessor_class* grib_accessor_class_second_order_bits_per_value = &_grib_accessor_class_second_order_bits_per_value;
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,10 +34,11 @@ static const size_t nbits[64] = {
|
||||||
0x1000000000000000, 0x2000000000000000, 0x4000000000000000, 0x8000000000000000
|
0x1000000000000000, 0x2000000000000000, 0x4000000000000000, 0x8000000000000000
|
||||||
};
|
};
|
||||||
|
|
||||||
static int number_of_bits(size_t x, long* result){
|
static int number_of_bits(size_t x, long* result)
|
||||||
|
{
|
||||||
const size_t* n = nbits;
|
const size_t* n = nbits;
|
||||||
const int count = sizeof(nbits) / sizeof(nbits[0]);
|
const int count = sizeof(nbits) / sizeof(nbits[0]);
|
||||||
*result = 0;
|
*result = 0;
|
||||||
while (x >= *n) {
|
while (x >= *n) {
|
||||||
n++;
|
n++;
|
||||||
(*result)++;
|
(*result)++;
|
||||||
|
@ -49,27 +49,30 @@ static int number_of_bits(size_t x, long* result){
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void grib_accessor_class_second_order_bits_per_value_t::init(grib_accessor* a, const long l, grib_arguments* c){
|
void grib_accessor_class_second_order_bits_per_value_t::init(grib_accessor* a, const long l, grib_arguments* c)
|
||||||
|
{
|
||||||
grib_accessor_class_long_t::init(a, l, c);
|
grib_accessor_class_long_t::init(a, l, c);
|
||||||
int n = 0;
|
int n = 0;
|
||||||
grib_accessor_second_order_bits_per_value_t* self = (grib_accessor_second_order_bits_per_value_t*)a;
|
grib_accessor_second_order_bits_per_value_t* self = (grib_accessor_second_order_bits_per_value_t*)a;
|
||||||
self->values = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
self->values = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
||||||
self->binaryScaleFactor = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
self->binaryScaleFactor = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
||||||
self->decimalScaleFactor = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
self->decimalScaleFactor = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
||||||
self->bitsPerValue = 0;
|
self->bitsPerValue = 0;
|
||||||
|
|
||||||
a->length = 0;
|
a->length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_second_order_bits_per_value_t::pack_long(grib_accessor* a, const long* val, size_t* len){
|
int grib_accessor_class_second_order_bits_per_value_t::pack_long(grib_accessor* a, const long* val, size_t* len)
|
||||||
|
{
|
||||||
grib_accessor_second_order_bits_per_value_t* self = (grib_accessor_second_order_bits_per_value_t*)a;
|
grib_accessor_second_order_bits_per_value_t* self = (grib_accessor_second_order_bits_per_value_t*)a;
|
||||||
self->bitsPerValue = (long)*val;
|
self->bitsPerValue = (long)*val;
|
||||||
*len = 1;
|
*len = 1;
|
||||||
|
|
||||||
return 0;
|
return GRIB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_second_order_bits_per_value_t::unpack_long(grib_accessor* a, long* val, size_t* len){
|
int grib_accessor_class_second_order_bits_per_value_t::unpack_long(grib_accessor* a, long* val, size_t* len)
|
||||||
|
{
|
||||||
int ret = GRIB_SUCCESS;
|
int ret = GRIB_SUCCESS;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2005- ECMWF.
|
* (C) Copyright 2005- ECMWF.
|
||||||
*
|
*
|
||||||
|
@ -11,30 +10,33 @@
|
||||||
|
|
||||||
#include "grib_accessor_class_select_step_template.h"
|
#include "grib_accessor_class_select_step_template.h"
|
||||||
|
|
||||||
grib_accessor_class_select_step_template_t _grib_accessor_class_select_step_template{"select_step_template"};
|
grib_accessor_class_select_step_template_t _grib_accessor_class_select_step_template{ "select_step_template" };
|
||||||
grib_accessor_class* grib_accessor_class_select_step_template = &_grib_accessor_class_select_step_template;
|
grib_accessor_class* grib_accessor_class_select_step_template = &_grib_accessor_class_select_step_template;
|
||||||
|
|
||||||
|
|
||||||
void grib_accessor_class_select_step_template_t::init(grib_accessor* a, const long l, grib_arguments* c){
|
void grib_accessor_class_select_step_template_t::init(grib_accessor* a, const long l, grib_arguments* c)
|
||||||
|
{
|
||||||
grib_accessor_class_unsigned_t::init(a, l, c);
|
grib_accessor_class_unsigned_t::init(a, l, c);
|
||||||
grib_accessor_select_step_template_t* self = (grib_accessor_select_step_template_t*)a;
|
grib_accessor_select_step_template_t* self = (grib_accessor_select_step_template_t*)a;
|
||||||
grib_handle* hand = grib_handle_of_accessor(a);
|
grib_handle* hand = grib_handle_of_accessor(a);
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
self->productDefinitionTemplateNumber = grib_arguments_get_name(hand, c, n++);
|
self->productDefinitionTemplateNumber = grib_arguments_get_name(hand, c, n++);
|
||||||
self->instant = grib_arguments_get_long(hand, c, n++);
|
self->instant = grib_arguments_get_long(hand, c, n++);
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_select_step_template_t::unpack_long(grib_accessor* a, long* val, size_t* len){
|
int grib_accessor_class_select_step_template_t::unpack_long(grib_accessor* a, long* val, size_t* len)
|
||||||
|
{
|
||||||
*val = 1;
|
*val = 1;
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_select_step_template_t::pack_long(grib_accessor* a, const long* val, size_t* len){
|
int grib_accessor_class_select_step_template_t::pack_long(grib_accessor* a, const long* val, size_t* len)
|
||||||
|
{
|
||||||
grib_accessor_select_step_template_t* self = (grib_accessor_select_step_template_t*)a;
|
grib_accessor_select_step_template_t* self = (grib_accessor_select_step_template_t*)a;
|
||||||
grib_handle* hand = grib_handle_of_accessor(a);
|
grib_handle* hand = grib_handle_of_accessor(a);
|
||||||
long productDefinitionTemplateNumber = 0;
|
long productDefinitionTemplateNumber = 0;
|
||||||
long productDefinitionTemplateNumberNew = 0;
|
long productDefinitionTemplateNumberNew = 0;
|
||||||
|
|
||||||
grib_get_long(hand, self->productDefinitionTemplateNumber, &productDefinitionTemplateNumber);
|
grib_get_long(hand, self->productDefinitionTemplateNumber, &productDefinitionTemplateNumber);
|
||||||
|
|
||||||
|
@ -64,28 +66,28 @@ int grib_accessor_class_select_step_template_t::pack_long(grib_accessor* a, cons
|
||||||
case 14:
|
case 14:
|
||||||
productDefinitionTemplateNumberNew = 4;
|
productDefinitionTemplateNumberNew = 4;
|
||||||
break;
|
break;
|
||||||
case 42: // DET chemical
|
case 42: // DET chemical
|
||||||
productDefinitionTemplateNumberNew = 40;
|
productDefinitionTemplateNumberNew = 40;
|
||||||
break;
|
break;
|
||||||
case 43: // ENS chemical
|
case 43: // ENS chemical
|
||||||
productDefinitionTemplateNumberNew = 41;
|
productDefinitionTemplateNumberNew = 41;
|
||||||
break;
|
break;
|
||||||
case 46: // DET aerosol
|
case 46: // DET aerosol
|
||||||
productDefinitionTemplateNumberNew = 48; // 44 is deprecated
|
productDefinitionTemplateNumberNew = 48; // 44 is deprecated
|
||||||
break;
|
break;
|
||||||
case 47: // ENS aerosol
|
case 47: // ENS aerosol
|
||||||
productDefinitionTemplateNumberNew = 45;
|
productDefinitionTemplateNumberNew = 45;
|
||||||
break;
|
break;
|
||||||
case 67: // DET chemical distrib func
|
case 67: // DET chemical distrib func
|
||||||
productDefinitionTemplateNumberNew = 57;
|
productDefinitionTemplateNumberNew = 57;
|
||||||
break;
|
break;
|
||||||
case 68: // ENS chemical distrib func
|
case 68: // ENS chemical distrib func
|
||||||
productDefinitionTemplateNumberNew = 58;
|
productDefinitionTemplateNumberNew = 58;
|
||||||
break;
|
break;
|
||||||
case 72: // DET post-processing
|
case 72: // DET post-processing
|
||||||
productDefinitionTemplateNumberNew = 70;
|
productDefinitionTemplateNumberNew = 70;
|
||||||
break;
|
break;
|
||||||
case 73: // ENS post-processing */
|
case 73: // ENS post-processing */
|
||||||
productDefinitionTemplateNumberNew = 71;
|
productDefinitionTemplateNumberNew = 71;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -128,25 +130,25 @@ int grib_accessor_class_select_step_template_t::pack_long(grib_accessor* a, cons
|
||||||
case 6:
|
case 6:
|
||||||
productDefinitionTemplateNumberNew = 10;
|
productDefinitionTemplateNumberNew = 10;
|
||||||
break;
|
break;
|
||||||
case 40: // DET chemical
|
case 40: // DET chemical
|
||||||
productDefinitionTemplateNumberNew = 42;
|
productDefinitionTemplateNumberNew = 42;
|
||||||
break;
|
break;
|
||||||
case 41: // ENS chemical
|
case 41: // ENS chemical
|
||||||
productDefinitionTemplateNumberNew = 43;
|
productDefinitionTemplateNumberNew = 43;
|
||||||
break;
|
break;
|
||||||
case 45: // ENS aerosol
|
case 45: // ENS aerosol
|
||||||
productDefinitionTemplateNumberNew = 85; // 47 is deprecated
|
productDefinitionTemplateNumberNew = 85; // 47 is deprecated
|
||||||
break;
|
break;
|
||||||
case 57: // DET chemical distrib func
|
case 57: // DET chemical distrib func
|
||||||
productDefinitionTemplateNumberNew = 67;
|
productDefinitionTemplateNumberNew = 67;
|
||||||
break;
|
break;
|
||||||
case 58: // ENS chemical distrib func
|
case 58: // ENS chemical distrib func
|
||||||
productDefinitionTemplateNumberNew = 68;
|
productDefinitionTemplateNumberNew = 68;
|
||||||
break;
|
break;
|
||||||
case 70: // DET post-processing
|
case 70: // DET post-processing
|
||||||
productDefinitionTemplateNumberNew = 72;
|
productDefinitionTemplateNumberNew = 72;
|
||||||
break;
|
break;
|
||||||
case 71: // ENS post-processing
|
case 71: // ENS post-processing
|
||||||
productDefinitionTemplateNumberNew = 73;
|
productDefinitionTemplateNumberNew = 73;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
|
@ -172,7 +174,8 @@ int grib_accessor_class_select_step_template_t::pack_long(grib_accessor* a, cons
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_select_step_template_t::value_count(grib_accessor* a, long* c){
|
int grib_accessor_class_select_step_template_t::value_count(grib_accessor* a, long* c)
|
||||||
|
{
|
||||||
*c = 1;
|
*c = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2005- ECMWF.
|
* (C) Copyright 2005- ECMWF.
|
||||||
*
|
*
|
||||||
|
@ -12,11 +11,12 @@
|
||||||
#include "grib_accessor_class_simple_packing_error.h"
|
#include "grib_accessor_class_simple_packing_error.h"
|
||||||
#include "grib_scaling.h"
|
#include "grib_scaling.h"
|
||||||
|
|
||||||
grib_accessor_class_simple_packing_error_t _grib_accessor_class_simple_packing_error{"simple_packing_error"};
|
grib_accessor_class_simple_packing_error_t _grib_accessor_class_simple_packing_error{ "simple_packing_error" };
|
||||||
grib_accessor_class* grib_accessor_class_simple_packing_error = &_grib_accessor_class_simple_packing_error;
|
grib_accessor_class* grib_accessor_class_simple_packing_error = &_grib_accessor_class_simple_packing_error;
|
||||||
|
|
||||||
|
|
||||||
void grib_accessor_class_simple_packing_error_t::init(grib_accessor* a, const long l, grib_arguments* c){
|
void grib_accessor_class_simple_packing_error_t::init(grib_accessor* a, const long l, grib_arguments* c)
|
||||||
|
{
|
||||||
grib_accessor_class_double_t::init(a, l, c);
|
grib_accessor_class_double_t::init(a, l, c);
|
||||||
grib_accessor_simple_packing_error_t* self = (grib_accessor_simple_packing_error_t*)a;
|
grib_accessor_simple_packing_error_t* self = (grib_accessor_simple_packing_error_t*)a;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
@ -32,7 +32,8 @@ void grib_accessor_class_simple_packing_error_t::init(grib_accessor* a, const lo
|
||||||
a->length = 0;
|
a->length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_simple_packing_error_t::unpack_double(grib_accessor* a, double* val, size_t* len){
|
int grib_accessor_class_simple_packing_error_t::unpack_double(grib_accessor* a, double* val, size_t* len)
|
||||||
|
{
|
||||||
grib_accessor_simple_packing_error_t* self = (grib_accessor_simple_packing_error_t*)a;
|
grib_accessor_simple_packing_error_t* self = (grib_accessor_simple_packing_error_t*)a;
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -40,7 +41,7 @@ int grib_accessor_class_simple_packing_error_t::unpack_double(grib_accessor* a,
|
||||||
long bitsPerValue = 0;
|
long bitsPerValue = 0;
|
||||||
long decimalScaleFactor = 0;
|
long decimalScaleFactor = 0;
|
||||||
double referenceValue = 0;
|
double referenceValue = 0;
|
||||||
grib_handle* h = grib_handle_of_accessor(a);
|
grib_handle* h = grib_handle_of_accessor(a);
|
||||||
|
|
||||||
if ((ret = grib_get_long_internal(h, self->binaryScaleFactor, &binaryScaleFactor)) != GRIB_SUCCESS)
|
if ((ret = grib_get_long_internal(h, self->binaryScaleFactor, &binaryScaleFactor)) != GRIB_SUCCESS)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2005- ECMWF.
|
* (C) Copyright 2005- ECMWF.
|
||||||
*
|
*
|
||||||
|
@ -11,14 +10,15 @@
|
||||||
|
|
||||||
#include "grib_accessor_class_spectral_truncation.h"
|
#include "grib_accessor_class_spectral_truncation.h"
|
||||||
|
|
||||||
grib_accessor_class_spectral_truncation_t _grib_accessor_class_spectral_truncation{"spectral_truncation"};
|
grib_accessor_class_spectral_truncation_t _grib_accessor_class_spectral_truncation{ "spectral_truncation" };
|
||||||
grib_accessor_class* grib_accessor_class_spectral_truncation = &_grib_accessor_class_spectral_truncation;
|
grib_accessor_class* grib_accessor_class_spectral_truncation = &_grib_accessor_class_spectral_truncation;
|
||||||
|
|
||||||
|
|
||||||
void grib_accessor_class_spectral_truncation_t::init(grib_accessor* a, const long l, grib_arguments* c){
|
void grib_accessor_class_spectral_truncation_t::init(grib_accessor* a, const long l, grib_arguments* c)
|
||||||
|
{
|
||||||
grib_accessor_class_long_t::init(a, l, c);
|
grib_accessor_class_long_t::init(a, l, c);
|
||||||
grib_accessor_spectral_truncation_t* self = (grib_accessor_spectral_truncation_t*)a;
|
grib_accessor_spectral_truncation_t* self = (grib_accessor_spectral_truncation_t*)a;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
self->J = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
self->J = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
||||||
self->K = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
self->K = grib_arguments_get_name(grib_handle_of_accessor(a), c, n++);
|
||||||
|
@ -28,9 +28,10 @@ void grib_accessor_class_spectral_truncation_t::init(grib_accessor* a, const lon
|
||||||
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
|
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_spectral_truncation_t::unpack_long(grib_accessor* a, long* val, size_t* len){
|
int grib_accessor_class_spectral_truncation_t::unpack_long(grib_accessor* a, long* val, size_t* len)
|
||||||
|
{
|
||||||
grib_accessor_spectral_truncation_t* self = (grib_accessor_spectral_truncation_t*)a;
|
grib_accessor_spectral_truncation_t* self = (grib_accessor_spectral_truncation_t*)a;
|
||||||
int ret = 0;
|
int ret = GRIB_SUCCESS;
|
||||||
|
|
||||||
long J, K, M, T, Tc;
|
long J, K, M, T, Tc;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2005- ECMWF.
|
* (C) Copyright 2005- ECMWF.
|
||||||
*
|
*
|
||||||
|
@ -11,18 +10,20 @@
|
||||||
|
|
||||||
#include "grib_accessor_class_sprintf.h"
|
#include "grib_accessor_class_sprintf.h"
|
||||||
|
|
||||||
grib_accessor_class_sprintf_t _grib_accessor_class_sprintf{"sprintf"};
|
grib_accessor_class_sprintf_t _grib_accessor_class_sprintf{ "sprintf" };
|
||||||
grib_accessor_class* grib_accessor_class_sprintf = &_grib_accessor_class_sprintf;
|
grib_accessor_class* grib_accessor_class_sprintf = &_grib_accessor_class_sprintf;
|
||||||
|
|
||||||
|
|
||||||
void grib_accessor_class_sprintf_t::init(grib_accessor* a, const long l, grib_arguments* c){
|
void grib_accessor_class_sprintf_t::init(grib_accessor* a, const long l, grib_arguments* c)
|
||||||
|
{
|
||||||
grib_accessor_class_ascii_t::init(a, l, c);
|
grib_accessor_class_ascii_t::init(a, l, c);
|
||||||
grib_accessor_sprintf_t* self = (grib_accessor_sprintf_t*)a;
|
grib_accessor_sprintf_t* self = (grib_accessor_sprintf_t*)a;
|
||||||
self->args = c;
|
self->args = c;
|
||||||
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
|
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_sprintf_t::unpack_string(grib_accessor* a, char* val, size_t* len){
|
int grib_accessor_class_sprintf_t::unpack_string(grib_accessor* a, char* val, size_t* len)
|
||||||
|
{
|
||||||
grib_accessor_sprintf_t* self = (grib_accessor_sprintf_t*)a;
|
grib_accessor_sprintf_t* self = (grib_accessor_sprintf_t*)a;
|
||||||
char result[1024];
|
char result[1024];
|
||||||
char tempBuffer[2048];
|
char tempBuffer[2048];
|
||||||
|
@ -61,7 +62,8 @@ int grib_accessor_class_sprintf_t::unpack_string(grib_accessor* a, char* val, si
|
||||||
if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), tempname, &ires)) != GRIB_SUCCESS)
|
if ((ret = grib_get_long_internal(grib_handle_of_accessor(a), tempname, &ires)) != GRIB_SUCCESS)
|
||||||
return ret;
|
return ret;
|
||||||
/* Bug GRIB-56: Check to see if the key is missing */
|
/* Bug GRIB-56: Check to see if the key is missing */
|
||||||
is_missing = grib_is_missing(grib_handle_of_accessor(a), tempname, &ret); if (ret != GRIB_SUCCESS)
|
is_missing = grib_is_missing(grib_handle_of_accessor(a), tempname, &ret);
|
||||||
|
if (ret != GRIB_SUCCESS)
|
||||||
return ret;
|
return ret;
|
||||||
if (is_missing) {
|
if (is_missing) {
|
||||||
snprintf(tempBuffer, sizeof(tempBuffer), "%sMISSING", result);
|
snprintf(tempBuffer, sizeof(tempBuffer), "%sMISSING", result);
|
||||||
|
@ -117,11 +119,13 @@ int grib_accessor_class_sprintf_t::unpack_string(grib_accessor* a, char* val, si
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int grib_accessor_class_sprintf_t::value_count(grib_accessor* a, long* count){
|
int grib_accessor_class_sprintf_t::value_count(grib_accessor* a, long* count)
|
||||||
|
{
|
||||||
*count = 1;
|
*count = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t grib_accessor_class_sprintf_t::string_length(grib_accessor* a){
|
size_t grib_accessor_class_sprintf_t::string_length(grib_accessor* a)
|
||||||
|
{
|
||||||
return 1024;
|
return 1024;
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,6 +281,7 @@ int grib_index_dump_file(FILE* fout, const char* filename, unsigned long flags);
|
||||||
void grib_index_dump(FILE* fout, grib_index* index, unsigned long flags);
|
void grib_index_dump(FILE* fout, grib_index* index, unsigned long flags);
|
||||||
char* grib_get_field_file(grib_index* index, off_t* offset);
|
char* grib_get_field_file(grib_index* index, off_t* offset);
|
||||||
grib_handle* grib_handle_new_from_index(grib_index* index, int* err);
|
grib_handle* grib_handle_new_from_index(grib_index* index, int* err);
|
||||||
|
void grib_index_rewind(grib_index *index);
|
||||||
grib_handle* codes_new_from_index(grib_index* index, int message_type, int* err);
|
grib_handle* codes_new_from_index(grib_index* index, int message_type, int* err);
|
||||||
int codes_index_set_product_kind(grib_index* index, ProductKind product_kind);
|
int codes_index_set_product_kind(grib_index* index, ProductKind product_kind);
|
||||||
int codes_index_set_unpack_bufr(grib_index* index, int unpack);
|
int codes_index_set_unpack_bufr(grib_index* index, int unpack);
|
||||||
|
|
|
@ -65,7 +65,6 @@ static int index_count;
|
||||||
static long values_count = 0;
|
static long values_count = 0;
|
||||||
|
|
||||||
static int codes_index_add_file_internal(grib_index* index, const char* filename, int message_type);
|
static int codes_index_add_file_internal(grib_index* index, const char* filename, int message_type);
|
||||||
static void grib_index_rewind(grib_index* index);
|
|
||||||
|
|
||||||
static char* get_key(char** keys, int* type)
|
static char* get_key(char** keys, int* type)
|
||||||
{
|
{
|
||||||
|
@ -1967,7 +1966,7 @@ grib_handle* codes_new_from_index(grib_index* index, int message_type, int* err)
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void grib_index_rewind(grib_index* index)
|
void grib_index_rewind(grib_index* index)
|
||||||
{
|
{
|
||||||
index->rewind = 1;
|
index->rewind = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,7 +276,7 @@ if( HAVE_BUILD_TOOLS )
|
||||||
grib_ecc-1467
|
grib_ecc-1467
|
||||||
grib_ecc-1764
|
grib_ecc-1764
|
||||||
grib_ecc-1792
|
grib_ecc-1792
|
||||||
grib_ecc-1846
|
grib_modelName
|
||||||
grib_sub_hourly
|
grib_sub_hourly
|
||||||
grib_set_bytes
|
grib_set_bytes
|
||||||
grib_set_force
|
grib_set_force
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
label="grib2_wave_spectra_test"
|
label="grib2_wave_spectra_test"
|
||||||
temp=temp.$label
|
temp=temp.$label
|
||||||
|
tempGribA=temp.$label.A.grib
|
||||||
|
tempGribB=temp.$label.B.grib
|
||||||
tempSample=temp.$label.tmpl
|
tempSample=temp.$label.tmpl
|
||||||
sample2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
sample2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||||
|
|
||||||
|
@ -52,5 +54,18 @@ grib_check_key_equals $temp firstWavelengthInNanometres '12'
|
||||||
grib_check_key_equals $temp firstWavelengthInMetres '1.2e-08'
|
grib_check_key_equals $temp firstWavelengthInMetres '1.2e-08'
|
||||||
|
|
||||||
|
|
||||||
|
# ECC-1867: Unexpected PDT change for wave template for ensemble DA streams
|
||||||
|
sample_ld=$ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib2.tmpl # Sample with a mars local def
|
||||||
|
${tools_dir}/grib_set -s tablesVersion=32,productDefinitionTemplateNumber=99,waveFrequencyNumber=14 $sample_ld $tempGribA
|
||||||
|
${tools_dir}/grib_set -s stream=ewla $tempGribA $tempGribB
|
||||||
|
grib_check_key_equals $tempGribB productDefinitionTemplateNumber,waveFrequencyNumber '99 14'
|
||||||
|
${tools_dir}/grib_compare -b marsStream $tempGribA $tempGribB
|
||||||
|
|
||||||
|
${tools_dir}/grib_set -s type=em $tempGribA $tempGribB
|
||||||
|
${tools_dir}/grib_compare -b marsType,typeOfProcessedData,typeOfGeneratingProcess $tempGribA $tempGribB
|
||||||
|
${tools_dir}/grib_set -s type=es $tempGribA $tempGribB
|
||||||
|
${tools_dir}/grib_compare -b marsType,typeOfProcessedData,typeOfGeneratingProcess $tempGribA $tempGribB
|
||||||
|
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -f $tempSample $temp
|
rm -f $tempSample $temp $tempGribA $tempGribB
|
||||||
|
|
|
@ -86,6 +86,16 @@ set -e
|
||||||
grep -q "unreadable message" $tempText
|
grep -q "unreadable message" $tempText
|
||||||
rm -f $outfile
|
rm -f $outfile
|
||||||
|
|
||||||
|
# ----------------------
|
||||||
|
# Printing array keys
|
||||||
|
# ----------------------
|
||||||
|
set +e
|
||||||
|
${tools_dir}/grib_get -p bitmap $data_dir/reduced_latlon_surface.grib2 > $tempText 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
grep -q "Hint: Tool grib_get cannot print keys of array type" $tempText
|
||||||
|
|
||||||
|
|
||||||
# ----------------------
|
# ----------------------
|
||||||
# Wrong message type
|
# Wrong message type
|
||||||
|
|
|
@ -291,5 +291,16 @@ if [ $HAVE_GEOGRAPHY -eq 1 ]; then
|
||||||
grep -q "unable to open mask file" $tempText
|
grep -q "unable to open mask file" $tempText
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ----------------------
|
||||||
|
# Printing array keys
|
||||||
|
# ----------------------
|
||||||
|
set +e
|
||||||
|
${tools_dir}/grib_ls -p bitmap $data_dir/reduced_latlon_surface.grib2 > $tempText 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
grep -q "Hint: Tool grib_ls cannot print keys of array type" $tempText
|
||||||
|
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -f $temp1 $temp2 $tempText $tempLog
|
rm -f $temp1 $temp2 $tempText $tempLog
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
|
|
||||||
. ./include.ctest.sh
|
. ./include.ctest.sh
|
||||||
|
|
||||||
label="grib_ecc-1846_test"
|
# See ECC-1846
|
||||||
|
|
||||||
|
label="grib_modelName_test"
|
||||||
tempGrib=temp.$label.grib
|
tempGrib=temp.$label.grib
|
||||||
tempFilt=temp.$label.filt
|
tempFilt=temp.$label.filt
|
||||||
tempLog=temp.$label.log
|
tempLog=temp.$label.log
|
|
@ -1239,14 +1239,18 @@ void grib_print_key_values(grib_runtime_options* options, grib_handle* h)
|
||||||
//GRIB_CHECK_NOLINE(ret, options->print_keys[i].name);
|
//GRIB_CHECK_NOLINE(ret, options->print_keys[i].name);
|
||||||
grib_context_log(h->context, GRIB_LOG_ERROR, "%s (%s)",
|
grib_context_log(h->context, GRIB_LOG_ERROR, "%s (%s)",
|
||||||
options->print_keys[i].name, grib_get_error_message(ret));
|
options->print_keys[i].name, grib_get_error_message(ret));
|
||||||
|
if (ret == GRIB_ARRAY_TOO_SMALL || ret == GRIB_BUFFER_TOO_SMALL) {
|
||||||
|
fprintf(dump_file, "\tHint: Tool %s cannot print keys of array type. Use grib_filter.\n", tool_name);
|
||||||
|
}
|
||||||
exit(ret);
|
exit(ret);
|
||||||
}
|
}
|
||||||
if (ret == GRIB_NOT_FOUND) {
|
if (ret == GRIB_NOT_FOUND) {
|
||||||
strcpy(value, notfound);
|
strcpy(value, notfound);
|
||||||
} else {
|
} else {
|
||||||
fprintf(dump_file, "%s (%s)\n", options->print_keys[i].name, grib_get_error_message(ret));
|
fprintf(dump_file, "%s (%s)\n", options->print_keys[i].name, grib_get_error_message(ret));
|
||||||
if (ret == GRIB_ARRAY_TOO_SMALL)
|
if (ret == GRIB_ARRAY_TOO_SMALL || ret == GRIB_BUFFER_TOO_SMALL) {
|
||||||
fprintf(dump_file, "\tHint: Tool %s cannot print keys of array type. Use grib_filter.\n", tool_name);
|
fprintf(dump_file, "\tHint: Tool %s cannot print keys of array type. Use grib_filter.\n", tool_name);
|
||||||
|
}
|
||||||
exit(ret);
|
exit(ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue