Difference between revisions of "Workdocumentation 2018-08-18"

From BITPlan Wiki
Jump to navigation Jump to search
Line 74: Line 74:
 
</source>
 
</source>
 
== Difference Examples ==
 
== Difference Examples ==
first column: Java - second column: go
+
first column: Java - second column: go third colum difference * 10
 
<pre>
 
<pre>
484,  0: 0,0 != 1,6
+
...
484, 1: 0,0 != 1,6
+
518, 32:   0,9 !=  18,5 d*10=176,0
485, 1: 0,4 != 2,0
+
519, 32:   0,8 !=  16,8 d*10=160,0
486, 1: 0,0 != 1,6
+
520, 32:   0,7 !=  15,1 d*10=144,0
487,  1: 0,0 != 1,6
+
517, 33:   0,9 !=  15,3 d*10=144,0
484,  2: 0,0 != 1,6
+
518, 33:   1,3 !=  22,1 d*10=208,0
485, 2: 0,7 != 2,3
+
519, 33:   1,1 !=  20,3 d*10=192,0
486,  2: 0,8 != 2,4
 
487,  2: 0,4 != 2,0
 
488, 2: 0,1 != 1,7
 
485,  3: 0,4 != 2,0
 
486, 3: 0,8 != 2,4
 
487,  3: 1,3 != 2,9
 
489, 3: 0,1 != 1,7
 
490,  3: 0,1 != 1,7
 
242,  4: 0,0 != 1,6
 
243,  4: 0,2 != 1,8
 
485,  4: 0,0 != 1,6
 
486, 4: 0,3 != 1,9
 
487,  4: 0,5 != 2,1
 
488,  4: 1,4 != 3,0
 
489,  4: 1,3 != 2,9
 
490, 4: 1,3 != 2,9
 
491, 4: 0,8 != 2,4
 
492, 4: 0,1 != 1,7
 
240,  5: 0,9 != 2,5
 
241,  5: 0,8 != 2,4
 
242,  5: 0,2 != 1,8
 
244,  5: 0,0 != 1,6
 
486,  5: 0,5 != 2,1
 
487,  5: 0,4 != 3,6
 
488,  5: 0,6 != 3,8
 
489,  5: 0,1 != 4,9
 
490,  5: 1,2 != 4,4
 
491,  5: 0,4 != 3,6
 
492, 5: 1,5 != 3,1
 
493,  5: 0,7 != 2,3
 
500, 5: 0,1 != 1,7
 
501, 5: 0,1 != 1,7
 
238,  6: 1,4 != 3,0
 
239,  6: 0,8 != 2,4
 
240,  6: 0,6 != 2,2
 
241, 6: 0,3 != 1,9
 
244,  6: 0,1 != 1,7
 
245,  6: 0,2 != 1,8
 
246,  6: 0,1 != 1,7
 
486,  6: 0,9 != 2,5
 
487,  6: 0,9 != 4,1
 
488, 6: 0,6 != 3,8
 
 
</pre>
 
</pre>

Revision as of 18:55, 18 August 2018

go:Sf-history2018-05-30 1650JS.pngjava:Sf-history2018-05-30 1650.png

go

// rvp6LittleEndian converts the raw two byte tuple of little endian encoded composite products
// to radar video processor values (rvp-6). NaN may be returned when the no-data flag is set.
func (c *Composite) rvp6LittleEndian(tuple [2]byte) float32 {
	var value int = 0x0F & int(tuple[1])
	value = (value << 8) + int(tuple[0])

	if tuple[1]&(1<<5) != 0 { // error code: no-data
		return NaN
	}

	if tuple[1]&(1<<6) != 0 { // flag: negative value
		value *= -1
	}

	conv := c.rvp6Raw(value) // set decimal point

	// little endian encoded formats are also used for mm/h
	if c.DataUnit != Unit_dBZ {
		return conv
	}

	// Even though this format supports negative values and custom
	// precision they do not make use of this and we still have to subtract
	// the bias and scale it (RADVOR FX, dBZ)
	return toDBZ(conv)
}

// rvp6Raw converts the raw value to radar video processor values (rvp-6) by applying the
// products precision field.
func (c *Composite) rvp6Raw(value int) float32 {
	return float32(value) * float32(math.Pow10(c.precision))
}

Java

 // rvp6LittleEndian converts the raw two byte tuple of little endian encoded
  // composite products
  // to radar video processor values (rvp-6). NaN may be returned when the
  // no-data flag is set.
  public static float rvp6LittleEndian(Composite c, byte... tuple) {
    int value = 0x0F & tuple[1];
    value = (value << 8) | (tuple[0]&0x0f);

    if ((tuple[1] & (1 << 5)) != 0) { // error code: no-data
      return Float.NaN;
    }

    if ((tuple[1] & (1 << 6)) != 0) { // flag: negative value
      value *= -1;
    }

    float conv = (float) c.rvp6Raw(value); // set decimal point

    // little endian encoded formats are also used for mm/h
    if (c.getDataUnit() != Unit.Unit_dBZ) {
      return conv;
    }

    // Even though this format supports negative values and custom
    // precision they do not make use of this and we still have to subtract
    // the bias and scale it (RADVOR FX, dBZ)
    return Conversion.toDBZ(conv);
  }

  // rvp6Raw converts the raw value to radar video processor values (rvp-6) by applying the
  // products precision field.
  public static double rvp6Raw(Composite c, int value)  {
    double rvalue=value * c.getPrecisionFactor();
    return rvalue;
  }

Difference Examples

first column: Java - second column: go third colum difference * 10

...
518, 32:   0,9 !=  18,5 d*10=176,0
519, 32:   0,8 !=  16,8 d*10=160,0
520, 32:   0,7 !=  15,1 d*10=144,0
517, 33:   0,9 !=  15,3 d*10=144,0
518, 33:   1,3 !=  22,1 d*10=208,0
519, 33:   1,1 !=  20,3 d*10=192,0