eccodes/definitions/bufr/section.3.def

112 lines
5.7 KiB
Modula-2
Raw Normal View History

# 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.
#
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.
#
constant defaultSequence=0;
constant tablesMasterDir="bufr/tables/[masterTableNumber]/wmo/[masterTablesVersionNumber]" : hidden;
constant tablesLocalDir="bufr/tables/[masterTableNumber]/local/[localTablesVersionNumber]/[bufrHeaderCentre:l]/[bufrHeaderSubCentre]" : hidden;
constant rootTablesDir="bufr/tables" : hidden;
# 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";
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;
2016-02-03 16:31:23 +00:00
hash_array sequences (defaultSequence,"sequence.def",tablesMasterDir,tablesLocalDir): long_type,no_copy;
#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;
alias ls.numberOfSubsets=numberOfSubsets;
if (section2Present && bufrHeaderCentre==98 && section2Length==52) {
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) {
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-11-17 14:53:05 +00:00
if (numberOfSubsets>255 ||
( 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;
} 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;
}
} 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;
}
}
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;
position offsetDescriptors;
2016-02-03 16:31:23 +00:00
#meta unexpandedDescriptorsEncoded raw(section3Length - 7,totalLength,section3Length) : hidden;
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;
2015-11-12 12:23:40 +00:00
concept BufrTemplate (unknown,"BufrTemplate.def",templatesMasterDir,templatesLocalDir) : no_copy;
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
2016-02-03 16:31:23 +00:00
meta expandedCodes expanded_descriptors(elementsTable,expandedCodes,0,unexpandedDescriptors,sequences) : no_copy;
alias expandedDescriptors=expandedCodes;
#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;
#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;
position endDescriptors;
2013-03-25 12:04:10 +00:00
section_padding section3Padding;
meta lengthDescriptors evaluate(endDescriptors-offsetDescriptors);
meta md5Structure md5(offsetDescriptors,lengthDescriptors);