Skip to content

Commit

Permalink
correct divide by zero check
Browse files Browse the repository at this point in the history
  • Loading branch information
netbymatt committed Apr 22, 2021
1 parent db948e5 commit 137840b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# nexrad-level-3-data

### v0.3.2
### v0.3.3
A javascript implementation for decoding Nexrad Level III radar files.

You can find more information on how radar data is encoded at [NOAA](https://www.roc.noaa.gov/WSR88D/BuildInfo/Files.aspx). The work in this project is based mainly on the document [2620001 ICD FOR THE RPG TO CLASS 1 USER - Build 19.0](https://www.roc.noaa.gov/wsr88d/PublicDocs/ICDs/2620001Y.pdf).
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nexrad-level-3-data",
"version": "0.3.2",
"version": "0.3.3",
"description": "Parsing of NEXRAD level 3 data files",
"main": "src/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/packets/utilities/ij.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const ijToAzDeg = (i, j, rawMax = 4096, range = 248, conversion = 1.15078) => {
const nm = ((Math.sqrt(i ** 2 + j ** 2) / rawMax) * range) * conversion;
let deg = 0;
// short circuit potential divide by zero
if (i !== j) {
if (i === 0) {
// calculate degrees, then rotate due to north = up = 0 deg convention
deg = (Math.atan(-j / i) * 180) / Math.PI + 90;
// coerce to 0<=deg<360
Expand Down

0 comments on commit 137840b

Please sign in to comment.