Merge branch 'develop' into feature/ECC-1620_sub-hourly

This commit is contained in:
Eugen Betke 2023-12-06 10:41:43 +00:00
commit 394ba554c4
14 changed files with 73 additions and 39 deletions

View File

@ -2,6 +2,8 @@
# DWD local grid definition 192 - triangular grid base on icosahedron subdivision
constant isGridded = true;
# n2 - exponent of 2 for the number of intervals on main triangle sides
unsigned[2] n2 : dump ;

View File

@ -1134,3 +1134,11 @@ int codes_bufr_key_is_coordinate(const grib_handle* h, const char* key, int* err
*err = GRIB_SUCCESS;
return ((acc->flags & GRIB_ACCESSOR_FLAG_BUFR_COORD) != 0);
}
int codes_bufr_key_exclude_from_dump(const char* key)
{
if (strstr(key, "percentConfidence->percentConfidence->percentConfidence->percentConfidence->percentConfidence")) {
return 1;
}
return 0;
}

View File

@ -1385,6 +1385,7 @@ int codes_bufr_extract_headers_malloc(grib_context* c, const char* filename, cod
int codes_bufr_header_get_string(codes_bufr_header* bh, const char* key, char* val, size_t* len);
int codes_bufr_key_is_header(const grib_handle* h, const char* key, int* err);
int codes_bufr_key_is_coordinate(const grib_handle* h, const char* key, int* err);
int codes_bufr_key_exclude_from_dump(const char* key);
/* string_util.cc*/
int strcmp_nocase(const char* s1, const char* s2);

View File

@ -326,11 +326,13 @@ static void dump_long(grib_dumper* d, grib_accessor* a, const char* comment)
}
else {
r = compute_bufr_key_rank(h, self->keys, a->name);
if (!grib_is_missing_long(a, value)) {
if (r != 0)
fprintf(self->dumper.out, " CODES_CHECK(codes_get_long(h, \"#%d#%s\", &iVal), 0);\n", r, a->name);
else
fprintf(self->dumper.out, " CODES_CHECK(codes_get_long(h, \"%s\", &iVal), 0);\n", a->name);
if (!codes_bufr_key_exclude_from_dump(a->name)) {
if (!grib_is_missing_long(a, value)) {
if (r != 0)
fprintf(self->dumper.out, " CODES_CHECK(codes_get_long(h, \"#%d#%s\", &iVal), 0);\n", r, a->name);
else
fprintf(self->dumper.out, " CODES_CHECK(codes_get_long(h, \"%s\", &iVal), 0);\n", a->name);
}
}
}
@ -388,8 +390,10 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
}
else {
/* int r=compute_bufr_key_rank(h,self->keys,a->name); */
if (!grib_is_missing_long(a, value)) {
fprintf(self->dumper.out, " CODES_CHECK(codes_get_long(h, \"%s->%s\", &iVal), 0);\n", prefix, a->name);
if (!codes_bufr_key_exclude_from_dump(prefix)) {
if (!grib_is_missing_long(a, value)) {
fprintf(self->dumper.out, " CODES_CHECK(codes_get_long(h, \"%s->%s\", &iVal), 0);\n", prefix, a->name);
}
}
}

View File

@ -322,8 +322,9 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
return;
self->empty = 0;
fprintf(self->dumper.out, "print \"%s->%s = [%s->%s]\";\n", prefix, a->name, prefix, a->name);
if (!codes_bufr_key_exclude_from_dump(prefix)) {
fprintf(self->dumper.out, "print \"%s->%s = [%s->%s]\";\n", prefix, a->name, prefix, a->name);
}
if (self->isLeaf == 0) {
char* prefix1 = (char*)grib_context_malloc_clear(c, sizeof(char) * (strlen(a->name) + strlen(prefix) + 5));
snprintf(prefix1, 1024, "%s->%s", prefix, a->name);

View File

@ -347,8 +347,10 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
fprintf(self->dumper.out, " call codes_get(ibufr, '%s->%s', iValues)\n", prefix, a->name);
}
else {
if (!grib_is_missing_long(a, value)) {
fprintf(self->dumper.out, " call codes_get(ibufr, '%s->%s', iVal)\n", prefix, a->name);
if (!codes_bufr_key_exclude_from_dump(prefix)) {
if (!grib_is_missing_long(a, value)) {
fprintf(self->dumper.out, " call codes_get(ibufr, '%s->%s', iVal)\n", prefix, a->name);
}
}
}

View File

@ -359,8 +359,10 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
fprintf(self->dumper.out, " iVals = codes_get_array(ibufr, '%s->%s')\n", prefix, a->name);
}
else {
if (!grib_is_missing_long(a, value)) {
fprintf(self->dumper.out, " iVal = codes_get(ibufr, '%s->%s')\n", prefix, a->name);
if (!codes_bufr_key_exclude_from_dump(prefix)) {
if (!grib_is_missing_long(a, value)) {
fprintf(self->dumper.out, " iVal = codes_get(ibufr, '%s->%s')\n", prefix, a->name);
}
}
}

View File

@ -524,10 +524,12 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
fprintf(self->dumper.out, " CODES_CHECK(codes_set_long_array(h, \"%s->%s\", ivalues, size), 0);\n", prefix, a->name);
}
else {
char* sval = lval_to_string(c, value);
fprintf(self->dumper.out, " CODES_CHECK(codes_set_long(h, \"%s->%s\", ", prefix, a->name);
fprintf(self->dumper.out, "%s), 0);\n", sval);
grib_context_free(c, sval);
if (!codes_bufr_key_exclude_from_dump(prefix)) {
char* sval = lval_to_string(c, value);
fprintf(self->dumper.out, " CODES_CHECK(codes_set_long(h, \"%s->%s\", ", prefix, a->name);
fprintf(self->dumper.out, "%s), 0);\n", sval);
grib_context_free(c, sval);
}
}
if (self->isLeaf == 0) {

View File

@ -451,9 +451,11 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
}
else {
/* int r=compute_bufr_key_rank(h,self->keys,a->name); */
if (!grib_is_missing_long(a, value)) {
fprintf(self->dumper.out, "set %s->%s = ", prefix, a->name);
fprintf(self->dumper.out, "%ld ;\n", value);
if (!codes_bufr_key_exclude_from_dump(prefix)) {
if (!grib_is_missing_long(a, value)) {
fprintf(self->dumper.out, "set %s->%s = ", prefix, a->name);
fprintf(self->dumper.out, "%ld ;\n", value);
}
}
}

View File

@ -573,10 +573,12 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
fprintf(self->dumper.out, " call codes_set(ibufr,'%s->%s' &\n,ivalues)\n", pref, a->name);
}
else {
char* sval = lval_to_string(c, value);
fprintf(self->dumper.out, " call codes_set(ibufr,'%s->%s'&\n,", pref, a->name);
fprintf(self->dumper.out, "%s)\n", sval);
grib_context_free(c, sval);
if (!codes_bufr_key_exclude_from_dump(prefix)) {
char* sval = lval_to_string(c, value);
fprintf(self->dumper.out, " call codes_set(ibufr,'%s->%s'&\n,", pref, a->name);
fprintf(self->dumper.out, "%s)\n", sval);
grib_context_free(c, sval);
}
}
if (self->isLeaf == 0) {

View File

@ -519,10 +519,12 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
fprintf(self->dumper.out, " codes_set_array(ibufr, '%s->%s', ivalues)\n", prefix, a->name);
}
else {
char* sval = lval_to_string(c, value);
fprintf(self->dumper.out, " codes_set(ibufr, '%s->%s', ", prefix, a->name);
fprintf(self->dumper.out, "%s)\n", sval);
grib_context_free(c, sval);
if (!codes_bufr_key_exclude_from_dump(prefix)) {
char* sval = lval_to_string(c, value);
fprintf(self->dumper.out, " codes_set(ibufr, '%s->%s', ", prefix, a->name);
fprintf(self->dumper.out, "%s)\n", sval);
grib_context_free(c, sval);
}
}
if (self->isLeaf == 0) {

View File

@ -466,19 +466,19 @@ static void dump_long_attribute(grib_dumper* d, grib_accessor* a, const char* pr
}
else {
/* int r=compute_bufr_key_rank(h,self->keys,a->name); */
if (!grib_is_missing_long(a, value)) {
fprintf(self->dumper.out, "%s->%s = ", prefix, a->name);
fprintf(self->dumper.out, "%ld\n", value);
}
else {
fprintf(self->dumper.out, "%s->%s = MISSING\n", prefix, a->name);
if (!codes_bufr_key_exclude_from_dump(prefix)) {
if (!grib_is_missing_long(a, value)) {
fprintf(self->dumper.out, "%s->%s = ", prefix, a->name);
fprintf(self->dumper.out, "%ld\n", value);
}
else {
fprintf(self->dumper.out, "%s->%s = MISSING\n", prefix, a->name);
}
}
}
if (self->isLeaf == 0) {
char* prefix1;
prefix1 = (char*)grib_context_malloc_clear(c, sizeof(char) * (strlen(a->name) + strlen(prefix) + 5));
char* prefix1 = (char*)grib_context_malloc_clear(c, sizeof(char) * (strlen(a->name) + strlen(prefix) + 5));
snprintf(prefix1, 1024, "%s->%s", prefix, a->name);
dump_attributes(d, a, prefix1);

View File

@ -40,7 +40,13 @@ ${tools_dir}/grib_ls -l 0,0,1 $infile >> $tempLog
${tools_dir}/grib_get -l 0,0,1 $infile >> $tempLog
${tools_dir}/grib_get -p count,step $infile >> $tempLog
${tools_dir}/grib_get -P count $infile >> $tempLog
${tools_dir}/grib_get -i 0 $infile
# ECC-786 and ECC-791
result=$( ${tools_dir}/grib_get -p shortName -i 0 $infile )
[ "$result" = "t 199.078 " ]
result=$( ${tools_dir}/grib_get -i 8191 $infile )
[ "$result" = "160.852 " ]
files=" reduced_gaussian_lsm.grib1
reduced_gaussian_model_level.grib1

View File

@ -1285,7 +1285,7 @@ void grib_print_key_values(grib_runtime_options* options, grib_handle* h)
snprintf(value, 32, options->format, v);
strlenvalue = (int)strlen(value);
width = strlenvalue < options->default_print_width ? options->default_print_width + 2 : strlenvalue + 2;
fprintf(dump_file, "%-*s", (int)width, value);
fprintf(dump_file, "%s%-*s", (written_to_dump?" ":""), (int)width, value);
written_to_dump = 1;
}
if (written_to_dump) {