cdm/src/main/java/ucar/unidata/geoloc/projection/LambertConformal.java
public float[][] projToLatLon(float[][] from, float[][] to) {
    int cnt = from[0].length;
    float[] fromXA = from[INDEX_X];
    float[] fromYA = from[INDEX_Y];
    float[] toLatA = to[INDEX_LAT];
    float[] toLonA = to[INDEX_LON];
    double toLat, toLon;
    for (int i = 0; i < cnt; i++) {
      double fromX = fromXA[i] - falseEasting;
      double fromY = fromYA[i] - falseNorthing;
      double rhop = rho;

      if (n < 0) {
        rhop *= -1.0;
        fromX *= -1.0;
        fromY *= -1.0;
      }

      double yd = (rhop - fromY);
      double theta = Math.atan2(fromX, yd);
      double r = Math.sqrt(fromX * fromX + yd * yd);
      if (n < 0.0) {
        r *= -1.0;
      }

      toLon = (Math.toDegrees(theta / n + lon0));

      if (Math.abs(r) < TOLERANCE) {
        toLat = ((n < 0.0)
                ? -90.0
                : 90.0);
      } else {
        double rn = Math.pow(earth_radius * F / r, 1 / n);
        toLat = Math.toDegrees(2.0 * Math.atan(rn) - Math.PI / 2);
      }

      toLatA[i] = (float) toLat;
      toLonA[i] = (float) toLon;
    }
    return to;
  }
public float[][] projToLatLon(float[][] from, float[][] to) {
    int cnt = from[0].length;
    float[] fromXA = from[INDEX_X];
    float[] fromYA = from[INDEX_Y];
    float[] toLatA = to[INDEX_LAT];
    float[] toLonA = to[INDEX_LON];
    double toLat, toLon;
    for (int i = 0; i < cnt; i++) {
      double fromX = fromXA[i] - falseEasting;
      double fromY = fromYA[i] - falseNorthing;
      double rhop = rho;

      if (n < 0) {
        rhop *= -1.0;
        fromX *= -1.0;
        fromY *= -1.0;
      }

      double yd = (rhop - fromY);
      double theta = Math.atan2(fromX, yd);
      double r = Math.sqrt(fromX * fromX + yd * yd);
      if (n < 0.0) {
        r *= -1.0;
      }

      toLon = (Math.toDegrees(theta / n + lon0));

      if (Math.abs(r) < TOLERANCE) {
        toLat = ((n < 0.0)
                ? -90.0
                : 90.0);
      } else {
        double rn = Math.pow(earth_radius * F / r, 1 / n);
        toLat = Math.toDegrees(2.0 * Math.atan(rn) - Math.PI / 2);
      }

      toLatA[i] = (float) toLat;
      toLonA[i] = (float) toLon;
    }
    return to;
  }
public float [ ] [ ] projToLatLon ( float [ ] [ ] from , float [ ] [ ] to ) { int cnt = from [ 0 ] . length ; float [ ] fromXA = from [ INDEX_X ] ; float [ ] fromYA = from [ INDEX_Y ] ; float [ ] toLatA = to [ INDEX_LAT ] ; float [ ] toLonA = to [ INDEX_LON ] ; double toLat , toLon ; for ( int i = 0 ; i < cnt ; i ++ ) { double fromX = fromXA [ i ] - falseEasting ; double fromY = fromYA [ i ] - falseNorthing ; double rhop = rho ; if ( n < 0 ) { rhop *= - 1.0 ; fromX *= - 1.0 ; fromY *= - 1.0 ; } double yd = ( rhop - fromY ) ; double theta = Math . atan2 ( fromX , yd ) ; double r = Math . sqrt ( fromX * fromX + yd * yd ) ; if ( n < 0.0 ) { r *= - 1.0 ; } toLon = ( Math . toDegrees ( theta / n + lon0 ) ) ; if ( Math . abs ( r ) < TOLERANCE ) { toLat = ( ( n < 0.0 ) ? - 90.0 : 90.0 ) ; } else { double rn = Math . pow ( earth_radius * F / r , 1 / n ) ; toLat = Math . toDegrees ( 2.0 * Math . atan ( rn ) - Math . PI / 2 ) ; } toLatA [ i ] = ( float ) toLat ; toLonA [ i ] = ( float ) toLon ; } return to ; }
Convert projection coordinates to lat/lon coordinate.

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