From 137840bd5155946c99595f5adafaaf622eff64c2 Mon Sep 17 00:00:00 2001 From: Matt Walsh Date: Wed, 21 Apr 2021 23:05:40 -0500 Subject: [PATCH] correct divide by zero check --- README.md | 2 +- package.json | 2 +- src/packets/utilities/ij.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5035b6a..c3a53e5 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/package.json b/package.json index 8628ad3..9551d76 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/packets/utilities/ij.js b/src/packets/utilities/ij.js index 45717eb..ba42795 100644 --- a/src/packets/utilities/ij.js +++ b/src/packets/utilities/ij.js @@ -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