Merge commit '7e78533dfe9a6cf6e0c2e98dadcf6482493ff3fb' into feature/destine-layout

This commit is contained in:
Matthew Griffith 2023-09-13 14:07:49 +00:00
commit fbc4d3ab03
26 changed files with 297 additions and 202 deletions

View File

@ -33,11 +33,11 @@ concept datasetForLocal(unknown) {
"hydro" = {marsClass="ul";} # ULYSSES
"fire" = {marsClass="gw";} # Global Wildfire awareness system
"uerra" = {productionStatusOfProcessedData=8;} # UERRA
"uerra" = {productionStatusOfProcessedData=9;} # UERRA
"uerra" = {productionStatusOfProcessedData=9;}
"uerra" = {productionStatusOfProcessedData=10;} # CARRA/CERRA
"uerra" = {productionStatusOfProcessedData=11;} # CARRA/CERRA
"destine" = {productionStatusOfProcessedData=12;} # DestinE
"destine" = {productionStatusOfProcessedData=13;} # DestinE Test
"uerra" = {productionStatusOfProcessedData=11;}
"destine" = {productionStatusOfProcessedData=12;} # Destination Earth
"destine" = {productionStatusOfProcessedData=13;}
"unknown" = { dummy=1; }
}

View File

@ -359,7 +359,6 @@ list( APPEND eccodes_src_files
grib_yacc.h
md5.h
md5.cc
grib_accessor_class_int64_little_endian.cc
grib_accessor_class_uint16.cc
grib_accessor_class_uint32.cc
grib_accessor_class_uint32_little_endian.cc

View File

@ -89,7 +89,6 @@ Generated by src/make_accessor_class_hierarchy_dirs.sh
|---grib_accessor_class_hash_array
|---grib_accessor_class_headers_only
|---grib_accessor_class_ifs_param
|---grib_accessor_class_int64_little_endian
|---grib_accessor_class_iterator
|---grib_accessor_class_label
|---grib_accessor_class_long

View File

@ -77,9 +77,7 @@ static void init_class(grib_action_class* c)
}
/* END_CLASS_IMP */
grib_action* grib_action_create_modify(grib_context* context,
const char* name,
long flags)
grib_action* grib_action_create_modify(grib_context* context, const char* name, long flags)
{
grib_action_modify* a;
grib_action_class* c = grib_action_class_modify;
@ -110,11 +108,13 @@ static int create_accessor(grib_section* p, grib_action* act, grib_loader* h)
ga = grib_find_accessor(p->h, a->name);
if (ga)
if (ga) {
ga->flags = a->flags;
}
else {
grib_context_log(act->context, GRIB_LOG_DEBUG, "action_class_modify: create_accessor_buffer : No accessor named %s to modify.", a->name);
grib_context_log(act->context, GRIB_LOG_ERROR, "action_class_modify: %s: No accessor named %s to modify",
__func__, a->name);
return GRIB_INTERNAL_ERROR;
}
return GRIB_SUCCESS;
}

View File

@ -408,8 +408,6 @@ int grib_g1_step_get_steps(grib_accessor* a, long* start, long* theEnd);
/* grib_accessor_class_ifs_param.cc*/
/* grib_accessor_class_int64_little_endian.cc*/
/* grib_accessor_class_uint16.cc*/
/* grib_accessor_class_uint32.cc*/

View File

@ -112,7 +112,6 @@ extern grib_accessor_class* grib_accessor_class_headers_only;
extern grib_accessor_class* grib_accessor_class_ibmfloat;
extern grib_accessor_class* grib_accessor_class_ieeefloat;
extern grib_accessor_class* grib_accessor_class_ifs_param;
extern grib_accessor_class* grib_accessor_class_int64_little_endian;
extern grib_accessor_class* grib_accessor_class_iterator;
extern grib_accessor_class* grib_accessor_class_julian_date;
extern grib_accessor_class* grib_accessor_class_julian_day;

View File

