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,8 +202,6 @@ void grib_accessor_gen_t::destroy(grib_context* ct)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ======================== grib_accessor_class_gen ========================
|
// ======================== grib_accessor_class_gen ========================
|
||||||
|
|
||||||
|
|
||||||
|
@ -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,11 +10,12 @@
|
||||||
|
|
||||||
#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";
|
||||||
|
@ -27,11 +27,13 @@ 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;
|
||||||
|
@ -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,11 +10,12 @@
|
||||||
|
|
||||||
#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;
|
||||||
|
@ -34,7 +34,8 @@ 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;
|
||||||
|
@ -140,7 +141,8 @@ 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;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2005- ECMWF.
|
* (C) Copyright 2005- ECMWF.
|
||||||
*
|
*
|
||||||
|
@ -11,12 +10,12 @@
|
||||||
|
|
||||||
#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;
|
||||||
|
@ -51,11 +50,13 @@ 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;
|
||||||
|
@ -108,8 +109,10 @@ 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;
|
int ret = 0;
|
||||||
long hour = 0;
|
long hour = 0;
|
||||||
long minute = 0;
|
long minute = 0;
|
||||||
|
@ -157,7 +160,8 @@ 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;
|
||||||
|
@ -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,11 +223,12 @@ 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;
|
||||||
|
@ -230,7 +236,8 @@ int grib_accessor_class_julian_date_t::pack_string(grib_accessor* a, const char*
|
||||||
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,11 +10,12 @@
|
||||||
|
|
||||||
#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;
|
||||||
|
@ -28,17 +28,21 @@ 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;
|
int ret = 0;
|
||||||
long hour = 0;
|
long hour = 0;
|
||||||
long minute = 0;
|
long minute = 0;
|
||||||
|
@ -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,11 +10,12 @@
|
||||||
|
|
||||||
#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);
|
||||||
|
@ -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,7 +93,7 @@ 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) {
|
||||||
|
@ -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;
|
||||||
|
@ -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);
|
||||||
|
@ -28,18 +28,21 @@ void grib_accessor_class_optimal_step_units_t::init(grib_accessor* a, const long
|
||||||
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;
|
const char* cval = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
long lval = 0;
|
long lval = 0;
|
||||||
|
@ -48,8 +51,9 @@ int grib_accessor_class_optimal_step_units_t::pack_expression(grib_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);
|
||||||
|
@ -61,13 +65,15 @@ int grib_accessor_class_optimal_step_units_t::pack_expression(grib_accessor* a,
|
||||||
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;
|
||||||
|
|
||||||
|
@ -79,19 +85,19 @@ int grib_accessor_class_optimal_step_units_t::pack_long(grib_accessor* a, const
|
||||||
|
|
||||||
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,7 +150,7 @@ 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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
int ret = 0;
|
||||||
long unit = 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,11 +10,12 @@
|
||||||
|
|
||||||
#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;
|
||||||
|
@ -25,16 +25,20 @@ 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);
|
grib_handle* h = grib_handle_of_accessor(a);
|
||||||
double* values = NULL;
|
double* values = NULL;
|
||||||
grib_context* c = a->context;
|
grib_context* c = a->context;
|
||||||
|
@ -66,7 +70,8 @@ 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);
|
||||||
|
|
||||||
|
|
|
@ -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,7 +34,8 @@ 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;
|
||||||
|
@ -49,7 +49,8 @@ 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;
|
||||||
|
@ -61,15 +62,17 @@ void grib_accessor_class_second_order_bits_per_value_t::init(grib_accessor* a, c
|
||||||
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,11 +10,12 @@
|
||||||
|
|
||||||
#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);
|
||||||
|
@ -25,12 +25,14 @@ void grib_accessor_class_select_step_template_t::init(grib_accessor* a, const lo
|
||||||
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;
|
||||||
|
@ -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;
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (C) Copyright 2005- ECMWF.
|
* (C) Copyright 2005- ECMWF.
|
||||||
*
|
*
|
||||||
|
@ -11,11 +10,12 @@
|
||||||
|
|
||||||
#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;
|
||||||
|
@ -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