netbymatt / nexrad-level-2-data

Retrieve data from Nexrad archive files for plotting
MIT License
11 stars 4 forks source link

Velocity just returns undefined #7

Open u10int opened 1 year ago

u10int commented 1 year ago

I can't seem to get getHighresVelocity() to return data, even by changing the main test to try returning velocity data instead of reflectivity:

const data = await fs.readFile(fileToLoad);
const radar = new Level2Radar(data);
const velocity = radar.getHighresVelocity();

The library just returns an array of undefined for everything:

[undefined, undefined, undefined, undefined, undefined, undefined,
  undefined, undefined, undefined, undefined, undefined, undefined,
  undefined, undefined, undefined, undefined, undefined, undefined,
  undefined, undefined, undefined, undefined,...]

The project's example page is showing real-time velocity output, so maybe I'm just missing something?

netbymatt commented 1 year ago

It's likely that you're looking at the first elevation (default) which often does not contain velocity data. You can use .listElevations() and .getHeader(<elevation>) to find out which elevations have waveforms that include velocity data. Waveform type 1 usually get the default first elevation and doesn't include velocity. Here's an excerpt from the nexrad-level-2-plot library

Waveform types of 1, 2, 3, 4 and 5 are produced by the radar. Type 1 is typically exclusive to reflectivity, Type 2 is typically exclusive to velocity however it also produces reflectivity data. Types 3, 4 and 5 all produce both velocity and reflectivity.

It's also possible that if you're loading chunks (see Changes in v2.0.0 for details) that the chunks that you have selected don't include the velocity data.