Files
nexrad-level-2-data/docs/index.html
T

352 lines
11 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Documentation Index</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.simplex.css">
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top ">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="index.html">Documentation</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="topNavigation">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="global.html">Global</a></li>
</ul>
</li>
</ul>
<div class="col-sm-3 col-md-3">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
<div class="input-group-btn">
<button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="container" id="toc-content">
<div class="row">
<div class="col-md-8">
<div id="main">
<section class="readme-section">
<article><h1>nexrad-level-2-data</h1>
<blockquote>
<p>A javascript implementation for decoding Nexrad Level II radar archive files.</p>
</blockquote>
<h1>Demo</h1>
<p>A live demo showing the output of this library (via <a href="https://www.github.com/netbymatt/nexrad-level-2-plot">nexrad-level-2-plot</a>) for select radar sites is available at https://nexrad-demo.netbymatt.com/</p>
<h2>Contents</h2>
<ol>
<li><a href="#changes-in-v300">Changes in v3.0.0</a></li>
<li><a href="#changes-in-v200">Changes in v2.0.0</a></li>
<li><a href="#install">Install</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#api">API</a></li>
<li><a href="#testing">Testing</a></li>
<li><a href="#error-recovery-and-handling">Error Recovery and handling</a></li>
<li><a href="#supported-messages">Supported Messages</a></li>
<li><a href="#source-data-documentation">Source Data Documentation</a></li>
<li><a href="#acknowledgements">Acknowledgements</a></li>
</ol>
<h2>Changes in v2.0.0</h2>
<p>v3.0.0 Changes to ESM and includes performance enhancements of ~30%</p>
<h2>Changes in v2.0.0</h2>
<p>v2.0.0 is a major overhaul of the parsing engine and has several breaking changes. See <a href="UPGRADE.md">UPGRADE.md</a> for detailed breaking changes.</p>
<ul>
<li>Allow for processing of &quot;chunks&quot; in addition to entire volume scan archives.
<ul>
<li>Chunks (real time data) is provided by Unidata in the s3 bucket <code>s3://unidata-nexrad-level2-chunks/</code></li>
<li>Full archives are provided by Unidata in the s3 bucket <code>s3://noaa-nexrad-level2</code></li>
<li>When processing a chunk all data may not be populated in the resulting object. This is deatiled in <a href="UPGRADE.md">UPGRADE.md</a></li>
</ul>
</li>
<li>Improve error reporting by throwing when data is not present or invalid elevations or scans are accessed.</li>
<li>Unify the data accessor functions (breaking change)</li>
<li>Follow NOAA convention of the lowest elevation being 1, and properly sort elevations above 1 into a sparse array (breaking change)</li>
<li>Provide a mechanism for consolidating data read from several chunks.</li>
</ul>
<h2>Install</h2>
<pre class="prettyprint source lang-bash"><code>$ npm i nexrad-level-2-data
</code></pre>
<h2>Usage</h2>
<pre class="prettyprint source lang-javascript"><code>const { Level2Radar } = require('nexrad-level-2-data')
const fs = require('fs');
const file_to_load = &quot;./data/KTLX20130420_205120_V06&quot; // The radar archive file to load
const rawData = fs.readFileSync(file_to_load);
new Level2Radar(rawData).then(radar => {
console.log(radar.getHighresReflectivity())
})
</code></pre>
<h2>API</h2>
<p>Complete <a href="API.md">API documentation</a></p>
<h2>Testing</h2>
<p>A formal testing suite is not provided. Several <code>test-*.js</code> are provided with matching data in the <code>./data</code> folder. These can be run individually as shown below.</p>
<pre class="prettyprint source lang-bash"><code>node test.js
node test-chunks.js
node test-error.js
</code></pre>
<p>The output of each test script is sent to the console.</p>
<h2>Error recovery and handling</h2>
<p>This library will throw on many errors including:</p>
<ul>
<li>Buffer not provided for parsing</li>
<li>Calling a data accessor on non-existant data such as invalid elevations or azimuths</li>
<li>A successfully parsed file that did not contain any data</li>
<li>A cursory check on data validity is done by checking the ICAO identifier of each record in the file before further parsing occurs.</li>
<li>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 <code>s3://noaa-nexrad-level2</code> and <code>s3://unidata-nexrad-level2-chunks/</code>. 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:</li>
<li>Successful error detection and skipping to a known good block.
<ul>
<li>Logs to console <code>Invlaid record id</code> or <code>Invalid block type</code></li>
<li>Returns as much data that could be parsed with some gaps in data. The actual gaps are not logged. A manual scan of the <code>Level2Radar.data[] arrays</code> looking at Azimuths would need to be performed to find the gaps in data. However any program calling this routine should be considering the <code>Level2Radar.data[].azimuth</code> data for further processing and thus should be unaffected.</li>
<li><code>Level2Data.hasGaps</code> is set to <code>true</code></li>
</ul>
</li>
<li>Error detection with no skipping to a known good block
<ul>
<li>Logs to console <code>Invalid record id</code> or <code>Invalid block id</code></li>
<li>Later logs to console <code>Unable to recover message</code></li>
<li>Returns as much data that could be parsed.</li>
<li><code>Level2Data.isTruncated is set to </code>true<code>The script</code>test-error.js<code>can be run to test some of this functionality. It parses data in</code>./data/messagesizeerror`.</li>
</ul>
</li>
</ul>
<h2>Supported Messages</h2>
<p>Nexrad data is stored as message types. This package currently processes the following messages.</p>
<table>
<thead>
<tr>
<th>Message</th>
<th>Title</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Digital Radar Data</td>
<td>Reflectivity and velocity data. Replaced by message 31 in 2008 which supports a higher resolution.</td>
</tr>
<tr>
<td>2</td>
<td>RDA Status</td>
<td></td>
</tr>
<tr>
<td>5</td>
<td>Volume Coverage Pattern</td>
<td>Overview of the scanning paramaters</td>
</tr>
<tr>
<td>7</td>
<td>Volume Coverage Pattern</td>
<td>Overview of the scanning paramaters</td>
</tr>
<tr>
<td>31</td>
<td>Digital Radar Data Generic Format</td>
<td>Reflectivity and velocity data</td>
</tr>
</tbody>
</table>
<h2>Source Data Documentation</h2>
<p>You can find more information on how radar data is encoded at <a href="https://www.roc.noaa.gov/WSR88D/BuildInfo/Files.aspx">NOAA</a> mainly in the document <a href="https://www.roc.noaa.gov/wsr88d/PublicDocs/ICDs/2620002U.pdf">ICD FOR RDA/RPG - Build RDA 20.0/RPG 20.0 (PDF)</a></p>
<h2>Acknowledgements</h2>
<p>This work is based on the project of <a href="https://github.com/Unidata/thredds/blob/master/cdm/src/main/java/ucar/nc2/iosp/nexrad2/">Unidata</a>
and <a href="https://github.com/bartholomew91/nexrad-radar-data">nexrad-radar-data</a></p></article>
</section>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-3">
<div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div>
</div>
</div>
</div>
<div class="modal fade" id="searchResults">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Search results</h4>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<footer>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a>
on 2026-08-11T23:20:45-05:00
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
</footer>
<script src="scripts/docstrap.lib.js"></script>
<script src="scripts/toc.js"></script>
<script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
<script>
$( function () {
$( "[id*='$']" ).each( function () {
var $this = $( this );
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
} );
$( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () {
var $this = $( this );
var example = $this.find( "code" );
exampleText = example.html();
var lang = /{@lang (.*?)}/.exec( exampleText );
if ( lang && lang[1] ) {
exampleText = exampleText.replace( lang[0], "" );
example.html( exampleText );
lang = lang[1];
} else {
var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
lang = langClassMatch ? langClassMatch[1] : "javascript";
}
if ( lang ) {
$this
.addClass( "sunlight-highlight-" + lang )
.addClass( "linenums" )
.html( example.html() );
}
} );
Sunlight.highlightAll( {
lineNumbers : false,
showMenu : true,
enableDoclinks : true
} );
$.catchAnchorLinks( {
navbarOffset: 10
} );
$( "#toc" ).toc( {
anchorName : function ( i, heading, prefix ) {
return $( heading ).attr( "id" ) || ( prefix + i );
},
selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
showAndHide : false,
smoothScrolling: true
} );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
$( '.dropdown-toggle' ).dropdown();
$( "table" ).each( function () {
var $this = $( this );
$this.addClass('table');
} );
} );
</script>
<!--Navigation and Symbol Display-->
<!--Google Analytics-->
<script type="text/javascript">
$(document).ready(function() {
SearcherDisplay.init();
});
</script>
</body>
</html>