ECC-128 section 3 is ok, data section is not updated yet and the message is unreadable. More work needed

This commit is contained in:
Enrico Fucile 2015-05-28 08:10:56 +01:00
parent 31b82ee08a
commit 75ffdc4581
3 changed files with 64 additions and 22 deletions

View File

@ -70,17 +70,9 @@ meta unexpandedDescriptors unexpanded_descriptors(numberOfUnexpandedDescriptors)
meta elementsTable bufr_elements_table("element.table",tablesMasterDir,tablesLocalDir) : hidden;
#transient elementCode="000000";
#elementAbbreviation=dict_search("element.table",elementCode,1,tablesMasterDir,tablesLocalDir) : string_type,hidden ;
#elementType=dict_search("element.table",elementCode,2,tablesMasterDir,tablesLocalDir) : string_type,hidden ;
#elementName=dict_search("element.table",elementCode,3,tablesMasterDir,tablesLocalDir) : string_type,hidden ;
#elementUnit=dict_search("element.table",elementCode,4,tablesMasterDir,tablesLocalDir) : string_type,hidden ;
#elementScale=dict_search("element.table",elementCode,5,tablesMasterDir,tablesLocalDir) : string_type,hidden ;
#elementReference=dict_search("element.table",elementCode,6,tablesMasterDir,tablesLocalDir) : string_type,hidden ;
#elementWidth=dict_search("element.table",elementCode,7,tablesMasterDir,tablesLocalDir) : string_type,hidden ;
meta expandedCodes expanded_descriptors(elementsTable,expandedCodes,0,unexpandedDescriptors,sequences);
#meta expandedScales expanded_descriptors(elemetsTable,expandedCodes,1);
alias expandedDescriptors=expandedCodes;
#meta expandedReferences expanded_descriptors(elemetsTable,expandedCodes,2);
#meta expandedWidths expanded_descriptors(elemetsTable,expandedCodes,3);
#meta expandedType expanded_descriptors(elemetsTable,expandedCodes,4);

View File

@ -209,21 +209,28 @@ static int unpack_long (grib_accessor* a, long* val, size_t *len)
static int pack_long (grib_accessor* a, const long* val, size_t *len)
{
int ret=0,i;
long pos = a->offset*8;
unsigned long f,x,y;
int ret=0,i;
long pos = 0;
unsigned long f,x,y;
unsigned char* buf = NULL;
size_t buflen=*len*2;
for (i=0;i<*len;i++) {
f=val[i]/100000;
x=(val[i]%100000)/1000;
y=(val[i]%100000)%1000;
printf("f=%ld x=%ld y=%ld new=%ld\n",f,x,y,*val);
grib_encode_unsigned_longb(a->parent->h->buffer->data,f,&pos,2);
grib_encode_unsigned_longb(a->parent->h->buffer->data,x,&pos,6);
grib_encode_unsigned_longb(a->parent->h->buffer->data,y,&pos,8);
}
buf=grib_context_malloc_clear(a->parent->h->context,buflen);
return ret;
for (i=0;i<*len;i++) {
f=val[i]/100000;
x=(val[i]%100000)/1000;
y=(val[i]%100000)%1000;
grib_encode_unsigned_longb(buf,f,&pos,2);
grib_encode_unsigned_longb(buf,x,&pos,6);
grib_encode_unsigned_longb(buf,y,&pos,8);
}
grib_buffer_replace(a,buf,buflen,1,1);
/* update_size(a,buflen); */
return ret;
}

View File

@ -646,6 +646,49 @@ diff ${f}.ref ${f}.log
rm -f ${f}.ref ${f}.log
#-----------------------------------------------------------
# Test: set unexpandedDescriptors
#-----------------------------------------------------------
cat > $fRules <<EOF
print "== unexpandedDescriptors ==";
print "[unexpandedDescriptors!16]";
print "== setting unexpandedDescriptors ==";
print "309007 104000 31001 7004 8001 11061 11062 222000 101000 31002 31031 1031 1032 101000 31002 33007";
set unexpandedDescriptors={309007, 104000, 31001, 7004, 8001, 11061, 11062, 222000, 101000, 31002, 31031, 1031, 1032, 101000, 31002, 33007 };
write "mytemp.bufr";
print "== unexpandedDescriptors ==";
print "[unexpandedDescriptors!16]";
print "== expandedDescriptors ==";
print "[expandedDescriptors]";
EOF
f="syno_1.bufr"
echo "Test: set unexpandedDescriptors" >> $fLog
echo "file: $f" >> $fLog
${tools_dir}/bufr_filter $fRules $f 2>> $fLog 1>> $fLog
${tools_dir}/bufr_filter $fRules $f 2> ${f}.log 1> ${f}.log
cat > ${f}.ref <<EOF
== unexpandedDescriptors ==
307005 13023 13013 222000 101049 31031 1031 1032 101049 33007
== setting unexpandedDescriptors ==
309007 104000 31001 7004 8001 11061 11062 222000 101000 31002 31031 1031 1032 101000 31002 33007
== unexpandedDescriptors ==
309007 104000 31001 7004 8001 11061 11062 222000 101000 31002 31031 1031 1032 101000 31002 33007
== expandedDescriptors ==
1001 1002 2011 2012 4001 4002 4003 4004
4005 5001 6001 7001 20010 8002 20011 20013
20012 20012 20012 107000 31001 7004 8001 10003
12001 12003 11001 11002 104000 31001 7004 8001
11061 11062 222000 101000 31002 31031 1031 1032
101000 31002 33007
EOF
diff ${f}.ref ${f}.log
rm -f ${f}.ref ${f}.log
#-----------------------------------------------------------
# Test: get string
#-----------------------------------------------------------