visad/src/main/java/ucar/nc2/iosp/grid/GridHorizCoordSys.java
private double setLatLonDxDy() {
    double lo1 = gds.getDouble(GridDefRecord.LO1);
    double la1 = gds.getDouble(GridDefRecord.LA1);
    double lo2 = gds.getDouble(GridDefRecord.LO2);
    double la2 = gds.getDouble(GridDefRecord.LA2);
    if (Double.isNaN(lo2) || Double.isNaN(la2)) {
      return Double.NaN;
    }
    if (lo2 < lo1) lo2 += 360;
    double dx = Math.abs(lo2 - lo1)
        / (gds.getInt(GridDefRecord.NX) - 1);
    double dy = Math.abs(la2 - la1)
        / (gds.getInt(GridDefRecord.NY) - 1);
    gds.addParam(GridDefRecord.DX, String.valueOf(dx));
    gds.addParam(GridDefRecord.DY, String.valueOf(dy));
    // in case someone checked on these before, we need to override
    gds.addParam(GridDefRecord.DX, new Double(dx));
    gds.addParam(GridDefRecord.DY, new Double(dy));
    gds.addParam(GridDefRecord.GRID_UNITS, "degree");

    return dy;
  }
private double setLatLonDxDy() {
    double lo1 = gds.getDouble(GridDefRecord.LO1);
    double la1 = gds.getDouble(GridDefRecord.LA1);
    double lo2 = gds.getDouble(GridDefRecord.LO2);
    double la2 = gds.getDouble(GridDefRecord.LA2);
    if (Double.isNaN(lo2) || Double.isNaN(la2)) {
      return Double.NaN;
    }
    if (lo2 < lo1) lo2 += 360;
    double dx = Math.abs(lo2 - lo1)
        / (gds.getInt(GridDefRecord.NX) - 1);
    double dy = Math.abs(la2 - la1)
        / (gds.getInt(GridDefRecord.NY) - 1);
    gds.addParam(GridDefRecord.DX, String.valueOf(dx));
    gds.addParam(GridDefRecord.DY, String.valueOf(dy));
    // in case someone checked on these before, we need to override
    gds.addParam(GridDefRecord.DX, new Double(dx));
    gds.addParam(GridDefRecord.DY, new Double(dy));
    gds.addParam(GridDefRecord.GRID_UNITS, "degree");

    return dy;
  }
private double setLatLonDxDy ( ) { double lo1 = gds . getDouble ( GridDefRecord . LO1 ) ; double la1 = gds . getDouble ( GridDefRecord . LA1 ) ; double lo2 = gds . getDouble ( GridDefRecord . LO2 ) ; double la2 = gds . getDouble ( GridDefRecord . LA2 ) ; if ( Double . isNaN ( lo2 ) || Double . isNaN ( la2 ) ) { return Double . NaN ; } if ( lo2 < lo1 ) lo2 += 360 ; double dx = Math . abs ( lo2 - lo1 ) / ( gds . getInt ( GridDefRecord . NX ) - 1 ) ; double dy = Math . abs ( la2 - la1 ) / ( gds . getInt ( GridDefRecord . NY ) - 1 ) ; gds . addParam ( GridDefRecord . DX , String . valueOf ( dx ) ) ; gds . addParam ( GridDefRecord . DY , String . valueOf ( dy ) ) ; // in case someone checked on these before, we need to override gds . addParam ( GridDefRecord . DX , new Double ( dx ) ) ; gds . addParam ( GridDefRecord . DY , new Double ( dy ) ) ; gds . addParam ( GridDefRecord . GRID_UNITS , "degree" ) ; return dy ; }
Calculate  Dx Dy Lat Lon Grid
Note: this assumes lo1 < lo2 and dx is positive going east
@return dy double
Calculate Dx Dy Lat Lon Grid Note : this assumes lo1 < lo2 and dx is positive going east