cdm/src/main/java/ucar/unidata/geoloc/projection/LambertConformal.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 dlon = LatLonPointImpl.lonNormal(fromLon - lon0Degrees);
      double theta = n * Math.toRadians(dlon);
      double tn = Math.pow(Math.tan(PI_OVER_4 + fromLat / 2), n);
      double r = earthRadiusTimesF / tn;
      toX = r * Math.sin(theta);
      toY = rho - r * Math.cos(theta);

      resultXA[i] = (float) (toX + falseEasting);
      resultYA[i] = (float) (toY + falseNorthing);
    }
    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 dlon = LatLonPointImpl.lonNormal(fromLon - lon0Degrees);
      double theta = n * Math.toRadians(dlon);
      double tn = Math.pow(Math.tan(PI_OVER_4 + fromLat / 2), n);
      double r = earthRadiusTimesF / tn;
      toX = r * Math.sin(theta);
      toY = rho - r * Math.cos(theta);

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

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