2015-12-31 12:44:51 +00:00
|
|
|
# Copyright 2005-2016 ECMWF.
|
2013-03-25 12:04:10 +00:00
|
|
|
#
|
|
|
|
# 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.
|
2014-06-21 21:28:40 +00:00
|
|
|
#
|
2013-03-25 12:04:10 +00:00
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2014-06-21 21:28:40 +00:00
|
|
|
constant defaultSequence=0;
|
|
|
|
constant tablesMasterDir="bufr/tables/[masterTableNumber]/wmo/[masterTablesVersionNumber]" : hidden;
|
2015-03-04 17:15:48 +00:00
|
|
|
constant tablesLocalDir="bufr/tables/[masterTableNumber]/local/[localTablesVersionNumber]/[bufrHeaderCentre:l]/[bufrHeaderSubCentre]" : hidden;
|
2014-08-07 11:03:53 +00:00
|
|
|
constant rootTablesDir="bufr/tables" : hidden;
|
2014-06-21 21:28:40 +00:00
|
|
|
|
2015-11-10 16:00:20 +00:00
|
|
|
# we should implement some table version dependency
|
|
|
|
#constant templatesMasterDir="bufr/templates/[masterTableNumber]/[masterTablesVersionNumber]";
|
|
|
|
#constant templatesLocalDir="bufr/templates/local/[masterTableNumber]/[bufrHeaderCentre:l]/[localTablesVersionNumber]";
|
|
|
|
|
|
|
|
constant templatesMasterDir="bufr/templates/";
|
2015-11-12 12:23:40 +00:00
|
|
|
constant templatesLocalDir="bufr/templates/local";
|
2015-11-10 16:00:20 +00:00
|
|
|
|
2014-06-21 21:28:40 +00:00
|
|
|
transient tableNumber=0;
|
2015-04-28 10:06:58 +00:00
|
|
|
#codetable[4] codeTablesMaster '[tablesMasterDir]/codetables/[tableNumber].table' : string_type,transient;
|
|
|
|
#codetable[4] codeTablesLocal '[tablesLocalDir]/codetables/[tableNumber].table' : string_type,transient;
|
2014-06-21 21:28:40 +00:00
|
|
|
|
2016-02-03 16:31:23 +00:00
|
|
|
hash_array sequences (defaultSequence,"sequence.def",tablesMasterDir,tablesLocalDir): long_type,no_copy;
|
2014-06-21 21:28:40 +00:00
|
|
|
#smart_table codeFlags ("codeFlag.def",tablesMasterDir,tablesLocalDir,...);
|
|
|
|
|
|
|
|
position offsetSection3;
|
|
|
|
section_length[3] section3Length ;
|
2016-02-03 16:31:23 +00:00
|
|
|
unsigned[1] reservedSection3 = 0;
|
2014-11-17 14:53:05 +00:00
|
|
|
unsigned[2] numberOfSubsets : dump;
|
2015-01-26 16:07:58 +00:00
|
|
|
alias ls.numberOfSubsets=numberOfSubsets;
|
2014-06-21 21:28:40 +00:00
|
|
|
|
2015-03-04 17:15:48 +00:00
|
|
|
if (section2Present && bufrHeaderCentre==98 && section2Length==52) {
|
2014-06-21 21:28:40 +00:00
|
|
|
|
2016-02-03 16:31:23 +00:00
|
|
|
if ( rdbType == 2 || rdbType == 3 || rdbType == 8 || rdbType == 12 ) {
|
|
|
|
transient isSatelliteType=1;
|
|
|
|
} else {
|
|
|
|
transient isSatelliteType=0;
|
|
|
|
}
|
2014-11-17 14:53:05 +00:00
|
|
|
if (isSatelliteType || numberOfSubsets>1) {
|
2014-06-21 21:28:40 +00:00
|
|
|
constant isSatellite=1;
|
|
|
|
} else {
|
|
|
|
constant isSatellite=0;
|
|
|
|
}
|
|
|
|
alias rdb.isSatellite=isSatellite;
|
|
|
|
if (isSatellite) {
|
2016-02-03 16:31:23 +00:00
|
|
|
meta localLongitude1 bits(keyData,40,26,-18000000,100000) : dump,no_copy;
|
|
|
|
meta localLatitude1 bits(keyData,72,25,-9000000,100000) : dump,no_copy;
|
|
|
|
meta localLongitude2 bits(keyMore,0,26,-18000000,100000) : dump,no_copy;
|
|
|
|
meta localLatitude2 bits(keyMore,32,25,-9000000,100000) : dump,no_copy;
|
2014-06-21 21:28:40 +00:00
|
|
|
|
2014-11-17 14:53:05 +00:00
|
|
|
if (numberOfSubsets>255 ||
|
2014-06-21 21:28:40 +00:00
|
|
|
( rdbSubtype>=121 && rdbSubtype <=130 ) ||
|
|
|
|
rdbSubtype==31) {
|
2016-02-03 16:31:23 +00:00
|
|
|
meta ls.numberOfObservations bits(keySat,0,16) : dump,long_type,no_copy;
|
|
|
|
meta ls.satelliteID bits(keySat,16,16) : dump,long_type,no_copy;
|
2014-06-21 21:28:40 +00:00
|
|
|
} else {
|
2016-02-03 16:31:23 +00:00
|
|
|
meta ls.numberOfObservations bits(keySat,0,8) : dump,long_type,no_copy;
|
|
|
|
meta ls.satelliteID bits(keySat,8,16) : dump,long_type,no_copy;
|
2014-06-21 21:28:40 +00:00
|
|
|
}
|
|
|
|
} else {
|
2016-02-03 16:31:23 +00:00
|
|
|
meta ls.localLatitude bits(keyData,72,25,-9000000,100000) : dump,no_copy;
|
|
|
|
meta ls.localLongitude bits(keyData,40,26,-18000000,100000) : dump,no_copy;
|
|
|
|
alias ls.ident=keyMore : dump,string_type,no_copy;
|
2014-06-21 21:28:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-25 12:04:10 +00:00
|
|
|
flags[1] section3Flags 'bufr/section3_flags.table';
|
2016-02-03 16:31:23 +00:00
|
|
|
flagbit observedData(section3Flags,7) : dump,no_copy;
|
|
|
|
flagbit compressedData(section3Flags,6) : dump,no_copy;
|
2014-06-21 21:28:40 +00:00
|
|
|
position offsetDescriptors;
|
2016-02-03 16:31:23 +00:00
|
|
|
|
|
|
|
#meta unexpandedDescriptorsEncoded raw(section3Length - 7,totalLength,section3Length) : hidden;
|
|
|
|
|
2015-09-11 13:22:49 +00:00
|
|
|
transient createNewData=1;
|
2016-02-03 16:31:23 +00:00
|
|
|
meta numberOfUnexpandedDescriptors evaluate( (section3Length - 7) / 2 ) : no_copy;
|
|
|
|
#meta unexpandedDescriptors unexpanded_descriptors(unexpandedDescriptorsEncoded,createNewData) :dump,no_copy;
|
|
|
|
meta unexpandedDescriptors unexpanded_descriptors(numberOfUnexpandedDescriptors,createNewData) :dump,no_copy;
|
2014-06-21 21:28:40 +00:00
|
|
|
|
2015-11-12 12:23:40 +00:00
|
|
|
concept BufrTemplate (unknown,"BufrTemplate.def",templatesMasterDir,templatesLocalDir) : no_copy;
|
2015-11-10 16:00:20 +00:00
|
|
|
|
2016-02-03 16:31:23 +00:00
|
|
|
meta elementsTable bufr_elements_table("element.table",tablesMasterDir,tablesLocalDir) : hidden,no_copy;
|
2014-09-01 12:20:22 +00:00
|
|
|
|
2014-11-04 13:59:20 +00:00
|
|
|
|
2016-02-03 16:31:23 +00:00
|
|
|
meta expandedCodes expanded_descriptors(elementsTable,expandedCodes,0,unexpandedDescriptors,sequences) : no_copy;
|
2015-05-28 07:10:56 +00:00
|
|
|
alias expandedDescriptors=expandedCodes;
|
2014-11-04 13:59:20 +00:00
|
|
|
#meta expandedReferences expanded_descriptors(elemetsTable,expandedCodes,2);
|
|
|
|
#meta expandedWidths expanded_descriptors(elemetsTable,expandedCodes,3);
|
|
|
|
#meta expandedType expanded_descriptors(elemetsTable,expandedCodes,4);
|
2014-09-01 12:20:22 +00:00
|
|
|
|
2016-02-03 16:31:23 +00:00
|
|
|
meta bufrdcExpandedDescriptors bufrdc_expanded_descriptors(expandedCodes) : no_copy;
|
2014-06-21 21:28:40 +00:00
|
|
|
|
2014-08-07 11:03:53 +00:00
|
|
|
#smart_table NAME (VALUES,FILE_NAME,MASTER_DIRECTORY,LOCAL_DIRECTORY,WIDTH_OF_CODE_IN_BITS,EXTRA_DIRECTORY,EXTRA_FILE_NAME);
|
2016-02-03 16:31:23 +00:00
|
|
|
smart_table expandedOriginalCodes (expandedCodes,"element.table",tablesMasterDir,tablesLocalDir,18,rootTablesDir,"operators.table") :no_copy;
|
|
|
|
meta expandedAbbreviations smart_table_column(expandedOriginalCodes,0,1) : string_type,no_copy;
|
|
|
|
meta expandedTypes smart_table_column(expandedOriginalCodes,1,0) : string_type,no_copy;
|
|
|
|
meta expandedNames smart_table_column(expandedOriginalCodes,2,0) : string_type,no_copy;
|
|
|
|
meta expandedUnits smart_table_column(expandedOriginalCodes,3,0) : string_type,no_copy;
|
|
|
|
meta expandedOriginalScales smart_table_column(expandedOriginalCodes,4,0) : long_type,no_copy;
|
|
|
|
meta expandedOriginalReferences smart_table_column(expandedOriginalCodes,5,0) : long_type,no_copy;
|
|
|
|
meta expandedOriginalWidths smart_table_column(expandedOriginalCodes,6,0) : long_type,no_copy;
|
|
|
|
meta expandedCrex_units smart_table_column(expandedOriginalCodes,7,0) : long_type,no_copy;
|
|
|
|
meta expandedCrex_scales smart_table_column(expandedOriginalCodes,8,0) : long_type,no_copy;
|
|
|
|
meta expandedCrex_widths smart_table_column(expandedOriginalCodes,9,0) : long_type,no_copy;
|
2014-06-21 21:28:40 +00:00
|
|
|
|
|
|
|
position endDescriptors;
|
2013-03-25 12:04:10 +00:00
|
|
|
section_padding section3Padding;
|
2014-06-21 21:28:40 +00:00
|
|
|
meta lengthDescriptors evaluate(endDescriptors-offsetDescriptors);
|
|
|
|
meta md5Structure md5(offsetDescriptors,lengthDescriptors);
|