@ -682,10 +682,10 @@ static int pack_string(grib_accessor* a, const char* buffer, size_t* len)
if (act->default_value != NULL) {
const char* p = 0;
size_t s_len = 1;
long l;
long l = 0;
int ret = 0;
double d;
char tmp[1024];
double d = 0;
char tmp[1024] = {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);
switch (type) {
@ -703,8 +703,8 @@ static int pack_string(grib_accessor* a, const char* buffer, size_t* len)
s_len = sizeof(tmp);
p = grib_expression_evaluate_string(grib_handle_of_accessor(a), expression, tmp, &s_len, &ret);
if (ret != GRIB_SUCCESS) {
grib_context_log(a->context, GRIB_LOG_FATAL,
"unable to evaluate %s as string", a->name);
grib_context_log(a->context, GRIB_LOG_ERROR,
"%s: Unable to evaluate default value of %s as string expression", __func__, a->name);
return ret;
}
s_len = strlen(p) + 1;

View File

@ -308,7 +308,8 @@ static int unpack_double(grib_accessor* a, double* values, size_t* len)
static int pack_double(grib_accessor* a, const double* cval, size_t* len)
{
grib_context_log(a->context, GRIB_LOG_ERROR, "constant width packing not implemented");
const char* cclass_name = a->cclass->name;
grib_context_log(a->context, GRIB_LOG_ERROR, "%s: %s: Not implemented", cclass_name, __func__);
return GRIB_NOT_IMPLEMENTED;
}

View File

@ -7,9 +7,6 @@
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
/***********************************************************
* Enrico Fucile
***********************************************************/
#include "grib_api_internal.h"
/*
@ -18,9 +15,9 @@
START_CLASS_DEF
CLASS = accessor
SUPER = grib_accessor_class_gen
IMPLEMENTS = unpack_string;pack_string
IMPLEMENTS = unpack_long;pack_long
IMPLEMENTS = unpack_double;pack_double
IMPLEMENTS = unpack_string
IMPLEMENTS = unpack_long
IMPLEMENTS = unpack_double
IMPLEMENTS = init;dump;string_length
IMPLEMENTS = value_count
IMPLEMENTS = next_offset
@ -42,9 +39,6 @@ or edit "accessor.class" and rerun ./make_class.pl
*/
static int get_native_type(grib_accessor*);
static int pack_double(grib_accessor*, const double* val, size_t* len);
static int pack_long(grib_accessor*, const long* val, size_t* len);
static int pack_string(grib_accessor*, const char*, size_t* len);
static int unpack_double(grib_accessor*, double* val, size_t* len);
static int unpack_long(grib_accessor*, long* val, size_t* len);
static int unpack_string(grib_accessor*, char*, size_t* len);
@ -84,13 +78,13 @@ static grib_accessor_class _grib_accessor_class_group = {
0, /* get sub_section */
0, /* pack_missing */
0, /* is_missing */
&pack_long, /* pack_long */
0, /* pack_long */
&unpack_long, /* unpack_long */
&pack_double, /* pack_double */
0, /* pack_double */
0, /* pack_float */
&unpack_double, /* unpack_double */
0, /* unpack_float */
&pack_string, /* pack_string */
0, /* pack_string */
&unpack_string, /* unpack_string */
0, /* pack_string_array */
0, /* unpack_string_array */
@ -194,23 +188,6 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
return GRIB_SUCCESS;
}
static int pack_string(grib_accessor* a, const char* val, size_t* len)
{
return GRIB_NOT_IMPLEMENTED;
}
static int pack_long(grib_accessor* a, const long* v, size_t* len)
{
grib_context_log(a->context, GRIB_LOG_ERROR, " Should not pack %s as long", a->name);
return GRIB_NOT_IMPLEMENTED;
}
static int pack_double(grib_accessor* a, const double* v, size_t* len)
{
grib_context_log(a->context, GRIB_LOG_ERROR, " Should not pack %s as double", a->name);
return GRIB_NOT_IMPLEMENTED;
}
static int unpack_long(grib_accessor* a, long* v, size_t* len)
{
char val[1024] = {0,};

View File

@ -7,9 +7,6 @@
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
/***********************************************************
* Enrico Fucile
***********************************************************/
#include "grib_api_internal.h"
/*
@ -18,9 +15,9 @@
START_CLASS_DEF
CLASS = accessor
SUPER = grib_accessor_class_gen
IMPLEMENTS = unpack_string;pack_string
IMPLEMENTS = unpack_long;pack_long
IMPLEMENTS = unpack_double;pack_double
IMPLEMENTS = unpack_string
IMPLEMENTS = unpack_long
IMPLEMENTS = unpack_double
IMPLEMENTS = init;dump;string_length
IMPLEMENTS = value_count
IMPLEMENTS = next_offset
@ -44,9 +41,6 @@ or edit "accessor.class" and rerun ./make_class.pl
*/
static int get_native_type(grib_accessor*);
static int pack_double(grib_accessor*, const double* val, size_t* len);
static int pack_long(grib_accessor*, const long* val, size_t* len);
static int pack_string(grib_accessor*, const char*, size_t* len);
static int unpack_double(grib_accessor*, double* val, size_t* len);
static int unpack_long(grib_accessor*, long* val, size_t* len);
static int unpack_string(grib_accessor*, char*, size_t* len);
@ -88,13 +82,13 @@ static grib_accessor_class _grib_accessor_class_to_string = {
0, /* get sub_section */
0, /* pack_missing */
0, /* is_missing */
&pack_long, /* pack_long */
0, /* pack_long */
&unpack_long, /* unpack_long */
&pack_double, /* pack_double */
0, /* pack_double */
0, /* pack_float */
&unpack_double, /* unpack_double */
0, /* unpack_float */
&pack_string, /* pack_string */
0, /* pack_string */
&unpack_string, /* unpack_string */
0, /* pack_string_array */
0, /* unpack_string_array */
@ -148,11 +142,11 @@ static int value_count(grib_accessor* a, long* count)
static size_t string_length(grib_accessor* a)
{
grib_accessor_to_string* self = (grib_accessor_to_string*)a;
size_t size = 0;
if (self->length)
return self->length;
size_t size = 0;
grib_get_string_length(grib_handle_of_accessor(a), self->key, &size);
return size;
}
@ -169,21 +163,21 @@ static int get_native_type(grib_accessor* a)
static int unpack_string(grib_accessor* a, char* val, size_t* len)
{
int err = 0;
grib_accessor_to_string* self = (grib_accessor_to_string*)a;
char buff[512] = {0,};
size_t length;
size_t size = 512;
length = string_length(a);
int err = 0;
char buff[512] = {0,};
size_t length = string_length(a);
if (len[0] < length + 1) {
grib_context_log(a->context, GRIB_LOG_ERROR, "unpack_string: Wrong size (%lu) for %s, it contains %ld values",
len[0], a->name, a->length + 1);
len[0], a->name, a->length + 1);
len[0] = 0;
return GRIB_ARRAY_TOO_SMALL;
}
size_t size = sizeof(buff);
err = grib_get_string(grib_handle_of_accessor(a), self->key, buff, &size);
if (err)
return err;
@ -199,23 +193,6 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
return GRIB_SUCCESS;
}
static int pack_string(grib_accessor* a, const char* val, size_t* len)
{
return GRIB_NOT_IMPLEMENTED;
}
static int pack_long(grib_accessor* a, const long* v, size_t* len)
{
grib_context_log(a->context, GRIB_LOG_ERROR, " Should not pack %s as long", a->name);
return GRIB_NOT_IMPLEMENTED;
}
static int pack_double(grib_accessor* a, const double* v, size_t* len)
{
grib_context_log(a->context, GRIB_LOG_ERROR, " Should not pack %s as double", a->name);
return GRIB_NOT_IMPLEMENTED;
}
static int unpack_long(grib_accessor* a, long* v, size_t* len)
{
char val[1024] = {0,};

View File

@ -18,6 +18,7 @@
SUPER = grib_accessor_class_gen
IMPLEMENTS = unpack_long
IMPLEMENTS = pack_long
IMPLEMENTS = get_native_type
END_CLASS_DEF
*/
@ -32,6 +33,7 @@ or edit "accessor.class" and rerun ./make_class.pl
*/
static int get_native_type(grib_accessor*);
static int pack_long(grib_accessor*, const long* val, size_t* len);
static int unpack_long(grib_accessor*, long* val, size_t* len);
@ -59,7 +61,7 @@ static grib_accessor_class _grib_accessor_class_uint16 = {
0, /* get number of values */
0, /* get number of bytes */
0, /* get offset to bytes */
0, /* get native type */
&get_native_type, /* get native type */
0, /* get sub_section */
0, /* pack_missing */
0, /* is_missing */
@ -104,7 +106,7 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
/*unsigned char* data = grib_handle_of_accessor(a)->buffer->data;*/
if (*len < 1) {
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s it contains %d values ", a->name, 1);
grib_context_log(a->context, GRIB_LOG_ERROR, "Wrong size for %s, it contains %d values", a->name, 1);
*len = 0;
return GRIB_ARRAY_TOO_SMALL;
}
@ -119,3 +121,8 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
{
return GRIB_NOT_IMPLEMENTED;
}
static int get_native_type(grib_accessor* a)
{
return GRIB_TYPE_LONG;
}

View File

@ -116,13 +116,11 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
return GRIB_NOT_IMPLEMENTED;
}
static int pack_long(grib_accessor* a, const long* val, size_t* len)
{
return GRIB_NOT_IMPLEMENTED;
}
static int get_native_type(grib_accessor* a)
{
return GRIB_TYPE_LONG;

View File

@ -132,7 +132,6 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
return GRIB_SUCCESS;
}
static int pack_long(grib_accessor* a, const long* val, size_t* len)
{
return GRIB_NOT_IMPLEMENTED;

View File

@ -37,7 +37,7 @@
#line 6 "accessor_class_list.gperf"
struct accessor_class_hash { char *name; grib_accessor_class **cclass;};
#define TOTAL_KEYWORDS 204
#define TOTAL_KEYWORDS 203
#define MIN_WORD_LENGTH 1
#define MAX_WORD_LENGTH 44
#define MIN_HASH_VALUE 1
@ -60,7 +60,7 @@ static unsigned int grib_accessor_classes_get_id (const char *str, size_t len)
507, 507, 507, 507, 507, 507, 507, 507, 507, 507,
507, 507, 0, 507, 507, 507, 507, 507, 507, 507,
507, 507, 507, 507, 507, 507, 507, 507, 1, 145,
23, 6, 5, 507, 4, 507, 1, 507, 507, 507,
23, 6, 2, 507, 4, 507, 1, 507, 507, 507,
507, 507, 507, 507, 507, 507, 507, 507, 507, 507,
507, 507, 507, 507, 507, 507, 507, 507, 507, 507,
507, 507, 507, 507, 507, 507, 507, 507, 507, 507,
@ -117,21 +117,21 @@ static const struct accessor_class_hash classes[] =
#line 9 "accessor_class_list.gperf"
{" "},
{""}, {""}, {""}, {""},
#line 178 "accessor_class_list.gperf"
#line 177 "accessor_class_list.gperf"
{"size", &grib_accessor_class_size},
#line 12 "accessor_class_list.gperf"
{"ascii", &grib_accessor_class_ascii},
#line 175 "accessor_class_list.gperf"
#line 174 "accessor_class_list.gperf"
{"signed", &grib_accessor_class_signed},
#line 155 "accessor_class_list.gperf"
#line 154 "accessor_class_list.gperf"
{"pad", &grib_accessor_class_pad},
#line 181 "accessor_class_list.gperf"
#line 180 "accessor_class_list.gperf"
{"spd", &grib_accessor_class_spd},
{""},
#line 75 "accessor_class_list.gperf"
{"dirty", &grib_accessor_class_dirty},
{""},
#line 176 "accessor_class_list.gperf"
#line 175 "accessor_class_list.gperf"
{"signed_bits", &grib_accessor_class_signed_bits},
{""},
#line 66 "accessor_class_list.gperf"
@ -141,7 +141,7 @@ static const struct accessor_class_hash classes[] =
{"data_simple_packing", &grib_accessor_class_data_simple_packing},
#line 68 "accessor_class_list.gperf"
{"data_secondary_bitmap", &grib_accessor_class_data_secondary_bitmap},
#line 169 "accessor_class_list.gperf"
#line 168 "accessor_class_list.gperf"
{"section", &grib_accessor_class_section},
#line 43 "accessor_class_list.gperf"
{"data_apply_bitmap", &grib_accessor_class_data_apply_bitmap},
@ -155,36 +155,36 @@ static const struct accessor_class_hash classes[] =
{"data_jpeg2000_packing", &grib_accessor_class_data_jpeg2000_packing},
#line 65 "accessor_class_list.gperf"
{"data_png_packing", &grib_accessor_class_data_png_packing},
#line 171 "accessor_class_list.gperf"
#line 170 "accessor_class_list.gperf"
{"section_padding", &grib_accessor_class_section_padding},
#line 172 "accessor_class_list.gperf"
#line 171 "accessor_class_list.gperf"
{"section_pointer", &grib_accessor_class_section_pointer},
#line 44 "accessor_class_list.gperf"
{"data_apply_boustrophedonic", &grib_accessor_class_data_apply_boustrophedonic},
{""}, {""}, {""}, {""},
#line 80 "accessor_class_list.gperf"
{"expanded_descriptors", &grib_accessor_class_expanded_descriptors},
#line 156 "accessor_class_list.gperf"
#line 155 "accessor_class_list.gperf"
{"padding", &grib_accessor_class_padding},
#line 45 "accessor_class_list.gperf"
{"data_apply_boustrophedonic_bitmap", &grib_accessor_class_data_apply_boustrophedonic_bitmap},
#line 110 "accessor_class_list.gperf"
{"gds_is_present", &grib_accessor_class_gds_is_present},
#line 168 "accessor_class_list.gperf"
#line 167 "accessor_class_list.gperf"
{"second_order_bits_per_value", &grib_accessor_class_second_order_bits_per_value},
#line 170 "accessor_class_list.gperf"
#line 169 "accessor_class_list.gperf"
{"section_length", &grib_accessor_class_section_length},
#line 113 "accessor_class_list.gperf"
{"getenv", &grib_accessor_class_getenv},
#line 57 "accessor_class_list.gperf"
{"data_g22order_packing", &grib_accessor_class_data_g22order_packing},
#line 190 "accessor_class_list.gperf"
#line 189 "accessor_class_list.gperf"
{"time", &grib_accessor_class_time},
{""},
#line 61 "accessor_class_list.gperf"
{"data_g2shsimple_packing", &grib_accessor_class_data_g2shsimple_packing},
{""},
#line 154 "accessor_class_list.gperf"
#line 153 "accessor_class_list.gperf"
{"packing_type", &grib_accessor_class_packing_type},
#line 62 "accessor_class_list.gperf"
{"data_g2simple_packing", &grib_accessor_class_data_g2simple_packing},
@ -198,28 +198,28 @@ static const struct accessor_class_hash classes[] =
{"g2end_step", &grib_accessor_class_g2end_step},
#line 98 "accessor_class_list.gperf"
{"g2_eps", &grib_accessor_class_g2_eps},
#line 142 "accessor_class_list.gperf"
#line 141 "accessor_class_list.gperf"
{"nearest", &grib_accessor_class_nearest},
{""},
#line 157 "accessor_class_list.gperf"
#line 156 "accessor_class_list.gperf"
{"padto", &grib_accessor_class_padto},
#line 188 "accessor_class_list.gperf"
#line 187 "accessor_class_list.gperf"
{"sum", &grib_accessor_class_sum},
{""},
#line 107 "accessor_class_list.gperf"
{"g2lon", &grib_accessor_class_g2lon},
#line 202 "accessor_class_list.gperf"
#line 201 "accessor_class_list.gperf"
{"uint8", &grib_accessor_class_uint8},
{""},
#line 187 "accessor_class_list.gperf"
#line 186 "accessor_class_list.gperf"
{"step_in_units", &grib_accessor_class_step_in_units},
#line 63 "accessor_class_list.gperf"
{"data_g2simple_packing_with_preprocessing", &grib_accessor_class_data_g2simple_packing_with_preprocessing},
#line 200 "accessor_class_list.gperf"
#line 199 "accessor_class_list.gperf"
{"uint64", &grib_accessor_class_uint64},
#line 47 "accessor_class_list.gperf"
{"data_complex_packing", &grib_accessor_class_data_complex_packing},
#line 198 "accessor_class_list.gperf"
#line 197 "accessor_class_list.gperf"
{"uint32", &grib_accessor_class_uint32},
#line 13 "accessor_class_list.gperf"
{"bit", &grib_accessor_class_bit},
@ -229,11 +229,11 @@ static const struct accessor_class_hash classes[] =
{"data_dummy_field", &grib_accessor_class_data_dummy_field},
#line 14 "accessor_class_list.gperf"
{"bitmap", &grib_accessor_class_bitmap},
#line 125 "accessor_class_list.gperf"
{"julian_day", &grib_accessor_class_julian_day},
#line 124 "accessor_class_list.gperf"
{"julian_day", &grib_accessor_class_julian_day},
#line 123 "accessor_class_list.gperf"
{"julian_date", &grib_accessor_class_julian_date},
#line 143 "accessor_class_list.gperf"
#line 142 "accessor_class_list.gperf"
{"non_alpha", &grib_accessor_class_non_alpha},
{""},
#line 29 "accessor_class_list.gperf"
@ -245,14 +245,14 @@ static const struct accessor_class_hash classes[] =
#line 16 "accessor_class_list.gperf"
{"bits_per_value", &grib_accessor_class_bits_per_value},
{""}, {""}, {""}, {""}, {""},
#line 166 "accessor_class_list.gperf"
#line 165 "accessor_class_list.gperf"
{"scale", &grib_accessor_class_scale},
{""},
#line 184 "accessor_class_list.gperf"
#line 183 "accessor_class_list.gperf"
{"statistics", &grib_accessor_class_statistics},
#line 102 "accessor_class_list.gperf"
{"g2date", &grib_accessor_class_g2date},
#line 145 "accessor_class_list.gperf"
#line 144 "accessor_class_list.gperf"
{"number_of_points", &grib_accessor_class_number_of_points},
#line 100 "accessor_class_list.gperf"
{"g2bitmap", &grib_accessor_class_g2bitmap},
@ -263,47 +263,47 @@ static const struct accessor_class_hash classes[] =
{"data_g2bifourier_packing", &grib_accessor_class_data_g2bifourier_packing},
#line 111 "accessor_class_list.gperf"
{"gds_not_present_bitmap", &grib_accessor_class_gds_not_present_bitmap},
#line 123 "accessor_class_list.gperf"
#line 122 "accessor_class_list.gperf"
{"iterator", &grib_accessor_class_iterator},
#line 185 "accessor_class_list.gperf"
#line 184 "accessor_class_list.gperf"
{"statistics_spectral", &grib_accessor_class_statistics_spectral},
#line 46 "accessor_class_list.gperf"
{"data_ccsds_packing", &grib_accessor_class_data_ccsds_packing},
#line 146 "accessor_class_list.gperf"
#line 145 "accessor_class_list.gperf"
{"number_of_points_gaussian", &grib_accessor_class_number_of_points_gaussian},
#line 205 "accessor_class_list.gperf"
#line 204 "accessor_class_list.gperf"
{"unsigned", &grib_accessor_class_unsigned},
#line 139 "accessor_class_list.gperf"
#line 138 "accessor_class_list.gperf"
{"md5", &grib_accessor_class_md5},
{""}, {""},
#line 96 "accessor_class_list.gperf"
{"g2_aerosol", &grib_accessor_class_g2_aerosol},
#line 140 "accessor_class_list.gperf"
#line 139 "accessor_class_list.gperf"
{"message", &grib_accessor_class_message},
#line 206 "accessor_class_list.gperf"
#line 205 "accessor_class_list.gperf"
{"unsigned_bits", &grib_accessor_class_unsigned_bits},
#line 173 "accessor_class_list.gperf"
#line 172 "accessor_class_list.gperf"
{"select_step_template", &grib_accessor_class_select_step_template},
#line 137 "accessor_class_list.gperf"
#line 136 "accessor_class_list.gperf"
{"mars_param", &grib_accessor_class_mars_param},
#line 203 "accessor_class_list.gperf"
#line 202 "accessor_class_list.gperf"
{"unexpanded_descriptors", &grib_accessor_class_unexpanded_descriptors},
#line 192 "accessor_class_list.gperf"
#line 191 "accessor_class_list.gperf"
{"to_integer", &grib_accessor_class_to_integer},
{""}, {""}, {""},
#line 177 "accessor_class_list.gperf"
#line 176 "accessor_class_list.gperf"
{"simple_packing_error", &grib_accessor_class_simple_packing_error},
#line 186 "accessor_class_list.gperf"
#line 185 "accessor_class_list.gperf"
{"step_human_readable", &grib_accessor_class_step_human_readable},
#line 141 "accessor_class_list.gperf"
#line 140 "accessor_class_list.gperf"
{"message_copy", &grib_accessor_class_message_copy},
#line 162 "accessor_class_list.gperf"
#line 161 "accessor_class_list.gperf"
{"raw", &grib_accessor_class_raw},
{""}, {""},
#line 201 "accessor_class_list.gperf"
#line 200 "accessor_class_list.gperf"
{"uint64_little_endian", &grib_accessor_class_uint64_little_endian},
{""},
#line 199 "accessor_class_list.gperf"
#line 198 "accessor_class_list.gperf"
{"uint32_little_endian", &grib_accessor_class_uint32_little_endian},
#line 114 "accessor_class_list.gperf"
{"global_gaussian", &grib_accessor_class_global_gaussian},
@ -311,22 +311,22 @@ static const struct accessor_class_hash classes[] =
#line 76 "accessor_class_list.gperf"
{"divdouble", &grib_accessor_class_divdouble},
{""},
#line 174 "accessor_class_list.gperf"
#line 173 "accessor_class_list.gperf"
{"sexagesimal2decimal", &grib_accessor_class_sexagesimal2decimal},
#line 99 "accessor_class_list.gperf"
{"g2_mars_labeling", &grib_accessor_class_g2_mars_labeling},
#line 78 "accessor_class_list.gperf"
{"element", &grib_accessor_class_element},
#line 159 "accessor_class_list.gperf"
#line 158 "accessor_class_list.gperf"
{"padtomultiple", &grib_accessor_class_padtomultiple},
#line 128 "accessor_class_list.gperf"
#line 127 "accessor_class_list.gperf"
{"latitudes", &grib_accessor_class_latitudes},
#line 163 "accessor_class_list.gperf"
#line 162 "accessor_class_list.gperf"
{"rdbtime_guess_date", &grib_accessor_class_rdbtime_guess_date},
{""}, {""}, {""},
#line 193 "accessor_class_list.gperf"
#line 192 "accessor_class_list.gperf"
{"to_string", &grib_accessor_class_to_string},
#line 133 "accessor_class_list.gperf"
#line 132 "accessor_class_list.gperf"
{"long", &grib_accessor_class_long},
#line 19 "accessor_class_list.gperf"
{"bufr_data_array", &grib_accessor_class_bufr_data_array},
@ -340,7 +340,7 @@ static const struct accessor_class_hash classes[] =
#line 26 "accessor_class_list.gperf"
{"bufr_simple_thinning", &grib_accessor_class_bufr_simple_thinning},
{""},
#line 138 "accessor_class_list.gperf"
#line 137 "accessor_class_list.gperf"
{"mars_step", &grib_accessor_class_mars_step},
{""},
#line 115 "accessor_class_list.gperf"
@ -348,20 +348,20 @@ static const struct accessor_class_hash classes[] =
{""},
#line 28 "accessor_class_list.gperf"
{"bufrdc_expanded_descriptors", &grib_accessor_class_bufrdc_expanded_descriptors},
#line 160 "accessor_class_list.gperf"
#line 159 "accessor_class_list.gperf"
{"position", &grib_accessor_class_position},
{""}, {""}, {""},
#line 17 "accessor_class_list.gperf"
{"blob", &grib_accessor_class_blob},
#line 109 "accessor_class_list.gperf"
{"gaussian_grid_name", &grib_accessor_class_gaussian_grid_name},
#line 196 "accessor_class_list.gperf"
#line 195 "accessor_class_list.gperf"
{"trim", &grib_accessor_class_trim},
{""}, {""},
#line 119 "accessor_class_list.gperf"
{"ibmfloat", &grib_accessor_class_ibmfloat},
{""}, {""},
#line 194 "accessor_class_list.gperf"
#line 193 "accessor_class_list.gperf"
{"transient", &grib_accessor_class_transient},
#line 55 "accessor_class_list.gperf"
{"data_g1shsimple_packing", &grib_accessor_class_data_g1shsimple_packing},
@ -370,49 +370,49 @@ static const struct accessor_class_hash classes[] =
{"data_g1simple_packing", &grib_accessor_class_data_g1simple_packing},
#line 49 "accessor_class_list.gperf"
{"data_g1complex_packing", &grib_accessor_class_data_g1complex_packing},
#line 165 "accessor_class_list.gperf"
#line 164 "accessor_class_list.gperf"
{"round", &grib_accessor_class_round},
#line 195 "accessor_class_list.gperf"
#line 194 "accessor_class_list.gperf"
{"transient_darray", &grib_accessor_class_transient_darray},
#line 18 "accessor_class_list.gperf"
{"budgdate", &grib_accessor_class_budgdate},
#line 209 "accessor_class_list.gperf"
#line 208 "accessor_class_list.gperf"
{"values", &grib_accessor_class_values},
#line 144 "accessor_class_list.gperf"
#line 143 "accessor_class_list.gperf"
{"number_of_coded_values", &grib_accessor_class_number_of_coded_values},
#line 127 "accessor_class_list.gperf"
#line 126 "accessor_class_list.gperf"
{"label", &grib_accessor_class_label},
{""}, {""},
#line 38 "accessor_class_list.gperf"
{"concept", &grib_accessor_class_concept},
{""},
#line 182 "accessor_class_list.gperf"
#line 181 "accessor_class_list.gperf"
{"spectral_truncation", &grib_accessor_class_spectral_truncation},
{""}, {""},
#line 83 "accessor_class_list.gperf"
{"g1_message_length", &grib_accessor_class_g1_message_length},
#line 183 "accessor_class_list.gperf"
#line 182 "accessor_class_list.gperf"
{"sprintf", &grib_accessor_class_sprintf},
#line 189 "accessor_class_list.gperf"
#line 188 "accessor_class_list.gperf"
{"suppressed", &grib_accessor_class_suppressed},
{""},
#line 212 "accessor_class_list.gperf"
#line 211 "accessor_class_list.gperf"
{"when", &grib_accessor_class_when},
{""}, {""},
#line 179 "accessor_class_list.gperf"
#line 178 "accessor_class_list.gperf"
{"smart_table", &grib_accessor_class_smart_table},
{""},
#line 39 "accessor_class_list.gperf"
{"constant", &grib_accessor_class_constant},
{""}, {""},
#line 161 "accessor_class_list.gperf"
#line 160 "accessor_class_list.gperf"
{"proj_string", &grib_accessor_class_proj_string},
#line 150 "accessor_class_list.gperf"
#line 149 "accessor_class_list.gperf"
{"octet_number", &grib_accessor_class_octet_number},
#line 180 "accessor_class_list.gperf"
#line 179 "accessor_class_list.gperf"
{"smart_table_column", &grib_accessor_class_smart_table_column},
{""},
#line 136 "accessor_class_list.gperf"
#line 135 "accessor_class_list.gperf"
{"lookup", &grib_accessor_class_lookup},
{""},
#line 94 "accessor_class_list.gperf"
@ -420,17 +420,15 @@ static const struct accessor_class_hash classes[] =
#line 73 "accessor_class_list.gperf"
{"decimal_precision", &grib_accessor_class_decimal_precision},
{""},
#line 135 "accessor_class_list.gperf"
#line 134 "accessor_class_list.gperf"
{"longitudes", &grib_accessor_class_longitudes},
#line 70 "accessor_class_list.gperf"
{"data_sh_unpacked", &grib_accessor_class_data_sh_unpacked},
#line 27 "accessor_class_list.gperf"
{"bufr_string_values", &grib_accessor_class_bufr_string_values},
#line 197 "accessor_class_list.gperf"
#line 196 "accessor_class_list.gperf"
{"uint16", &grib_accessor_class_uint16},
#line 122 "accessor_class_list.gperf"
{"int64_little_endian", &grib_accessor_class_int64_little_endian},
{""},
{""}, {""},
#line 71 "accessor_class_list.gperf"
{"data_shsimple_packing", &grib_accessor_class_data_shsimple_packing},
#line 86 "accessor_class_list.gperf"
@ -441,35 +439,35 @@ static const struct accessor_class_hash classes[] =
{""},
#line 54 "accessor_class_list.gperf"
{"data_g1secondary_bitmap", &grib_accessor_class_data_g1secondary_bitmap},
#line 191 "accessor_class_list.gperf"
#line 190 "accessor_class_list.gperf"
{"to_double", &grib_accessor_class_to_double},
#line 101 "accessor_class_list.gperf"
{"g2bitmap_present", &grib_accessor_class_g2bitmap_present},
#line 120 "accessor_class_list.gperf"
{"ieeefloat", &grib_accessor_class_ieeefloat},
#line 151 "accessor_class_list.gperf"
#line 150 "accessor_class_list.gperf"
{"offset_file", &grib_accessor_class_offset_file},
#line 207 "accessor_class_list.gperf"
#line 206 "accessor_class_list.gperf"
{"validity_date", &grib_accessor_class_validity_date},
#line 208 "accessor_class_list.gperf"
#line 207 "accessor_class_list.gperf"
{"validity_time", &grib_accessor_class_validity_time},
{""},
#line 131 "accessor_class_list.gperf"
#line 130 "accessor_class_list.gperf"
{"library_version", &grib_accessor_class_library_version},
#line 211 "accessor_class_list.gperf"
#line 210 "accessor_class_list.gperf"
{"vector", &grib_accessor_class_vector},
{""}, {""},
#line 52 "accessor_class_list.gperf"
{"data_g1second_order_general_packing", &grib_accessor_class_data_g1second_order_general_packing},
#line 84 "accessor_class_list.gperf"
{"g1_section4_length", &grib_accessor_class_g1_section4_length},
{""},
#line 52 "accessor_class_list.gperf"
{"data_g1second_order_general_packing", &grib_accessor_class_data_g1second_order_general_packing},
{""}, {""},
#line 53 "accessor_class_list.gperf"
{"data_g1second_order_row_by_row_packing", &grib_accessor_class_data_g1second_order_row_by_row_packing},
{""},
#line 24 "accessor_class_list.gperf"
{"bufr_extract_subsets", &grib_accessor_class_bufr_extract_subsets},
#line 158 "accessor_class_list.gperf"
#line 157 "accessor_class_list.gperf"
{"padtoeven", &grib_accessor_class_padtoeven},
#line 50 "accessor_class_list.gperf"
{"data_g1second_order_constant_width_packing", &grib_accessor_class_data_g1second_order_constant_width_packing},
@ -485,11 +483,11 @@ static const struct accessor_class_hash classes[] =
#line 21 "accessor_class_list.gperf"
{"bufr_elements_table", &grib_accessor_class_bufr_elements_table},
{""}, {""}, {""}, {""},
#line 153 "accessor_class_list.gperf"
#line 152 "accessor_class_list.gperf"
{"pack_bufr_values", &grib_accessor_class_pack_bufr_values},
#line 35 "accessor_class_list.gperf"
{"codetable", &grib_accessor_class_codetable},
#line 132 "accessor_class_list.gperf"
#line 131 "accessor_class_list.gperf"
{"local_definition", &grib_accessor_class_local_definition},
{""},
#line 25 "accessor_class_list.gperf"
@ -497,7 +495,7 @@ static const struct accessor_class_hash classes[] =
{""},
#line 88 "accessor_class_list.gperf"
{"g1end_of_interval_monthly", &grib_accessor_class_g1end_of_interval_monthly},
#line 147 "accessor_class_list.gperf"
#line 146 "accessor_class_list.gperf"
{"number_of_values", &grib_accessor_class_number_of_values},
{""},
#line 116 "accessor_class_list.gperf"
@ -506,23 +504,23 @@ static const struct accessor_class_hash classes[] =
#line 33 "accessor_class_list.gperf"
{"closest_date", &grib_accessor_class_closest_date},
{""}, {""},
#line 210 "accessor_class_list.gperf"
#line 209 "accessor_class_list.gperf"
{"variable", &grib_accessor_class_variable},
#line 134 "accessor_class_list.gperf"
#line 133 "accessor_class_list.gperf"
{"long_vector", &grib_accessor_class_long_vector},
#line 167 "accessor_class_list.gperf"
#line 166 "accessor_class_list.gperf"
{"scale_values", &grib_accessor_class_scale_values},
{""}, {""}, {""},
#line 129 "accessor_class_list.gperf"
#line 128 "accessor_class_list.gperf"
{"latlon_increment", &grib_accessor_class_latlon_increment},
{""}, {""}, {""},
#line 148 "accessor_class_list.gperf"
#line 147 "accessor_class_list.gperf"
{"number_of_values_data_raw_packing", &grib_accessor_class_number_of_values_data_raw_packing},
{""},
#line 79 "accessor_class_list.gperf"
{"evaluate", &grib_accessor_class_evaluate},
{""}, {""}, {""}, {""}, {""},
#line 152 "accessor_class_list.gperf"
#line 151 "accessor_class_list.gperf"
{"offset_values", &grib_accessor_class_offset_values},
#line 69 "accessor_class_list.gperf"
{"data_sh_packed", &grib_accessor_class_data_sh_packed},
@ -530,12 +528,12 @@ static const struct accessor_class_hash classes[] =
{"abstract_vector", &grib_accessor_class_abstract_vector},
#line 118 "accessor_class_list.gperf"
{"headers_only", &grib_accessor_class_headers_only},
#line 126 "accessor_class_list.gperf"
#line 125 "accessor_class_list.gperf"
{"ksec1expver", &grib_accessor_class_ksec1expver},
{""}, {""},
#line 41 "accessor_class_list.gperf"
{"count_missing", &grib_accessor_class_count_missing},
#line 204 "accessor_class_list.gperf"
#line 203 "accessor_class_list.gperf"
{"unpack_bufr_values", &grib_accessor_class_unpack_bufr_values},
{""}, {""},
#line 121 "accessor_class_list.gperf"
@ -560,7 +558,7 @@ static const struct accessor_class_hash classes[] =
#line 37 "accessor_class_list.gperf"
{"codetable_units", &grib_accessor_class_codetable_units},
{""}, {""},
#line 130 "accessor_class_list.gperf"
#line 129 "accessor_class_list.gperf"
{"latlonvalues", &grib_accessor_class_latlonvalues},
{""}, {""}, {""}, {""},
#line 30 "accessor_class_list.gperf"
@ -569,7 +567,7 @@ static const struct accessor_class_hash classes[] =
#line 31 "accessor_class_list.gperf"
{"change_scanning_direction", &grib_accessor_class_change_scanning_direction},
{""}, {""}, {""}, {""}, {""}, {""}, {""},
#line 149 "accessor_class_list.gperf"
#line 148 "accessor_class_list.gperf"
{"octahedral_gaussian", &grib_accessor_class_octahedral_gaussian},
#line 10 "accessor_class_list.gperf"
{"abstract_long_vector", &grib_accessor_class_abstract_long_vector},
@ -600,7 +598,7 @@ static const struct accessor_class_hash classes[] =
#line 87 "accessor_class_list.gperf"
{"g1day_of_the_year_date", &grib_accessor_class_g1day_of_the_year_date},
{""}, {""}, {""}, {""}, {""},
#line 164 "accessor_class_list.gperf"
#line 163 "accessor_class_list.gperf"
{"reference_value_error", &grib_accessor_class_reference_value_error},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},

View File

@ -111,7 +111,6 @@
{ "ibmfloat", &grib_accessor_class_ibmfloat, },
{ "ieeefloat", &grib_accessor_class_ieeefloat, },
{ "ifs_param", &grib_accessor_class_ifs_param, },
{ "int64_little_endian", &grib_accessor_class_int64_little_endian, },
{ "iterator", &grib_accessor_class_iterator, },
{ "julian_date", &grib_accessor_class_julian_date, },
{ "julian_day", &grib_accessor_class_julian_day, },

View File

@ -112,7 +112,6 @@ headers_only, &grib_accessor_class_headers_only
ibmfloat, &grib_accessor_class_ibmfloat
ieeefloat, &grib_accessor_class_ieeefloat
ifs_param, &grib_accessor_class_ifs_param
int64_little_endian, &grib_accessor_class_int64_little_endian
iterator, &grib_accessor_class_iterator
julian_date, &grib_accessor_class_julian_date
julian_day, &grib_accessor_class_julian_day

View File

@ -83,7 +83,6 @@ static void init_class(grib_iterator_class* c)
}
/* END_CLASS_IMP */
#define ITER "HEALPix Geoiterator"
#define RAD2DEG 57.29577951308232087684 // 180 over pi
@ -123,7 +122,7 @@ size_t HEALPix_nj(size_t N, size_t i)
// // Equator
// xstart[2*N-1] = start * (1 - (N % 2 ? 1 : 0));
// pl[2*N-1] = 4*N;
//
//
static std::vector<double> HEALPix_longitudes(size_t N, size_t i)
{
const auto Nj = HEALPix_nj(N, i);
@ -138,7 +137,7 @@ static std::vector<double> HEALPix_longitudes(size_t N, size_t i)
static int iterate_healpix(grib_iterator_healpix* self, long N)
{
size_t ny, nx, k;
size_t ny, nx;
ny = nx = 4*N - 1;
std::vector<double> latitudes(ny);
@ -160,7 +159,7 @@ static int iterate_healpix(grib_iterator_healpix* self, long N)
// Equator
latitudes[2 * N - 1] = 0.0;
k = 0;
size_t k = 0;
for (size_t i = 0; i < ny; i++) {
// Compute the longitudes at a given latitude
std::vector<double> longitudes = HEALPix_longitudes(N, i);
@ -211,7 +210,9 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
}
self->lats = (double*)grib_context_malloc(h->context, iter->nv * sizeof(double));
if (self->lats == NULL) return GRIB_OUT_OF_MEMORY;
self->lons = (double*)grib_context_malloc(h->context, iter->nv * sizeof(double));
if (self->lons == NULL) return GRIB_OUT_OF_MEMORY;
try {
err = iterate_healpix(self, N);

View File

@ -87,6 +87,7 @@ if( HAVE_BUILD_TOOLS )
bufr_check_descriptors
definitions
grib2_version
grib_accessors
grib_calendar
grib_md5
grib_cfNames

View File

@ -34,6 +34,7 @@ int main(int argc, char* argv[])
char* filename = NULL;
FILE* fin = NULL;
int is_coord = 0;
int is_header = 0;
assert (argc == 2);
filename = argv[1];
@ -78,6 +79,10 @@ int main(int argc, char* argv[])
is_coord = codes_bufr_key_is_coordinate(h, "nosuchkey", &err);
assert(err == CODES_NOT_FOUND);
assert(is_coord == 0);
is_header = codes_bufr_key_is_header(h, "nosuchkey", &err);
assert(err == CODES_NOT_FOUND);
assert(is_header == 0);
codes_bufr_keys_iterator_delete(kiter);
codes_handle_delete(h);

View File

@ -35,8 +35,7 @@ done
# Template 4.86
# -------------
# TODO: Add tablesVersion later...
$tools_dir/grib_set -s productDefinitionTemplateNumber=86,totalNumberOfQuantiles=2 $sample2 $temp
$tools_dir/grib_set -s tablesVersion=31,productDefinitionTemplateNumber=86,totalNumberOfQuantiles=2 $sample2 $temp
grib_check_key_equals $temp totalNumberOfQuantiles,quantileValue '2 0'
@ -148,6 +147,33 @@ grib_check_key_equals $temp perturbationNumber,typeOfStatisticalProcessing '2000
$tools_dir/grib_dump -O -p section_4 $temp > $tempText
grep -q "Individual member for large ensemble forecast.*continuous or non-continuous interval" $tempText
# stepType & PDTNs
# --------------------
test_PDTN_conversions()
{
# Arguments
# $1 = product def template for instantaneous
# $2 = product def template for interval-based
pdtn_instant=$1
pdtn_interval=$2
$tools_dir/grib_set -s productDefinitionTemplateNumber=$pdtn_instant,stepType=accum $sample2 $temp
grib_check_key_equals $temp productDefinitionTemplateNumber $pdtn_interval
$tools_dir/grib_set -s stepType=instant $temp $temp1
grib_check_key_equals $temp1 productDefinitionTemplateNumber $pdtn_instant
}
test_PDTN_conversions 2 12
test_PDTN_conversions 3 13
test_PDTN_conversions 4 14
test_PDTN_conversions 5 9
test_PDTN_conversions 6 10
test_PDTN_conversions 40 42
test_PDTN_conversions 41 43
# test_PDTN_conversions 45 85 # TODO
test_PDTN_conversions 57 67
test_PDTN_conversions 58 68
test_PDTN_conversions 71 73
# Clean up
rm -f $temp $temp1 $temp2 $tempFilt $tempText

61
tests/grib_accessors.sh Executable file
View File

@ -0,0 +1,61 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
. ./include.ctest.sh
label="grib_accessors_test"
tempText=temp.$label.txt
if [ $ECCODES_ON_WINDOWS -eq 1 ]; then
echo "$0: This test is currently disabled on Windows"
exit 0
fi
# Accessors like uint16, uint32 etc
# ----------------------------------
tempDir=${label}.temp.dir
rm -rf $tempDir
mkdir -p $tempDir/definitions/grib2
bootfile=$tempDir/definitions/grib2/boot.def
cat $def_dir/grib2/boot.def > $bootfile
echo "uint16 key_uint16: transient;" >> $bootfile
echo "uint32 key_uint32: transient;" >> $bootfile
echo "uint32_little_endian key_uint32_le: transient;" >> $bootfile
echo "uint64 key_uint64: transient;" >> $bootfile
echo "uint64_little_endian key_uint64_le: transient;" >> $bootfile
echo "key_tos1 = to_string(kindOfProduct,0,1);" >> $bootfile
echo "key_tos2 = to_string(dataDate,0,3);" >> $bootfile
echo >> $bootfile
curr_defs=$ECCODES_DEFINITION_PATH
export ECCODES_DEFINITION_PATH=$PWD/$tempDir/definitions:$curr_defs
input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
set +e
# Not yet fully implemented
${tools_dir}/grib_get -p key_uint16 $input > $tempText 2>&1
${tools_dir}/grib_get -p key_uint32 $input >> $tempText 2>&1
${tools_dir}/grib_get -p key_uint32_le $input >> $tempText 2>&1
set -e
# TODO
# grib_check_key_equals $input 'key_uint64,key_uint64_le' '0 0'
# kindOfProduct = GRIB, dataDate = 20070323
grib_check_key_equals $input 'key_tos1,key_tos2' 'G 200'
grib_check_key_equals $input 'key_tos2:d,key_tos2:i' '200 200'
rm -rf $tempDir
# Clean up
rm -f $tempText

View File

@ -214,6 +214,15 @@ switch (packingType) {
EOF
${tools_dir}/grib_filter $tempFilt $data_dir/sample.grib2 ${data_dir}/ccsds.grib2 $data_dir/spherical_model_level.grib2
cat >$tempFilt <<EOF
switch (length(packingType)) {
# Expression 'length' evaluated as a string. Length of grid_simple is 11
case "11": print "ok";
default: print "[file]: bad length?"; assert(0);
}
EOF
${tools_dir}/grib_filter $tempFilt $data_dir/sample.grib2
echo "Test MISSING"
# -----------------
input="${data_dir}/reduced_gaussian_pressure_level.grib2"
@ -362,6 +371,14 @@ set -e
[ $status -ne 0 ]
grep "Assertion failure" $tempOut
# Use of the "length" expression
cat >$tempFilt <<EOF
assert( length(identifier) == 4 );
if (length(edition) == referenceValue) { print "matched"; }
EOF
${tools_dir}/grib_filter $tempFilt $ECCODES_SAMPLES_PATH/GRIB2.tmpl #> $tempOut
# Clean up
rm -f $tempGrib $tempFilt $tempOut $tempRef
rm -f ${data_dir}/formatint.rules ${data_dir}/binop.rules

View File

@ -12,20 +12,19 @@
label="grib_get_fail_test"
tempText=temp.$label.txt
REDIRECT=/dev/null
# Check input file has been downloaded
[ -f ${data_dir}/regular_latlon_surface.grib1 ]
# Expect failure as the key does not exist
set +e
${tools_dir}/grib_get -p boomerang ${data_dir}/regular_latlon_surface.grib1 2> $REDIRECT > $REDIRECT
if [ $? -eq 0 ] ; then
exit 1; # Should not have succeeded
fi
${tools_dir}/grib_get -p boomerang ${data_dir}/regular_latlon_surface.grib1
status=$?
set -e
[ $status -ne 0 ]
# ECC-1551: Print which key does not exist
# -----------------------------------------
set +e
${tools_dir}/grib_get -p Ni,Nh,Nj $ECCODES_SAMPLES_PATH/GRIB2.tmpl > $tempText 2>&1
status=$?
@ -33,4 +32,5 @@ set -e
[ $status -ne 0 ]
grep -q "Nh (Key/value not found)" $tempText
# Clean up
rm -f $tempText

View File

@ -183,6 +183,24 @@ ${tools_dir}/grib_set -s scaleValuesBy=1.1 boustrophedonic.grib1 $temp1
unset ECCODES_GRIBEX_BOUSTROPHEDONIC
# data_g1second_order_constant_width_packing
# ------------------------------------------
input=second_ord_rbr.grib1
${tools_dir}/grib_set -s Ni=2,Nj=74,secondOrderOfDifferentWidth=0,secondaryBitmapPresent=1 $input $temp1
grib_check_key_equals $temp1 packingType grid_second_order_constant_width
${tools_dir}/grib_dump -O $temp1 > $REDIRECT
set +e
${tools_dir}/grib_set -s scaleValuesBy=2 $temp1 $temp2 > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "Not implemented" $tempText
${tools_dir}/grib_get_data $temp1 > $REDIRECT
${tools_dir}/grib_ls -l46,1 $temp1 > $REDIRECT
${tools_dir}/grib_ls -j -l46,1,1 $temp1 > $REDIRECT
# Clean up
rm -f $temp_stat1 $temp_stat2
rm -f $temp1 $temp2 $temp3 $sec_ord_bmp

View File

@ -208,6 +208,22 @@ count=`${tools_dir}/grib_count $outfile`
[ $count -eq 1 ]
grib_check_key_equals $outfile shortName '2t'
# Key with no_fail flag
# ------------------------
input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
grib_check_key_equals $input 'typeOfProcessedData:i' '2'
${tools_dir}/grib_set -s typeOfProcessedData=rubbish $input $outfile
grib_check_key_equals $outfile 'typeOfProcessedData:i' '255' # set to default
# Codetable mismatch
# ------------------------
input=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
set +e
${tools_dir}/grib_set -s stepUnits=d $input $outfile > $temp 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "stepUnits: No such code table entry.*Did you mean" $temp
# ------------------------
# Unreadable message