# (C) Copyright 2005- ECMWF.

# TEMPLATE 3.62, Spectral polar stereographic with modelling subdomains definition

transient biFourierMakeTemplate = 0;

include "grib2/templates/template.3.bf.def"

include "grib2/templates/template.3.shape_of_the_earth.def"

#  La1 - latitude of first grid point
signed[4] latitudeOfFirstGridPoint : edition_specific ;
meta geography.latitudeOfFirstGridPointInDegrees scale(latitudeOfFirstGridPoint,oneConstant,grib2divider,truncateDegrees) : dump;
alias La1 =  latitudeOfFirstGridPoint;

#  Lo1 - longitude of first grid point
unsigned[4] longitudeOfFirstGridPoint : edition_specific;
meta geography.longitudeOfFirstGridPointInDegrees scale(longitudeOfFirstGridPoint,oneConstant,grib2divider,truncateDegrees) : dump;
alias Lo1 =  longitudeOfFirstGridPoint;

#  Resolution and component flag
flags[1] resolutionAndComponentFlags 'grib2/tables/[tablesVersion]/3.3.table' : dump;

#  LaD - Latitude where Dx and Dy are specified
signed[4] LaD : edition_specific;
alias latitudeWhereDxAndDyAreSpecified=LaD;
meta geography.LaDInDegrees scale(LaD,oneConstant,grib2divider,truncateDegrees) : dump;
alias latitudeWhereDxAndDyAreSpecifiedInDegrees=LaDInDegrees;

#  LoV - orientation of the grid
#  LoV is the longitude value of the meridian which is parallel to the y-axis (or columns of the grid)
#  along which latitude increases as the y-coordinate increases
signed[4] orientationOfTheGrid : edition_specific;
alias LoV =  orientationOfTheGrid ;
meta geography.orientationOfTheGridInDegrees scale(orientationOfTheGrid,oneConstant,grib2divider,truncateDegrees) : dump;

#  Projection centre flag
flags[1] projectionCentreFlag 'grib2/tables/[tablesVersion]/3.5.table' : dump;
# Note our flagbit numbers go from 7 to 0, while WMO convention is from 1 to 8
# If bit 1 is 0, then the North Pole is on the projection plane
# If bit 1 is 1, then the South Pole is on the projection plane
flagbit southPoleOnProjectionPlane(projectionCentreFlag,7) : dump;   # WMO bit 1
