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
1e404d67a5
|
@ -889,39 +889,36 @@ static int encode_new_replication(grib_context* c,grib_accessor_bufr_data_array*
|
|||
unsigned long repetitions=1;
|
||||
bufr_descriptor** descriptors=self->expanded->v;
|
||||
|
||||
/* compressed to be implemented*/
|
||||
if (self->compressedData==0) {
|
||||
switch(descriptors[i]->code) {
|
||||
case 31000:
|
||||
if (self->nInputShortReplications>=0) {
|
||||
if (self->iInputShortReplications>=self->nInputShortReplications) {
|
||||
grib_context_log(c,GRIB_LOG_FATAL,"array inputShortDelayedDescriptorReplicationFactor dimension too small");
|
||||
}
|
||||
repetitions=self->inputShortReplications[self->iInputShortReplications];
|
||||
self->iInputShortReplications++;
|
||||
}
|
||||
break;
|
||||
case 31001:
|
||||
if (self->nInputReplications>=0) {
|
||||
if (self->iInputReplications>=self->nInputReplications) {
|
||||
grib_context_log(c,GRIB_LOG_FATAL,"array inputDelayedDescriptorReplicationFactor dimension too small");
|
||||
}
|
||||
repetitions=self->inputReplications[self->iInputReplications];
|
||||
self->iInputReplications++;
|
||||
}
|
||||
break;
|
||||
case 31002:
|
||||
if (self->nInputExtendedReplications>=0) {
|
||||
if (self->iInputExtendedReplications>=self->nInputExtendedReplications) {
|
||||
grib_context_log(c,GRIB_LOG_FATAL,"array inputExtendedDelayedDescriptorReplicationFactor dimension too small");
|
||||
}
|
||||
repetitions=self->inputExtendedReplications[self->iInputExtendedReplications];
|
||||
self->iInputExtendedReplications++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Assert(0);
|
||||
switch(descriptors[i]->code) {
|
||||
case 31000:
|
||||
if (self->nInputShortReplications>=0) {
|
||||
if (self->iInputShortReplications>=self->nInputShortReplications) {
|
||||
grib_context_log(c,GRIB_LOG_FATAL,"array inputShortDelayedDescriptorReplicationFactor dimension too small");
|
||||
}
|
||||
repetitions=self->inputShortReplications[self->iInputShortReplications];
|
||||
self->iInputShortReplications++;
|
||||
}
|
||||
break;
|
||||
case 31001:
|
||||
if (self->nInputReplications>=0) {
|
||||
if (self->iInputReplications>=self->nInputReplications) {
|
||||
grib_context_log(c,GRIB_LOG_FATAL,"array inputDelayedDescriptorReplicationFactor dimension too small");
|
||||
}
|
||||
repetitions=self->inputReplications[self->iInputReplications];
|
||||
self->iInputReplications++;
|
||||
}
|
||||
break;
|
||||
case 31002:
|
||||
if (self->nInputExtendedReplications>=0) {
|
||||
if (self->iInputExtendedReplications>=self->nInputExtendedReplications) {
|
||||
grib_context_log(c,GRIB_LOG_FATAL,"array inputExtendedDelayedDescriptorReplicationFactor dimension too small");
|
||||
}
|
||||
repetitions=self->inputExtendedReplications[self->iInputExtendedReplications];
|
||||
self->iInputExtendedReplications++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Assert(0);
|
||||
}
|
||||
|
||||
grib_context_log(c, GRIB_LOG_DEBUG,"BUFR data encoding replication: \twidth=%ld pos=%ld ulength=%ld ulength_bits=%ld",
|
||||
|
|
|
@ -628,6 +628,7 @@ static int _grib_set_double_array(grib_handle* h, const char* name,
|
|||
if(check && (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY))
|
||||
return GRIB_READ_ONLY;
|
||||
err=grib_pack_double(a, val, &length);
|
||||
encoded=length;
|
||||
} else err=_grib_set_double_array_internal(h,a,val,length,&encoded,check);
|
||||
|
||||
if(err == GRIB_SUCCESS && length > encoded)
|
||||
|
|
|
@ -1079,3 +1079,55 @@ diff ${f}.log.ref ${f}.log
|
|||
rm -f ${f}.log ${f}.log.ref
|
||||
rm -f $fLog $fRules
|
||||
|
||||
#-----------------------------------------------------------
|
||||
# Test: delayed replication compressed data
|
||||
#-----------------------------------------------------------
|
||||
cat > $fRules <<EOF
|
||||
set localTablesVersionNumber=1;
|
||||
set masterTablesVersionNumber=13;
|
||||
|
||||
|
||||
set inputDelayedDescriptorReplicationFactor = {5};
|
||||
set compressedData=1;
|
||||
set numberOfSubsets=2;
|
||||
|
||||
set unexpandedDescriptors={312061};
|
||||
|
||||
set #1#windSpeedAt10M={10,20};
|
||||
set #3#windSpeedAt10M={30,40};
|
||||
|
||||
set pack=1;
|
||||
|
||||
write;
|
||||
EOF
|
||||
|
||||
f="asel_139.bufr"
|
||||
fOut="asel_139.bufr.out"
|
||||
|
||||
echo "Test: delayed replication compressed data" >> $fLog
|
||||
echo "file: $f" >> $fLog
|
||||
${tools_dir}bufr_filter -o $fOut $fRules $f 2>> $fLog 1>> $fLog
|
||||
|
||||
cat > ${fRules} <<EOF
|
||||
set unpack=1;
|
||||
|
||||
print "delayedDescriptorReplicationFactor=[delayedDescriptorReplicationFactor]";
|
||||
print "#1#windSpeedAt10M=[#1#windSpeedAt10M]";
|
||||
print "#3#windSpeedAt10M=[#3#windSpeedAt10M]";
|
||||
print "#5#windSpeedAt10M=[#5#windSpeedAt10M]";
|
||||
EOF
|
||||
|
||||
${tools_dir}bufr_filter $fRules $fOut > ${f}.log
|
||||
|
||||
cat > ${f}.log.ref <<EOF
|
||||
delayedDescriptorReplicationFactor=5
|
||||
#1#windSpeedAt10M=10 20
|
||||
#3#windSpeedAt10M=30 40
|
||||
#5#windSpeedAt10M=-1e+100
|
||||
EOF
|
||||
|
||||
diff ${f}.log.ref ${f}.log
|
||||
|
||||
rm -f ${f}.log ${f}.log.ref
|
||||
rm -f $fLog $fOut $fRules
|
||||
|
||||
|
|
Loading…
Reference in New Issue