Skip to content
GitLab
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
2d3702b0
Commit
2d3702b0
authored
Sep 14, 2016
by
Jonny Schäfer
Browse files
Go fmt
parent
19990cc6
Changes
2
Hide whitespace changes
Inline
Side-by-side
conversion.go
View file @
2d3702b0
...
...
@@ -19,7 +19,7 @@ func (z DBZ) PrecipitationRate() float64 {
// Reflectivity returns the estimated reflectivity factor for the given precipitation
// rate (mm/h). The used Z-R relation is described in [6].
func
Reflectivity
(
rate
float64
)
DBZ
{
return
DBZ
(
10
*
math
.
Log10
(
256
*
math
.
Pow
(
rate
,
1.42
)))
return
DBZ
(
10
*
math
.
Log10
(
256
*
math
.
Pow
(
rate
,
1.42
)))
}
// ToDBZ converts the given radar video processor values (rvp-6) to radar reflectivity
...
...
conversion_test.go
View file @
2d3702b0
...
...
@@ -7,9 +7,9 @@ import (
func
TestConversion
(
t
*
testing
.
T
)
{
testcases
:=
[]
struct
{
rvp
RVP6
dbz
DBZ
zr
float64
rvp
RVP6
dbz
DBZ
zr
float64
}{
{
0
,
-
32.5
,
0.0001
},
{
65
,
0
,
0.0201
},
...
...
@@ -32,7 +32,7 @@ func TestConversion(t *testing.T) {
if
math
.
Abs
(
test
.
zr
-
zr
)
>
0.0001
{
t
.
Errorf
(
"RVP6(%f).ToDBZ().PrecipitationRate() = %f; expected: %f"
,
test
.
rvp
,
zr
,
test
.
zr
)
}
if
math
.
Abs
(
float64
(
test
.
dbz
-
rz
))
>
0.0000001
{
if
math
.
Abs
(
float64
(
test
.
dbz
-
rz
))
>
0.0000001
{
t
.
Errorf
(
"Reflectivity(RVP6(%f).ToDBZ().PrecipitationRate()) = %f; expected: %f"
,
test
.
rvp
,
rz
,
test
.
dbz
)
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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