Commit 54e65a40 by Jonny Schäfer

### Cache intermediate results in Z-R conversions

parent 828c7bbe
 ... ... @@ -10,30 +10,43 @@ func IsNaN(f float32) (is bool) { return f != f } // Z-R relationship mathematically expressed as Z = a * R^b // Z-R relationship type ZR struct { A float64 B float64 // intermediate caching c1 float64 // 10*b c2 float64 // a^(-1/b) c3 float64 // 10^(1/(10*b)) c4 float64 // 10 * log10(a) } // Common Z-R relationships var ( Aniol80 = ZR{256, 1.42} // operational use in germany, described in [6] Doelling98 = ZR{316, 1.50} // operational use in switzerland JossWaldvogel70 = ZR{300, 1.50} MarshallPalmer55 = ZR{200, 1.60} // operational use in austria Aniol80 = NewZR(256, 1.42) // operational use in germany, described in [6] Doelling98 = NewZR(316, 1.50) // operational use in switzerland JossWaldvogel70 = NewZR(300, 1.50) MarshallPalmer55 = NewZR(200, 1.60) // operational use in austria ) // New Z-R returns a Z-R relationship mathematically expressed as Z = a * R^b func NewZR(A, B float64) ZR { c1 := 10.0 * B c2 := math.Pow(A, -1.0/B) c3 := math.Pow(10.0, 1/c1) c4 := 10.0 * math.Log10(A) return ZR{c1, c2, c3, c4} } // PrecipitationRate returns the estimated precipitation rate in mm/h for the given // reflectivity factor and Z-R relationship. func PrecipitationRate(relation ZR, dBZ float32) (rate float64) { return math.Pow(math.Pow(10, float64(dBZ)/10)/relation.A, 1/relation.B) return relation.c2 * math.Pow(relation.c3, float64(dBZ)) } // Reflectivity returns the estimated reflectivity factor for the given precipitation // rate (mm/h) and Z-R relationship. func Reflectivity(relation ZR, rate float64) (dBZ float32) { return float32(10 * math.Log10(relation.A*math.Pow(float64(rate), relation.B))) return float32(relation.c4 + relation.c1 * math.Log10(rate)) } // toDBZ converts the given radar video processor values (rvp-6) to radar reflectivity ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment