cdm/src/main/java/ucar/nc2/ft2/coverage/writer/CFGridCoverageWriter2.java
private boolean shouldAddLatLon2D(boolean tryToAddLatLon2D, CoverageCollection subsetDataset) {
    if (!tryToAddLatLon2D) {  // We don't even want 2D lat/lon vars.
      return false;
    }

    HorizCoordSys horizCoordSys = subsetDataset.getHorizCoordSys();
    if (horizCoordSys.isLatLon2D()) {  // We already have 2D lat/lon vars.
      return false;
    }
    if (!horizCoordSys.isProjection()) {  // CRS doesn't contain a projection, meaning we can't calc 2D lat/lon vars.
      return false;
    }

    Projection proj = horizCoordSys.getTransform().getProjection();
    if (proj instanceof LatLonProjection) {  // Projection is a "fake"; we already have lat/lon.
      return false;
    }

    return true;
  }
private boolean shouldAddLatLon2D(boolean tryToAddLatLon2D, CoverageCollection subsetDataset) {
    if (!tryToAddLatLon2D) {  // We don't even want 2D lat/lon vars.
      return false;
    }

    HorizCoordSys horizCoordSys = subsetDataset.getHorizCoordSys();
    if (horizCoordSys.isLatLon2D()) {  // We already have 2D lat/lon vars.
      return false;
    }
    if (!horizCoordSys.isProjection()) {  // CRS doesn't contain a projection, meaning we can't calc 2D lat/lon vars.
      return false;
    }

    Projection proj = horizCoordSys.getTransform().getProjection();
    if (proj instanceof LatLonProjection) {  // Projection is a "fake"; we already have lat/lon.
      return false;
    }

    return true;
  }
private boolean shouldAddLatLon2D ( boolean tryToAddLatLon2D , CoverageCollection subsetDataset ) { if ( ! tryToAddLatLon2D ) { // We don't even want 2D lat/lon vars. return false ; } HorizCoordSys horizCoordSys = subsetDataset . getHorizCoordSys ( ) ; if ( horizCoordSys . isLatLon2D ( ) ) { // We already have 2D lat/lon vars. return false ; } if ( ! horizCoordSys . isProjection ( ) ) { // CRS doesn't contain a projection, meaning we can't calc 2D lat/lon vars. return false ; } Projection proj = horizCoordSys . getTransform ( ) . getProjection ( ) ; if ( proj instanceof LatLonProjection ) { // Projection is a "fake"; we already have lat/lon. return false ; } return true ; }
Returns {@code true} if we should add 2D latitude & longitude variables to the output file.
This method could return {@code false} for several reasons:

<ul>
<li>{@code !tryToAddLatLon2D}</li>
<li>{@code subsetDataset.getHorizCoordSys().isLatLon2D()}</li>
<li>{@code !subsetDataset.getHorizCoordSys().isProjection()}</li>
<li>{@code subsetDataset.getHorizCoordSys() instanceof LatLonProjection}</li>
</ul>

@param tryToAddLatLon2D  attempt to add 2D lat/lon vars to output file.
@param subsetDataset     subsetted version of the original CoverageCollection.
@return  {@code true} if we should add 2D latitude & longitude variables to the output file.
Returns { @code true } if we should add 2D latitude & longitude variables to the output file . This method could return { @code false } for several reasons :