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
d9f8decb
Commit
d9f8decb
authored
Mar 19, 2017
by
Jonny Schäfer
Browse files
Allow various Z-R relationships
parent
1e6179d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
conversion.go
View file @
d9f8decb
...
@@ -10,16 +10,30 @@ type DBZ float64
...
@@ -10,16 +10,30 @@ type DBZ float64
// Raw radar video processor value.
// Raw radar video processor value.
type
RVP6
float64
type
RVP6
float64
// Z-R relationship mathematically expressed as Z = a * R^b
type
ZR
struct
{
A
float64
B
float64
}
// 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
)
// PrecipitationRate returns the estimated precipitation rate in mm/h for the given
// PrecipitationRate returns the estimated precipitation rate in mm/h for the given
// reflectivity factor
. The use
d Z-R relation
is described in [6]
.
// reflectivity factor
an
d Z-R relation
ship
.
func
(
z
DBZ
)
PrecipitationRate
()
float64
{
func
(
z
DBZ
)
PrecipitationRate
(
relation
ZR
)
float64
{
return
math
.
Pow
(
math
.
Pow
(
10
,
float64
(
z
)
/
10
)
/
256
,
1
/
1.42
)
return
math
.
Pow
(
math
.
Pow
(
10
,
float64
(
z
)
/
10
)
/
relation
.
A
,
1
/
relation
.
B
)
}
}
// Reflectivity returns the estimated reflectivity factor for the given precipitation
// Reflectivity returns the estimated reflectivity factor for the given precipitation
// rate (mm/h)
. The use
d Z-R relation
is described in [6]
.
// rate (mm/h)
an
d Z-R relation
ship
.
func
Reflectivity
(
rate
float64
)
DBZ
{
func
Reflectivity
(
rate
float64
,
relation
ZR
)
DBZ
{
return
DBZ
(
10
*
math
.
Log10
(
256
*
math
.
Pow
(
rate
,
1.42
)))
return
DBZ
(
10
*
math
.
Log10
(
relation
.
A
*
math
.
Pow
(
rate
,
relation
.
B
)))
}
}
// ToDBZ converts the given radar video processor values (rvp-6) to radar reflectivity
// ToDBZ converts the given radar video processor values (rvp-6) to radar reflectivity
...
...
conversion_test.go
View file @
d9f8decb
...
@@ -19,8 +19,8 @@ func TestConversion(t *testing.T) {
...
@@ -19,8 +19,8 @@ func TestConversion(t *testing.T) {
for
_
,
test
:=
range
testcases
{
for
_
,
test
:=
range
testcases
{
dbz
:=
test
.
rvp
.
ToDBZ
()
dbz
:=
test
.
rvp
.
ToDBZ
()
zr
:=
dbz
.
PrecipitationRate
()
zr
:=
dbz
.
PrecipitationRate
(
Aniol80
)
rz
:=
Reflectivity
(
zr
)
rz
:=
Reflectivity
(
zr
,
Aniol80
)
rvp
:=
dbz
.
ToRVP6
()
rvp
:=
dbz
.
ToRVP6
()
if
dbz
!=
test
.
dbz
{
if
dbz
!=
test
.
dbz
{
...
...
Write
Preview
Supports
Markdown
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