Skip to content

Latest commit

 

History

History
665 lines (512 loc) · 28.5 KB

API.md

File metadata and controls

665 lines (512 loc) · 28.5 KB

Classes

Typedefs

Level2Radar

Kind: global class

new Level2Radar(file, [options])

Parses a Nexrad Level 2 Data archive or chunk. Provide rawData as a Buffer. Returns an object formatted per the ICD FOR RDA/RPG - Build RDA 20.0/RPG 20.0 (PDF), or as close as can reasonably be represented in a javascript object. Additional data accessors are provided in the returned object to pull out typical data in a format ready for processing. Radar data is accessed through the get* methods

Param Type Description
file Buffer | Level2Radar Buffer with Nexrad Level 2 data. Alternatively a Level2Radar object, typically used internally when combining data.
[options] ParserOptions Parser options

level2Radar.setElevation(elevation)

Sets the elevation in use for get* methods

Kind: instance method of Level2Radar
Category: Configuration

Param Type Description
elevation number Selected elevation number

level2Radar.getAzimuth([scan]) ⇒ number | Array.<number>

Returns an single azimuth value or array of azimuth values for the current elevation and scan (or all scans if not provided). The order of azimuths in the returned array matches the order of the data in other get* functions.

Kind: instance method of Level2Radar
Returns: number | Array.<number> - Azimuth angle
Category: Data

Param Type Description
[scan] number Selected scan

level2Radar.getHighresReflectivity([scan]) ⇒ HighResData | Array.<HighResData>

Returns an Object of radar reflectivity data for the current elevation and scan (or all scans if not provided)

Kind: instance method of Level2Radar
Returns: HighResData | Array.<HighResData> - Scan's high res reflectivity data, or an array of the data.
Category: Data

Param Type Description
[scan] number Selected scan or null for all scans in elevation

level2Radar.getHighresVelocity([scan]) ⇒ HighResData | Array.<HighResData>

Returns an Object of radar velocity data for the current elevation and scan (or all scans if not provided)

Kind: instance method of Level2Radar
Returns: HighResData | Array.<HighResData> - Scan's high res velocity data, or an array of the data.
Category: Data

Param Type Description
[scan] number Selected scan, or null for all scans in this elevation

level2Radar.getHighresSpectrum([scan]) ⇒ HighResData | Array.<HighResData>

Returns an Object of radar spectrum data for the current elevation and scan (or all scans if not provided)

Kind: instance method of Level2Radar
Returns: HighResData | Array.<HighResData> - Scan's high res spectrum data, or an array of the data.
Category: Data

Param Type Description
[scan] number Selected scan, or null for all scans in this elevation

level2Radar.getHighresDiffReflectivity([scan]) ⇒ HighResData | Array.<HighResData>

Returns an Object of radar differential reflectivity data for the current elevation and scan (or all scans if not provided)

Kind: instance method of Level2Radar
Returns: HighResData | Array.<HighResData> - Scan's high res differential reflectivity data, or an array of the data.
Category: Data

Param Type Description
[scan] number Selected scan or null for all scans in elevation

level2Radar.getHighresDiffPhase([scan]) ⇒ HighResData | Array.<HighResData>

Returns an Object of radar differential phase data for the current elevation and scan (or all scans if not provided)

Kind: instance method of Level2Radar
Returns: HighResData | Array.<HighResData> - Scan's high res differential phase data, or an array of the data.
Category: Data

Param Type Description
[scan] number Selected scan or null for all scans in elevation

level2Radar.getHighresCorrelationCoefficient([scan]) ⇒ HighResData | Array.<HighResData>

Returns an Object of radar correlation coefficient data for the current elevation and scan (or all scans if not provided)

Kind: instance method of Level2Radar
Returns: HighResData | Array.<HighResData> - Scan's high res correlation coefficient data, or an array of the data.
Category: Data

Param Type Description
[scan] number Selected scan or null for all scans in elevation

level2Radar.header : Header

Kind: instance property of Level2Radar
Category: Metadata

level2Radar.vcp : Vcp

Kind: instance property of Level2Radar
Category: Metadata

level2Radar.hasGaps : boolean

