diff --git a/.eslintrc.js b/.eslintrc.js index bab5f7c..30cdad2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,7 +6,8 @@ module.exports = { node: true, jquery: true, }, - extends: ['airbnb-base', 'plugin:import/recommended'], + plugins: ['jsdoc'], + extends: ['airbnb-base', 'plugin:import/recommended', 'plugin:jsdoc/recommended'], globals: { Atomics: 'readonly', SharedArrayBuffer: 'readonly', @@ -70,6 +71,11 @@ module.exports = { allowAfterThis: true, }], 'no-bitwise': 0, + 'jsdoc/require-property-description': 0, + 'jsdoc/require-returns-description': 0, + 'jsdoc/check-tag-names': ['error', { + definedTags: ['category'], + }], }, ignorePatterns: [ '*.min.js', diff --git a/.vscode/cspell.json b/.vscode/cspell.json new file mode 100644 index 0000000..8dfa745 --- /dev/null +++ b/.vscode/cspell.json @@ -0,0 +1,13 @@ +{ + "words": [ + "azmith", + "bzip", + "dcount", + "KLOT", + "mseconds", + "noaa", + "NOAA", + "nyquist", + "rsbs" + ] +} \ No newline at end of file diff --git a/API.md b/API.md new file mode 100644 index 0000000..40fd2aa --- /dev/null +++ b/API.md @@ -0,0 +1,303 @@ +## Classes + +
+
Level2Radar
+
+
+ +## Typedefs + +
+
HighResData : object
+

See NOAA documentation for detailed meanings of these values.

+
+
MessageHeader : object
+

See NOAA documentation for detailed meanings of these values.

+
+
Radial
+
+
Volume
+
+
+ + + +## Level2Radar +**Kind**: global class + +* [Level2Radar](#Level2Radar) + * [new Level2Radar(file, [options])](#new_Level2Radar_new) + * _instance_ + * _Configuration_ + * [.setElevation(elevation)](#Level2Radar+setElevation) + * _Data_ + * [.getAzimuth([scan])](#Level2Radar+getAzimuth) ⇒ number \| Array.<number> + * [.getHighresReflectivity([scan])](#Level2Radar+getHighresReflectivity) ⇒ [HighResData](#HighResData) \| [Array.<HighResData>](#HighResData) + * [.getHighresVelocity([scan])](#Level2Radar+getHighresVelocity) ⇒ [HighResData](#HighResData) \| [Array.<HighResData>](#HighResData) + * [.getHighresSpectrum([scan])](#Level2Radar+getHighresSpectrum) ⇒ [HighResData](#HighResData) \| [Array.<HighResData>](#HighResData) + * [.getHighresDiffReflectivity([scan])](#Level2Radar+getHighresDiffReflectivity) ⇒ [HighResData](#HighResData) \| [Array.<HighResData>](#HighResData) + * [.getHighresDiffPhase([scan])](#Level2Radar+getHighresDiffPhase) ⇒ [HighResData](#HighResData) \| [Array.<HighResData>](#HighResData) + * [.getHighresCorrelationCoefficient([scan])](#Level2Radar+getHighresCorrelationCoefficient) ⇒ [HighResData](#HighResData) \| [Array.<HighResData>](#HighResData) + * _Metadata_ + * [.getScans()](#Level2Radar+getScans) ⇒ number + * [.getHeader([scan])](#Level2Radar+getHeader) ⇒ [MessageHeader](#MessageHeader) + * [.listElevations()](#Level2Radar+listElevations) ⇒ Array.<number> + * _static_ + * [.combineData(...data)](#Level2Radar.combineData) ⇒ [Level2Radar](#Level2Radar) + + + +### 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)](https://www.roc.noaa.gov/wsr88d/PublicDocs/ICDs/2620002U.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. + + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| file | Buffer \| [Level2Radar](#Level2Radar) | | 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() and error() function. | + + + +### level2Radar.setElevation(elevation) +Sets the elevation in use for get* methods + +**Kind**: instance method of [Level2Radar](#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](#Level2Radar) +**Returns**: number \| Array.<number> - Azimuth angle +**Category**: Data + +| Param | Type | Description | +| --- | --- | --- | +| [scan] | number | Selected scan | + + + +### level2Radar.getHighresReflectivity([scan]) ⇒ [HighResData](#HighResData) \| [Array.<HighResData>](#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](#Level2Radar) +**Returns**: [HighResData](#HighResData) \| [Array.<HighResData>](#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](#HighResData) \| [Array.<HighResData>](#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](#Level2Radar) +**Returns**: [HighResData](#HighResData) \| [Array.<HighResData>](#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](#HighResData) \| [Array.<HighResData>](#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](#Level2Radar) +**Returns**: [HighResData](#HighResData) \| [Array.<HighResData>](#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](#HighResData) \| [Array.<HighResData>](#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](#Level2Radar) +**Returns**: [HighResData](#HighResData) \| [Array.<HighResData>](#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](#HighResData) \| [Array.<HighResData>](#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](#Level2Radar) +**Returns**: [HighResData](#HighResData) \| [Array.<HighResData>](#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](#HighResData) \| [Array.<HighResData>](#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](#Level2Radar) +**Returns**: [HighResData](#HighResData) \| [Array.<HighResData>](#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.getScans() ⇒ number +Return the number of scans in the current elevation + +**Kind**: instance method of [Level2Radar](#Level2Radar) +**Category**: Metadata + + +### level2Radar.getHeader([scan]) ⇒ [MessageHeader](#MessageHeader) +Return message_header information for all scans or a specific scan for the selected elevation + +**Kind**: instance method of [Level2Radar](#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](#Level2Radar) +**Category**: Metadata + + +### Level2Radar.combineData(...data) ⇒ [Level2Radar](#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](#Level2Radar) +**Returns**: [Level2Radar](#Level2Radar) - Combined data + +| Param | Type | Description | +| --- | --- | --- | +| ...data | [Level2Radar](#Level2Radar) | Data to combine | + + + +## 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](#HighResData) | +| radial | [Radial](#Radial) | +| radial_length | number | +| radial_number | number | +| [reflect] | [HighResData](#HighResData) | +| [rho] | [HighResData](#HighResData) | +| rs | number | +| rsbs | number | +| spectrum | [HighResData](#HighResData) | +| sp | number | +| volume | [Volume](#Volume) | +| [velocity] | [HighResData](#HighResData) | +| [zdr] | [HighResData](#HighResData) | + + + +## Radial +**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 +**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 | | + diff --git a/README.md b/README.md index d51ce6e..da558bd 100644 --- a/README.md +++ b/README.md @@ -49,11 +49,13 @@ new Level2Radar(rawData).then(radar => { ## API ### Constructor(rawData, 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)](https://www.roc.noaa.gov/wsr88d/PublicDocs/ICDs/2620002U.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. These are detailed below. + +Complete [API documentation](API.md) + |option|Description| |--|--| -|options.logger|By default error and information messages will be written to the console. These can be supressed by passing false, or a custom logger can be provided. A custom logger must provide the ``log()`` and ``error()`` function.| +|options.logger|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()`` function.| ## Level2Data.combineData(data, [data, data], ...) 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. diff --git a/docs/Level2Radar.html b/docs/Level2Radar.html new file mode 100644 index 0000000..0ff4781 --- /dev/null +++ b/docs/Level2Radar.html @@ -0,0 +1,2314 @@ + + + + + + + Documentation Class: Level2Radar + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: Level2Radar

+
+ +
+ +

+ Level2Radar +

+ + +
+ + +
+
+ + +
+
+

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)](https://www.roc.noaa.gov/wsr88d/PublicDocs/ICDs/2620002U.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. +
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
file + + +Buffer +| + +Level2Radar + + + + + + + + + + + Buffer with Nexrad Level 2 data. Alternatively a Level2Radar object, typically used internally when combining data.
options + + +object + + + + + + + <optional>
+ + + + + +
Parser options +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
logger + + +object +| + +boolean + + + + + + + <optional>
+ + + + + +
+ + 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() function.
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +

Methods

+ +
+ +
+
+

<static> combineData(data)

+ + +
+
+ + +
+ 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. +
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
data + + +Level2Radar + + + + + + + + + + + <repeatable>
+ +
Data to combine
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Combined data +
+ + + +
+
+ Type +
+
+ +Level2Radar + + + +
+
+ + + + + +
+ + + +
+
+

getAzimuth( [scan])

+ + +
+
+ + +
+ 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. +
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
scan + + +number + + + + + + + <optional>
+ + + + + +
Selected scan
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Azimuth angle +
+ + + +
+
+ Type +
+
+ +number +| + +Array.<number> + + + +
+
+ + + + + +
+ + + +
+
+

getHeader( [scan])

+ + +
+
+ + +
+ Return message_header information for all scans or a specific scan for the selected elevation +
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
scan + + +number + + + + + + + <optional>
+ + + + + +
Selected scan, omit to return all scans for this elevation
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +MessageHeader + + + +
+
+ + + + + +
+ + + +
+
+

getHighresCorrelationCoefficient( [scan])

+ + +
+
+ + +
+ Returns an Object of radar correlation coefficient data for the current elevation and scan (or all scans if not provided) +
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
scan + + +number + + + + + + + <optional>
+ + + + + +
Selected scan or null for all scans in elevation
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Scan's high res correlation coefficient data, or an array of the data. +
+ + + +
+
+ Type +
+
+ +HighResData +| + +Array.<HighResData> + + + +
+
+ + + + + +
+ + + +
+
+

getHighresDiffPhase( [scan])

+ + +
+
+ + +
+ Returns an Object of radar differential phase data for the current elevation and scan (or all scans if not provided) +
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
scan + + +number + + + + + + + <optional>
+ + + + + +
Selected scan or null for all scans in elevation
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Scan's high res differential phase data, or an array of the data. +
+ + + +
+
+ Type +
+
+ +HighResData +| + +Array.<HighResData> + + + +
+
+ + + + + +
+ + + +
+
+

getHighresDiffReflectivity( [scan])

+ + +
+
+ + +
+ Returns an Object of radar differential reflectivity data for the current elevation and scan (or all scans if not provided) +
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
scan + + +number + + + + + + + <optional>
+ + + + + +
Selected scan or null for all scans in elevation
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Scan's high res differential reflectivity data, or an array of the data. +
+ + + +
+
+ Type +
+
+ +HighResData +| + +Array.<HighResData> + + + +
+
+ + + + + +
+ + + +
+
+

getHighresReflectivity( [scan])

+ + +
+
+ + +
+ Returns an Object of radar reflectivity data for the current elevation and scan (or all scans if not provided) +
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
scan + + +number + + + + + + + <optional>
+ + + + + +
Selected scan or null for all scans in elevation
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Scan's high res reflectivity data, or an array of the data. +
+ + + +
+
+ Type +
+
+ +HighResData +| + +Array.<HighResData> + + + +
+
+ + + + + +
+ + + +
+
+

getHighresSpectrum( [scan])

+ + +
+
+ + +
+ Returns an Object of radar spectrum data for the current elevation and scan (or all scans if not provided) +
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
scan + + +number + + + + + + + <optional>
+ + + + + +
Selected scan, or null for all scans in this elevation
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Scan's high res spectrum data, or an array of the data. +
+ + + +
+
+ Type +
+
+ +HighResData +| + +Array.<HighResData> + + + +
+
+ + + + + +
+ + + +
+
+

getHighresVelocity( [scan])

+ + +
+
+ + +
+ Returns an Object of radar velocity data for the current elevation and scan (or all scans if not provided) +
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
scan + + +number + + + + + + + <optional>
+ + + + + +
Selected scan, or null for all scans in this elevation
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Scan's high res velocity data, or an array of the data. +
+ + + +
+
+ Type +
+
+ +HighResData +| + +Array.<HighResData> + + + +
+
+ + + + + +
+ + + +
+
+

getScans()

+ + +
+
+ + +
+ Return the number of scans in the current elevation +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +number + + + +
+
+ + + + + +
+ + + +
+
+

listElevations()

+ + +
+
+ + +
+ List all available elevations +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array.<number> + + + +
+
+ + + + + +
+ + + +
+
+

setElevation(elevation)

+ + +
+
+ + +
+ Sets the elevation in use for get* methods +
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
elevation + + +number + + + + + Selected elevation number
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/classes.list.html b/docs/classes.list.html new file mode 100644 index 0000000..b175055 --- /dev/null +++ b/docs/classes.list.html @@ -0,0 +1,296 @@ + + + + + + + Documentation Classes + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Classes

+
+ +
+ +

+ +

+ + +
+ + +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + +

Classes

+ +
+
Level2Radar
+
+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/glyphicons-halflings-regular.eot b/docs/fonts/glyphicons-halflings-regular.eot new file mode 100644 index 0000000..b93a495 Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.eot differ diff --git a/docs/fonts/glyphicons-halflings-regular.svg b/docs/fonts/glyphicons-halflings-regular.svg new file mode 100644 index 0000000..94fb549 --- /dev/null +++ b/docs/fonts/glyphicons-halflings-regular.svg @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/glyphicons-halflings-regular.ttf b/docs/fonts/glyphicons-halflings-regular.ttf new file mode 100644 index 0000000..1413fc6 Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.ttf differ diff --git a/docs/fonts/glyphicons-halflings-regular.woff b/docs/fonts/glyphicons-halflings-regular.woff new file mode 100644 index 0000000..9e61285 Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.woff differ diff --git a/docs/fonts/glyphicons-halflings-regular.woff2 b/docs/fonts/glyphicons-halflings-regular.woff2 new file mode 100644 index 0000000..64539b5 Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.woff2 differ diff --git a/docs/global.html b/docs/global.html new file mode 100644 index 0000000..bafab27 --- /dev/null +++ b/docs/global.html @@ -0,0 +1,2323 @@ + + + + + + + Documentation Global + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Global

+
+ +
+ +

+ +

+ + +
+ + +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + +

Type Definitions

+ +
+ +
+
+

HighResData

+ + +
+
+ +
+ See NOAA documentation for detailed meanings of these values. +
+ + + +
Type:
+
    +
  • + +object + + + +
  • +
+ + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
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

+ + +
+
+ +
+ See NOAA documentation for detailed meanings of these values. +
+ + + +
Type:
+
    +
  • + +object + + + +
  • +
+ + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
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 + + + + + + + <optional>
+ + + +
rho + + +HighResData + + + + + + + <optional>
+ + + +
rs + + +number + + + + + + + + +
rsbs + + +number + + + + + + + + +
spectrum + + +HighResData + + + + + + + + +
sp + + +number + + + + + + + + +
volume + + +Volume + + + + + + + + +
velocity + + +HighResData + + + + + + + <optional>
+ + + +
zdr + + +HighResData + + + + + + + <optional>
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+
+

Radial

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
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

+ + +
+
+ + + + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
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 + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ +
+ + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/img/glyphicons-halflings-white.png b/docs/img/glyphicons-halflings-white.png new file mode 100644 index 0000000..3bf6484 Binary files /dev/null and b/docs/img/glyphicons-halflings-white.png differ diff --git a/docs/img/glyphicons-halflings.png b/docs/img/glyphicons-halflings.png new file mode 100644 index 0000000..a996999 Binary files /dev/null and b/docs/img/glyphicons-halflings.png differ diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..42f501f --- /dev/null +++ b/docs/index.html @@ -0,0 +1,458 @@ + + + + + + + Documentation Index + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + +
+

nexrad-level-2-data

+
+

A javascript implementation for decoding Nexrad Level II radar archive files.

+
+

You can find more information on how radar data is encoded at NOAA mainly in the document ICD FOR RDA/RPG - Build RDA 20.0/RPG 20.0 (PDF)

+

Contents

+
    +
  1. Changes in v2.0.0
  2. +
  3. Install
  4. +
  5. Usage
  6. +
  7. API
  8. +
  9. Testing
  10. +
  11. Error Recovery and handling
  12. +
  13. Supported Messages
  14. +
  15. Acknowledgements
  16. +
+

Changes in v2.0.0

+

v2.0.0 is a major overhaul of the parsing engine and has several breaking changes. See UPGRADE.md for detailed breaking changes.

+
    +
  • Allow for processing of "chunks" in addition to entire volume scan archives. +
      +
    • Chunks (real time data) is provided by Unidata in the s3 bucket s3://unidata-nexrad-level2-chunks/
    • +
    • Full archives are provided by Unidata in the s3 bucket s3://noaa-nexrad-level2
    • +
    • When processing a chunk all data may not be populated in the resulting object. This is deatiled in UPGRADE.md
    • +
    +
  • +
  • Improve error reporting by throwing when data is not present or invalid elevations or scans are accessed.
  • +
  • Unify the data accessor functions (breaking change)
  • +
  • Follow NOAA convention of the lowest elevation being 1, and properly sort elevations above 1 into a sparse array (breaking change)
  • +
  • Provide a mechanism for consolidating data read from several chunks.
  • +
+

Install

+
$ npm i nexrad-level-2-data
+
+

Usage

+
const { Level2Radar } = require('nexrad-level-2-data')
+const fs = require('fs');
+const file_to_load = "./data/KTLX20130420_205120_V06" // The radar archive file to load
+
+const rawData = fs.readFileSync(file_to_load);
+
+new Level2Radar(rawData).then(radar => {
+    console.log(radar.getHighresReflectivity())
+})
+
+

API

+

Constructor(rawData, options)

+

Complete API documentation

+ + + + + + + + + + + + + +
optionDescription
options.loggerBy 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() function.
+

Level2Data.combineData(data, [data, data], ...)

+

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.

+

setElevation(Number elevation)

+

Sets the elevation you want to grab the data from

+

getHighresReflectivity([scan])

+

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

+
{ 
+  gate_count: Number,
+	first_gate: Number,
+	gate_size: Number,
+	rf_threshold: Number,
+	snr_threshold: Number,
+	scale: Number,
+	offset: Number,
+	data_offset: Number,
+	moment_data: Array
+}
+
+

getHighresVelocity([scan])

+

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

+
{ 
+  gate_count: Number,
+	first_gate: Number,
+	gate_size: Number,
+	rf_threshold: Number,
+	snr_threshold: Number,
+	scale: Number,
+	offset: Number,
+	data_offset: Number,
+	moment_data: Array
+}
+
+

getHighresSpectrum([scan])

+

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

+
{ 
+  gate_count: Number,
+	first_gate: Number,
+	gate_size: Number,
+	rf_threshold: Number,
+	snr_threshold: Number,
+	scale: Number,
+	offset: Number,
+	data_offset: Number,
+	moment_data: Array
+}
+
+

getHighresDiffReflectivity([scan])

+

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

+
{ 
+  gate_count: Number,
+	first_gate: Number,
+	gate_size: Number,
+	rf_threshold: Number,
+	snr_threshold: Number,
+	scale: Number,
+	offset: Number,
+	data_offset: Number,
+	moment_data: Array
+}
+
+

getHighresDiffPhase([scan])

+

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

+
{ 
+  gate_count: Number,
+	first_gate: Number,
+	gate_size: Number,
+	rf_threshold: Number,
+	snr_threshold: Number,
+	scale: Number,
+	offset: Number,
+	data_offset: Number,
+	moment_data: Array
+}
+
+

getHighresCorrelationCoefficient([scan])

+

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

+
{ 
+  gate_count: Number,
+	first_gate: Number,
+	gate_size: Number,
+	rf_threshold: Number,
+	snr_threshold: Number,
+	scale: Number,
+	offset: Number,
+	data_offset: Number,
+	moment_data: Array
+}
+
+

getAzimuth([scan])

+

Returns an single azimuth value or array of azimuth values forthe 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 above.

+

Testing

+

A formal testing suite is not provided. Several test-*.js are provided with matching data in the ./data folder. These can be run individually as shown below.

+
node test.js
+node test-chunks.js
+node test-error.js
+
+

The output of each test script is sent to the console.

+

Error recovery and handling

+

This library will throw on many errors including:

+
    +
  • Buffer not provided for parsing
  • +
  • Calling a data accessor on non-existant data such as invalid elevations or azimuths
  • +
  • A successfully parsed file that did not contain any data
  • +
  • A cursory check on data validity is done by checking the ICAO identifier of each record in the file before further parsing occurs.
  • +
  • Basic file length checks against offsets and block lengths listed in the file. +The Nexrad archives and chunks do contain errors when read from the Unidata archives in s3 buckets s3://noaa-nexrad-level2 and s3://unidata-nexrad-level2-chunks/. A very basic attempt is made to detect these errors, discard the affected record and find the begining of the next record. This does not always succeeded. The following are the possible outcomes:
  • +
  • Successful error detection and skipping to a known good block. +
      +
    • Logs to console Invlaid record id or Invalid block type
    • +
    • Returns as much data that could be parsed with some gaps in data. The actual gaps are not logged. A manual scan of the Level2Radar.data[] arrays looking at Azimuths would need to be performed to find the gaps in data. However any program calling this routine should be considering the Level2Radar.data[].azimuth data for further processing and thus should be unaffected.
    • +
    • Level2Data.hasGaps is set to true
    • +
    +
  • +
  • Error detection with no skipping to a known good block +
      +
    • Logs to console Invalid record id or Invalid block id
    • +
    • Later logs to console Unable to recover message
    • +
    • Returns as much data that could be parsed.
    • +
    • Level2Data.isTruncated is set to trueThe scripttest-error.jscan be run to test some of this functionality. It parses data in./data/messagesizeerror`.
    • +
    +
  • +
+

Supported Messages

+

Nexrad data is stored as message types. This package currently processes the following messages.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MessageTitleDescription
1Digital Radar DataReflectivity and velocity data. Replaced by message 31 in 2008 which supports a higher resolution.
2RDA Status
5Volume Coverage PatternOverview of the scanning paramaters
7Volume Coverage PatternOverview of the scanning paramaters
31Digital Radar Data Generic FormatReflectivity and velocity data
+

Acknowledgements

+

This work is based on the project of Unidata +and nexrad-radar-data

+
+ + + + + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/quicksearch.html b/docs/quicksearch.html new file mode 100644 index 0000000..dea3972 --- /dev/null +++ b/docs/quicksearch.html @@ -0,0 +1,31 @@ + + + + + + + + + + + + + diff --git a/docs/scripts/docstrap.lib.js b/docs/scripts/docstrap.lib.js new file mode 100644 index 0000000..09d9272 --- /dev/null +++ b/docs/scripts/docstrap.lib.js @@ -0,0 +1,11 @@ +if(!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b="length"in a&&a.length,c=_.type(a);return"function"!==c&&!_.isWindow(a)&&(!(1!==a.nodeType||!b)||("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a))}function d(a,b,c){if(_.isFunction(b))return _.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return _.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(ha.test(b))return _.filter(b,a,c);b=_.filter(b,a)}return _.grep(a,function(a){return U.call(b,a)>=0!==c})}function e(a,b){for(;(a=a[b])&&1!==a.nodeType;);return a}function f(a){var b=oa[a]={};return _.each(a.match(na)||[],function(a,c){b[c]=!0}),b}function g(){Z.removeEventListener("DOMContentLoaded",g,!1),a.removeEventListener("load",g,!1),_.ready()}function h(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=_.expando+h.uid++}function i(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(ua,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c||"false"!==c&&("null"===c?null:+c+""===c?+c:ta.test(c)?_.parseJSON(c):c)}catch(a){}sa.set(a,b,c)}else c=void 0;return c}function j(){return!0}function k(){return!1}function l(){try{return Z.activeElement}catch(a){}}function m(a,b){return _.nodeName(a,"table")&&_.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function n(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function o(a){var b=Ka.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function p(a,b){for(var c=0,d=a.length;d>c;c++)ra.set(a[c],"globalEval",!b||ra.get(b[c],"globalEval"))}function q(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(ra.hasData(a)&&(f=ra.access(a),g=ra.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)_.event.add(b,e,j[e][c])}sa.hasData(a)&&(h=sa.access(a),i=_.extend({},h),sa.set(b,i))}}function r(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&_.nodeName(a,b)?_.merge([a],c):c}function s(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ya.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function t(b,c){var d,e=_(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:_.css(e[0],"display");return e.detach(),f}function u(a){var b=Z,c=Oa[a];return c||(c=t(a,b),"none"!==c&&c||(Na=(Na||_("