eccodes/definitions/bufr/section.3.def

105 lines
5.4 KiB
Modula-2
Raw Normal View History

2014-01-03 16:22:21 +00:00
# Copyright 2005-2014 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]/[centre:l]/[subCentre]" : hidden;
constant rootTablesDir="bufr/tables" : hidden;
transient tableNumber=0;
codetable[24] codeTablesMaster '[tablesMasterDir]/codetables/[tableNumber].table' : string_type,transient;
codetable[24] codeTablesLocal '[tablesLocalDir]/codetables/[tableNumber].table' : string_type,transient;
hash_array sequences (defaultSequence,"sequence.def",tablesMasterDir,tablesLocalDir): long_type;
#smart_table codeFlags ("codeFlag.def",tablesMasterDir,tablesLocalDir,...);
position offsetSection3;
section_length[3] section3Length ;
2013-03-25 12:04:10 +00:00
unsigned[1] reserved = 0;
unsigned[2] numberOfDataSubsets : dump;
if (section2Present && centre==98 && section2Length==52) {
concept isSatelliteType(zero) {
1 = {rdbType = 2; }
1 = {rdbType = 3; }
1 = {rdbType = 8; }
1 = {rdbType = 12; }
}
if (isSatelliteType || numberOfDataSubsets>1) {
constant isSatellite=1;
} else {
constant isSatellite=0;
}
alias rdb.isSatellite=isSatellite;
if (isSatellite) {
meta localLongitude1 bits(keyData,40,26,-18000000,100000) : dump;
meta localLatitude1 bits(keyData,72,25,-9000000,100000) : dump;
meta localLongitude2 bits(keyMore,0,26,-18000000,100000) : dump;
meta localLatitude2 bits(keyMore,32,25,-9000000,100000) : dump;
if (numberOfDataSubsets>255 ||
( rdbSubtype>=121 && rdbSubtype <=130 ) ||
rdbSubtype==31) {
meta ls.umberOfObservations bits(keySat,0,16) : dump,long_type;
meta ls.satelliteID bits(keySat,16,16) : dump,long_type;
} else {
meta ls.numberOfObservations bits(keySat,0,8) : dump,long_type;
meta ls.satelliteID bits(keySat,8,16) : dump,long_type;
}
} else {
meta ls.localLatitude bits(keyData,72,25,-9000000,100000) : dump;
meta ls.localLongitude bits(keyData,40,26,-18000000,100000) : dump;
alias ls.ident=keyMore : dump,string_type;
}
}
2013-03-25 12:04:10 +00:00
flags[1] section3Flags 'bufr/section3_flags.table';
flagbit observedData(section3Flags,7) : dump;
flagbit compressedData(section3Flags,6) : dump;
position offsetDescriptors;
meta numberOfUnexpandedDescriptors evaluate( (section3Length - 7) / 2 ) ;
meta unexpandedDescriptors unexpanded_descriptors(numberOfUnexpandedDescriptors) :dump;
2014-09-01 12:20:22 +00:00
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(expandedCodes,0,unexpandedDescriptors,sequences,elementCode,
elementUnit,elementScale,elementReference,elementWidth);
meta expandedScales expanded_descriptors(expandedCodes,1);
meta expandedReferences expanded_descriptors(expandedCodes,2);
meta expandedWidths expanded_descriptors(expandedCodes,3);
meta expandedFlags expanded_descriptors(expandedCodes,4);
2014-09-01 12:20:22 +00:00
meta bufrdcExpandedDescriptors bufrdc_expanded_descriptors(expandedCodes);
#smart_table NAME (VALUES,FILE_NAME,MASTER_DIRECTORY,LOCAL_DIRECTORY,WIDTH_OF_CODE_IN_BITS,EXTRA_DIRECTORY,EXTRA_FILE_NAME);
smart_table expandedOriginalCodes (expandedCodes,"element.table",tablesMasterDir,tablesLocalDir,18,rootTablesDir,"operators.table") ;
meta expandedAbbreviations smart_table_column(expandedOriginalCodes,0,1) : string_type;
meta expandedTypes smart_table_column(expandedOriginalCodes,1,0) : string_type;
meta expandedNames smart_table_column(expandedOriginalCodes,2,0) : string_type;
meta expandedUnits smart_table_column(expandedOriginalCodes,3,0) : string_type;
meta expandedOriginalScales smart_table_column(expandedOriginalCodes,4,0) : long_type;
meta expandedOriginalReferences smart_table_column(expandedOriginalCodes,5,0) : long_type;
meta expandedOriginalWidths smart_table_column(expandedOriginalCodes,6,0) : long_type;
meta expandedCrex_units smart_table_column(expandedOriginalCodes,7,0) : long_type;
meta expandedCrex_scales smart_table_column(expandedOriginalCodes,8,0) : long_type;
meta expandedCrex_widths smart_table_column(expandedOriginalCodes,9,0) : long_type;
position endDescriptors;
2013-03-25 12:04:10 +00:00
section_padding section3Padding;
meta lengthDescriptors evaluate(endDescriptors-offsetDescriptors);
meta md5Structure md5(offsetDescriptors,lengthDescriptors);