cdm/src/main/java/ucar/nc2/ft2/coverage/CoordAxisHelper.java
int findCoordElement(double[] target, boolean bounded) {
    switch (axis.getSpacing()) {
      case regularInterval:
        // can use midpoint
        return findCoordElementRegular((target[0]+target[1])/2, bounded);
      case contiguousInterval:
        // can use midpoint
        return findCoordElementContiguous((target[0]+target[1])/2, bounded);
      case discontiguousInterval:
        // cant use midpoint
        return findCoordElementDiscontiguousInterval(target, bounded);
    }
    throw new IllegalStateException("unknown spacing" + axis.getSpacing());
  }
int findCoordElement(double[] target, boolean bounded) {
    switch (axis.getSpacing()) {
      case regularInterval:
        // can use midpoint
        return findCoordElementRegular((target[0]+target[1])/2, bounded);
      case contiguousInterval:
        // can use midpoint
        return findCoordElementContiguous((target[0]+target[1])/2, bounded);
      case discontiguousInterval:
        // cant use midpoint
        return findCoordElementDiscontiguousInterval(target, bounded);
    }
    throw new IllegalStateException("unknown spacing" + axis.getSpacing());
  }
int findCoordElement ( double [ ] target , boolean bounded ) { switch ( axis . getSpacing ( ) ) { case regularInterval : // can use midpoint return findCoordElementRegular ( ( target [ 0 ] + target [ 1 ] ) / 2 , bounded ) ; case contiguousInterval : // can use midpoint return findCoordElementContiguous ( ( target [ 0 ] + target [ 1 ] ) / 2 , bounded ) ; case discontiguousInterval : // cant use midpoint return findCoordElementDiscontiguousInterval ( target , bounded ) ; } throw new IllegalStateException ( "unknown spacing" + axis . getSpacing ( ) ) ; }
Given a coordinate interval, find what grid element matches it.
@param target  interval in this coordinate system
@param bounded if true, always return a valid index. otherwise can return < 0 or > n-1
@return index of grid point containing it, or < 0 or > n-1 if outside grid area
Given a coordinate interval find what grid element matches it .