示例#1
0
 /**
  * Eastern Longitude
  *
  * @return Eastern Longitude
  */
 public final float getEastLongitude() {
   if (length > 72 && ((getType() == 4) || (getType() == 5))) {
     return GribNumbers.int3(getOctet(71), getOctet(72), getOctet(73)) / 1000;
   } else {
     return GribNumbers.UNDEFINED;
   }
 }
示例#2
0
 /**
  * Western Longitude
  *
  * @return Western Longitude
  */
 public final float getWestLongitude() {
   if (length > 75 && ((getType() == 4) || (getType() == 5))) {
     return GribNumbers.int3(getOctet(74), getOctet(75), getOctet(76)) / 1000;
   } else {
     return GribNumbers.UNDEFINED;
   }
 }
示例#3
0
 /**
  * Northern latitude
  *
  * @return Northern latitude
  */
 public final float getNorthLatitude() {
   if (length > 66 && ((getType() == 4) || (getType() == 5))) {
     return GribNumbers.int3(getOctet(65), getOctet(66), getOctet(67)) / 1000;
   } else {
     return GribNumbers.UNDEFINED;
   }
 }
示例#4
0
 /**
  * Southern latitude
  *
  * @return Southern latitude
  */
 public final float getSouthLatitude() {
   if (length > 69 && ((getType() == 4) || (getType() == 5))) {
     return GribNumbers.int3(getOctet(68), getOctet(69), getOctet(70)) / 1000;
   } else {
     return GribNumbers.UNDEFINED;
   }
 }
示例#5
0
 /**
  * upper limit of probability
  *
  * @return ID
  */
 public final float getValueUpperLimit() {
   if (length > 54 && ((getParameterNumber() == 191) || (getParameterNumber() == 192))) {
     return GribNumbers.float4(getOctet(52), getOctet(53), getOctet(54), getOctet(55));
   } else {
     return GribNumbers.UNDEFINED;
   }
 }
示例#6
0
 /**
  * lower limit of probability
  *
  * @return ID
  */
 public final float getValueLowerLimit() {
   if (length > 50 && ((getParameterNumber() == 191) || (getParameterNumber() == 192))) {
     return GribNumbers.float4(getOctet(48), getOctet(49), getOctet(50), getOctet(51));
   } else {
     return GribNumbers.UNDEFINED;
   }
 }
示例#7
0
  /**
   * Constructs Grib1PDSVariables from a byte[].
   *
   * @param input PDS
   * @param cal use this calendar to set the date
   * @throws java.io.IOException byte[] read
   */
  public Grib1Pds(byte[] input, Calendar cal) throws IOException {
    this.input = input;
    this.length = GribNumbers.int3(getOctet(1), getOctet(2), getOctet(3));
    this.level = new GribPDSLevel(getOctet(10), getOctet(11), getOctet(12));

    // calculate the reference date
    // octet 25
    int century = getOctet(25) - 1;
    if (century == -1) century = 20;
    // octets 13-17 (base time for reference time)
    int year = getOctet(13);
    int month = getOctet(14);
    int day = getOctet(15);
    int hour = getOctet(16);
    int minute = getOctet(17);

    cal.clear();
    cal.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
    cal.set(Calendar.DST_OFFSET, 0);
    cal.set((century * 100 + year), month - 1, day, hour, minute, 0);
    refTime = cal.getTimeInMillis();

    // calculate the valid date
    int type = 1;
    int factor = 1;
    switch (getTimeUnit()) {
      case 0:
        type = Calendar.MINUTE;
        break;
      case 1:
        type = Calendar.HOUR_OF_DAY;
        break;
      case 2:
        type = Calendar.HOUR_OF_DAY;
        factor = 24;
        break;
      case 3:
        type = Calendar.MONTH;
        break;
      case 4:
        type = Calendar.YEAR;
        break;
      case 5:
        type = Calendar.YEAR;
        factor = 10;
        break;
      case 6:
        type = Calendar.YEAR;
        factor = 30;
        break;
      case 7:
        type = Calendar.YEAR;
        factor = 100;
        break;
      case 10:
        type = Calendar.HOUR_OF_DAY;
        factor = 3;
        break;
      case 11:
        type = Calendar.HOUR_OF_DAY;
        factor = 6;
        break;
      case 12:
        type = Calendar.HOUR_OF_DAY;
        factor = 12;
        break;
      default:
        throw new IllegalArgumentException("Unknown timeUnit= " + getTimeUnit());
    }
    cal.add(type, factor * getForecastTime());
    validTime = cal.getTimeInMillis();
  }
示例#8
0
 /**
  * Stream.
  *
  * @return Stream.
  */
 public final int getStream() {
   return GribNumbers.int2(getOctet(44), getOctet(45));
 }
示例#9
0
 /**
  * Get the exponent of the decimal scale used for all data values.
  *
  * @return exponent of decimal scale
  */
 public final int getDecimalScale() {
   return GribNumbers.int2(getOctet(27), getOctet(28));
 }
示例#10
0
 /**
  * Number Included In Average, octet 22 & 23
  *
  * @return Number Included In Average
  */
 public final int getNumberIncludedInAverage() {
   return GribNumbers.int2(getOctet(22), getOctet(23));
 }
示例#11
0
 /**
  * Period of time, octet 19 in units of getTimeRangeUnit()
  *
  * @return P1
  */
 public final int getP1() {
   if (getTimeRangeIndicator() == 10) return GribNumbers.int2(getOctet(19), getOctet(20));
   return getOctet(19);
 }