eccodes/definitions/grib1/section.2.def

101 lines
2.5 KiB
Modula-2
Raw Normal View History

2013-03-25 12:04:10 +00:00
# START grib1::section
# SECTION 2, Grid description section
# Length of section
position offsetSection2;
section_length[3] section2Length ;
2013-03-25 12:04:10 +00:00
meta section2Pointer section_pointer(offsetSection2,section2Length,2);
transient radius=6367470;
alias radiusOfTheEarth=radius;
alias radiusInMetres=radius;
2020-07-19 17:18:55 +00:00
transient shapeOfTheEarth=0: hidden; #ECC-811
2013-03-25 12:04:10 +00:00
# NV -- number of vertical coordinate parameters
unsigned[1] numberOfVerticalCoordinateValues : dump ;
constant neitherPresent = 255;
alias NV = numberOfVerticalCoordinateValues;
alias numberOfCoordinatesValues= numberOfVerticalCoordinateValues;
# PV -- location
# (octet number)
unsigned[1] pvlLocation = 255;
# Data representation type
codetable[1] dataRepresentationType 'grib1/6.table' = 0;
meta gridDefinitionDescription codetable_title(dataRepresentationType);
2013-03-25 12:04:10 +00:00
# Grid definition
# (according to data representation type - octet 6 above)
2020-03-14 12:20:54 +00:00
alias isRotatedGrid=zero;
2013-03-25 12:04:10 +00:00
if (dataRepresentationType < 192)
{
2015-08-13 14:04:31 +00:00
template dataRepresentation "grib1/grid_definition_[dataRepresentationType:l].def";
2013-03-25 12:04:10 +00:00
}
else
{
2015-08-13 14:04:31 +00:00
template dataRepresentation "grib1/grid_definition_[dataRepresentationType:l].[centre:l].def";
2013-03-25 12:04:10 +00:00
}
position endGridDefinition;
position offsetBeforePV;
transient PVPresent = ( NV > 0);
if (pvlLocation != neitherPresent)
{
2015-08-13 14:04:31 +00:00
padto padding_sec2_2(offsetSection2 + pvlLocation - 1);
2013-03-25 12:04:10 +00:00
} else {
2015-08-13 14:04:31 +00:00
padto padding_sec2_2(offsetSection2 + 32 );
2013-03-25 12:04:10 +00:00
}
if(PVPresent )
{
ibmfloat pv[NV] : dump;
alias vertical.pv=pv;
}
position offsetBeforePL;
transient PLPresent = (section2Length > (offsetBeforePL - offsetSection2))
&& (section2Length >= (Nj * 2 + offsetBeforePL - offsetSection2)) ;
if(PLPresent)
{
# For grib 1 -> 2
2015-08-13 14:04:31 +00:00
constant numberOfOctectsForNumberOfPoints = 2;
constant interpretationOfNumberOfPoints = 1;
2013-03-25 12:04:10 +00:00
unsigned[2] pl[Nj] : dump;
alias geography.pl=pl;
}
if(PVPresent == 0 && PLPresent == 0)
{
# pad to the end of the grid definiton as in documentation
# ( gribex compatibility )
padto padding_sec2_1(offsetSection2 + 32);
}
#when (PVPresent == 0) { set NV = 0;}
when ((PVPresent == 1) or (PLPresent==1)) {
set pvlLocation = offsetBeforePV - offsetSection2 + 1;
}
when ((PVPresent == 0) and (PLPresent==0)) { set pvlLocation = 255; }
alias reducedGrid = PLPresent;
2014-09-29 17:03:49 +00:00
# GRIB-534: To easily remove vertical coordinates, set this key to 1
concept_nofail deletePV(unknown) {
"1" = { PVPresent=0; NV=0; }
}
2013-03-25 12:04:10 +00:00
padtoeven padding_sec2_3(offsetSection2,section2Length);
meta md5Section2 md5(offsetSection2,section2Length);
alias md5GridSection = md5Section2;