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

unsigned[2] Nj : can_be_missing,dump;
alias numberOfPointsAlongAMeridian=Nj;
alias Ny = Nj;

# Latitudes and Longitudes of the first and the last points
# Resolution and component flags
include "grib1/grid_first_last_resandcomp.def";

unsigned[2] iDirectionIncrement : can_be_missing, edition_specific;
unsigned[2] jDirectionIncrement : can_be_missing, edition_specific;
alias Dj = jDirectionIncrement;
alias Dy = jDirectionIncrement;
alias Di = iDirectionIncrement;
alias Dx = iDirectionIncrement;

include "grib1/scanning_mode.def";

meta  geography.jDirectionIncrementInDegrees latlon_increment(ijDirectionIncrementGiven,jDirectionIncrement,
  jScansPositively,
  latitudeOfFirstGridPointInDegrees,latitudeOfLastGridPointInDegrees,
  numberOfPointsAlongAMeridian,oneConstant,grib1divider,0) : can_be_missing,dump;

alias DjInDegrees=jDirectionIncrementInDegrees;
alias DyInDegrees=jDirectionIncrementInDegrees;

meta  geography.iDirectionIncrementInDegrees latlon_increment(ijDirectionIncrementGiven,iDirectionIncrement,
  iScansPositively,
  longitudeOfFirstGridPointInDegrees,longitudeOfLastGridPointInDegrees,
  Ni,oneConstant,grib1divider,1) : can_be_missing,dump;
alias DiInDegrees=iDirectionIncrementInDegrees;
alias DxInDegrees=iDirectionIncrementInDegrees;

meta numberOfDataPoints number_of_points(Ni,Nj,PLPresent,pl) : dump;
alias numberOfPoints=numberOfDataPoints;
meta numberOfValues number_of_values(values,bitsPerValue,numberOfDataPoints,
                            bitmapPresent,bitmap,numberOfCodedValues) : dump;
#alias ls.valuesCount=numberOfValues;

if(missing(Ni)){
   iterator latlon_reduced(numberOfPoints,missingValue,values,
        latitudeFirstInDegrees,longitudeFirstInDegrees,
        latitudeLastInDegrees,longitudeLastInDegrees,
      Nj,DjInDegrees,pl);
   nearest latlon_reduced(values,radius,Nj,pl,longitudeFirstInDegrees,longitudeLastInDegrees);
} else {
   transient iteratorDisableUnrotate = 0 : hidden; # ECC-808
   iterator latlon(numberOfPoints,missingValue,values,longitudeFirstInDegrees,
                   DiInDegrees ,Ni,Nj,iScansNegatively ,
                   latitudeFirstInDegrees,DjInDegrees,
                   jScansPositively,jPointsAreConsecutive,
                   isRotatedGrid, angleOfRotation,
                   latitudeOfSouthernPoleInDegrees,longitudeOfSouthernPoleInDegrees);
   nearest regular(values,radius,Ni,Nj);
}


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