Merge branch 'develop' into master

This commit is contained in:
shahramn 2021-08-30 15:12:16 +01:00 committed by GitHub
commit be29a2cca0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 204 additions and 160 deletions

View File

@ -2,7 +2,7 @@
# general configuration #
#---------------------------------#
version: 2.23.0-{build}-{branch}
version: 2.24.0-{build}-{branch}
branches:
only:

View File

@ -21,7 +21,7 @@ cmake_minimum_required( VERSION 3.12 FATAL_ERROR )
find_package( ecbuild 3.4 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild)
# Initialise project
project( eccodes VERSION 2.23.0 LANGUAGES C )
project( eccodes VERSION 2.24.0 LANGUAGES C )
###############################################################################
# system checks needed for eccodes_config.h and some options like MEMFS

View File

@ -27,7 +27,6 @@ unsigned[1] methodNumber : dump ;
#
# Coordinate structure definition
#
unsigned[1] spaceUnitFlag : dump ;
unsigned[1] verticalCoordinateDefinition : dump ;
@ -41,7 +40,6 @@ unsigned[1] timeCoordinateDefinition : dump ;
#
# Position definition: mixed coordinates
#
unsigned[1] mixedCoordinateFieldFlag : dump ;
unsigned[1] coordinate1Flag : dump ;
@ -63,7 +61,6 @@ signed[4] coordinate2End : dump ;
#
# Data grid definitions
#
unsigned[1] coordinate3Flag : dump ;
unsigned[1] coordinate4Flag : dump ;
@ -87,7 +84,6 @@ flags[1] flagForNormalOrStaggeredGrid 'grib1/ocean.1.table' : dump;
#
# Auxiliary information
#
flags[1] flagForAnyFurtherInformation 'grib1/ocean.1.table' : dump;
unsigned[1] numberInHorizontalCoordinates : dump;
@ -101,13 +97,11 @@ unsigned[2] numberInTheAuxiliaryArray : dump ;
#
# Horizontal coordinate definition
#
unsigned[4] horizontalCoordinateSupplement[numberInHorizontalCoordinates] : dump;
#
# Mixed coordinate definition
#
unsigned[4] mixedCoordinateDefinition[numberInMixedCoordinateDefinition] : dump;
#
@ -120,17 +114,15 @@ if (numberInTheGridCoordinateList>0) {
#
# Auxiliary array
#
unsigned[4] auxiliary[numberInTheAuxiliaryArray] : dump;
#
# Post-auxiliary array
#
constant postAuxiliaryArrayPresent = 1;
if (flagShowingPostAuxiliaryArrayInUse == postAuxiliaryArrayPresent) {
unsigned[4] sizeOfPostAuxiliaryArrayPlusOne : dump;
unsigned[4] sizeOfPostAuxiliaryArrayPlusOne : dump;
meta sizeOfPostAuxiliaryArray evaluate(sizeOfPostAuxiliaryArrayPlusOne - 1);
if (sizeOfPostAuxiliaryArray>0) {
unsigned[4] postAuxiliary[sizeOfPostAuxiliaryArray] : dump;

View File

@ -21,173 +21,139 @@ constant isectionNumber2 = "h";
constant isectionNumber3 = "m";
constant isectionNumber4 = "z";
constant tsectionNumber3 = "v";
constant tsectionNumber4 = "z";
constant tsectionNumber5 = "m";
constant GRIB_DEPTH = 2;
constant GRIB_LONGITUDE = 3;
constant GRIB_LATITUDE = 4;
constant GRIB_DEPTH = 2;
constant GRIB_LONGITUDE = 3;
constant GRIB_LATITUDE = 4;
meta verificationDate g1verificationdate(dataDate, dataTime, endStep) : read_only;
if(horizontalCoordinateDefinition == 0)
{
if(coordinate1Flag == 1 )
{
# range
if(averaging1Flag == P_TAVG ){
if(
marsType == TYPE_OR
|| marsType == TYPE_FC
|| marsType == TYPE_FF
|| marsType == TYPE_FX
)
{
meta marsRange evaluate((coordinate1End - coordinate1Start)/3600);
alias mars.range = marsRange;
}
if (horizontalCoordinateDefinition == 0) {
if (coordinate1Flag == 1 ) {
# range
if (averaging1Flag == P_TAVG ) {
if (marsType == TYPE_OR
|| marsType == TYPE_FC
|| marsType == TYPE_FF
|| marsType == TYPE_FX)
{
meta marsRange evaluate((coordinate1End - coordinate1Start)/3600);
alias mars.range = marsRange;
}
}
# section
# section
if (coordinate2Flag == 2) { alias mars.section = isectionNumber2; }
if (coordinate2Flag == 3) { alias mars.section = isectionNumber3; }
if (coordinate2Flag == 4) { alias mars.section = isectionNumber4; }
if(coordinate2Flag == 2) { alias mars.section = isectionNumber2;}
if(coordinate2Flag == 3) { alias mars.section = isectionNumber3;}
if(coordinate2Flag == 4) { alias mars.section = isectionNumber4;}
# levelist latitude longitude
if(coordinate2Flag == GRIB_DEPTH){
meta marsLevelist divdouble( coordinate2Start,1000 );
meta roundedMarsLevelist round( marsLevelist ,1000);
alias mars.levelist = roundedMarsLevelist ;
}
if(coordinate2Flag == GRIB_LONGITUDE){
meta marsLongitude divdouble( coordinate2Start,1000000 );
meta roundedMarsLongitude round( marsLongitude ,1000);
alias mars.longitude = roundedMarsLongitude ;
}
if(coordinate2Flag == GRIB_LATITUDE){
meta marsLatitude divdouble( coordinate2Start,1000000 );
meta roundedMarsLatitude round( marsLatitude ,1000);
alias mars.latitude = roundedMarsLatitude ;
# levelist latitude longitude
if (coordinate2Flag == GRIB_DEPTH) {
meta marsLevelist divdouble( coordinate2Start,1000 );
meta roundedMarsLevelist round( marsLevelist ,1000);
alias mars.levelist = roundedMarsLevelist ;
}
if (coordinate2Flag == GRIB_LONGITUDE) {
meta marsLongitude divdouble( coordinate2Start,1000000 );
meta roundedMarsLongitude round( marsLongitude ,1000);
alias mars.longitude = roundedMarsLongitude ;
}
if (coordinate2Flag == GRIB_LATITUDE) {
meta marsLatitude divdouble( coordinate2Start,1000000 );
meta roundedMarsLatitude round( marsLatitude ,1000);
alias mars.latitude = roundedMarsLatitude ;
}
#product
if(averaging1Flag == 0) { alias mars.product = coordAveraging0;}
if(averaging1Flag == 1) { alias mars.product = coordAveraging1;}
if(averaging1Flag == 2) { alias mars.product = coordAveraging2;}
if(averaging1Flag == 3) { alias mars.product = coordAveraging3;}
#product
if (averaging1Flag == 0) { alias mars.product = coordAveraging0;}
if (averaging1Flag == 1) { alias mars.product = coordAveraging1;}
if (averaging1Flag == 2) { alias mars.product = coordAveraging2;}
if (averaging1Flag == 3) { alias mars.product = coordAveraging3;}
# date
if(
(marsType == TYPE_OR && averaging1Flag == P_TAVG)
# date
if ( (marsType == TYPE_OR && averaging1Flag == P_TAVG)
|| (marsType == TYPE_OR && averaging1Flag == P_TACC)
|| (marsType == TYPE_FX && averaging1Flag == P_TAVG)
)
{
|| (marsType == TYPE_FX && averaging1Flag == P_TAVG))
{
#remove mars.date;
alias mars.date = verificationDate;
#remove mars.step;
constant stepZero = 0;
alias mars.step = stepZero;
}
}
else
{
meta coordinateIndexNumber evaluate(coordinate4Flag+coordinate3Flag);
}
}
else
{
meta coordinateIndexNumber evaluate(coordinate4Flag+coordinate3Flag);
# levelist latitude longitude
if (coordinateIndexNumber== 3) {
meta marsLatitude divdouble( coordinate1Start,1000000);
meta marsLongitude divdouble( coordinate2Start,1000000);
if(coordinateIndexNumber== 3)
{
meta marsLatitude divdouble( coordinate1Start,1000000);
meta marsLongitude divdouble( coordinate2Start,1000000);
meta roundedMarsLatitude round( marsLatitude ,1000);
meta roundedMarsLongitude round( marsLongitude ,1000);
meta roundedMarsLatitude round( marsLatitude ,1000);
meta roundedMarsLongitude round( marsLongitude ,1000);
alias mars.latitude = roundedMarsLatitude ;
alias mars.longitude = roundedMarsLongitude ;
}
alias mars.latitude = roundedMarsLatitude ;
alias mars.longitude = roundedMarsLongitude ;
if (coordinateIndexNumber == 4) {
meta marsLevelist divdouble( coordinate1Start,1000);
meta marsLatitude divdouble( coordinate2Start,1000000);
}
meta roundedMarsLevelist round( marsLevelist ,1000);
meta roundedMarsLatitude round( marsLatitude ,1000);
if(coordinateIndexNumber == 4)
{
meta marsLevelist divdouble( coordinate1Start,1000);
meta marsLatitude divdouble( coordinate2Start,1000000);
alias mars.levelist = roundedMarsLevelist ;
alias mars.latitude = roundedMarsLatitude ;
}
meta roundedMarsLevelist round( marsLevelist ,1000);
meta roundedMarsLatitude round( marsLatitude ,1000);
if (coordinateIndexNumber == 5) {
meta marsLevelist divdouble( coordinate1Start,1000);
meta marsLongitude divdouble( coordinate2Start,1000000);
alias mars.levelist = roundedMarsLevelist ;
alias mars.latitude = roundedMarsLatitude ;
}
meta roundedMarsLevelist round( marsLevelist ,1000);
meta roundedMarsLongitude round( marsLongitude ,1000);
if(coordinateIndexNumber == 5)
{
meta marsLevelist divdouble( coordinate1Start,1000);
meta marsLongitude divdouble( coordinate2Start,1000000);
alias mars.levelist = roundedMarsLevelist ;
alias mars.longitude = roundedMarsLongitude ;
}
meta roundedMarsLevelist round( marsLevelist ,1000);
meta roundedMarsLongitude round( marsLongitude ,1000);
# section
if (coordinateIndexNumber == 3) { alias mars.section = tsectionNumber3; }
if (coordinateIndexNumber == 4) { alias mars.section = tsectionNumber4; }
if (coordinateIndexNumber == 5) { alias mars.section = tsectionNumber5; }
alias mars.levelist = roundedMarsLevelist ;
alias mars.longitude = roundedMarsLongitude ;
}
# section
if(coordinateIndexNumber == 3) { alias mars.section = tsectionNumber3;}
if(coordinateIndexNumber == 4) { alias mars.section = tsectionNumber4;}
if(coordinateIndexNumber == 5) { alias mars.section = tsectionNumber5;}
# range
if(averaging1Flag == P_INST){
if(
(marsType == TYPE_OR)
# range
if (averaging1Flag == P_INST) {
if ((marsType == TYPE_OR)
||(marsType == TYPE_FC)
||(marsType == TYPE_CF)
||(marsType == TYPE_PF)
||(marsType == TYPE_FF)
||(marsType == TYPE_OF)
)
||(marsType == TYPE_OF))
{
if( coordinate4Flag == 1){
if (coordinate4Flag == 1){
meta marsRange evaluate((coordinate4OfLastGridPoint - coordinate4OfFirstGridPoint)/3600);
}else{
} else {
meta marsRange evaluate((coordinate3OfLastGridPoint - coordinate3OfFirstGridPoint)/3600);
}
alias mars.range = marsRange;
alias mars.range = marsRange;
}
}
}
# product
alias mars.product = coordAveragingTims;
# date
if(marsType == TYPE_OR && averaging1Flag == P_INST){
if (marsType == TYPE_OR && averaging1Flag == P_INST) {
#remove mars.date;
alias mars.date = verificationDate;
#remove mars.step;
constant stepZero = 0;
alias mars.step =stepZero;
}
}
}
}

View File

@ -56,7 +56,7 @@ int main(int argc, char** argv)
set = codes_fieldset_new_from_files(0, filenames, nfiles, keys, nkeys, 0, 0, &err);
CODES_CHECK(err, 0);
/* not jet implemented */
/* not yet implemented */
/* err=codes_fieldset_apply_where(set,"(centre=='ecmf') && number==1 || step==6 "); */
/* CODES_CHECK(err,0); */

View File

@ -57,7 +57,7 @@ int main(int argc, char** argv) {
set=grib_fieldset_new_from_files(0,filenames,nfiles,keys,nkeys,0,0,&err);
GRIB_CHECK(err,0);
/* not jet implemented */
/* not yet implemented */
/* err=grib_fieldset_apply_where(set,"(centre=='ecmf') && number==1 || step==6 "); */
/* GRIB_CHECK(err,0); */

View File

@ -407,7 +407,7 @@ bufr_descriptor* accessor_bufr_elements_table_get_descriptor(grib_accessor* a, i
v = (bufr_descriptor*)grib_context_malloc_clear(c, sizeof(bufr_descriptor));
if (!v) {
grib_context_log(c, GRIB_LOG_ERROR,
"grib_bufr_descriptor_new unable to allocate %ld bytes\n", sizeof(bufr_descriptor));
"accessor_bufr_elements_table_get_descriptor: unable to allocate %ld bytes\n", sizeof(bufr_descriptor));
*err = GRIB_OUT_OF_MEMORY;
return NULL;
}

View File

@ -216,6 +216,7 @@ static int global_depth = -1;
#endif
#define BUFR_DESCRIPTORS_ARRAY_USED_SIZE(v) ((v)->n)
#define SILENT 1
static void __expand(grib_accessor* a, bufr_descriptors_array* unexpanded, bufr_descriptors_array* expanded,
change_coding_params* ccp, int* err)
@ -273,7 +274,7 @@ static void __expand(grib_accessor* a, bufr_descriptors_array* unexpanded, bufr_
inner_unexpanded = grib_bufr_descriptors_array_new(c, DESC_SIZE_INIT, DESC_SIZE_INCR);
for (i = 0; i < size; i++) {
vv = grib_bufr_descriptor_new(self->tablesAccessor, v[i], err);
vv = grib_bufr_descriptor_new(self->tablesAccessor, v[i], !SILENT, err);
inner_unexpanded = grib_bufr_descriptors_array_push(inner_unexpanded, vv);
}
grib_context_free(c, v);
@ -396,7 +397,7 @@ static void __expand(grib_accessor* a, bufr_descriptors_array* unexpanded, bufr_
DESCRIPTORS_POP_FRONT_OR_RETURN(unexpanded, u);
size = 1;
if (ccp->associatedFieldWidth && u->X != 31) {
bufr_descriptor* au = grib_bufr_descriptor_new(self->tablesAccessor, 999999, err);
bufr_descriptor* au = grib_bufr_descriptor_new(self->tablesAccessor, 999999, !SILENT, err);
au->width = ccp->associatedFieldWidth;
grib_bufr_descriptor_set_scale(au, 0);
strcpy(au->shortName, "associatedField");
@ -658,8 +659,12 @@ static int expand(grib_accessor* a)
unexpanded_copy = grib_bufr_descriptors_array_new(c, unexpandedSize, DESC_SIZE_INCR);
operator206yyy_width = 0;
for (i = 0; i < unexpandedSize; i++) {
bufr_descriptor* aDescriptor1 = grib_bufr_descriptor_new(self->tablesAccessor, u[i], &err);
bufr_descriptor* aDescriptor2 = grib_bufr_descriptor_new(self->tablesAccessor, u[i], &err);
bufr_descriptor *aDescriptor1, *aDescriptor2;
/* ECC-1274: clear error and only issue msg once */
err = 0;
aDescriptor1 = grib_bufr_descriptor_new(self->tablesAccessor, u[i], SILENT, &err);
err = 0;
aDescriptor2 = grib_bufr_descriptor_new(self->tablesAccessor, u[i], !SILENT, &err);
/* ECC-433: Operator 206YYY */
if (aDescriptor1->F == 2 && aDescriptor1->X == 6) {

View File

@ -235,14 +235,14 @@ int pack_long_unsigned_helper(grib_accessor* a, const long* val, size_t* len, in
/* Check if value fits into number of bits */
if (check) {
const long nbits = self->nbytes * 8;
if (v < 0) {
grib_context_log(a->context, GRIB_LOG_ERROR,
"Key \"%s\": Trying to encode a negative value of %ld for key of type unsigned\n", a->name, v);
return GRIB_ENCODING_ERROR;
}
/* See GRIB-23 and GRIB-262 */
if (!value_is_missing(v)) {
if (v < 0) {
grib_context_log(a->context, GRIB_LOG_ERROR,
"Key \"%s\": Trying to encode a negative value of %ld for key of type unsigned\n", a->name, v);
return GRIB_ENCODING_ERROR;
}
const long nbits = self->nbytes * 8;
if (nbits < 33) {
unsigned long maxval = (1UL << nbits) - 1;
if (maxval > 0 && v > maxval) { /* See ECC-1002 */

View File

@ -171,7 +171,7 @@ grib_hash_array_value* grib_double_hash_array_value_new(grib_context* c, const c
void grib_hash_array_value_delete(grib_context* c, grib_hash_array_value* v);
/* grib_bufr_descriptor.c */
bufr_descriptor* grib_bufr_descriptor_new(grib_accessor* tables_accessor, int code, int* err);
bufr_descriptor* grib_bufr_descriptor_new(grib_accessor* tables_accessor, int code, int silent, int* err);
bufr_descriptor* grib_bufr_descriptor_clone(bufr_descriptor* d);
int grib_bufr_descriptor_set_code(grib_accessor* tables_accessor, int code, bufr_descriptor* v);
void grib_bufr_descriptor_set_reference(bufr_descriptor* v, long reference);

View File

@ -11,10 +11,10 @@
#include "grib_api_internal.h"
bufr_descriptor* grib_bufr_descriptor_new(grib_accessor* tables_accessor, int code, int* err)
bufr_descriptor* grib_bufr_descriptor_new(grib_accessor* tables_accessor, int code, int silent, int* err)
{
bufr_descriptor* ret = accessor_bufr_elements_table_get_descriptor(tables_accessor, code, err);
if (*err)
if (!silent && *err)
grib_context_log(tables_accessor->context, GRIB_LOG_ERROR,
"unable to get descriptor %06d from table", code);
return ret;

View File

@ -423,6 +423,7 @@ int grib_fieldset_apply_where(grib_fieldset* set, const char* where_string)
print_math(m);
printf("\n");
grib_math_delete(set->context, m);
return err;
}

View File

@ -193,6 +193,7 @@ static grib_math* readatom(grib_context* c, char** form, int* err)
p->name = strdup(buf);
Assert(p->name);
p->left = 0;
p->right = 0;
switch (**form) {
case '(':
@ -252,9 +253,9 @@ static grib_math* readpower(grib_context* c, char** form, int* err)
{
grib_math* p = readatom(c, form, err);
while (**form == '^' || (**form == '*' && *(*form + 1) == '*')) {
grib_math* q = (grib_math*)grib_context_malloc(c, sizeof(grib_math));
q->right = 0;
q->left = p;
q->arity = 2;

View File

@ -23,7 +23,15 @@ for file in $ECCODES_SAMPLES_PATH/BUFR*.tmpl; do
done
# Check one specific BUFR file dump output
${tools_dir}/bufr_dump -p $ECCODES_SAMPLES_PATH/BUFR3.tmpl > $temp
input=$ECCODES_SAMPLES_PATH/BUFR3.tmpl
${tools_dir}/bufr_dump -p $input > $temp
diff ${data_dir}/BUFR3.tmpl.dump.plain.ref $temp
# Code generation
input=$ECCODES_SAMPLES_PATH/BUFR4.tmpl
for lang in C python fortran filter; do
${tools_dir}/bufr_dump -D $lang $input >/dev/null
${tools_dir}/bufr_dump -E $lang $input >/dev/null
done
rm -f $temp

View File

@ -92,6 +92,9 @@ input=${data_dir}/spherical_model_level.grib1
${tools_dir}/grib_set -r -s packingType=spectral_simple $input $temp
grib_check_key_equals $temp packingType 'spectral_simple'
${tools_dir}/grib_ls -p numberOfCodedValues $temp
${tools_dir}/grib_ls -n statistics $temp
stats=`${tools_dir}/grib_get -F%.1f -p average,standardDeviation $temp`
[ "$stats" = "195.1 12.0" ]
rm -f $temp

View File

@ -189,6 +189,17 @@ sample1=$ECCODES_SAMPLES_PATH/sh_ml_grib1.tmpl
padding=`echo 'print "[padding_grid50_1]";' | ${tools_dir}/grib_filter - $sample1`
[ "$padding" = "000000000000000000000000000000000000" ]
echo "Test switch statement"
# --------------------------
cat >temp.filt <<EOF
switch (edition) {
case 1: print "1";
case 2: print "2";
default: print "what is this?";assert(0);
}
EOF
${tools_dir}/grib_filter temp.filt $ECCODES_SAMPLES_PATH/GRIB1.tmpl $ECCODES_SAMPLES_PATH/GRIB2.tmpl
# Clean up
rm -f temp_filt.grib2 temp.filt

View File

@ -9,6 +9,8 @@
#
. ./include.sh
set -u
temp=temp.grib_iterator.grib
files="reduced_latlon_surface.grib1 \
reduced_gaussian_pressure_level.grib1 \
@ -32,3 +34,7 @@ done
# ECC-822: Increase lat/lon decimals using default grib_get_data
${tools_dir}/grib_get_data -L%12.6f%11.5f ${data_dir}/regular_latlon_surface.grib2
${tools_dir}/grib_get_data -p shortName,level ${data_dir}/regular_latlon_surface.grib2 > $temp
grep -q "Latitude Longitude Value shortName level" $temp
rm -f $temp

View File

@ -117,8 +117,16 @@ grib_check_key_equals $temp section2Length 5
rm -f $temp
# Local Definition 5
# -----------------------
# Local Definition 4: Ocean model data
# ---------------------------------------
${tools_dir}/grib_set -s \
localDefinitionNumber=4,coordinate2Flag=2,averaging1Flag=1,coordinate1Flag=1,coordinate2Start=1234 \
$sample_g1 $temp
grib_check_key_equals $temp "mars.levelist,roundedMarsLevelist:d,roundedMarsLevelist:s" "1 1.234 1.234"
# Local Definition 5: Forecast probability data
# ---------------------------------------------
sample_g1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
temp=temp.grib_local.grib
${tools_dir}/grib_set -s setLocalDefinition=1,localDefinitionNumber=5 $sample_g1 $temp.1
@ -181,4 +189,5 @@ result=`echo 'print "[ccccIdentifiers]";' | ${tools_dir}/grib_filter - $temp`
[ "$result" = "kwbc ecmf sabm" ]
rm -f $temp $temp.1 $temp.2 $temp.3

View File

@ -21,6 +21,8 @@
#include "eccodes.h"
int grib_fieldset_apply_where(grib_fieldset* set, const char* where_string); /*experimental*/
static void usage(const char* prog)
{
printf("Usage: %s [-n] grib_file grib_file ...\n", prog);
@ -72,6 +74,10 @@ int main(int argc, char** argv)
set = codes_fieldset_new_from_files(0, filenames, nfiles, 0, 0, 0, order_by, &err);
CODES_CHECK(err, 0);
/* grib_fieldset_apply_where not fully implemented*/
err=grib_fieldset_apply_where(set, "(centre=='ecmf') && number==1 || step==6");
CODES_CHECK(err, 0);
printf("ordering by %s\n", order_by);
printf("%d fields in the fieldset\n", codes_fieldset_count(set));
printf("n,step,param\n");

View File

@ -19,6 +19,7 @@ input_grb=${data_dir}/reduced_gaussian_pressure_level.grib1
# --------------------------------------
$EXEC ${test_dir}/grib_nearest_test $input_grb > $temp
cat > $tempRef <<EOF
((((centre)==(ecmf))&&((number)==(1)))||((step)==(6)))
ordering by param,step
1 fields in the fieldset
n,step,param
@ -36,6 +37,7 @@ diff $tempRef $temp
# ----------------------------------------
$EXEC ${test_dir}/grib_nearest_test -n $input_grb > $temp
cat > $tempRef <<EOF
((((centre)==(ecmf))&&((number)==(1)))||((step)==(6)))
ordering by param,step
1 fields in the fieldset
n,step,param

View File

@ -13,7 +13,8 @@
REDIRECT=/dev/null
infile=${data_dir}/regular_gaussian_surface.grib1
outfile=${data_dir}/set.grib1
outfile=${data_dir}/temp.grib_set.grib
temp=temp.grib_set.out
rm -f $outfile
@ -52,13 +53,37 @@ levtype=`${tools_dir}/grib_get -p levtype:l $outfile`
centre=`${tools_dir}/grib_get -p centre:l $outfile`
[ $centre -eq 80 ]
# Set without -s. Expected to fail
# ----------------------------------------------------
set +e
# This is expected to fail
${tools_dir}/grib_set -p levtype $infile $outfile 2> $REDIRECT > $REDIRECT
[ $? -ne 0 ]
status=$?
set -e
[ $status -ne 0 ]
# GRIB-941: encoding of grib2 angles
# Out-of-bounds value. Expected to fail
# ----------------------------------------------------
input=${data_dir}/reduced_gaussian_sub_area.grib2
set +e
${tools_dir}/grib_set -s perturbationNumber=1000 $input $outfile 2>$temp
status=$?
set -e
[ $status -ne 0 ]
grep -q "Trying to encode value of 1000 but the maximum allowable value is 255 (number of bits=8)" $temp
# Negative value for an unsigned key. Expected to fail
# ----------------------------------------------------
input=${data_dir}/reduced_gaussian_sub_area.grib2
set +e
${tools_dir}/grib_set -s perturbationNumber=-1 $input $outfile 2>$temp
status=$?
set -e
[ $status -ne 0 ]
grep -q "Trying to encode a negative value of -1 for key of type unsigned" $temp
# GRIB-941: encoding of GRIB2 angles
# -----------------------------------
angleInDegrees=130.9989
angleInMicroDegrees=130998900
files="GRIB2.tmpl regular_gg_pl_grib2.tmpl reduced_gg_pl_320_grib2.tmpl polar_stereographic_pl_grib2.tmpl"
@ -69,14 +94,17 @@ for f in $files; do
done
# GRIB-943: centre code table
# ----------------------------
${tools_dir}/grib_set -s centre=289 $ECCODES_SAMPLES_PATH/GRIB2.tmpl $outfile
${tools_dir}/grib_dump -O $outfile | grep -q 'centre = 289.*Zambia'
# ECC-539: avoid output being the same as input
# -----------------------------------------------
set +e
${tools_dir}/grib_set -s centre=0 $outfile $outfile
status=$?
set -e
[ $status -ne 0 ]
rm -f $outfile
rm -f $outfile $temp

View File

@ -15,6 +15,7 @@ label="pseudo_budg_test"
set -u
tempOut=temp.$label.txt
tempRef=temp.$label.ref
tempBud=temp.$label.bud
${tools_dir}/grib_ls -j ${data_dir}/budg > $tempOut
cat > $tempRef << EOF
@ -31,6 +32,11 @@ cat > $tempRef << EOF
EOF
diff $tempRef $tempOut
# Set date
${tools_dir}/grib_set -s date=20170102 ${data_dir}/budg $tempBud
res=`${tools_dir}/grib_get -p mars.date $tempBud`
[ "$res" = "20170102" ]
${tools_dir}/grib_dump ${data_dir}/budg
${tools_dir}/grib_dump -O ${data_dir}/budg
@ -42,4 +48,4 @@ ms=`${tools_dir}/grib_get -p mars.step $tempOut`
[ "$ms" = "19" ]
rm -f $tempRef $tempOut
rm -f $tempRef $tempOut $tempBud

View File

@ -1,4 +1,4 @@
# bashrc to be used for running tests on windows.
# bashrc to be used for running tests on Microsoft Windows.
# In order for the functions to be usable by the tests, we need to use the -i option.
# Typical usage:
# bash --rcfile windows_testing.bashrc -ci "some/test/script.sh"

View File

@ -208,7 +208,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
if (print_keys)
for (i = 0; i < options->print_keys_count; i++)
fprintf(dump_file, ", %s", options->print_keys[i].name);
fprintf(dump_file, " %s", options->print_keys[i].name);
fprintf(dump_file, "\n");

View File

@ -3,7 +3,7 @@ PACKAGE_NAME='eccodes'
# Package version
ECCODES_MAJOR_VERSION=2
ECCODES_MINOR_VERSION=23
ECCODES_MINOR_VERSION=24
ECCODES_REVISION_VERSION=0
ECCODES_CURRENT=1