Merge develop

This commit is contained in:
Shahram Najm 2019-11-15 10:26:34 +00:00
commit f15be4cb23
15 changed files with 7769 additions and 7734 deletions

View File

@ -20,7 +20,7 @@ unsigned[1] localTablesVersionNumber : dump;
transient typicalCentury=21;
unsigned[1] typicalYearOfCentury : dump;
transient typicalYear = (typicalCentury - 1 ) *100 + typicalYearOfCentury : no_copy;
transient typicalYear = (typicalCentury - 1) * 100 + typicalYearOfCentury : no_copy;
unsigned[1] typicalMonth : dump;
unsigned[1] typicalDay : dump;

View File

@ -1,13 +1,13 @@
# Copyright 2005-2019 ECMWF.
section_length[3] section2Length ;
unsigned[1] reservedSection2 = 0;
section_length[3] section2Length;
unsigned[1] reservedSection2 = 0;
if(bufrHeaderCentre == 98) {
if (section2Length==52 or new() ) {
template rdb_key "bufr/rdb_key.def";
}
if (section2Length==28) {
template rdb_key "bufr/rdb_key_28.def";
}
template rdb_key "bufr/rdb_key.def";
}
if (section2Length==28) {
template rdb_key "bufr/rdb_key_28.def";
}
}
section_padding section2Padding;

View File

@ -1574,7 +1574,7 @@
033070|totalOzoneQuality|table|TOTAL OZONE QUALITY|CODE TABLE|0|0|4|CODE TABLE|0|2
033071|profileOzoneQuality|table|PROFILE OZONE QUALITY|CODE TABLE|0|0|4|CODE TABLE|0|2
033072|ozoneError|table|OZONE ERROR|CODE TABLE|0|0|5|CODE TABLE|0|2
033075|scanLevelQualityFlags|flag|SCAN-LEVEL QUALITY FLAGS|FLAG TABLE|0|0|13|FLAG TABLE|0|5
033075|scanLevelDataValidityQualityFlags|flag|SCAN-LEVEL QUALITY FLAGS|FLAG TABLE|0|0|13|FLAG TABLE|0|5
033076|calibrationQualityFlags|flag|CALIBRATION QUALITY FLAGS|FLAG TABLE|0|0|9|FLAG TABLE|0|3
033077|fieldOfViewQualityFlags|flag|FIELD-OF-VIEW QUALITY FLAGS|FLAG TABLE|0|0|19|FLAG TABLE|0|7
033078|geolocationQuality|table|GEOLOCATION QUALITY|CODE TABLE|0|0|4|CODE TABLE|0|2

View File