Gaps were found in the source data

Kind: instance property of Level2Radar
Category: Metadata

level2Radar.isTruncated : boolean

Source data was truncated

Kind: instance property of Level2Radar
Category: Metadata

level2Radar.getScans() ⇒ number

Return the number of scans in the current elevation

Kind: instance method of Level2Radar
Category: Metadata

level2Radar.getHeader([scan]) ⇒ MessageHeader

Return message_header information for all scans or a specific scan for the selected elevation

Kind: instance method of Level2Radar
Category: Metadata

Param Type Description
[scan] number Selected scan, omit to return all scans for this elevation

level2Radar.listElevations() ⇒ Array.<number>

List all available elevations

Kind: instance method of Level2Radar
Category: Metadata

Level2Radar.combineData(...data) ⇒ Level2Radar

Combines the data returned by multiple runs of the Level2Data constructor. This is typically used in "chunks" mode to combine all azimuths from one revolution into a single data set. data can be provided as an array of Level2Radar objects, individual Level2Data parameters or any combination thereof.

The combine function blindly combines data and the right-most argument will overwrite any previously provided data. Individual azimuths located in Level2Radar.data[] will be appended. It is up to the calling routine to properly manage the parsing of related chunks and send it in to this routine.

Kind: static method of Level2Radar
Returns: Level2Radar - Combined data

Param Type Description
...data Level2Radar Data to combine

parseData

Kind: global class

new parseData(file, [options])

Internal function. Parses a Nexrad Level 2 Data archive or chunk. Provide rawData as a Buffer.

Returns: object - Intermediate data for use with Level2Radar

Param Type Default Description
file Buffer Buffer with Nexrad Level 2 data. Alternatively a Level2Radar object, typically used internally when combining data.
[options] object Parser options
[options.logger] object | boolean console By default error and information messages will be written to the console. These can be suppressed by passing false, or a custom logger can be provided. A custom logger must provide the log(), warn() and error() function.

RandomAccessFile

Kind: global class

new RandomAccessFile(file, endian)

Store a buffer or string and add functionality for random access Unless otherwise noted all read functions advance the file's pointer by the length of the data read

Param Type Description
file Buffer | string A file as a string or Buffer to load for random access
endian number Endianess of the file constants BIG_ENDIAN and LITTLE_ENDIAN are provided

randomAccessFile.readString(length) ⇒ string

Read a string of a specificed length from the buffer

Kind: instance method of RandomAccessFile
Category: Data

Param Type Description
length number Length of string to read

randomAccessFile.readFloat() ⇒ number

Read a float from the buffer

Kind: instance method of RandomAccessFile
Category: Data

randomAccessFile.readInt() ⇒ number

Read a 4-byte unsigned integer from the buffer

Kind: instance method of RandomAccessFile
Category: Data

randomAccessFile.readShort() ⇒ number

Read a 2-byte unsigned integer from the buffer

Kind: instance method of RandomAccessFile
Category: Data

randomAccessFile.readSignedInt() ⇒ number

Read a 2-byte signed integer from the buffer

Kind: instance method of RandomAccessFile
Category: Data

randomAccessFile.readByte() ⇒ number

Read a single byte from the buffer

Kind: instance method of RandomAccessFile
Category: Data

randomAccessFile.read(length) ⇒ number | Array.<number>

Read a set number of bytes from the buffer

Kind: instance method of RandomAccessFile
Returns: number | Array.<number> - number if length = 1, otherwise number[]
Category: Data

Param Type Default Description
length number 1 Number of bytes to read

randomAccessFile.getLength() ⇒ number

Get buffer length

Kind: instance method of RandomAccessFile
Category: Positioning

randomAccessFile.getPos() ⇒ number

Get current position in the file

Kind: instance method of RandomAccessFile
Category: Positioning

randomAccessFile.seek(position)

Seek to a provided buffer offset

Kind: instance method of RandomAccessFile
Category: Positioning

Param Type Description
position number Byte offset

randomAccessFile.skip(length)

Advance the pointer forward a set number of bytes

Kind: instance method of RandomAccessFile
Category: Positioning

Param Type Description
length number Number of bytes to skip

