mirror of https://github.com/ecmwf/eccodes.git
Merge branch 'develop' of ssh://software.ecmwf.int:7999/eccodes/eccodes into develop
This commit is contained in:
commit
a4308e0f90
|
@ -70,6 +70,7 @@ list( APPEND tests
|
||||||
grib_precision
|
grib_precision
|
||||||
grib_clone
|
grib_clone
|
||||||
grib_copy_message
|
grib_copy_message
|
||||||
|
grib_ensemble_index
|
||||||
grib_set_pv
|
grib_set_pv
|
||||||
grib_set_bitmap
|
grib_set_bitmap
|
||||||
grib_list
|
grib_list
|
||||||
|
|
|
@ -30,9 +30,11 @@ int main(int argc, char * argv[])
|
||||||
double min=1e13,max=-1e13,avg=0;
|
double min=1e13,max=-1e13,avg=0;
|
||||||
codes_index* index;
|
codes_index* index;
|
||||||
codes_handle* h=NULL;
|
codes_handle* h=NULL;
|
||||||
|
|
||||||
|
if (argc<2) return 1;
|
||||||
|
|
||||||
/* create index of file contents for paramId and number */
|
/* 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);
|
CODES_CHECK(ret,0);
|
||||||
|
|
||||||
/* get size of "paramId" list */
|
/* get size of "paramId" list */
|
||||||
|
|
|
@ -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
|
|
@ -2,6 +2,5 @@
|
||||||
|
|
||||||
. ./include.sh
|
. ./include.sh
|
||||||
|
|
||||||
REDIRECT=/dev/null
|
$PYTHON $examples_src/grib_index.py
|
||||||
$PYTHON $examples_src/grib_index.py 2> $REDIRECT > $REDIRECT
|
rm -f my.idx
|
||||||
rm my.idx || true
|
|
||||||
|
|
|
@ -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)
|
void grib_dump_accessors_list(grib_dumper* dumper,grib_accessors_list* al)
|
||||||
{
|
{
|
||||||
grib_accessors_list* cur=al;
|
grib_accessors_list* cur=al;
|
||||||
grib_accessors_list* next=al->next;
|
while(cur) {
|
||||||
|
|
||||||
while(next) {
|
|
||||||
grib_accessor_dump(cur->accessor,dumper);
|
grib_accessor_dump(cur->accessor,dumper);
|
||||||
cur=next;
|
cur = cur->next;
|
||||||
next=cur->next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -940,6 +940,7 @@ int _codes_index_add_file(grib_index* index,const char* filename,int message_typ
|
||||||
{
|
{
|
||||||
double dval;
|
double dval;
|
||||||
size_t svallen;
|
size_t svallen;
|
||||||
|
size_t message_count = 0;
|
||||||
long length,lval;
|
long length,lval;
|
||||||
char buf[1024]={0,};
|
char buf[1024]={0,};
|
||||||
int err=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;
|
index_key=index->keys;
|
||||||
field_tree=index->fields;
|
field_tree=index->fields;
|
||||||
index_key->value[0]=0;
|
index_key->value[0]=0;
|
||||||
|
message_count++;
|
||||||
|
|
||||||
while (index_key) {
|
while (index_key) {
|
||||||
if (index_key->type==GRIB_TYPE_UNDEFINED) {
|
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;
|
if (err) return err;
|
||||||
field->length=length;
|
field->length=length;
|
||||||
|
|
||||||
|
|
||||||
if (field_tree->field) {
|
if (field_tree->field) {
|
||||||
grib_field* pfield=field_tree->field;
|
grib_field* pfield=field_tree->field;
|
||||||
while (pfield->next) pfield=pfield->next;
|
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;
|
field_tree->field=field;
|
||||||
|
|
||||||
if (h) grib_handle_delete(h);
|
if (h) grib_handle_delete(h);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
grib_file_close(file->name, 0, &err);
|
grib_file_close(file->name, 0, &err);
|
||||||
|
|
||||||
if (err) return err;
|
if (err) return err;
|
||||||
index->rewind=1;
|
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;
|
return GRIB_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -45,3 +45,5 @@ for c in 1 3 1/3; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# ECC-272
|
||||||
|
${tools_dir}bufr_dump -jf aaen_55.bufr | grep -q -w channelRadiance
|
||||||
|
|
Loading…
Reference in New Issue