Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jonny Schäfer
radolan
Commits
54e65a40
Commit
54e65a40
authored
May 29, 2018
by
Jonny Schäfer
Browse files
Cache intermediate results in Z-R conversions
parent
828c7bbe
Changes
1
Hide whitespace changes
Inline
Side-by-side
conversion.go
View file @
54e65a40
...
...
@@ -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
=
New
ZR
(
256
,
1.42
)
// operational use in germany, described in [6]
Doelling98
=
New
ZR
(
316
,
1.50
)
// operational use in switzerland
JossWaldvogel70
=
New
ZR
(
300
,
1.50
)
MarshallPalmer55
=
New
ZR
(
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment