archive2

package
v0.0.0-...-6689a17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2021 License: MIT Imports: 9 Imported by: 0

README

Nexrad Archive II File Format

It's a beast. Below are some handy notes/references. The real details are commented in the source.

High Level Format

A single file consists of the following structure. Each records are compressed with bzip2.

Section Purpose Message Types Number of Entries
Volume Header Record 24 byte record identifying this file -- 1
LDM Compressed Record metadata message types 2, 3, 5, 13, 15, 18 1
LDM Compressed Record radial data messages 1, 2, 31 N
EOF end of file -- --

Message Types

Every message type comes with a header to identify it, then the rest of the message is decoded appropriately.

Message Type Description
Message 2 RDA Status Data, contains the state of operational functions
Message 3 RDA Performance/Maintenance Data
Message 5 RDA Volume Coverage Pattern
Message 13 RDA Clutter Filter Bypass Map
Message 15 RDA Clutter Map Data
Message 18 RDA Adaptation Data
Message 31 Digital Radar Data Generic Format

Resources

Documentation

Overview

Package archive2 provides structs and functions for decoding NEXRAD Archive II files.

The documents used and referenced in this package:

Index

Constants

View Source
const (
	// MomentDataBelowThreshold ...
	MomentDataBelowThreshold = 999

	// MomentDataFolded ...
	MomentDataFolded = 998
)
View Source
const (

	// LegacyCTMHeaderLength sits in front of every message header
	LegacyCTMHeaderLength = 12

	// DefaultMetadataRecordLength is the size of every record regardless of its contents
	DefaultMetadataRecordLength = 2432
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Archive2

type Archive2 struct {
	VolumeHeader   VolumeHeaderRecord
	ElevationScans map[int][]*Message31
}

Archive2 wrapper for processed archive 2 data files.

func NewArchive2

func NewArchive2(filename string) *Archive2

NewArchive2 returns a new Archive2 from the provided file

type DataBlock

type DataBlock struct {
	DataBlockType [1]byte
	DataName      [3]byte
}

DataBlock is sort of like the header for the blocks of data (GenericDataMoment, VolumeData, etc). These 4 bytes are normally found at the top of tables XVII-[BEFH] (User 3.2.4.17)

type DataMoment

type DataMoment struct {
	GenericDataMoment
	Data []byte
}

DataMoment wraps all Momentary data records. ex: REF, VEL, SW data. Data interpretation provided by User 3.2.4.17.6.

func (*DataMoment) ScaledData

func (d *DataMoment) ScaledData() []float32

ScaledData automatically scales the nexrad moment values to their actual values. For all data moment integer values N = 0 indicates received signal is below threshold and N = 1 indicates range folded data. Actual data range is N = 2 through 255, or 1023 for data resolution size 8, and 10 bits respectively.

type ElevationData

type ElevationData struct {
	// data block type and data moment name are retrieved separately
	LRTUP      uint16  // LRTUP Size of data block in bytes
	ATMOS      [2]byte // ATMOS Atmospheric Attenuation Factor
	CalibConst float32 // CalibConst Scaling constant used by the Signal Processor for this elevation to calculate reflectivity
}

ElevationData wraps Message 31 elevation data (User 3.2.4.17.4)

type GenericDataMoment

type GenericDataMoment struct {
	// data block type and data moment name are retrieved separately
	Reserved                      uint32  //
	NumberDataMomentGates         uint16  // NumberDataMomentGates Number of data moment gates for current radial
	DataMomentRange               uint16  // DataMomentRange Range to center of first range gate
	DataMomentRangeSampleInterval uint16  // DataMomentRangeSampleInterval Size of data moment sample interval
	TOVER                         uint16  // TOVER Threshold parameter which specifies the minimum difference in echo power between two resolution gates for them not to be labeled "overlayed"
	SNRThreshold                  uint16  // SNRThreshold SNR threshold for valid data
	ControlFlags                  uint8   // ControlFlags Indicates special control features
	DataWordSize                  uint8   // DataWordSize Number of bits (DWS) used for storing data for each Data Moment gate
	Scale                         float32 // Scale value used to convert Data Moments from integer to floating point data
	Offset                        float32 // Offset value used to convert Data Moments from integer to floating point data
}

GenericDataMoment is a generic data wrapper for momentary data. ex: REF, VEL, SW data (User 3.2.4.17.2)

type LDMRecord

type LDMRecord struct {
	Size           int32
	MetaDataRecord []byte
}

LDMRecord (Local Data Manager) wraps every radar message in bzip2 compression. (RDA/RPG 7.3.4)

type Message2

type Message2 struct {
	RDAStatus                       uint16
	OperabilityStatus               uint16
	ControlStatus                   uint16
	AuxPowerGeneratorState          uint16
	AvgTxPower                      uint16
	HorizRefCalibCorr               uint16
	DataTxEnabled                   uint16
	VolumeCoveragePatternNum        uint16
	RDAControlAuth                  uint16
	RDABuild                        uint16
	OperationalMode                 uint16
	SuperResStatus                  uint16
	ClutterMitigationDecisionStatus uint16
	AvsetStatus                     uint16
	RDAAlarmSummary                 uint16
	CommandAck                      uint16
	ChannelControlStatus            uint16
	SpotBlankingStatus              uint16
	BypassMapGenDate                uint16
	BypassMapGenTime                uint16
	ClutterFilterMapGenDate         uint16
	ClutterFilterMapGenTime         uint16
	VertRefCalibCorr                uint16
	TransitionPwrSourceStatus       uint16
	RMSControlStatus                uint16
	PerformanceCheckStatus          uint16
	AlarmCodes                      uint16
	Spares                          [14]byte
}

Message2 RDA Status Data (User 3.2.4.6)

func (Message2) GetBuildNumber

func (m2 Message2) GetBuildNumber() float32

GetBuildNumber as a more recognizable float

func (Message2) GetOperabilityStatus

func (m2 Message2) GetOperabilityStatus() string

GetOperabilityStatus returns a human friendly status

func (Message2) GetRDAStatus

func (m2 Message2) GetRDAStatus() string

GetRDAStatus returns a human friendly status

func (Message2) String

func (m2 Message2) String() string

type Message31

type Message31 struct {
	Header        Message31Header
	VolumeData    VolumeData
	ElevationData ElevationData
	RadialData    RadialData
	REFData       DataMoment
	VELData       DataMoment
	SWData        DataMoment
	ZDRData       DataMoment
	PHIData       DataMoment
	RHOData       DataMoment
	CFPData       DataMoment
}

Message31 - Digital Radar Data Generic Format (User 3.2.4.17)

func NewMessage31

func NewMessage31(r io.Reader, build float32) *Message31

NewMessage31 from the provided io.Reader

func (*Message31) AzimuthResolutionSpacing

func (h *Message31) AzimuthResolutionSpacing() float32

AzimuthResolutionSpacing returns the spacing in degrees

type Message31Header

type Message31Header struct {
	RadarIdentifier              [4]byte // ICAO (eg KMPX for Minneapolis)
	CollectionTime               uint32  // CollectionTime Radial data collection time in milliseconds past midnight GMT
	CollectionDate               uint16  // CollectionDate Current Julian date - 2440586.5
	AzimuthNumber                uint16  // AzimuthNumber Radial number within elevation scan
	AzimuthAngle                 float32 // AzimuthAngle Azimuth angle at which radial data was collected
	CompressionIndicator         uint8   // CompressionIndicator Indicates if message type 31 is compressed and what method of compression is used. The Data Header Block is not compressed.
	Spare                        uint8   // unused
	RadialLength                 uint16  // RadialLength Uncompressed length of the radial in bytes including the Data Header block length
	AzimuthResolutionSpacingCode uint8   // AzimuthResolutionSpacing Code for the Azimuthal spacing between adjacent radials. 1 = .5 degrees, 2 = 1degree
	RadialStatus                 uint8   // RadialStatus Radial Status
	ElevationNumber              uint8   // ElevationNumber Elevation number within volume scan
	CutSectorNumber              uint8   // CutSectorNumber Sector Number within cut
	ElevationAngle               float32 // ElevationAngle Elevation angle at which radial radar data was collected
	RadialSpotBlankingStatus     uint8   // RadialSpotBlankingStatus Spot blanking status for current radial, elevation scan and volume scan
	AzimuthIndexingMode          uint8   // AzimuthIndexingMode Azimuth indexing value (Set if azimuth angle is keyed to constant angles)
	DataBlockCount               uint16  // Number of data blocks used

}

Message31Header is the non-data portions of Message31 (User 3.2.4.17)

func (Message31Header) Date

func (h Message31Header) Date() time.Time

Date and time this data is valid for

func (Message31Header) String

func (h Message31Header) String() string

type MessageHeader

type MessageHeader struct {
	MessageSize         uint16
	RDARedundantChannel uint8
	MessageType         uint8
	IDSequenceNumber    uint16
	JulianDate          uint16
	MillisOfDay         uint32
	NumMessageSegments  uint16
	MessageSegmentNum   uint16
}

MessageHeader provides a high level description for a particular message. (User 3.2.4.1)

type RadialData

type RadialData struct {
	// data block type and data moment name are retrieved separately
	LRTUP              uint16 // LRTUP Size of data block in bytes
	UnambiguousRange   uint16 // UnambiguousRange, Interval Size
	NoiseLevelHorz     float32
	NoiseLevelVert     float32
	NyquistVelocity    uint16
	Spares             [2]byte
	CalibConstHorzChan float32
	CalibConstVertChan float32
}

RadialData wraps Message 31 radial data (User 3.2.4.17.5)

type VolumeData

type VolumeData struct {
	// data block type and data moment name are retrieved separately
	LRTUP                          uint16 // LRTUP Size of data block in bytes
	VersionMajor                   uint8
	VersionMinor                   uint8
	Lat                            float32
	Long                           float32
	SiteHeight                     uint16
	FeedhornHeight                 uint16
	CalibrationConstant            float32
	SHVTXPowerHor                  float32
	SHVTXPowerVer                  float32
	SystemDifferentialReflectivity float32
	InitialSystemDifferentialPhase float32
	VolumeCoveragePatternNumber    uint16
	ProcessingStatus               uint16
}

VolumeData wraps information about the Volume being extracted (User 3.2.4.17.3)

type VolumeHeaderRecord

type VolumeHeaderRecord struct {
	TapeFilename    [9]byte // eg "AR2V0006"
	ExtensionNumber [3]byte // eg "001" (cycles through 0-999)
	ModifiedDate    int32   // data's valid date (julian day since 1970)
	ModifiedTime    int32   // data's valid time (milliseconds past midnight)
	ICAO            [4]byte // radar identifier
}

VolumeHeaderRecord for NEXRAD Archive II Data Streams (RDA/RPG 7.3.3)

func (VolumeHeaderRecord) Date

func (vh VolumeHeaderRecord) Date() time.Time

Date and time this data is valid for

func (VolumeHeaderRecord) Filename

func (vh VolumeHeaderRecord) Filename() string

Filename for this archive file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL