# Copyright 2005-2013 ECMWF.
#
# 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.
#
# 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.
#

# DWD local grid definition 192 - triangular grid base on icosahedron subdivision

# neu 2.33.0
constant isGridded = true;

#  n2 - exponent of 2 for the number of intervals on main triangle sides
unsigned[2] n2  : dump ;
alias exponentOf2ForTheNumberOfIntervalsOnMainTriangleSides = n2;

#  n3 - exponent of 3 for the number of intervals on main triangle sides
unsigned[2] n3 : dump ;
alias exponentOf3ForTheNumberOfIntervalsOnMainTriangleSides = n3;

#  nd - Number of diamonds
unsigned[3] nd : dump ;
alias numberOfDiamonds=nd;
alias Nj=nd;

#  Ni - number of intervals on main triangle sides of the icosahedron
unsigned[3] Ni : dump ;
alias numberOfIntervalsOnMainTriangleSidesOfTheIcosahedron=Ni;

#  Numbering order of diamonds
flags[1] numberingOrderOfDiamonds 'grib1/grid.192.78.3.9.table';

#  Latitude of the pole point of the icosahedron on the sphere
signed[3] latitudeOfIcosahedronPole  : dump ;
alias latitudeOfThePolePointOfTheIcosahedronOnTheSphere=latitudeOfIcosahedronPole;
meta latitudeOfIcosahedronPoleInDegrees   scale(latitudeOfIcosahedronPole ,oneConstant,grib1divider,truncateDegrees) : dump;
alias geography.latitudeOfThePolePointInDegrees=latitudeOfIcosahedronPoleInDegrees;

#  Longitude of the pole point of the icosahedron on the sphere
unsigned[3] longitudeOfIcosahedronPole  : dump ;
alias longitudeOfThePolePointOfTheIcosahedronOnTheSphere=longitudeOfIcosahedronPole;
meta longitudeOfIcosahedronPoleInDegrees   scale(longitudeOfIcosahedronPole ,oneConstant,grib1divider,truncateDegrees) : dump;
alias geography.longitudeOfThePolePointInDegrees=longitudeOfIcosahedronPoleInDegrees;

#  Longitude of the centre line of the first diamond of the icosahedron on the sphere
unsigned[2] longitudeOfFirstDiamondCenterLine  : dump ;
alias longitudeOfTheCenterLineOfTheFirstDiamondOfTheIcosahedronOnTheSphere=longitudeOfFirstDiamondCenterLine;
meta geography.longitudeOfFirstDiamondCenterLineInDegrees   scale(longitudeOfFirstDiamondCenterLine ,oneConstant,grib1divider,truncateDegrees) : dump;

#  Reserved
unsigned[2] reservedOctet;

#  Scanning mode for one diamond
flags[1] scanningModeForOneDiamond 'grib1/grid.192.78.3.10.table';

###########neu###############
unsigned[4] reservedOctets;
###########neu###############

transient numberOfPoints= nd *(Ni + 1) * (Ni + 1);
alias numberOfDataPoints=numberOfPoints;
alias totalNumberOfGridPoints=numberOfPoints;
alias nt=numberOfPoints;
 
meta numberOfValues
number_of_values(values,bitsPerValue,numberOfDataPoints,
                 bitmapPresent,bitmap,numberOfCodedValues) : dump;