Level2Record

Kind: global class

new Level2Record(raf, record, message31Offset, header, [options])

Read a single record from the radar data

Returns: object - Variable data based on message types present in record

Param Type Description
raf RandomAccessFile Random access file
record number Record number
message31Offset number Additional record offset caused by message 31 size
header Header Original parsed file header
[options] ParserOptions Parser options

ParserOptions : object

parser options

Kind: global typedef
Properties

Name Type Default Description
[logger] object | boolean console By default error and information messages will be written to the console. These can be suppressed by passing false, or a custom logger can be provided. A custom logger must provide the log() and error() functions.

ParsedData : object

Intermediate parsed radar data, further processed by Level2Radar

Kind: global typedef
Properties

Name Type Description
data object Grouped and sorted data
header Header
vcp Vcp
isTruncated boolean
hasGaps boolean

HighResData : object

See NOAA documentation for detailed meanings of these values.

Kind: global typedef
Properties

Name Type Description
gate_count number
gate_size number
first_gate number
rf_threshold number
snr_threshold number
scale number
offset number
block_type string 'D'
control_flags number
data_size number
name string 'REF', 'VEL', 'SW ', 'ZDR', 'PHI', 'RHO'
spare Array.<Buffer> Spare data per the documentation
moment_data Array.<number> Scaled data

MessageHeader : object

See NOAA documentation for detailed meanings of these values.

Kind: global typedef
Properties

Name Type
aim number
ars number
compress_idx number
cut number
dcount number
elevation_angle number
elevation_number number
id string
julian_date number
mseconds number
[phi] HighResData
radial Radial
radial_length number
radial_number number
[reflect] HighResData
[rho] HighResData
rs number
rsbs number
[spectrum] HighResData
sp number
volume Volume
[velocity] HighResData
[zdr] HighResData

Radial : object

See NOAA documentation for detailed meanings of these values.

Kind: global typedef
Properties

Name Type Description
block_type string 'R'
horizontal_calibration number
horizontal_noise_level number
name string 'RAD'
nyquist_velocity number
radial_flags number
size number
unambiguous_range number
vertical_calibration number
vertical_noise_level number

Volume : object

See NOAA documentation for detailed meanings of these values.

Kind: global typedef
Properties

Name Type Description
block_type string 'R'
calibration number
differential_phase number
differential_reflectivity number
elevation number
feedhorn_height number
latitude number
longitude number
name string 'VOL'
processing_status number
size number
tx_horizontal number
tx_vertical number
version_major number
version_minor number
volume_coverage_pattern number
zdr_bias_estimate number

Header : object

File header details See NOAA documentation for detailed meanings of these values.

Kind: global typedef
Properties

Name Type Description
ICAO string Radar site identifier
milliseconds number Milliseconds since midnight
modified_julian_date number Days since Dec 31, 1969
raw Buffer Raw header from file
version string Version number

Vcp : object

Volume coverage pattern See NOAA documentation for detailed meanings of these values.

Kind: global typedef
Properties

Name Type
channel number
id_sequence number
message_julian_date number
message_mseconds number
message_size number
message_type number
record VcpRecord
segment_count number
segment_number number

VcpRecord : object

See NOAA documentation for detailed meanings of these values.

Kind: global typedef
Properties

Name Type Description
clutter_number number
elevations Array.<VcpElevations>
message_size number
num_elevations number
pattern_number number
pattern_type number
pulse_width string
reserved1 number Reserved per NOAA documentation
reserved2 number Reserved per NOAA documentation
vcp_sequencing VcpSequencing
vcp_supplemental VcpSupplemental
velocity_resolution number
version number

VcpSequencing : object

See NOAA documentation for detailed meanings of these values.

Kind: global typedef
Properties

Name Type
elevations number
max_sails_cuts number
sequence_active number
truncated_vcp number

VcpSupplemental : object

See NOAA documentation for detailed meanings of these values.

Kind: global typedef
Properties

Name Type
base_tilt_vcp boolean
mpda_vcp boolean
mrle_vcp boolean
number_base_tilts number
number_mrle_cuts number
number_sails_cuts number
sails_vcp number