cdm/src/main/java/ucar/unidata/geoloc/projection/AlbersEqualArea.java
public double[][] latLonToProj(double[][] from, double[][] to,
                                 int latIndex, int lonIndex) {
    int cnt = from[0].length;
    double[] fromLatA = from[latIndex];
    double[] fromLonA = from[lonIndex];
    double[] resultXA = to[INDEX_X];
    double[] 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);
      fromLon = Math.toRadians(fromLon);
      double rho = computeRho(fromLat);
      double theta = computeTheta(fromLon);

      toX = rho * Math.sin(theta);
      toY = rho0 - rho * Math.cos(theta);

      resultXA[i] = toX + falseEasting;
      resultYA[i] = toY + falseNorthing;
    }
    return to;
  }
public double[][] latLonToProj(double[][] from, double[][] to,
                                 int latIndex, int lonIndex) {
    int cnt = from[0].length;
    double[] fromLatA = from[latIndex];
    double[] fromLonA = from[lonIndex];
    double[] resultXA = to[INDEX_X];
    double[] 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);
      fromLon = Math.toRadians(fromLon);
      double rho = computeRho(fromLat);
      double theta = computeTheta(fromLon);

      toX = rho * Math.sin(theta);
      toY = rho0 - rho * Math.cos(theta);

      resultXA[i] = toX + falseEasting;
      resultYA[i] = toY + falseNorthing;
    }
    return to;
  }
public double [ ] [ ] latLonToProj ( double [ ] [ ] from , double [ ] [ ] to , int latIndex , int lonIndex ) { int cnt = from [ 0 ] . length ; double [ ] fromLatA = from [ latIndex ] ; double [ ] fromLonA = from [ lonIndex ] ; double [ ] resultXA = to [ INDEX_X ] ; double [ ] 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 ) ; fromLon = Math . toRadians ( fromLon ) ; double rho = computeRho ( fromLat ) ; double theta = computeTheta ( fromLon ) ; toX = rho * Math . sin ( theta ) ; toY = rho0 - rho * Math . cos ( theta ) ; resultXA [ i ] = toX + falseEasting ; resultYA [ i ] = toY + falseNorthing ; } 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.
Convert lat / lon coordinates to projection coordinates .