コード例 #1
0
 // @todo Make sure units are degrees_east
 public double getLongitude(int point) throws IOException // required, units degrees_east
     {
   Array array = null;
   try {
     array = getLongitude(this.getPointRange(point));
   } catch (InvalidRangeException e) {
     IllegalArgumentException iae =
         new IllegalArgumentException(
             "Point <"
                 + point
                 + "> not in valid range <0, "
                 + (this.getNumberPoints() - 1)
                 + ">: "
                 + e.getMessage());
     iae.initCause(e);
     throw iae;
   }
   if (array instanceof ArrayDouble) {
     return (array.getDouble(array.getIndex()));
   } else if (array instanceof ArrayFloat) {
     return (array.getFloat(array.getIndex()));
   } else {
     throw new IOException(
         "Longitude variable not float or double <" + array.getElementType().toString() + ">.");
   }
 }
コード例 #2
0
 // @todo Make sure units are meters
 public double getElevation(int point)
     throws IOException // optional; units meters;  missing = NaN.
     {
   Array array = null;
   try {
     array = getElevation(this.getPointRange(point));
   } catch (InvalidRangeException e) {
     IllegalArgumentException iae =
         new IllegalArgumentException(
             "Point <"
                 + point
                 + "> not in valid range <0, "
                 + (this.getNumberPoints() - 1)
                 + ">: "
                 + e.getMessage());
     iae.initCause(e);
     throw iae;
   }
   if (array instanceof ArrayDouble) {
     return array.getDouble(array.getIndex());
   } else if (array instanceof ArrayFloat) {
     return array.getFloat(array.getIndex());
   } else {
     throw new IOException(
         "Elevation variable not float or double <" + array.getElementType().toString() + ">.");
   }
 }
コード例 #3
0
 public double getTimeValue(int point) throws IOException {
   Array array = null;
   try {
     array = getTime(this.getPointRange(point));
   } catch (InvalidRangeException e) {
     IllegalArgumentException iae =
         new IllegalArgumentException(
             "Point <"
                 + point
                 + "> not in valid range <0, "
                 + (this.getNumberPoints() - 1)
                 + ">: "
                 + e.getMessage());
     iae.initCause(e);
     throw iae;
   }
   if (array instanceof ArrayDouble) {
     return (array.getDouble(array.getIndex()));
   } else if (array instanceof ArrayFloat) {
     return (array.getFloat(array.getIndex()));
   } else if (array instanceof ArrayInt) {
     return (array.getInt(array.getIndex()));
   } else {
     throw new IOException(
         "Time variable not float, double, or integer <"
             + array.getElementType().toString()
             + ">.");
   }
 }
コード例 #4
0
 public Array getData(int point, String parameterName) throws IOException {
   try {
     return (getData(this.getPointRange(point), parameterName));
   } catch (InvalidRangeException e) {
     IllegalArgumentException iae =
         new IllegalArgumentException(
             "Point <"
                 + point
                 + "> not in valid range <0, "
                 + (this.getNumberPoints() - 1)
                 + ">: "
                 + e.getMessage());
     iae.initCause(e);
     throw iae;
   }
 }