ui/src/main/java/ucar/nc2/ui/coverage2/CoverageRenderer.java
private GeoReferencedArray readHSlice(int level, int time, int ensemble, int runtime) {

    /* make sure x, y exists
    CoverageCS gcs = useG.getCoordinateSystem();
    CoordinateAxis xaxis = gcs.getXHorizAxis();
    CoordinateAxis yaxis = gcs.getYHorizAxis();
    if ((xaxis == null) || (yaxis == null))    // doesnt exist
      return null;
    if ((xaxis.getSize() <= 1) || (yaxis.getSize() <= 1)) // LOOK ??
      return null;   */

    // make sure we need new one
    if (dataState.grid.equals(lastGrid) && (time == lastTime) && (level == lastLevel) && (horizStride == lastStride)
            && (ensemble == lastEnsemble) && (runtime == lastRunTime))
      return dataH; // nothing changed

    // get the data slice
    //dataH = useG.readDataSlice(runtime, ensemble, time, level, -1, -1);
    SubsetParams subset = new SubsetParams();
    if (level >= 0 && dataState.zaxis != null) {
      double levelVal = dataState.zaxis.getCoordMidpoint(level);
      subset.set(SubsetParams.vertCoord, levelVal);
    }
    if (time >= 0 && dataState.taxis != null) {
      double timeVal = dataState.taxis.getCoordMidpoint(time);
      CalendarDate date = dataState.taxis.makeDate(timeVal);
      subset.set(SubsetParams.time, date);
    }
    if (runtime >= 0 && dataState.rtaxis != null) {
      double rtimeVal = dataState.rtaxis.getCoordMidpoint(runtime);
      CalendarDate date = dataState.rtaxis.makeDate(rtimeVal);
      subset.set(SubsetParams.runtime, date);
    }
    if (ensemble >= 0 && dataState.ensaxis != null) {
      double ensVal = dataState.ensaxis.getCoordMidpoint(ensemble);
      subset.set(SubsetParams.ensCoord, ensVal);
    }
    if (horizStride != 1)
      subset.setHorizStride( horizStride);

    try {
      dataH = dataState.grid.readData(subset);
      geodata = dataH.getData().reduce(); // get rid of n=1 dimensions

    } catch (IOException | InvalidRangeException e) {
      e.printStackTrace();
    }

    lastGrid = dataState.grid;
    lastTime = time;
    lastLevel = level;
    lastEnsemble = ensemble;
    lastRunTime = runtime;
    lastStride = horizStride;

    /*
    CoordinateAxis1D zaxis = gcs.getVerticalAxis();
    if ((zaxis == null) || (zaxis.getSize() < 1)) {
      dataH = dataVolume;  // volume is xy plane
    } else {
      dataH = dataVolume.slice(0, level);  // if z exists, always first (logical) dimension
    }

    if (debugArrayShape) {
      System.out.println("Horiz shape = ");
      for (int i = 0; i < dataH.getRank(); i++)
        System.out.println("   shape = " + dataH.getShape()[i]);
    } */

    return dataH;
  }
private GeoReferencedArray readHSlice(int level, int time, int ensemble, int runtime) {

    /* make sure x, y exists
    CoverageCS gcs = useG.getCoordinateSystem();
    CoordinateAxis xaxis = gcs.getXHorizAxis();
    CoordinateAxis yaxis = gcs.getYHorizAxis();
    if ((xaxis == null) || (yaxis == null))    // doesnt exist
      return null;
    if ((xaxis.getSize() <= 1) || (yaxis.getSize() <= 1)) // LOOK ??
      return null;   */

    // make sure we need new one
    if (dataState.grid.equals(lastGrid) && (time == lastTime) && (level == lastLevel) && (horizStride == lastStride)
            && (ensemble == lastEnsemble) && (runtime == lastRunTime))
      return dataH; // nothing changed

    // get the data slice
    //dataH = useG.readDataSlice(runtime, ensemble, time, level, -1, -1);
    SubsetParams subset = new SubsetParams();
    if (level >= 0 && dataState.zaxis != null) {
      double levelVal = dataState.zaxis.getCoordMidpoint(level);
      subset.set(SubsetParams.vertCoord, levelVal);
    }
    if (time >= 0 && dataState.taxis != null) {
      double timeVal = dataState.taxis.getCoordMidpoint(time);
      CalendarDate date = dataState.taxis.makeDate(timeVal);
      subset.set(SubsetParams.time, date);
    }
    if (runtime >= 0 && dataState.rtaxis != null) {
      double rtimeVal = dataState.rtaxis.getCoordMidpoint(runtime);
      CalendarDate date = dataState.rtaxis.makeDate(rtimeVal);
      subset.set(SubsetParams.runtime, date);
    }
    if (ensemble >= 0 && dataState.ensaxis != null) {
      double ensVal = dataState.ensaxis.getCoordMidpoint(ensemble);
      subset.set(SubsetParams.ensCoord, ensVal);
    }
    if (horizStride != 1)
      subset.setHorizStride( horizStride);

    try {
      dataH = dataState.grid.readData(subset);
      geodata = dataH.getData().reduce(); // get rid of n=1 dimensions

    } catch (IOException | InvalidRangeException e) {
      e.printStackTrace();
    }

    lastGrid = dataState.grid;
    lastTime = time;
    lastLevel = level;
    lastEnsemble = ensemble;
    lastRunTime = runtime;
    lastStride = horizStride;

    /*
    CoordinateAxis1D zaxis = gcs.getVerticalAxis();
    if ((zaxis == null) || (zaxis.getSize() < 1)) {
      dataH = dataVolume;  // volume is xy plane
    } else {
      dataH = dataVolume.slice(0, level);  // if z exists, always first (logical) dimension
    }

    if (debugArrayShape) {
      System.out.println("Horiz shape = ");
      for (int i = 0; i < dataH.getRank(); i++)
        System.out.println("   shape = " + dataH.getShape()[i]);
    } */

    return dataH;
  }
/* get an x,y,z data volume for the given time
private void makeDataVolume( GridDatatype g, int time) {
try {
dataVolume = g.readVolumeData( time);
} catch (java.io.IOException e) {
System.out.println("Error reading netcdf file "+e);
dataVolume = null;
}
lastGrid = g;
lastTime = time;
lastLevel = -1;  // invalidate
lastSlice = -1;  // invalidate
dataVolumeChanged = true;
}