cdm/src/main/java/ucar/unidata/geoloc/projection/LambertAzimuthalEqualArea.java
public float[][] latLonToProj(float[][] from, float[][] to, int latIndex,
                                int lonIndex) {
    int cnt = from[0].length;
    float[] fromLatA = from[latIndex];
    float[] fromLonA = from[lonIndex];
    float[] resultXA = to[INDEX_X];
    float[] resultYA = to[INDEX_Y];
    double toX, toY;

    for (int i = 0; i < cnt; i++) {
      double fromLat = fromLatA[i];
      double fromLon = fromLonA[i];

      fromLat = Math.toRadians(fromLat);
      double lonDiff = Math.toRadians(LatLonPointImpl.lonNormal(fromLon
              - lon0Degrees));
      double g = sinLat0 * Math.sin(fromLat)
              + cosLat0 * Math.cos(fromLat) * Math.cos(lonDiff);

      double kPrime = Math.sqrt(2 / (1 + g));
      toX = R * kPrime * Math.cos(fromLat) * Math.sin(lonDiff)
              + falseEasting;
      toY = R * kPrime
              * (cosLat0 * Math.sin(fromLat)
              - sinLat0 * Math.cos(fromLat)
              * Math.cos(lonDiff)) + falseNorthing;

      resultXA[i] = (float) toX;
      resultYA[i] = (float) toY;
    }
    return to;
  }
public float[][] latLonToProj(float[][] from, float[][] to, int latIndex,
                                int lonIndex) {
    int cnt = from[0].length;
    float[] fromLatA = from[latIndex];
    float[] fromLonA = from[lonIndex];
    float[] resultXA = to[INDEX_X];
    float[] resultYA = to[INDEX_Y];
    double toX, toY;

    for (int i = 0; i < cnt; i++) {
      double fromLat = fromLatA[i];
      double fromLon = fromLonA[i];

      fromLat = Math.toRadians(fromLat);
      double lonDiff = Math.toRadians(LatLonPointImpl.lonNormal(fromLon
              - lon0Degrees));
      double g = sinLat0 * Math.sin(fromLat)
              + cosLat0 * Math.cos(fromLat) * Math.cos(lonDiff);

      double kPrime = Math.sqrt(2 / (1 + g));
      toX = R * kPrime * Math.cos(fromLat) * Math.sin(lonDiff)
              + falseEasting;
      toY = R * kPrime
              * (cosLat0 * Math.sin(fromLat)
              - sinLat0 * Math.cos(fromLat)
              * Math.cos(lonDiff)) + falseNorthing;

      resultXA[i] = (float) toX;
      resultYA[i] = (float) toY;
    }
    return to;
  }
Convert lat/lon coordinates to projection coordinates.

@param from     array of lat/lon coordinates: from[2][n],
where from[0][i], from[1][i] is the (lat,lon)
coordinate of the ith point
@param to       resulting array of projection coordinates,
where to[0][i], to[1][i] is the (x,y) coordinate
of the ith point
@param latIndex index of latitude in "from"
@param lonIndex index of longitude in "from"
@return the "to" array.