cdm/src/main/java/ucar/nc2/iosp/sigmet/SigmetIOServiceProvider.java
static float calcData(Map<String, Number> recHdr, short dty, byte data) {
    short[] coef = {1, 2, 3, 4}; // MultiPRF modes
    short multiprf = recHdr.get("multiprf").shortValue();
    float vNyq = recHdr.get("vNyq").floatValue();
    double temp = -999.99;
    switch (dty) {
      default:        // dty=1,2 -total_power, reflectivity (dBZ)
        if (data != 0) {
          temp = (((int) data & 0xFF) - 64) * 0.5;
        }
        break;
      case 3:        // dty=3 - mean velocity (m/sec)
        if (data != 0) {
          temp = ((((int) data & 0xFF) - 128) / 127.0) * vNyq * coef[multiprf];
        }
        break;
      case 4:        // dty=4 - spectrum width (m/sec)
        if (data != 0) {
          double v = ((((int) data & 0xFF) - 128) / 127.0) * vNyq * coef[multiprf];
          temp = (((int) data & 0xFF) / 256.0) * v;
        }
        break;
      case 5:        // dty=5 - differential reflectivity (dB)
        if (data != 0) {
          temp = ((((int) data & 0xFF) - 128) / 16.0);
        }
        break;
    }
    BigDecimal bd = new BigDecimal(temp);
    BigDecimal result = bd.setScale(2, RoundingMode.HALF_DOWN);
    return result.floatValue();
  }
static float calcData(Map<String, Number> recHdr, short dty, byte data) {
    short[] coef = {1, 2, 3, 4}; // MultiPRF modes
    short multiprf = recHdr.get("multiprf").shortValue();
    float vNyq = recHdr.get("vNyq").floatValue();
    double temp = -999.99;
    switch (dty) {
      default:        // dty=1,2 -total_power, reflectivity (dBZ)
        if (data != 0) {
          temp = (((int) data & 0xFF) - 64) * 0.5;
        }
        break;
      case 3:        // dty=3 - mean velocity (m/sec)
        if (data != 0) {
          temp = ((((int) data & 0xFF) - 128) / 127.0) * vNyq * coef[multiprf];
        }
        break;
      case 4:        // dty=4 - spectrum width (m/sec)
        if (data != 0) {
          double v = ((((int) data & 0xFF) - 128) / 127.0) * vNyq * coef[multiprf];
          temp = (((int) data & 0xFF) / 256.0) * v;
        }
        break;
      case 5:        // dty=5 - differential reflectivity (dB)
        if (data != 0) {
          temp = ((((int) data & 0xFF) - 128) / 16.0);
        }
        break;
    }
    BigDecimal bd = new BigDecimal(temp);
    BigDecimal result = bd.setScale(2, RoundingMode.HALF_DOWN);
    return result.floatValue();
  }
static float calcData ( Map < String , Number > recHdr , short dty , byte data ) { short [ ] coef = { 1 , 2 , 3 , 4 } ; // MultiPRF modes
 short multiprf = recHdr . get ( "multiprf" ) . shortValue ( ) ; float vNyq = recHdr . get ( "vNyq" ) . floatValue ( ) ; double temp = - 999.99 ; switch ( dty ) { default : // dty=1,2 -total_power, reflectivity (dBZ)
 if ( data != 0 ) { temp = ( ( ( int ) data & 0xFF ) - 64 ) * 0.5 ; } break ; case 3 : // dty=3 - mean velocity (m/sec)
 if ( data != 0 ) { temp = ( ( ( ( int ) data & 0xFF ) - 128 ) / 127.0 ) * vNyq * coef [ multiprf ] ; } break ; case 4 : // dty=4 - spectrum width (m/sec)
 if ( data != 0 ) { double v = ( ( ( ( int ) data & 0xFF ) - 128 ) / 127.0 ) * vNyq * coef [ multiprf ] ; temp = ( ( ( int ) data & 0xFF ) / 256.0 ) * v ; } break ; case 5 : // dty=5 - differential reflectivity (dB)
 if ( data != 0 ) { temp = ( ( ( ( int ) data & 0xFF ) - 128 ) / 16.0 ) ; } break ; } BigDecimal bd = new BigDecimal ( temp ) ; BigDecimal result = bd . setScale ( 2 , RoundingMode . HALF_DOWN ) ; return result . floatValue ( ) ; }
Calculate data values from raw ingest data

@param recHdr java.util.Map object with values for calculation
@param dty    type of data ( "Total_Power", "Reflectivity", "Velocity",
"Width", "Differential_Reflectivity")
@param data   1-byte input value
@return float value with precision of two decimal
Calculate data values from raw ingest data