@ -1,6 +1,5 @@
# START grib1::section
# SECTION 4, Binary data section
# Length of section
# GRIB1 SECTION 4, Binary data section
# Length of section
position offsetSection4;
# Due to a trick done by GRIBEX to support large GRIBs, we need a special treatment
@ -125,9 +124,8 @@ alias ls.packingType=packingType;
alias typeOfPacking=packingType;
if( binaryScaleFactor == -32767) {
unsigned[1] bitsPerValue : dump ;
alias numberOfBitsContainingEachPackedValue = bitsPerValue;
unsigned[1] bitsPerValue : dump ;
alias numberOfBitsContainingEachPackedValue = bitsPerValue;
constant dataRepresentationTemplateNumber = 0;
constant bitMapIndicator = 0;
@ -148,8 +146,8 @@ alias numberOfBitsContainingEachPackedValue = bitsPerValue;
decimalScaleFactor,
optimizeScaleFactor,
halfByte,
packingType,
grid_ieee,precision,
packingType,
grid_ieee,precision,
missingValue,
numberOfPoints,
bitmap
@ -169,7 +167,7 @@ if (bitmapPresent==1) {
}
_if (sphericalHarmonics) {
alias numberOfEffectiveValues=numberOfValues;
alias numberOfEffectiveValues=numberOfValues;
}
meta changeDecimalPrecision decimal_precision(bitsPerValue,decimalScaleFactor,changingPrecision,values) : edition_specific;
@ -220,7 +218,6 @@ concept gridType {
"regular_stretched_gg" = { dataRepresentationType = 24; sphericalHarmonics = 0; PLPresent=0; } # = stretched_gg
"regular_stretched_rotated_gg" = { dataRepresentationType = 34; sphericalHarmonics = 0; PLPresent=0; } # = stretched_rotated_gg
"sh" = {dataRepresentationType = 50; sphericalHarmonics = 1; PLPresent=0; }
"rotated_sh" = {dataRepresentationType = 60; sphericalHarmonics = 1; PLPresent=0; }
"stretched_sh" = {dataRepresentationType = 70; sphericalHarmonics = 1; PLPresent=0; }
@ -237,7 +234,7 @@ alias typeOfGrid=gridType;
meta getNumberOfValues size(values) : edition_specific,dump ;
if (complexPacking==0 || sphericalHarmonics==1) {
padtoeven padding_sec4_1(offsetSection4,section4Length) ;
padtoeven padding_sec4_1(offsetSection4,section4Length) ;
}
meta md5Section4 md5(offsetSection4,section4Length);

View File

@ -1,7 +1,7 @@
# CARRA/CERRA suite names
0 unknown Unknown
1 enmi-haro-cae HARMONIE-AROME reanalysis by MetNorway on CARRA-East domain (CARRA project)
2 enmi-haro-caw HARMONIE-AROME reanalysis by MetNorway on CARRA-West domain (CARRA project)
3 enmi-haro-par HARMONIE-AROME reanalysis by MetNorway on Pan-Arctic domain (CARRA project)
4 eswi-hald-ecx HARMONIE-ALADIN reanalysis by SMHI on EURO-CORDEX domain (CERRA project)
5 lfpw-mesu-ecx MESCAN-SURFEX surface reanalysis by Meteo-France on EURO-CORDEX domain (CERRA project)
1 no-ar-ce HARMONIE-AROME reanalysis by MetNorway on CARRA-East domain (CARRA project)
2 no-ar-cw HARMONIE-AROME reanalysis by MetNorway on CARRA-West domain (CARRA project)
3 no-ar-pa HARMONIE-AROME reanalysis by MetNorway on Pan-Arctic domain (CARRA project)
4 se-al-ec HARMONIE-ALADIN reanalysis by SMHI on EURO-CORDEX domain (CERRA project)
5 fr-ms-ec MESCAN-SURFEX surface reanalysis by Meteo-France on EURO-CORDEX domain (CERRA project)

View File

@ -39,13 +39,11 @@ alias mars.param = paramId;
alias mars.origin = centre;
if (section2Used == 1) {
constant marsLamModel = 'lam';
alias mars.model = marsLamModel; # model redefined. It is not 'glob'
alias mars.origin = crraSuiteID; # origin is the suiteName
unalias mars.domain; # No mars domain needed
alias mars.origin = crraSuiteID; # origin is the suiteName
unalias mars.domain;
unalias mars.model;
}
# See GRIB-911 re typeOfProcessedData values in UERRA
concept marsType {

View File

@ -313,6 +313,8 @@ static int bufr_decode_edition3(const void* message, codes_bufr_header* hdr)
long nbits_localTablesVersionNumber = 1*8;
long pos_localTablesVersionNumber = 19*8;
const long typicalCentury = 21; /* This century */
long typicalYearOfCentury = 0;
long nbits_typicalYearOfCentury = 1*8;
long pos_typicalYearOfCentury = 20*8;
@ -353,11 +355,15 @@ static int bufr_decode_edition3(const void* message, codes_bufr_header* hdr)
hdr->masterTablesVersionNumber = (long)grib_decode_unsigned_long(
message, &pos_masterTablesVersionNumber, nbits_masterTablesVersionNumber);
hdr->localTablesVersionNumber = (long)grib_decode_unsigned_long(message, &pos_localTablesVersionNumber, nbits_localTablesVersionNumber);
hdr->typicalYearOfCentury = (long)grib_decode_unsigned_long(message, &pos_typicalYearOfCentury, nbits_typicalYearOfCentury);
typicalYearOfCentury = (long)grib_decode_unsigned_long(message, &pos_typicalYearOfCentury, nbits_typicalYearOfCentury);
hdr->typicalYear = (typicalCentury - 1) * 100 + typicalYearOfCentury;
hdr->typicalMonth = (long)grib_decode_unsigned_long(message, &pos_typicalMonth, nbits_typicalMonth);
hdr->typicalDay = (long)grib_decode_unsigned_long(message, &pos_typicalDay, nbits_typicalDay);
hdr->typicalHour = (long)grib_decode_unsigned_long(message, &pos_typicalHour, nbits_typicalHour);
hdr->typicalMinute = (long)grib_decode_unsigned_long(message, &pos_typicalMinute, nbits_typicalMinute);
hdr->typicalSecond = 0;
hdr->typicalDate = hdr->typicalYear * 10000 + hdr->typicalMonth * 100 + hdr->typicalDay;
hdr->typicalTime = hdr->typicalHour * 10000 + hdr->typicalMinute * 100 + hdr->typicalSecond;
offset_section2 = BUFR_SECTION0_LEN + section1Length; /*bytes*/
section2Length = 0;
@ -434,6 +440,7 @@ static int bufr_decode_edition4(const void* message, codes_bufr_header* hdr)
long nbits_localTablesVersionNumber = 1*8;
long pos_localTablesVersionNumber = 22*8;
long typicalYear2 = 0; /* corrected */
long nbits_typicalYear = 2*8;
long pos_typicalYear = 23*8;
@ -477,12 +484,16 @@ static int bufr_decode_edition4(const void* message, codes_bufr_header* hdr)
hdr->dataSubCategory = (long)grib_decode_unsigned_long(message, &pos_dataSubCategory, nbits_dataSubCategory);
hdr->masterTablesVersionNumber = (long)grib_decode_unsigned_long(message, &pos_masterTablesVersionNumber, nbits_masterTablesVersionNumber);
hdr->localTablesVersionNumber = (long)grib_decode_unsigned_long(message, &pos_localTablesVersionNumber, nbits_localTablesVersionNumber);
hdr->typicalYear = (long)grib_decode_unsigned_long(message, &pos_typicalYear, nbits_typicalYear);
typicalYear2 = hdr->typicalYear < 100 ? 2000 + hdr->typicalYear : hdr->typicalYear; /*ECC-556*/
hdr->typicalMonth = (long)grib_decode_unsigned_long(message, &pos_typicalMonth, nbits_typicalMonth);
hdr->typicalDay = (long)grib_decode_unsigned_long(message, &pos_typicalDay, nbits_typicalDay);
hdr->typicalHour = (long)grib_decode_unsigned_long(message, &pos_typicalHour, nbits_typicalHour);
hdr->typicalMinute = (long)grib_decode_unsigned_long(message, &pos_typicalMinute, nbits_typicalMinute);
hdr->typicalSecond = (long)grib_decode_unsigned_long(message, &pos_typicalSecond, nbits_typicalSecond);
hdr->typicalDate = typicalYear2 * 10000 + hdr->typicalMonth * 100 + hdr->typicalDay;
hdr->typicalTime = hdr->typicalHour * 10000 + hdr->typicalMinute * 100 + hdr->typicalSecond;
offset_section2 = BUFR_SECTION0_LEN + section1Length; /*bytes*/
section2Length = 0;

View File

@ -142,9 +142,8 @@ static void dump(grib_accessor* a, grib_dumper* dumper)
grib_dump_long(dumper,a,NULL);
}
static int unpack_long (grib_accessor* a, long* val, size_t *len)
static int unpack_long(grib_accessor* a, long* val, size_t *len)
{
unsigned char dat = 0;
if(*len < 1)
{
@ -154,13 +153,12 @@ static int unpack_long (grib_accessor* a, long* val, size_t *len)
}
dat = grib_handle_of_accessor(a)->buffer->data[a->offset] & 0x0f;
*val = dat;
*len = 1;
return GRIB_SUCCESS;
}
static int pack_long (grib_accessor* a, const long *val, size_t *len)
static int pack_long(grib_accessor* a, const long *val, size_t *len)
{
int ret = 0;
if(*len < 1)
@ -207,4 +205,3 @@ static int compare(grib_accessor* a,grib_accessor* b) {
if (bval != aval) return GRIB_VALUE_MISMATCH;
return GRIB_SUCCESS;
}

View File

@ -1577,16 +1577,17 @@ typedef struct codes_bufr_header {
long dataSubCategory;
long masterTablesVersionNumber;
long localTablesVersionNumber;
long typicalYearOfCentury;
long typicalYear;
long typicalMonth;
long typicalDay;
long typicalHour;
long typicalMinute;
/* Section 1 keys: BUFR4-specific */
long internationalDataSubCategory;
long typicalYear;
long typicalSecond;
long typicalDate; // computed key
long typicalTime; // computed key
long internationalDataSubCategory; /*BUFR4-specific*/
long ecmwfLocalSectionPresent;

File diff suppressed because it is too large Load Diff

View File

@ -70,13 +70,16 @@ int main(int argc, char* argv[])
if (strstr(keys, "dataSubCategory")) printf("%ld ", bh.dataSubCategory);
if (strstr(keys, "masterTablesVersionNumber")) printf("%ld ", bh.masterTablesVersionNumber);
if (strstr(keys, "localTablesVersionNumber")) printf("%ld ", bh.localTablesVersionNumber);
if (strstr(keys, "typicalYearOfCentury")) printf("%ld ", bh.typicalYearOfCentury);
if (strstr(keys, "typicalYear")) printf("%ld ", bh.typicalYear);
if (strstr(keys, "typicalMonth")) printf("%ld ", bh.typicalMonth);
if (strstr(keys, "typicalDay")) printf("%ld ", bh.typicalDay);
if (strstr(keys, "typicalHour")) printf("%ld ", bh.typicalHour);
if (strstr(keys, "typicalMinute")) printf("%ld ", bh.typicalMinute);
if (strstr(keys, "typicalDate")) printf("%ld ", bh.typicalDate);
if (strstr(keys, "typicalTime")) printf("%ld ", bh.typicalTime);
if (strstr(keys, "internationalDataSubCategory")) printf("%ld ", bh.internationalDataSubCategory);
if (strstr(keys, "typicalYear")) printf("%ld ", bh.typicalYear);
if (strstr(keys, "typicalSecond")) printf("%ld ", bh.typicalSecond);
if (strstr(keys, "localSectionPresent")) printf("%ld ", bh.ecmwfLocalSectionPresent);

View File

@ -30,6 +30,8 @@ latest_wmo_version=`${tools_dir}/bufr_get -p masterTablesVersionNumberLatest $sa
# In version 29, some key names changed. So blacklist them
blacklist=$blacklist",bandwidthCorrectionCoefficient1ForAtovs,bandwidthCorrectionCoefficient2ForAtovs,tovsOrAtovsProductQualifier"
# In version 33, we changed scanLevelQualityFlags
blacklist=$blacklist",scanLevelQualityFlags"
# The units for centre also changed
blacklist=$blacklist",centre,subCentre,generatingApplication"

3482
tests/keys

File diff suppressed because it is too large Load Diff

View File

@ -929,30 +929,6 @@ s2s/ammc: warning: s2s.mx2t6_20151224_26.grib2, field 47 [surface_air_maximum_te
{&point_in_time, &given_thickness, &has_bitmap},
},
{
"maximum_wind_gust.glob",
0,
10,
0,
100,
{
{"model", GRIB_TYPE_STRING, 0, "glob"},
{"discipline", GRIB_TYPE_LONG, 0},
{"parameterCategory", GRIB_TYPE_LONG, 2},
{"parameterNumber", GRIB_TYPE_LONG, 22},
{"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 2},
{"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103},
{"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0},
{"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 10},
/* {"typeOfSecondFixedSurface", GRIB_TYPE_LONG, 255}, */
{NULL, },
},
{&three_hourly, &given_level},
},
/*
cosmoleps-arpasimc-eu 20140323, 12UTC, prod: tigge_lam.vmax_10m.9999.grib2, field 11 [maximum_wind_gust.lam]: maximum_wind_gust.lam maximum value 106.861 is not in [0,100]
@ -995,7 +971,7 @@ s2s/ammc: warning: s2s.mx2t6_20151224_26.grib2, field 47 [surface_air_maximum_te
*/
{
"maximum_wind_gust.lam",
"maximum_wind_gust.lam.mogreps",
0,
20,
0,
@ -2918,19 +2894,22 @@ uerra/egrr (something like ad hoc 1 grid-point issue (similarly grid-point storm
{&point_in_time, &given_level},
},
{
"10_metre_wind_gust",
"10_metre_wind_gust_since_pp",
0.001,
10,
10,
150,
{
{"paramId", GRIB_TYPE_LONG, 49},
{"discipline", GRIB_TYPE_LONG, 0},
{"parameterCategory", GRIB_TYPE_LONG, 2},
{"parameterNumber", GRIB_TYPE_LONG, 22},
{"typeOfFirstFixedSurface", GRIB_TYPE_LONG, 103},
{"scaleFactorOfFirstFixedSurface", GRIB_TYPE_LONG, 0},
{"scaledValueOfFirstFixedSurface", GRIB_TYPE_LONG, 10},
{"typeOfStatisticalProcessing", GRIB_TYPE_LONG, 2},
{NULL, },
},
@ -3893,7 +3872,7 @@ uerra, eswi-enfo:total_cloud_cover_sfc maximum value 96.4844 is not in [100,100]
{NULL, },
},
{&daily_average, &given_level, &has_bitmap},
{&daily_average, &predefined_level, &has_bitmap},
},
{
"northward_sea_water_velocity_o2d.s2",
@ -3913,7 +3892,7 @@ uerra, eswi-enfo:total_cloud_cover_sfc maximum value 96.4844 is not in [100,100]
{NULL, },
},
{&daily_average, &given_level, &has_bitmap},
{&daily_average, &predefined_level, &has_bitmap},
},
{
"sea-ice_thickness_o2d.s2",

View File

@ -9,7 +9,9 @@
*/
#include "grib_api_internal.h"
static int fail_on_error = 1;
static const char* tool_name = NULL;
static void usage(const char* prog)
{
@ -64,6 +66,18 @@ static int count_messages(FILE* in, int message_type, unsigned long *count)
return err;
}
static int is_a_directory(const char* filename)
{
struct stat s;
int stat_val = stat(filename, &s);
if ( stat_val == 0 ) {
if (S_ISDIR(s.st_mode)) {
return 1;
}
}
return 0;
}
int main(int argc,char* argv[])
{
FILE* infh = NULL;
@ -73,11 +87,12 @@ int main(int argc,char* argv[])
unsigned long count_total=0, count_curr=0;
int message_type = 0; /* GRIB, BUFR etc */
if (argc <2) usage(argv[0]);
if (strstr(argv[0], "grib_count")) message_type = CODES_GRIB;
if (strstr(argv[0], "bufr_count")) message_type = CODES_BUFR;
if (strstr(argv[0], "gts_count")) message_type = CODES_GTS;
tool_name = argv[0];
if (argc <2) usage(tool_name);
if (strstr(tool_name, "grib_count")) message_type = CODES_GRIB;
if (strstr(tool_name, "bufr_count")) message_type = CODES_BUFR;
if (strstr(tool_name, "gts_count")) message_type = CODES_GTS;
count_total=0;
for (i=1;i<argc;i++) {
@ -90,6 +105,11 @@ int main(int argc,char* argv[])
continue;
}
filename=argv[i];
if (is_a_directory(filename)) {
fprintf(stderr, "%s: ERROR: \"%s\": Is a directory\n", tool_name, filename);
continue;
}
if (strcmp(filename,"-")==0)
infh=stdin;
else