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
5f567473
Commit
5f567473
authored
Dec 22, 2017
by
Jonny Schäfer
Browse files
Detect unit of composite data
parent
d678f16a
Changes
3
Hide whitespace changes
Inline
Side-by-side
catalog.go
View file @
5f567473
...
...
@@ -28,3 +28,86 @@ var catalog = map[string]spec{
"PY"
:
{
200
,
224
,
200
,
200
,
1
,
1
},
// accumulated rainfall
"PZ"
:
{
200
,
2400
,
200
,
200
,
2
,
2
},
// 3D reflectivity CAPPI
}
type
Unit
int
const
(
Unit_unknown
=
iota
Unit_mm
// mm/interval
Unit_dBZ
// dBZ
Unit_km
// km
Unit_mps
// m/s
)
func
(
u
Unit
)
String
()
string
{
return
[]
string
{
"unknown unit"
,
"mm"
,
"dBZ"
,
"km"
,
"m/s"
}[
u
]
}
var
unitCatalog
=
map
[
string
]
Unit
{
"CH"
:
Unit_mm
,
"CX"
:
Unit_dBZ
,
"D2"
:
Unit_mm
,
"D3"
:
Unit_mm
,
"EA"
:
Unit_dBZ
,
"EB"
:
Unit_mm
,
"EC"
:
Unit_mm
,
"EH"
:
Unit_mm
,
"EM"
:
Unit_mm
,
"EW"
:
Unit_mm
,
"EX"
:
Unit_dBZ
,
"EY"
:
Unit_mm
,
"EZ"
:
Unit_mm
,
"FX"
:
Unit_dBZ
,
"FZ"
:
Unit_dBZ
,
"HX"
:
Unit_dBZ
,
"OL"
:
Unit_dBZ
,
"OX"
:
Unit_dBZ
,
"PA"
:
Unit_dBZ
,
"PC"
:
Unit_dBZ
,
"PD"
:
Unit_mps
,
"PE"
:
Unit_km
,
"PF"
:
Unit_dBZ
,
"PG"
:
Unit_dBZ
,
"PH"
:
Unit_mm
,
"PI"
:
Unit_dBZ
,
"PK"
:
Unit_dBZ
,
"PL"
:
Unit_dBZ
,
"PM"
:
Unit_dBZ
,
"PN"
:
Unit_dBZ
,
"PR"
:
Unit_mps
,
"PU"
:
Unit_mps
,
"PV"
:
Unit_mps
,
"PX"
:
Unit_dBZ
,
"PY"
:
Unit_mm
,
"PZ"
:
Unit_dBZ
,
"RA"
:
Unit_mm
,
"RB"
:
Unit_mm
,
"RE"
:
Unit_mm
,
"RH"
:
Unit_mm
,
"RK"
:
Unit_mm
,
"RL"
:
Unit_mm
,
"RM"
:
Unit_mm
,
"RN"
:
Unit_mm
,
"RQ"
:
Unit_mm
,
"RR"
:
Unit_mm
,
"RU"
:
Unit_mm
,
"RW"
:
Unit_mm
,
"RX"
:
Unit_dBZ
,
"RY"
:
Unit_mm
,
"RZ"
:
Unit_mm
,
"S2"
:
Unit_mm
,
"S3"
:
Unit_mm
,
"SF"
:
Unit_mm
,
"SH"
:
Unit_mm
,
"SQ"
:
Unit_mm
,
"TB"
:
Unit_mm
,
"TH"
:
Unit_mm
,
"TW"
:
Unit_mm
,
"TX"
:
Unit_dBZ
,
"TZ"
:
Unit_mm
,
"W1"
:
Unit_mm
,
"W2"
:
Unit_mm
,
"W3"
:
Unit_mm
,
"W4"
:
Unit_mm
,
"WX"
:
Unit_dBZ
,
}
header.go
View file @
5f567473
...
...
@@ -52,6 +52,12 @@ func (c *Composite) parseHeader(reader *bufio.Reader) error {
// Parse Product - Example: "PG" or "FZ"
c
.
Product
=
header
[
:
2
]
// Lookup Unit
c
.
DataUnit
=
Unit_unknown
if
unit
,
ok
:=
unitCatalog
[
c
.
Product
];
ok
{
c
.
DataUnit
=
unit
}
// Parse DataLength - Example: "BY 405160"
if
_
,
err
:=
fmt
.
Sscanf
(
section
[
"BY"
],
"%d"
,
&
c
.
dataLength
);
err
!=
nil
{
return
newError
(
"parseHeader"
,
"could not parse data length: "
+
err
.
Error
())
...
...
radolan.go
View file @
5f567473
...
...
@@ -41,6 +41,7 @@ import (
// which the voxel at position (x, y, z) is accessible by c.DataZ[ z ][ y ][ x ].
//
// The rvp-6 value is used differently depending on the product type:
// (also consult the DataUnit field of the Composite)
//
// Product label | rvp-6 value represents | unit
// -------------------------+--------------------------+------------------------
...
...
@@ -75,6 +76,7 @@ type Composite struct {
PlainData
[][]
RVP6
// rvp-6 data for parsed plain data element [y][x]
Px
int
// plain data width
Py
int
// plain data height
DataUnit
Unit
DataZ
[][][]
RVP6
// rvp-6 data for each voxel [z][y][x] (composites use only one z-layer)
Data
[][]
RVP6
// rvp-6 data for each pixel [y][x] at layer 0 (alias for DataZ[0][x][y])
...
...
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