Merge branch 'develop' of ssh://software.ecmwf.int:7999/eccodes/eccodes into develop

This commit is contained in:
Enrico Fucile 2016-11-08 14:11:35 +00:00
commit a4308e0f90
7 changed files with 39 additions and 12 deletions

View File

@ -70,6 +70,7 @@ list( APPEND tests
grib_precision
grib_clone
grib_copy_message
grib_ensemble_index
grib_set_pv
grib_set_bitmap
grib_list

View File

@ -30,9 +30,11 @@ int main(int argc, char * argv[])
double min=1e13,max=-1e13,avg=0;
codes_index* index;
codes_handle* h=NULL;
if (argc<2) return 1;
/* create index of file contents for paramId and number */
index = codes_index_new_from_file(0, "eps", "paramId,number",&ret);
index = codes_index_new_from_file(0, argv[1], "paramId,number",&ret);
CODES_CHECK(ret,0);
/* get size of "paramId" list */

View File

@ -0,0 +1,23 @@
#!/bin/sh
# Copyright 2005-2016 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.sh
input="../../data/index.grib"
${examples_dir}c_grib_ensemble_index $input
# ECC-378: Empty input file
temp=temp_index.empty.grib
touch $temp
set +e
${examples_dir}c_grib_ensemble_index $temp 2>/dev/null
status=$?
set -e
[ $status -ne 0 ]
rm -f $temp

View File

@ -2,6 +2,5 @@
. ./include.sh
REDIRECT=/dev/null
$PYTHON $examples_src/grib_index.py 2> $REDIRECT > $REDIRECT
rm my.idx || true
$PYTHON $examples_src/grib_index.py
rm -f my.idx

View File

@ -64,12 +64,9 @@ void grib_dump_accessors_block(grib_dumper* dumper,grib_block_of_accessors* bloc
void grib_dump_accessors_list(grib_dumper* dumper,grib_accessors_list* al)
{
grib_accessors_list* cur=al;
grib_accessors_list* next=al->next;
while(next) {
while(cur) {
grib_accessor_dump(cur->accessor,dumper);
cur=next;
next=cur->next;
cur = cur->next;
}
}

View File

@ -940,6 +940,7 @@ int _codes_index_add_file(grib_index* index,const char* filename,int message_typ
{
double dval;
size_t svallen;
size_t message_count = 0;
long length,lval;
char buf[1024]={0,};
int err=0;
@ -990,6 +991,7 @@ int _codes_index_add_file(grib_index* index,const char* filename,int message_typ
index_key=index->keys;
field_tree=index->fields;
index_key->value[0]=0;
message_count++;
while (index_key) {
if (index_key->type==GRIB_TYPE_UNDEFINED) {
@ -1071,7 +1073,6 @@ int _codes_index_add_file(grib_index* index,const char* filename,int message_typ
if (err) return err;
field->length=length;
if (field_tree->field) {
grib_field* pfield=field_tree->field;
while (pfield->next) pfield=pfield->next;
@ -1080,15 +1081,17 @@ int _codes_index_add_file(grib_index* index,const char* filename,int message_typ
field_tree->field=field;
if (h) grib_handle_delete(h);
}
grib_file_close(file->name, 0, &err);
if (err) return err;
index->rewind=1;
if (message_count == 0) {
grib_context_log(c,GRIB_LOG_ERROR,"File %s contains no messages", filename);
return GRIB_END_OF_FILE;
}
return GRIB_SUCCESS;
}
#if 0

View File

@ -45,3 +45,5 @@ for c in 1 3 1/3; do
fi
done
# ECC-272
${tools_dir}bufr_dump -jf aaen_55.bufr | grep -q -w channelRadiance