# (C) Copyright 2005- ECMWF.

# START 2/template.3.140 ----------------------------------------------------------------------
# TEMPLATE 3.140, Lambert azimuthal equal area projection
include "grib3/template.3.shape_of_the_earth.def";

#  Nx - number of points along X-axis
unsigned[4] numberOfPointsAlongXAxis : dump  ;
alias Nx  = numberOfPointsAlongXAxis;

#  Ny - number of points along Y-axis
unsigned[4] numberOfPointsAlongYAxis : dump  ;
alias Ny =  numberOfPointsAlongYAxis;

#  La1 - latitude of first grid point
signed[4] latitudeOfFirstGridPoint: edition_specific ;
alias La1 =  latitudeOfFirstGridPoint;
meta  geography.latitudeOfFirstGridPointInDegrees   scale(latitudeOfFirstGridPoint
                                                 ,one,grib3divider,truncateDegrees) : dump;
#meta latitudeOfFirstGridPointInMicrodegrees times(latitudeOfFirstGridPoint,mAngleMultiplier,angleDivisor): no_copy;

#  Lo1 - longitude of first grid point
signed[4] longitudeOfFirstGridPoint: edition_specific ;
alias La1 =  longitudeOfFirstGridPoint;
meta  geography.longitudeOfFirstGridPointInDegrees   scale(longitudeOfFirstGridPoint
                                                 ,one,grib3divider,truncateDegrees) : dump;
#meta longitudeOfFirstGridPointInMicrodegrees times(longitudeOfFirstGridPoint,mAngleMultiplier,angleDivisor) : no_copy;

signed[4] standardParallelInMicrodegrees  : dump;
alias standardParallel=standardParallelInMicrodegrees;

signed[4] centralLongitudeInMicrodegrees  : dump;
alias centralLongitude=centralLongitudeInMicrodegrees;

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

#  Dx - X-direction grid length in millimetres
unsigned[4] xDirectionGridLengthInMillimetres  : dump ;
alias Dx  = xDirectionGridLengthInMillimetres ;

#  Dy - Y-direction grid length in millimetres
unsigned[4] yDirectionGridLengthInMillimetres  : dump ;
alias Dy  = yDirectionGridLengthInMillimetres ;

include "grib3/template.4.scanning_mode.def";

iterator lambert_azimuthal_equal_area(numberOfPoints,missingValue,values,
          radius,Nx,Ny,
          latitudeOfFirstGridPointInDegrees,longitudeOfFirstGridPointInDegrees,
          standardParallel,centralLongitude,
          Dx,Dy,
          iScansNegatively,
          jScansPositively,
          jPointsAreConsecutive,
          alternativeRowScanning);

meta latLonValues latlonvalues(values);
alias latitudeLongitudeValues=latLonValues;
meta latitudes latitudes(values,0);
meta longitudes longitudes(values,0);

# END   2/template.3.140 ----------------------------------------------------------------------
