[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in GeoGrid.subset



John-

I guess the code is correct if one reads the java doc:

@param z_stride use only if z_range is null, then take all z with this
stride (1 means all)

So, I guess you'd have to use the stride in the Range instead of in
the subset if you wanted to stride a subset of the entire vertical
level.

Don

Don Murray wrote:
John-

In ucar.nc2.dt.GeoGrid, the method:

  public GeoGrid subset(Range t_range, Range z_range, LatLonRect bbox,
int z_stride, int y_stride, int x_stride) throws InvalidRangeException {

does not handle the case where I have a z_range and z_stride.  The code
looks like:

    if ((z_range == null) && (z_stride > 1)) {
      Dimension zdim = getZDimension();
      if (zdim != null)
        z_range = new Range(0, zdim.getLength() - 1, z_stride);
    }

and should probably look like:

    if (z_stride > 1) {
      if (z_range == null) {
        Dimension zdim = getZDimension();
        z_range = new Range( 0, zdim.getLength()-1, z_stride);
      } else {
        z_range= new Range( z_range.first(), z_range.last(), z_stride);
      }
    }

to match the x and y cases.  Right now, if z_range is not null, the
stride is ignored.

Don
*************************************************************
Don Murray                               UCAR Unidata Program
address@hidden                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************


--
*************************************************************
Don Murray                               UCAR Unidata Program
address@hidden                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************