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

# TEMPLATE 3.120, Azimuth-range projection
#  Nb - number of data bins along radials (A data bin is a data point representing the volume centred on it)
unsigned[4] numberOfDataBinsAlongRadials ;
alias Nb =  numberOfDataBinsAlongRadials;

#  Nr - number of radials
unsigned[4] numberOfRadials ;
alias Nr  = numberOfRadials;

#  La1 - latitude of centre point
signed[4] latitudeOfCenterPoint ;
alias La1 =  latitudeOfCenterPoint;
meta  geography.latitudeOfCenterPointInDegrees
        scale(latitudeOfCenterPoint,one,grib2divider,truncateDegrees) : dump;
alias La1InDegrees=latitudeOfCenterPointInDegrees;

#  Lo1 - longitude of centre point
unsigned[4] longitudeOfCenterPoint ;
alias Lo1 =  longitudeOfCenterPoint;
meta  geography.longitudeOfCenterPointInDegrees
        scale(longitudeOfCenterPoint,one,grib2divider,truncateDegrees) : dump;
alias Lo1InDegrees=longitudeOfCenterPointInDegrees;

#  Dx - spacing of bins along radials
unsigned[4] spacingOfBinsAlongRadials ;
alias Dx  = spacingOfBinsAlongRadials;

#  Dstart - offset from origin to inner bound
unsigned[4] offsetFromOriginToInnerBound ;
alias Dstart =  offsetFromOriginToInnerBound;

include "grib2/template.3.scanning_mode.def";

# Octets 40-(39+4Nr) : For each of Nr radials:
radials list(numberOfRadials){
  # Azi - starting azimuth, degrees x 10 (degrees as north)
  signed[2] startingAzimuth;
  alias Azi = startingAzimuth;
  # Adelta - azimuthal width, degrees x 100 (+ clockwise, - counterclockwise)
  signed[2] azimuthalWidth;
  alias Adelta = azimuthalWidth;
}
