# 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.
#

unsigned[4] Ni : can_be_missing,dump;
alias numberOfPointsAlongAParallel=Ni;
alias Nx = Ni;

unsigned[4] Nj : dump;
alias numberOfPointsAlongAMeridian=Nj;
alias Ny = Nj;

alias geography.Ni=Ni;
alias geography.Nj=Nj;

#  Basic angle of the initial production domain
unsigned[4] basicAngleOfTheInitialProductionDomain = 0;
transient mBasicAngle=basicAngleOfTheInitialProductionDomain*oneMillionConstant;
transient angleMultiplier  = 1;
transient mAngleMultiplier = 1000000;
when (basicAngleOfTheInitialProductionDomain == 0) {
  set angleMultiplier  = 1;
  set mAngleMultiplier = 1000000;
} else {
  set angleMultiplier  = basicAngleOfTheInitialProductionDomain;
  set mAngleMultiplier = mBasicAngle;
}

#  Subdivisions of basic angle used to define extreme longitudes and latitudes, and direction increments
unsigned[4] subdivisionsOfBasicAngle = missing() : can_be_missing;

transient angleDivisor = 1000000;
when (missing(subdivisionsOfBasicAngle) || subdivisionsOfBasicAngle == 0) {
  set angleDivisor  = 1000000;
} else {
  set angleDivisor  = subdivisionsOfBasicAngle;
}

include "grib2/template.3.resolution_flags.def"

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

longitudesList list(Ni) {
    unsigned[4] longitudes;
}

latitudesList list(Nj) {
    signed[4] latitudes;
}

